1
0
mirror of synced 2025-02-01 12:17:55 +01:00

Added Daytona 3 stuff for boom

This commit is contained in:
Nico Giansanti 2018-11-03 03:10:30 +02:00
parent 0b8ed332e3
commit dcecc0c1b9
3 changed files with 40 additions and 12 deletions

View File

@ -1,6 +1,5 @@
#include <StdInc.h> #include <StdInc.h>
#include "Utility/InitFunction.h" #include "Utility/InitFunction.h"
#include <thread> #include <thread>
static uint8_t g_fastIOValues[64]; static uint8_t g_fastIOValues[64];

View File

@ -23,6 +23,8 @@ HANDLE XboxOneControllerMutex[4] = { 0 };
static unsigned short idVendor = 0x045E; static unsigned short idVendor = 0x045E;
static unsigned short idProduct = 0x02D1; static unsigned short idProduct = 0x02D1;
static bool daytonaPressStart = false;
int configuration = 1; int configuration = 1;
int interface = 0; int interface = 0;
int endpointIn = 0x81; int endpointIn = 0x81;
@ -72,7 +74,15 @@ DWORD WINAPI XInputGetState
{ {
XINPUT_GAMEPAD gamepadState = { 0 }; XINPUT_GAMEPAD gamepadState = { 0 };
if (GameDetect::currentGame == GameID::Daytona3)
gamepadState.wButtons |= *ffbOffset; gamepadState.wButtons |= *ffbOffset;
else
gamepadState.wButtons |= 0;
if (GameDetect::currentGame == GameID::Daytona3)
{
gamepadState.bRightTrigger = daytonaPressStart ? 0xFF : 0x00;
}
if (pState->dwPacketNumber == UINT_MAX) if (pState->dwPacketNumber == UINT_MAX)
pState->dwPacketNumber = 0; pState->dwPacketNumber = 0;
@ -267,7 +277,15 @@ DWORD WINAPI XInputGetStateEx
{ {
XINPUT_GAMEPAD gamepadState = { 0 }; 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) if (pState->dwPacketNumber == UINT_MAX)
pState->dwPacketNumber = 0; pState->dwPacketNumber = 0;
@ -308,6 +326,10 @@ __in XINPUT_VIBRATION_EX* pVibration // The vibration information to send to
} }
} }
LPCWSTR libName = L"xinput1_3.dll";
LPCWSTR daytonalibName = L"xinput9_1_0.dll";
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)
@ -316,15 +338,20 @@ static InitFunction XInputHook([]()
MH_Initialize(); MH_Initialize();
MH_CreateHookApi(L"xinput1_3.dll", "XInputGetState", &XInputGetState, NULL); if (GameDetect::currentGame == GameID::Daytona3)
MH_CreateHookApi(L"xinput1_3.dll", "XInputSetState", &XInputSetState, NULL); ptrToUse = daytonalibName;
MH_CreateHookApi(L"xinput1_3.dll", "XInputGetCapabilities", &XInputGetCapabilities, NULL); else
MH_CreateHookApi(L"xinput1_3.dll", "XInputEnable", &XInputEnable, NULL); ptrToUse = libName;
MH_CreateHookApi(L"xinput1_3.dll", "XInputGetDSoundAudioDeviceGuids", &XInputGetDSoundAudioDeviceGuids, NULL);
MH_CreateHookApi(L"xinput1_3.dll", "XInputGetBatteryInformation", &XInputGetBatteryInformation, NULL); MH_CreateHookApi(ptrToUse, "XInputGetState", &XInputGetState, NULL);
MH_CreateHookApi(L"xinput1_3.dll", "XInputGetKeystroke", &XInputGetKeystroke, NULL); MH_CreateHookApi(ptrToUse, "XInputSetState", &XInputSetState, NULL);
MH_CreateHookApi(L"xinput1_3.dll", "XInputGetStateEx", &XInputGetStateEx, NULL); MH_CreateHookApi(ptrToUse, "XInputGetCapabilities", &XInputGetCapabilities, NULL);
MH_CreateHookApi(L"xinput1_3.dll", "XInputSetStateEx", &XInputSetStateEx, 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); MH_EnableHook(MH_ALL_HOOKS);
} }

View File

@ -149,4 +149,6 @@ typedef struct _XINPUT_KEYSTROKE
WORD Flags; WORD Flags;
BYTE UserIndex; BYTE UserIndex;
BYTE HidCode; BYTE HidCode;
} XINPUT_KEYSTROKE, *PXINPUT_KEYSTROKE; } XINPUT_KEYSTROKE, *PXINPUT_KEYSTROKE;
extern static bool daytonaPressStart;