From 742ef9cdd6266bb2665533c23a326e1370fb7a75 Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 18 Dec 2022 13:32:49 -0500 Subject: emuopts.cpp: Correction for 42adf5d51de36560547449c6c279a8df9df7dcfe --- src/emu/emuopts.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index 812c6eeb0c1..f5efc348222 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -816,10 +816,10 @@ void emu_options::set_software(std::string &&new_software) // identify any options as a result of softlists software_options softlist_opts = evaluate_initial_softlist_options(new_software); - while (!softlist_opts.slot.empty() || !softlist_opts.slot_defaults.empty() || !softlist_opts.image.empty()) + while (!softlist_opts.slot.empty() || !softlist_opts.image.empty()) { // track how many options we have - size_t before_size = softlist_opts.slot.size() + softlist_opts.slot_defaults.size() + softlist_opts.image.size(); + size_t before_size = softlist_opts.slot.size() + softlist_opts.image.size(); // keep a list of deferred options, in case anything is applied // out of order @@ -835,16 +835,6 @@ void emu_options::set_software(std::string &&new_software) deferred_opts.slot[slot_opt.first] = std::move(slot_opt.second); } - // distribute slot option defaults - for (auto &slot_opt : softlist_opts.slot_defaults) - { - auto iter = m_slot_options.find(slot_opt.first); - if (iter != m_slot_options.end()) - iter->second.set_default_card_software(std::move(slot_opt.second)); - else - deferred_opts.slot_defaults[slot_opt.first] = std::move(slot_opt.second); - } - // distribute image options for (auto &image_opt : softlist_opts.image) { @@ -856,14 +846,23 @@ void emu_options::set_software(std::string &&new_software) } // keep any deferred options for the next round - softlist_opts = std::move(deferred_opts); + softlist_opts.slot = std::move(deferred_opts.slot); + softlist_opts.image = std::move(deferred_opts.image); // do we have any pending options after failing to distribute any? - size_t after_size = softlist_opts.slot.size() + softlist_opts.slot_defaults.size() + softlist_opts.image.size(); + size_t after_size = softlist_opts.slot.size() + softlist_opts.image.size(); if ((after_size > 0) && after_size >= before_size) throw options_error_exception("Could not assign software option"); } + // distribute slot option defaults + for (auto &slot_opt : softlist_opts.slot_defaults) + { + auto iter = m_slot_options.find(slot_opt.first); + if (iter != m_slot_options.end()) + iter->second.set_default_card_software(std::move(slot_opt.second)); + } + // we've succeeded; update the set name m_software_name = std::move(new_software); } -- cgit v1.2.3