diff --git a/NFS_XtendedInput.h b/NFS_XtendedInput.h index c078ab9..6acca3e 100644 --- a/NFS_XtendedInput.h +++ b/NFS_XtendedInput.h @@ -42,3 +42,4 @@ unsigned int LastControlledDeviceOldState = 0; unsigned int ControllerIconMode = 0; // read modes above bool bInDebugWorldCamera = false; +bool bGlobalDoPolling = true; diff --git a/NFS_XtendedInput_FEng.h b/NFS_XtendedInput_FEng.h index 3710c91..858b504 100644 --- a/NFS_XtendedInput_FEng.h +++ b/NFS_XtendedInput_FEng.h @@ -412,7 +412,7 @@ void* FEngSetTextureHash_CheckObj(FEObject* inobj, unsigned int obj_hash, unsign void UpdateFECursorPos() { - if (*(int*)GAMEFLOWMANAGER_STATUS_ADDR != 0) // don't execute until we're in the game... fixes BSOD crash on old ATI video drivers... + if ((*(int*)GAMEFLOWMANAGER_STATUS_ADDR != 0) && bGlobalDoPolling) // don't execute until we're in the game... fixes BSOD crash on old ATI video drivers... { bool bMouseInGameWindow = false; bool bShowMouse = true; diff --git a/dllmain.cpp b/dllmain.cpp index 750390f..20840a8 100644 --- a/dllmain.cpp +++ b/dllmain.cpp @@ -275,7 +275,7 @@ HRESULT UpdateControllerState() void ReadXInput_Extra() { #ifndef NO_QUIT_BUTTON - if (g_Controllers[0].bConnected) + if (g_Controllers[0].bConnected && bGlobalDoPolling) { WORD wButtons = g_Controllers[0].state.Gamepad.wButtons; @@ -349,7 +349,7 @@ void __stdcall ReadControllerData() GetKeyboardState(VKeyStates[0]); // read mouse info for Debug World Camera - if (bInDebugWorldCamera) + if (bInDebugWorldCamera && bGlobalDoPolling) { RECT windowRect; POINT MousePos; @@ -820,6 +820,9 @@ class InputDevice } virtual void PollDevice() { + if (!bGlobalDoPolling) + return; + ReadControllerData(); WORD wButtons = g_Controllers[fDeviceIndex].state.Gamepad.wButtons; WORD SecondBind = 0; @@ -1618,6 +1621,16 @@ int Init() return 0; } +extern "C" __declspec(dllexport) bool GetPollingState() +{ + return bGlobalDoPolling; +} + +extern "C" __declspec(dllexport) bool SetPollingState(bool state) +{ + bGlobalDoPolling = state; + return state; +} BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD reason, LPVOID /*lpReserved*/) {