-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathESRecord.cs
More file actions
86 lines (66 loc) · 2.44 KB
/
ESRecord.cs
File metadata and controls
86 lines (66 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace ESRecorder
{
public enum ESRecordState
{
Idle,
Compiling,
Preparing,
Warmup,
Recording
}
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
public struct SampleConfig
{
public bool overrideRevlimit;
public int prerunCount;
public int rpm, throttle, frequency, length;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string output;
};
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
public struct SampleConfigEx
{
public bool overrideRevlimit;
public int prerunCount;
public int rpm, throttle, frequency, length;
public int instanceId;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string output;
}
[StructLayout(LayoutKind.Sequential)]
public struct SampleResult
{
public bool success;
public float power, torque, ratio;
public long millis;
};
public static class ESRecord
{
[DllImport("es/esrecord-lib.dll")]
public static extern bool ESRecord_Compile(int instanceId, string path);
[DllImport("es/esrecord-lib.dll")]
public static extern bool ESRecord_Initialise(int instanceId);
[DllImport("es/esrecord-lib.dll")]
public static extern double ESRecord_Update(int instanceId, float averagefps);
[DllImport("es/esrecord-lib.dll")]
public static extern bool ESRecord_GetSimState(int instanceId);
[DllImport("es/esrecord-lib.dll")]
public static extern ESRecordState ESRecord_GetState(int instanceId, out int progress);
[DllImport("es/esrecord-lib.dll")]
public static extern unsafe string ESRecord_Engine_GetName(int instanceId);
[DllImport("es/esrecord-lib.dll")]
public static extern unsafe float ESRecord_Engine_GetRedline(int instanceId);
[DllImport("es/esrecord-lib.dll")]
public static extern unsafe float ESRecord_Engine_GetDisplacement(int instanceId);
[DllImport("es/esrecord-lib.dll")]
public static extern unsafe SampleResult ESRecord_Record(int instanceId, SampleConfig config);
[DllImport("es/esrecord-lib.dll")]
public static extern int ESRecord_GetVersion();
}
}