Skip to content

Instantly share code, notes, and snippets.

@LeonB
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LeonB/b0670d947bb7b4a3f6db to your computer and use it in GitHub Desktop.
Save LeonB/b0670d947bb7b4a3f6db to your computer and use it in GitHub Desktop.
irsdk_broadcastMsg test

Compile with i686-w64-mingw32-g++ -static-libgcc -static test.cpp
Run with /opt/iracing/bin/wine --bottle default a.exe

#include <windows.h>
#include <stdio.h>
#include <tchar.h>
enum irsdk_BroadcastMsg
{
irsdk_BroadcastCamSwitchPos = 0, // car position, group, camera
irsdk_BroadcastCamSwitchNum, // driver #, group, camera
irsdk_BroadcastCamSetState, // irsdk_CameraState, unused, unused
irsdk_BroadcastReplaySetPlaySpeed, // speed, slowMotion, unused
irskd_BroadcastReplaySetPlayPosition, // irsdk_RpyPosMode, Frame Number (high, low)
irsdk_BroadcastReplaySearch, // irsdk_RpySrchMode, unused, unused
irsdk_BroadcastReplaySetState, // irsdk_RpyStateMode, unused, unused
irsdk_BroadcastReloadTextures, // irsdk_ReloadTexturesMode, carIdx, unused
irsdk_BroadcastChatComand, // irsdk_ChatCommandMode, subCommand, unused
irsdk_BroadcastPitCommand, // irsdk_PitCommandMode, parameter
irsdk_BroadcastTelemCommand, // irsdk_TelemCommandMode, unused, unused
irsdk_BroadcastLast // unused placeholder
};
enum irsdk_ChatCommandMode
{
irsdk_ChatCommand_Macro = 0, // pass in a number from 1-15 representing the chat macro to launch
irsdk_ChatCommand_BeginChat, // Open up a new chat window
irsdk_ChatCommand_Reply, // Reply to last private chat
irsdk_ChatCommand_Cancel // Close chat window
};
static const _TCHAR IRSDK_BROADCASTMSGNAME[] = _T("IRSDK_BROADCASTMSG");
unsigned int irsdk_getBroadcastMsgID()
{
static unsigned int msgId = RegisterWindowMessageA(IRSDK_BROADCASTMSGNAME);
return msgId;
}
void irsdk_broadcastMsg(irsdk_BroadcastMsg msg, int var1, int var2)
{
static unsigned int msgId = irsdk_getBroadcastMsgID();
if(msgId && msg >= 0 && msg < irsdk_BroadcastLast)
{
SendNotifyMessage(HWND_BROADCAST, msgId, MAKELONG(msg, var1), var2);
}
}
void irsdk_broadcastMsg(irsdk_BroadcastMsg msg, int var1, int var2, int var3)
{
printf("msg: %d\n", msg);
printf("var1: %d\n", var1);
printf("MAKELONG(var2, var3): %d\n", MAKELONG(var2, var3));
irsdk_broadcastMsg(msg, var1, MAKELONG(var2, var3));
}
int main()
{
int chatMacro = 0;
printf("Sending chatMacro\n");
irsdk_broadcastMsg(irsdk_BroadcastChatComand, irsdk_ChatCommand_Macro, chatMacro++, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment