mirror of
https://github.com/holub/mame
synced 2025-06-06 12:53:46 +03:00
emuopts.cpp: Correction for 42adf5d51d
This commit is contained in:
parent
42adf5d51d
commit
742ef9cdd6
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user