Skip to content
15 changes: 15 additions & 0 deletions Common Files/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,21 @@ UINT8 Helpers::WriteNop(INT_PTR offset, bool isRelativeOffset)
return nop;
}

UINT8 Helpers::WriteNopBytes(INT_PTR offset, int countBytes, bool isRelativeOffset)
{
U8 nop = 0x90;
SIZE_T written;
for (int i = 0; i < countBytes; i++)
{
offset = offset + i;
LPVOID trueOffset = (isRelativeOffset ? GetTranslatedOffset(offset) : (LPVOID)offset);
WriteProcessMemory(GetCurrentProcess(), trueOffset, &nop, 1, &written);
offset = offset - i;
}
return nop;
}


int Helpers::ReadInt32(INT_PTR offset, bool isRelativeOffset)
{
int val = 0;
Expand Down
1 change: 1 addition & 0 deletions Common Files/Game.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Helpers {
UINT8 WriteByte(INT_PTR offset, UINT8 val, bool isRelativeOffset);
INT_PTR WriteIntPtr(INT_PTR offset, INT_PTR val, bool isRelativeOffset);
UINT8 WriteNop(INT_PTR offset, bool isRelativeOffset);
UINT8 WriteNopBytes(INT_PTR offset, int countBytes, bool isRelativeOffset);
INT_PTR ReadIntPtr(INT_PTR offset, bool isRelativeOffset);
float ReadFloat32(INT_PTR offset, bool isRelativeOffset);
};
Expand Down
53 changes: 53 additions & 0 deletions Game Files/HarleyDavidson.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*This file is part of Output Blaster.

Output Blaster is free software : you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Output Blaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Output Blaster.If not, see < https://www.gnu.org/licenses/>.*/

#include "HarleyDavidson.h"

static int WindowsLoop()
{
UINT8 myLamp = helpers->ReadByte(0x88F4420, false);
Outputs->SetValue(OutputLampStart, !!(myLamp & 0x128));
Outputs->SetValue(OutputLampLeader, !!(myLamp & 0x64));
Outputs->SetValue(OutputLampLeader2, !!(myLamp & 0x32));
return 0;
}

static DWORD WINAPI OutputsAreGo(LPVOID lpParam)
{
while (true)
{
WindowsLoop();
Sleep(SleepA);
}
}

void HarleyDavidson::OutputsGameLoop()
{
if (!init)
{
Outputs = CreateOutputsFromConfig();
m_game.name = "Harley Davidson King Of the Road";
Outputs->SetGame(m_game);
Outputs->Initialize();
Outputs->Attached();
CreateThread(NULL, 0, OutputsAreGo, NULL, 0, NULL);
while (GetMessage(&Msg1, NULL, NULL, 0))
{
TranslateMessage(&Msg1);
DispatchMessage(&Msg1);
}
init = true;
}
}
22 changes: 22 additions & 0 deletions Game Files/HarleyDavidson.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*This file is part of Output Blaster.

Output Blaster is free software : you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Output Blaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Output Blaster.If not, see < https://www.gnu.org/licenses/>.*/

#pragma once
#include "../Common Files/Game.h"
class HarleyDavidson : public Game {

public:
void OutputsGameLoop();
};
54 changes: 54 additions & 0 deletions Game Files/Hummer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*This file is part of Output Blaster.

Output Blaster is free software : you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Output Blaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Output Blaster.If not, see < https://www.gnu.org/licenses/>.*/

#include "Hummer.h"

static int WindowsLoop()
{
UINT8 myLamp = helpers->ReadByte(0xa69fc24, false);
Outputs->SetValue(OutputLampStart, !!(myLamp & 0x80));
Outputs->SetValue(OutputLampView1, !!(myLamp & 0x08));
Outputs->SetValue(OutputLampView2, !!(myLamp & 0x10));
Outputs->SetValue(OutputLampWhite, !!(myLamp & 0x64));
return 0;
}

static DWORD WINAPI OutputsAreGo(LPVOID lpParam)
{
while (true)
{
WindowsLoop();
Sleep(SleepA);
}
}

void Hummer::OutputsGameLoop()
{
if (!init)
{
Outputs = CreateOutputsFromConfig();
m_game.name = "Hummer";
Outputs->SetGame(m_game);
Outputs->Initialize();
Outputs->Attached();
CreateThread(NULL, 0, OutputsAreGo, NULL, 0, NULL);
while (GetMessage(&Msg1, NULL, NULL, 0))
{
TranslateMessage(&Msg1);
DispatchMessage(&Msg1);
}
init = true;
}
}
22 changes: 22 additions & 0 deletions Game Files/Hummer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*This file is part of Output Blaster.

Output Blaster is free software : you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Output Blaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Output Blaster.If not, see < https://www.gnu.org/licenses/>.*/

#pragma once
#include "../Common Files/Game.h"
class Hummer : public Game {

public:
void OutputsGameLoop();
};
38 changes: 36 additions & 2 deletions Game Files/M2Emulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License
along with Output Blaster.If not, see < https://www.gnu.org/licenses/>.*/

#include "M2Emulator.h"

static int detectedGameId = 0;
static int WindowsLoop()
{
INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, true);
Expand All @@ -29,9 +29,19 @@ static int WindowsLoop()
Outputs->SetValue(OutputLampView4, !!(data & 0x40));
Outputs->SetValue(OutputRawLamps, data);

if (detectedGameId == 10) {
//do some custom stuff for this game
}
if (detectedGameId == 12)
{
//do some more custom stuff for this game :)
//And so on...
}

return 0;
}


static DWORD WINAPI OutputsAreGo(LPVOID lpParam)
{
while (true)
Expand All @@ -50,6 +60,30 @@ void M2Emulator::OutputsGameLoop()
Outputs->SetGame(m_game);
Outputs->Initialize();
Outputs->Attached();


if(FindWindowA(0, ("Sega Rally Championship"))) detectedGameId = 1;
else if (FindWindowA(0, ("Daytona USA"))) detectedGameId = 2;
else if (FindWindowA(0, ("Indianapolis 500 (Rev A, Deluxe)"))) detectedGameId = 3;
else if (FindWindowA(0, ("Sega Touring Car Championship (Rev A)"))) detectedGameId = 4;
else if (FindWindowA(0, ("Over Rev"))) detectedGameId = 5;
else if (FindWindowA(0, ("Super GT 24h"))) detectedGameId = 6;
else if (FindWindowA(0, ("Daytona USA '93 Edition"))) detectedGameId = 7;
else if (FindWindowA(0, ("Daytona USA (Saturn Ads)"))) detectedGameId = 8;
else if (FindWindowA(0, ("Daytona USA Special Edition"))) detectedGameId = 9;
else if (FindWindowA(0, ("Daytona USA Turbo"))) detectedGameId = 10;
else if (FindWindowA(0, ("Daytona USA Turbo (Rev A)"))) detectedGameId = 11;
else if (FindWindowA(0, ("Daytona USA: GTX 2004"))) detectedGameId = 12;
else if (FindWindowA(0, ("Daytona USA: To The Maxx"))) detectedGameId = 13;
else if (FindWindowA(0, ("Sega Rally Championship (Rev B)"))) detectedGameId = 14;
else if (FindWindowA(0, ("Sega Rally Pro Drivin'"))) detectedGameId = 15;
else if (FindWindowA(0, ("Indianapolis 500 (Rev A, Twin, Newer rev)"))) detectedGameId = 16;
else if (FindWindowA(0, ("Indianapolis 500 (Rev A, Twin, Older rev)"))) detectedGameId = 17;
else if (FindWindowA(0, ("Sega Touring Car Championship"))) detectedGameId = 18;
else if (FindWindowA(0, ("Sega Touring Car Championship (Rev B)"))) detectedGameId = 19;
else if (FindWindowA(0, ("Over Rev (Model 2B)"))) detectedGameId = 20;


CreateThread(NULL, 0, OutputsAreGo, NULL, 0, NULL);
while (GetMessage(&Msg1, NULL, NULL, 0))
{
Expand All @@ -58,4 +92,4 @@ void M2Emulator::OutputsGameLoop()
}
init = true;
}
}
}
Loading