From 62e37496b365660f904d7130a2ca7d579b9c0530 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Mon, 22 Feb 2021 00:29:07 -0600 Subject: [PATCH] InputCommon: update v1 specification to use new data structure --- .../DynamicInputTextures/DITSpecification.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/Core/InputCommon/DynamicInputTextures/DITSpecification.cpp b/Source/Core/InputCommon/DynamicInputTextures/DITSpecification.cpp index f176115f0eb1..3bc88e6246f6 100644 --- a/Source/Core/InputCommon/DynamicInputTextures/DITSpecification.cpp +++ b/Source/Core/InputCommon/DynamicInputTextures/DITSpecification.cpp @@ -97,7 +97,7 @@ bool ProcessSpecificationV1(picojson::value& root, std::vector& input_text return false; } - auto& key_to_regions = texture_data.m_emulated_controllers[emulated_controller_name]; + auto& entries_vector = texture_data.m_emulated_controllers[emulated_controller_name]; for (auto& [emulated_control, regions_array] : map.get()) { if (!regions_array.is()) @@ -110,7 +110,6 @@ bool ProcessSpecificationV1(picojson::value& root, std::vector& input_text return false; } - std::vector region_rects; for (auto& region : regions_array.get()) { Rect r; @@ -152,9 +151,10 @@ bool ProcessSpecificationV1(picojson::value& root, std::vector& input_text r.top = static_cast(region_offsets[1].get()); r.right = static_cast(region_offsets[2].get()); r.bottom = static_cast(region_offsets[3].get()); - region_rects.push_back(r); + + entries_vector.push_back( + Data::EmulatedSingleEntry{emulated_control, std::nullopt, std::move(r)}); } - key_to_regions.insert_or_assign(emulated_control, std::move(region_rects)); } } @@ -186,10 +186,11 @@ bool ProcessSpecificationV1(picojson::value& root, std::vector& input_text json_file, host_device); return false; } - auto& host_control_to_imagename = texture_data.m_host_devices[host_device]; + auto& host_control_entries = texture_data.m_host_devices[host_device]; for (auto& [host_control, image_name] : map.get()) { - host_control_to_imagename.insert_or_assign(host_control, image_name.to_str()); + host_control_entries.push_back(Data::HostEntry{std::vector{host_control}, + std::nullopt, image_name.to_str()}); } }