Skip to content

Commit

Permalink
NFS2: Fix jittery mouse
Browse files Browse the repository at this point in the history
  • Loading branch information
CookiePLMonster committed Sep 14, 2023
1 parent 237b6bc commit b53f764
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions source/SilentPatchNFS90s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,19 @@ namespace NFS2SEMovieRaceFix
}


__declspec(naked) void NFS2SE_MouseZeroEax()
{
_asm
{
mov ebx, ecx
shl ebx, 4
xor eax, eax
xor edx, edx
ret
}
}


void OnInitializeHook()
{
using namespace Memory;
Expand Down Expand Up @@ -282,6 +295,20 @@ void OnInitializeHook()
TXN_CATCH();


// NFS2: Fix jittery mouse
try
{
auto get_device_data = get_pattern("8B 10 50 FF 52 28 89 C2 85 C0 0F 85", 10 + 1);
auto zero_eax = get_pattern("89 CB C1 E3 04");

// jne -> js
Patch<uint8_t>(get_device_data, 0x88);
// Add xor eax, eax
InjectHook(zero_eax, NFS2SE_MouseZeroEax, HookType::Call);
}
TXN_CATCH();


// NFS4: Fix jittery mouse
try
{
Expand Down

0 comments on commit b53f764

Please sign in to comment.