diff --git a/irsdk.py b/irsdk.py index 768c5e9..9ef7760 100644 --- a/irsdk.py +++ b/irsdk.py @@ -15,7 +15,7 @@ except ImportError: from yaml import SafeLoader as YamlSafeLoader -VERSION = '1.2.6' +VERSION = '1.3.0' SIM_STATUS_URL = 'http://127.0.0.1:32034/get_sim_status?object=simStatus' @@ -39,6 +39,7 @@ class EngineWarnings: engine_stalled = 0x08 pit_speed_limiter = 0x10 rev_limiter_active = 0x20 + oil_temp_warning = 0x40 class Flags: # global flags @@ -146,6 +147,7 @@ class BroadcastMsg: telem_command = 10 # irsdk_TelemCommandMode, unused, unused ffb_command = 11 # irsdk_FFBCommandMode, value (float, high, low) replay_search_session_time = 12 # sessionNum, sessionTimeMS (high, low) + video_capture = 13 # irsdk_VideoCaptureMode, unused, unused class ChatCommandMode: macro = 0 # pass in a number from 1-15 representing the chat macro to launch @@ -246,6 +248,13 @@ class CarLeftRight: class FFBCommandMode: # You can call this any time ffb_command_max_force = 0 # Set the maximum force when mapping steering torque force to direct input units (float in Nm) +class VideoCaptureMode: + trigger_screen_shot = 0 # save a screenshot to disk + start_video_capture = 1 # start capturing video + end_video_capture = 2 # stop capturing video + toggle_video_capture = 3 # toggle video capture on/off + show_video_timer = 4 # show video timer in upper left corner of display + hide_video_timer = 5 # hide video timer class IRSDKStruct: @@ -477,12 +486,15 @@ def pit_command(self, pit_command_mode=PitCommandMode.clear, var=0): def telem_command(self, telem_command_mode=TelemCommandMode.stop): return self._broadcast_msg(BroadcastMsg.telem_command, telem_command_mode) - def ffb_command(self, ffb_command_mode=FFBCommandMode.ffb_command_max_force, value=0.0): - return self._broadcast_msg(BroadcastMsg.ffb_command, ffb_command_mode, float(value)) + def ffb_command(self, ffb_command_mode=FFBCommandMode.ffb_command_max_force, value=0): + return self._broadcast_msg(BroadcastMsg.ffb_command, ffb_command_mode, int(value * 65536)) def replay_search_session_time(self, session_num=0, session_time_ms=0): return self._broadcast_msg(BroadcastMsg.replay_search_session_time, session_num, session_time_ms) + def video_capture(self, video_capture_mode=VideoCaptureMode.trigger_screen_shot): + return self._broadcast_msg(BroadcastMsg.video_capture, video_capture_mode) + def _check_sim_status(self): try: return 'running:1' in request.urlopen(SIM_STATUS_URL).read().decode('utf-8') @@ -615,8 +627,6 @@ def _broadcast_msg_id(self): return self.__broadcast_msg_id def _broadcast_msg(self, broadcast_type=0, var1=0, var2=0, var3=0): - if isinstance(var2, float): - var2 = int(var2 * 65536.0) return ctypes.windll.user32.SendNotifyMessageW(0xFFFF, self._broadcast_msg_id, broadcast_type | var1 << 16, var2 | var3 << 16) diff --git a/vars.txt b/vars.txt index ac3ddfd..1b936e3 100644 --- a/vars.txt +++ b/vars.txt @@ -2,6 +2,7 @@ AirDensity Density of air at start/finish line, kg/m^3 AirPressure Pressure of air at start/finish line, Hg AirTemp Temperature of air at start/finish line, C Brake 0=brake released to 1=max pedal force, % +BrakeABSactive true if abs is currently reducing brake force pressure, BrakeRaw Raw brake input 0=brake released to 1=max pedal force, % CamCameraNumber Active camera number, CamCameraState State of camera system, irsdk_CameraState @@ -9,9 +10,11 @@ CamCarIdx Active camera's focus car index, CamGroupNumber Active camera group number, CarIdxBestLapNum Cars best lap number, CarIdxBestLapTime Cars best lap time, s +CarIdxClass Cars class id by car index, CarIdxClassPosition Cars class position in race by car index, CarIdxEstTime Estimated time to reach current location on track, s CarIdxF2Time Race time behind leader or fastest lap time otherwise, s +CarIdxFastRepairsUsed How many fast repairs each car has used, CarIdxGear -1=reverse 0=neutral 1..n=current gear by car index, CarIdxLap Laps started by car index, CarIdxLapCompleted Laps completed by car index, @@ -32,10 +35,17 @@ CarIdxTireCompound Cars current tire compound, CarIdxTrackSurface Track surface type by car index, irsdk_TrkLoc CarIdxTrackSurfaceMaterial Track surface material type by car index, irsdk_TrkSurf CarLeftRight Notify if car is to the left or right of driver, irsdk_CarLeftRight +ChanAvgLatency Communications average latency, s +ChanClockSkew Communications server clock skew, s +ChanLatency Communications latency, s +ChanPartnerQuality Partner communications quality, % +ChanQuality Communications quality, % Clutch 0=disengaged to 1=fully engaged, % CpuUsageBG Percent of available tim bg thread took with a 1 sec avg, % +CpuUsageFG Percent of available tim fg thread took with a 1 sec avg, % DCDriversSoFar Number of team drivers who have run a stint, DCLapStatus Status of driver change lap requirements, +dcPitSpeedLimiterToggle In car traction control active, dcStarter In car trigger car starter, DisplayUnits Default units for the user interface 0 = english 1 = metric, dpFastRepair Pitstop fast repair set, @@ -64,6 +74,7 @@ FuelLevelPct Percent fuel remaining, % FuelPress Engine fuel pressure, bar FuelUsePerHour Engine fuel used instantaneous, kg/h Gear -1=reverse 0=neutral 1..n=current gear, +GpuUsage Percent of available tim gpu took with a 1 sec avg, % HandbrakeRaw Raw handbrake input 0=handbrake released to 1=max force, % IsDiskLoggingActive 0=disk based telemetry file not being written 1=being written, IsDiskLoggingEnabled 0=disk based telemetry turned off 1=turned on, @@ -136,6 +147,7 @@ LRwearR LR tire right percent tread remaining, % ManifoldPress Engine manifold pressure, bar ManualBoost Hybrid manual boost state, ManualNoBoost Hybrid manual no boost state, +MemPageFaultSec Memory page faults per second, OilLevel Engine oil level, l OilPress Engine oil pressure, bar OilTemp Engine oil temperature, C @@ -156,6 +168,7 @@ PitSvLRP Pit service left rear tire pressure, kPa PitSvRFP Pit service right front tire pressure, kPa PitSvRRP Pit service right rear tire pressure, kPa PitSvTireCompound Pit service pending tire compound, +PlayerCarClass Player car class id, PlayerCarClassPosition Players class position in race, PlayerCarDriverIncidentCount Teams current drivers incident count for this session, PlayerCarDryTireSetLimit Players dry tire set limit, @@ -168,6 +181,7 @@ PlayerCarPowerAdjust Players power adjust, % PlayerCarTeamIncidentCount Players team incident count for this session, PlayerCarTowTime Players car is being towed if time is greater than zero, s PlayerCarWeightPenalty Players weight penalty, kg +PlayerFastRepairsUsed Players car number of fast repairs used, PlayerTireCompound Players car current tire compound, PlayerTrackSurface Players car track surface type, irsdk_TrkLoc PlayerTrackSurfaceMaterial Players car track surface material type, irsdk_TrkSurf @@ -222,12 +236,14 @@ RRwearR RR tire right percent tread remaining, % SessionFlags Session flags, irsdk_Flags SessionLapsRemain Old laps left till session ends use SessionLapsRemainEx, SessionLapsRemainEx New improved laps left till session ends, +SessionLapsTotal Total number of laps in session, SessionNum Session number, SessionState Session state, irsdk_SessionState SessionTick Current update number, SessionTime Seconds since session start, s SessionTimeOfDay Time of day in seconds, s SessionTimeRemain Seconds left till session ends, s +SessionTimeTotal Total number of seconds in session, s SessionUniqueID Session ID, ShiftGrindRPM RPM of shifter grinding noise, RPM ShiftIndicatorPct DEPRECATED use DriverCarSLBlinkRPM instead, % @@ -262,6 +278,8 @@ VelocityZ Z velocity, m/s VelocityZ_ST Z velocity, m/s at 360 Hz VertAccel Vertical acceleration (including gravity), m/s^2 VertAccel_ST Vertical acceleration (including gravity) at 360 Hz, m/s^2 +VidCapActive True if video currently being captured, +VidCapEnabled True if video capture system is enabled, Voltage Engine voltage, V WaterLevel Engine coolant level, l WaterTemp Engine coolant temp, C