From 0108ae12b50ed67c410b362d2f988e87096528d8 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Wed, 23 Feb 2022 03:10:16 -0500 Subject: [PATCH] aurora: Cleanup remap_controller_layout --- aurora/lib/input.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/aurora/lib/input.cpp b/aurora/lib/input.cpp index 6da288b68..267cc7296 100644 --- a/aurora/lib/input.cpp +++ b/aurora/lib/input.cpp @@ -15,10 +15,10 @@ struct GameController { }; std::unordered_map g_GameControllers; -static std::optional remap_controller_layout(absl::string_view mapping) { +static std::optional remap_controller_layout(std::string_view mapping) { std::string newMapping; newMapping.reserve(mapping.size()); - absl::btree_map entries; + absl::btree_map entries; for (size_t idx = 0; const auto value : absl::StrSplit(mapping, ',')) { if (idx < 2) { if (idx > 0) { @@ -34,11 +34,10 @@ static std::optional remap_controller_layout(absl::string_view mapp } if (entries.contains("rightshoulder"sv) && !entries.contains("leftshoulder"sv)) { Log.report(logvisor::Info, FMT_STRING("Remapping GameCube controller layout")); + entries.insert_or_assign("back"sv, entries["rightshoulder"sv]); // TODO trigger buttons may differ per platform entries.insert_or_assign("leftshoulder"sv, "b11"sv); - auto zButton = entries["rightshoulder"sv]; entries.insert_or_assign("rightshoulder"sv, "b10"sv); - entries.insert_or_assign("back"sv, zButton); } else if (entries.contains("leftshoulder"sv) && entries.contains("rightshoulder"sv) && entries.contains("back"sv)) { Log.report(logvisor::Info, FMT_STRING("Controller has standard layout")); auto a = entries["a"sv];