service: npad: Default initialize shared memory

This commit is contained in:
german77 2022-04-02 19:43:49 -06:00
parent 9346f0b33d
commit 3e5469a974

View file

@ -191,16 +191,16 @@ private:
// This is nn::hid::detail::NpadFullKeyColorState // This is nn::hid::detail::NpadFullKeyColorState
struct NpadFullKeyColorState { struct NpadFullKeyColorState {
ColorAttribute attribute; ColorAttribute attribute{ColorAttribute::NoController};
Core::HID::NpadControllerColor fullkey; Core::HID::NpadControllerColor fullkey{};
}; };
static_assert(sizeof(NpadFullKeyColorState) == 0xC, "NpadFullKeyColorState is an invalid size"); static_assert(sizeof(NpadFullKeyColorState) == 0xC, "NpadFullKeyColorState is an invalid size");
// This is nn::hid::detail::NpadJoyColorState // This is nn::hid::detail::NpadJoyColorState
struct NpadJoyColorState { struct NpadJoyColorState {
ColorAttribute attribute; ColorAttribute attribute{ColorAttribute::NoController};
Core::HID::NpadControllerColor left; Core::HID::NpadControllerColor left{};
Core::HID::NpadControllerColor right; Core::HID::NpadControllerColor right{};
}; };
static_assert(sizeof(NpadJoyColorState) == 0x14, "NpadJoyColorState is an invalid size"); static_assert(sizeof(NpadJoyColorState) == 0x14, "NpadJoyColorState is an invalid size");
@ -226,11 +226,11 @@ private:
// This is nn::hid::NpadPalmaState // This is nn::hid::NpadPalmaState
// This is nn::hid::NpadSystemExtState // This is nn::hid::NpadSystemExtState
struct NPadGenericState { struct NPadGenericState {
s64_le sampling_number; s64_le sampling_number{};
Core::HID::NpadButtonState npad_buttons; Core::HID::NpadButtonState npad_buttons{};
Core::HID::AnalogStickState l_stick; Core::HID::AnalogStickState l_stick{};
Core::HID::AnalogStickState r_stick; Core::HID::AnalogStickState r_stick{};
NpadAttribute connection_status; NpadAttribute connection_status{};
INSERT_PADDING_BYTES(4); // Reserved INSERT_PADDING_BYTES(4); // Reserved
}; };
static_assert(sizeof(NPadGenericState) == 0x28, "NPadGenericState is an invalid size"); static_assert(sizeof(NPadGenericState) == 0x28, "NPadGenericState is an invalid size");
@ -253,7 +253,7 @@ private:
Common::Vec3f gyro{}; Common::Vec3f gyro{};
Common::Vec3f rotation{}; Common::Vec3f rotation{};
std::array<Common::Vec3f, 3> orientation{}; std::array<Common::Vec3f, 3> orientation{};
SixAxisSensorAttribute attribute; SixAxisSensorAttribute attribute{};
INSERT_PADDING_BYTES(4); // Reserved INSERT_PADDING_BYTES(4); // Reserved
}; };
static_assert(sizeof(SixAxisSensorState) == 0x60, "SixAxisSensorState is an invalid size"); static_assert(sizeof(SixAxisSensorState) == 0x60, "SixAxisSensorState is an invalid size");
@ -325,11 +325,11 @@ private:
// This is nn::hid::detail::NfcXcdDeviceHandleStateImpl // This is nn::hid::detail::NfcXcdDeviceHandleStateImpl
struct NfcXcdDeviceHandleStateImpl { struct NfcXcdDeviceHandleStateImpl {
u64 handle; u64 handle{};
bool is_available; bool is_available{};
bool is_activated; bool is_activated{};
INSERT_PADDING_BYTES(0x6); // Reserved INSERT_PADDING_BYTES(0x6); // Reserved
u64 sampling_number; u64 sampling_number{};
}; };
static_assert(sizeof(NfcXcdDeviceHandleStateImpl) == 0x18, static_assert(sizeof(NfcXcdDeviceHandleStateImpl) == 0x18,
"NfcXcdDeviceHandleStateImpl is an invalid size"); "NfcXcdDeviceHandleStateImpl is an invalid size");
@ -366,8 +366,8 @@ private:
}; };
struct AppletFooterUi { struct AppletFooterUi {
AppletFooterUiAttributes attributes; AppletFooterUiAttributes attributes{};
AppletFooterUiType type; AppletFooterUiType type{AppletFooterUiType::None};
INSERT_PADDING_BYTES(0x5B); // Reserved INSERT_PADDING_BYTES(0x5B); // Reserved
}; };
static_assert(sizeof(AppletFooterUi) == 0x60, "AppletFooterUi is an invalid size"); static_assert(sizeof(AppletFooterUi) == 0x60, "AppletFooterUi is an invalid size");
@ -404,41 +404,41 @@ private:
// This is nn::hid::detail::NpadInternalState // This is nn::hid::detail::NpadInternalState
struct NpadInternalState { struct NpadInternalState {
Core::HID::NpadStyleTag style_tag; Core::HID::NpadStyleTag style_tag{Core::HID::NpadStyleSet::None};
NpadJoyAssignmentMode assignment_mode; NpadJoyAssignmentMode assignment_mode{NpadJoyAssignmentMode::Dual};
NpadFullKeyColorState fullkey_color; NpadFullKeyColorState fullkey_color{};
NpadJoyColorState joycon_color; NpadJoyColorState joycon_color{};
Lifo<NPadGenericState, hid_entry_count> fullkey_lifo; Lifo<NPadGenericState, hid_entry_count> fullkey_lifo{};
Lifo<NPadGenericState, hid_entry_count> handheld_lifo; Lifo<NPadGenericState, hid_entry_count> handheld_lifo{};
Lifo<NPadGenericState, hid_entry_count> joy_dual_lifo; Lifo<NPadGenericState, hid_entry_count> joy_dual_lifo{};
Lifo<NPadGenericState, hid_entry_count> joy_left_lifo; Lifo<NPadGenericState, hid_entry_count> joy_left_lifo{};
Lifo<NPadGenericState, hid_entry_count> joy_right_lifo; Lifo<NPadGenericState, hid_entry_count> joy_right_lifo{};
Lifo<NPadGenericState, hid_entry_count> palma_lifo; Lifo<NPadGenericState, hid_entry_count> palma_lifo{};
Lifo<NPadGenericState, hid_entry_count> system_ext_lifo; Lifo<NPadGenericState, hid_entry_count> system_ext_lifo{};
Lifo<SixAxisSensorState, hid_entry_count> sixaxis_fullkey_lifo; Lifo<SixAxisSensorState, hid_entry_count> sixaxis_fullkey_lifo{};
Lifo<SixAxisSensorState, hid_entry_count> sixaxis_handheld_lifo; Lifo<SixAxisSensorState, hid_entry_count> sixaxis_handheld_lifo{};
Lifo<SixAxisSensorState, hid_entry_count> sixaxis_dual_left_lifo; Lifo<SixAxisSensorState, hid_entry_count> sixaxis_dual_left_lifo{};
Lifo<SixAxisSensorState, hid_entry_count> sixaxis_dual_right_lifo; Lifo<SixAxisSensorState, hid_entry_count> sixaxis_dual_right_lifo{};
Lifo<SixAxisSensorState, hid_entry_count> sixaxis_left_lifo; Lifo<SixAxisSensorState, hid_entry_count> sixaxis_left_lifo{};
Lifo<SixAxisSensorState, hid_entry_count> sixaxis_right_lifo; Lifo<SixAxisSensorState, hid_entry_count> sixaxis_right_lifo{};
DeviceType device_type; DeviceType device_type{};
INSERT_PADDING_BYTES(0x4); // Reserved INSERT_PADDING_BYTES(0x4); // Reserved
NPadSystemProperties system_properties; NPadSystemProperties system_properties{};
NpadSystemButtonProperties button_properties; NpadSystemButtonProperties button_properties{};
Core::HID::NpadBatteryLevel battery_level_dual; Core::HID::NpadBatteryLevel battery_level_dual{};
Core::HID::NpadBatteryLevel battery_level_left; Core::HID::NpadBatteryLevel battery_level_left{};
Core::HID::NpadBatteryLevel battery_level_right; Core::HID::NpadBatteryLevel battery_level_right{};
union { union {
Lifo<NfcXcdDeviceHandleStateImpl, 0x2> nfc_xcd_device_lifo{}; AppletFooterUi applet_footer{};
AppletFooterUi applet_footer; Lifo<NfcXcdDeviceHandleStateImpl, 0x2> nfc_xcd_device_lifo;
}; };
INSERT_PADDING_BYTES(0x20); // Unknown INSERT_PADDING_BYTES(0x20); // Unknown
Lifo<NpadGcTriggerState, hid_entry_count> gc_trigger_lifo; Lifo<NpadGcTriggerState, hid_entry_count> gc_trigger_lifo{};
NpadLarkType lark_type_l_and_main; NpadLarkType lark_type_l_and_main{};
NpadLarkType lark_type_r; NpadLarkType lark_type_r{};
NpadLuciaType lucia_type; NpadLuciaType lucia_type{};
NpadLagonType lagon_type; NpadLagonType lagon_type{};
NpadLagerType lager_type; NpadLagerType lager_type{};
// FW 13.x Investigate there is some sort of bitflag related to joycons // FW 13.x Investigate there is some sort of bitflag related to joycons
INSERT_PADDING_BYTES(0x4); INSERT_PADDING_BYTES(0x4);
INSERT_PADDING_BYTES(0xc08); // Unknown INSERT_PADDING_BYTES(0xc08); // Unknown