https://git.reactos.org/?p=reactos.git;a=commitdiff;h=97150ce9dd96412036e64…
commit 97150ce9dd96412036e64a1aa74ccfd2ca9c1805
Author: Baruch Rutman <peterooch(a)gmail.com>
AuthorDate: Wed Nov 14 13:32:55 2018 +0200
Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org>
CommitDate: Wed Nov 14 12:32:55 2018 +0100
[WINMM] Sync wine commit ebae298 as a fix for CORE-15336 (#1031)
Reduce CPU usage by only attempting once to load the default joystick driver.
Fix for CORE-15336
Imported wine commit ebae298
https://github.com/wine-mirror/wine/commit/ebae298aa4d2711fef35d4ac60c60124…
https://www.winehq.org/pipermail/wine-devel/2018-November/134767.html
---
dll/win32/winmm/joystick.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/dll/win32/winmm/joystick.c b/dll/win32/winmm/joystick.c
index ed6054bfbf..92bd48d399 100644
--- a/dll/win32/winmm/joystick.c
+++ b/dll/win32/winmm/joystick.c
@@ -55,12 +55,21 @@ static WINE_JOYSTICK JOY_Sticks[MAXJOYSTICK];
*/
static BOOL JOY_LoadDriver(DWORD dwJoyID)
{
- if (dwJoyID >= MAXJOYSTICK)
+ static BOOL winejoystick_missing = FALSE;
+
+ if (dwJoyID >= MAXJOYSTICK || winejoystick_missing)
return FALSE;
if (JOY_Sticks[dwJoyID].hDriver)
return TRUE;
JOY_Sticks[dwJoyID].hDriver = OpenDriverA("winejoystick.drv", 0, dwJoyID);
+
+ if (!JOY_Sticks[dwJoyID].hDriver)
+ {
+ /* The default driver is missing, don't attempt to load it again */
+ winejoystick_missing = TRUE;
+ }
+
return (JOY_Sticks[dwJoyID].hDriver != 0);
}