winmm: Attempt only once to load the default joystick driver.

Signed-off-by: Baruch Rutman <peterooch@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Baruch Rutman 2018-11-09 00:45:19 +02:00 committed by Alexandre Julliard
parent 0c28ca8d50
commit ebae298aa4
1 changed files with 10 additions and 1 deletions

View File

@ -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);
}