From fe21fc1377b93044254f26e17b2cf9a36dbcb552 Mon Sep 17 00:00:00 2001 From: CrabJournal <59743349+CrabJournal@users.noreply.github.com> Date: Fri, 7 Jan 2022 12:50:18 +0700 Subject: [PATCH] Update HotkeyStuff.h --- NFSU2ExtraOptions/HotkeyStuff.h | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/NFSU2ExtraOptions/HotkeyStuff.h b/NFSU2ExtraOptions/HotkeyStuff.h index 492b090..bdaa2f2 100644 --- a/NFSU2ExtraOptions/HotkeyStuff.h +++ b/NFSU2ExtraOptions/HotkeyStuff.h @@ -96,20 +96,12 @@ void Thing() // Freeze Camera if ((GetAsyncKeyState(hotkeyFreezeCamera) & 1) && (TheGameFlowManager == 6) && IsOnFocus) { - static BOOL isCameraFrozen = FALSE; - static const int call_near_size = 5; - static BYTE call_backup[call_near_size]; // in case of someone already placed hook there - static void* const call_SetCameraMatrix = (void*)0x453BF3; - if (isCameraFrozen) - { - injector::WriteMemoryRaw(call_SetCameraMatrix, call_backup, call_near_size, true); - } - else - { - memcpy(call_backup, call_SetCameraMatrix, call_near_size); - injector::MakeNOP(call_SetCameraMatrix, call_near_size); - } - isCameraFrozen ^= 1; // isCameraFrozen = !isCameraFrozen + static BYTE byte_backup = 0xC3; // ret + static void* const CubicCameraMover_Update = (void*)0x453570; + + BYTE tmp = *(BYTE*)CubicCameraMover_Update; + injector::WriteMemory(CubicCameraMover_Update, byte_backup, true); + byte_backup = tmp; } if ((GetAsyncKeyState(hotkeyUnlockAllThings) & 1) && IsOnFocus) // Unlock All Things