1
0
mirror of synced 2025-02-01 04:15:50 +01:00

-KOF SkyStage: Add temp fix for turbo fire issue until real fix comes

This commit is contained in:
Aaron M 2020-05-07 09:03:47 +12:00
parent d812013b6a
commit 142e8c3875

View File

@ -654,6 +654,160 @@ static int BG4ProThreadLoop(Helpers* helpers)
return 0;
}
static int KOFSkyStageThreadLoop(Helpers* helpers) // Temp Fix for turbo fire (Remove when proper fix sorted)
{
UINT8 JVSInput1 = helpers->ReadByte(0x2DF304, true);
UINT8 JVSInput1A = helpers->ReadByte(0x2DF305, true);
UINT8 Joystick1Up = helpers->ReadByte(0x37085A, true);
UINT8 Joystick1Down = helpers->ReadByte(0x370860, true);
UINT8 Joystick1Left = helpers->ReadByte(0x370866, true);
UINT8 Joystick1Right = helpers->ReadByte(0x37086C, true);
UINT8 Joystick1Start = helpers->ReadByte(0x37088A, true);
UINT8 Joystick1Button1 = helpers->ReadByte(0x370890, true);
UINT8 Joystick1Button2 = helpers->ReadByte(0x370896, true);
UINT8 Joystick1Button3 = helpers->ReadByte(0x37089C, true);
UINT8 JVSInput2 = helpers->ReadByte(0x2DF306, true);
UINT8 JVSInput2A = helpers->ReadByte(0x2DF307, true);
UINT8 Joystick2Up = helpers->ReadByte(0x370950, true);
UINT8 Joystick2Down = helpers->ReadByte(0x370956, true);
UINT8 Joystick2Left = helpers->ReadByte(0x37095C, true);
UINT8 Joystick2Right = helpers->ReadByte(0x370962, true);
UINT8 Joystick2Start = helpers->ReadByte(0x370980, true);
UINT8 Joystick2Button1 = helpers->ReadByte(0x370986, true);
UINT8 Joystick2Button2 = helpers->ReadByte(0x37098C, true);
UINT8 Joystick2Button3 = helpers->ReadByte(0x370992, true);
if (!(JVSInput1 & 0x20))
{
if (Joystick1Up == 0x01)
{
helpers->WriteByte(0x37085A, 0x00, true);
}
}
if (!(JVSInput1 & 0x10))
{
if (Joystick1Down == 0x01)
{
helpers->WriteByte(0x370860, 0x00, true);
}
}
if (!(JVSInput1 & 0x08))
{
if (Joystick1Left == 0x01)
{
helpers->WriteByte(0x370866, 0x00, true);
}
}
if (!(JVSInput1 & 0x04))
{
if (Joystick1Right == 0x01)
{
helpers->WriteByte(0x37086C, 0x00, true);
}
}
if (!(JVSInput1 & 0x80))
{
if (Joystick1Start == 0x01)
{
helpers->WriteByte(0x37088A, 0x00, true);
}
}
if (!(JVSInput1 & 0x02))
{
if (Joystick1Button1 == 0x01)
{
helpers->WriteByte(0x370890, 0x00, true);
}
}
if (!(JVSInput1 & 0x01))
{
if (Joystick1Button2 == 0x01)
{
helpers->WriteByte(0x370896, 0x00, true);
}
}
if (!(JVSInput1A & 0x80))
{
if (Joystick1Button3 == 0x01)
{
helpers->WriteByte(0x37089C, 0x00, true);
}
}
if (!(JVSInput2 & 0x20))
{
if (Joystick2Up == 0x01)
{
helpers->WriteByte(0x370950, 0x00, true);
}
}
if (!(JVSInput2 & 0x10))
{
if (Joystick2Down == 0x01)
{
helpers->WriteByte(0x370956, 0x00, true);
}
}
if (!(JVSInput2 & 0x08))
{
if (Joystick2Left == 0x01)
{
helpers->WriteByte(0x37095C, 0x00, true);
}
}
if (!(JVSInput2 & 0x04))
{
if (Joystick2Right == 0x01)
{
helpers->WriteByte(0x370962, 0x00, true);
}
}
if (!(JVSInput2 & 0x80))
{
if (Joystick2Start == 0x01)
{
helpers->WriteByte(0x370980, 0x00, true);
}
}
if (!(JVSInput2 & 0x02))
{
if (Joystick2Button1 == 0x01)
{
helpers->WriteByte(0x370986, 0x00, true);
}
}
if (!(JVSInput2 & 0x01))
{
if (Joystick2Button2 == 0x01)
{
helpers->WriteByte(0x37098C, 0x00, true);
}
}
if (!(JVSInput2A & 0x80))
{
if (Joystick2Button3 == 0x01)
{
helpers->WriteByte(0x370992, 0x00, true);
}
}
return 0;
}
static DWORD WINAPI BG4ProRunningLoop(LPVOID lpParam)
{
while (true)
@ -672,6 +826,15 @@ static DWORD WINAPI BG4RunningLoop(LPVOID lpParam)
}
}
static DWORD WINAPI KOFSkyStageRunningLoop(LPVOID lpParam)
{
while (true)
{
KOFSkyStageThreadLoop(0);
Sleep(16);
}
}
static InitFunction initFunction([]()
{
DWORD imageBase = (DWORD)GetModuleHandleA(0);
@ -952,6 +1115,10 @@ static InitFunction initFunction([]()
{
// TODO: fix weird "turbo fire" for the buttons, rotate screen
//Temp Fix (Remove when properly sorted)
injector::MakeNOP(imageBase + 0xBD675, 3);
CreateThread(NULL, 0, KOFSkyStageRunningLoop, NULL, 0, NULL);
// don't hide windows and don't break desktop
injector::WriteMemory<BYTE>(imageBase + 0x12F6E2, 0xEB, true);