diff --git a/Utilities/Config.cpp b/Utilities/Config.cpp index d43289a12c..f962ff8c38 100644 --- a/Utilities/Config.cpp +++ b/Utilities/Config.cpp @@ -22,15 +22,15 @@ namespace cfg _base::_base(type _type, node* owner, const std::string& name, bool dynamic) : m_type(_type), m_dynamic(dynamic), m_name(name) { - for (const auto& pair : owner->m_nodes) + for (const auto& node : owner->m_nodes) { - if (pair.first == name) + if (node->get_name() == name) { cfg_log.fatal("Node already exists: %s", name); } } - owner->m_nodes.emplace_back(name, this); + owner->m_nodes.emplace_back(this); } bool _base::from_string(const std::string&, bool) @@ -218,11 +218,11 @@ void cfg::encode(YAML::Emitter& out, const cfg::_base& rhs) case type::node: { out << YAML::BeginMap; - for (const auto& np : static_cast(rhs).get_nodes()) + for (const auto& node : static_cast(rhs).get_nodes()) { - out << YAML::Key << np.first; + out << YAML::Key << node->get_name(); out << YAML::Value; - encode(out, *np.second); + encode(out, *node); } out << YAML::EndMap; @@ -281,11 +281,11 @@ void cfg::decode(const YAML::Node& data, cfg::_base& rhs, bool dynamic) if (!pair.first.IsScalar()) continue; // Find the key among existing nodes - for (const auto& _pair : static_cast(rhs).get_nodes()) + for (const auto& node : static_cast(rhs).get_nodes()) { - if (_pair.first == pair.first.Scalar()) + if (node->get_name() == pair.first.Scalar()) { - decode(pair.second, *_pair.second, dynamic); + decode(pair.second, *node, dynamic); } } } @@ -366,7 +366,7 @@ void cfg::node::from_default() { for (auto& node : m_nodes) { - node.second->from_default(); + node->from_default(); } } diff --git a/Utilities/Config.h b/Utilities/Config.h index e97ab042dc..d79095d73e 100644 --- a/Utilities/Config.h +++ b/Utilities/Config.h @@ -98,7 +98,7 @@ namespace cfg // Config tree node which contains another nodes class node : public _base { - std::vector> m_nodes; + std::vector<_base*> m_nodes; friend class _base; diff --git a/rpcs3/Input/evdev_joystick_handler.cpp b/rpcs3/Input/evdev_joystick_handler.cpp index 81c8b89a86..87784fc3b8 100644 --- a/rpcs3/Input/evdev_joystick_handler.cpp +++ b/rpcs3/Input/evdev_joystick_handler.cpp @@ -105,9 +105,9 @@ bool evdev_joystick_handler::Init() for (const auto& node : m_pos_axis_config.get_nodes()) { - if (*static_cast(node.second)) + if (*static_cast(node)) { - const auto name = node.first; + const auto name = node->get_name(); const int code = libevdev_event_code_from_name(EV_ABS, name.c_str()); if (code < 0) evdev_log.error("Failed to read axis name from %s. [code = %d] [name = %s]", m_pos_axis_config.cfg_name, code, name); diff --git a/rpcs3/rpcs3qt/config_adapter.cpp b/rpcs3/rpcs3qt/config_adapter.cpp index ac8afa7307..cb65fc3f11 100644 --- a/rpcs3/rpcs3qt/config_adapter.cpp +++ b/rpcs3/rpcs3qt/config_adapter.cpp @@ -12,11 +12,11 @@ namespace cfg_adapter { if (root.get_type() == cfg::type::node) { - for (const auto& pair : static_cast(root).get_nodes()) + for (const auto& node : static_cast(root).get_nodes()) { - if (pair.first == name) + if (node->get_name() == name) { - return *pair.second; + return *node; } } } diff --git a/rpcs3/rpcs3qt/emu_settings.cpp b/rpcs3/rpcs3qt/emu_settings.cpp index a162cd7423..d6630b8659 100644 --- a/rpcs3/rpcs3qt/emu_settings.cpp +++ b/rpcs3/rpcs3qt/emu_settings.cpp @@ -196,9 +196,9 @@ void emu_settings::ValidateSettings() if (cfg_base && cfg_base->get_type() == cfg::type::node) { - for (const auto& [name, node] : static_cast(cfg_base)->get_nodes()) + for (const auto& node : static_cast(cfg_base)->get_nodes()) { - if (name == keys[level]) + if (node->get_name() == keys[level]) { cfg_node = node; break;