From 730f07830247cfcdc551c253d30c6717fc16316c Mon Sep 17 00:00:00 2001 From: german77 Date: Sun, 31 Oct 2021 10:41:44 -0500 Subject: settings: Fix Debug controller type options --- src/core/hid/emulated_console.cpp | 3 ++- src/core/hid/emulated_controller.cpp | 11 ++++++++--- src/core/hid/input_converter.cpp | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src/core') diff --git a/src/core/hid/emulated_console.cpp b/src/core/hid/emulated_console.cpp index c259de0f1..012909954 100644 --- a/src/core/hid/emulated_console.cpp +++ b/src/core/hid/emulated_console.cpp @@ -166,9 +166,10 @@ void EmulatedConsole::SetTouch(Common::Input::CallbackStatus callback, return; } + // TODO(german77): Remap touch id in sequential order console.touch_state[index] = { .position = {console.touch_values[index].x.value, console.touch_values[index].y.value}, - .id = console.touch_values[index].id, + .id = static_cast(console.touch_values[index].id), .pressed = console.touch_values[index].pressed.value, }; diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index 49893cdbd..9a1864279 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp @@ -77,7 +77,12 @@ void EmulatedController::ReloadFromSettings() { controller.colors_state.fullkey = controller.colors_state.left; - SetNpadType(MapSettingsTypeToNPad(player.controller_type)); + // Other or debug controller should always be a pro controller + if (npad_id_type != NpadIdType::Other) { + SetNpadType(MapSettingsTypeToNPad(player.controller_type)); + } else { + SetNpadType(NpadType::ProController); + } if (player.connected) { Connect(); @@ -606,12 +611,12 @@ void EmulatedController::SetTrigger(Common::Input::CallbackStatus callback, std: switch (index) { case Settings::NativeTrigger::LTrigger: controller.gc_trigger_state.left = static_cast(trigger.analog.value * HID_TRIGGER_MAX); - controller.npad_button_state.zl.Assign(trigger.pressed); + controller.npad_button_state.zl.Assign(trigger.pressed.value); break; case Settings::NativeTrigger::RTrigger: controller.gc_trigger_state.right = static_cast(trigger.analog.value * HID_TRIGGER_MAX); - controller.npad_button_state.zr.Assign(trigger.pressed); + controller.npad_button_state.zr.Assign(trigger.pressed.value); break; } diff --git a/src/core/hid/input_converter.cpp b/src/core/hid/input_converter.cpp index 14204917e..5b123bd3a 100644 --- a/src/core/hid/input_converter.cpp +++ b/src/core/hid/input_converter.cpp @@ -53,7 +53,7 @@ Common::Input::ButtonStatus TransformToButton(const Common::Input::CallbackStatu switch (callback.type) { case Common::Input::InputType::Analog: case Common::Input::InputType::Trigger: - status.value = TransformToTrigger(callback).pressed; + status.value = TransformToTrigger(callback).pressed.value; break; case Common::Input::InputType::Button: status = callback.button_status; @@ -222,7 +222,7 @@ Common::Input::TriggerStatus TransformToTrigger(const Common::Input::CallbackSta // Set button status if (calculate_button_value) { - status.pressed = value > properties.threshold; + status.pressed.value = value > properties.threshold; } // Adjust if value is inverted -- cgit v1.2.3