Skip to content

Commit 9a3a24b

Browse files
committed
Pull latest sdk update
1 parent e8d3180 commit 9a3a24b

File tree

4 files changed

+107
-93
lines changed

4 files changed

+107
-93
lines changed

index.d.ts

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ declare module 'iracing-sdk-js' {
99
}
1010

1111
// String literal types for various enums
12-
export type TrackSurface =
12+
export type TrackSurface =
1313
| 'NotInWorld'
14-
| 'OffTrack'
14+
| 'OffTrack'
1515
| 'InPitStall'
1616
| 'AproachingPits'
1717
| 'OnTrack';
1818

19-
export type TrackSurfaceMaterial =
19+
export type TrackSurfaceMaterial =
2020
| 'SurfaceNotInWorld'
2121
| 'UndefinedMaterial'
2222
| 'Asphalt1Material'
@@ -47,7 +47,7 @@ declare module 'iracing-sdk-js' {
4747
| 'GrasscreteMaterial'
4848
| 'AstroturfMaterial';
4949

50-
export type SessionState =
50+
export type SessionState =
5151
| 'Invalid'
5252
| 'GetInCar'
5353
| 'Warmup'
@@ -56,7 +56,7 @@ declare module 'iracing-sdk-js' {
5656
| 'Checkered'
5757
| 'CoolDown';
5858

59-
export type SessionFlag =
59+
export type SessionFlag =
6060
| 'OneLapToGreen'
6161
| 'Servicible'
6262
| 'StartHidden'
@@ -78,6 +78,7 @@ declare module 'iracing-sdk-js' {
7878
| 'Black'
7979
| 'Disqualify'
8080
| 'Furled'
81+
| 'DQScoringInvalid'
8182
| 'Repair'
8283
| 'StartReady'
8384
| 'StartSet'
@@ -94,7 +95,7 @@ declare module 'iracing-sdk-js' {
9495
| 'PitSvBadAngle'
9596
| 'PitSvCantFixThat';
9697

97-
export type CarLeftRight =
98+
export type CarLeftRight =
9899
| 'LROff'
99100
| 'LRClear'
100101
| 'LRCarLeft'
@@ -103,7 +104,7 @@ declare module 'iracing-sdk-js' {
103104
| 'LR2CarsLeft'
104105
| 'LR2CarsRight';
105106

106-
export type TrackWetness =
107+
export type TrackWetness =
107108
| 'UNKNOWN'
108109
| 'Dry'
109110
| 'MostlyDry'
@@ -113,7 +114,7 @@ declare module 'iracing-sdk-js' {
113114
| 'VeryWet'
114115
| 'ExtremelyWet';
115116

116-
export type CameraState =
117+
export type CameraState =
117118
| 'IsSessionScreen'
118119
| 'IsScenicActive'
119120
| 'CamToolActive'
@@ -897,7 +898,6 @@ declare module 'iracing-sdk-js' {
897898
GreenWhiteCheckeredLimit: number;
898899
}
899900

900-
901901
export interface TelemetryEvent {
902902
timestamp: Date;
903903
values: TelemetryValues;
@@ -909,15 +909,28 @@ declare module 'iracing-sdk-js' {
909909
}
910910

911911
export interface UpdateEvent {
912-
type: 'Connected' | 'Disconnected' | 'Telemetry' | 'TelemetryDescription' | 'SessionInfo';
912+
type:
913+
| 'Connected'
914+
| 'Disconnected'
915+
| 'Telemetry'
916+
| 'TelemetryDescription'
917+
| 'SessionInfo';
913918
data?: any;
914919
timestamp: Date;
915920
}
916921

917922
export interface CameraControls {
918923
setState(state: number): void;
919-
switchToCar(carNum: number | string, camGroupNum?: number, camNum?: number): void;
920-
switchToPos(position: number | string, camGroupNum?: number, camNum?: number): void;
924+
switchToCar(
925+
carNum: number | string,
926+
camGroupNum?: number,
927+
camNum?: number
928+
): void;
929+
switchToPos(
930+
position: number | string,
931+
camGroupNum?: number,
932+
camNum?: number
933+
): void;
921934
}
922935

923936
export interface PlaybackControls {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iracing-sdk-js",
3-
"version": "1.5.0",
3+
"version": "1.6.0",
44
"description": "iRacing SDK implementation for Node.js",
55
"main": "src/iracing-sdk-js.js",
66
"types": "index.d.ts",

src/cpp/IrSdkBindingHelpers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ namespace NodeIrSdk
5151
MaskName((int)irsdk_servicible, "Servicible"),
5252
MaskName((int)irsdk_furled, "Furled"),
5353
MaskName((int)irsdk_repair, "Repair"),
54+
MaskName((int)irsdk_dqScoringInvalid, "DQScoringInvalid"),
5455

5556
// start lights
5657
MaskName((int)irsdk_startHidden, "StartHidden"),

src/cpp/irsdk/irsdk_defines.h

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ All rights reserved.
44
55
Redistribution and use in source and binary forms, with or without
66
modification, are permitted provided that the following conditions are met:
7-
* Redistributions of source code must retain the above copyright
8-
notice, this list of conditions and the following disclaimer.
9-
* Redistributions in binary form must reproduce the above copyright
10-
notice, this list of conditions and the following disclaimer in the
11-
documentation and/or other materials provided with the distribution.
12-
* Neither the name of iRacing.com Motorsport Simulations nor the
13-
names of its contributors may be used to endorse or promote products
14-
derived from this software without specific prior written permission.
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above copyright
10+
notice, this list of conditions and the following disclaimer in the
11+
documentation and/or other materials provided with the distribution.
12+
* Neither the name of iRacing.com Motorsport Simulations nor the
13+
names of its contributors may be used to endorse or promote products
14+
derived from this software without specific prior written permission.
1515
1616
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1717
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@@ -36,50 +36,50 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3636
iRacing simulator. It is broken down into several parts:
3737
3838
- Live data
39-
Live data is output from the sim into a shared memory mapped file. Any
40-
application can open this memory mapped file and read the telemetry data
41-
out. The format of this data was laid out in such a way that it should be
42-
possible to access from any language that can open a windows memory mapped
43-
file, without needing an external api.
44-
45-
There are two different types of data that the telemetry outputs,
46-
sessionInfo and variables:
47-
48-
Session info is for data that only needs to be updated every once in a
49-
while. This data is output as a YAML formatted string.
50-
51-
Variables, on the other hand, are output at a rate of 60 times a second.
52-
The varHeader struct defines each variable that the sim will output, while
53-
the varData struct gives details about the current line buffer that the vars
54-
are being written into. Each variable is packed into a binary array with
55-
an offset and length stored in the varHeader. The number of variables
56-
available can change depending on the car or session loaded. But once the
57-
sim is running the variable list is locked down and will not change during a
58-
session.
59-
60-
The sim writes a new line of variables every 16 ms, and then signals any
61-
listeners in order to wake them up to read the data. Because the sim has no
62-
way of knowing when a listener is done reading the data, we triple buffer
63-
it in order to give all the clients enough time to read the data out. This
64-
gives you a minimum of 16 ms to read the data out and process it. So it is
65-
best to copy the data out before processing it. You can use the function
66-
irsdk_waitForDataReady() to both wait for new data and copy the data to a
67-
local buffer.
39+
Live data is output from the sim into a shared memory mapped file. Any
40+
application can open this memory mapped file and read the telemetry data
41+
out. The format of this data was laid out in such a way that it should be
42+
possible to access from any language that can open a windows memory mapped
43+
file, without needing an external api.
44+
45+
There are two different types of data that the telemetry outputs,
46+
sessionInfo and variables:
47+
48+
Session info is for data that only needs to be updated every once in a
49+
while. This data is output as a YAML formatted string.
50+
51+
Variables, on the other hand, are output at a rate of 60 times a second.
52+
The varHeader struct defines each variable that the sim will output, while
53+
the varData struct gives details about the current line buffer that the vars
54+
are being written into. Each variable is packed into a binary array with
55+
an offset and length stored in the varHeader. The number of variables
56+
available can change depending on the car or session loaded. But once the
57+
sim is running the variable list is locked down and will not change during a
58+
session.
59+
60+
The sim writes a new line of variables every 16 ms, and then signals any
61+
listeners in order to wake them up to read the data. Because the sim has no
62+
way of knowing when a listener is done reading the data, we triple buffer
63+
it in order to give all the clients enough time to read the data out. This
64+
gives you a minimum of 16 ms to read the data out and process it. So it is
65+
best to copy the data out before processing it. You can use the function
66+
irsdk_waitForDataReady() to both wait for new data and copy the data to a
67+
local buffer.
6868
6969
- Logged data
70-
Detailed information about the local drivers car can be logged to disk in
71-
the form of an ibt binary file. This logging is enabled in the sim by
72-
typing alt-L at any time. The ibt file format directly mirrors the format
73-
of the live data.
70+
Detailed information about the local drivers car can be logged to disk in
71+
the form of an ibt binary file. This logging is enabled in the sim by
72+
typing alt-L at any time. The ibt file format directly mirrors the format
73+
of the live data.
7474
75-
It is stored as an irsdk_header followed immediately by an irsdk_diskSubHeader.
76-
After that the offsets in the irsdk_header point to the sessionInfo string,
77-
the varHeader, and the varBuffer.
75+
It is stored as an irsdk_header followed immediately by an irsdk_diskSubHeader.
76+
After that the offsets in the irsdk_header point to the sessionInfo string,
77+
the varHeader, and the varBuffer.
7878
7979
- Remote Conrol
80-
You can control the camera selections and playback of a replay tape, from
81-
any external application by sending a windows message with the
82-
irsdk_broadcastMsg() function.
80+
You can control the camera selections and playback of a replay tape, from
81+
any external application by sending a windows message with the
82+
irsdk_broadcastMsg() function.
8383
*/
8484

8585
// Constant Definitions
@@ -253,6 +253,34 @@ enum irsdk_TrackWetness
253253
irsdk_TrackWetness_ExtremelyWet
254254
};
255255

256+
enum irsdk_IncidentFlags
257+
{
258+
// first byte is incident report flag
259+
// only one of these will be used
260+
irsdk_Incident_RepNoReport = 0x0000, // no penalty
261+
irsdk_Incident_RepOutOfControl = 0x0001, // "Loss of Control (2x)"
262+
irsdk_Incident_RepOffTrack = 0x0002, // "Off Track (1x)"
263+
irsdk_Incident_RepOffTrackOngoing = 0x0003, // not currently sent
264+
irsdk_Incident_RepContactWithWorld = 0x0004, // "Contact (0x)"
265+
irsdk_Incident_RepCollisionWithWorld = 0x0005, // "Contact (2x)"
266+
irsdk_Incident_RepCollisionWithWorldOngoing = 0x0006, // not currently sent
267+
irsdk_Incident_RepContactWithCar = 0x0007, // "Car Contact (0x)"
268+
irsdk_Incident_RepCollisionWithCar = 0x0008, // "Car Contact (4x)"
269+
270+
// second byte is incident penalty
271+
// only one of these will be used
272+
irsdk_Incident_PenNoReport = 0x0000, // no penalty
273+
irsdk_Incident_PenZeroX = 0x0100, // 0x
274+
irsdk_Incident_PenOneX = 0x0200, // 1x
275+
irsdk_Incident_PenTwoX = 0x0300, // 2x
276+
irsdk_Incident_PenFourX = 0x0400, // 4x
277+
278+
// not enums, used to seperate the above incident report field
279+
// from the incident penalty field
280+
IRSDK_INCIDENT_REP_MASK = 0x000000FF,
281+
IRSDK_INCIDENT_PEN_MASK = 0x0000FF00,
282+
};
283+
256284
//---
257285

258286
// bit fields
@@ -296,6 +324,7 @@ enum irsdk_Flags
296324
irsdk_servicible = 0x00040000, // car is allowed service (not a flag)
297325
irsdk_furled = 0x00080000,
298326
irsdk_repair = 0x00100000,
327+
irsdk_dqScoringInvalid = 0x00200000, // car is disqualified and scoring is disabled
299328

300329
// start lights
301330
irsdk_startHidden = 0x10000000,
@@ -338,35 +367,6 @@ enum irsdk_PaceFlags
338367
irsdk_PaceFlagsWavedAround = 0x0004,
339368
};
340369

341-
enum irsdk_IncidentFlags
342-
{
343-
// first byte is incident report flag
344-
// only one of these will be used
345-
346-
irsdk_Incident_RepNoReport = 0x0000, // no penalty
347-
irsdk_Incident_RepOutOfControl = 0x0001, // "Loss of Control (2x)"
348-
irsdk_Incident_RepOffTrack = 0x0002, // "Off Track (1x)"
349-
irsdk_Incident_RepOffTrackOngoing = 0x0003, // not currently sent
350-
irsdk_Incident_RepContactWithWorld = 0x0004, // "Contact (0x)"
351-
irsdk_Incident_RepCollisionWithWorld = 0x0005, // "Contact (2x)"
352-
irsdk_Incident_RepCollisionWithWorldOngoing = 0x0006, // not currently sent
353-
irsdk_Incident_RepContactWithCar = 0x0007, // "Car Contact (0x)"
354-
irsdk_Incident_RepCollisionWithCar = 0x0008, // "Car Contact (4x)"
355-
356-
// second byte is incident penalty
357-
// only one of these will be used
358-
irsdk_Incident_PenNoReport = 0x0000, // no penalty
359-
irsdk_Incident_PenZeroX = 0x0100, // 0x
360-
irsdk_Incident_PenOneX = 0x0200, // 1x
361-
irsdk_Incident_PenTwoX = 0x0300, // 2x
362-
irsdk_Incident_PenFourX = 0x0400, // 4x
363-
364-
// not enums, used to seperate the above incident report field
365-
// from the incident penalty field
366-
IRSKD_INCIDENT_REP_MASK = 0x000000FF,
367-
IRSKD_INCIDENT_PEN_MASK = 0x0000FF00,
368-
};
369-
370370
//----
371371
//
372372

@@ -421,9 +421,9 @@ struct irsdk_header
421421
int numBuf; // <= IRSDK_MAX_BUFS (3 for now)
422422
int bufLen; // length in bytes for one line
423423
//****ToDo, add these in
424-
// int curBufTickCount; // stashed copy of the current tickCount, can read this to see if new data is available
425-
// byte curBuf; // index of the most recently written buffer (0 to IRSDK_MAX_BUFS-1)
426-
// byte pad1[3]; // 16 byte align
424+
// int curBufTickCount; // stashed copy of the current tickCount, can read this to see if new data is available
425+
// byte curBuf; // index of the most recently written buffer (0 to IRSDK_MAX_BUFS-1)
426+
// byte pad1[3]; // 16 byte align
427427
int pad1[2]; // (16 byte align)
428428
irsdk_varBuf varBuf[IRSDK_MAX_BUFS]; // buffers of data being written to
429429
};
@@ -469,7 +469,7 @@ enum irsdk_BroadcastMsg
469469
irsdk_BroadcastCamSwitchNum, // driver #, group, camera
470470
irsdk_BroadcastCamSetState, // irsdk_CameraState, unused, unused
471471
irsdk_BroadcastReplaySetPlaySpeed, // speed, slowMotion, unused
472-
irskd_BroadcastReplaySetPlayPosition, // irsdk_RpyPosMode, Frame Number (high, low)
472+
irsdk_BroadcastReplaySetPlayPosition, // irsdk_RpyPosMode, Frame Number (high, low)
473473
irsdk_BroadcastReplaySearch, // irsdk_RpySrchMode, unused, unused
474474
irsdk_BroadcastReplaySetState, // irsdk_RpyStateMode, unused, unused
475475
irsdk_BroadcastReloadTextures, // irsdk_ReloadTexturesMode, carIdx, unused

0 commit comments

Comments
 (0)