diff --git a/Game Files/BattlePod.cpp b/Game Files/BattlePod.cpp index 699e09a..f62b297 100644 --- a/Game Files/BattlePod.cpp +++ b/Game Files/BattlePod.cpp @@ -37,26 +37,26 @@ static int WindowsLoop() - int ledRearWindowsRed = (ledRearWindowsRGB >> 8) & 0xF; + int ledRearWindowsRed = ledRearWindowsRGB & 0xF; int ledRearWindowsGreen = (ledRearWindowsRGB >> 4) & 0xF; - int ledRearWindowsBlue = ledRearWindowsRGB & 0xF; + int ledRearWindowsBlue = (ledRearWindowsRGB >> 8) & 0xF; - int ledRearCoverRed = (ledRearCoverRGB >> 8) & 0xF; + int ledRearCoverRed = ledRearCoverRGB & 0xF; int ledRearCoverGreen = (ledRearCoverRGB >> 4) & 0xF; - int ledRearCoverBlue = ledRearCoverRGB & 0xF; + int ledRearCoverBlue = (ledRearCoverRGB >> 8) & 0xF; Outputs->SetValue(Output1pAirFront, !!(air & 1)); Outputs->SetValue(OutputLampView1, !!(view & 1)); Outputs->SetValue(OutputLampView2, !!(ledRearPanelA & 1)); Outputs->SetValue(OutputLampView3, !!(ledRearPanelB & 1)); Outputs->SetValue(OutputLampView4, !!(ledRearPanelC & 1)); - Outputs->SetValue(OutputLampRed, ledRearWindowsRed); - Outputs->SetValue(OutputLampGreen, ledRearWindowsGreen); - Outputs->SetValue(OutputLampBlue, ledRearWindowsBlue); - Outputs->SetValue(OutputLampRed2, ledRearCoverRed); - Outputs->SetValue(OutputLampGreen2, ledRearCoverGreen); - Outputs->SetValue(OutputLampBlue2, ledRearCoverBlue); - Outputs->SetValue(OutputFFB, (vibration / 16) * 100); + Outputs->SetValue(OutputLampRed, (ledRearWindowsRed / 15.0) * (MaxScaleOutput * 1.0)); + Outputs->SetValue(OutputLampGreen, (ledRearWindowsGreen / 15.0) * (MaxScaleOutput * 1.0)); + Outputs->SetValue(OutputLampBlue, (ledRearWindowsBlue / 15.0) * (MaxScaleOutput * 1.0)); + Outputs->SetValue(OutputLampRed2, (ledRearCoverRed / 15.0) * (MaxScaleOutput * 1.0)); + Outputs->SetValue(OutputLampGreen2, (ledRearCoverGreen / 15.0) * (MaxScaleOutput * 1.0)); + Outputs->SetValue(OutputLampBlue2, (ledRearCoverBlue / 15.0) * (MaxScaleOutput * 1.0)); + Outputs->SetValue(OutputFFB, (vibration / 16.0) * 100.0); return 0; } diff --git a/Game Files/M2Emulator.cpp b/Game Files/M2Emulator.cpp index 2ca6692..2aed3ef 100644 --- a/Game Files/M2Emulator.cpp +++ b/Game Files/M2Emulator.cpp @@ -17,27 +17,104 @@ along with Output Blaster.If not, see < https://www.gnu.org/licenses/>.*/ static int detectedGameId = 0; static int WindowsLoop() { - INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, true); - INT_PTR RambaseA = helpers->ReadIntPtr(Rambase + 0x100, false); - UINT8 data = helpers->ReadByte(RambaseA + 0x824, false); - - Outputs->SetValue(OutputLampStart, !!(data & 0x04)); - Outputs->SetValue(OutputLampLeader, !!(data & 0x80)); - Outputs->SetValue(OutputLampView1, !!(data & 0x08)); - Outputs->SetValue(OutputLampView2, !!(data & 0x10)); - Outputs->SetValue(OutputLampView3, !!(data & 0x20)); - Outputs->SetValue(OutputLampView4, !!(data & 0x40)); - Outputs->SetValue(OutputRawLamps, data); + /*INT_PTR data1 = helpers->ReadIntPtr(0x174CF0, true); + Outputs->SetValue(OutputLampStart, !!(data1 & 0x04)); + Outputs->SetValue(OutputLampLeader, !!(data1 & 0x80)); + Outputs->SetValue(OutputLampView1, !!(data1 & 0x08)); + Outputs->SetValue(OutputLampView2, !!(data1 & 0x10)); + Outputs->SetValue(OutputLampView3, !!(data1 & 0x20)); + Outputs->SetValue(OutputLampView4, !!(data1 & 0x40));*/ + + /*sega rally*/ + if ((detectedGameId == 1) || (detectedGameId == 14) || (detectedGameId == 15)) + { + INT_PTR data1 = helpers->ReadIntPtr(0x174CF0, true); + Outputs->SetValue(OutputLampStart, !!(data1 & 0x04)); + Outputs->SetValue(OutputLampLeader, !!(data1 & 0x80)); + Outputs->SetValue(OutputLampView1, !!(data1 & 0x08)); + Outputs->SetValue(OutputLampView2, !!(data1 & 0x10)); + Outputs->SetValue(OutputLampView3, !!(data1 & 0x20)); + Outputs->SetValue(OutputLampView4, !!(data1 & 0x40)); + } + /*stcc*/ + else if ((detectedGameId == 4) || (detectedGameId == 18) || (detectedGameId == 19)) + { + INT_PTR data2 = helpers->ReadIntPtr(0x174CF0, true); + Outputs->SetValue(OutputLampStart, !!(data2 & 0x04)); + Outputs->SetValue(OutputLampLeader, !!(data2 & 0x80)); + Outputs->SetValue(OutputLampView1, !!(data2 & 0x08)); + Outputs->SetValue(OutputLampView2, !!(data2 & 0x10)); + Outputs->SetValue(OutputLampView3, !!(data2 & 0x20)); + Outputs->SetValue(OutputLampView4, !!(data2 & 0x40)); + } + /*daytona*/ + else if ((detectedGameId == 2) || (detectedGameId == 7) || (detectedGameId == 8) || (detectedGameId == 9) || (detectedGameId == 10) || (detectedGameId == 11) || (detectedGameId == 12) || (detectedGameId == 13)) + { + INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, true); + INT_PTR RambaseA = helpers->ReadIntPtr(Rambase + 0x100, false); + UINT8 data = helpers->ReadByte(RambaseA + 0x824, false); - if (detectedGameId == 10) { - //do some custom stuff for this game + Outputs->SetValue(OutputLampStart, !!(data & 0x04)); + Outputs->SetValue(OutputLampLeader, !!(data & 0x80)); + Outputs->SetValue(OutputLampView1, !!(data & 0x08)); + Outputs->SetValue(OutputLampView2, !!(data & 0x10)); + Outputs->SetValue(OutputLampView3, !!(data & 0x20)); + Outputs->SetValue(OutputLampView4, !!(data & 0x40)); + Outputs->SetValue(OutputRawLamps, data); + } + /*indy500*/ + else if ((detectedGameId == 3) || (detectedGameId == 16) || (detectedGameId == 17)) + { + INT_PTR data2 = helpers->ReadIntPtr(0x174CF0, true); + Outputs->SetValue(OutputLampStart, !!(data2 & 0x04)); + Outputs->SetValue(OutputLampLeader, !!(data2 & 0x80)); + Outputs->SetValue(OutputLampView1, !!(data2 & 0x08)); + Outputs->SetValue(OutputLampView2, !!(data2 & 0x10)); + Outputs->SetValue(OutputLampView3, !!(data2 & 0x20)); + Outputs->SetValue(OutputLampView4, !!(data2 & 0x40)); } - if (detectedGameId == 12) + /*overrev*/ + else if ((detectedGameId == 20) || (detectedGameId == 5)) { - //do some more custom stuff for this game :) - //And so on... + INT_PTR data2 = helpers->ReadIntPtr(0x174CF0, true); + Outputs->SetValue(OutputLampStart, !!(data2 & 0x04)); + Outputs->SetValue(OutputLampLeader, !!(data2 & 0x80)); + Outputs->SetValue(OutputLampView1, !!(data2 & 0x08)); + Outputs->SetValue(OutputLampView2, !!(data2 & 0x10)); + Outputs->SetValue(OutputLampView3, !!(data2 & 0x20)); + Outputs->SetValue(OutputLampView4, !!(data2 & 0x40)); } + /*supergt24*/ + else if (detectedGameId == 6) + { + INT_PTR data2 = helpers->ReadIntPtr(0x174CF0, true); + Outputs->SetValue(OutputLampStart, !!(data2 & 0x04)); + Outputs->SetValue(OutputLampLeader, !!(data2 & 0x80)); + Outputs->SetValue(OutputLampView1, !!(data2 & 0x08)); + Outputs->SetValue(OutputLampView2, !!(data2 & 0x10)); + Outputs->SetValue(OutputLampView3, !!(data2 & 0x20)); + Outputs->SetValue(OutputLampView4, !!(data2 & 0x40)); + } + else if ((detectedGameId == 21) || (detectedGameId == 22) || (detectedGameId == 23)) + { + INT_PTR data = helpers->ReadIntPtr(0x174CF0, true); + //INT_PTR drive = helpers->ReadIntPtr(0x174CF4, true); + //INT_PTR RambaseA = helpers->ReadIntPtr(0x5AA8F0, false); + //INT_PTR RambaseB = helpers->ReadIntPtr(0x5AA8F4, false); + //UINT8 data1 = helpers->ReadByte(RambaseA + 0x420, false); + //INT_PTR data2 = helpers->ReadIntPtr(RambaseB + 0x500, false); + //UINT8 data3 = helpers->ReadByte(data2 + 0x578B64, false); + Outputs->SetValue(OutputLampStart, !!(data & 0x04)); + Outputs->SetValue(OutputLampLeader, !!(data & 0x08)); + Outputs->SetValue(OutputLampView3, !!(data & 0x80)); + Outputs->SetValue(OutputLampView1, !!(data & 0x10)); + Outputs->SetValue(OutputLampView2, !!(data & 0x20)); + Outputs->SetValue(OutputLampView4, !!(data & 0x40)); + //Outputs->SetValue(OutputRawDrive, drive); + //Outputs->SetValue(OutputSpeedo, data1); + //Outputs->SetValue(OutputDash, data3); + } return 0; } @@ -53,16 +130,16 @@ static DWORD WINAPI OutputsAreGo(LPVOID lpParam) void M2Emulator::OutputsGameLoop() { + if (!init) { - Outputs = new CWinOutputs(); - m_game.name = "M2 Emulator"; + /*Outputs = new CWinOutputs(); + m_game.name = "M2 Emulator"; Outputs->SetGame(m_game); Outputs->Initialize(); - Outputs->Attached(); + Outputs->Attached();*/ - - if(FindWindowA(0, ("Sega Rally Championship"))) detectedGameId = 1; + 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; @@ -82,14 +159,124 @@ void M2Emulator::OutputsGameLoop() 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; + else if (FindWindowA(0, ("ManxTT Superbike (Rev C, Twin)"))) detectedGameId = 21; + else if (FindWindowA(0, ("ManxTT Superbike (Rev D, Deluxe)"))) detectedGameId = 22; + else if (FindWindowA(0, ("Motor Raid"))) detectedGameId = 23; + + + if (detectedGameId == 1) + { + m_game.name = "Sega Rally Championship"; + } + else if (detectedGameId == 2) + { + m_game.name = "Daytona USA"; + } + else if (detectedGameId == 3) + { + m_game.name = "Indianapolis 500 (Rev A, Deluxe)"; + } + else if (detectedGameId == 4) + { + m_game.name = "Sega Touring Car Championship (Rev A)"; + } + else if (detectedGameId == 5) + { + m_game.name = "Over Rev"; + } + else if (detectedGameId == 6) + { + m_game.name = "Super GT 24h"; + } + else if (detectedGameId == 7) + { + m_game.name = "Daytona USA '93 Edition"; + } + else if (detectedGameId == 8) + { + m_game.name = "Daytona USA (Saturn Ads)"; + } + else if (detectedGameId == 9) + { + m_game.name = "Daytona USA Special Edition"; + } + else if (detectedGameId == 10) + { + m_game.name = "Daytona USA Turbo"; + } + else if (detectedGameId == 11) + { + m_game.name = "Daytona USA Turbo (Rev A)"; + } + else if (detectedGameId == 12) + { + m_game.name = "Daytona USA: GTX 2004"; + } + else if (detectedGameId == 13) + { + m_game.name = "Daytona USA: To The Maxx"; + } + else if (detectedGameId == 14) + { + m_game.name = "Sega Rally Championship (Rev B)"; + } + else if (detectedGameId == 15) + { + m_game.name = "Sega Rally Pro Drivin'"; + } + else if (detectedGameId == 16) + { + m_game.name = "Indianapolis 500 (Rev A, Twin, Newer rev)"; + } + else if (detectedGameId == 17) + { + m_game.name = "Indianapolis 500 (Rev A, Twin, Older rev)"; + } + else if (detectedGameId == 18) + { + m_game.name = "Sega Touring Car Championship"; + } + else if (detectedGameId == 19) + { + m_game.name = "Sega Touring Car Championship (Rev B)"; + } + else if (detectedGameId == 20) + { + m_game.name = "Over Rev (Model 2B)"; + } + else if (detectedGameId == 21) + { + m_game.name = "ManxTT Superbike (Rev C, Twin)"; + } + else if (detectedGameId == 22) + { + m_game.name = "ManxTT Superbike (Rev D, Deluxe)"; + } + else if (detectedGameId == 23) + { + m_game.name = "Motor Raid"; + } + + if (detectedGameId != 0) + { + Outputs = new CWinOutputs(); + 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); + } - CreateThread(NULL, 0, OutputsAreGo, NULL, 0, NULL); - while (GetMessage(&Msg1, NULL, NULL, 0)) + init = true; + } + else if(detectedGameId == 0) { - TranslateMessage(&Msg1); - DispatchMessage(&Msg1); + init = false; } - init = true; } -} +} \ No newline at end of file