ReXGlue SDK
Toggle main menu visibility
Loading...
Searching...
No Matches
pad.h
Go to the documentation of this file.
1
11
12
#pragma once
13
14
#include <string>
15
16
#include <
rex/bit.h
>
17
#include <
rex/types.h
>
18
19
namespace
rex::hid {
20
21
using
rex::HasFlags
;
22
using
rex::operator|;
23
using
rex::operator&;
24
using
rex::operator^;
25
using
rex::operator~;
26
using
rex::operator|=;
27
using
rex::operator&=;
28
using
rex::operator^=;
29
31
enum
PadButton
: u16 {
32
kPadDPadUp = 0x0001,
33
kPadDPadDown = 0x0002,
34
kPadDPadLeft = 0x0004,
35
kPadDPadRight = 0x0008,
36
kPadStart = 0x0010,
37
kPadBack = 0x0020,
38
kPadLeftThumb
= 0x0040,
39
kPadRightThumb
= 0x0080,
40
kPadLeftShoulder = 0x0100,
41
kPadRightShoulder = 0x0200,
42
kPadGuide = 0x0400,
43
kPadA = 0x1000,
44
kPadB = 0x2000,
45
kPadX = 0x4000,
46
kPadY = 0x8000,
47
};
48
50
struct
PadState
{
51
u16 buttons = 0;
52
u8
left_trigger
= 0;
53
u8
right_trigger
= 0;
54
i16 thumb_lx = 0;
55
i16 thumb_ly = 0;
56
i16 thumb_rx = 0;
57
i16 thumb_ry = 0;
58
};
59
61
struct
PadVibration
{
62
u16
left_motor
= 0;
63
u16
right_motor
= 0;
64
};
65
66
struct
PadCapabilities
{
67
u8
subtype
= 0x01;
68
u16
flags
= 0;
69
PadState
supported
;
70
PadVibration
motors
;
71
};
72
74
struct
PadKeystroke
{
75
u16
virtual_key
= 0;
76
u16
unicode
= 0;
77
u16
flags
= 0;
78
u8
user
= 0;
79
u8
hid_code
= 0;
80
};
81
83
enum class
KeystrokeSource
: u8 {
84
kNone = 0x00,
85
kPad
= 0x01,
86
kKeyboard
= 0x02,
87
};
88
90
enum class
PadType
: u8 {
91
kUnknown,
92
kStandard,
93
kX360,
94
kXOne,
95
kPS3,
96
kPS4,
97
kPS5,
98
kSwitchPro,
99
kSwitchJoyCon,
100
};
101
103
struct
PadInfo
{
104
PadType
type = PadType::kUnknown;
105
u16
vendor
= 0;
106
u16
product
= 0;
107
};
108
110
struct
PadDeviceID
{
111
u64 value = 0;
112
113
constexpr
bool
operator==(
const
PadDeviceID
&)
const
=
default
;
114
};
115
117
inline
constexpr
PadDeviceID
kInvalidPadDeviceID
{};
118
124
struct
PadIdentity
{
125
i32
xinput_slot
= -1;
126
u16
vendor
= 0;
127
u16
product
= 0;
128
std::string
serial
;
129
};
130
131
struct
PadDevice
{
132
PadDeviceID
id
=
kInvalidPadDeviceID
;
133
std::string name;
134
PadInfo
info;
135
PadIdentity
identity;
136
};
137
138
}
// namespace rex::hid
139
140
template
<>
141
inline
constexpr
bool
rex::is_flags_enum<rex::hid::KeystrokeSource>
=
true
;
bit.h
rex::is_flags_enum
constexpr bool is_flags_enum
Definition
bit.h:422
rex::HasFlags
constexpr bool HasFlags(E value, E flags)
Definition
bit.h:483
rex::hid::KeystrokeSource
KeystrokeSource
Definition
pad.h:83
rex::hid::KeystrokeSource::kKeyboard
@ kKeyboard
Definition
pad.h:86
rex::hid::KeystrokeSource::kPad
@ kPad
Definition
pad.h:85
rex::hid::kInvalidPadDeviceID
constexpr PadDeviceID kInvalidPadDeviceID
Definition
pad.h:117
rex::hid::PadButton
PadButton
Definition
pad.h:31
rex::hid::kPadRightThumb
@ kPadRightThumb
Definition
pad.h:39
rex::hid::kPadLeftThumb
@ kPadLeftThumb
Definition
pad.h:38
rex::hid::PadType
PadType
Definition
pad.h:90
rex::hid::PadCapabilities
Definition
pad.h:66
rex::hid::PadCapabilities::subtype
u8 subtype
Definition
pad.h:67
rex::hid::PadCapabilities::motors
PadVibration motors
Definition
pad.h:70
rex::hid::PadCapabilities::supported
PadState supported
Definition
pad.h:69
rex::hid::PadCapabilities::flags
u16 flags
Definition
pad.h:68
rex::hid::PadDeviceID
Definition
pad.h:110
rex::hid::PadDevice
Definition
pad.h:131
rex::hid::PadIdentity
Definition
pad.h:124
rex::hid::PadIdentity::product
u16 product
Definition
pad.h:127
rex::hid::PadIdentity::vendor
u16 vendor
Definition
pad.h:126
rex::hid::PadIdentity::serial
std::string serial
Definition
pad.h:128
rex::hid::PadIdentity::xinput_slot
i32 xinput_slot
Definition
pad.h:125
rex::hid::PadInfo
Definition
pad.h:103
rex::hid::PadInfo::vendor
u16 vendor
Definition
pad.h:105
rex::hid::PadInfo::product
u16 product
Definition
pad.h:106
rex::hid::PadKeystroke
Definition
pad.h:74
rex::hid::PadKeystroke::unicode
u16 unicode
Definition
pad.h:76
rex::hid::PadKeystroke::user
u8 user
Definition
pad.h:78
rex::hid::PadKeystroke::hid_code
u8 hid_code
Definition
pad.h:79
rex::hid::PadKeystroke::virtual_key
u16 virtual_key
Definition
pad.h:75
rex::hid::PadKeystroke::flags
u16 flags
Definition
pad.h:77
rex::hid::PadState
Definition
pad.h:50
rex::hid::PadState::left_trigger
u8 left_trigger
Definition
pad.h:52
rex::hid::PadState::right_trigger
u8 right_trigger
Definition
pad.h:53
rex::hid::PadVibration
Definition
pad.h:61
rex::hid::PadVibration::left_motor
u16 left_motor
Definition
pad.h:62
rex::hid::PadVibration::right_motor
u16 right_motor
Definition
pad.h:63
types.h
Integer types, byte order wrappers and size literals.
rex
hid
pad.h
Generated by
1.18.0