py-acevo 0.0.1__tar.gz
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.
- py_acevo-0.0.1/PKG-INFO +11 -0
- py_acevo-0.0.1/README.MD +3 -0
- py_acevo-0.0.1/VERSION +1 -0
- py_acevo-0.0.1/acevo/__init__.py +5 -0
- py_acevo-0.0.1/acevo/models/__init__.py +0 -0
- py_acevo-0.0.1/acevo/models/enums.py +49 -0
- py_acevo-0.0.1/acevo/models/graphics.py +581 -0
- py_acevo-0.0.1/acevo/models/physics.py +193 -0
- py_acevo-0.0.1/acevo/models/static.py +59 -0
- py_acevo-0.0.1/acevo/reader.py +76 -0
- py_acevo-0.0.1/py_acevo.egg-info/PKG-INFO +11 -0
- py_acevo-0.0.1/py_acevo.egg-info/SOURCES.txt +14 -0
- py_acevo-0.0.1/py_acevo.egg-info/dependency_links.txt +1 -0
- py_acevo-0.0.1/py_acevo.egg-info/top_level.txt +1 -0
- py_acevo-0.0.1/pyproject.toml +17 -0
- py_acevo-0.0.1/setup.cfg +4 -0
py_acevo-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py-acevo
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Read Assetto Corsa EVO shared memory on Windows.
|
|
5
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
9
|
+
# py-acevo
|
|
10
|
+
|
|
11
|
+
The Python library to read shared memory of Assetto Corsa Evo.
|
py_acevo-0.0.1/README.MD
ADDED
py_acevo-0.0.1/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.0.1
|
|
File without changes
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from enum import IntEnum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ACEVO_STATUS(IntEnum):
|
|
5
|
+
AC_OFF = 0
|
|
6
|
+
AC_REPLAY = 1
|
|
7
|
+
AC_LIVE = 2
|
|
8
|
+
AC_PAUSE = 3
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ACEVO_SESSION_TYPE(IntEnum):
|
|
12
|
+
AC_UNKNOWN = -1
|
|
13
|
+
AC_TIME_ATTACK = 0
|
|
14
|
+
AC_RACE = 1
|
|
15
|
+
AC_HOT_STINT = 2
|
|
16
|
+
AC_CRUISE = 3
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class ACEVO_FLAG_TYPE(IntEnum):
|
|
20
|
+
AC_NO_FLAG = 0
|
|
21
|
+
AC_WHITE_FLAG = 1
|
|
22
|
+
AC_GREEN_FLAG = 2
|
|
23
|
+
AC_RED_FLAG = 3
|
|
24
|
+
AC_BLUE_FLAG = 4
|
|
25
|
+
AC_YELLOW_FLAG = 5
|
|
26
|
+
AC_BLACK_FLAG = 6
|
|
27
|
+
AC_BLACK_WHITE_FLAG = 7
|
|
28
|
+
AC_CHECKERED_FLAG = 8
|
|
29
|
+
AC_ORANGE_CIRCLE_FLAG = 9
|
|
30
|
+
AC_RED_YELLOW_STRIPES_FLAG = 10
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class ACEVO_CAR_LOCATION(IntEnum):
|
|
34
|
+
ACEVO_UNASSIGNED = 0
|
|
35
|
+
ACEVO_PITLANE = 1
|
|
36
|
+
ACEVO_PITENTRY = 2
|
|
37
|
+
ACEVO_PITEXIT = 3
|
|
38
|
+
ACEVO_TRACK = 4
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class ACEVO_ENGINE_TYPE(IntEnum):
|
|
42
|
+
ACEVO_INTERNAL_COMBUSTION = 0
|
|
43
|
+
ACEVO_ELECTRIC_MOTOR = 1
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class ACEVO_STARTING_GRIP(IntEnum):
|
|
47
|
+
ACEVO_GREEN = 0
|
|
48
|
+
ACEVO_FAST = 1
|
|
49
|
+
ACEVO_OPTIMUM = 2
|
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
from ctypes import (
|
|
2
|
+
LittleEndianStructure,
|
|
3
|
+
sizeof,
|
|
4
|
+
c_bool,
|
|
5
|
+
c_char,
|
|
6
|
+
c_float,
|
|
7
|
+
c_int16,
|
|
8
|
+
c_int32,
|
|
9
|
+
c_int8,
|
|
10
|
+
c_uint16,
|
|
11
|
+
c_uint32,
|
|
12
|
+
c_uint64,
|
|
13
|
+
c_uint8,
|
|
14
|
+
)
|
|
15
|
+
from collections.abc import Sequence
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
FloatArray = Sequence[float]
|
|
19
|
+
FloatMatrix = Sequence[FloatArray]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class SMEvoTyreState(LittleEndianStructure):
|
|
23
|
+
_layout_ = "ms"
|
|
24
|
+
_pack_ = 4
|
|
25
|
+
slip: float
|
|
26
|
+
lock: bool
|
|
27
|
+
tyre_pression: float
|
|
28
|
+
tyre_temperature_c: float
|
|
29
|
+
brake_temperature_c: float
|
|
30
|
+
brake_pressure: float
|
|
31
|
+
tyre_temperature_left: float
|
|
32
|
+
tyre_temperature_center: float
|
|
33
|
+
tyre_temperature_right: float
|
|
34
|
+
tyre_compound_front: bytes
|
|
35
|
+
tyre_compound_rear: bytes
|
|
36
|
+
tyre_normalized_pressure: float
|
|
37
|
+
tyre_normalized_temperature_left: float
|
|
38
|
+
tyre_normalized_temperature_center: float
|
|
39
|
+
tyre_normalized_temperature_right: float
|
|
40
|
+
brake_normalized_temperature: float
|
|
41
|
+
tyre_normalized_temperature_core: float
|
|
42
|
+
_fields_ = [
|
|
43
|
+
("slip", c_float),
|
|
44
|
+
("lock", c_bool),
|
|
45
|
+
("tyre_pression", c_float),
|
|
46
|
+
("tyre_temperature_c", c_float),
|
|
47
|
+
("brake_temperature_c", c_float),
|
|
48
|
+
("brake_pressure", c_float),
|
|
49
|
+
("tyre_temperature_left", c_float),
|
|
50
|
+
("tyre_temperature_center", c_float),
|
|
51
|
+
("tyre_temperature_right", c_float),
|
|
52
|
+
("tyre_compound_front", (c_char * 33)),
|
|
53
|
+
("tyre_compound_rear", (c_char * 33)),
|
|
54
|
+
("tyre_normalized_pressure", c_float),
|
|
55
|
+
("tyre_normalized_temperature_left", c_float),
|
|
56
|
+
("tyre_normalized_temperature_center", c_float),
|
|
57
|
+
("tyre_normalized_temperature_right", c_float),
|
|
58
|
+
("brake_normalized_temperature", c_float),
|
|
59
|
+
("tyre_normalized_temperature_core", c_float),
|
|
60
|
+
("place_holder", (c_char * 128)),
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class SMEvoDamageState(LittleEndianStructure):
|
|
65
|
+
_layout_ = "ms"
|
|
66
|
+
_pack_ = 4
|
|
67
|
+
damage_front: float
|
|
68
|
+
damage_rear: float
|
|
69
|
+
damage_left: float
|
|
70
|
+
damage_right: float
|
|
71
|
+
damage_center: float
|
|
72
|
+
damage_suspension_lf: float
|
|
73
|
+
damage_suspension_rf: float
|
|
74
|
+
damage_suspension_lr: float
|
|
75
|
+
damage_suspension_rr: float
|
|
76
|
+
_fields_ = [
|
|
77
|
+
("damage_front", c_float),
|
|
78
|
+
("damage_rear", c_float),
|
|
79
|
+
("damage_left", c_float),
|
|
80
|
+
("damage_right", c_float),
|
|
81
|
+
("damage_center", c_float),
|
|
82
|
+
("damage_suspension_lf", c_float),
|
|
83
|
+
("damage_suspension_rf", c_float),
|
|
84
|
+
("damage_suspension_lr", c_float),
|
|
85
|
+
("damage_suspension_rr", c_float),
|
|
86
|
+
("place_holder", (c_char * 92)),
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class SMEvoPitInfo(LittleEndianStructure):
|
|
91
|
+
_layout_ = "ms"
|
|
92
|
+
_pack_ = 4
|
|
93
|
+
damage: int
|
|
94
|
+
fuel: int
|
|
95
|
+
tyres_lf: int
|
|
96
|
+
tyres_rf: int
|
|
97
|
+
tyres_lr: int
|
|
98
|
+
tyres_rr: int
|
|
99
|
+
_fields_ = [
|
|
100
|
+
("damage", c_int8),
|
|
101
|
+
("fuel", c_int8),
|
|
102
|
+
("tyres_lf", c_int8),
|
|
103
|
+
("tyres_rf", c_int8),
|
|
104
|
+
("tyres_lr", c_int8),
|
|
105
|
+
("tyres_rr", c_int8),
|
|
106
|
+
("place_holder", (c_char * 58)),
|
|
107
|
+
]
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class SMEvoElectronics(LittleEndianStructure):
|
|
111
|
+
_layout_ = "ms"
|
|
112
|
+
_pack_ = 4
|
|
113
|
+
tc_level: int
|
|
114
|
+
tc_cut_level: int
|
|
115
|
+
abs_level: int
|
|
116
|
+
esc_level: int
|
|
117
|
+
ebb_level: int
|
|
118
|
+
brake_bias: float
|
|
119
|
+
engine_map_level: int
|
|
120
|
+
turbo_level: float
|
|
121
|
+
ers_deployment_map: int
|
|
122
|
+
ers_recharge_map: float
|
|
123
|
+
is_ers_heat_charging_on: bool
|
|
124
|
+
is_ers_overtake_mode_on: bool
|
|
125
|
+
is_drs_open: bool
|
|
126
|
+
diff_power_level: int
|
|
127
|
+
diff_coast_level: int
|
|
128
|
+
front_bump_damper_level: int
|
|
129
|
+
front_rebound_damper_level: int
|
|
130
|
+
rear_bump_damper_level: int
|
|
131
|
+
rear_rebound_damper_level: int
|
|
132
|
+
is_ignition_on: bool
|
|
133
|
+
is_pitlimiter_on: bool
|
|
134
|
+
active_performance_mode: int
|
|
135
|
+
_fields_ = [
|
|
136
|
+
("tc_level", c_int8),
|
|
137
|
+
("tc_cut_level", c_int8),
|
|
138
|
+
("abs_level", c_int8),
|
|
139
|
+
("esc_level", c_int8),
|
|
140
|
+
("ebb_level", c_int8),
|
|
141
|
+
("brake_bias", c_float),
|
|
142
|
+
("engine_map_level", c_int8),
|
|
143
|
+
("turbo_level", c_float),
|
|
144
|
+
("ers_deployment_map", c_int8),
|
|
145
|
+
("ers_recharge_map", c_float),
|
|
146
|
+
("is_ers_heat_charging_on", c_bool),
|
|
147
|
+
("is_ers_overtake_mode_on", c_bool),
|
|
148
|
+
("is_drs_open", c_bool),
|
|
149
|
+
("diff_power_level", c_int8),
|
|
150
|
+
("diff_coast_level", c_int8),
|
|
151
|
+
("front_bump_damper_level", c_int8),
|
|
152
|
+
("front_rebound_damper_level", c_int8),
|
|
153
|
+
("rear_bump_damper_level", c_int8),
|
|
154
|
+
("rear_rebound_damper_level", c_int8),
|
|
155
|
+
("is_ignition_on", c_bool),
|
|
156
|
+
("is_pitlimiter_on", c_bool),
|
|
157
|
+
("active_performance_mode", c_int8),
|
|
158
|
+
("place_holder", (c_char * 88)),
|
|
159
|
+
]
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
class SMEvoInstrumentation(LittleEndianStructure):
|
|
163
|
+
_layout_ = "ms"
|
|
164
|
+
_pack_ = 4
|
|
165
|
+
main_light_stage: int
|
|
166
|
+
special_light_stage: int
|
|
167
|
+
cockpit_light_stage: int
|
|
168
|
+
wiper_level: int
|
|
169
|
+
rain_lights: bool
|
|
170
|
+
direction_light_left: bool
|
|
171
|
+
direction_light_right: bool
|
|
172
|
+
flashing_lights: bool
|
|
173
|
+
warning_lights: bool
|
|
174
|
+
selected_display_index: int
|
|
175
|
+
display_current_page_index: Sequence[int]
|
|
176
|
+
are_headlights_visible: bool
|
|
177
|
+
_fields_ = [
|
|
178
|
+
("main_light_stage", c_int8),
|
|
179
|
+
("special_light_stage", c_int8),
|
|
180
|
+
("cockpit_light_stage", c_int8),
|
|
181
|
+
("wiper_level", c_int8),
|
|
182
|
+
("rain_lights", c_bool),
|
|
183
|
+
("direction_light_left", c_bool),
|
|
184
|
+
("direction_light_right", c_bool),
|
|
185
|
+
("flashing_lights", c_bool),
|
|
186
|
+
("warning_lights", c_bool),
|
|
187
|
+
("selected_display_index", c_int8),
|
|
188
|
+
("display_current_page_index", (c_int8 * 16)),
|
|
189
|
+
("are_headlights_visible", c_bool),
|
|
190
|
+
("place_holder", (c_char * 101)),
|
|
191
|
+
]
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
class SMEvoSessionState(LittleEndianStructure):
|
|
195
|
+
_layout_ = "ms"
|
|
196
|
+
_pack_ = 4
|
|
197
|
+
phase_name: bytes
|
|
198
|
+
time_left: bytes
|
|
199
|
+
time_left_ms: int
|
|
200
|
+
wait_time: bytes
|
|
201
|
+
total_lap: int
|
|
202
|
+
current_lap: int
|
|
203
|
+
lights_on: int
|
|
204
|
+
lights_mode: int
|
|
205
|
+
lap_length_km: float
|
|
206
|
+
end_session_flag: int
|
|
207
|
+
time_to_next_session: bytes
|
|
208
|
+
disconnected_from_server: bool
|
|
209
|
+
restart_season_enabled: bool
|
|
210
|
+
ui_enable_drive: bool
|
|
211
|
+
ui_enable_setup: bool
|
|
212
|
+
is_ready_to_next_blinking: bool
|
|
213
|
+
show_waiting_for_players: bool
|
|
214
|
+
_fields_ = [
|
|
215
|
+
("phase_name", (c_char * 33)),
|
|
216
|
+
("time_left", (c_char * 15)),
|
|
217
|
+
("time_left_ms", c_int32),
|
|
218
|
+
("wait_time", (c_char * 15)),
|
|
219
|
+
("total_lap", c_int32),
|
|
220
|
+
("current_lap", c_int32),
|
|
221
|
+
("lights_on", c_int32),
|
|
222
|
+
("lights_mode", c_int32),
|
|
223
|
+
("lap_length_km", c_float),
|
|
224
|
+
("end_session_flag", c_int32),
|
|
225
|
+
("time_to_next_session", (c_char * 15)),
|
|
226
|
+
("disconnected_from_server", c_bool),
|
|
227
|
+
("restart_season_enabled", c_bool),
|
|
228
|
+
("ui_enable_drive", c_bool),
|
|
229
|
+
("ui_enable_setup", c_bool),
|
|
230
|
+
("is_ready_to_next_blinking", c_bool),
|
|
231
|
+
("show_waiting_for_players", c_bool),
|
|
232
|
+
("place_holder", (c_char * 140)),
|
|
233
|
+
]
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
class SMEvoTimingState(LittleEndianStructure):
|
|
237
|
+
_layout_ = "ms"
|
|
238
|
+
_pack_ = 4
|
|
239
|
+
current_laptime: bytes
|
|
240
|
+
delta_current: bytes
|
|
241
|
+
delta_current_p: int
|
|
242
|
+
last_laptime: bytes
|
|
243
|
+
delta_last: bytes
|
|
244
|
+
delta_last_p: int
|
|
245
|
+
best_laptime: bytes
|
|
246
|
+
ideal_laptime: bytes
|
|
247
|
+
total_time: bytes
|
|
248
|
+
is_invalid: bool
|
|
249
|
+
_fields_ = [
|
|
250
|
+
("current_laptime", (c_char * 15)),
|
|
251
|
+
("delta_current", (c_char * 15)),
|
|
252
|
+
("delta_current_p", c_int32),
|
|
253
|
+
("last_laptime", (c_char * 15)),
|
|
254
|
+
("delta_last", (c_char * 15)),
|
|
255
|
+
("delta_last_p", c_int32),
|
|
256
|
+
("best_laptime", (c_char * 15)),
|
|
257
|
+
("ideal_laptime", (c_char * 15)),
|
|
258
|
+
("total_time", (c_char * 15)),
|
|
259
|
+
("is_invalid", c_bool),
|
|
260
|
+
("place_holder", (c_char * 137)),
|
|
261
|
+
]
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
class SMEvoAssistsState(LittleEndianStructure):
|
|
265
|
+
_layout_ = "ms"
|
|
266
|
+
_pack_ = 4
|
|
267
|
+
auto_gear: int
|
|
268
|
+
auto_blip: int
|
|
269
|
+
auto_clutch: int
|
|
270
|
+
auto_clutch_on_start: int
|
|
271
|
+
manual_ignition_e_start: int
|
|
272
|
+
auto_pit_limiter: int
|
|
273
|
+
standing_start_assist: int
|
|
274
|
+
auto_steer: float
|
|
275
|
+
arcade_stability_control: float
|
|
276
|
+
_fields_ = [
|
|
277
|
+
("auto_gear", c_uint8),
|
|
278
|
+
("auto_blip", c_uint8),
|
|
279
|
+
("auto_clutch", c_uint8),
|
|
280
|
+
("auto_clutch_on_start", c_uint8),
|
|
281
|
+
("manual_ignition_e_start", c_uint8),
|
|
282
|
+
("auto_pit_limiter", c_uint8),
|
|
283
|
+
("standing_start_assist", c_uint8),
|
|
284
|
+
("auto_steer", c_float),
|
|
285
|
+
("arcade_stability_control", c_float),
|
|
286
|
+
("place_holder", (c_char * 48)),
|
|
287
|
+
]
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
class GraphicsPage(LittleEndianStructure):
|
|
291
|
+
_layout_ = "ms"
|
|
292
|
+
_pack_ = 4
|
|
293
|
+
|
|
294
|
+
packetId: int
|
|
295
|
+
status: int
|
|
296
|
+
focused_car_id_a: int
|
|
297
|
+
focused_car_id_b: int
|
|
298
|
+
player_car_id_a: int
|
|
299
|
+
player_car_id_b: int
|
|
300
|
+
rpm: int
|
|
301
|
+
is_rpm_limiter_on: bool
|
|
302
|
+
is_change_up_rpm: bool
|
|
303
|
+
is_change_down_rpm: bool
|
|
304
|
+
tc_active: bool
|
|
305
|
+
abs_active: bool
|
|
306
|
+
esc_active: bool
|
|
307
|
+
launch_active: bool
|
|
308
|
+
is_ignition_on: bool
|
|
309
|
+
is_engine_running: bool
|
|
310
|
+
kers_is_charging: bool
|
|
311
|
+
is_wrong_way: bool
|
|
312
|
+
is_drs_available: bool
|
|
313
|
+
battery_is_charging: bool
|
|
314
|
+
is_max_kj_per_lap_reached: bool
|
|
315
|
+
is_max_charge_kj_per_lap_reached: bool
|
|
316
|
+
display_speed_kmh: int
|
|
317
|
+
display_speed_mph: int
|
|
318
|
+
display_speed_ms: int
|
|
319
|
+
pitspeeding_delta: float
|
|
320
|
+
gear_int: int
|
|
321
|
+
rpm_percent: float
|
|
322
|
+
gas_percent: float
|
|
323
|
+
brake_percent: float
|
|
324
|
+
handbrake_percent: float
|
|
325
|
+
clutch_percent: float
|
|
326
|
+
steering_percent: float
|
|
327
|
+
ffb_strength: float
|
|
328
|
+
car_ffb_mupliplier: float
|
|
329
|
+
water_temperature_percent: float
|
|
330
|
+
water_pressure_bar: float
|
|
331
|
+
fuel_pressure_bar: float
|
|
332
|
+
water_temperature_c: int
|
|
333
|
+
air_temperature_c: int
|
|
334
|
+
oil_temperature_c: float
|
|
335
|
+
oil_pressure_bar: float
|
|
336
|
+
exhaust_temperature_c: float
|
|
337
|
+
g_forces_x: float
|
|
338
|
+
g_forces_y: float
|
|
339
|
+
g_forces_z: float
|
|
340
|
+
turbo_boost: float
|
|
341
|
+
turbo_boost_level: float
|
|
342
|
+
turbo_boost_perc: float
|
|
343
|
+
steer_degrees: int
|
|
344
|
+
current_km: float
|
|
345
|
+
total_km: int
|
|
346
|
+
total_driving_time_s: int
|
|
347
|
+
time_of_day_hours: int
|
|
348
|
+
time_of_day_minutes: int
|
|
349
|
+
time_of_day_seconds: int
|
|
350
|
+
delta_time_ms: int
|
|
351
|
+
current_lap_time_ms: int
|
|
352
|
+
predicted_lap_time_ms: int
|
|
353
|
+
fuel_liter_current_quantity: float
|
|
354
|
+
fuel_liter_current_quantity_percent: float
|
|
355
|
+
fuel_liter_per_km: float
|
|
356
|
+
km_per_fuel_liter: float
|
|
357
|
+
current_torque: float
|
|
358
|
+
current_bhp: int
|
|
359
|
+
tyre_lf: SMEvoTyreState
|
|
360
|
+
tyre_rf: SMEvoTyreState
|
|
361
|
+
tyre_lr: SMEvoTyreState
|
|
362
|
+
tyre_rr: SMEvoTyreState
|
|
363
|
+
npos: float
|
|
364
|
+
kers_charge_perc: float
|
|
365
|
+
kers_current_perc: float
|
|
366
|
+
control_lock_time: float
|
|
367
|
+
car_damage: SMEvoDamageState
|
|
368
|
+
car_location: int
|
|
369
|
+
pit_info: SMEvoPitInfo
|
|
370
|
+
fuel_liter_used: float
|
|
371
|
+
fuel_liter_per_lap: float
|
|
372
|
+
laps_possible_with_fuel: float
|
|
373
|
+
battery_temperature: float
|
|
374
|
+
battery_voltage: float
|
|
375
|
+
instantaneous_fuel_liter_per_km: float
|
|
376
|
+
instantaneous_km_per_fuel_liter: float
|
|
377
|
+
gear_rpm_window: float
|
|
378
|
+
instrumentation: SMEvoInstrumentation
|
|
379
|
+
instrumentation_min_limit: SMEvoInstrumentation
|
|
380
|
+
instrumentation_max_limit: SMEvoInstrumentation
|
|
381
|
+
electronics: SMEvoElectronics
|
|
382
|
+
electronics_min_limit: SMEvoElectronics
|
|
383
|
+
electronics_max_limit: SMEvoElectronics
|
|
384
|
+
electronics_is_modifiable: SMEvoElectronics
|
|
385
|
+
total_lap_count: int
|
|
386
|
+
current_pos: int
|
|
387
|
+
total_drivers: int
|
|
388
|
+
last_laptime_ms: int
|
|
389
|
+
best_laptime_ms: int
|
|
390
|
+
flag: int
|
|
391
|
+
global_flag: int
|
|
392
|
+
max_gears: int
|
|
393
|
+
engine_type: int
|
|
394
|
+
has_kers: bool
|
|
395
|
+
is_last_lap: bool
|
|
396
|
+
performance_mode_name: bytes
|
|
397
|
+
diff_coast_raw_value: float
|
|
398
|
+
diff_power_raw_value: float
|
|
399
|
+
race_cut_gained_time_ms: int
|
|
400
|
+
distance_to_deadline: int
|
|
401
|
+
race_cut_current_delta: float
|
|
402
|
+
session_state: SMEvoSessionState
|
|
403
|
+
timing_state: SMEvoTimingState
|
|
404
|
+
player_ping: int
|
|
405
|
+
player_latency: int
|
|
406
|
+
player_cpu_usage: int
|
|
407
|
+
player_cpu_usage_avg: int
|
|
408
|
+
player_qos: int
|
|
409
|
+
player_qos_avg: int
|
|
410
|
+
player_fps: int
|
|
411
|
+
player_fps_avg: int
|
|
412
|
+
driver_name: bytes
|
|
413
|
+
driver_surname: bytes
|
|
414
|
+
car_model: bytes
|
|
415
|
+
is_in_pit_box: bool
|
|
416
|
+
is_in_pit_lane: bool
|
|
417
|
+
is_valid_lap: bool
|
|
418
|
+
car_coordinates: FloatMatrix
|
|
419
|
+
gap_ahead: float
|
|
420
|
+
gap_behind: float
|
|
421
|
+
active_cars: int
|
|
422
|
+
fuel_per_lap: float
|
|
423
|
+
fuel_estimated_laps: float
|
|
424
|
+
assists_state: SMEvoAssistsState
|
|
425
|
+
max_fuel: float
|
|
426
|
+
max_turbo_boost: float
|
|
427
|
+
use_single_compound: bool
|
|
428
|
+
car_ids: Sequence[Sequence[int]]
|
|
429
|
+
|
|
430
|
+
_fields_ = [
|
|
431
|
+
("packetId", c_int32),
|
|
432
|
+
("status", c_int32),
|
|
433
|
+
("focused_car_id_a", c_uint64),
|
|
434
|
+
("focused_car_id_b", c_uint64),
|
|
435
|
+
("player_car_id_a", c_uint64),
|
|
436
|
+
("player_car_id_b", c_uint64),
|
|
437
|
+
("rpm", c_uint16),
|
|
438
|
+
("is_rpm_limiter_on", c_bool),
|
|
439
|
+
("is_change_up_rpm", c_bool),
|
|
440
|
+
("is_change_down_rpm", c_bool),
|
|
441
|
+
("tc_active", c_bool),
|
|
442
|
+
("abs_active", c_bool),
|
|
443
|
+
("esc_active", c_bool),
|
|
444
|
+
("launch_active", c_bool),
|
|
445
|
+
("is_ignition_on", c_bool),
|
|
446
|
+
("is_engine_running", c_bool),
|
|
447
|
+
("kers_is_charging", c_bool),
|
|
448
|
+
("is_wrong_way", c_bool),
|
|
449
|
+
("is_drs_available", c_bool),
|
|
450
|
+
("battery_is_charging", c_bool),
|
|
451
|
+
("is_max_kj_per_lap_reached", c_bool),
|
|
452
|
+
("is_max_charge_kj_per_lap_reached", c_bool),
|
|
453
|
+
("display_speed_kmh", c_int16),
|
|
454
|
+
("display_speed_mph", c_int16),
|
|
455
|
+
("display_speed_ms", c_int16),
|
|
456
|
+
("pitspeeding_delta", c_float),
|
|
457
|
+
("gear_int", c_int16),
|
|
458
|
+
("rpm_percent", c_float),
|
|
459
|
+
("gas_percent", c_float),
|
|
460
|
+
("brake_percent", c_float),
|
|
461
|
+
("handbrake_percent", c_float),
|
|
462
|
+
("clutch_percent", c_float),
|
|
463
|
+
("steering_percent", c_float),
|
|
464
|
+
("ffb_strength", c_float),
|
|
465
|
+
("car_ffb_mupliplier", c_float),
|
|
466
|
+
("water_temperature_percent", c_float),
|
|
467
|
+
("water_pressure_bar", c_float),
|
|
468
|
+
("fuel_pressure_bar", c_float),
|
|
469
|
+
("water_temperature_c", c_int8),
|
|
470
|
+
("air_temperature_c", c_int8),
|
|
471
|
+
("oil_temperature_c", c_float),
|
|
472
|
+
("oil_pressure_bar", c_float),
|
|
473
|
+
("exhaust_temperature_c", c_float),
|
|
474
|
+
("g_forces_x", c_float),
|
|
475
|
+
("g_forces_y", c_float),
|
|
476
|
+
("g_forces_z", c_float),
|
|
477
|
+
("turbo_boost", c_float),
|
|
478
|
+
("turbo_boost_level", c_float),
|
|
479
|
+
("turbo_boost_perc", c_float),
|
|
480
|
+
("steer_degrees", c_int32),
|
|
481
|
+
("current_km", c_float),
|
|
482
|
+
("total_km", c_uint32),
|
|
483
|
+
("total_driving_time_s", c_uint32),
|
|
484
|
+
("time_of_day_hours", c_int32),
|
|
485
|
+
("time_of_day_minutes", c_int32),
|
|
486
|
+
("time_of_day_seconds", c_int32),
|
|
487
|
+
("delta_time_ms", c_int32),
|
|
488
|
+
("current_lap_time_ms", c_int32),
|
|
489
|
+
("predicted_lap_time_ms", c_int32),
|
|
490
|
+
("fuel_liter_current_quantity", c_float),
|
|
491
|
+
("fuel_liter_current_quantity_percent", c_float),
|
|
492
|
+
("fuel_liter_per_km", c_float),
|
|
493
|
+
("km_per_fuel_liter", c_float),
|
|
494
|
+
("current_torque", c_float),
|
|
495
|
+
("current_bhp", c_int32),
|
|
496
|
+
("tyre_lf", SMEvoTyreState),
|
|
497
|
+
("tyre_rf", SMEvoTyreState),
|
|
498
|
+
("tyre_lr", SMEvoTyreState),
|
|
499
|
+
("tyre_rr", SMEvoTyreState),
|
|
500
|
+
("npos", c_float),
|
|
501
|
+
("kers_charge_perc", c_float),
|
|
502
|
+
("kers_current_perc", c_float),
|
|
503
|
+
("control_lock_time", c_float),
|
|
504
|
+
("car_damage", SMEvoDamageState),
|
|
505
|
+
("car_location", c_int32),
|
|
506
|
+
("pit_info", SMEvoPitInfo),
|
|
507
|
+
("fuel_liter_used", c_float),
|
|
508
|
+
("fuel_liter_per_lap", c_float),
|
|
509
|
+
("laps_possible_with_fuel", c_float),
|
|
510
|
+
("battery_temperature", c_float),
|
|
511
|
+
("battery_voltage", c_float),
|
|
512
|
+
("instantaneous_fuel_liter_per_km", c_float),
|
|
513
|
+
("instantaneous_km_per_fuel_liter", c_float),
|
|
514
|
+
("gear_rpm_window", c_float),
|
|
515
|
+
("instrumentation", SMEvoInstrumentation),
|
|
516
|
+
("instrumentation_min_limit", SMEvoInstrumentation),
|
|
517
|
+
("instrumentation_max_limit", SMEvoInstrumentation),
|
|
518
|
+
("electronics", SMEvoElectronics),
|
|
519
|
+
("electronics_min_limit", SMEvoElectronics),
|
|
520
|
+
("electronics_max_limit", SMEvoElectronics),
|
|
521
|
+
("electronics_is_modifiable", SMEvoElectronics),
|
|
522
|
+
("total_lap_count", c_int32),
|
|
523
|
+
("current_pos", c_uint32),
|
|
524
|
+
("total_drivers", c_uint32),
|
|
525
|
+
("last_laptime_ms", c_int32),
|
|
526
|
+
("best_laptime_ms", c_int32),
|
|
527
|
+
("flag", c_int32),
|
|
528
|
+
("global_flag", c_int32),
|
|
529
|
+
("max_gears", c_uint32),
|
|
530
|
+
("engine_type", c_int32),
|
|
531
|
+
("has_kers", c_bool),
|
|
532
|
+
("is_last_lap", c_bool),
|
|
533
|
+
("performance_mode_name", (c_char * 33)),
|
|
534
|
+
("diff_coast_raw_value", c_float),
|
|
535
|
+
("diff_power_raw_value", c_float),
|
|
536
|
+
("race_cut_gained_time_ms", c_int32),
|
|
537
|
+
("distance_to_deadline", c_int32),
|
|
538
|
+
("race_cut_current_delta", c_float),
|
|
539
|
+
("session_state", SMEvoSessionState),
|
|
540
|
+
("timing_state", SMEvoTimingState),
|
|
541
|
+
("player_ping", c_int32),
|
|
542
|
+
("player_latency", c_int32),
|
|
543
|
+
("player_cpu_usage", c_int32),
|
|
544
|
+
("player_cpu_usage_avg", c_int32),
|
|
545
|
+
("player_qos", c_int32),
|
|
546
|
+
("player_qos_avg", c_int32),
|
|
547
|
+
("player_fps", c_int32),
|
|
548
|
+
("player_fps_avg", c_int32),
|
|
549
|
+
("driver_name", (c_char * 33)),
|
|
550
|
+
("driver_surname", (c_char * 33)),
|
|
551
|
+
("car_model", (c_char * 33)),
|
|
552
|
+
("is_in_pit_box", c_bool),
|
|
553
|
+
("is_in_pit_lane", c_bool),
|
|
554
|
+
("is_valid_lap", c_bool),
|
|
555
|
+
("car_coordinates", ((c_float * 3) * 60)),
|
|
556
|
+
("gap_ahead", c_float),
|
|
557
|
+
("gap_behind", c_float),
|
|
558
|
+
("active_cars", c_uint8),
|
|
559
|
+
("fuel_per_lap", c_float),
|
|
560
|
+
("fuel_estimated_laps", c_float),
|
|
561
|
+
("assists_state", SMEvoAssistsState),
|
|
562
|
+
("max_fuel", c_float),
|
|
563
|
+
("max_turbo_boost", c_float),
|
|
564
|
+
("use_single_compound", c_bool),
|
|
565
|
+
("car_ids", ((c_uint64 * 2) * 60)),
|
|
566
|
+
]
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
assert sizeof(SMEvoTyreState) == 256, "SMEvoTyreState differs from the EVO ABI"
|
|
570
|
+
assert sizeof(SMEvoDamageState) == 128, "SMEvoDamageState differs from the EVO ABI"
|
|
571
|
+
assert sizeof(SMEvoPitInfo) == 64, "SMEvoPitInfo differs from the EVO ABI"
|
|
572
|
+
assert sizeof(SMEvoElectronics) == 128, "SMEvoElectronics differs from the EVO ABI"
|
|
573
|
+
assert sizeof(SMEvoInstrumentation) == 128, (
|
|
574
|
+
"SMEvoInstrumentation differs from the EVO ABI"
|
|
575
|
+
)
|
|
576
|
+
assert sizeof(SMEvoSessionState) == 256, "SMEvoSessionState differs from the EVO ABI"
|
|
577
|
+
assert sizeof(SMEvoTimingState) == 256, "SMEvoTimingState differs from the EVO ABI"
|
|
578
|
+
assert sizeof(SMEvoAssistsState) == 64, "SMEvoAssistsState differs from the EVO ABI"
|
|
579
|
+
assert sizeof(GraphicsPage) == 4900, (
|
|
580
|
+
"GraphicsPage differs from the EVO ABI"
|
|
581
|
+
)
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
from ctypes import (
|
|
2
|
+
LittleEndianStructure,
|
|
3
|
+
sizeof,
|
|
4
|
+
c_float,
|
|
5
|
+
c_int32,
|
|
6
|
+
)
|
|
7
|
+
from collections.abc import Sequence
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
FloatArray = Sequence[float]
|
|
11
|
+
FloatMatrix = Sequence[FloatArray]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class PhysicsPage(LittleEndianStructure):
|
|
15
|
+
_layout_ = "ms"
|
|
16
|
+
_pack_ = 4
|
|
17
|
+
|
|
18
|
+
packetId: int
|
|
19
|
+
gas: float
|
|
20
|
+
brake: float
|
|
21
|
+
fuel: float
|
|
22
|
+
gear: int
|
|
23
|
+
rpms: int
|
|
24
|
+
steerAngle: float
|
|
25
|
+
speedKmh: float
|
|
26
|
+
velocity: FloatArray
|
|
27
|
+
accG: FloatArray
|
|
28
|
+
wheelSlip: FloatArray
|
|
29
|
+
wheelLoad: FloatArray
|
|
30
|
+
wheelsPressure: FloatArray
|
|
31
|
+
wheelAngularSpeed: FloatArray
|
|
32
|
+
tyreWear: FloatArray
|
|
33
|
+
tyreDirtyLevel: FloatArray
|
|
34
|
+
tyreCoreTemperature: FloatArray
|
|
35
|
+
camberRAD: FloatArray
|
|
36
|
+
suspensionTravel: FloatArray
|
|
37
|
+
drs: float
|
|
38
|
+
tc: float
|
|
39
|
+
heading: float
|
|
40
|
+
pitch: float
|
|
41
|
+
roll: float
|
|
42
|
+
cgHeight: float
|
|
43
|
+
carDamage: FloatArray
|
|
44
|
+
numberOfTyresOut: int
|
|
45
|
+
pitLimiterOn: int
|
|
46
|
+
abs: float
|
|
47
|
+
kersCharge: float
|
|
48
|
+
kersInput: float
|
|
49
|
+
autoShifterOn: int
|
|
50
|
+
rideHeight: FloatArray
|
|
51
|
+
turboBoost: float
|
|
52
|
+
ballast: float
|
|
53
|
+
airDensity: float
|
|
54
|
+
airTemp: float
|
|
55
|
+
roadTemp: float
|
|
56
|
+
localAngularVel: FloatArray
|
|
57
|
+
finalFF: float
|
|
58
|
+
performanceMeter: float
|
|
59
|
+
engineBrake: int
|
|
60
|
+
ersRecoveryLevel: int
|
|
61
|
+
ersPowerLevel: int
|
|
62
|
+
ersHeatCharging: int
|
|
63
|
+
ersIsCharging: int
|
|
64
|
+
kersCurrentKJ: float
|
|
65
|
+
drsAvailable: int
|
|
66
|
+
drsEnabled: int
|
|
67
|
+
brakeTemp: FloatArray
|
|
68
|
+
clutch: float
|
|
69
|
+
tyreTempI: FloatArray
|
|
70
|
+
tyreTempM: FloatArray
|
|
71
|
+
tyreTempO: FloatArray
|
|
72
|
+
isAIControlled: int
|
|
73
|
+
tyreContactPoint: FloatMatrix
|
|
74
|
+
tyreContactNormal: FloatMatrix
|
|
75
|
+
tyreContactHeading: FloatMatrix
|
|
76
|
+
brakeBias: float
|
|
77
|
+
localVelocity: FloatArray
|
|
78
|
+
P2PActivations: int
|
|
79
|
+
P2PStatus: int
|
|
80
|
+
currentMaxRpm: int
|
|
81
|
+
mz: FloatArray
|
|
82
|
+
fx: FloatArray
|
|
83
|
+
fy: FloatArray
|
|
84
|
+
slipRatio: FloatArray
|
|
85
|
+
slipAngle: FloatArray
|
|
86
|
+
tcinAction: int
|
|
87
|
+
absInAction: int
|
|
88
|
+
suspensionDamage: FloatArray
|
|
89
|
+
tyreTemp: FloatArray
|
|
90
|
+
waterTemp: float
|
|
91
|
+
brakeTorque: FloatArray
|
|
92
|
+
frontBrakeCompound: int
|
|
93
|
+
rearBrakeCompound: int
|
|
94
|
+
padLife: FloatArray
|
|
95
|
+
discLife: FloatArray
|
|
96
|
+
ignitionOn: int
|
|
97
|
+
starterEngineOn: int
|
|
98
|
+
isEngineRunning: int
|
|
99
|
+
kerbVibration: float
|
|
100
|
+
slipVibrations: float
|
|
101
|
+
roadVibrations: float
|
|
102
|
+
absVibrations: float
|
|
103
|
+
|
|
104
|
+
_fields_ = [
|
|
105
|
+
("packetId", c_int32),
|
|
106
|
+
("gas", c_float),
|
|
107
|
+
("brake", c_float),
|
|
108
|
+
("fuel", c_float),
|
|
109
|
+
("gear", c_int32),
|
|
110
|
+
("rpms", c_int32),
|
|
111
|
+
("steerAngle", c_float),
|
|
112
|
+
("speedKmh", c_float),
|
|
113
|
+
("velocity", (c_float * 3)),
|
|
114
|
+
("accG", (c_float * 3)),
|
|
115
|
+
("wheelSlip", (c_float * 4)),
|
|
116
|
+
("wheelLoad", (c_float * 4)),
|
|
117
|
+
("wheelsPressure", (c_float * 4)),
|
|
118
|
+
("wheelAngularSpeed", (c_float * 4)),
|
|
119
|
+
("tyreWear", (c_float * 4)),
|
|
120
|
+
("tyreDirtyLevel", (c_float * 4)),
|
|
121
|
+
("tyreCoreTemperature", (c_float * 4)),
|
|
122
|
+
("camberRAD", (c_float * 4)),
|
|
123
|
+
("suspensionTravel", (c_float * 4)),
|
|
124
|
+
("drs", c_float),
|
|
125
|
+
("tc", c_float),
|
|
126
|
+
("heading", c_float),
|
|
127
|
+
("pitch", c_float),
|
|
128
|
+
("roll", c_float),
|
|
129
|
+
("cgHeight", c_float),
|
|
130
|
+
("carDamage", (c_float * 5)),
|
|
131
|
+
("numberOfTyresOut", c_int32),
|
|
132
|
+
("pitLimiterOn", c_int32),
|
|
133
|
+
("abs", c_float),
|
|
134
|
+
("kersCharge", c_float),
|
|
135
|
+
("kersInput", c_float),
|
|
136
|
+
("autoShifterOn", c_int32),
|
|
137
|
+
("rideHeight", (c_float * 2)),
|
|
138
|
+
("turboBoost", c_float),
|
|
139
|
+
("ballast", c_float),
|
|
140
|
+
("airDensity", c_float),
|
|
141
|
+
("airTemp", c_float),
|
|
142
|
+
("roadTemp", c_float),
|
|
143
|
+
("localAngularVel", (c_float * 3)),
|
|
144
|
+
("finalFF", c_float),
|
|
145
|
+
("performanceMeter", c_float),
|
|
146
|
+
("engineBrake", c_int32),
|
|
147
|
+
("ersRecoveryLevel", c_int32),
|
|
148
|
+
("ersPowerLevel", c_int32),
|
|
149
|
+
("ersHeatCharging", c_int32),
|
|
150
|
+
("ersIsCharging", c_int32),
|
|
151
|
+
("kersCurrentKJ", c_float),
|
|
152
|
+
("drsAvailable", c_int32),
|
|
153
|
+
("drsEnabled", c_int32),
|
|
154
|
+
("brakeTemp", (c_float * 4)),
|
|
155
|
+
("clutch", c_float),
|
|
156
|
+
("tyreTempI", (c_float * 4)),
|
|
157
|
+
("tyreTempM", (c_float * 4)),
|
|
158
|
+
("tyreTempO", (c_float * 4)),
|
|
159
|
+
("isAIControlled", c_int32),
|
|
160
|
+
("tyreContactPoint", ((c_float * 3) * 4)),
|
|
161
|
+
("tyreContactNormal", ((c_float * 3) * 4)),
|
|
162
|
+
("tyreContactHeading", ((c_float * 3) * 4)),
|
|
163
|
+
("brakeBias", c_float),
|
|
164
|
+
("localVelocity", (c_float * 3)),
|
|
165
|
+
("P2PActivations", c_int32),
|
|
166
|
+
("P2PStatus", c_int32),
|
|
167
|
+
("currentMaxRpm", c_int32),
|
|
168
|
+
("mz", (c_float * 4)),
|
|
169
|
+
("fx", (c_float * 4)),
|
|
170
|
+
("fy", (c_float * 4)),
|
|
171
|
+
("slipRatio", (c_float * 4)),
|
|
172
|
+
("slipAngle", (c_float * 4)),
|
|
173
|
+
("tcinAction", c_int32),
|
|
174
|
+
("absInAction", c_int32),
|
|
175
|
+
("suspensionDamage", (c_float * 4)),
|
|
176
|
+
("tyreTemp", (c_float * 4)),
|
|
177
|
+
("waterTemp", c_float),
|
|
178
|
+
("brakeTorque", (c_float * 4)),
|
|
179
|
+
("frontBrakeCompound", c_int32),
|
|
180
|
+
("rearBrakeCompound", c_int32),
|
|
181
|
+
("padLife", (c_float * 4)),
|
|
182
|
+
("discLife", (c_float * 4)),
|
|
183
|
+
("ignitionOn", c_int32),
|
|
184
|
+
("starterEngineOn", c_int32),
|
|
185
|
+
("isEngineRunning", c_int32),
|
|
186
|
+
("kerbVibration", c_float),
|
|
187
|
+
("slipVibrations", c_float),
|
|
188
|
+
("roadVibrations", c_float),
|
|
189
|
+
("absVibrations", c_float),
|
|
190
|
+
]
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
assert sizeof(PhysicsPage) == 800, "PhysicsPage differs from the EVO ABI"
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
from ctypes import (
|
|
2
|
+
LittleEndianStructure,
|
|
3
|
+
sizeof,
|
|
4
|
+
c_bool,
|
|
5
|
+
c_char,
|
|
6
|
+
c_float,
|
|
7
|
+
c_int32,
|
|
8
|
+
c_uint8,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class StaticPage(LittleEndianStructure):
|
|
13
|
+
_layout_ = "ms"
|
|
14
|
+
_pack_ = 4
|
|
15
|
+
|
|
16
|
+
sm_version: bytes
|
|
17
|
+
ac_evo_version: bytes
|
|
18
|
+
session: int
|
|
19
|
+
session_name: bytes
|
|
20
|
+
event_id: int
|
|
21
|
+
session_id: int
|
|
22
|
+
starting_grip: int
|
|
23
|
+
starting_ambient_temperature_c: float
|
|
24
|
+
starting_ground_temperature_c: float
|
|
25
|
+
is_static_weather: bool
|
|
26
|
+
is_timed_race: bool
|
|
27
|
+
is_online: bool
|
|
28
|
+
number_of_sessions: int
|
|
29
|
+
nation: bytes
|
|
30
|
+
longitude: float
|
|
31
|
+
latitude: float
|
|
32
|
+
track: bytes
|
|
33
|
+
track_configuration: bytes
|
|
34
|
+
track_length_m: float
|
|
35
|
+
|
|
36
|
+
_fields_ = [
|
|
37
|
+
("sm_version", (c_char * 15)),
|
|
38
|
+
("ac_evo_version", (c_char * 15)),
|
|
39
|
+
("session", c_int32),
|
|
40
|
+
("session_name", (c_char * 33)),
|
|
41
|
+
("event_id", c_uint8),
|
|
42
|
+
("session_id", c_uint8),
|
|
43
|
+
("starting_grip", c_int32),
|
|
44
|
+
("starting_ambient_temperature_c", c_float),
|
|
45
|
+
("starting_ground_temperature_c", c_float),
|
|
46
|
+
("is_static_weather", c_bool),
|
|
47
|
+
("is_timed_race", c_bool),
|
|
48
|
+
("is_online", c_bool),
|
|
49
|
+
("number_of_sessions", c_int32),
|
|
50
|
+
("nation", (c_char * 33)),
|
|
51
|
+
("longitude", c_float),
|
|
52
|
+
("latitude", c_float),
|
|
53
|
+
("track", (c_char * 33)),
|
|
54
|
+
("track_configuration", (c_char * 33)),
|
|
55
|
+
("track_length_m", c_float),
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
assert sizeof(StaticPage) == 208, "StaticPage differs from the EVO ABI"
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import ctypes
|
|
2
|
+
from ctypes import wintypes
|
|
3
|
+
from typing import TypeVar
|
|
4
|
+
|
|
5
|
+
from .models.graphics import GraphicsPage
|
|
6
|
+
from .models.physics import PhysicsPage
|
|
7
|
+
from .models.static import StaticPage
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Page = TypeVar("Page", bound=ctypes.Structure)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Reader:
|
|
14
|
+
"""Read Assetto Corsa EVO shared-memory telemetry on Windows."""
|
|
15
|
+
|
|
16
|
+
def __init__(self) -> None:
|
|
17
|
+
self.kernel32 = kernel32 = ctypes.WinDLL("kernel32", use_last_error=True)
|
|
18
|
+
kernel32.OpenFileMappingW.argtypes = (
|
|
19
|
+
wintypes.DWORD,
|
|
20
|
+
wintypes.BOOL,
|
|
21
|
+
wintypes.LPCWSTR,
|
|
22
|
+
)
|
|
23
|
+
kernel32.OpenFileMappingW.restype = wintypes.HANDLE
|
|
24
|
+
kernel32.MapViewOfFile.argtypes = (
|
|
25
|
+
wintypes.HANDLE,
|
|
26
|
+
wintypes.DWORD,
|
|
27
|
+
wintypes.DWORD,
|
|
28
|
+
wintypes.DWORD,
|
|
29
|
+
ctypes.c_size_t,
|
|
30
|
+
)
|
|
31
|
+
kernel32.MapViewOfFile.restype = ctypes.c_void_p
|
|
32
|
+
kernel32.UnmapViewOfFile.argtypes = (ctypes.c_void_p,)
|
|
33
|
+
kernel32.UnmapViewOfFile.restype = wintypes.BOOL
|
|
34
|
+
kernel32.CloseHandle.argtypes = (wintypes.HANDLE,)
|
|
35
|
+
kernel32.CloseHandle.restype = wintypes.BOOL
|
|
36
|
+
|
|
37
|
+
def read_static(self) -> StaticPage:
|
|
38
|
+
"""Return validated session metadata; refresh when a new session loads."""
|
|
39
|
+
metadata = self._read_page("Local\\acevo_pmf_static", StaticPage)
|
|
40
|
+
if metadata.sm_version != b"1.0":
|
|
41
|
+
raise ValueError(
|
|
42
|
+
f"Unsupported EVO shared-memory API {metadata.sm_version!r}; expected b'1.0'."
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
return metadata
|
|
46
|
+
|
|
47
|
+
def read_physics(self) -> PhysicsPage:
|
|
48
|
+
"""Return a copied physics page; call read_static first to validate the API."""
|
|
49
|
+
return self._read_page("Local\\acevo_pmf_physics", PhysicsPage)
|
|
50
|
+
|
|
51
|
+
def read_graphics(self) -> GraphicsPage:
|
|
52
|
+
"""Return a copied graphics page; call read_static first to validate the API."""
|
|
53
|
+
return self._read_page("Local\\acevo_pmf_graphics", GraphicsPage)
|
|
54
|
+
|
|
55
|
+
def _read_page(self, name: str, page_type: type[Page]) -> Page:
|
|
56
|
+
kernel32 = self.kernel32
|
|
57
|
+
handle = kernel32.OpenFileMappingW(4, False, name)
|
|
58
|
+
if not handle:
|
|
59
|
+
error = ctypes.get_last_error()
|
|
60
|
+
if error == 2:
|
|
61
|
+
message = "The Assetto Corsa Evo shared memory is unavailable. Start a driving session."
|
|
62
|
+
raise FileNotFoundError(message)
|
|
63
|
+
raise ctypes.WinError(ctypes.get_last_error())
|
|
64
|
+
|
|
65
|
+
try:
|
|
66
|
+
# Use the read-only handle directly; mmap reopens the named mapping.
|
|
67
|
+
size = ctypes.sizeof(page_type)
|
|
68
|
+
address = kernel32.MapViewOfFile(handle, 4, 0, 0, size)
|
|
69
|
+
if not address:
|
|
70
|
+
raise ctypes.WinError(ctypes.get_last_error())
|
|
71
|
+
try:
|
|
72
|
+
return page_type.from_buffer_copy(ctypes.string_at(address, size))
|
|
73
|
+
finally:
|
|
74
|
+
kernel32.UnmapViewOfFile(address)
|
|
75
|
+
finally:
|
|
76
|
+
kernel32.CloseHandle(handle)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py-acevo
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Read Assetto Corsa EVO shared memory on Windows.
|
|
5
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
9
|
+
# py-acevo
|
|
10
|
+
|
|
11
|
+
The Python library to read shared memory of Assetto Corsa Evo.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
README.MD
|
|
2
|
+
VERSION
|
|
3
|
+
pyproject.toml
|
|
4
|
+
acevo/__init__.py
|
|
5
|
+
acevo/reader.py
|
|
6
|
+
acevo/models/__init__.py
|
|
7
|
+
acevo/models/enums.py
|
|
8
|
+
acevo/models/graphics.py
|
|
9
|
+
acevo/models/physics.py
|
|
10
|
+
acevo/models/static.py
|
|
11
|
+
py_acevo.egg-info/PKG-INFO
|
|
12
|
+
py_acevo.egg-info/SOURCES.txt
|
|
13
|
+
py_acevo.egg-info/dependency_links.txt
|
|
14
|
+
py_acevo.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
acevo
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools >= 77.0.3"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "py-acevo"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Read Assetto Corsa EVO shared memory on Windows."
|
|
9
|
+
readme = "README.MD"
|
|
10
|
+
requires-python = ">= 3.9"
|
|
11
|
+
classifiers = ["Operating System :: Microsoft :: Windows"]
|
|
12
|
+
|
|
13
|
+
[tool.setuptools.packages.find]
|
|
14
|
+
include = ["acevo*"]
|
|
15
|
+
|
|
16
|
+
[tool.setuptools.dynamic]
|
|
17
|
+
version = { file = ["VERSION"] }
|
py_acevo-0.0.1/setup.cfg
ADDED