summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar german772021-10-24 23:23:54 -0500
committerGravatar Narr the Reg2021-11-24 20:30:26 -0600
commit064ddacf49aa7155e26add55983b81fdda997077 (patch)
tree17f6d767233c10578d84d2029014a3dfa4b55396
parentinput_common: Add manual update options to input devices (diff)
downloadyuzu-064ddacf49aa7155e26add55983b81fdda997077.tar.gz
yuzu-064ddacf49aa7155e26add55983b81fdda997077.tar.xz
yuzu-064ddacf49aa7155e26add55983b81fdda997077.zip
core/hid: Rework battery mappings
Diffstat (limited to '')
-rw-r--r--src/core/hid/emulated_controller.cpp50
-rw-r--r--src/core/hid/emulated_controller.h28
-rw-r--r--src/core/hid/emulated_devices.cpp2
-rw-r--r--src/core/hid/input_converter.cpp4
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp11
-rw-r--r--src/input_common/helpers/stick_from_buttons.cpp2
-rw-r--r--src/input_common/input_poller.cpp39
-rw-r--r--src/yuzu/configuration/configure_input_player.cpp2
-rw-r--r--src/yuzu/configuration/configure_input_player_widget.cpp17
9 files changed, 109 insertions, 46 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 48add394b..83ced5635 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -87,11 +87,23 @@ void EmulatedController::ReloadFromSettings() {
87 87
88 ReloadInput(); 88 ReloadInput();
89} 89}
90void EmulatedController::LoadDevices() {
91 const auto left_joycon = button_params[Settings::NativeButton::ZL];
92 const auto right_joycon = button_params[Settings::NativeButton::ZR];
90 93
91void EmulatedController::ReloadInput() { 94 // Triggers for GC controllers
92 // If you load any device here add the equivalent to the UnloadInput() function 95 trigger_params[LeftIndex] = button_params[Settings::NativeButton::ZL];
93 const auto left_side = button_params[Settings::NativeButton::ZL]; 96 trigger_params[RightIndex] = button_params[Settings::NativeButton::ZR];
94 const auto right_side = button_params[Settings::NativeButton::ZR]; 97
98 battery_params[LeftIndex] = left_joycon;
99 battery_params[RightIndex] = right_joycon;
100 battery_params[LeftIndex].Set("battery", true);
101 battery_params[RightIndex].Set("battery", true);
102
103 output_params[LeftIndex] = left_joycon;
104 output_params[RightIndex] = right_joycon;
105 output_params[LeftIndex].Set("output", true);
106 output_params[RightIndex].Set("output", true);
95 107
96 std::transform(button_params.begin() + Settings::NativeButton::BUTTON_HID_BEGIN, 108 std::transform(button_params.begin() + Settings::NativeButton::BUTTON_HID_BEGIN,
97 button_params.begin() + Settings::NativeButton::BUTTON_NS_END, 109 button_params.begin() + Settings::NativeButton::BUTTON_NS_END,
@@ -102,19 +114,17 @@ void EmulatedController::ReloadInput() {
102 std::transform(motion_params.begin() + Settings::NativeMotion::MOTION_HID_BEGIN, 114 std::transform(motion_params.begin() + Settings::NativeMotion::MOTION_HID_BEGIN,
103 motion_params.begin() + Settings::NativeMotion::MOTION_HID_END, 115 motion_params.begin() + Settings::NativeMotion::MOTION_HID_END,
104 motion_devices.begin(), Input::CreateDevice<Input::InputDevice>); 116 motion_devices.begin(), Input::CreateDevice<Input::InputDevice>);
117 std::transform(trigger_params.begin(), trigger_params.end(), trigger_devices.begin(),
118 Input::CreateDevice<Input::InputDevice>);
119 std::transform(battery_params.begin(), battery_params.begin(), battery_devices.end(),
120 Input::CreateDevice<Input::InputDevice>);
121 std::transform(output_params.begin(), output_params.end(), output_devices.begin(),
122 Input::CreateDevice<Input::OutputDevice>);
123}
105 124
106 trigger_devices[0] = 125void EmulatedController::ReloadInput() {
107 Input::CreateDevice<Input::InputDevice>(button_params[Settings::NativeButton::ZL]); 126 // If you load any device here add the equivalent to the UnloadInput() function
108 trigger_devices[1] = 127 LoadDevices();
109 Input::CreateDevice<Input::InputDevice>(button_params[Settings::NativeButton::ZR]);
110
111 battery_devices[0] = Input::CreateDevice<Input::InputDevice>(left_side);
112 battery_devices[1] = Input::CreateDevice<Input::InputDevice>(right_side);
113
114 button_params[Settings::NativeButton::ZL].Set("output", true);
115 output_devices[0] =
116 Input::CreateDevice<Input::OutputDevice>(button_params[Settings::NativeButton::ZL]);
117
118 for (std::size_t index = 0; index < button_devices.size(); ++index) { 128 for (std::size_t index = 0; index < button_devices.size(); ++index) {
119 if (!button_devices[index]) { 129 if (!button_devices[index]) {
120 continue; 130 continue;
@@ -241,7 +251,7 @@ void EmulatedController::RestoreConfig() {
241 ReloadFromSettings(); 251 ReloadFromSettings();
242} 252}
243 253
244std::vector<Common::ParamPackage> EmulatedController::GetMappedDevices() const { 254std::vector<Common::ParamPackage> EmulatedController::GetMappedDevices(DeviceIndex device_index) const {
245 std::vector<Common::ParamPackage> devices; 255 std::vector<Common::ParamPackage> devices;
246 for (const auto& param : button_params) { 256 for (const auto& param : button_params) {
247 if (!param.Has("engine")) { 257 if (!param.Has("engine")) {
@@ -612,21 +622,21 @@ void EmulatedController::SetBattery(Input::CallbackStatus callback, std::size_t
612 } 622 }
613 623
614 switch (index) { 624 switch (index) {
615 case 0: 625 case LeftIndex:
616 controller.battery_state.left = { 626 controller.battery_state.left = {
617 .is_powered = is_powered, 627 .is_powered = is_powered,
618 .is_charging = is_charging, 628 .is_charging = is_charging,
619 .battery_level = battery_level, 629 .battery_level = battery_level,
620 }; 630 };
621 break; 631 break;
622 case 1: 632 case RightIndex:
623 controller.battery_state.right = { 633 controller.battery_state.right = {
624 .is_powered = is_powered, 634 .is_powered = is_powered,
625 .is_charging = is_charging, 635 .is_charging = is_charging,
626 .battery_level = battery_level, 636 .battery_level = battery_level,
627 }; 637 };
628 break; 638 break;
629 case 2: 639 case DualIndex:
630 controller.battery_state.dual = { 640 controller.battery_state.dual = {
631 .is_powered = is_powered, 641 .is_powered = is_powered,
632 .is_charging = is_charging, 642 .is_charging = is_charging,
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h
index d66768549..eb705a241 100644
--- a/src/core/hid/emulated_controller.h
+++ b/src/core/hid/emulated_controller.h
@@ -18,7 +18,7 @@
18#include "core/hid/motion_input.h" 18#include "core/hid/motion_input.h"
19 19
20namespace Core::HID { 20namespace Core::HID {
21 21const std::size_t max_emulated_controllers = 2;
22struct ControllerMotionInfo { 22struct ControllerMotionInfo {
23 Input::MotionStatus raw_status{}; 23 Input::MotionStatus raw_status{};
24 MotionInput emulated{}; 24 MotionInput emulated{};
@@ -32,23 +32,23 @@ using ControllerMotionDevices =
32 std::array<std::unique_ptr<Input::InputDevice>, Settings::NativeMotion::NumMotions>; 32 std::array<std::unique_ptr<Input::InputDevice>, Settings::NativeMotion::NumMotions>;
33using TriggerDevices = 33using TriggerDevices =
34 std::array<std::unique_ptr<Input::InputDevice>, Settings::NativeTrigger::NumTriggers>; 34 std::array<std::unique_ptr<Input::InputDevice>, Settings::NativeTrigger::NumTriggers>;
35using BatteryDevices = std::array<std::unique_ptr<Input::InputDevice>, 2>; 35using BatteryDevices = std::array<std::unique_ptr<Input::InputDevice>, max_emulated_controllers>;
36using OutputDevices = std::array<std::unique_ptr<Input::OutputDevice>, 2>; 36using OutputDevices = std::array<std::unique_ptr<Input::OutputDevice>, max_emulated_controllers>;
37 37
38using ButtonParams = std::array<Common::ParamPackage, Settings::NativeButton::NumButtons>; 38using ButtonParams = std::array<Common::ParamPackage, Settings::NativeButton::NumButtons>;
39using StickParams = std::array<Common::ParamPackage, Settings::NativeAnalog::NumAnalogs>; 39using StickParams = std::array<Common::ParamPackage, Settings::NativeAnalog::NumAnalogs>;
40using ControllerMotionParams = std::array<Common::ParamPackage, Settings::NativeMotion::NumMotions>; 40using ControllerMotionParams = std::array<Common::ParamPackage, Settings::NativeMotion::NumMotions>;
41using TriggerParams = std::array<Common::ParamPackage, Settings::NativeTrigger::NumTriggers>; 41using TriggerParams = std::array<Common::ParamPackage, Settings::NativeTrigger::NumTriggers>;
42using BatteryParams = std::array<Common::ParamPackage, 2>; 42using BatteryParams = std::array<Common::ParamPackage, max_emulated_controllers>;
43using OutputParams = std::array<Common::ParamPackage, 2>; 43using OutputParams = std::array<Common::ParamPackage, max_emulated_controllers>;
44 44
45using ButtonValues = std::array<Input::ButtonStatus, Settings::NativeButton::NumButtons>; 45using ButtonValues = std::array<Input::ButtonStatus, Settings::NativeButton::NumButtons>;
46using SticksValues = std::array<Input::StickStatus, Settings::NativeAnalog::NumAnalogs>; 46using SticksValues = std::array<Input::StickStatus, Settings::NativeAnalog::NumAnalogs>;
47using TriggerValues = std::array<Input::TriggerStatus, Settings::NativeTrigger::NumTriggers>; 47using TriggerValues = std::array<Input::TriggerStatus, Settings::NativeTrigger::NumTriggers>;
48using ControllerMotionValues = std::array<ControllerMotionInfo, Settings::NativeMotion::NumMotions>; 48using ControllerMotionValues = std::array<ControllerMotionInfo, Settings::NativeMotion::NumMotions>;
49using ColorValues = std::array<Input::BodyColorStatus, 3>; 49using ColorValues = std::array<Input::BodyColorStatus, max_emulated_controllers>;
50using BatteryValues = std::array<Input::BatteryStatus, 3>; 50using BatteryValues = std::array<Input::BatteryStatus, max_emulated_controllers>;
51using VibrationValues = std::array<Input::VibrationStatus, 2>; 51using VibrationValues = std::array<Input::VibrationStatus, max_emulated_controllers>;
52 52
53struct AnalogSticks { 53struct AnalogSticks {
54 AnalogStickState left{}; 54 AnalogStickState left{};
@@ -75,6 +75,13 @@ struct ControllerMotion {
75 bool is_at_rest{}; 75 bool is_at_rest{};
76}; 76};
77 77
78enum DeviceIndex : u8 {
79 LeftIndex,
80 RightIndex,
81 DualIndex,
82 AllDevices,
83};
84
78using MotionState = std::array<ControllerMotion, 2>; 85using MotionState = std::array<ControllerMotion, 2>;
79 86
80struct ControllerStatus { 87struct ControllerStatus {
@@ -189,7 +196,7 @@ public:
189 void RestoreConfig(); 196 void RestoreConfig();
190 197
191 /// Returns a vector of mapped devices from the mapped button and stick parameters 198 /// Returns a vector of mapped devices from the mapped button and stick parameters
192 std::vector<Common::ParamPackage> GetMappedDevices() const; 199 std::vector<Common::ParamPackage> GetMappedDevices(DeviceIndex device_index) const;
193 200
194 // Returns the current mapped button device 201 // Returns the current mapped button device
195 Common::ParamPackage GetButtonParam(std::size_t index) const; 202 Common::ParamPackage GetButtonParam(std::size_t index) const;
@@ -289,6 +296,9 @@ public:
289 void DeleteCallback(int key); 296 void DeleteCallback(int key);
290 297
291private: 298private:
299 /// creates input devices from params
300 void LoadDevices();
301
292 /** 302 /**
293 * Updates the button status of the controller 303 * Updates the button status of the controller
294 * @param callback: A CallbackStatus containing the button status 304 * @param callback: A CallbackStatus containing the button status
diff --git a/src/core/hid/emulated_devices.cpp b/src/core/hid/emulated_devices.cpp
index 5afd83f62..eb59c310c 100644
--- a/src/core/hid/emulated_devices.cpp
+++ b/src/core/hid/emulated_devices.cpp
@@ -174,7 +174,7 @@ void EmulatedDevices::UpdateKey(std::size_t key_index, bool status) {
174 if (status) { 174 if (status) {
175 entry = entry | mask; 175 entry = entry | mask;
176 } else { 176 } else {
177 entry = entry & ~mask; 177 entry = static_cast<u8>(entry & ~mask);
178 } 178 }
179} 179}
180 180
diff --git a/src/core/hid/input_converter.cpp b/src/core/hid/input_converter.cpp
index b3c8913ce..e2598f367 100644
--- a/src/core/hid/input_converter.cpp
+++ b/src/core/hid/input_converter.cpp
@@ -33,6 +33,10 @@ Input::BatteryStatus TransformToBattery(const Input::CallbackStatus& callback) {
33 } 33 }
34 break; 34 break;
35 } 35 }
36 case Input::InputType::Button:
37 battery = callback.button_status.value ? Input::BatteryLevel::Charging
38 : Input::BatteryLevel::Critical;
39 break;
36 case Input::InputType::Battery: 40 case Input::InputType::Battery:
37 battery = callback.battery_status; 41 battery = callback.battery_status;
38 break; 42 break;
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index 7bf31f63a..9f84e20c2 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -101,8 +101,9 @@ Controller_NPad::Controller_NPad(Core::System& system_,
101 for (std::size_t i = 0; i < controller_data.size(); ++i) { 101 for (std::size_t i = 0; i < controller_data.size(); ++i) {
102 auto& controller = controller_data[i]; 102 auto& controller = controller_data[i];
103 controller.device = system.HIDCore().GetEmulatedControllerByIndex(i); 103 controller.device = system.HIDCore().GetEmulatedControllerByIndex(i);
104 controller.vibration[0].latest_vibration_value = DEFAULT_VIBRATION_VALUE; 104 controller.vibration[Core::HID::DeviceIndex::LeftIndex].latest_vibration_value = DEFAULT_VIBRATION_VALUE;
105 controller.vibration[1].latest_vibration_value = DEFAULT_VIBRATION_VALUE; 105 controller.vibration[Core::HID::DeviceIndex::RightIndex].latest_vibration_value =
106 DEFAULT_VIBRATION_VALUE;
106 Core::HID::ControllerUpdateCallback engine_callback{ 107 Core::HID::ControllerUpdateCallback engine_callback{
107 .on_change = [this, 108 .on_change = [this,
108 i](Core::HID::ControllerTriggerType type) { ControllerUpdate(type, i); }, 109 i](Core::HID::ControllerTriggerType type) { ControllerUpdate(type, i); },
@@ -285,9 +286,12 @@ void Controller_NPad::OnInit() {
285 auto& npad = controller.shared_memory_entry; 286 auto& npad = controller.shared_memory_entry;
286 npad.fullkey_color = { 287 npad.fullkey_color = {
287 .attribute = ColorAttribute::NoController, 288 .attribute = ColorAttribute::NoController,
289 .fullkey = {},
288 }; 290 };
289 npad.joycon_color = { 291 npad.joycon_color = {
290 .attribute = ColorAttribute::NoController, 292 .attribute = ColorAttribute::NoController,
293 .left = {},
294 .right = {},
291 }; 295 };
292 // HW seems to initialize the first 19 entries 296 // HW seems to initialize the first 19 entries
293 for (std::size_t i = 0; i < 19; ++i) { 297 for (std::size_t i = 0; i < 19; ++i) {
@@ -907,9 +911,12 @@ void Controller_NPad::DisconnectNpadAtIndex(std::size_t npad_index) {
907 shared_memory_entry.battery_level_right = 0; 911 shared_memory_entry.battery_level_right = 0;
908 shared_memory_entry.fullkey_color = { 912 shared_memory_entry.fullkey_color = {
909 .attribute = ColorAttribute::NoController, 913 .attribute = ColorAttribute::NoController,
914 .fullkey = {},
910 }; 915 };
911 shared_memory_entry.joycon_color = { 916 shared_memory_entry.joycon_color = {
912 .attribute = ColorAttribute::NoController, 917 .attribute = ColorAttribute::NoController,
918 .left = {},
919 .right = {},
913 }; 920 };
914 shared_memory_entry.assignment_mode = NpadJoyAssignmentMode::Dual; 921 shared_memory_entry.assignment_mode = NpadJoyAssignmentMode::Dual;
915 shared_memory_entry.footer_type = AppletFooterUiType::None; 922 shared_memory_entry.footer_type = AppletFooterUiType::None;
diff --git a/src/input_common/helpers/stick_from_buttons.cpp b/src/input_common/helpers/stick_from_buttons.cpp
index 9101f11ce..806a0e8bb 100644
--- a/src/input_common/helpers/stick_from_buttons.cpp
+++ b/src/input_common/helpers/stick_from_buttons.cpp
@@ -200,7 +200,7 @@ public:
200 TriggerOnChange(status); 200 TriggerOnChange(status);
201 } 201 }
202 202
203 void ForceUpdate() override{ 203 void ForceUpdate() override {
204 up->ForceUpdate(); 204 up->ForceUpdate();
205 down->ForceUpdate(); 205 down->ForceUpdate();
206 left->ForceUpdate(); 206 left->ForceUpdate();
diff --git a/src/input_common/input_poller.cpp b/src/input_common/input_poller.cpp
index 024bd28ef..6edb8d900 100644
--- a/src/input_common/input_poller.cpp
+++ b/src/input_common/input_poller.cpp
@@ -183,6 +183,17 @@ public:
183 return status; 183 return status;
184 } 184 }
185 185
186 void ForceUpdate() {
187 const Input::CallbackStatus status{
188 .type = Input::InputType::Stick,
189 .stick_status = GetStatus(),
190 };
191
192 last_axis_x_value = status.stick_status.x.raw_value;
193 last_axis_y_value = status.stick_status.y.raw_value;
194 TriggerOnChange(status);
195 }
196
186 void OnChange() { 197 void OnChange() {
187 const Input::CallbackStatus status{ 198 const Input::CallbackStatus status{
188 .type = Input::InputType::Stick, 199 .type = Input::InputType::Stick,
@@ -448,6 +459,16 @@ public:
448 return static_cast<Input::BatteryLevel>(input_engine->GetBattery(identifier)); 459 return static_cast<Input::BatteryLevel>(input_engine->GetBattery(identifier));
449 } 460 }
450 461
462 void ForceUpdate() {
463 const Input::CallbackStatus status{
464 .type = Input::InputType::Battery,
465 .battery_status = GetStatus(),
466 };
467
468 last_battery_value = status.battery_status;
469 TriggerOnChange(status);
470 }
471
451 void OnChange() { 472 void OnChange() {
452 const Input::CallbackStatus status{ 473 const Input::CallbackStatus status{
453 .type = Input::InputType::Battery, 474 .type = Input::InputType::Battery,
@@ -579,6 +600,18 @@ public:
579 return status; 600 return status;
580 } 601 }
581 602
603 void ForceUpdate() {
604 const Input::CallbackStatus status{
605 .type = Input::InputType::Motion,
606 .motion_status = GetStatus(),
607 };
608
609 last_axis_x_value = status.motion_status.gyro.x.raw_value;
610 last_axis_y_value = status.motion_status.gyro.y.raw_value;
611 last_axis_z_value = status.motion_status.gyro.z.raw_value;
612 TriggerOnChange(status);
613 }
614
582 void OnChange() { 615 void OnChange() {
583 const Input::CallbackStatus status{ 616 const Input::CallbackStatus status{
584 .type = Input::InputType::Motion, 617 .type = Input::InputType::Motion,
@@ -868,6 +901,9 @@ InputFactory::InputFactory(std::shared_ptr<InputEngine> input_engine_)
868 : input_engine(std::move(input_engine_)) {} 901 : input_engine(std::move(input_engine_)) {}
869 902
870std::unique_ptr<Input::InputDevice> InputFactory::Create(const Common::ParamPackage& params) { 903std::unique_ptr<Input::InputDevice> InputFactory::Create(const Common::ParamPackage& params) {
904 if (params.Has("battery")) {
905 return CreateBatteryDevice(params);
906 }
871 if (params.Has("button") && params.Has("axis")) { 907 if (params.Has("button") && params.Has("axis")) {
872 return CreateTriggerDevice(params); 908 return CreateTriggerDevice(params);
873 } 909 }
@@ -892,9 +928,6 @@ std::unique_ptr<Input::InputDevice> InputFactory::Create(const Common::ParamPack
892 if (params.Has("axis")) { 928 if (params.Has("axis")) {
893 return CreateAnalogDevice(params); 929 return CreateAnalogDevice(params);
894 } 930 }
895 if (params.Has("battery")) {
896 return CreateBatteryDevice(params);
897 }
898 LOG_ERROR(Input, "Invalid parameters given"); 931 LOG_ERROR(Input, "Invalid parameters given");
899 return std::make_unique<DummyInput>(); 932 return std::make_unique<DummyInput>();
900} 933}
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp
index 416096333..acb29a6b4 100644
--- a/src/yuzu/configuration/configure_input_player.cpp
+++ b/src/yuzu/configuration/configure_input_player.cpp
@@ -630,7 +630,7 @@ void ConfigureInputPlayer::UpdateInputDeviceCombobox() {
630 return; 630 return;
631 } 631 }
632 632
633 const auto devices = emulated_controller->GetMappedDevices(); 633 const auto devices = emulated_controller->GetMappedDevices(Core::HID::DeviceIndex::AllDevices);
634 UpdateInputDevices(); 634 UpdateInputDevices();
635 635
636 if (devices.empty()) { 636 if (devices.empty()) {
diff --git a/src/yuzu/configuration/configure_input_player_widget.cpp b/src/yuzu/configuration/configure_input_player_widget.cpp
index 3f179150d..67e56ed3a 100644
--- a/src/yuzu/configuration/configure_input_player_widget.cpp
+++ b/src/yuzu/configuration/configure_input_player_widget.cpp
@@ -356,7 +356,7 @@ void PlayerControlPreview::DrawLeftController(QPainter& p, const QPointF center)
356 DrawCircle(p, center + QPoint(26, 71), 5); 356 DrawCircle(p, center + QPoint(26, 71), 5);
357 357
358 // Draw battery 358 // Draw battery
359 DrawBattery(p, center + QPoint(-170, -140), battery_values[0]); 359 DrawBattery(p, center + QPoint(-170, -140), battery_values[Core::HID::DeviceIndex::LeftIndex]);
360} 360}
361 361
362void PlayerControlPreview::DrawRightController(QPainter& p, const QPointF center) { 362void PlayerControlPreview::DrawRightController(QPainter& p, const QPointF center) {
@@ -482,7 +482,7 @@ void PlayerControlPreview::DrawRightController(QPainter& p, const QPointF center
482 DrawSymbol(p, center + QPoint(-26, 66), Symbol::House, 5); 482 DrawSymbol(p, center + QPoint(-26, 66), Symbol::House, 5);
483 483
484 // Draw battery 484 // Draw battery
485 DrawBattery(p, center + QPoint(110, -140), battery_values[1]); 485 DrawBattery(p, center + QPoint(110, -140), battery_values[Core::HID::DeviceIndex::RightIndex]);
486} 486}
487 487
488void PlayerControlPreview::DrawDualController(QPainter& p, const QPointF center) { 488void PlayerControlPreview::DrawDualController(QPainter& p, const QPointF center) {
@@ -618,8 +618,8 @@ void PlayerControlPreview::DrawDualController(QPainter& p, const QPointF center)
618 DrawSymbol(p, center + QPoint(50, 60), Symbol::House, 4.2f); 618 DrawSymbol(p, center + QPoint(50, 60), Symbol::House, 4.2f);
619 619
620 // Draw battery 620 // Draw battery
621 DrawBattery(p, center + QPoint(-100, -160), battery_values[0]); 621 DrawBattery(p, center + QPoint(-100, -160), battery_values[Core::HID::DeviceIndex::LeftIndex]);
622 DrawBattery(p, center + QPoint(40, -160), battery_values[1]); 622 DrawBattery(p, center + QPoint(40, -160), battery_values[Core::HID::DeviceIndex::RightIndex]);
623} 623}
624 624
625void PlayerControlPreview::DrawHandheldController(QPainter& p, const QPointF center) { 625void PlayerControlPreview::DrawHandheldController(QPainter& p, const QPointF center) {
@@ -720,9 +720,8 @@ void PlayerControlPreview::DrawHandheldController(QPainter& p, const QPointF cen
720 DrawSymbol(p, center + QPoint(161, 37), Symbol::House, 2.75f); 720 DrawSymbol(p, center + QPoint(161, 37), Symbol::House, 2.75f);
721 721
722 // Draw battery 722 // Draw battery
723 DrawBattery(p, center + QPoint(-200, 110), battery_values[0]); 723 DrawBattery(p, center + QPoint(-200, 110), battery_values[Core::HID::DeviceIndex::LeftIndex]);
724 DrawBattery(p, center + QPoint(-30, 110), battery_values[1]); 724 DrawBattery(p, center + QPoint(130, 110), battery_values[Core::HID::DeviceIndex::RightIndex]);
725 DrawBattery(p, center + QPoint(130, 110), battery_values[2]);
726} 725}
727 726
728void PlayerControlPreview::DrawProController(QPainter& p, const QPointF center) { 727void PlayerControlPreview::DrawProController(QPainter& p, const QPointF center) {
@@ -812,7 +811,7 @@ void PlayerControlPreview::DrawProController(QPainter& p, const QPointF center)
812 DrawSymbol(p, center + QPoint(29, -56), Symbol::House, 3.9f); 811 DrawSymbol(p, center + QPoint(29, -56), Symbol::House, 3.9f);
813 812
814 // Draw battery 813 // Draw battery
815 DrawBattery(p, center + QPoint(-30, -160), battery_values[0]); 814 DrawBattery(p, center + QPoint(-30, -160), battery_values[Core::HID::DeviceIndex::LeftIndex]);
816} 815}
817 816
818void PlayerControlPreview::DrawGCController(QPainter& p, const QPointF center) { 817void PlayerControlPreview::DrawGCController(QPainter& p, const QPointF center) {
@@ -868,7 +867,7 @@ void PlayerControlPreview::DrawGCController(QPainter& p, const QPointF center) {
868 DrawCircleButton(p, center + QPoint(0, -44), button_values[Plus], 8); 867 DrawCircleButton(p, center + QPoint(0, -44), button_values[Plus], 8);
869 868
870 // Draw battery 869 // Draw battery
871 DrawBattery(p, center + QPoint(-30, -165), battery_values[0]); 870 DrawBattery(p, center + QPoint(-30, -165), battery_values[Core::HID::DeviceIndex::LeftIndex]);
872} 871}
873 872
874constexpr std::array<float, 13 * 2> symbol_a = { 873constexpr std::array<float, 13 * 2> symbol_a = {