dinput: Call hid_joystick_enum_device directly in JoyConfig8Impl_GetConfig.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5726c77faa
commit
bbff12381e
|
@ -74,13 +74,6 @@ static inline IDirectInputDeviceImpl *impl_from_IDirectInputDevice8W(IDirectInpu
|
|||
return CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface);
|
||||
}
|
||||
|
||||
static const struct dinput_device *dinput_devices[] =
|
||||
{
|
||||
&mouse_device,
|
||||
&keyboard_device,
|
||||
&joystick_hid_device,
|
||||
};
|
||||
|
||||
HINSTANCE DINPUT_instance;
|
||||
|
||||
static HWND di_em_win;
|
||||
|
@ -927,10 +920,11 @@ static HRESULT WINAPI JoyConfig8Impl_DeleteType(IDirectInputJoyConfig8 *iface, L
|
|||
|
||||
static HRESULT WINAPI JoyConfig8Impl_GetConfig(IDirectInputJoyConfig8 *iface, UINT id, LPDIJOYCONFIG info, DWORD flags)
|
||||
{
|
||||
DIDEVICEINSTANCEW instance = {.dwSize = sizeof(DIDEVICEINSTANCEW)};
|
||||
IDirectInputImpl *di = impl_from_IDirectInputJoyConfig8(iface);
|
||||
unsigned int i = 0;
|
||||
UINT found = 0;
|
||||
int i, j;
|
||||
HRESULT r;
|
||||
HRESULT hr;
|
||||
|
||||
FIXME("(%p)->(%d, %p, 0x%08x): semi-stub!\n", iface, id, info, flags);
|
||||
|
||||
|
@ -941,29 +935,14 @@ static HRESULT WINAPI JoyConfig8Impl_GetConfig(IDirectInputJoyConfig8 *iface, UI
|
|||
X(DIJC_CALLOUT)
|
||||
#undef X
|
||||
|
||||
/* Enumerate all joysticks in order */
|
||||
for (i = 0; i < ARRAY_SIZE(dinput_devices); i++)
|
||||
do
|
||||
{
|
||||
if (!dinput_devices[i]->enum_device) continue;
|
||||
|
||||
for (j = 0, r = S_OK; SUCCEEDED(r); j++)
|
||||
{
|
||||
DIDEVICEINSTANCEW dev;
|
||||
dev.dwSize = sizeof(dev);
|
||||
if ((r = dinput_devices[i]->enum_device(DI8DEVCLASS_GAMECTRL, 0, &dev, di->dwVersion, j)) == S_OK)
|
||||
{
|
||||
/* Only take into account the chosen id */
|
||||
if (found == id)
|
||||
{
|
||||
if (flags & DIJC_GUIDINSTANCE)
|
||||
info->guidInstance = dev.guidInstance;
|
||||
|
||||
return DI_OK;
|
||||
}
|
||||
found += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
hr = hid_joystick_enum_device( DI8DEVCLASS_GAMECTRL, 0, &instance, di->dwVersion, i++ );
|
||||
if (hr != DI_OK) continue;
|
||||
if (flags & DIJC_GUIDINSTANCE) info->guidInstance = instance.guidInstance;
|
||||
/* Only take into account the chosen id */
|
||||
if (found++ == id) return DI_OK;
|
||||
} while (SUCCEEDED(hr));
|
||||
|
||||
return DIERR_NOMOREITEMS;
|
||||
}
|
||||
|
|
|
@ -52,13 +52,6 @@ struct IDirectInputImpl
|
|||
extern const IDirectInput7AVtbl dinput7_a_vtbl DECLSPEC_HIDDEN;
|
||||
extern const IDirectInput8AVtbl dinput8_a_vtbl DECLSPEC_HIDDEN;
|
||||
|
||||
/* Function called by all devices that Wine supports */
|
||||
struct dinput_device {
|
||||
const char *name;
|
||||
HRESULT (*enum_device)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id);
|
||||
HRESULT (*create_device)(IDirectInputImpl *dinput, REFGUID rguid, IDirectInputDevice8W **out);
|
||||
};
|
||||
|
||||
extern HRESULT mouse_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, DWORD version, int index );
|
||||
extern HRESULT mouse_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirectInputDevice8W **out );
|
||||
extern HRESULT keyboard_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, DWORD version, int index );
|
||||
|
@ -72,10 +65,6 @@ struct DevicePlayer {
|
|||
struct list entry;
|
||||
};
|
||||
|
||||
extern const struct dinput_device mouse_device DECLSPEC_HIDDEN;
|
||||
extern const struct dinput_device keyboard_device DECLSPEC_HIDDEN;
|
||||
extern const struct dinput_device joystick_hid_device DECLSPEC_HIDDEN;
|
||||
|
||||
extern void dinput_hooks_acquire_device(LPDIRECTINPUTDEVICE8W iface);
|
||||
extern void dinput_hooks_unacquire_device(LPDIRECTINPUTDEVICE8W iface);
|
||||
extern int dinput_mouse_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam );
|
||||
|
|
|
@ -1867,13 +1867,6 @@ failed:
|
|||
return hr;
|
||||
}
|
||||
|
||||
const struct dinput_device joystick_hid_device =
|
||||
{
|
||||
"Wine HID joystick driver",
|
||||
hid_joystick_enum_device,
|
||||
hid_joystick_create_device,
|
||||
};
|
||||
|
||||
static HRESULT WINAPI hid_joystick_effect_QueryInterface( IDirectInputEffect *iface, REFIID iid, void **out )
|
||||
{
|
||||
TRACE( "iface %p, iid %s, out %p\n", iface, debugstr_guid( iid ), out );
|
||||
|
|
|
@ -204,12 +204,6 @@ HRESULT keyboard_create_device( IDirectInputImpl *dinput, const GUID *guid, IDir
|
|||
return DI_OK;
|
||||
}
|
||||
|
||||
const struct dinput_device keyboard_device = {
|
||||
"Wine keyboard driver",
|
||||
keyboard_enum_device,
|
||||
keyboard_create_device
|
||||
};
|
||||
|
||||
static HRESULT keyboard_poll( IDirectInputDevice8W *iface )
|
||||
{
|
||||
check_dinput_events();
|
||||
|
|
|
@ -153,12 +153,6 @@ HRESULT mouse_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirect
|
|||
return DI_OK;
|
||||
}
|
||||
|
||||
const struct dinput_device mouse_device = {
|
||||
"Wine mouse driver",
|
||||
mouse_enum_device,
|
||||
mouse_create_device
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* SysMouseA (DInput Mouse support)
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue