Fix Random input in N-Rage Plugin (https://github.com/project64/project64/issues/1876)
This should fix the issue.
This commit is contained in:
parent
d4ec1f7f37
commit
7616a26160
|
@ -163,11 +163,12 @@ void AxisDeadzone( SHORT &AxisValue, long lDeadZoneValue, float fDeadZoneRelati
|
||||||
|
|
||||||
void GetXInputControllerKeys( const int indexController, LPDWORD Keys )
|
void GetXInputControllerKeys( const int indexController, LPDWORD Keys )
|
||||||
{
|
{
|
||||||
if (fnXInputGetState == NULL)
|
|
||||||
|
if (fnXInputGetState == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using namespace N64_BUTTONS;
|
using namespace N64_BUTTONS;
|
||||||
|
|
||||||
LPCONTROLLER pcController = &g_pcControllers[indexController];
|
LPCONTROLLER pcController = &g_pcControllers[indexController];
|
||||||
|
@ -178,22 +179,25 @@ void GetXInputControllerKeys( const int indexController, LPDWORD Keys )
|
||||||
if ( !gController->bConfigured )
|
if ( !gController->bConfigured )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ULONGLONG time = GetTickCount() / 1000;
|
|
||||||
if (g_pcControllers[indexController].XcheckTime != NULL && (time - g_pcControllers[indexController].XcheckTime) < 3)
|
|
||||||
return;
|
|
||||||
|
|
||||||
DWORD result;
|
DWORD result;
|
||||||
XINPUT_STATE state;
|
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);
|
result = fnXInputGetState(gController->nControl, &state);
|
||||||
|
|
||||||
if (result == ERROR_DEVICE_NOT_CONNECTED) {
|
if (result == ERROR_DEVICE_NOT_CONNECTED) {
|
||||||
g_pcControllers[indexController].XcheckTime = time;
|
g_pcControllers[indexController].XcheckTime = time;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
g_pcControllers[indexController].XcheckTime = NULL;
|
g_pcControllers[indexController].XcheckTime = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( result != ERROR_SUCCESS )
|
||||||
|
return;
|
||||||
|
|
||||||
DWORD wButtons = state.Gamepad.wButtons;
|
DWORD wButtons = state.Gamepad.wButtons;
|
||||||
|
|
||||||
if( pcController->bPadDeadZone > 0 )
|
if( pcController->bPadDeadZone > 0 )
|
||||||
|
|
Loading…
Reference in New Issue