diff options
Diffstat (limited to 'src/core/hid/emulated_controller.cpp')
| -rw-r--r-- | src/core/hid/emulated_controller.cpp | 37 |
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() { | |||
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | controller.color_values = {}; | 98 | controller.color_values = {}; |
| 99 | controller.colors_state.fullkey = { | 99 | ReloadColorsFromSettings(); |
| 100 | .body = GetNpadColor(player.body_color_left), | ||
| 101 | .button = GetNpadColor(player.button_color_left), | ||
| 102 | }; | ||
| 103 | controller.colors_state.left = { | ||
| 104 | .body = GetNpadColor(player.body_color_left), | ||
| 105 | .button = GetNpadColor(player.button_color_left), | ||
| 106 | }; | ||
| 107 | controller.colors_state.right = { | ||
| 108 | .body = GetNpadColor(player.body_color_right), | ||
| 109 | .button = GetNpadColor(player.button_color_right), | ||
| 110 | }; | ||
| 111 | 100 | ||
| 112 | ring_params[0] = Common::ParamPackage(Settings::values.ringcon_analogs); | 101 | ring_params[0] = Common::ParamPackage(Settings::values.ringcon_analogs); |
| 113 | 102 | ||
| @@ -128,6 +117,30 @@ void EmulatedController::ReloadFromSettings() { | |||
| 128 | ReloadInput(); | 117 | ReloadInput(); |
| 129 | } | 118 | } |
| 130 | 119 | ||
| 120 | void EmulatedController::ReloadColorsFromSettings() { | ||
| 121 | const auto player_index = NpadIdTypeToIndex(npad_id_type); | ||
| 122 | const auto& player = Settings::values.players.GetValue()[player_index]; | ||
| 123 | |||
| 124 | // Avoid updating colors if overridden by physical controller | ||
| 125 | if (controller.color_values[LeftIndex].body != 0 && | ||
| 126 | controller.color_values[RightIndex].body != 0) { | ||
| 127 | return; | ||
| 128 | } | ||
| 129 | |||
| 130 | controller.colors_state.fullkey = { | ||
| 131 | .body = GetNpadColor(player.body_color_left), | ||
| 132 | .button = GetNpadColor(player.button_color_left), | ||
| 133 | }; | ||
| 134 | controller.colors_state.left = { | ||
| 135 | .body = GetNpadColor(player.body_color_left), | ||
| 136 | .button = GetNpadColor(player.button_color_left), | ||
| 137 | }; | ||
| 138 | controller.colors_state.right = { | ||
| 139 | .body = GetNpadColor(player.body_color_right), | ||
| 140 | .button = GetNpadColor(player.button_color_right), | ||
| 141 | }; | ||
| 142 | } | ||
| 143 | |||
| 131 | void EmulatedController::LoadDevices() { | 144 | void EmulatedController::LoadDevices() { |
| 132 | // TODO(german77): Use more buttons to detect the correct device | 145 | // TODO(german77): Use more buttons to detect the correct device |
| 133 | const auto left_joycon = button_params[Settings::NativeButton::DRight]; | 146 | const auto left_joycon = button_params[Settings::NativeButton::DRight]; |