diff --git a/Source/nragev20/NRagePluginV2.cpp b/Source/nragev20/NRagePluginV2.cpp index 4a758fef1..c83617fc5 100644 --- a/Source/nragev20/NRagePluginV2.cpp +++ b/Source/nragev20/NRagePluginV2.cpp @@ -409,7 +409,7 @@ EXPORT void CALL InitiateControllers( if (g_pcControllers[i].fXInput) { InitiateXInputController(&g_pcControllers[i].xiController, i); - continue; + //continue; } // Search for right Controller @@ -923,7 +923,7 @@ void FillControls(CONTROL * Controls) { case PAK_MEM: Controls[i].Plugin = PLUGIN_MEMPAK; - Controls[i].RawData = false; + //Controls[i].RawData = false; break; case PAK_RUMBLE: Controls[i].Plugin = PLUGIN_RUMBLE_PAK; @@ -1053,7 +1053,7 @@ void DoShortcut( int iControl, int iShortcut ) { EnterCriticalSection( &g_critical ); g_pcControllers[iControl].PakType = PAK_RUMBLE; - g_pcControllers[iControl].fPakInitialized = false; + g_pcControllers[iControl].fPakInitialized = true; if( g_pcControllers[iControl].fRawData ) if (CreateEffectHandle( iControl, g_pcControllers[iControl].bRumbleTyp, g_pcControllers[iControl].bRumbleStrength ) ) diff --git a/Source/nragev20/NRagePluginV2.h b/Source/nragev20/NRagePluginV2.h index 5929cdb6a..089868063 100644 --- a/Source/nragev20/NRagePluginV2.h +++ b/Source/nragev20/NRagePluginV2.h @@ -155,6 +155,8 @@ typedef struct _CONTROLLER // AN N64 CONTROLLER unsigned bBackgroundInput; // allow input while main window isn't focused? + unsigned XcheckTime; // checks for newly connected gamepads timer + BYTE bRumbleTyp; // what type of rumble effect? none, constant, ramp, or direct? GUID guidFFDevice; // GUID of the device that rumble gets sent to diff --git a/Source/nragev20/XInputController.cpp b/Source/nragev20/XInputController.cpp index 9c88bfa67..62f25c10d 100644 --- a/Source/nragev20/XInputController.cpp +++ b/Source/nragev20/XInputController.cpp @@ -178,13 +178,21 @@ 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; result = fnXInputGetState(gController->nControl, &state); - if( result != ERROR_SUCCESS ) - return; + if (result == ERROR_DEVICE_NOT_CONNECTED) { + g_pcControllers[indexController].XcheckTime = time; + } + else { + g_pcControllers[indexController].XcheckTime = NULL; + } DWORD wButtons = state.Gamepad.wButtons;