@irsdk-node/native 4.1.1 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -1
- package/dist/cjs/index.cjs +9454 -0
- package/dist/esm/index.js +9441 -0
- package/dist/types/INativeSDK.d.ts +24 -0
- package/dist/types/MockSdk.d.ts +31 -0
- package/dist/types/index.d.ts +4 -0
- package/lib/irsdk_client.cpp +94 -94
- package/lib/irsdk_client.h +23 -23
- package/lib/irsdk_defines.h +136 -82
- package/lib/irsdk_diskclient.cpp +997 -0
- package/lib/irsdk_diskclient.h +205 -0
- package/lib/irsdk_node.cc +336 -283
- package/lib/irsdk_utils.cpp +71 -71
- package/lib/yaml_parser.cpp +41 -41
- package/lib/yaml_parser.h +1 -1
- package/package.json +27 -29
- package/prebuilds/darwin-arm64/@irsdk-node+native.node +0 -0
- package/prebuilds/win32-x64/@irsdk-node+native.node +0 -0
- package/dist/INativeSDK.d.ts +0 -28
- package/dist/INativeSDK.js +0 -2
- package/dist/MockSdk.d.ts +0 -43
- package/dist/MockSdk.js +0 -70
- package/dist/mock-data/loader.js +0 -41
- package/dist/mock-data/session.json +0 -4305
- package/dist/mock-data/telemetry.json +0 -4986
- package/index.d.ts +0 -87
- package/index.js +0 -36
- package/scripts/generate-var-types.js +0 -71
- /package/dist/{mock-data → types/mock-data}/loader.d.ts +0 -0
package/lib/irsdk_defines.h
CHANGED
|
@@ -84,13 +84,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
84
84
|
#include <tchar.h>
|
|
85
85
|
|
|
86
86
|
static const _TCHAR IRSDK_DATAVALIDEVENTNAME[] = _T("Local\\IRSDKDataValidEvent");
|
|
87
|
-
static const _TCHAR IRSDK_MEMMAPFILENAME[]
|
|
88
|
-
static const _TCHAR IRSDK_BROADCASTMSGNAME[]
|
|
87
|
+
static const _TCHAR IRSDK_MEMMAPFILENAME[] = _T("Local\\IRSDKMemMapFileName");
|
|
88
|
+
static const _TCHAR IRSDK_BROADCASTMSGNAME[] = _T("IRSDK_BROADCASTMSG");
|
|
89
89
|
|
|
90
90
|
static const int IRSDK_MAX_BUFS = 4;
|
|
91
91
|
static const int IRSDK_MAX_STRING = 32;
|
|
92
92
|
// descriptions can be longer than max_string!
|
|
93
|
-
static const int IRSDK_MAX_DESC = 64;
|
|
93
|
+
static const int IRSDK_MAX_DESC = 64;
|
|
94
94
|
|
|
95
95
|
// define markers for unlimited session lap and time
|
|
96
96
|
static const int IRSDK_UNLIMITED_LAPS = 32767;
|
|
@@ -134,60 +134,16 @@ static const int irsdk_VarTypeBytes[irsdk_ETCount] =
|
|
|
134
134
|
8 // irsdk_double
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
enum irsdk_EngineWarnings
|
|
139
|
-
{
|
|
140
|
-
irsdk_waterTempWarning = 0x01,
|
|
141
|
-
irsdk_fuelPressureWarning = 0x02,
|
|
142
|
-
irsdk_oilPressureWarning = 0x04,
|
|
143
|
-
irsdk_engineStalled = 0x08,
|
|
144
|
-
irsdk_pitSpeedLimiter = 0x10,
|
|
145
|
-
irsdk_revLimiterActive = 0x20,
|
|
146
|
-
irsdk_oilTempWarning = 0x40,
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
// global flags
|
|
150
|
-
enum irsdk_Flags
|
|
151
|
-
{
|
|
152
|
-
// global flags
|
|
153
|
-
irsdk_checkered = 0x00000001,
|
|
154
|
-
irsdk_white = 0x00000002,
|
|
155
|
-
irsdk_green = 0x00000004,
|
|
156
|
-
irsdk_yellow = 0x00000008,
|
|
157
|
-
irsdk_red = 0x00000010,
|
|
158
|
-
irsdk_blue = 0x00000020,
|
|
159
|
-
irsdk_debris = 0x00000040,
|
|
160
|
-
irsdk_crossed = 0x00000080,
|
|
161
|
-
irsdk_yellowWaving = 0x00000100,
|
|
162
|
-
irsdk_oneLapToGreen = 0x00000200,
|
|
163
|
-
irsdk_greenHeld = 0x00000400,
|
|
164
|
-
irsdk_tenToGo = 0x00000800,
|
|
165
|
-
irsdk_fiveToGo = 0x00001000,
|
|
166
|
-
irsdk_randomWaving = 0x00002000,
|
|
167
|
-
irsdk_caution = 0x00004000,
|
|
168
|
-
irsdk_cautionWaving = 0x00008000,
|
|
169
|
-
|
|
170
|
-
// drivers black flags
|
|
171
|
-
irsdk_black = 0x00010000,
|
|
172
|
-
irsdk_disqualify = 0x00020000,
|
|
173
|
-
irsdk_servicible = 0x00040000, // car is allowed service (not a flag)
|
|
174
|
-
irsdk_furled = 0x00080000,
|
|
175
|
-
irsdk_repair = 0x00100000,
|
|
176
|
-
|
|
177
|
-
// start lights
|
|
178
|
-
irsdk_startHidden = 0x10000000,
|
|
179
|
-
irsdk_startReady = 0x20000000,
|
|
180
|
-
irsdk_startSet = 0x40000000,
|
|
181
|
-
irsdk_startGo = 0x80000000,
|
|
182
|
-
};
|
|
183
|
-
|
|
137
|
+
//---
|
|
184
138
|
|
|
185
139
|
// status
|
|
186
140
|
enum irsdk_TrkLoc
|
|
187
141
|
{
|
|
188
142
|
irsdk_NotInWorld = -1,
|
|
189
|
-
irsdk_OffTrack,
|
|
143
|
+
irsdk_OffTrack = 0,
|
|
190
144
|
irsdk_InPitStall,
|
|
145
|
+
// This indicates the lead in to pit road, as well as the pit road itself (where speed limits are enforced)
|
|
146
|
+
// if you just want to know that your on the pit road surface look at the live value 'OnPitRoad'
|
|
191
147
|
irsdk_AproachingPits,
|
|
192
148
|
irsdk_OnTrack
|
|
193
149
|
};
|
|
@@ -240,7 +196,7 @@ enum irsdk_SessionState
|
|
|
240
196
|
|
|
241
197
|
enum irsdk_CarLeftRight
|
|
242
198
|
{
|
|
243
|
-
irsdk_LROff,
|
|
199
|
+
irsdk_LROff = 0,
|
|
244
200
|
irsdk_LRClear, // no cars around us.
|
|
245
201
|
irsdk_LRCarLeft, // there is a car to our left.
|
|
246
202
|
irsdk_LRCarRight, // there is a car to our right.
|
|
@@ -249,6 +205,124 @@ enum irsdk_CarLeftRight
|
|
|
249
205
|
irsdk_LR2CarsRight // there are two cars to our right.
|
|
250
206
|
};
|
|
251
207
|
|
|
208
|
+
enum irsdk_PitSvStatus
|
|
209
|
+
{
|
|
210
|
+
// status
|
|
211
|
+
irsdk_PitSvNone = 0,
|
|
212
|
+
irsdk_PitSvInProgress,
|
|
213
|
+
irsdk_PitSvComplete,
|
|
214
|
+
|
|
215
|
+
// errors
|
|
216
|
+
irsdk_PitSvTooFarLeft = 100,
|
|
217
|
+
irsdk_PitSvTooFarRight,
|
|
218
|
+
irsdk_PitSvTooFarForward,
|
|
219
|
+
irsdk_PitSvTooFarBack,
|
|
220
|
+
irsdk_PitSvBadAngle,
|
|
221
|
+
irsdk_PitSvCantFixThat,
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
enum irsdk_PaceMode
|
|
225
|
+
{
|
|
226
|
+
irsdk_PaceModeSingleFileStart = 0,
|
|
227
|
+
irsdk_PaceModeDoubleFileStart,
|
|
228
|
+
irsdk_PaceModeSingleFileRestart,
|
|
229
|
+
irsdk_PaceModeDoubleFileRestart,
|
|
230
|
+
irsdk_PaceModeNotPacing,
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
enum irsdk_TrackWetness
|
|
234
|
+
{
|
|
235
|
+
irsdk_TrackWetness_UNKNOWN = 0,
|
|
236
|
+
irsdk_TrackWetness_Dry,
|
|
237
|
+
irsdk_TrackWetness_MostlyDry,
|
|
238
|
+
irsdk_TrackWetness_VeryLightlyWet,
|
|
239
|
+
irsdk_TrackWetness_LightlyWet,
|
|
240
|
+
irsdk_TrackWetness_ModeratelyWet,
|
|
241
|
+
irsdk_TrackWetness_VeryWet,
|
|
242
|
+
irsdk_TrackWetness_ExtremelyWet
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
enum irsdk_IncidentFlags
|
|
246
|
+
{
|
|
247
|
+
// first byte is incident report flag
|
|
248
|
+
// only one of these will be used
|
|
249
|
+
irsdk_Incident_RepNoReport = 0x0000, // no penalty
|
|
250
|
+
irsdk_Incident_RepOutOfControl = 0x0001, // "Loss of Control (2x)"
|
|
251
|
+
irsdk_Incident_RepOffTrack = 0x0002, // "Off Track (1x)"
|
|
252
|
+
irsdk_Incident_RepOffTrackOngoing = 0x0003, // not currently sent
|
|
253
|
+
irsdk_Incident_RepContactWithWorld = 0x0004, // "Contact (0x)"
|
|
254
|
+
irsdk_Incident_RepCollisionWithWorld = 0x0005, // "Contact (2x)"
|
|
255
|
+
irsdk_Incident_RepCollisionWithWorldOngoing = 0x0006, // not currently sent
|
|
256
|
+
irsdk_Incident_RepContactWithCar = 0x0007, // "Car Contact (0x)"
|
|
257
|
+
irsdk_Incident_RepCollisionWithCar = 0x0008, // "Car Contact (4x)"
|
|
258
|
+
|
|
259
|
+
// second byte is incident penalty
|
|
260
|
+
// only one of these will be used
|
|
261
|
+
irsdk_Incident_PenNoReport = 0x0000, // no penalty
|
|
262
|
+
irsdk_Incident_PenZeroX = 0x0100, // 0x
|
|
263
|
+
irsdk_Incident_PenOneX = 0x0200, // 1x
|
|
264
|
+
irsdk_Incident_PenTwoX = 0x0300, // 2x
|
|
265
|
+
irsdk_Incident_PenFourX = 0x0400, // 4x
|
|
266
|
+
|
|
267
|
+
// not enums, used to seperate the above incident report field
|
|
268
|
+
// from the incident penalty field
|
|
269
|
+
IRSDK_INCIDENT_REP_MASK = 0x000000FF,
|
|
270
|
+
IRSDK_INCIDENT_PEN_MASK = 0x0000FF00,
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
//---
|
|
274
|
+
|
|
275
|
+
// bit fields
|
|
276
|
+
enum irsdk_EngineWarnings
|
|
277
|
+
{
|
|
278
|
+
irsdk_waterTempWarning = 0x0001,
|
|
279
|
+
irsdk_fuelPressureWarning = 0x0002,
|
|
280
|
+
irsdk_oilPressureWarning = 0x0004,
|
|
281
|
+
irsdk_engineStalled = 0x0008,
|
|
282
|
+
irsdk_pitSpeedLimiter = 0x0010,
|
|
283
|
+
irsdk_revLimiterActive = 0x0020,
|
|
284
|
+
irsdk_oilTempWarning = 0x0040,
|
|
285
|
+
|
|
286
|
+
irsdk_mandRepNeeded = 0x0080, // car needs mandatory repairs
|
|
287
|
+
irsdk_optRepNeeded = 0x0100, // car needs optional repairs
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
// global flags
|
|
291
|
+
enum irsdk_Flags
|
|
292
|
+
{
|
|
293
|
+
// global flags
|
|
294
|
+
irsdk_checkered = 0x00000001,
|
|
295
|
+
irsdk_white = 0x00000002,
|
|
296
|
+
irsdk_green = 0x00000004,
|
|
297
|
+
irsdk_yellow = 0x00000008,
|
|
298
|
+
irsdk_red = 0x00000010,
|
|
299
|
+
irsdk_blue = 0x00000020,
|
|
300
|
+
irsdk_debris = 0x00000040,
|
|
301
|
+
irsdk_crossed = 0x00000080,
|
|
302
|
+
irsdk_yellowWaving = 0x00000100,
|
|
303
|
+
irsdk_oneLapToGreen = 0x00000200,
|
|
304
|
+
irsdk_greenHeld = 0x00000400,
|
|
305
|
+
irsdk_tenToGo = 0x00000800,
|
|
306
|
+
irsdk_fiveToGo = 0x00001000,
|
|
307
|
+
irsdk_randomWaving = 0x00002000,
|
|
308
|
+
irsdk_caution = 0x00004000,
|
|
309
|
+
irsdk_cautionWaving = 0x00008000,
|
|
310
|
+
|
|
311
|
+
// drivers black flags
|
|
312
|
+
irsdk_black = 0x00010000,
|
|
313
|
+
irsdk_disqualify = 0x00020000,
|
|
314
|
+
irsdk_servicible = 0x00040000, // car is allowed service (not a flag)
|
|
315
|
+
irsdk_furled = 0x00080000,
|
|
316
|
+
irsdk_repair = 0x00100000,
|
|
317
|
+
irsdk_dqScoringInvalid = 0x00200000, // car is disqualified and scoring is disabled
|
|
318
|
+
|
|
319
|
+
// start lights
|
|
320
|
+
irsdk_startHidden = 0x10000000,
|
|
321
|
+
irsdk_startReady = 0x20000000,
|
|
322
|
+
irsdk_startSet = 0x40000000,
|
|
323
|
+
irsdk_startGo = 0x80000000,
|
|
324
|
+
};
|
|
325
|
+
|
|
252
326
|
enum irsdk_CameraState
|
|
253
327
|
{
|
|
254
328
|
irsdk_IsSessionScreen = 0x0001, // the camera tool can only be activated if viewing the session screen (out of car)
|
|
@@ -276,36 +350,11 @@ enum irsdk_PitSvFlags
|
|
|
276
350
|
irsdk_FastRepair = 0x0040
|
|
277
351
|
};
|
|
278
352
|
|
|
279
|
-
enum irsdk_PitSvStatus
|
|
280
|
-
{
|
|
281
|
-
// status
|
|
282
|
-
irsdk_PitSvNone = 0,
|
|
283
|
-
irsdk_PitSvInProgress,
|
|
284
|
-
irsdk_PitSvComplete,
|
|
285
|
-
|
|
286
|
-
// errors
|
|
287
|
-
irsdk_PitSvTooFarLeft = 100,
|
|
288
|
-
irsdk_PitSvTooFarRight,
|
|
289
|
-
irsdk_PitSvTooFarForward,
|
|
290
|
-
irsdk_PitSvTooFarBack,
|
|
291
|
-
irsdk_PitSvBadAngle,
|
|
292
|
-
irsdk_PitSvCantFixThat,
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
enum irsdk_PaceMode
|
|
296
|
-
{
|
|
297
|
-
irsdk_PaceModeSingleFileStart = 0,
|
|
298
|
-
irsdk_PaceModeDoubleFileStart,
|
|
299
|
-
irsdk_PaceModeSingleFileRestart,
|
|
300
|
-
irsdk_PaceModeDoubleFileRestart,
|
|
301
|
-
irsdk_PaceModeNotPacing,
|
|
302
|
-
};
|
|
303
|
-
|
|
304
353
|
enum irsdk_PaceFlags
|
|
305
354
|
{
|
|
306
|
-
irsdk_PaceFlagsEndOfLine =
|
|
307
|
-
irsdk_PaceFlagsFreePass =
|
|
308
|
-
irsdk_PaceFlagsWavedAround =
|
|
355
|
+
irsdk_PaceFlagsEndOfLine = 0x0001,
|
|
356
|
+
irsdk_PaceFlagsFreePass = 0x0002,
|
|
357
|
+
irsdk_PaceFlagsWavedAround = 0x0004,
|
|
309
358
|
};
|
|
310
359
|
|
|
311
360
|
//----
|
|
@@ -361,6 +410,10 @@ struct irsdk_header
|
|
|
361
410
|
|
|
362
411
|
int numBuf; // <= IRSDK_MAX_BUFS (3 for now)
|
|
363
412
|
int bufLen; // length in bytes for one line
|
|
413
|
+
//****ToDo, add these in
|
|
414
|
+
//int curBufTickCount; // stashed copy of the current tickCount, can read this to see if new data is available
|
|
415
|
+
//byte curBuf; // index of the most recently written buffer (0 to IRSDK_MAX_BUFS-1)
|
|
416
|
+
//byte pad1[3]; // 16 byte align
|
|
364
417
|
int pad1[2]; // (16 byte align)
|
|
365
418
|
irsdk_varBuf varBuf[IRSDK_MAX_BUFS]; // buffers of data being written to
|
|
366
419
|
};
|
|
@@ -400,13 +453,13 @@ int irsdk_varNameToOffset(const char *name);
|
|
|
400
453
|
// Remote controll the sim by sending these windows messages
|
|
401
454
|
// camera and replay commands only work when you are out of your car,
|
|
402
455
|
// pit commands only work when in your car
|
|
403
|
-
enum irsdk_BroadcastMsg
|
|
456
|
+
enum irsdk_BroadcastMsg
|
|
404
457
|
{
|
|
405
458
|
irsdk_BroadcastCamSwitchPos = 0, // car position, group, camera
|
|
406
459
|
irsdk_BroadcastCamSwitchNum, // driver #, group, camera
|
|
407
460
|
irsdk_BroadcastCamSetState, // irsdk_CameraState, unused, unused
|
|
408
461
|
irsdk_BroadcastReplaySetPlaySpeed, // speed, slowMotion, unused
|
|
409
|
-
|
|
462
|
+
irsdk_BroadcastReplaySetPlayPosition, // irsdk_RpyPosMode, Frame Number (high, low)
|
|
410
463
|
irsdk_BroadcastReplaySearch, // irsdk_RpySrchMode, unused, unused
|
|
411
464
|
irsdk_BroadcastReplaySetState, // irsdk_RpyStateMode, unused, unused
|
|
412
465
|
irsdk_BroadcastReloadTextures, // irsdk_ReloadTexturesMode, carIdx, unused
|
|
@@ -441,6 +494,7 @@ enum irsdk_PitCommandMode // this only works when the driver is in the car
|
|
|
441
494
|
irsdk_PitCommand_ClearWS, // Uncheck Clean the winshield checkbox
|
|
442
495
|
irsdk_PitCommand_ClearFR, // Uncheck request a fast repair
|
|
443
496
|
irsdk_PitCommand_ClearFuel, // Uncheck add fuel
|
|
497
|
+
irsdk_PitCommand_TC, // Change tire compound
|
|
444
498
|
};
|
|
445
499
|
|
|
446
500
|
enum irsdk_TelemCommandMode // You can call this any time, but telemtry only records when driver is in there car
|