dinput: Support disabled by default option in device_disabled_registry.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2726644124
commit
0ba137e36d
|
@ -271,13 +271,13 @@ void dump_DIEFFECT(LPCDIEFFECT eff, REFGUID guid, DWORD dwFlags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL device_disabled_registry(const char* name)
|
BOOL device_disabled_registry(const char* name, BOOL disable)
|
||||||
{
|
{
|
||||||
static const char disabled_str[] = "disabled";
|
static const char disabled_str[] = "disabled";
|
||||||
|
static const char enabled_str[] = "enabled";
|
||||||
static const char joystick_key[] = "Joysticks";
|
static const char joystick_key[] = "Joysticks";
|
||||||
char buffer[MAX_PATH];
|
char buffer[MAX_PATH];
|
||||||
HKEY hkey, appkey, temp;
|
HKEY hkey, appkey, temp;
|
||||||
BOOL do_disable = FALSE;
|
|
||||||
|
|
||||||
get_app_key(&hkey, &appkey);
|
get_app_key(&hkey, &appkey);
|
||||||
|
|
||||||
|
@ -297,16 +297,23 @@ BOOL device_disabled_registry(const char* name)
|
||||||
|
|
||||||
/* Look for the "controllername"="disabled" key */
|
/* Look for the "controllername"="disabled" key */
|
||||||
if (!get_config_key(hkey, appkey, name, buffer, sizeof(buffer)))
|
if (!get_config_key(hkey, appkey, name, buffer, sizeof(buffer)))
|
||||||
if (!strcmp(disabled_str, buffer))
|
{
|
||||||
|
if (!disable && !strcmp(disabled_str, buffer))
|
||||||
{
|
{
|
||||||
TRACE("Disabling joystick '%s' based on registry key.\n", name);
|
TRACE("Disabling joystick '%s' based on registry key.\n", name);
|
||||||
do_disable = TRUE;
|
disable = TRUE;
|
||||||
|
}
|
||||||
|
else if (disable && !strcmp(enabled_str, buffer))
|
||||||
|
{
|
||||||
|
TRACE("Enabling joystick '%s' based on registry key.\n", name);
|
||||||
|
disable = FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (appkey) RegCloseKey(appkey);
|
if (appkey) RegCloseKey(appkey);
|
||||||
if (hkey) RegCloseKey(hkey);
|
if (hkey) RegCloseKey(hkey);
|
||||||
|
|
||||||
return do_disable;
|
return disable;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL is_xinput_device(const DIDEVCAPS *devcaps, WORD vid, WORD pid)
|
BOOL is_xinput_device(const DIDEVCAPS *devcaps, WORD vid, WORD pid)
|
||||||
|
|
|
@ -175,7 +175,7 @@ static INT find_joystick_devices(void)
|
||||||
/* Append driver name */
|
/* Append driver name */
|
||||||
strcat(joydev.name, JOYDEVDRIVER);
|
strcat(joydev.name, JOYDEVDRIVER);
|
||||||
|
|
||||||
if (device_disabled_registry(joydev.name)) {
|
if (device_disabled_registry(joydev.name, FALSE)) {
|
||||||
close(fd);
|
close(fd);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,7 +264,7 @@ static void find_joydevs(void)
|
||||||
else
|
else
|
||||||
joydev.name = joydev.device;
|
joydev.name = joydev.device;
|
||||||
|
|
||||||
if (device_disabled_registry(joydev.name)) {
|
if (device_disabled_registry(joydev.name, FALSE)) {
|
||||||
close(fd);
|
close(fd);
|
||||||
HeapFree(GetProcessHeap(), 0, joydev.name);
|
HeapFree(GetProcessHeap(), 0, joydev.name);
|
||||||
if (joydev.name != joydev.device)
|
if (joydev.name != joydev.device)
|
||||||
|
|
|
@ -57,7 +57,7 @@ HRESULT setup_dinput_options(JoystickGenericImpl *This, const int *default_axis_
|
||||||
|
|
||||||
DWORD joystick_map_pov(const POINTL *p) DECLSPEC_HIDDEN;
|
DWORD joystick_map_pov(const POINTL *p) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
BOOL device_disabled_registry(const char* name) DECLSPEC_HIDDEN;
|
BOOL device_disabled_registry(const char* name, BOOL disable) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
ULONG WINAPI JoystickWGenericImpl_Release(LPDIRECTINPUTDEVICE8W iface);
|
ULONG WINAPI JoystickWGenericImpl_Release(LPDIRECTINPUTDEVICE8W iface);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue