The whole joystick list is refreshed anyway, so probably no reason to track the delay per joystick.
Fixes FPS drops happening each 2-3 seconds in Super House of Dead Ninjas. The game normally calls joyGetPosEx() for joystick 0 only, but once per second it scans all the 16 possible joysticks and for 15 of those joyGetPosEx() results in lengthy joystick list refresh, causing FPS drop in this otherwise not demanding game.
-- v2: winmm: Use a global timeout for refreshing joystick devices.
From: Paul Gofman pgofman@codeweavers.com
--- dlls/winmm/joystick.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/winmm/joystick.c b/dlls/winmm/joystick.c index 52094504186..428593fa590 100644 --- a/dlls/winmm/joystick.c +++ b/dlls/winmm/joystick.c @@ -131,12 +131,12 @@ struct joystick UINT timer; DWORD threshold; BOOL changed; - ULONG last_check; };
static DIDEVICEINSTANCEW instances[16]; static struct joystick joysticks[16]; static IDirectInput8W *dinput; +static ULONG last_check;
static BOOL CALLBACK enum_instances( const DIDEVICEINSTANCEW *instance, void *context ) { @@ -342,9 +342,9 @@ MMRESULT WINAPI DECLSPEC_HOTPATCH joyGetDevCapsW( UINT_PTR id, JOYCAPSW *caps, U
EnterCriticalSection( &joystick_cs );
- if (!(device = joysticks[id].device) && (ticks - joysticks[id].last_check) >= 2000) + if (!(device = joysticks[id].device) && (ticks - last_check) >= 2000) { - joysticks[id].last_check = ticks; + last_check = ticks; find_joysticks(); }
@@ -477,9 +477,9 @@ MMRESULT WINAPI DECLSPEC_HOTPATCH joyGetPosEx( UINT id, JOYINFOEX *info )
EnterCriticalSection( &joystick_cs );
- if (!(device = joysticks[id].device) && (ticks - joysticks[id].last_check) >= 2000) + if (!(device = joysticks[id].device) && (ticks - last_check) >= 2000) { - joysticks[id].last_check = ticks; + last_check = ticks; find_joysticks(); }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=125276
Your paranoid android.
=== debian11 (build log) ===
Task: Could not create the win32 wineprefix: Failed to disable the crash dialogs: Task: WineTest did not produce the win32 report
This merge request was approved by Rémi Bernon.