Reduce disk usage by preventing frequent calls to load an non-existant driver.
ReactOS issue: https://jira.reactos.org/browse/CORE-15336
Signed-off-by: Baruch Rutman peterooch@gmail.com --- dlls/winmm/joystick.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/winmm/joystick.c b/dlls/winmm/joystick.c index 8a52942ca6..5a12b3685b 100644 --- a/dlls/winmm/joystick.c +++ b/dlls/winmm/joystick.c @@ -68,12 +68,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); }
Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Fri, Nov 09, 2018 at 12:45:19AM +0200, Baruch Rutman wrote:
Reduce disk usage by preventing frequent calls to load an non-existant driver.
ReactOS issue: https://jira.reactos.org/browse/CORE-15336
Signed-off-by: Baruch Rutman peterooch@gmail.com
dlls/winmm/joystick.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/winmm/joystick.c b/dlls/winmm/joystick.c index 8a52942ca6..5a12b3685b 100644 --- a/dlls/winmm/joystick.c +++ b/dlls/winmm/joystick.c @@ -68,12 +68,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);
}
-- 2.19.1.windows.1