summaryrefslogtreecommitdiffstats
path: root/src/core/hid/emulated_controller.cpp
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2023-11-04 21:05:05 +0100
committerNarr the Reg <juangerman-13@hotmail.com>2023-11-04 21:13:18 +0100
commitf07484bc64e6c6f178f4891f1c86ebb23d14dbe7 (patch)
tree70028c9f4a1c3a0a62a873892b023489f56f9eff /src/core/hid/emulated_controller.cpp
parentMerge pull request #11952 from liamwhite/opus_stereo_count (diff)
downloadyuzu-f07484bc64e6c6f178f4891f1c86ebb23d14dbe7.tar
yuzu-f07484bc64e6c6f178f4891f1c86ebb23d14dbe7.tar.gz
yuzu-f07484bc64e6c6f178f4891f1c86ebb23d14dbe7.tar.bz2
yuzu-f07484bc64e6c6f178f4891f1c86ebb23d14dbe7.tar.lz
yuzu-f07484bc64e6c6f178f4891f1c86ebb23d14dbe7.tar.xz
yuzu-f07484bc64e6c6f178f4891f1c86ebb23d14dbe7.tar.zst
yuzu-f07484bc64e6c6f178f4891f1c86ebb23d14dbe7.zip
Diffstat (limited to 'src/core/hid/emulated_controller.cpp')
-rw-r--r--src/core/hid/emulated_controller.cpp37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 8e2894449..b08a71446 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -96,18 +96,7 @@ void EmulatedController::ReloadFromSettings() {
}
controller.color_values = {};
- controller.colors_state.fullkey = {
- .body = GetNpadColor(player.body_color_left),
- .button = GetNpadColor(player.button_color_left),
- };
- controller.colors_state.left = {
- .body = GetNpadColor(player.body_color_left),
- .button = GetNpadColor(player.button_color_left),
- };
- controller.colors_state.right = {
- .body = GetNpadColor(player.body_color_right),
- .button = GetNpadColor(player.button_color_right),
- };
+ ReloadColorsFromSettings();
ring_params[0] = Common::ParamPackage(Settings::values.ringcon_analogs);
@@ -128,6 +117,30 @@ void EmulatedController::ReloadFromSettings() {
ReloadInput();
}
+void EmulatedController::ReloadColorsFromSettings() {
+ const auto player_index = NpadIdTypeToIndex(npad_id_type);
+ const auto& player = Settings::values.players.GetValue()[player_index];
+
+ // Avoid updating colors if overridden by physical controller
+ if (controller.color_values[LeftIndex].body != 0 &&
+ controller.color_values[RightIndex].body != 0) {
+ return;
+ }
+
+ controller.colors_state.fullkey = {
+ .body = GetNpadColor(player.body_color_left),
+ .button = GetNpadColor(player.button_color_left),
+ };
+ controller.colors_state.left = {
+ .body = GetNpadColor(player.body_color_left),
+ .button = GetNpadColor(player.button_color_left),
+ };
+ controller.colors_state.right = {
+ .body = GetNpadColor(player.body_color_right),
+ .button = GetNpadColor(player.button_color_right),
+ };
+}
+
void EmulatedController::LoadDevices() {
// TODO(german77): Use more buttons to detect the correct device
const auto left_joycon = button_params[Settings::NativeButton::DRight];