forked from riverar/IndirectInput
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindirectinput.cpp
58 lines (48 loc) · 1.65 KB
/
indirectinput.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "common.h"
#include "indirectinput.h"
IndirectInput::IndirectInput(LPDIRECTINPUTA directInput)
{
_directInput = directInput;
}
HRESULT __stdcall IndirectInput::QueryInterface(REFIID riid, LPVOID * ppvObj)
{
return _directInput->QueryInterface(riid, ppvObj);
}
ULONG __stdcall IndirectInput::AddRef()
{
return _directInput->AddRef();
}
ULONG __stdcall IndirectInput::Release()
{
return _directInput->Release();
}
HRESULT __stdcall IndirectInput::CreateDevice(REFGUID rguid, LPDIRECTINPUTDEVICEA * lplpDirectInputDevice, LPUNKNOWN pUnkOuter)
{
return _directInput->CreateDevice(rguid, lplpDirectInputDevice, pUnkOuter);
}
HRESULT __stdcall IndirectInput::EnumDevices(DWORD dwDevType, LPDIENUMDEVICESCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags)
{
//
// To workaround a Windows 10 platform bug that causes a crash when a DEVCLASS_DEVICE
// is encountered (https://aka.ms/AA3931c), we fall back to the EnumDevices behavior
// circa 1996 [DirectInput 3.0 API (September 11, 1996, v1.0, DINPUT3E.DOC)]
//
HRESULT hr = _directInput->EnumDevices(DIDEVTYPE_KEYBOARD, lpCallback, pvRef, dwFlags);
if (SUCCEEDED(hr))
{
hr = _directInput->EnumDevices(DIDEVTYPE_MOUSE, lpCallback, pvRef, dwFlags);
}
return hr;
}
HRESULT __stdcall IndirectInput::GetDeviceStatus(REFGUID rguid)
{
return _directInput->GetDeviceStatus(rguid);
}
HRESULT __stdcall IndirectInput::RunControlPanel(HWND hwndOwner, DWORD dwFlags)
{
return _directInput->RunControlPanel(hwndOwner, dwFlags);
}
HRESULT __stdcall IndirectInput::Initialize(HINSTANCE hinst, DWORD dwVersion)
{
return _directInput->Initialize(hinst, dwVersion);
}