1
0
mirror of synced 2024-11-15 07:17:35 +01:00

Merge pull request #49 from 00C0FFEE/FNF+GHA-fixes

Fnf+gha fixes
This commit is contained in:
Reaver 2019-06-19 16:00:53 +03:00 committed by GitHub
commit 005f358bec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 285 additions and 38 deletions

View File

@ -15,6 +15,16 @@ int horizontal = 0;
int vertical = 0; int vertical = 0;
HWND hWndRT = 0; HWND hWndRT = 0;
HCURSOR cursorhndle; HCURSOR cursorhndle;
static bool previousLeft = false;
static bool previousRight = false;
static bool previousUp = false;
static bool previousDown = false;
static bool button1pressed = false;
static bool button2pressed = false;
static bool button3pressed = false;
static bool button4pressed = false;
// controls // controls
extern int* ffbOffset; extern int* ffbOffset;
extern int* ffbOffset2; extern int* ffbOffset2;
@ -28,10 +38,6 @@ DWORD WINAPI InputRT(LPVOID lpParam)
{ {
int deltaTimer = 16; int deltaTimer = 16;
INT_PTR keyboardBuffer = (0x41B5920 + BaseAddress); INT_PTR keyboardBuffer = (0x41B5920 + BaseAddress);
bool previousLeft = false;
bool previousRight = false;
bool previousUp = false;
bool previousDown = false;
while (true) while (true)
{ {
@ -54,8 +60,19 @@ DWORD WINAPI InputRT(LPVOID lpParam)
// NITRO ( = START too) // NITRO ( = START too)
if (*ffbOffset & 0x100) if (*ffbOffset & 0x100)
{ {
if (button1pressed == false)
{
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_N), 2, true); injector::WriteMemory<BYTE>((keyboardBuffer + DIK_N), 2, true);
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_SPACE), 2, true); injector::WriteMemory<BYTE>((keyboardBuffer + DIK_SPACE), 2, true);
button1pressed = true;
}
}
else
{
if (button1pressed == true)
{
button1pressed = false;
}
} }
// SHIFT DOWN // SHIFT DOWN
if (*ffbOffset & 0x2000) if (*ffbOffset & 0x2000)
@ -92,20 +109,53 @@ DWORD WINAPI InputRT(LPVOID lpParam)
// BUTTON 1/ VIEW 1 // BUTTON 1/ VIEW 1
if (*ffbOffset & 0x200) if (*ffbOffset & 0x200)
{ {
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_A), 2, true); if (button2pressed == false)
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_F1), 2, true); {
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_A), 2, true);
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_F1), 2, true);
button2pressed = true;
}
}
else
{
if (button2pressed == true)
{
button2pressed = false;
}
} }
// BUTTON 2/ VIEW 2 // BUTTON 2/ VIEW 2
if (*ffbOffset & 0x400) if (*ffbOffset & 0x400)
{ {
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_B), 2, true); if (button3pressed == false)
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_F2), 2, true); {
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_B), 2, true);
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_F2), 2, true);
button3pressed = true;
}
}
else
{
if (button3pressed == true)
{
button3pressed = false;
}
} }
// BUTTON 3/ VIEW 3 // BUTTON 3/ VIEW 3
if (*ffbOffset & 0x800) if (*ffbOffset & 0x800)
{ {
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_E), 2, true); if (button4pressed == false)
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_F3), 2, true); {
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_E), 2, true);
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_F3), 2, true);
button4pressed = true;
}
}
else
{
if (button4pressed == true)
{
button4pressed = false;
}
} }
// MENU LEFT // MENU LEFT
if (*ffbOffset & 0x4000) if (*ffbOffset & 0x4000)

View File

@ -5,6 +5,8 @@
#include <Xinput.h> #include <Xinput.h>
#include <math.h> #include <math.h>
#include <dinput.h> #include <dinput.h>
#include <string>
#include <atlstr.h>
#pragma comment(lib, "Ws2_32.lib") #pragma comment(lib, "Ws2_32.lib")
@ -430,4 +432,16 @@ static InitFunction FNFSBFunc([]()
injector::WriteMemory<DWORD>((0x11FA18 + BaseAddress4), 0x00, true); injector::WriteMemory<DWORD>((0x11FA18 + BaseAddress4), 0x00, true);
} }
// FPS Fix
if ((strcmp(config["General"]["FPSFix"].c_str(), "0") != 0))
{
std::string FPSstring = (LPCSTR)(config["General"]["FPSFix"].c_str());
int FPSvalue = std::stoi(FPSstring);
injector::WriteMemoryRaw((0x36560 + BaseAddress4), "\x6A", 1, true);
injector::WriteMemory<BYTE>((0x36561 + BaseAddress4), FPSvalue, true);
injector::WriteMemoryRaw((0x36562 + BaseAddress4), "\xFF\x15\xD0\x21\x62\x03", 6, true);
injector::WriteMemoryRaw((0x36568 + BaseAddress4), "\xC3", 1, true);
}
}, GameID::FNFSB); }, GameID::FNFSB);

View File

@ -16,6 +16,17 @@ int horizontal2 = 0;
int vertical2 = 0; int vertical2 = 0;
HWND hWndRT2 = 0; HWND hWndRT2 = 0;
HCURSOR cursorhndle2; HCURSOR cursorhndle2;
static bool previousLeft = false;
static bool previousRight = false;
static bool previousUp = false;
static bool previousDown = false;
static bool button1pressed = false;
static bool button2pressed = false;
static bool button3pressed = false;
static bool button4pressed = false;
static bool musicpressed = false;
// controls // controls
extern int* ffbOffset; extern int* ffbOffset;
extern int* ffbOffset2; extern int* ffbOffset2;
@ -30,10 +41,6 @@ DWORD WINAPI InputRT2(LPVOID lpParam)
int deltaTimer = 16; int deltaTimer = 16;
INT_PTR keyboardBuffer = (0x437F6F8 + BaseAddress2); INT_PTR keyboardBuffer = (0x437F6F8 + BaseAddress2);
INT_PTR keyboardBuffer2 = (0x437FC08 + BaseAddress2); INT_PTR keyboardBuffer2 = (0x437FC08 + BaseAddress2);
bool previousLeft = false;
bool previousRight = false;
bool previousUp = false;
bool previousDown = false;
while (true) while (true)
{ {
@ -58,8 +65,19 @@ DWORD WINAPI InputRT2(LPVOID lpParam)
// NITRO ( = START too) // NITRO ( = START too)
if (*ffbOffset & 0x100) if (*ffbOffset & 0x100)
{ {
injector::WriteMemory<BYTE>((keyboardBuffer2 + 4 * 0x00), 2, true); if (button1pressed == false)
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_NUMPADENTER), 2, true); {
injector::WriteMemory<BYTE>((keyboardBuffer2 + 4 * 0x00), 2, true);
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_NUMPADENTER), 2, true);
button1pressed = true;
}
}
else
{
if (button1pressed == true)
{
button1pressed = false;
}
} }
// SHIFT DOWN // SHIFT DOWN
if (*ffbOffset & 0x2000) if (*ffbOffset & 0x2000)
@ -96,20 +114,69 @@ DWORD WINAPI InputRT2(LPVOID lpParam)
// BUTTON 1/ VIEW 1 // BUTTON 1/ VIEW 1
if (*ffbOffset & 0x200) if (*ffbOffset & 0x200)
{ {
injector::WriteMemory<BYTE>(keyboardBuffer + DIK_A, 2, true); if (button2pressed == false)
injector::WriteMemory<BYTE>(keyboardBuffer2 + 0x01 * sizeof(U32), 2, true); {
injector::WriteMemory<BYTE>(keyboardBuffer + DIK_A, 2, true);
injector::WriteMemory<BYTE>(keyboardBuffer2 + 0x01 * sizeof(U32), 2, true);
button2pressed = true;
}
}
else
{
if (button2pressed == true)
{
button2pressed = false;
}
} }
// BUTTON 2/ VIEW 2 // BUTTON 2/ VIEW 2
if (*ffbOffset & 0x400) if (*ffbOffset & 0x400)
{ {
injector::WriteMemory<BYTE>(keyboardBuffer + DIK_B, 2, true); if (button3pressed == false)
injector::WriteMemory<BYTE>(keyboardBuffer2 + 0x02 * sizeof(U32), 2, true); {
injector::WriteMemory<BYTE>(keyboardBuffer + DIK_B, 2, true);
injector::WriteMemory<BYTE>(keyboardBuffer2 + 0x02 * sizeof(U32), 2, true);
button3pressed = true;
}
}
else
{
if (button3pressed == true)
{
button3pressed = false;
}
} }
// BUTTON 3/ VIEW 3 // BUTTON 3/ VIEW 3
if (*ffbOffset & 0x800) if (*ffbOffset & 0x800)
{ {
injector::WriteMemory<BYTE>(keyboardBuffer + DIK_E, 2, true); if (button4pressed == false)
injector::WriteMemory<BYTE>(keyboardBuffer2 + 0x03 * sizeof(U32), 2, true); {
injector::WriteMemory<BYTE>(keyboardBuffer + DIK_E, 2, true);
injector::WriteMemory<BYTE>(keyboardBuffer2 + 0x03 * sizeof(U32), 2, true);
button4pressed = true;
}
}
else
{
if (button4pressed == true)
{
button4pressed = false;
}
}
// BUTTON MUSIC/ VIEW 2+3
if (*ffbOffset & 0xC00)
{
if (musicpressed == false)
{
injector::WriteMemory<BYTE>(keyboardBuffer2 + 0x04 * sizeof(U32), 2, true);
musicpressed = true;
}
}
else
{
if (musicpressed == true)
{
musicpressed = false;
}
} }
// MENU LEFT // MENU LEFT
if (*ffbOffset & 0x4000) if (*ffbOffset & 0x4000)
@ -329,4 +396,16 @@ static InitFunction FNFSCFunc([]()
injector::WriteMemory<DWORD>((0x3036A8 + BaseAddress2), 0x00, true); injector::WriteMemory<DWORD>((0x3036A8 + BaseAddress2), 0x00, true);
} }
// FPS Fix
if ((strcmp(config["General"]["FPSFix"].c_str(), "0") != 0))
{
std::string FPSstring = (LPCSTR)(config["General"]["FPSFix"].c_str());
int FPSvalue = std::stoi(FPSstring);
injector::WriteMemoryRaw((0xE1770 + BaseAddress2), "\x6A", 1, true);
injector::WriteMemory<BYTE>((0xE1771 + BaseAddress2), FPSvalue, true);
injector::WriteMemoryRaw((0xE1772 + BaseAddress2), "\xFF\x15\x3C\x52\x62\x00", 6, true);
injector::WriteMemoryRaw((0xE1778 + BaseAddress2), "\xC3", 1, true);
}
}, GameID::FNFSC); }, GameID::FNFSC);

View File

@ -17,10 +17,15 @@ int horizontal5 = 0;
int vertical5 = 0; int vertical5 = 0;
HWND hWndRT5 = 0; HWND hWndRT5 = 0;
bool previousLeft = false; static bool previousLeft = false;
bool previousRight = false; static bool previousRight = false;
bool previousUp = false; static bool previousUp = false;
bool previousDown = false; static bool previousDown = false;
static bool button1pressed = false;
static bool button2pressed = false;
static bool button3pressed = false;
static bool button4pressed = false;
static bool viewpressed = false;
// controls // controls
extern int* ffbOffset; extern int* ffbOffset;
@ -59,25 +64,86 @@ DWORD WINAPI InputRT5(LPVOID lpParam)
// NITRO ( = START too) // NITRO ( = START too)
if (*ffbOffset & 0x100) if (*ffbOffset & 0x100)
{ {
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_SPACE), 2, true); if (button1pressed == false)
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_N), 2, true); {
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_SPACE), 2, true);
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_N), 2, true);
button1pressed = true;
}
}
else
{
if (button1pressed == true)
{
button1pressed = false;
}
} }
// BUTTON 1/ VIEW 1 // BUTTON 1/ VIEW 1
if (*ffbOffset & 0x200) if (*ffbOffset & 0x200)
{ {
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_A), 2, true); if (button2pressed == false)
{
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_A), 2, true);
button2pressed = true;
}
}
else
{
if (button2pressed == true)
{
button2pressed = false;
}
} }
// BUTTON 2/ VIEW ? (+ RIGHT BRAKE) // BUTTON 2/ VIEW ? (+ RIGHT BRAKE)
if (*ffbOffset & 0x400) if (*ffbOffset & 0x400)
{ {
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_B), 2, true); if (button3pressed == false)
{
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_B), 2, true);
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_4), 2, true);
button3pressed = true;
}
}
else
{
if (button3pressed == true)
{
button3pressed = false;
}
} }
// BUTTON 3/ MUSIC (+ LEFT BRAKE) // BUTTON 3/ MUSIC (+ LEFT BRAKE)
if (*ffbOffset & 0x800) if (*ffbOffset & 0x800)
{ {
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_E), 2, true); if (button4pressed == false)
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_3), 2, true); {
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_E), 2, true);
injector::WriteMemory<BYTE>((keyboardBuffer + DIK_3), 2, true);
button4pressed = true;
}
}
else
{
if (button4pressed == true)
{
button4pressed = false;
}
}
// BUTTON VIEW/ buttons 2+3
if (*ffbOffset & 0xC00)
{
if (viewpressed == false)
{
// TO DO find VIEW button OFFSET
// injector::WriteMemory<BYTE>((keyboardBuffer + DIK_4), 2, true);
viewpressed = true;
}
}
else
{
if (viewpressed == true)
{
viewpressed = false;
}
} }
// MENU LEFT // MENU LEFT
if (*ffbOffset & 0x4000) if (*ffbOffset & 0x4000)
@ -345,5 +411,18 @@ static InitFunction FNFSB2Func([]()
{ {
injector::WriteMemory<DWORD>((0x46D7D8 + BaseAddress5), 0x00, true); injector::WriteMemory<DWORD>((0x46D7D8 + BaseAddress5), 0x00, true);
} }
// FPS Fix
if ((strcmp(config["General"]["FPSFix"].c_str(), "0") != 0))
{
std::string FPSstring = (LPCSTR)(config["General"]["FPSFix"].c_str());
int FPSvalue = std::stoi(FPSstring);
injector::WriteMemoryRaw((0x9F3D0 + BaseAddress5), "\x6A", 1, true);
injector::WriteMemory<BYTE>((0x9F3D1 + BaseAddress5), FPSvalue, true);
injector::WriteMemoryRaw((0x9F3D2 + BaseAddress5), "\xFF\x15\x7C\x71\x71\x00", 6, true);
injector::WriteMemoryRaw((0x9F3D8 + BaseAddress5), "\xC3", 1, true);
}
}, GameID::FNFSB2); }, GameID::FNFSB2);
#endif #endif

View File

@ -386,6 +386,8 @@ static InitFunction initFunc([]()
return; return;
if (GameDetect::currentGame == GameID::FNFSB) if (GameDetect::currentGame == GameID::FNFSB)
return; return;
if (GameDetect::currentGame == GameID::GHA)
return;
MH_Initialize(); MH_Initialize();
MH_CreateHookApi(L"DINPUT8.dll", "DirectInput8Create", &Hook_DirectInput8Create, (void**)&__DirectInput8Create); MH_CreateHookApi(L"DINPUT8.dll", "DirectInput8Create", &Hook_DirectInput8Create, (void**)&__DirectInput8Create);

View File

@ -58,6 +58,8 @@ int iround(double num) {
extern int* ffbOffset; extern int* ffbOffset;
extern int* ffbOffset2; extern int* ffbOffset2;
extern int* ffbOffset3;
extern int* ffbOffset4;
DWORD WINAPI XInputGetState DWORD WINAPI XInputGetState
( (
@ -77,6 +79,27 @@ DWORD WINAPI XInputGetState
gamepadState.wButtons |= *ffbOffset; gamepadState.wButtons |= *ffbOffset;
else else
gamepadState.wButtons |= 0; gamepadState.wButtons |= 0;
if (GameDetect::currentGame == GameID::GHA)
{
gamepadState.wButtons |= *ffbOffset;
gamepadState.bLeftTrigger |= *ffbOffset3;
gamepadState.bRightTrigger |= *ffbOffset4;
// START KEY MACRO (only on ATTRACT SCREEN)
if (*ffbOffset == XINPUT_GAMEPAD_START)
{
gamepadState.wButtons = 0xF000;
gamepadState.bLeftTrigger = 255;
gamepadState.bRightTrigger = 255;
}
}
else
{
gamepadState.wButtons |= 0;
gamepadState.bLeftTrigger = 0;
gamepadState.bRightTrigger = 0;
}
#ifdef _M_IX86 #ifdef _M_IX86
if (GameDetect::currentGame == GameID::Daytona3) if (GameDetect::currentGame == GameID::Daytona3)
{ {
@ -304,8 +327,8 @@ DWORD WINAPI XInputGetStateEx
DWORD WINAPI XInputSetStateEx DWORD WINAPI XInputSetStateEx
( (
__in DWORD dwUserIndex, // Index of the gamer associated with the device __in DWORD dwUserIndex, // Index of the gamer associated with the device
__in XINPUT_VIBRATION_EX* pVibration // The vibration information to send to the controller __in XINPUT_VIBRATION_EX* pVibration // The vibration information to send to the controller
) )
{ {
if (!controllerInit) if (!controllerInit)
@ -334,7 +357,7 @@ LPCWSTR ptrToUse;
static InitFunction XInputHook([]() static InitFunction XInputHook([]()
{ {
if (GameDetect::currentGame == GameID::PokkenTournament || GameDetect::currentGame == GameID::SchoolOfRagnarok || GameDetect::currentGame == GameID::Daytona3) if (GameDetect::currentGame == GameID::PokkenTournament || GameDetect::currentGame == GameID::SchoolOfRagnarok || GameDetect::currentGame == GameID::Daytona3 || GameDetect::currentGame == GameID::GHA)
{ {
controllerInit = true; controllerInit = true;

View File

@ -386,8 +386,8 @@ void GameDetect::DetectCurrentGame()
case 0x6449d9b1: // FNF SuperBikes case 0x6449d9b1: // FNF SuperBikes
currentGame = GameID::FNFSB; currentGame = GameID::FNFSB;
break; break;
case 0x6214f7ec: // Guitar Hero Arcade case 0x6214f7ec: // Guitar Hero Arcade
currentGame = GameID::GHA; currentGame = GameID::GHA;
break; break;
//case 0xea1984ff: //case 0xea1984ff:
// currentGame = GameID::ExBoardGeneric; // currentGame = GameID::ExBoardGeneric;