diff options
Diffstat (limited to 'src/core/hle/service/hid')
-rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index d92325cb5..c55d900e2 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -44,7 +44,7 @@ static Controller_NPad::NPadControllerType MapSettingsTypeToNPad(Settings::Contr case Settings::ControllerType::RightJoycon: return Controller_NPad::NPadControllerType::JoyRight; default: - UNREACHABLE(); + UNREACHABLE(); return Controller_NPad::NPadControllerType::JoyDual; } } @@ -93,10 +93,7 @@ u32 Controller_NPad::IndexToNPad(std::size_t index) { }; } -Controller_NPad::Controller_NPad(Core::System& system) - : ControllerBase(system), system(system) { -} - +Controller_NPad::Controller_NPad(Core::System& system) : ControllerBase(system), system(system) {} Controller_NPad::~Controller_NPad() = default; void Controller_NPad::InitNewlyAddedControler(std::size_t controller_idx) { @@ -109,7 +106,7 @@ void Controller_NPad::InitNewlyAddedControler(std::size_t controller_idx) { controller.device_type.raw = 0; switch (controller_type) { case NPadControllerType::None: - UNREACHABLE(); + UNREACHABLE(); break; case NPadControllerType::Handheld: controller.joy_styles.handheld.Assign(1); @@ -197,8 +194,7 @@ void Controller_NPad::OnInit() { std::transform( Settings::values.players.begin(), Settings::values.players.end(), - connected_controllers.begin(), [](const Settings::PlayerInput& player) - { + connected_controllers.begin(), [](const Settings::PlayerInput& player) { return ControllerHolder{MapSettingsTypeToNPad(player.type), player.connected}; }); @@ -242,8 +238,7 @@ void Controller_NPad::OnLoadInputDevices() { } } -void Controller_NPad::OnRelease() { -} +void Controller_NPad::OnRelease() {} void Controller_NPad::RequestPadStateUpdate(u32 npad_id) { const auto controller_idx = NPadIdToIndex(npad_id); @@ -281,31 +276,27 @@ void Controller_NPad::RequestPadStateUpdate(u32 npad_id) { pad_state.d_down.Assign(button_state[DDown - BUTTON_HID_BEGIN]->GetStatus()); pad_state.l_stick_right.Assign( - analog_state[static_cast<std::size_t>(JoystickId::Joystick_Left)]-> - GetAnalogDirectionStatus( + analog_state[static_cast<std::size_t>(JoystickId::Joystick_Left)]->GetAnalogDirectionStatus( Input::AnalogDirection::RIGHT)); pad_state.l_stick_left.Assign( - analog_state[static_cast<std::size_t>(JoystickId::Joystick_Left)]-> - GetAnalogDirectionStatus( + analog_state[static_cast<std::size_t>(JoystickId::Joystick_Left)]->GetAnalogDirectionStatus( Input::AnalogDirection::LEFT)); pad_state.l_stick_up.Assign( - analog_state[static_cast<std::size_t>(JoystickId::Joystick_Left)]-> - GetAnalogDirectionStatus( + analog_state[static_cast<std::size_t>(JoystickId::Joystick_Left)]->GetAnalogDirectionStatus( Input::AnalogDirection::UP)); pad_state.l_stick_down.Assign( - analog_state[static_cast<std::size_t>(JoystickId::Joystick_Left)]-> - GetAnalogDirectionStatus( + analog_state[static_cast<std::size_t>(JoystickId::Joystick_Left)]->GetAnalogDirectionStatus( Input::AnalogDirection::DOWN)); pad_state.r_stick_right.Assign( analog_state[static_cast<std::size_t>(JoystickId::Joystick_Right)] - ->GetAnalogDirectionStatus(Input::AnalogDirection::RIGHT)); + ->GetAnalogDirectionStatus(Input::AnalogDirection::RIGHT)); pad_state.r_stick_left.Assign(analog_state[static_cast<std::size_t>(JoystickId::Joystick_Right)] - ->GetAnalogDirectionStatus(Input::AnalogDirection::LEFT)); + ->GetAnalogDirectionStatus(Input::AnalogDirection::LEFT)); pad_state.r_stick_up.Assign(analog_state[static_cast<std::size_t>(JoystickId::Joystick_Right)] - ->GetAnalogDirectionStatus(Input::AnalogDirection::UP)); + ->GetAnalogDirectionStatus(Input::AnalogDirection::UP)); pad_state.r_stick_down.Assign(analog_state[static_cast<std::size_t>(JoystickId::Joystick_Right)] - ->GetAnalogDirectionStatus(Input::AnalogDirection::DOWN)); + ->GetAnalogDirectionStatus(Input::AnalogDirection::DOWN)); pad_state.left_sl.Assign(button_state[SL - BUTTON_HID_BEGIN]->GetStatus()); pad_state.left_sr.Assign(button_state[SR - BUTTON_HID_BEGIN]->GetStatus()); @@ -372,7 +363,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* switch (controller_type) { case NPadControllerType::None: - UNREACHABLE(); + UNREACHABLE(); break; case NPadControllerType::Handheld: handheld_entry.connection_status.raw = 0; @@ -468,9 +459,8 @@ void Controller_NPad::SetSupportedNPadIdTypes(u8* data, std::size_t length) { continue; } const auto requested_controller = - i <= MAX_NPAD_ID - ? MapSettingsTypeToNPad(Settings::values.players[i].type) - : NPadControllerType::Handheld; + i <= MAX_NPAD_ID ? MapSettingsTypeToNPad(Settings::values.players[i].type) + : NPadControllerType::Handheld; if (!IsControllerSupported(requested_controller)) { const auto is_handheld = requested_controller == NPadControllerType::Handheld; if (is_handheld) { |