diff options
| author | 2021-11-03 22:35:45 -0600 | |
|---|---|---|
| committer | 2021-11-24 20:30:27 -0600 | |
| commit | 84c58666a4dbb6d46e132514e4d91437fb689fa0 (patch) | |
| tree | 4d6196522922374c927f9139bd22c28ea8cad279 /src/core/hid/emulated_console.cpp | |
| parent | input_common: Fix motion from 3 axis (diff) | |
| download | yuzu-84c58666a4dbb6d46e132514e4d91437fb689fa0.tar.gz yuzu-84c58666a4dbb6d46e132514e4d91437fb689fa0.tar.xz yuzu-84c58666a4dbb6d46e132514e4d91437fb689fa0.zip | |
config: Cleanup and documentation
Diffstat (limited to 'src/core/hid/emulated_console.cpp')
| -rw-r--r-- | src/core/hid/emulated_console.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/hid/emulated_console.cpp b/src/core/hid/emulated_console.cpp index dfbaa3f8c..b51c72eae 100644 --- a/src/core/hid/emulated_console.cpp +++ b/src/core/hid/emulated_console.cpp | |||
| @@ -11,7 +11,7 @@ EmulatedConsole::EmulatedConsole() = default; | |||
| 11 | EmulatedConsole::~EmulatedConsole() = default; | 11 | EmulatedConsole::~EmulatedConsole() = default; |
| 12 | 12 | ||
| 13 | void EmulatedConsole::ReloadFromSettings() { | 13 | void EmulatedConsole::ReloadFromSettings() { |
| 14 | // Using first motion device from player 1. No need to assign a special config at the moment | 14 | // Using first motion device from player 1. No need to assign any unique config at the moment |
| 15 | const auto& player = Settings::values.players.GetValue()[0]; | 15 | const auto& player = Settings::values.players.GetValue()[0]; |
| 16 | motion_params = Common::ParamPackage(player.motions[0]); | 16 | motion_params = Common::ParamPackage(player.motions[0]); |
| 17 | 17 | ||
| @@ -33,6 +33,7 @@ void EmulatedConsole::SetTouchParams() { | |||
| 33 | static_cast<u64>(Settings::values.touch_from_button_map_index.GetValue()); | 33 | static_cast<u64>(Settings::values.touch_from_button_map_index.GetValue()); |
| 34 | const auto& touch_buttons = Settings::values.touch_from_button_maps[button_index].buttons; | 34 | const auto& touch_buttons = Settings::values.touch_from_button_maps[button_index].buttons; |
| 35 | 35 | ||
| 36 | // Map the rest of the fingers from touch from button configuration | ||
| 36 | for (const auto& config_entry : touch_buttons) { | 37 | for (const auto& config_entry : touch_buttons) { |
| 37 | Common::ParamPackage params{config_entry}; | 38 | Common::ParamPackage params{config_entry}; |
| 38 | Common::ParamPackage touch_button_params; | 39 | Common::ParamPackage touch_button_params; |
| @@ -54,7 +55,9 @@ void EmulatedConsole::SetTouchParams() { | |||
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | void EmulatedConsole::ReloadInput() { | 57 | void EmulatedConsole::ReloadInput() { |
| 58 | // If you load any device here add the equivalent to the UnloadInput() function | ||
| 57 | SetTouchParams(); | 59 | SetTouchParams(); |
| 60 | |||
| 58 | motion_devices = Common::Input::CreateDevice<Common::Input::InputDevice>(motion_params); | 61 | motion_devices = Common::Input::CreateDevice<Common::Input::InputDevice>(motion_params); |
| 59 | if (motion_devices) { | 62 | if (motion_devices) { |
| 60 | Common::Input::InputCallback motion_callback{ | 63 | Common::Input::InputCallback motion_callback{ |
| @@ -62,6 +65,7 @@ void EmulatedConsole::ReloadInput() { | |||
| 62 | motion_devices->SetCallback(motion_callback); | 65 | motion_devices->SetCallback(motion_callback); |
| 63 | } | 66 | } |
| 64 | 67 | ||
| 68 | // Unique index for identifying touch device source | ||
| 65 | std::size_t index = 0; | 69 | std::size_t index = 0; |
| 66 | for (auto& touch_device : touch_devices) { | 70 | for (auto& touch_device : touch_devices) { |
| 67 | touch_device = Common::Input::CreateDevice<Common::Input::InputDevice>(touch_params[index]); | 71 | touch_device = Common::Input::CreateDevice<Common::Input::InputDevice>(touch_params[index]); |