1
0
mirror of synced 2025-01-20 09:42:49 +01:00

Merge pull request #111 from Exmach/BG4

Battle Gear 4 key toggle
This commit is contained in:
Boomslangnz 2020-08-26 20:22:33 +12:00 committed by GitHub
commit a264c70764
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -434,7 +434,7 @@ static DWORD WINAPI ChangeValues(LPVOID lpParam)
Sleep(10000); Sleep(10000);
DWORD imageBase = (DWORD)GetModuleHandleA(0); DWORD imageBase = (DWORD)GetModuleHandleA(0);
myHelpers->WriteByte(0x42E296, 0x01, true); myHelpers->WriteByte(0x42E296, 0x05, true);
myHelpers->WriteByte(0x42E295, 0x80, true); myHelpers->WriteByte(0x42E295, 0x80, true);
injector::MakeNOP(imageBase + 0x27400, 6); injector::MakeNOP(imageBase + 0x27400, 6);
return 0; return 0;
@ -528,6 +528,7 @@ static int BG4ProThreadLoop(Helpers* helpers)
} }
DWORD imageBase = (DWORD)GetModuleHandleA(0); DWORD imageBase = (DWORD)GetModuleHandleA(0);
UINT8 KeyInput = helpers->ReadByte(imageBase + 0x42E296, false);
if (*ffbOffset & 0x100) //Test if (*ffbOffset & 0x100) //Test
{ {
@ -764,7 +765,14 @@ static int BG4ProThreadLoop(Helpers* helpers)
if (!KeyPressed) if (!KeyPressed)
{ {
KeyPressed = true; KeyPressed = true;
*(BYTE*)(imageBase + 0x42E296) += 0x04; if (!(KeyInput & 0x04))
{
*(BYTE*)(imageBase + 0x42E296) += 0x04;
}
else
{
*(BYTE*)(imageBase + 0x42E296) -= 0x04;
}
} }
} }
else else
@ -772,7 +780,6 @@ static int BG4ProThreadLoop(Helpers* helpers)
if (KeyPressed) if (KeyPressed)
{ {
KeyPressed = false; KeyPressed = false;
*(BYTE*)(imageBase + 0x42E296) -= 0x04;
} }
} }