Documentation ¶
Index ¶
- Constants
- Variables
- func CToGoString(c []byte) string
- func MAKELONG(lo, hi uint16) uint32
- type BroadcastMsg
- type CWrapper
- func (cw *CWrapper) CloseHandle(handle uintptr) error
- func (cw *CWrapper) OpenEvent(lpName string) (uintptr, error)
- func (cw *CWrapper) RegisterWindowMessageA(lpString string) (uint, error)
- func (cw *CWrapper) RegisterWindowMessageW(lpString string) (uint, error)
- func (cw *CWrapper) SendNotifyMessage(msgID uint, wParam uint32, lParam uint32) error
- func (cw *CWrapper) SendNotifyMessageW(msgID uint, wParam uint32, lParam uint32) error
- func (cw *CWrapper) UnmapViewOfFile(lpBaseAddress uintptr) error
- func (cw *CWrapper) WaitForDataChange(timeout time.Duration) error
- func (cw *CWrapper) WaitForDataChangeChannel(timeout time.Duration) error
- func (cw *CWrapper) WaitForSingleObject(hDataValidEvent uintptr, timeOut int) error
- type CameraState
- type ChatCommandMode
- type CsMode
- type DiskSubHeader
- type EngineWarnings
- type Flags
- type GetMemoryArgs
- type Header
- type Irsdk
- func (ir *Irsdk) BroadcastMsg(msg BroadcastMsg, var1 uint16, var2 uint16, var3 uint16) error
- func (ir *Irsdk) GetBroadcastMsgID() (uint, error)
- func (ir *Irsdk) GetHeader() (*Header, error)
- func (ir *Irsdk) GetLastValidTime() time.Time
- func (ir *Irsdk) GetNewData() ([]byte, error)
- func (ir *Irsdk) GetNumVars() int
- func (ir *Irsdk) GetSessionInfoStr() []byte
- func (ir *Irsdk) GetVarHeaderEntry(index int) (*VarHeader, error)
- func (ir *Irsdk) IsConnected() bool
- func (ir *Irsdk) PadCarNum(num int, zero int) int
- func (ir *Irsdk) Shutdown()
- func (ir *Irsdk) Startup() error
- func (ir *Irsdk) VarNameToIndex(name string) (int, error)
- func (ir *Irsdk) VarNameToOffset(name string) (int, error)
- func (ir *Irsdk) WaitForDataReady(timeOut time.Duration) ([]byte, error)
- type MapViewOfFileArgs
- type OpenEventArgs
- type OpenFileMappingArgs
- type PitCommandMode
- type PitSvFlag
- type PtrToHeaderArgs
- type PtrToSharedMemArgs
- type PtrToVarHeaderArgs
- type ReloadTexturesMode
- type RpyPosMode
- type RpySrchMode
- type RpyStateMode
- type SessionState
- type StatusField
- type TelemCommandMode
- type TrkLoc
- type VarBuf
- type VarHeader
- type VarType
- type WaitForSingleObjectArgs
Constants ¶
View Source
const ( RPC_COMMAND = "utils/assets/ir-syscalls-rpc.exe" DATA_CHANGE_TICK = time.Duration(time.Millisecond * 9) )
View Source
const ( MEMMAPFILENAME = "Local\\IRSDKMemMapFileName" BROADCASTMSGNAME = "IRSDK_BROADCASTMSG" DATAVALIDEVENTNAME = "Local\\IRSDKDataValidEvent" INT_MAX = 2147483647 MEMMAPFILESIZE = 780 * 1024 MAX_BUFS = 4 MAX_STRING = 32 // descriptions can be longer than max_string! MAX_DESC = 64 TIMEOUT = time.Duration(time.Second * 30) // timeout after 30 seconds with no communication )
Variables ¶
View Source
var ( ErrInitialize = errors.New("Failed to initialize") ErrDataChanged = errors.New("Data changed out from under us") ErrDisconnected = errors.New("We probably disconnected") ErrNothingChanged = errors.New("Nothing changed this tick") )
View Source
var VarTypeBytes = [ETCount]VarType{
1,
1,
4,
4,
4,
8,
}
const doesn't work for some reason
View Source
var (
WineCmd = []string{"/opt/iracing/bin/wine", "--bottle", "default"}
)
Functions ¶
func CToGoString ¶
Types ¶
type BroadcastMsg ¶
type BroadcastMsg uint16
const ( BroadcastCamSwitchPos BroadcastMsg = 0 // car position, group, camera BroadcastCamSwitchNum BroadcastMsg = iota // driver #, group, camera BroadcastCamSetState BroadcastMsg = iota // CameraState, unused, unused BroadcastReplaySetPlaySpeed BroadcastMsg = iota // speed, slowMotion, unused BroadcastReplaySetPlayPosition BroadcastMsg = iota // RpyPosMode, Frame Number (high, low) BroadcastReplaySearch BroadcastMsg = iota // RpySrchMode, unused, unused BroadcastReplaySetState BroadcastMsg = iota // RpyStateMode, unused, unused BroadcastReloadTextures BroadcastMsg = iota // ReloadTexturesMode, carIdx, unused BroadcastChatComand BroadcastMsg = iota // ChatCommandMode, subCommand, unused BroadcastPitCommand BroadcastMsg = iota // PitCommandMode, parameter BroadcastTelemCommand BroadcastMsg = iota // TelemCommandMode, unused, unused BroadcastLast BroadcastMsg = iota // unused placeholder )
type CWrapper ¶
type CWrapper struct {
// contains filtered or unexported fields
}
func NewCWrapper ¶
func (*CWrapper) CloseHandle ¶
func (*CWrapper) RegisterWindowMessageA ¶
func (*CWrapper) RegisterWindowMessageW ¶
func (*CWrapper) SendNotifyMessage ¶
func (*CWrapper) SendNotifyMessageW ¶
func (*CWrapper) UnmapViewOfFile ¶
func (*CWrapper) WaitForDataChange ¶
func (*CWrapper) WaitForDataChangeChannel ¶
type CameraState ¶
type CameraState int32
const ( IsSessionScreen CameraState = 0x0001 // the camera tool can only be activated if viewing the session screen (out of car) IsScenicActive CameraState = 0x0002 // the scenic camera is active (no focus car) //these can be changed with a broadcast message CamToolActive CameraState = 0x0004 UIHidden CameraState = 0x0008 UseAutoShotSelection CameraState = 0x0010 UseTemporaryEdits CameraState = 0x0020 UseKeyAcceleration CameraState = 0x0040 UseKey10xAcceleration CameraState = 0x0080 UseMouseAimMode CameraState = 0x0100 )
type ChatCommandMode ¶
type ChatCommandMode int32
const ( ChatCommand_Macro ChatCommandMode = 0 // pass in a number from 1-15 representing the chat macro to launch ChatCommand_BeginChat ChatCommandMode = iota // Open up a new chat window ChatCommand_Reply ChatCommandMode = iota // Reply to last private chat ChatCommand_Cancel ChatCommandMode = iota // Close chat window )
type CsMode ¶
type CsMode int32
BroadcastCamSwitchPos or BroadcastCamSwitchNum camera focus defines pass these in for the first parameter to select the 'focus at' types in the camera system.
type DiskSubHeader ¶
type DiskSubHeader struct {
// contains filtered or unexported fields
}
sub header used when writing telemetry to disk
type EngineWarnings ¶
type EngineWarnings int32
bit fields
const ( WaterTempWarning EngineWarnings = 0x01 FuelPressureWarning EngineWarnings = 0x02 OilPressureWarning EngineWarnings = 0x04 EngineStalled EngineWarnings = 0x08 PitSpeedLimiter EngineWarnings = 0x10 RevLimiterActive EngineWarnings = 0x20 )
type Flags ¶
type Flags uint32
const ( // global flags CheckeredFlag Flags = 0x00000001 WhiteFlag Flags = 0x00000002 GreenFlag Flags = 0x00000004 YellowFlag Flags = 0x00000008 RedFlag Flags = 0x00000010 BlueFlag Flags = 0x00000020 DebrisFlag Flags = 0x00000040 CrossedFlag Flags = 0x00000080 YellowWavingFlag Flags = 0x00000100 OneLapToGreenFlag Flags = 0x00000200 GreenHeldFlag Flags = 0x00000400 TenToGoFlag Flags = 0x00000800 FiveToGoFlag Flags = 0x00001000 RandomWavingFlag Flags = 0x00002000 CautionFlag Flags = 0x00004000 CautionWavingFlag Flags = 0x00008000 // drivers black flags BlackFlag Flags = 0x00010000 DisqualifyFlag Flags = 0x00020000 ServicibleFlag Flags = 0x00040000 // car is allowed service (not a flag) FurledFlag Flags = 0x00080000 RepairFlag Flags = 0x00100000 // start lights StartHidden Flags = 0x10000000 StartReady Flags = 0x20000000 StartSet Flags = 0x40000000 StartGo Flags = 0x80000000 )
type GetMemoryArgs ¶
type Header ¶
type Header struct { Ver int32 // api version 1 for now Status StatusField // bitfield using StatusField TickRate int32 // ticks per second (60 or 360 etc) // session information, updated periodicaly SessionInfoUpdate int32 // Incremented when session info changes SessionInfoLen int32 // Length in bytes of session info string SessionInfoOffset int32 // Session info, encoded in YAML format // State data, output at tickRate NumVars int32 // length of array pointed to by varHeaderOffset VarHeaderOffset int32 // offset to VarHeader[numVars] array, Describes the variables recieved in varBuf NumBuf int32 // <= MAX_BUFS (3 for now) BufLen int32 // length in bytes for one line Pad1 [2]int32 // (16 byte align) VarBuf [MAX_BUFS]VarBuf }
func (*Header) GetLatestVarBufN ¶
type Irsdk ¶
type Irsdk struct {
// contains filtered or unexported fields
}
func (*Irsdk) BroadcastMsg ¶
func (*Irsdk) GetBroadcastMsgID ¶
func (*Irsdk) GetLastValidTime ¶
func (*Irsdk) GetNewData ¶
func (*Irsdk) GetNumVars ¶
func (*Irsdk) GetSessionInfoStr ¶
func (*Irsdk) IsConnected ¶
func (*Irsdk) VarNameToIndex ¶
Note: this is a linear search, so cache the results
type MapViewOfFileArgs ¶
type OpenEventArgs ¶
type OpenEventArgs struct {
LpName string
}
type OpenFileMappingArgs ¶
type OpenFileMappingArgs struct {
LpName string
}
type PitCommandMode ¶
type PitCommandMode int32
const ( PitCommand_Clear PitCommandMode = 0 // Clear all pit checkboxes PitCommand_WS PitCommandMode = iota // Clean the winshield, using one tear off PitCommand_Fuel PitCommandMode = iota // Add fuel, optionally specify the amount to add in liters or pass '0' to use existing amount PitCommand_LF PitCommandMode = iota // Change the left front tire, optionally specifying the pressure in KPa or pass '0' to use existing pressure PitCommand_RF PitCommandMode = iota // right front PitCommand_LR PitCommandMode = iota // left rear PitCommand_RR PitCommandMode = iota // right rear PitCommand_ClearTires PitCommandMode = iota // Clear tire pit checkboxes )
type PtrToHeaderArgs ¶
type PtrToHeaderArgs struct {
}type PtrToSharedMemArgs ¶
type PtrToSharedMemArgs struct {
}type PtrToVarHeaderArgs ¶
type PtrToVarHeaderArgs struct {
VarHeaderPtr uintptr
}
type ReloadTexturesMode ¶
type ReloadTexturesMode int32
const ( ReloadTextures_All ReloadTexturesMode = 0 // reload all textuers ReloadTextures_CarIdx ReloadTexturesMode = iota // reload only textures for the specific carIdx )
type RpyPosMode ¶
type RpyPosMode int32
const ( RpyPos_Begin RpyPosMode = 0 RpyPos_Current RpyPosMode = iota RpyPos_End RpyPosMode = iota RpyPos_Last RpyPosMode = iota // unused placeholder )
type RpySrchMode ¶
type RpySrchMode int32
Search replay tape for events
const ( RpySrch_ToStart RpySrchMode = 0 RpySrch_ToEnd RpySrchMode = iota RpySrch_PrevSession RpySrchMode = iota RpySrch_NextSession RpySrchMode = iota RpySrch_PrevLap RpySrchMode = iota RpySrch_NextLap RpySrchMode = iota RpySrch_PrevFrame RpySrchMode = iota RpySrch_NextFrame RpySrchMode = iota RpySrch_PrevIncident RpySrchMode = iota RpySrch_NextIncident RpySrchMode = iota RpySrch_Last RpySrchMode = iota // unused placeholder )
type RpyStateMode ¶
type RpyStateMode int32
const ( RpyState_EraseTape RpyStateMode = 0 // clear any data in the replay tape RpyState_Last RpyStateMode = iota // unused place holder )
type SessionState ¶
type SessionState int32
const ( StateInvalid SessionState = iota StateGetInCar SessionState = iota StateWarmup SessionState = iota StateParadeLaps SessionState = iota StateRacing SessionState = iota StateCheckered SessionState = iota StateCoolDown SessionState = iota )
type TelemCommandMode ¶
type TelemCommandMode int32
const ( TelemCommand_Stop TelemCommandMode = 0 // Turn telemetry recording off TelemCommand_Start TelemCommandMode = iota // Turn telemetry recording on TelemCommand_Restart TelemCommandMode = iota // Write current file to disk and start a new one )
type VarHeader ¶
type VarHeader struct { Type VarType // VarType Offset int32 // offset fron start of buffer row Count int32 // number of entrys (array) Pad [1]int32 // (16 byte align) Name [MAX_STRING]byte Desc [MAX_DESC]byte Unit [MAX_STRING]byte // something like "kg/m^2" }
type WaitForSingleObjectArgs ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.