From e04a652a029ee15ee6c7cd5ed8893fb78ce8285c Mon Sep 17 00:00:00 2001 From: AJR Date: Mon, 19 Dec 2022 20:48:21 -0500 Subject: emuopts.cpp: Work around reevaluate_default_card_software trying to purge XXX_default values; reword some comments --- src/emu/emuopts.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index f5efc348222..3defd33d0bb 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -615,8 +615,8 @@ bool emu_options::add_and_remove_slot_options() //------------------------------------------------- -// add_and_remove_slot_options - add any missing -// and/or purge extraneous slot options +// add_and_remove_image_options - add any missing +// and/or purge extraneous image options //------------------------------------------------- bool emu_options::add_and_remove_image_options() @@ -719,7 +719,7 @@ bool emu_options::add_and_remove_image_options() //------------------------------------------------- // reevaluate_default_card_software - based on recent -// changes in what images are mounted, give drivers +// changes in what images are mounted, give devices // a chance to specify new default slot options //------------------------------------------------- @@ -758,6 +758,16 @@ void emu_options::reevaluate_default_card_software() std::string default_card_software = get_default_card_software(slot); if (slot_opt.default_card_software() != default_card_software) { + // HACK: prevent option values set from "XXX_default" in software list entries + // from getting cleared out, using crude heuristic to distinguish these from + // values representing cartridge types and such + if (default_card_software.empty()) + { + auto *opt = slot.option(slot_opt.default_card_software().c_str()); + if (opt && opt->selectable()) + continue; + } + slot_opt.set_default_card_software(std::move(default_card_software)); // calling set_default_card_software() can cause a cascade of slot/image -- cgit v1.2.3