CommonLibSSE NG
Loading...
Searching...
No Matches
BSPCOrbisGamepadDevice.h
Go to the documentation of this file.
1#pragma once
2
4
5namespace RE
6{
7 // PS4 controller used via HID polling
9 {
10 public:
11 inline static constexpr auto RTTI = RTTI_BSPCOrbisGamepadDevice;
12 inline static constexpr auto VTABLE = VTABLE_BSPCOrbisGamepadDevice;
13
14 struct Keys
15 {
16 enum Key : std::uint32_t
17 {
18 // Masks for buttonState
19 // Key hardware value. Matches SCE_PAD_BUTTON_* enum values on ORBIS
20 KUp = 0x0010,
21 kDown = 0x0040,
22 kLeft = 0x0080,
23 kRight = 0x0020,
24 kPS3_Start = 0x0008,
25 kPS3_Back = 0x00100000, // This is mapped to the touchpad on the PS4 controller
26 kPS3_L3 = 0x0002,
27 kPS3_R3 = 0x0004,
28 kPS3_LB = 0x0400,
29 kPS3_RB = 0x0800,
30 kPS3_A = 0x4000,
31 kPS3_B = 0x2000,
32 kPS3_X = 0x8000,
33 kPS3_Y = 0x1000,
34
35 // Unused by Skyrim
36 kPS4_Share = 0x0001, // Skyrim uses the touchpad for Back and leaves the Share button unused
37 kPS4_L2 = 0x0100, // Skyrim uses trigger axis read instead of button press
38 kPS4_R2 = 0x0200, // Skyrim uses trigger axis read instead of button press
39 kPS4_PSBtn = 0x10000, // Playstation button
40
41 // arbitrary values
42 // IDs meant to be used with ButtonEvent
43 kPS3_LT = 0x0009,
44 kPS3_RT = 0x000a,
45 // IDs meant to be used with ThumbstickEvent
46 kPS3_LS = 0x000b,
47 kPS3_RS = 0x000c,
48 };
49 };
50 using Key = Keys::Key;
51
53 {
54 bool Share: 1; // 0x0001 -- unused by Skyrim
55 bool L3: 1; // 0x0002
56 bool R3: 1; // 0x0004
57 bool Start: 1; // 0x0008
58 bool Up: 1; // 0x0010
59 bool Right: 1; // 0x0020
60 bool Down: 1; // 0x0040
61 bool Left: 1; // 0x0080
62 bool L2btn: 1; // 0x0100 -- unused by Skyrim, which uses axis data
63 bool R2btn: 1; // 0x0200 -- unused by Skyrim, which uses axis data
64 bool LB: 1; // 0x0400
65 bool RB: 1; // 0x0800
66 bool Triangle_Y: 1; // 0x1000
67 bool Circle_B: 1; // 0x2000
68 bool Cross_A: 1; // 0x4000
69 bool Square_X: 1; // 0x8000
70 bool PSbtn: 1; // 0x00010000 -- unused by Skyrim
71 bool _unused20000: 1; // 0x00020000
72 bool _unused40000: 1; // 0x00040000
73 bool _unused80000: 1; // 0x00080000
74 bool Touchpad: 1; // 0x00100000
75 bool _unused200000: 1; // 0x00200000
76 bool _unused400000: 1; // 0x00400000
77 bool _unused800000: 1; // 0x00800000
78 bool _unused1000000: 1; // 0x01000000
79 bool _unused2000000: 1; // 0x02000000
80 bool _unused4000000: 1; // 0x04000000
81 bool _unused8000000: 1; // 0x08000000
82 bool _unused10000000: 1; // 0x10000000
83 bool _unused20000000: 1; // 0x20000000
84 bool _unused40000000: 1; // 0x40000000
85 bool _Intercepted: 1; // 0x80000000
86 };
87 static_assert(sizeof(ButtonState) == 0x4);
88
89 struct Vector3
90 {
91 float x; // 00
92 float y; // 04
93 float z; // 08
94 };
95 static_assert(sizeof(Vector3) == 0x0C);
96
97 struct Vector4
98 {
99 float x; // 00
100 float y; // 04
101 float z; // 08
102 float w; // 0C
103 };
104 static_assert(sizeof(Vector4) == 0x10);
105
106 struct PadTouch
107 {
108 std::uint16_t x; // 00
109 std::uint16_t y; // 02
110 std::uint8_t touch_id; // 04
111 std::uint8_t pad_05[3]; // 05
112 };
113 static_assert(sizeof(PadTouch) == 0x08);
114
116 {
117 std::uint8_t touchNum; // 00 - Number of touch reports
118 std::uint8_t pad_01[3]; // 01
119 std::uint32_t pad_04; // 04
120 PadTouch touch[2]; // 08 - Touch Data for max number of touch points = 2
121 };
122 static_assert(sizeof(TouchPadData) == 0x18);
123
125 {
126 std::uint32_t extUnitId; // 00
127 std::uint8_t pad04; // 04
128 std::uint8_t dataLength; // 05
129 std::uint8_t data[10]; // 06
130 };
131 static_assert(sizeof(UnusedExtensionData) == 0x10);
132
134 {
135 std::uint32_t buttonState; // 00
136 std::byte rawLeftStickX; // 04
137 std::byte rawLeftStickY; // 05
138 std::byte rawRightStickX; // 06
139 std::byte rawRightStickY; // 07
140 std::byte rawLeftTrigger; // 08
141 std::byte rawRightTrigger; // 09
142 std::byte pad_0A[2]; // 0A
147 bool padConnected; // 4C
148 std::byte pad_4D[3]; // 4D
149 std::uint64_t timestamp; // 50
151 uint8_t connectedCount; // 68 -- Controller handle connected count
152 uint8_t pad_69[2]; // 69 -- nice.
153 uint8_t specialDataLen; // 6B
154 uint8_t specialData[12]; // 6C -- Device data for special controllers
155 };
156 static_assert(sizeof(GamepadData) == 0x78);
157
158 ~BSPCOrbisGamepadDevice() override; // 00
159
160 // override (BSPCGamepadDeviceDelegate)
161 void Initialize() override; // 01
162 void Process(float a_arg1) override; // 02
163 void Release() override; // 03
164 void Reset() override; // 08 - { memset(this+0xD8, 0, 0x120); }
165 void SetRumble(float lValue, float rValue) override; // 09
166 void SetLEDColor(ColorParam* colorParam) override; // 0A
167 void ResetLEDColor() override; // 0B
168 void ProcessRawInput(int32_t a_rawX, int32_t a_rawY, float& a_outX, float& a_outY) override; // 0D
169 void Unk_0E(void) override; // 0E - { return; }
170
172 {
173 return stl::unrestricted_cast<ButtonState>(previousPadState.buttonState);
174 }
175
177 {
178 return stl::unrestricted_cast<ButtonState>(currentPadState.buttonState);
179 }
180
181 // members
183 float previousLT; // 150
184 float previousRT; // 154
185 float previousLX; // 158
186 float previousLY; // 15C
187 float previousRX; // 160
188 float previousRY; // 164
190 float currentLT; // 1E0
191 float currentRT; // 1E4
192 float currentLX; // 1E8
193 float currentLY; // 1EC
194 float currentRX; // 1F0
195 float currentRY; // 1F4
196
197 protected:
200 };
201 static_assert(sizeof(BSPCOrbisGamepadDevice) == 0x1F8);
202}
Definition BSPCGamepadDeviceDelegate.h:10
Definition BSPCOrbisGamepadDevice.h:9
float previousRT
Definition BSPCOrbisGamepadDevice.h:184
GamepadData previousPadState
Definition BSPCOrbisGamepadDevice.h:182
float previousRX
Definition BSPCOrbisGamepadDevice.h:187
float previousLX
Definition BSPCOrbisGamepadDevice.h:185
static constexpr auto RTTI
Definition BSPCOrbisGamepadDevice.h:11
void SetLEDColor(ColorParam *colorParam) override
float currentLY
Definition BSPCOrbisGamepadDevice.h:193
ButtonState GetPreviousButtonState() const
Definition BSPCOrbisGamepadDevice.h:171
void ProcessRawInput(int32_t a_rawX, int32_t a_rawY, float &a_outX, float &a_outY) override
static constexpr auto VTABLE
Definition BSPCOrbisGamepadDevice.h:12
GamepadData currentPadState
Definition BSPCOrbisGamepadDevice.h:189
void Initialize() override
float currentLX
Definition BSPCOrbisGamepadDevice.h:192
float previousLT
Definition BSPCOrbisGamepadDevice.h:183
float previousLY
Definition BSPCOrbisGamepadDevice.h:186
float currentRX
Definition BSPCOrbisGamepadDevice.h:194
void ResetLEDColor() override
float currentRY
Definition BSPCOrbisGamepadDevice.h:195
float previousRY
Definition BSPCOrbisGamepadDevice.h:188
~BSPCOrbisGamepadDevice() override
ButtonState GetCurrentButtonState() const
Definition BSPCOrbisGamepadDevice.h:176
void Unk_0E(void) override
void Process(float a_arg1) override
void SetRumble(float lValue, float rValue) override
float currentRT
Definition BSPCOrbisGamepadDevice.h:191
float currentLT
Definition BSPCOrbisGamepadDevice.h:190
friend class BSGamepadDeviceHandler
Definition BSPCOrbisGamepadDevice.h:198
Definition AbsorbEffect.h:6
constexpr std::array< REL::VariantID, 1 > VTABLE_BSPCOrbisGamepadDevice
Definition Offsets_VTABLE.h:5440
constexpr REL::VariantID RTTI_BSPCOrbisGamepadDevice(690318, 398173, 0x1f5fe90)
Definition BSGamepadDevice.h:19
Definition BSPCOrbisGamepadDevice.h:53
bool Cross_A
Definition BSPCOrbisGamepadDevice.h:68
bool L2btn
Definition BSPCOrbisGamepadDevice.h:62
bool R3
Definition BSPCOrbisGamepadDevice.h:56
bool Down
Definition BSPCOrbisGamepadDevice.h:60
bool _Intercepted
Definition BSPCOrbisGamepadDevice.h:85
bool Up
Definition BSPCOrbisGamepadDevice.h:58
bool _unused200000
Definition BSPCOrbisGamepadDevice.h:75
bool _unused80000
Definition BSPCOrbisGamepadDevice.h:73
bool RB
Definition BSPCOrbisGamepadDevice.h:65
bool _unused2000000
Definition BSPCOrbisGamepadDevice.h:79
bool _unused800000
Definition BSPCOrbisGamepadDevice.h:77
bool Circle_B
Definition BSPCOrbisGamepadDevice.h:67
bool L3
Definition BSPCOrbisGamepadDevice.h:55
bool Start
Definition BSPCOrbisGamepadDevice.h:57
bool _unused8000000
Definition BSPCOrbisGamepadDevice.h:81
bool Touchpad
Definition BSPCOrbisGamepadDevice.h:74
bool R2btn
Definition BSPCOrbisGamepadDevice.h:63
bool _unused40000000
Definition BSPCOrbisGamepadDevice.h:84
bool Right
Definition BSPCOrbisGamepadDevice.h:59
bool _unused10000000
Definition BSPCOrbisGamepadDevice.h:82
bool Left
Definition BSPCOrbisGamepadDevice.h:61
bool _unused40000
Definition BSPCOrbisGamepadDevice.h:72
bool LB
Definition BSPCOrbisGamepadDevice.h:64
bool PSbtn
Definition BSPCOrbisGamepadDevice.h:70
bool _unused20000
Definition BSPCOrbisGamepadDevice.h:71
bool Triangle_Y
Definition BSPCOrbisGamepadDevice.h:66
bool _unused400000
Definition BSPCOrbisGamepadDevice.h:76
bool Share
Definition BSPCOrbisGamepadDevice.h:54
bool _unused20000000
Definition BSPCOrbisGamepadDevice.h:83
bool _unused4000000
Definition BSPCOrbisGamepadDevice.h:80
bool Square_X
Definition BSPCOrbisGamepadDevice.h:69
bool _unused1000000
Definition BSPCOrbisGamepadDevice.h:78
Definition BSPCOrbisGamepadDevice.h:134
std::uint32_t buttonState
Definition BSPCOrbisGamepadDevice.h:135
std::byte rawRightStickY
Definition BSPCOrbisGamepadDevice.h:139
uint8_t specialData[12]
Definition BSPCOrbisGamepadDevice.h:154
Vector4 orientation
Definition BSPCOrbisGamepadDevice.h:143
std::byte rawLeftTrigger
Definition BSPCOrbisGamepadDevice.h:140
std::uint64_t timestamp
Definition BSPCOrbisGamepadDevice.h:149
UnusedExtensionData unusedExtData
Definition BSPCOrbisGamepadDevice.h:150
std::byte rawLeftStickX
Definition BSPCOrbisGamepadDevice.h:136
TouchPadData touchPadData
Definition BSPCOrbisGamepadDevice.h:146
uint8_t pad_69[2]
Definition BSPCOrbisGamepadDevice.h:152
std::byte rawRightTrigger
Definition BSPCOrbisGamepadDevice.h:141
std::byte rawRightStickX
Definition BSPCOrbisGamepadDevice.h:138
Vector3 angularVelocity
Definition BSPCOrbisGamepadDevice.h:145
bool padConnected
Definition BSPCOrbisGamepadDevice.h:147
std::byte rawLeftStickY
Definition BSPCOrbisGamepadDevice.h:137
uint8_t connectedCount
Definition BSPCOrbisGamepadDevice.h:151
uint8_t specialDataLen
Definition BSPCOrbisGamepadDevice.h:153
Vector3 acceleration
Definition BSPCOrbisGamepadDevice.h:144
std::byte pad_4D[3]
Definition BSPCOrbisGamepadDevice.h:148
std::byte pad_0A[2]
Definition BSPCOrbisGamepadDevice.h:142
Definition BSPCOrbisGamepadDevice.h:15
Key
Definition BSPCOrbisGamepadDevice.h:17
@ kPS3_R3
Definition BSPCOrbisGamepadDevice.h:27
@ kPS3_LT
Definition BSPCOrbisGamepadDevice.h:43
@ kPS3_RB
Definition BSPCOrbisGamepadDevice.h:29
@ kLeft
Definition BSPCOrbisGamepadDevice.h:22
@ kPS3_B
Definition BSPCOrbisGamepadDevice.h:31
@ kPS3_RS
Definition BSPCOrbisGamepadDevice.h:47
@ kPS3_Y
Definition BSPCOrbisGamepadDevice.h:33
@ kRight
Definition BSPCOrbisGamepadDevice.h:23
@ kPS3_X
Definition BSPCOrbisGamepadDevice.h:32
@ kDown
Definition BSPCOrbisGamepadDevice.h:21
@ KUp
Definition BSPCOrbisGamepadDevice.h:20
@ kPS3_Start
Definition BSPCOrbisGamepadDevice.h:24
@ kPS4_R2
Definition BSPCOrbisGamepadDevice.h:38
@ kPS4_L2
Definition BSPCOrbisGamepadDevice.h:37
@ kPS4_PSBtn
Definition BSPCOrbisGamepadDevice.h:39
@ kPS3_Back
Definition BSPCOrbisGamepadDevice.h:25
@ kPS4_Share
Definition BSPCOrbisGamepadDevice.h:36
@ kPS3_LS
Definition BSPCOrbisGamepadDevice.h:46
@ kPS3_A
Definition BSPCOrbisGamepadDevice.h:30
@ kPS3_L3
Definition BSPCOrbisGamepadDevice.h:26
@ kPS3_LB
Definition BSPCOrbisGamepadDevice.h:28
@ kPS3_RT
Definition BSPCOrbisGamepadDevice.h:44
Definition BSPCOrbisGamepadDevice.h:107
std::uint8_t touch_id
Definition BSPCOrbisGamepadDevice.h:110
std::uint16_t y
Definition BSPCOrbisGamepadDevice.h:109
std::uint8_t pad_05[3]
Definition BSPCOrbisGamepadDevice.h:111
std::uint16_t x
Definition BSPCOrbisGamepadDevice.h:108
Definition BSPCOrbisGamepadDevice.h:116
PadTouch touch[2]
Definition BSPCOrbisGamepadDevice.h:120
std::uint8_t touchNum
Definition BSPCOrbisGamepadDevice.h:117
std::uint32_t pad_04
Definition BSPCOrbisGamepadDevice.h:119
std::uint8_t pad_01[3]
Definition BSPCOrbisGamepadDevice.h:118
Definition BSPCOrbisGamepadDevice.h:125
std::uint32_t extUnitId
Definition BSPCOrbisGamepadDevice.h:126
std::uint8_t dataLength
Definition BSPCOrbisGamepadDevice.h:128
std::uint8_t pad04
Definition BSPCOrbisGamepadDevice.h:127
std::uint8_t data[10]
Definition BSPCOrbisGamepadDevice.h:129
Definition BSPCOrbisGamepadDevice.h:90
float x
Definition BSPCOrbisGamepadDevice.h:91
float z
Definition BSPCOrbisGamepadDevice.h:93
float y
Definition BSPCOrbisGamepadDevice.h:92
Definition BSPCOrbisGamepadDevice.h:98
float y
Definition BSPCOrbisGamepadDevice.h:100
float z
Definition BSPCOrbisGamepadDevice.h:101
float x
Definition BSPCOrbisGamepadDevice.h:99
float w
Definition BSPCOrbisGamepadDevice.h:102