CommonLibSSE NG
Loading...
Searching...
No Matches
BSWin32GamepadDevice.h
Go to the documentation of this file.
1#pragma once
2
4
5namespace RE
6{
8 {
9 public:
10 inline static constexpr auto RTTI = RTTI_BSWin32GamepadDevice;
11 inline static constexpr auto VTABLE = VTABLE_BSWin32GamepadDevice;
12
13 struct Keys
14 {
15 enum Key : std::uint32_t
16 {
17 // button masks for wButtons
32
33 // arbitrary values
34 // IDs meant to be used with ButtonEvent
35 kLeftTrigger = 0x0009,
36 kRightTrigger = 0x000A,
37 // IDs meant to be used with ThumbstickEvent
38 kLeftStick = 0x000B,
39 kRightStick = 0x000C
40 };
41 };
42 using Key = Keys::Key;
43
45 {
46 bool up: 1; // 0x0001
47 bool down: 1; // 0x0002
48 bool left: 1; // 0x0004
49 bool right: 1; // 0x0008
50 bool start: 1; // 0x0010
51 bool back: 1; // 0x0020
52 bool leftThumb: 1; // 0x0040
53 bool rightThumb: 1; // 0x0080
54 bool leftShoulder: 1; // 0x0100
55 bool rightShoulder: 3; // 0x0200, skip over 2 bits (XInput documentation says the state of these two bits are undefined)
56 bool a: 1; // 0x1000
57 bool b: 1; // 0x2000
58 bool x: 1; // 0x4000
59 bool y: 1; // 0x8000
60 };
61
62 ~BSWin32GamepadDevice() override; // 00
63
64 // override (BSPCGamepadDeviceDelegate)
65 void Initialize() override; // 01
66 void Process(float a_arg1) override; // 02
67 void Release() override; // 03 - { return; }
68 void Reset() override; // 08 - { std::memset(&unk0D8, 0, 0x50); }
69 void SetRumble(float lValue, float rValue) override; // 09 - { return; }
70
71 // Returns the previous ButtonState of the gamepad
73 {
74 return stl::unrestricted_cast<ButtonState>(previousState.Gamepad.wButtons & XInput::XINPUT_BUTTON_MASK);
75 }
76
77 // Returns the current ButtonState of the gamepad
79 {
80 return stl::unrestricted_cast<ButtonState>(currentState.Gamepad.wButtons & XInput::XINPUT_BUTTON_MASK);
81 }
82
83 // members
85 float previousLT; // 0E8
86 float previousRT; // 0EC
87 float previousLX; // 0F0
88 float previousLY; // 0F4
89 float previousRX; // 0F8
90 float previousRY; // 0FC
92 float currentLT; // 110
93 float currentRT; // 114
94 float currentLX; // 118
95 float currentLY; // 11C
96 float currentRX; // 120
97 float currentRY; // 124
98
99 protected:
102 };
103 static_assert(sizeof(BSWin32GamepadDevice) == 0x128);
104}
Definition BSPCGamepadDeviceDelegate.h:10
Definition BSWin32GamepadDevice.h:8
float currentRX
Definition BSWin32GamepadDevice.h:96
float previousLT
Definition BSWin32GamepadDevice.h:85
float previousRY
Definition BSWin32GamepadDevice.h:90
float previousRX
Definition BSWin32GamepadDevice.h:89
float currentLY
Definition BSWin32GamepadDevice.h:95
static constexpr auto VTABLE
Definition BSWin32GamepadDevice.h:11
~BSWin32GamepadDevice() override
float currentRT
Definition BSWin32GamepadDevice.h:93
float previousLY
Definition BSWin32GamepadDevice.h:88
XInput::XINPUT_STATE previousState
Definition BSWin32GamepadDevice.h:84
float currentRY
Definition BSWin32GamepadDevice.h:97
float previousLX
Definition BSWin32GamepadDevice.h:87
float currentLX
Definition BSWin32GamepadDevice.h:94
static constexpr auto RTTI
Definition BSWin32GamepadDevice.h:10
ButtonState GetPreviousButtonState() const
Definition BSWin32GamepadDevice.h:72
float currentLT
Definition BSWin32GamepadDevice.h:92
ButtonState GetCurrentButtonState() const
Definition BSWin32GamepadDevice.h:78
XInput::XINPUT_STATE currentState
Definition BSWin32GamepadDevice.h:91
void Process(float a_arg1) override
void SetRumble(float lValue, float rValue) override
float previousRT
Definition BSWin32GamepadDevice.h:86
void Release() override
void Initialize() override
void Reset() override
friend class BSGamepadDeviceHandler
Definition BSWin32GamepadDevice.h:100
static constexpr std::uint16_t XINPUT_BUTTON_MASK
Definition XInputAPI.h:70
@ XINPUT_GAMEPAD_X
Definition XInputAPI.h:63
@ XINPUT_GAMEPAD_START
Definition XInputAPI.h:55
@ XINPUT_GAMEPAD_DPAD_LEFT
Definition XInputAPI.h:53
@ XINPUT_GAMEPAD_Y
Definition XInputAPI.h:64
@ XINPUT_GAMEPAD_DPAD_DOWN
Definition XInputAPI.h:52
@ XINPUT_GAMEPAD_LEFT_THUMB
Definition XInputAPI.h:57
@ XINPUT_GAMEPAD_BACK
Definition XInputAPI.h:56
@ XINPUT_GAMEPAD_LEFT_SHOULDER
Definition XInputAPI.h:59
@ XINPUT_GAMEPAD_DPAD_UP
Definition XInputAPI.h:51
@ XINPUT_GAMEPAD_DPAD_RIGHT
Definition XInputAPI.h:54
@ XINPUT_GAMEPAD_RIGHT_SHOULDER
Definition XInputAPI.h:60
@ XINPUT_GAMEPAD_RIGHT_THUMB
Definition XInputAPI.h:58
@ XINPUT_GAMEPAD_A
Definition XInputAPI.h:61
@ XINPUT_GAMEPAD_B
Definition XInputAPI.h:62
Definition AbsorbEffect.h:6
constexpr std::array< REL::VariantID, 1 > VTABLE_BSWin32GamepadDevice
Definition Offsets_VTABLE.h:5439
constexpr REL::VariantID RTTI_BSWin32GamepadDevice(690317, 398172, 0x1f5fe60)
Definition BSWin32GamepadDevice.h:45
bool y
Definition BSWin32GamepadDevice.h:59
bool b
Definition BSWin32GamepadDevice.h:57
bool rightThumb
Definition BSWin32GamepadDevice.h:53
bool left
Definition BSWin32GamepadDevice.h:48
bool leftShoulder
Definition BSWin32GamepadDevice.h:54
bool back
Definition BSWin32GamepadDevice.h:51
bool down
Definition BSWin32GamepadDevice.h:47
bool leftThumb
Definition BSWin32GamepadDevice.h:52
bool a
Definition BSWin32GamepadDevice.h:56
bool rightShoulder
Definition BSWin32GamepadDevice.h:55
bool start
Definition BSWin32GamepadDevice.h:50
bool x
Definition BSWin32GamepadDevice.h:58
bool up
Definition BSWin32GamepadDevice.h:46
bool right
Definition BSWin32GamepadDevice.h:49
Definition BSWin32GamepadDevice.h:14
Key
Definition BSWin32GamepadDevice.h:16
@ kUp
Definition BSWin32GamepadDevice.h:18
@ kRightThumb
Definition BSWin32GamepadDevice.h:25
@ kRight
Definition BSWin32GamepadDevice.h:21
@ kB
Definition BSWin32GamepadDevice.h:29
@ kLeftThumb
Definition BSWin32GamepadDevice.h:24
@ kDown
Definition BSWin32GamepadDevice.h:19
@ kA
Definition BSWin32GamepadDevice.h:28
@ kLeft
Definition BSWin32GamepadDevice.h:20
@ kBack
Definition BSWin32GamepadDevice.h:23
@ kY
Definition BSWin32GamepadDevice.h:31
@ kRightTrigger
Definition BSWin32GamepadDevice.h:36
@ kLeftTrigger
Definition BSWin32GamepadDevice.h:35
@ kRightShoulder
Definition BSWin32GamepadDevice.h:27
@ kLeftStick
Definition BSWin32GamepadDevice.h:38
@ kX
Definition BSWin32GamepadDevice.h:30
@ kStart
Definition BSWin32GamepadDevice.h:22
@ kRightStick
Definition BSWin32GamepadDevice.h:39
@ kLeftShoulder
Definition BSWin32GamepadDevice.h:26
std::uint16_t wButtons
Definition XInputAPI.h:8
Definition XInputAPI.h:18
__XINPUT_GAMEPAD Gamepad
Definition XInputAPI.h:20