From 70103ece54118002f1ab7b0345be5153143f9c3a Mon Sep 17 00:00:00 2001 From: Aaron M Date: Sat, 18 Jul 2020 15:18:23 +1200 Subject: [PATCH] Revert "Fix FFB not working on certain games" This reverts commit cfbe20d098f528dd16c996a8dd9f0af3b92a688b. --- DllMain.cpp | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/DllMain.cpp b/DllMain.cpp index 4b4b6ed..bfb72eb 100644 --- a/DllMain.cpp +++ b/DllMain.cpp @@ -2059,17 +2059,8 @@ DWORD WINAPI AdjustFFBStrengthLoop(LPVOID lpParam) } } -DWORD WINAPI FFBLoop(LPVOID lpParam) +DWORD WINAPI FFBLoop2(LPVOID lpParam) { - hlp.log("In FFBLoop"); - - SDL_HapticStopAll(haptic); - if (configGameId != 29) //For games which need code to run quicker etc. Some games will crash if no sleep added - { - Sleep(2500); - } - Initialize(0); - hlp.log("Initialize() complete"); if (EnableRumble == 1) { if ((configGameId != 1) && (configGameId != 9) && (configGameId != 12) && (configGameId != 26) && (configGameId != 28) && (configGameId != 29) && (configGameId != 30) && (configGameId != 31) && (configGameId != 35)) @@ -2271,13 +2262,7 @@ DWORD WINAPI FFBLoop(LPVOID lpParam) if (configDefaultFriction >= 0 && configDefaultFriction <= 100) { TriggerFrictionEffectWithDefaultOption(configDefaultFriction / 100.0, true); } - - if (EnableFFBStrengthDynamicAdjustment == 1) - { - CreateThread(NULL, 0, AdjustFFBStrengthLoop, NULL, 0, NULL); - CustomFFBStrengthSetup(); - } - + hlp.log("Entering Game's FFBLoop loop"); bool* kr = (bool*)lpParam; while (*kr) @@ -2292,6 +2277,28 @@ DWORD WINAPI FFBLoop(LPVOID lpParam) return 0; } +DWORD WINAPI FFBLoop(LPVOID lpParam) +{ + hlp.log("In FFBLoop"); + + SDL_HapticStopAll(haptic); + CreateThread(NULL, 0, FFBLoop2, (LPVOID)&keepRunning, 0, NULL); + if (configGameId != 29) //For games which need code to run quicker etc. Some games will crash if no sleep added + { + Sleep(2500); + } + Initialize(0); + hlp.log("Initialize() complete"); + + if (EnableFFBStrengthDynamicAdjustment == 1) + { + Sleep(4000); + CreateThread(NULL, 0, AdjustFFBStrengthLoop, NULL, 0, NULL); + CustomFFBStrengthSetup(); + } + return 0; +} + void CreateFFBLoopThread() { hlp.log("Before CreateThread");