@@ -4,14 +4,14 @@ All rights reserved.
44
55Redistribution and use in source and binary forms, with or without
66modification, 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
1616THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1717ANY 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