Commit 7011685e authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dinput: Move PIDVID internal guid to device.c.

parent 46d35211
......@@ -36,6 +36,9 @@
#include "winuser.h"
#include "winerror.h"
#include "dinput.h"
#include "dinputd.h"
#include "initguid.h"
#include "device_private.h"
#include "dinput_private.h"
......@@ -43,6 +46,12 @@
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
/* Windows uses this GUID for guidProduct on non-keyboard/mouse devices.
* Data1 contains the device VID (low word) and PID (high word).
* Data4 ends with the ASCII bytes "PIDVID".
*/
DEFINE_GUID( dinput_pidvid_guid, 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 'P', 'I', 'D', 'V', 'I', 'D' );
static inline IDirectInputDeviceImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
{
return CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface);
......
......@@ -128,7 +128,7 @@ typedef struct
LPDIRECTINPUTEFFECT ref;
} effect_list_item;
extern const GUID DInput_PIDVID_Product_GUID DECLSPEC_HIDDEN;
extern const GUID dinput_pidvid_guid DECLSPEC_HIDDEN;
/* Various debug tools */
extern void _dump_DIPROPHEADER(LPCDIPROPHEADER diph) DECLSPEC_HIDDEN;
......
......@@ -52,14 +52,6 @@ static const WORD PID_XBOX_CONTROLLERS[] = {
0x0719, /* Xbox 360 Wireless Adapter */
};
/* Windows uses this GUID for guidProduct on non-keyboard/mouse devices.
* Data1 contains the device VID (low word) and PID (high word).
* Data4 ends with the ASCII bytes "PIDVID".
*/
const GUID DInput_PIDVID_Product_GUID = { /* device_pidvid-0000-0000-0000-504944564944 */
0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44}
};
static inline JoystickGenericImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
{
return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), JoystickGenericImpl, base);
......
......@@ -1737,7 +1737,7 @@ static BOOL hid_joystick_device_try_open( UINT32 handle, const WCHAR *path, HAND
instance->guidInstance = hid_joystick_guid;
instance->guidInstance.Data1 ^= handle;
instance->guidProduct = DInput_PIDVID_Product_GUID;
instance->guidProduct = dinput_pidvid_guid;
instance->guidProduct.Data1 = MAKELONG( attrs->VendorID, attrs->ProductID );
instance->guidFFDriver = GUID_NULL;
instance->wUsagePage = caps->UsagePage;
......@@ -2258,9 +2258,9 @@ static HRESULT hid_joystick_create_device( IDirectInputImpl *dinput, const GUID
TRACE( "dinput %p, guid %s, out %p\n", dinput, debugstr_guid( guid ), out );
*out = NULL;
instance.guidProduct.Data1 = DInput_PIDVID_Product_GUID.Data1;
instance.guidProduct.Data1 = dinput_pidvid_guid.Data1;
instance.guidInstance.Data1 = hid_joystick_guid.Data1;
if (IsEqualGUID( &DInput_PIDVID_Product_GUID, &instance.guidProduct ))
if (IsEqualGUID( &dinput_pidvid_guid, &instance.guidProduct ))
instance.guidProduct = *guid;
else if (IsEqualGUID( &hid_joystick_guid, &instance.guidInstance ))
instance.guidInstance = *guid;
......
......@@ -315,7 +315,7 @@ static INT find_joystick_devices(void)
else
{
/* Concatenate product_id with vendor_id to mimic Windows behaviour */
joydev.guid_product = DInput_PIDVID_Product_GUID;
joydev.guid_product = dinput_pidvid_guid;
joydev.guid_product.Data1 = MAKELONG(joydev.vendor_id, joydev.product_id);
}
......
......@@ -320,7 +320,7 @@ static void find_joydevs(void)
joydev.bus_type = device_id.bustype;
/* Concatenate product_id with vendor_id to mimic Windows behaviour */
joydev.guid_product = DInput_PIDVID_Product_GUID;
joydev.guid_product = dinput_pidvid_guid;
joydev.guid_product.Data1 = MAKELONG(joydev.vendor_id, joydev.product_id);
}
......
......@@ -1058,7 +1058,7 @@ static HRESULT joydev_enum_device(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINST
/* Return joystick */
lpddi->guidInstance = DInput_Wine_OsX_Joystick_GUID;
lpddi->guidInstance.Data3 = id;
lpddi->guidProduct = DInput_PIDVID_Product_GUID;
lpddi->guidProduct = dinput_pidvid_guid;
lpddi->guidProduct.Data1 = make_vid_pid(device);
lpddi->dwDevType = get_device_type(version, is_joystick);
lpddi->dwDevType |= DIDEVTYPE_HID;
......@@ -1131,7 +1131,7 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, JoystickIm
newDevice->generic.guidInstance = DInput_Wine_OsX_Joystick_GUID;
newDevice->generic.guidInstance.Data3 = index;
newDevice->generic.guidProduct = DInput_PIDVID_Product_GUID;
newDevice->generic.guidProduct = dinput_pidvid_guid;
newDevice->generic.guidProduct.Data1 = make_vid_pid(device);
newDevice->generic.joy_polldev = poll_osx_device_state;
......@@ -1309,7 +1309,7 @@ static unsigned short get_joystick_index(REFGUID guid)
if(IsEqualGUID(&wine_joystick, &dev_guid)) return guid->Data3;
prod_guid.Data1 = 0;
if(IsEqualGUID(&DInput_PIDVID_Product_GUID, &prod_guid))
if(IsEqualGUID(&dinput_pidvid_guid, &prod_guid))
{
joystick_devices_count = find_joystick_devices();
for(i = 0; i < joystick_devices_count; i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment