core/hid: Remove usage of native types, fix a couple of errors with motion
This commit is contained in:
parent
a17550be98
commit
71f9b90dd9
11 changed files with 631 additions and 427 deletions
|
@ -152,7 +152,7 @@ void EmulatedConsole::SetMotion(Common::Input::CallbackStatus callback) {
|
|||
motion.rotation = emulated.GetGyroscope();
|
||||
motion.orientation = emulated.GetOrientation();
|
||||
motion.quaternion = emulated.GetQuaternion();
|
||||
motion.is_at_rest = emulated.IsMoving(motion_sensitivity);
|
||||
motion.is_at_rest = !emulated.IsMoving(motion_sensitivity);
|
||||
|
||||
TriggerOnChange(ConsoleTriggerType::Motion);
|
||||
}
|
||||
|
|
|
@ -347,7 +347,7 @@ void EmulatedController::RestoreConfig() {
|
|||
}
|
||||
|
||||
std::vector<Common::ParamPackage> EmulatedController::GetMappedDevices(
|
||||
DeviceIndex device_index) const {
|
||||
EmulatedDeviceIndex device_index) const {
|
||||
std::vector<Common::ParamPackage> devices;
|
||||
for (const auto& param : button_params) {
|
||||
if (!param.Has("engine")) {
|
||||
|
@ -704,7 +704,7 @@ void EmulatedController::SetMotion(Common::Input::CallbackStatus callback, std::
|
|||
motion.gyro = emulated.GetGyroscope();
|
||||
motion.rotation = emulated.GetRotations();
|
||||
motion.orientation = emulated.GetOrientation();
|
||||
motion.is_at_rest = emulated.IsMoving(motion_sensitivity);
|
||||
motion.is_at_rest = !emulated.IsMoving(motion_sensitivity);
|
||||
|
||||
TriggerOnChange(ControllerTriggerType::Motion, true);
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ struct ControllerMotion {
|
|||
bool is_at_rest{};
|
||||
};
|
||||
|
||||
enum DeviceIndex : u8 {
|
||||
enum EmulatedDeviceIndex : u8 {
|
||||
LeftIndex,
|
||||
RightIndex,
|
||||
DualIndex,
|
||||
|
@ -202,7 +202,7 @@ public:
|
|||
void RestoreConfig();
|
||||
|
||||
/// Returns a vector of mapped devices from the mapped button and stick parameters
|
||||
std::vector<Common::ParamPackage> GetMappedDevices(DeviceIndex device_index) const;
|
||||
std::vector<Common::ParamPackage> GetMappedDevices(EmulatedDeviceIndex device_index) const;
|
||||
|
||||
// Returns the current mapped button device
|
||||
Common::ParamPackage GetButtonParam(std::size_t index) const;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Core::HID {
|
||||
|
||||
// This is nn::hid::NpadIdType
|
||||
enum class NpadIdType : u8 {
|
||||
enum class NpadIdType : u32 {
|
||||
Player1 = 0x0,
|
||||
Player2 = 0x1,
|
||||
Player3 = 0x2,
|
||||
|
@ -25,7 +25,7 @@ enum class NpadIdType : u8 {
|
|||
Other = 0x10,
|
||||
Handheld = 0x20,
|
||||
|
||||
Invalid = 0xFF,
|
||||
Invalid = 0xFFFFFFFF,
|
||||
};
|
||||
|
||||
/// Converts a NpadIdType to an array index.
|
||||
|
@ -104,10 +104,30 @@ enum class NpadStyleIndex : u8 {
|
|||
MaxNpadType = 34,
|
||||
};
|
||||
|
||||
// This is nn::hid::NpadStyleSet
|
||||
enum class NpadStyleSet : u32 {
|
||||
None = 0,
|
||||
Fullkey = 1U << 0,
|
||||
Handheld = 1U << 1,
|
||||
JoyDual = 1U << 2,
|
||||
JoyLeft = 1U << 3,
|
||||
JoyRight = 1U << 4,
|
||||
Gc = 1U << 5,
|
||||
Palma = 1U << 6,
|
||||
Lark = 1U << 7,
|
||||
HandheldLark = 1U << 8,
|
||||
Lucia = 1U << 9,
|
||||
Lagoon = 1U << 10,
|
||||
Lager = 1U << 11,
|
||||
SystemExt = 1U << 29,
|
||||
System = 1U << 30,
|
||||
};
|
||||
static_assert(sizeof(NpadStyleSet) == 4, "NpadStyleSet is an invalid size");
|
||||
|
||||
// This is nn::hid::NpadStyleTag
|
||||
struct NpadStyleTag {
|
||||
union {
|
||||
u32 raw{};
|
||||
NpadStyleSet raw{};
|
||||
|
||||
BitField<0, 1, u32> fullkey;
|
||||
BitField<1, 1, u32> handheld;
|
||||
|
@ -322,6 +342,47 @@ struct DebugPadButton {
|
|||
};
|
||||
static_assert(sizeof(DebugPadButton) == 0x4, "DebugPadButton is an invalid size");
|
||||
|
||||
enum class DeviceIndex : u8 {
|
||||
Left = 0,
|
||||
Right = 1,
|
||||
None = 2,
|
||||
MaxDeviceIndex = 3,
|
||||
};
|
||||
|
||||
// This is nn::hid::ConsoleSixAxisSensorHandle
|
||||
struct ConsoleSixAxisSensorHandle {
|
||||
u8 unknown_1;
|
||||
u8 unknown_2;
|
||||
INSERT_PADDING_BYTES_NOINIT(2);
|
||||
};
|
||||
static_assert(sizeof(ConsoleSixAxisSensorHandle) == 4,
|
||||
"ConsoleSixAxisSensorHandle is an invalid size");
|
||||
|
||||
// This is nn::hid::SixAxisSensorHandle
|
||||
struct SixAxisSensorHandle {
|
||||
NpadStyleIndex npad_type;
|
||||
u8 npad_id;
|
||||
DeviceIndex device_index;
|
||||
INSERT_PADDING_BYTES_NOINIT(1);
|
||||
};
|
||||
static_assert(sizeof(SixAxisSensorHandle) == 4, "SixAxisSensorHandle is an invalid size");
|
||||
|
||||
struct SixAxisSensorFusionParameters {
|
||||
f32 parameter1;
|
||||
f32 parameter2;
|
||||
};
|
||||
static_assert(sizeof(SixAxisSensorFusionParameters) == 8,
|
||||
"SixAxisSensorFusionParameters is an invalid size");
|
||||
|
||||
// This is nn::hid::VibrationDeviceHandle
|
||||
struct VibrationDeviceHandle {
|
||||
NpadStyleIndex npad_type;
|
||||
u8 npad_id;
|
||||
DeviceIndex device_index;
|
||||
INSERT_PADDING_BYTES_NOINIT(1);
|
||||
};
|
||||
static_assert(sizeof(VibrationDeviceHandle) == 4, "SixAxisSensorHandle is an invalid size");
|
||||
|
||||
// This is nn::hid::VibrationDeviceType
|
||||
enum class VibrationDeviceType : u32 {
|
||||
Unknown = 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue