1
0
mirror of synced 2025-01-20 17:48:51 +01:00

Daytona Usa 3 is now fixed

Fixed bug that boomslangz had which caused some control inputs to crash the game.
This commit is contained in:
Nico Giansanti 2018-10-28 04:12:16 +02:00
parent e37fa64ae3
commit 0b8ed332e3
2 changed files with 27 additions and 1 deletions

View File

@ -41,7 +41,9 @@ static void InjectKeys()
if (track != 0)
{
BYTE track1 = *(BYTE *)(track + 0x4);
#ifdef _DEBUG
info(true, "%02X %02X", track1, gamestate);
#endif
if ((track1 == 2 || track1 == 4) && (gamestate == 0x16))
{
BYTE reverse = wheel * 0xFF;
@ -49,18 +51,24 @@ static void InjectKeys()
*(BYTE *)(imageBase + 0x15B4678) = 0xFF;
else
*(BYTE *)(imageBase + 0x15B4678) = reverse;
#ifdef _DEBUG
info(true, "Reverse wheel");
#endif
}
else
{
*(BYTE *)(imageBase + 0x15B4678) = wheel;
#ifdef _DEBUG
info(true, "Normal wheel1");
#endif
}
}
else
{
*(BYTE *)(imageBase + 0x15B4678) = wheel;
#ifdef _DEBUG
info(true, "Normal wheel2");
#endif
}
@ -208,8 +216,18 @@ static void InjectKeys()
}
}
int(__stdcall *g_origControlsFunction)();
int __stdcall ControlsFunction()
{
int result = g_origControlsFunction();
InjectKeys();
return result;
}
static InitFunction Daytona3Func([]()
{
imageBase = (uintptr_t)GetModuleHandleA(0);
injector::WriteMemoryRaw(imageBase + 0xDD697, "\x90\x90\x90\x90\x90\x90\x38\x05\xC8\xF9\x5A\x01\x90\x90\x90\x90\x90\x90", 18, true);
injector::MakeNOP(imageBase + 0x1DDDFA, 5);
@ -218,7 +236,9 @@ static InitFunction Daytona3Func([]()
injector::MakeNOP(imageBase + 0x1DE10D, 6);
injector::MakeNOP(imageBase + 0x29B481, 3);
injector::MakeNOP(imageBase + 0x29B513, 4);
MH_Initialize();
MH_CreateHook((void*)(imageBase + 0x1E9280), ControlsFunction, (void**)&g_origControlsFunction);
MH_EnableHook(MH_ALL_HOOKS);
injector::MakeCALL(imageBase + 0x1DDDFA, InjectKeys);
}, GameID::Daytona3);
#endif

View File

@ -369,6 +369,12 @@ void GameDetect::DetectCurrentGame()
currentGame = GameID::MachStorm;
break;
}
if(*(uint32_t*)(moduleBase + 0xABB7) == 0x00E445C7 &&
*(uint32_t*)(moduleBase + 0xABB7 + 4) == 0xC7000100)
{
currentGame = GameID::Daytona3;
break;
}
#else
// X64
// School of Ragnarok