This repository was archived by the owner on Dec 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 541
/
Copy pathSCPController.h
87 lines (47 loc) · 2.04 KB
/
SCPController.h
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#pragma once
class CSCPController
{
protected:
PTCHAR m_deviceId, m_devicePath;
volatile BOOL m_bConnected, m_xConnected;
PHID_DEVICE m_lpHidDevice;
XINPUT_STATE m_padState;
XINPUT_VIBRATION m_padVibration;
OVERLAPPED m_Reader, m_Writer;
DWORD m_dwIndex;
DWORD m_dwReportSize;
BYTE* m_Report;
BOOL m_bReportEnabled;
SCP_EXTN m_Extended;
protected:
CSCPController();
CSCPController(DWORD dwIndex, DWORD dwReportSize);
static inline float ToPressure(BYTE Value) { return ((int) Value & 0xFF) / 255.0f; }
static inline float ClampAxis(float Value) { if (Value > 1.0f) return 1.0f; else if (Value < -1.0f) return -1.0f; else return Value; }
static inline float ToAxis (SHORT Value) { return ClampAxis(Value / 32767.0f); }
public:
virtual ~CSCPController(void);
virtual BOOL Open(void);
virtual BOOL Close(void);
virtual DWORD GetState(DWORD dwUserIndex, XINPUT_STATE* pState);
virtual DWORD SetState(DWORD dwUserIndex, XINPUT_VIBRATION* pVibration);
virtual DWORD GetCapabilities(DWORD dwUserIndex, DWORD dwFlags, XINPUT_CAPABILITIES* pCapabilities);
virtual DWORD GetDSoundAudioDeviceGuids(DWORD dwUserIndex, GUID* pDSoundRenderGuid, GUID* pDSoundCaptureGuid);
virtual DWORD GetBatteryInformation(DWORD dwUserIndex, BYTE devType, XINPUT_BATTERY_INFORMATION* pBatteryInformation);
virtual DWORD GetKeystroke(DWORD dwUserIndex, DWORD dwReserved, PXINPUT_KEYSTROKE pKeystroke);
virtual DWORD GetExtended(DWORD dwUserIndex, SCP_EXTN* pPressure);
// UNDOCUMENTED
virtual DWORD GetStateEx(DWORD dwUserIndex, XINPUT_STATE *pState);
virtual DWORD WaitForGuideButton(DWORD dwUserIndex, DWORD dwFlag, LPVOID pVoid);
virtual DWORD CancelGuideButtonWait(DWORD dwUserIndex);
virtual DWORD PowerOffController(DWORD dwUserIndex);
protected:
virtual BOOL Reopen(void);
virtual BOOL Read(void);
static void ReadThread(void *lpController);
virtual void Report(void);
virtual void InitReport(void);
virtual SHORT Scale(SHORT Value);
virtual void FormatReport(void) { };
virtual void XInputMapState(void) { };
};