diff options
Diffstat (limited to 'src/osd/modules/input/input_dinput.h')
-rw-r--r-- | src/osd/modules/input/input_dinput.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/osd/modules/input/input_dinput.h b/src/osd/modules/input/input_dinput.h index 3d3cf7e6544..b314b3bd538 100644 --- a/src/osd/modules/input/input_dinput.h +++ b/src/osd/modules/input/input_dinput.h @@ -11,8 +11,12 @@ // DirectInput-specific information about a device struct dinput_api_state { +#if DIRECTINPUT_VERSION >= 0x0800 + Microsoft::WRL::ComPtr<IDirectInputDevice8> device; +#else Microsoft::WRL::ComPtr<IDirectInputDevice> device; Microsoft::WRL::ComPtr<IDirectInputDevice2> device2; +#endif DIDEVCAPS caps; LPCDIDATAFORMAT format; }; @@ -39,12 +43,20 @@ public: virtual BOOL device_enum_callback(LPCDIDEVICEINSTANCE instance, LPVOID ref) = 0; }; +#if DIRECTINPUT_VERSION >= 0x0800 +typedef lazy_loaded_function_p4<HRESULT, HMODULE, int, IDirectInput8 **, LPUNKNOWN> pfn_dinput_create; +#else typedef lazy_loaded_function_p4<HRESULT, HMODULE, int, IDirectInput **, LPUNKNOWN> pfn_dinput_create; +#endif class dinput_api_helper { private: +#if DIRECTINPUT_VERSION >= 0x0800 + Microsoft::WRL::ComPtr<IDirectInput8> m_dinput; +#else Microsoft::WRL::ComPtr<IDirectInput> m_dinput; +#endif int m_dinput_version; pfn_dinput_create m_pfn_DirectInputCreate; @@ -76,10 +88,12 @@ public: if (result != DI_OK) goto error; - // try to get a version 2 device for it +#if DIRECTINPUT_VERSION < 0x0800 + // try to get a version 2 device for it so we can use the poll method result = devinfo->dinput.device.CopyTo(IID_IDirectInputDevice2, reinterpret_cast<void**>(devinfo->dinput.device2.GetAddressOf())); if (result != DI_OK) devinfo->dinput.device2 = nullptr; +#endif // get the caps devinfo->dinput.caps.dwSize = sizeof(devinfo->dinput.caps); |