dinput: Disable linuxinput or linux joysticks based on registry key.
This commit is contained in:
parent
8bfb125617
commit
3da6f1754e
|
@ -49,6 +49,44 @@ static inline IDirectInputDevice8W *IDirectInputDevice8W_from_impl(JoystickGener
|
|||
return &This->base.IDirectInputDevice8W_iface;
|
||||
}
|
||||
|
||||
BOOL device_disabled_registry(const char* name)
|
||||
{
|
||||
static const char *disabled_str = "disabled";
|
||||
static const char *joystick_key = "Joysticks";
|
||||
char buffer[MAX_PATH];
|
||||
HKEY hkey, appkey, temp;
|
||||
BOOL do_disable = FALSE;
|
||||
|
||||
get_app_key(&hkey, &appkey);
|
||||
|
||||
/* Joystick settings are in the 'joysticks' subkey */
|
||||
if (appkey)
|
||||
{
|
||||
if (RegOpenKeyA(appkey, joystick_key, &temp)) temp = 0;
|
||||
RegCloseKey(appkey);
|
||||
appkey = temp;
|
||||
}
|
||||
if (hkey)
|
||||
{
|
||||
if (RegOpenKeyA(hkey, joystick_key, &temp)) temp = 0;
|
||||
RegCloseKey(hkey);
|
||||
hkey = temp;
|
||||
}
|
||||
|
||||
/* Look for the "controllername"="disabled" key */
|
||||
if (!get_config_key(hkey, appkey, name, buffer, sizeof(buffer)))
|
||||
if (!strncmp(disabled_str, buffer, sizeof(disabled_str)))
|
||||
{
|
||||
TRACE("Disabling joystick '%s' based on registry key.\n", name);
|
||||
do_disable = TRUE;
|
||||
}
|
||||
|
||||
if (appkey) RegCloseKey(appkey);
|
||||
if (hkey) RegCloseKey(hkey);
|
||||
|
||||
return do_disable;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* SetProperty : change input device properties
|
||||
*/
|
||||
|
|
|
@ -158,6 +158,8 @@ static INT find_joystick_devices(void)
|
|||
/* Append driver name */
|
||||
strcat(joydev.name, JOYDEVDRIVER);
|
||||
|
||||
if (device_disabled_registry(joydev.name)) continue;
|
||||
|
||||
#ifdef JSIOCGAXES
|
||||
if (ioctl(fd, JSIOCGAXES, &joydev.axis_count) < 0)
|
||||
{
|
||||
|
|
|
@ -251,6 +251,8 @@ static void find_joydevs(void)
|
|||
else
|
||||
joydev.name = joydev.device;
|
||||
|
||||
if (device_disabled_registry(joydev.name)) continue;
|
||||
|
||||
joydev.guid = DInput_Wine_Joystick_Base_GUID;
|
||||
joydev.guid.Data3 += have_joydevs;
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@ HRESULT setup_dinput_options(JoystickGenericImpl *This, const int *default_axis_
|
|||
|
||||
DWORD joystick_map_pov(const POINTL *p) DECLSPEC_HIDDEN;
|
||||
|
||||
BOOL device_disabled_registry(const char* name) DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT WINAPI JoystickWGenericImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
|
||||
LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow) DECLSPEC_HIDDEN;
|
||||
|
||||
|
|
Loading…
Reference in New Issue