[PATCH 2/5] dinput: return fake DIPROP_GUIDANDPATH property for linux input joysticks
Alexey Prokhin
alexey at prokhin.ru
Tue Jun 4 16:53:45 CDT 2019
Signed-off-by: Alexey Prokhin <alexey at prokhin.ru>
---
dlls/dinput/joystick_linuxinput.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
index fdfbc7f372..e3371b9f44 100644
--- a/dlls/dinput/joystick_linuxinput.c
+++ b/dlls/dinput/joystick_linuxinput.c
@@ -57,6 +57,7 @@
#include "winbase.h"
#include "winerror.h"
#include "winreg.h"
+#include "devguid.h"
#include "dinput.h"
#include "dinput_private.h"
@@ -1034,6 +1035,29 @@ static HRESULT WINAPI JoystickWImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REF
break;
}
+ case (DWORD_PTR) DIPROP_GUIDANDPATH:
+ {
+ static const WCHAR formatW[] = {'\\','\\','?','\\','h','i','d','#','v','i','d','_','%','0','4','x','&',
+ 'p','i','d','_','%','0','4','x','&','%','s','_','%','h','u',0};
+ static const WCHAR miW[] = {'m','i',0};
+ static const WCHAR igW[] = {'i','g',0};
+
+ BOOL is_gamepad;
+ LPDIPROPGUIDANDPATH pd = (LPDIPROPGUIDANDPATH)pdiph;
+ WORD vid = This->joydev->vendor_id;
+ WORD pid = This->joydev->product_id;
+
+ if (!pid || !vid)
+ return DIERR_UNSUPPORTED;
+
+ is_gamepad = is_xinput_device(&This->generic.devcaps, vid, pid);
+ pd->guidClass = GUID_DEVCLASS_HIDCLASS;
+ sprintfW(pd->wszPath, formatW, vid, pid, is_gamepad ? igW : miW, get_joystick_index(&This->generic.base.guid));
+
+ TRACE("DIPROP_GUIDANDPATH(%s, %s): returning fake path\n", debugstr_guid(&pd->guidClass), debugstr_w(pd->wszPath));
+ break;
+ }
+
default:
return JoystickWGenericImpl_GetProperty(iface, rguid, pdiph);
}
--
2.17.2 (Apple Git-113)
More information about the wine-devel
mailing list