summaryrefslogtreecommitdiff
path: root/src/core/hid/emulated_controller.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hid/emulated_controller.cpp')
-rw-r--r--src/core/hid/emulated_controller.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 8c3895937..085ff3fda 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -84,18 +84,19 @@ void EmulatedController::ReloadFromSettings() {
84 motion_params[index] = Common::ParamPackage(player.motions[index]); 84 motion_params[index] = Common::ParamPackage(player.motions[index]);
85 } 85 }
86 86
87 controller.colors_state.fullkey = {
88 .body = GetNpadColor(player.body_color_left),
89 .button = GetNpadColor(player.button_color_left),
90 };
87 controller.colors_state.left = { 91 controller.colors_state.left = {
88 .body = player.body_color_left, 92 .body = GetNpadColor(player.body_color_left),
89 .button = player.button_color_left, 93 .button = GetNpadColor(player.button_color_left),
90 }; 94 };
91 95 controller.colors_state.left = {
92 controller.colors_state.right = { 96 .body = GetNpadColor(player.body_color_right),
93 .body = player.body_color_right, 97 .button = GetNpadColor(player.button_color_right),
94 .button = player.button_color_right,
95 }; 98 };
96 99
97 controller.colors_state.fullkey = controller.colors_state.left;
98
99 // Other or debug controller should always be a pro controller 100 // Other or debug controller should always be a pro controller
100 if (npad_id_type != NpadIdType::Other) { 101 if (npad_id_type != NpadIdType::Other) {
101 SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type)); 102 SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type));
@@ -1310,6 +1311,15 @@ const CameraState& EmulatedController::GetCamera() const {
1310 return controller.camera_state; 1311 return controller.camera_state;
1311} 1312}
1312 1313
1314NpadColor EmulatedController::GetNpadColor(u32 color) {
1315 return {
1316 .r = static_cast<u8>((color >> 16) & 0xFF),
1317 .g = static_cast<u8>((color >> 8) & 0xFF),
1318 .b = static_cast<u8>(color & 0xFF),
1319 .a = 0xff,
1320 };
1321}
1322
1313void EmulatedController::TriggerOnChange(ControllerTriggerType type, bool is_npad_service_update) { 1323void EmulatedController::TriggerOnChange(ControllerTriggerType type, bool is_npad_service_update) {
1314 std::scoped_lock lock{callback_mutex}; 1324 std::scoped_lock lock{callback_mutex};
1315 for (const auto& poller_pair : callback_list) { 1325 for (const auto& poller_pair : callback_list) {