summaryrefslogtreecommitdiff
path: root/src/yuzu_cmd/config.cpp
diff options
context:
space:
mode:
authorGravatar Mai M2021-06-04 23:21:29 -0400
committerGravatar GitHub2021-06-04 23:21:29 -0400
commit07f6646f7f76d30477d8384c046cb3c40a46d86c (patch)
tree10fe77d0055c969e4bc6b948a954faae619bccb0 /src/yuzu_cmd/config.cpp
parentMerge pull request #6392 from german77/controller-widget (diff)
parentyuzu-cmd: Add touch_from_button in config file (diff)
downloadyuzu-07f6646f7f76d30477d8384c046cb3c40a46d86c.tar.gz
yuzu-07f6646f7f76d30477d8384c046cb3c40a46d86c.tar.xz
yuzu-07f6646f7f76d30477d8384c046cb3c40a46d86c.zip
Merge pull request #6411 from clementgallet/yuzu-cmd-touch-button
yuzu-cmd: Add touch_from_button in config file
Diffstat (limited to 'src/yuzu_cmd/config.cpp')
-rw-r--r--src/yuzu_cmd/config.cpp37
1 files changed, 37 insertions, 0 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