Skip to content

Commit

Permalink
v5.1.0.1340
Browse files Browse the repository at this point in the history
Merged pull request #35 from CrabJournal/Fix-Autopilot-and-FreezeCamera: Fix of previous fix
  • Loading branch information
nlgxzef authored Jan 7, 2022
2 parents d10b710 + fe21fc1 commit 801539e
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions NFSU2ExtraOptions/HotkeyStuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<BYTE>(CubicCameraMover_Update, byte_backup, true);
byte_backup = tmp;
}

if ((GetAsyncKeyState(hotkeyUnlockAllThings) & 1) && IsOnFocus) // Unlock All Things
Expand Down

0 comments on commit 801539e

Please sign in to comment.