diff options
Diffstat (limited to 'src/emu/emuopts.cpp')
-rw-r--r-- | src/emu/emuopts.cpp | 57 |
1 files changed, 34 insertions, 23 deletions
diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index dfca2bde492..b3de757e453 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -93,6 +93,7 @@ const options_entry emu_options::s_option_entries[] = { OPTION_KEEPASPECT ";ka", "1", OPTION_BOOLEAN, "constrain to the proper aspect ratio" }, { OPTION_UNEVENSTRETCH ";ues", "1", OPTION_BOOLEAN, "allow non-integer stretch factors" }, { OPTION_UNEVENSTRETCHX ";uesx", "0", OPTION_BOOLEAN, "allow non-integer stretch factors only on horizontal axis"}, + { OPTION_INTOVERSCAN ";ios", "0", OPTION_BOOLEAN, "allow overscan on integer scaled targets"}, { OPTION_INTSCALEX ";sx", "0", OPTION_INTEGER, "set horizontal integer scale factor."}, { OPTION_INTSCALEY ";sy", "0", OPTION_INTEGER, "set vertical integer scale."}, @@ -255,24 +256,16 @@ bool emu_options::add_slot_options(const software_part *swpart) if (slot->fixed()) continue; - // first device? add the header as to be pretty - if (m_slot_options++ == 0) - add_entry(nullptr, "SLOT DEVICES", OPTION_HEADER | OPTION_FLAG_DEVICE); - // retrieve info about the device instance const char *name = slot->device().tag() + 1; if (!exists(name)) { + // first device? add the header as to be pretty + if (m_slot_options++ == 0) + add_entry(nullptr, "SLOT DEVICES", OPTION_HEADER | OPTION_FLAG_DEVICE); + // add the option - UINT32 flags = OPTION_STRING | OPTION_FLAG_DEVICE; - const char *defvalue = slot->default_option(); - if (defvalue != nullptr) - { - const device_slot_option *option = slot->option(defvalue); - if (option != nullptr && !option->selectable()) - flags |= OPTION_FLAG_INTERNAL; - } - add_entry(name, nullptr, flags, defvalue, true); + add_entry(name, nullptr, OPTION_STRING | OPTION_FLAG_DEVICE, slot->default_option(), true); } // allow software lists to supply their own defaults @@ -314,12 +307,21 @@ void emu_options::update_slot_options(const software_part *swpart) if (exists(name) && !slot->option_list().empty()) { std::string defvalue = slot->get_default_card_software(); - if (defvalue.length() > 0) + if (defvalue.empty()) { - set_default_value(name, defvalue.c_str()); - const device_slot_option *option = slot->option(defvalue.c_str()); - set_flag(name, ~OPTION_FLAG_INTERNAL, (option != nullptr && !option->selectable()) ? OPTION_FLAG_INTERNAL : 0); + // keep any non-default setting + if (priority(name) > OPTION_PRIORITY_DEFAULT) + continue; + + // reinstate the actual default value as configured + if (slot->default_option() != nullptr) + defvalue.assign(slot->default_option()); } + + // set the value and hide the option if not selectable + set_default_value(name, defvalue.c_str()); + const device_slot_option *option = slot->option(defvalue.c_str()); + set_flag(name, ~OPTION_FLAG_INTERNAL, (option != nullptr && !option->selectable()) ? OPTION_FLAG_INTERNAL : 0); } } while (add_slot_options(swpart)) { } @@ -344,11 +346,10 @@ void emu_options::add_device_options() image_interface_iterator iter(config.root_device()); for (const device_image_interface *image = iter.first(); image != nullptr; image = iter.next()) { - // first device? add the header as to be pretty - if (m_device_options++ == 0) - add_entry(nullptr, "IMAGE DEVICES", OPTION_HEADER | OPTION_FLAG_DEVICE); + if (!image->user_loadable()) + continue; - // retrieve info about the device instance + // retrieve info about the device instance std::ostringstream option_name; util::stream_format(option_name, "%s;%s", image->instance_name(), image->brief_instance_name()); if (strcmp(image->device_typename(image->image_type()), image->instance_name()) == 0) @@ -356,7 +357,14 @@ void emu_options::add_device_options() // add the option if (!exists(image->instance_name())) + { + // first device? add the header as to be pretty + if (m_device_options++ == 0) + add_entry(nullptr, "IMAGE DEVICES", OPTION_HEADER | OPTION_FLAG_DEVICE); + + // add the option add_entry(option_name.str().c_str(), nullptr, OPTION_STRING | OPTION_FLAG_DEVICE, nullptr, true); + } } } @@ -401,12 +409,10 @@ bool emu_options::parse_slot_devices(int argc, char *argv[], std::string &error_ core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); // keep adding slot options until we stop seeing new stuff - m_slot_options = 0; while (add_slot_options(swpart)) core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); // add device options and reparse - m_device_options = 0; add_device_options(); if (name != nullptr && exists(name)) set_value(name, value, OPTION_PRIORITY_SUBCMD, error_string); @@ -560,6 +566,11 @@ void emu_options::set_system_name(const char *name) // remove any existing device options remove_device_options(); } + else + { + // revert device options set for the old software + revert(OPTION_PRIORITY_SUBCMD, OPTION_PRIORITY_SUBCMD); + } // get the new system const game_driver *cursystem = system(); |