diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/hid/emulated_console.cpp | 2 | ||||
-rw-r--r-- | src/core/hid/emulated_controller.cpp | 4 | ||||
-rw-r--r-- | src/core/hid/emulated_controller.h | 4 | ||||
-rw-r--r-- | src/core/hid/hid_types.h | 67 |
4 files changed, 69 insertions, 8 deletions
diff --git a/src/core/hid/emulated_console.cpp b/src/core/hid/emulated_console.cpp index 864481f52..374dd5d41 100644 --- a/src/core/hid/emulated_console.cpp +++ b/src/core/hid/emulated_console.cpp @@ -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); } diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index a9038e06f..54c1a2324 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp @@ -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); } diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h index fa2e89c0b..2c5d51bc8 100644 --- a/src/core/hid/emulated_controller.h +++ b/src/core/hid/emulated_controller.h @@ -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; diff --git a/src/core/hid/hid_types.h b/src/core/hid/hid_types.h index 22177b5ed..f224cb744 100644 --- a/src/core/hid/hid_types.h +++ b/src/core/hid/hid_types.h @@ -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, |