From cc576b6d2a10ba0517fc9eac24e436a1218b2b71 Mon Sep 17 00:00:00 2001 From: 00C0FFEE <49476850+00C0FFEE@users.noreply.github.com> Date: Thu, 27 Jun 2019 10:13:19 +0200 Subject: [PATCH] more FNF fixes SuperBikes2 TEST button now working again! SuperBikes2 TOGGLE MANUAL-AUTO now working! **Shifting Gear Up** is done like this: when GAS pressed, just press SHIFT button. **Shifting Gear Down** is done like this: when BRAKE pressed, just press SHIFT button. SuperBikes2 VIEW button is now working too! --- OpenParrot/src/Functions/Games/Other/FNF.cpp | 3 ++ .../src/Functions/Games/Other/FNFDrift.cpp | 3 ++ .../src/Functions/Games/Other/FNFSB.cpp | 6 ++- .../src/Functions/Games/Other/FNFSC.cpp | 3 ++ .../Functions/Games/Other/FNFSuperBikes2.cpp | 52 +++++++++++++------ .../Games/TypeX2/DirectInputWrapper.cpp | 12 +---- 6 files changed, 49 insertions(+), 30 deletions(-) diff --git a/OpenParrot/src/Functions/Games/Other/FNF.cpp b/OpenParrot/src/Functions/Games/Other/FNF.cpp index 798584e..931d3c2 100644 --- a/OpenParrot/src/Functions/Games/Other/FNF.cpp +++ b/OpenParrot/src/Functions/Games/Other/FNF.cpp @@ -388,6 +388,9 @@ static InitFunction FNFFunc([]() injector::MakeNOP((0x4159B + BaseAddress3), 14); injector::WriteMemory((0x415AA + BaseAddress3), DIK_BACK, true); + // REMOVE ESC BOX + injector::MakeNOP((0x440A0B), 5, true); + MH_Initialize(); MH_CreateHookApi(L"user32.dll", "SetCursorPos", &SetCursorPosRT3, (void**)&original_SetCursorPosRT3); MH_CreateHookApi(L"user32.dll", "DefWindowProcA", &DefWindowProcART3, (void**)&original_DefWindowProcA3); diff --git a/OpenParrot/src/Functions/Games/Other/FNFDrift.cpp b/OpenParrot/src/Functions/Games/Other/FNFDrift.cpp index b19e972..bfbd4f2 100644 --- a/OpenParrot/src/Functions/Games/Other/FNFDrift.cpp +++ b/OpenParrot/src/Functions/Games/Other/FNFDrift.cpp @@ -316,6 +316,9 @@ static InitFunction FNFDriftFunc([]() injector::MakeNOP((0x57B35 + BaseAddress), 14); injector::WriteMemory((0x57B44 + BaseAddress), DIK_BACK, true); + // REMOVE ESC BOX + injector::MakeNOP((0x455FC8), 5, true); + CreateThread(NULL, 0, InputRT, NULL, 0, NULL); if (ToBool(config["General"]["Windowed"])) diff --git a/OpenParrot/src/Functions/Games/Other/FNFSB.cpp b/OpenParrot/src/Functions/Games/Other/FNFSB.cpp index 24518ca..e898ff8 100644 --- a/OpenParrot/src/Functions/Games/Other/FNFSB.cpp +++ b/OpenParrot/src/Functions/Games/Other/FNFSB.cpp @@ -110,8 +110,7 @@ DWORD WINAPI InputRT4(LPVOID lpParam) } // buttons see bitwise values in TPui//RawThrills.cs - - // START + // START if (*ffbOffset & 0x08) { injector::WriteMemory((keyboardBuffer + DIK_SPACE), 2, true); @@ -391,6 +390,9 @@ static InitFunction FNFSBFunc([]() injector::MakeNOP((0x4C426 + BaseAddress4), 14); injector::WriteMemory((0x4C435 + BaseAddress4), DIK_BACK, true); + // REMOVE ESC BOX + injector::MakeNOP((0x44B4B5), 5, true); + MH_Initialize(); MH_CreateHookApi(L"user32.dll", "SetCursorPos", &SetCursorPosRT4, (void**)&original_SetCursorPosRT4); MH_CreateHookApi(L"user32.dll", "DefWindowProcA", &DefWindowProcART4, (void**)&original_DefWindowProcA4); diff --git a/OpenParrot/src/Functions/Games/Other/FNFSC.cpp b/OpenParrot/src/Functions/Games/Other/FNFSC.cpp index b30f662..bcb290b 100644 --- a/OpenParrot/src/Functions/Games/Other/FNFSC.cpp +++ b/OpenParrot/src/Functions/Games/Other/FNFSC.cpp @@ -354,6 +354,9 @@ static InitFunction FNFSCFunc([]() // REMOVE CMD WATSON nonsense injector::MakeNOP((0x5F3882), 2, true); + // REMOVE ESC BOX + injector::MakeNOP((0x464A58), 5, true); + CreateThread(NULL, 0, InputRT2, NULL, 0, NULL); MH_Initialize(); diff --git a/OpenParrot/src/Functions/Games/Other/FNFSuperBikes2.cpp b/OpenParrot/src/Functions/Games/Other/FNFSuperBikes2.cpp index 2f347b9..01fcb9d 100644 --- a/OpenParrot/src/Functions/Games/Other/FNFSuperBikes2.cpp +++ b/OpenParrot/src/Functions/Games/Other/FNFSuperBikes2.cpp @@ -25,7 +25,8 @@ static bool button1pressed = false; static bool button2pressed = false; static bool button3pressed = false; static bool button4pressed = false; -static bool viewpressed = false; +static bool normalview = false; +static bool geartoggpressed = false; static bool PINpressed = false; static bool NUMpressed = false; static bool NUMpressed0 = false; @@ -273,14 +274,15 @@ DWORD WINAPI InputRT5(LPVOID lpParam) // TEST if (*ffbOffset & 0x01) { - injector::WriteMemory((keyboardBuffer + DIK_RBRACKET), 2, true); + injector::WriteMemory((keyboardBuffer + DIK_RETURN), 2, true); + injector::MakeNOP((0x6ABB9 + BaseAddress5), 23, true); } - // NITRO ( = START too) + // NITRO / Neon Color if (*ffbOffset & 0x100) { if (button1pressed == false) { - injector::WriteMemory((keyboardBuffer + DIK_SPACE), 2, true); + injector::WriteMemory((keyboardBuffer + DIK_A), 2, true); injector::WriteMemory((keyboardBuffer + DIK_N), 2, true); button1pressed = true; } @@ -292,12 +294,22 @@ DWORD WINAPI InputRT5(LPVOID lpParam) button1pressed = false; } } - // BUTTON 1/ VIEW 1 + // BUTTON 1/ VIEW if (*ffbOffset & 0x200) { if (button2pressed == false) { - injector::WriteMemory((keyboardBuffer + DIK_A), 2, true); + injector::WriteMemoryRaw((0x718F5 + BaseAddress5), "\x90\x90", 2, true); + if (normalview == false) + { + injector::WriteMemoryRaw((0x718F8 + BaseAddress5), "\x24\xD9 ", 2, true); + normalview = true; + } + else + { + injector::WriteMemoryRaw((0x718F8 + BaseAddress5), "\xA8\xD7 ", 2, true); + normalview = false; + } button2pressed = true; } } @@ -305,16 +317,18 @@ DWORD WINAPI InputRT5(LPVOID lpParam) { if (button2pressed == true) { + injector::WriteMemoryRaw((0x718F8 + BaseAddress5), "\x8C\xD7 ", 2, true); + injector::WriteMemoryRaw((0x718F5 + BaseAddress5), "\x74\x14", 2, true); button2pressed = false; } } - // BUTTON 2/ VIEW ? (+ RIGHT BRAKE) + // BUTTON 2/ SHIFT LEVER / Bike Color if (*ffbOffset & 0x400) { if (button3pressed == false) { - injector::WriteMemory((keyboardBuffer + DIK_B), 2, true); injector::WriteMemory((keyboardBuffer + DIK_4), 2, true); + injector::WriteMemory((keyboardBuffer + DIK_B), 2, true); button3pressed = true; } } @@ -325,7 +339,7 @@ DWORD WINAPI InputRT5(LPVOID lpParam) button3pressed = false; } } - // BUTTON 3/ MUSIC (+ LEFT BRAKE) + // BUTTON 3/ MUSIC / Change Pilot if (*ffbOffset & 0x800) { if (button4pressed == false) @@ -342,22 +356,23 @@ DWORD WINAPI InputRT5(LPVOID lpParam) button4pressed = false; } } - // BUTTON VIEW + // BUTTON MENU TOGGLE MANUAL-AUTO if (*ffbOffset & 0x10) { - if (viewpressed == false) + if (geartoggpressed == false) { - // TO-DO - // injector::WriteMemory((keyboardBuffer + DIK_ESCAPE), 2, true); - // injector::WriteMemory((keyboardBuffer + DIK_RETURN), 2, true); - viewpressed = true; + injector::MakeNOP((0x226B6 + BaseAddress5), 6, true); + injector::MakeNOP((0x226CB + BaseAddress5), 6, true); + geartoggpressed = true; } } else { - if (viewpressed == true) + if (geartoggpressed == true) { - viewpressed = false; + injector::WriteMemoryRaw((0x226B6 + BaseAddress5), "\x0F\x84\x9A\x00\x00\x00", 6, true); + injector::WriteMemoryRaw((0x226CB + BaseAddress5), "\x0F\x84\x85\x00\x00\x00", 6, true); + geartoggpressed = false; } } // BUTTON ENTER-PIN @@ -613,6 +628,9 @@ static InitFunction FNFSB2Func([]() // REMOVE CMD WATSON nonsense injector::MakeNOP((0x529E62), 2, true); + // REMOVE ESC BOX + injector::MakeNOP((0x4714DA), 5, true); + // Force correct backbuffer format injector::MakeJMP(BaseAddress5 + 0xB7BD2, BaseAddress5 + 0xB7BE3, true); diff --git a/OpenParrot/src/Functions/Games/TypeX2/DirectInputWrapper.cpp b/OpenParrot/src/Functions/Games/TypeX2/DirectInputWrapper.cpp index 6cb15d4..7d30710 100644 --- a/OpenParrot/src/Functions/Games/TypeX2/DirectInputWrapper.cpp +++ b/OpenParrot/src/Functions/Games/TypeX2/DirectInputWrapper.cpp @@ -376,17 +376,7 @@ HRESULT __stdcall Hook_DirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFI static InitFunction initFunc([]() { - if (GameDetect::currentGame == GameID::PokkenTournament) - return; - if (GameDetect::currentGame == GameID::FNFDrift) - return; - if (GameDetect::currentGame == GameID::FNFSC) - return; - if (GameDetect::currentGame == GameID::FNF) - return; - if (GameDetect::currentGame == GameID::FNFSB) - return; - if (GameDetect::currentGame == GameID::GHA) + if (GameDetect::currentGame == GameID::PokkenTournament || GameDetect::currentGame == GameID::FNFDrift || GameDetect::currentGame == GameID::FNFSC || GameDetect::currentGame == GameID::FNF || GameDetect::currentGame == GameID::FNFSB || GameDetect::currentGame == GameID::FNFSB2 || GameDetect::currentGame == GameID::GHA) return; MH_Initialize();