Merge pull request #2036 from pcca-matrix/develop

Fix Random input in N-Rage Plugin (https://github.com/project64/proje
This commit is contained in:
zilmar 2021-05-15 17:01:19 +09:30 committed by GitHub
commit 09e4a6d211
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 12 deletions

View File

@ -163,7 +163,8 @@ void AxisDeadzone( SHORT &AxisValue, long lDeadZoneValue, float fDeadZoneRelati
void GetXInputControllerKeys( const int indexController, LPDWORD Keys )
{
if (fnXInputGetState == NULL)
if (fnXInputGetState == NULL)
{
return;
}
@ -178,21 +179,24 @@ void GetXInputControllerKeys( const int indexController, LPDWORD Keys )
if ( !gController->bConfigured )
return;
ULONGLONG time = GetTickCount() / 1000;
if (g_pcControllers[indexController].XcheckTime != NULL && (time - g_pcControllers[indexController].XcheckTime) < 3)
return;
DWORD result;
XINPUT_STATE state;
ULONGLONG time = GetTickCount() / 1000;
if (g_pcControllers[indexController].XcheckTime != NULL && (time - g_pcControllers[indexController].XcheckTime) < 3)
return;
result = fnXInputGetState(gController->nControl, &state);
if (result == ERROR_DEVICE_NOT_CONNECTED) {
g_pcControllers[indexController].XcheckTime = time;
}
else {
g_pcControllers[indexController].XcheckTime = NULL;
}
if (result == ERROR_DEVICE_NOT_CONNECTED) {
g_pcControllers[indexController].XcheckTime = time;
}
else {
g_pcControllers[indexController].XcheckTime = NULL;
}
if( result != ERROR_SUCCESS )
return;
DWORD wButtons = state.Gamepad.wButtons;