diff options
| author | 2021-06-04 00:58:35 +0200 | |
|---|---|---|
| committer | 2021-06-04 00:58:35 +0200 | |
| commit | 166f5d1612de718fc19a45541191b33eb56cd75b (patch) | |
| tree | d8cb9990469b2ba9bace728e1c7b83bced84d4a7 /src | |
| parent | Merge pull request #6402 from Kelebek1/UI (diff) | |
| download | yuzu-166f5d1612de718fc19a45541191b33eb56cd75b.tar.gz yuzu-166f5d1612de718fc19a45541191b33eb56cd75b.tar.xz yuzu-166f5d1612de718fc19a45541191b33eb56cd75b.zip | |
yuzu-cmd: Add touch_from_button in config file
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu_cmd/config.cpp | 37 | ||||
| -rw-r--r-- | src/yuzu_cmd/default_ini.h | 14 |
2 files changed, 50 insertions, 1 deletions
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index a2ab69cdd..63f368fe5 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp | |||
| @@ -317,6 +317,43 @@ void Config::ReadValues() { | |||
| 317 | sdl2_config->GetInteger("ControlsGeneral", "touch_diameter_x", 15); | 317 | sdl2_config->GetInteger("ControlsGeneral", "touch_diameter_x", 15); |
| 318 | Settings::values.touchscreen.diameter_y = | 318 | Settings::values.touchscreen.diameter_y = |
| 319 | sdl2_config->GetInteger("ControlsGeneral", "touch_diameter_y", 15); | 319 | sdl2_config->GetInteger("ControlsGeneral", "touch_diameter_y", 15); |
| 320 | |||
| 321 | int num_touch_from_button_maps = | ||
| 322 | sdl2_config->GetInteger("ControlsGeneral", "touch_from_button_map", 0); | ||
| 323 | if (num_touch_from_button_maps > 0) { | ||
| 324 | for (int i = 0; i < num_touch_from_button_maps; ++i) { | ||
| 325 | Settings::TouchFromButtonMap map; | ||
| 326 | map.name = sdl2_config->Get("ControlsGeneral", | ||
| 327 | std::string("touch_from_button_maps_") + std::to_string(i) + | ||
| 328 | std::string("_name"), | ||
| 329 | "default"); | ||
| 330 | const int num_touch_maps = sdl2_config->GetInteger( | ||
| 331 | "ControlsGeneral", | ||
| 332 | std::string("touch_from_button_maps_") + std::to_string(i) + std::string("_count"), | ||
| 333 | 0); | ||
| 334 | map.buttons.reserve(num_touch_maps); | ||
| 335 | |||
| 336 | for (int j = 0; j < num_touch_maps; ++j) { | ||
| 337 | std::string touch_mapping = | ||
| 338 | sdl2_config->Get("ControlsGeneral", | ||
| 339 | std::string("touch_from_button_maps_") + std::to_string(i) + | ||
| 340 | std::string("_bind_") + std::to_string(j), | ||
| 341 | ""); | ||
| 342 | map.buttons.emplace_back(std::move(touch_mapping)); | ||
| 343 | } | ||
| 344 | |||
| 345 | Settings::values.touch_from_button_maps.emplace_back(std::move(map)); | ||
| 346 | } | ||
| 347 | } else { | ||
| 348 | Settings::values.touch_from_button_maps.emplace_back( | ||
| 349 | Settings::TouchFromButtonMap{"default", {}}); | ||
| 350 | num_touch_from_button_maps = 1; | ||
| 351 | } | ||
| 352 | Settings::values.use_touch_from_button = | ||
| 353 | sdl2_config->GetBoolean("ControlsGeneral", "use_touch_from_button", false); | ||
| 354 | Settings::values.touch_from_button_map_index = | ||
| 355 | std::clamp(Settings::values.touch_from_button_map_index, 0, num_touch_from_button_maps - 1); | ||
| 356 | |||
| 320 | Settings::values.udp_input_servers = | 357 | Settings::values.udp_input_servers = |
| 321 | sdl2_config->Get("Controls", "udp_input_address", InputCommon::CemuhookUDP::DEFAULT_SRV); | 358 | sdl2_config->Get("Controls", "udp_input_address", InputCommon::CemuhookUDP::DEFAULT_SRV); |
| 322 | 359 | ||
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h index 4ce8e08e4..8ce2967ac 100644 --- a/src/yuzu_cmd/default_ini.h +++ b/src/yuzu_cmd/default_ini.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | namespace DefaultINI { | 7 | namespace DefaultINI { |
| 8 | 8 | ||
| 9 | const char* sdl2_config_file = R"( | 9 | const char* sdl2_config_file = R"( |
| 10 | [Controls] | 10 | [ControlsGeneral] |
| 11 | # The input devices and parameters for each Switch native input | 11 | # The input devices and parameters for each Switch native input |
| 12 | # It should be in the format of "engine:[engine_name],[param1]:[value1],[param2]:[value2]..." | 12 | # It should be in the format of "engine:[engine_name],[param1]:[value1],[param2]:[value2]..." |
| 13 | # Escape characters $0 (for ':'), $1 (for ',') and $2 (for '$') can be used in values | 13 | # Escape characters $0 (for ':'), $1 (for ',') and $2 (for '$') can be used in values |
| @@ -86,6 +86,18 @@ motion_device= | |||
| 86 | # - "min_x", "min_y", "max_x", "max_y": defines the udp device's touch screen coordinate system | 86 | # - "min_x", "min_y", "max_x", "max_y": defines the udp device's touch screen coordinate system |
| 87 | touch_device= | 87 | touch_device= |
| 88 | 88 | ||
| 89 | # Whether to enable or disable touch input from button | ||
| 90 | # 0 (default): Disabled, 1: Enabled | ||
| 91 | use_touch_from_button= | ||
| 92 | |||
| 93 | # for mapping buttons to touch inputs. | ||
| 94 | #touch_from_button_map=1 | ||
| 95 | #touch_from_button_maps_0_name=default | ||
| 96 | #touch_from_button_maps_0_count=2 | ||
| 97 | #touch_from_button_maps_0_bind_0=foo | ||
| 98 | #touch_from_button_maps_0_bind_1=bar | ||
| 99 | # etc. | ||
| 100 | |||
| 89 | # Most desktop operating systems do not expose a way to poll the motion state of the controllers | 101 | # Most desktop operating systems do not expose a way to poll the motion state of the controllers |
| 90 | # so as a way around it, cemuhook created a udp client/server protocol to broadcast the data directly | 102 | # so as a way around it, cemuhook created a udp client/server protocol to broadcast the data directly |
| 91 | # from a controller device to the client program. Citra has a client that can connect and read | 103 | # from a controller device to the client program. Citra has a client that can connect and read |