Merge branch 'master' of https://github.com/teknogods/OpenParrot
This commit is contained in:
commit
2e85d92d50
@ -41,7 +41,14 @@ static void InjectKeys()
|
||||
if (track != 0)
|
||||
{
|
||||
BYTE track1 = *(BYTE *)(track + 0x4);
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
#ifdef _DEBUG
|
||||
info(true, "%02X %02X", track1, gamestate);
|
||||
#endif
|
||||
if ((track1 == 2 || track1 == 4) && (gamestate == 0x16))
|
||||
>>>>>>> c000b7c7ca96e0804e4505624bbd470887a189d8
|
||||
{
|
||||
info(true, "%02X %02X", track1, gamestate);
|
||||
if ((track1 == 2 || track1 == 4) && (gamestate == 0x16))
|
||||
@ -54,16 +61,32 @@ static void InjectKeys()
|
||||
info(true, "Reverse wheel");
|
||||
}
|
||||
else
|
||||
<<<<<<< HEAD
|
||||
{
|
||||
*(BYTE *)(imageBase + 0x15B4678) = wheel;
|
||||
info(true, "Normal wheel1");
|
||||
}
|
||||
=======
|
||||
*(BYTE *)(imageBase + 0x15B4678) = reverse;
|
||||
#ifdef _DEBUG
|
||||
info(true, "Reverse wheel");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
*(BYTE *)(imageBase + 0x15B4678) = wheel;
|
||||
#ifdef _DEBUG
|
||||
info(true, "Normal wheel1");
|
||||
#endif
|
||||
>>>>>>> c000b7c7ca96e0804e4505624bbd470887a189d8
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*(BYTE *)(imageBase + 0x15B4678) = wheel;
|
||||
#ifdef _DEBUG
|
||||
info(true, "Normal wheel2");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -225,8 +248,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::WriteMemoryRaw(imageBase + 0x12958F, "\x33\xC0\x8A\x45\x08\x90\x90\x90\x90\x72\x08\x66\xA3\x46\xFC\x5A\x01\xEB\x06\x66\xA3\x44\xFC\x5A\x01\x31\xFF\x31\xF6\x47\xBE\x0F\x00\x00\x00\xEB\x4C\x90\x90\x90\x90", 41, true);
|
||||
@ -236,7 +269,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
|
@ -1,6 +1,5 @@
|
||||
#include <StdInc.h>
|
||||
#include "Utility/InitFunction.h"
|
||||
|
||||
#include <thread>
|
||||
|
||||
static uint8_t g_fastIOValues[64];
|
||||
|
@ -23,6 +23,8 @@ HANDLE XboxOneControllerMutex[4] = { 0 };
|
||||
static unsigned short idVendor = 0x045E;
|
||||
static unsigned short idProduct = 0x02D1;
|
||||
|
||||
static bool daytonaPressStart = false;
|
||||
|
||||
int configuration = 1;
|
||||
int interface = 0;
|
||||
int endpointIn = 0x81;
|
||||
@ -72,7 +74,15 @@ DWORD WINAPI XInputGetState
|
||||
{
|
||||
XINPUT_GAMEPAD gamepadState = { 0 };
|
||||
|
||||
if (GameDetect::currentGame == GameID::Daytona3)
|
||||
gamepadState.wButtons |= *ffbOffset;
|
||||
else
|
||||
gamepadState.wButtons |= 0;
|
||||
|
||||
if (GameDetect::currentGame == GameID::Daytona3)
|
||||
{
|
||||
gamepadState.bRightTrigger = daytonaPressStart ? 0xFF : 0x00;
|
||||
}
|
||||
|
||||
if (pState->dwPacketNumber == UINT_MAX)
|
||||
pState->dwPacketNumber = 0;
|
||||
@ -267,7 +277,15 @@ DWORD WINAPI XInputGetStateEx
|
||||
{
|
||||
XINPUT_GAMEPAD gamepadState = { 0 };
|
||||
|
||||
gamepadState.wButtons = *ffbOffset;
|
||||
if (GameDetect::currentGame == GameID::Daytona3)
|
||||
gamepadState.wButtons = *ffbOffset;
|
||||
else
|
||||
gamepadState.wButtons = 0;
|
||||
|
||||
if (GameDetect::currentGame == GameID::Daytona3)
|
||||
{
|
||||
gamepadState.bRightTrigger = daytonaPressStart ? 0xFF : 0x00;
|
||||
}
|
||||
|
||||
if (pState->dwPacketNumber == UINT_MAX)
|
||||
pState->dwPacketNumber = 0;
|
||||
@ -308,6 +326,7 @@ __in XINPUT_VIBRATION_EX* pVibration // The vibration information to send to
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
LPCWSTR libName = L"xinput1_3.dll";
|
||||
LPCWSTR daytonalibName = L"xinput9_1_0.dll";
|
||||
LPCWSTR ptrToUse;
|
||||
@ -338,4 +357,37 @@ static InitFunction XInputHook([]()
|
||||
MH_EnableHook(MH_ALL_HOOKS);
|
||||
}
|
||||
});
|
||||
#pragma optimize("", on)´
|
||||
#pragma optimize("", on)´
|
||||
=======
|
||||
LPCWSTR libName = L"xinput1_3.dll";
|
||||
LPCWSTR daytonalibName = L"xinput9_1_0.dll";
|
||||
LPCWSTR ptrToUse;
|
||||
|
||||
static InitFunction XInputHook([]()
|
||||
{
|
||||
if (GameDetect::currentGame == GameID::PokkenTournament || GameDetect::currentGame == GameID::SchoolOfRagnarok || GameDetect::currentGame == GameID::Daytona3)
|
||||
{
|
||||
controllerInit = true;
|
||||
|
||||
MH_Initialize();
|
||||
|
||||
if (GameDetect::currentGame == GameID::Daytona3)
|
||||
ptrToUse = daytonalibName;
|
||||
else
|
||||
ptrToUse = libName;
|
||||
|
||||
MH_CreateHookApi(ptrToUse, "XInputGetState", &XInputGetState, NULL);
|
||||
MH_CreateHookApi(ptrToUse, "XInputSetState", &XInputSetState, NULL);
|
||||
MH_CreateHookApi(ptrToUse, "XInputGetCapabilities", &XInputGetCapabilities, NULL);
|
||||
MH_CreateHookApi(ptrToUse, "XInputEnable", &XInputEnable, NULL);
|
||||
MH_CreateHookApi(ptrToUse, "XInputGetDSoundAudioDeviceGuids", &XInputGetDSoundAudioDeviceGuids, NULL);
|
||||
MH_CreateHookApi(ptrToUse, "XInputGetBatteryInformation", &XInputGetBatteryInformation, NULL);
|
||||
MH_CreateHookApi(ptrToUse, "XInputGetKeystroke", &XInputGetKeystroke, NULL);
|
||||
MH_CreateHookApi(ptrToUse, "XInputGetStateEx", &XInputGetStateEx, NULL);
|
||||
MH_CreateHookApi(ptrToUse, "XInputSetStateEx", &XInputSetStateEx, NULL);
|
||||
|
||||
MH_EnableHook(MH_ALL_HOOKS);
|
||||
}
|
||||
});
|
||||
#pragma optimize("", on)
|
||||
>>>>>>> c000b7c7ca96e0804e4505624bbd470887a189d8
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user