From 23af81384703f7c27c400717989361e22ea6896c Mon Sep 17 00:00:00 2001 From: 00C0FFEE <49476850+00C0FFEE@users.noreply.github.com> Date: Fri, 24 May 2019 10:09:42 +0200 Subject: [PATCH] RTFNF_all added MACHINE ID setting added fullscreen HD patch (breaks game UI) fixed windowed mode --- OpenParrot/src/Functions/Games/Other/FNF.cpp | 51 +++++++++++++------ .../src/Functions/Games/Other/FNFDrift.cpp | 18 +++++++ .../src/Functions/Games/Other/FNFSB.cpp | 35 ++++++++++--- .../src/Functions/Games/Other/FNFSC.cpp | 18 +++++++ 4 files changed, 98 insertions(+), 24 deletions(-) diff --git a/OpenParrot/src/Functions/Games/Other/FNF.cpp b/OpenParrot/src/Functions/Games/Other/FNF.cpp index f672907..d60a425 100644 --- a/OpenParrot/src/Functions/Games/Other/FNF.cpp +++ b/OpenParrot/src/Functions/Games/Other/FNF.cpp @@ -16,7 +16,7 @@ int vertical3 = 0; HWND hWndRT3 = 0; bool movable3 = false; bool polling3 = false; - +int oldvalue3 = 0; static bool previousLeft = false; static bool previousRight = false; static bool previousUp = false; @@ -269,11 +269,12 @@ DWORD WINAPI InputRT3(LPVOID lpParam) int iWheel = (int)((width - 20) * 0.5 * wheel); double fx = (float)((wheel) * (65535.0f / horizontal3)); - if (movable3 == false) // then poll ugly mouse input + if ((movable3 == false) && (oldvalue3 != *ffbOffset2)) // then poll ugly mouse input { polling3 = true; mouse_event(MOUSEEVENTF_MOVE, fx, 0, 0, 0); polling3 = false; + oldvalue3 = *ffbOffset2; } // GAS @@ -354,7 +355,7 @@ DWORD WINAPI CreateWindowExART3(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWi DWORD WINAPI SetCursorPosRT3(int X, int Y) { - return 0; + return 0; } DWORD WINAPI SetWindowPosRT3(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags) @@ -365,13 +366,13 @@ DWORD WINAPI SetWindowPosRT3(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int static InitFunction FNFFunc([]() { GetDesktopResolution(horizontal3, vertical3); - + // BUTTON VIEW 1 HACK injector::WriteMemory((0x35B9A + BaseAddress3), DIK_F1, true); - + // BUTTON VIEW 3 HACK injector::WriteMemory((0x83739 + BaseAddress3), DIK_F4, true); - + // DISABLE CURSOR RESET injector::WriteMemory((0x4C489 + BaseAddress3), 0xEB, true); @@ -398,17 +399,35 @@ static InitFunction FNFFunc([]() if (ToBool(config["General"]["Windowed"])) { - CreateThread(NULL, 0, WindowRT3, NULL, 0, NULL); + CreateThread(NULL, 0, WindowRT3, NULL, 0, NULL); - MH_Initialize(); - MH_CreateHookApi(L"user32.dll", "CreateWindowExA", &CreateWindowExART3, (void**)&original_CreateWindowExA3); - MH_EnableHook(MH_ALL_HOOKS); + MH_Initialize(); + MH_CreateHookApi(L"user32.dll", "CreateWindowExA", &CreateWindowExART3, (void**)&original_CreateWindowExA3); + MH_EnableHook(MH_ALL_HOOKS); + } + else if (ToBool(config["General"]["HDPatch"])) + { + // BROKEN RESOLUTION PATCH WHEN FULLSCREEN + injector::WriteMemory((0x135954 + BaseAddress3), horizontal3, true); + injector::WriteMemory((0x135958 + BaseAddress3), vertical3, true); + } + + // MACHINE ID setting + if ((strcmp(config["Network"]["MachineID"].c_str(), "2") == 0)) + { + injector::WriteMemory((0xCD808 + BaseAddress3), 0x01, true); + } + else if ((strcmp(config["Network"]["MachineID"].c_str(), "3") == 0)) + { + injector::WriteMemory((0xCD808 + BaseAddress3), 0x02, true); + } + else if ((strcmp(config["Network"]["MachineID"].c_str(), "4") == 0)) + { + injector::WriteMemory((0xCD808 + BaseAddress3), 0x03, true); + } + else // MACHINE ID = 1 + { + injector::WriteMemory((0xCD808 + BaseAddress3), 0x00, true); } -// else -// { -// // BROKEN RESOLUTION PATCH WHEN FULLSCREEN -// injector::WriteMemory((0x135954 + BaseAddress3), horizontal3, true); -// injector::WriteMemory((0x135958 + BaseAddress3), vertical3, true); -// } }, GameID::FNF); diff --git a/OpenParrot/src/Functions/Games/Other/FNFDrift.cpp b/OpenParrot/src/Functions/Games/Other/FNFDrift.cpp index ad02ada..fc8e0fa 100644 --- a/OpenParrot/src/Functions/Games/Other/FNFDrift.cpp +++ b/OpenParrot/src/Functions/Games/Other/FNFDrift.cpp @@ -285,4 +285,22 @@ static InitFunction FNFDriftFunc([]() MH_EnableHook(MH_ALL_HOOKS); } + // MACHINE ID setting + if ((strcmp(config["Network"]["MachineID"].c_str(), "2") == 0)) + { + injector::WriteMemory((0x137F88 + BaseAddress), 0x01, true); + } + else if ((strcmp(config["Network"]["MachineID"].c_str(), "3") == 0)) + { + injector::WriteMemory((0x137F88 + BaseAddress), 0x02, true); + } + else if ((strcmp(config["Network"]["MachineID"].c_str(), "4") == 0)) + { + injector::WriteMemory((0x137F88 + BaseAddress), 0x03, true); + } + else // MACHINE ID = 1 + { + injector::WriteMemory((0x137F88 + BaseAddress), 0x00, true); + } + }, GameID::FNFDrift); diff --git a/OpenParrot/src/Functions/Games/Other/FNFSB.cpp b/OpenParrot/src/Functions/Games/Other/FNFSB.cpp index 4e0b016..38b8990 100644 --- a/OpenParrot/src/Functions/Games/Other/FNFSB.cpp +++ b/OpenParrot/src/Functions/Games/Other/FNFSB.cpp @@ -14,7 +14,7 @@ int vertical4 = 0; HWND hWndRT4 = 0; bool movable4 = false; bool polling4 = false; - +int oldvalue4 = 0; static bool previousLeft = false; static bool previousRight = false; static bool previousUp = false; @@ -268,11 +268,12 @@ DWORD WINAPI InputRT4(LPVOID lpParam) int iWheel = (int)((width - 20) * 0.5 * wheel); double fx = (float)((wheel) * (65535.0f / horizontal4)); - if (movable4 == false) // then poll ugly mouse input + if ((movable4 == false) && (oldvalue4 != *ffbOffset2)) // then poll ugly mouse input { polling4 = true; mouse_event(MOUSEEVENTF_MOVE, fx, 0, 0, 0); polling4 = false; + oldvalue4 = *ffbOffset2; } // GAS @@ -405,11 +406,29 @@ static InitFunction FNFSBFunc([]() MH_CreateHookApi(L"user32.dll", "CreateWindowExA", &CreateWindowExART4, (void**)&original_CreateWindowExA4); MH_EnableHook(MH_ALL_HOOKS); } -// else -// { -// // BROKEN RESOLUTION PATCH WHEN FULLSCREEN -// injector::WriteMemory((0x1522F8 + BaseAddress3), horizontal3, true); -// injector::WriteMemory((0x1522FC + BaseAddress3), vertical3, true); -// } + else if (ToBool(config["General"]["HDPatch"])) + { + // BROKEN RESOLUTION PATCH WHEN FULLSCREEN + injector::WriteMemory((0x1522F8 + BaseAddress4), horizontal4, true); + injector::WriteMemory((0x1522FC + BaseAddress4), vertical4, true); + } + + // MACHINE ID setting + if ((strcmp(config["Network"]["MachineID"].c_str(), "2") == 0)) + { + injector::WriteMemory((0x11FA18 + BaseAddress4), 0x01, true); + } + else if ((strcmp(config["Network"]["MachineID"].c_str(), "3") == 0)) + { + injector::WriteMemory((0x11FA18 + BaseAddress4), 0x02, true); + } + else if ((strcmp(config["Network"]["MachineID"].c_str(), "4") == 0)) + { + injector::WriteMemory((0x11FA18 + BaseAddress4), 0x03, true); + } + else // MACHINE ID = 1 + { + injector::WriteMemory((0x11FA18 + BaseAddress4), 0x00, true); + } }, GameID::FNFSB); diff --git a/OpenParrot/src/Functions/Games/Other/FNFSC.cpp b/OpenParrot/src/Functions/Games/Other/FNFSC.cpp index 73099c7..a28999d 100644 --- a/OpenParrot/src/Functions/Games/Other/FNFSC.cpp +++ b/OpenParrot/src/Functions/Games/Other/FNFSC.cpp @@ -311,4 +311,22 @@ static InitFunction FNFSCFunc([]() CreateThread(NULL, 0, FullscreenRT2, NULL, 0, NULL); } + // MACHINE ID setting + if ((strcmp(config["Network"]["MachineID"].c_str(), "2") == 0)) + { + injector::WriteMemory((0x3036A8 + BaseAddress2), 0x01, true); + } + else if ((strcmp(config["Network"]["MachineID"].c_str(), "3") == 0)) + { + injector::WriteMemory((0x3036A8 + BaseAddress2), 0x02, true); + } + else if ((strcmp(config["Network"]["MachineID"].c_str(), "4") == 0)) + { + injector::WriteMemory((0x3036A8 + BaseAddress2), 0x03, true); + } + else // MACHINE ID = 1 + { + injector::WriteMemory((0x3036A8 + BaseAddress2), 0x00, true); + } + }, GameID::FNFSC);