[PATCH] dinput : use vendor and product ids to generate product GUID like it's done on Windows - second try
Bruno Jesus
00cpxxx at gmail.com
Fri Jul 22 19:30:34 CDT 2016
On Fri, Jul 22, 2016 at 3:31 AM, Corentin Rossignon <corossig at gmail.com> wrote:
> Signed-off-by: Corentin Rossignon <corossig at gmail.com>
> ---
> dlls/dinput/joystick_linuxinput.c | 26 ++++++++++++++++++++++++--
> 1 file changed, 24 insertions(+), 2 deletions(-)
Hi, I just tested in Windows and indeed what you intend seems correct.
The PID/VID matches with what Windows uses:
//Windows
guidProduct : {68750603-0000-0000-0000-504944564944} --- Generic HID gamepad
guidProduct : {0268054C-0000-0000-0000-504944564944} --- PS2 gamepad +
usb adapter
//Wine
guidProduct : {9E573ED9-7734-11D2-8D4A-23903FB6BDF7}
guidProduct : {9E573ED9-7734-11D2-8D4A-23903FB6BDF7}
But this patch does not work for me, my joysticks are detected in
joystick_linux.c not joystick_linuxinput.c. I believe the change is
correct but I can't confirm it, a similar patch for joystick_linux.c
would be needed.
> diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
> index 86f12d0..3f9c241 100644
> --- a/dlls/dinput/joystick_linuxinput.c
> +++ b/dlls/dinput/joystick_linuxinput.c
> @@ -96,6 +96,7 @@ struct JoyDev {
> char *device;
> char *name;
> GUID guid;
> + GUID guid_product;
>
> BOOL has_ff;
> int num_effects;
> @@ -293,11 +294,32 @@ static void find_joydevs(void)
> }
>
> if (ioctl(fd, EVIOCGID, &device_id) == -1)
> + {
> WARN("ioctl(EVIOCGID) failed: %d %s\n", errno, strerror(errno));
> + joydev.guid_product = DInput_Wine_Joystick_Base_GUID;
> + }
> else
> {
> joydev.vendor_id = device_id.vendor;
> joydev.product_id = device_id.product;
> +
> + /* Construct the GUID in the same way of Windows doing this.
> + Data1 is concatenation of productid and vendorid.
> + Data2 and Data3 are NULL.
> + Data4 seems to be a constant. */
> + joydev.guid_product.Data1 = (device_id.product << 16) + device_id.vendor;
> +
> + joydev.guid_product.Data2 = 0x0000;
> + joydev.guid_product.Data3 = 0x0000;
> +
> + joydev.guid_product.Data4[0] = 0x00;
> + joydev.guid_product.Data4[1] = 0x00;
> + joydev.guid_product.Data4[2] = 0x50;
> + joydev.guid_product.Data4[3] = 0x49;
> + joydev.guid_product.Data4[4] = 0x44;
> + joydev.guid_product.Data4[5] = 0x56;
> + joydev.guid_product.Data4[6] = 0x49;
> + joydev.guid_product.Data4[7] = 0x44;
> }
I believe it is better to use a local escope static const char and
memcpy instead of setting byte per byte. Or in global escope static
const char near the definition of DInput_Wine_Joystick_Base_GUID
(line 157).
Best regards,
Bruno
More information about the wine-devel
mailing list