bool emu_options::parse_slot_devices(int argc, char *argv[], std::string &error_string, const char *name, const char *value, const software_part *swpart) { // an initial parse to capture the initial set of values bool result; core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); // keep adding slot options until we stop seeing new stuff while (add_slot_options(swpart)) core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); // add device options and reparse add_device_options(); if (name != nullptr && exists(name)) set_value(name, value, OPTION_PRIORITY_SUBCMD, error_string); core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); int num; do { num = options_count(); update_slot_options(swpart); result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); } while (num != options_count()); update_cached_options(); return result; }
bool emu_options::parse_slot_devices(int argc, char *argv[], std::string &error_string, const char *name, const char *value) { // an initial parse to capture the initial set of values bool result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); // keep adding slot options until we stop seeing new stuff bool isfirstpass = true; while (add_slot_options(isfirstpass)) { result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); isfirstpass = false; } // add device options and reparse add_device_options(true); if (name != NULL && exists(name)) set_value(name, value, OPTION_PRIORITY_CMDLINE, error_string); result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); int num = 0; do { num = options_count(); update_slot_options(); result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); } while (num != options_count()); update_cached_options(); return result; }
bool emu_options::parse_command_line(int argc, char *argv[], std::string &error_string) { // parse as normal core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); bool result = parse_slot_devices(argc, argv, error_string); update_cached_options(); return result; }
void emu_options::parse_standard_inis(std::string &error_string, const game_driver *driver) { // start with an empty string error_string.clear(); // parse the INI file defined by the platform (e.g., "mame.ini") // we do this twice so that the first file can change the INI path parse_one_ini(emulator_info::get_configname(), OPTION_PRIORITY_MAME_INI); parse_one_ini(emulator_info::get_configname(), OPTION_PRIORITY_MAME_INI, &error_string); // debug mode: parse "debug.ini" as well if (debug()) parse_one_ini("debug", OPTION_PRIORITY_DEBUG_INI, &error_string); // if we have a valid system driver, parse system-specific INI files const game_driver *cursystem = (driver == nullptr) ? system() : driver; if (cursystem == nullptr) return; // parse "vertical.ini" or "horizont.ini" if (cursystem->flags & ORIENTATION_SWAP_XY) parse_one_ini("vertical", OPTION_PRIORITY_ORIENTATION_INI, &error_string); else parse_one_ini("horizont", OPTION_PRIORITY_ORIENTATION_INI, &error_string); if (cursystem->flags & MACHINE_TYPE_ARCADE) parse_one_ini("arcade", OPTION_PRIORITY_SYSTYPE_INI, &error_string); else if (cursystem->flags & MACHINE_TYPE_CONSOLE) parse_one_ini("console", OPTION_PRIORITY_SYSTYPE_INI, &error_string); else if (cursystem->flags & MACHINE_TYPE_COMPUTER) parse_one_ini("computer", OPTION_PRIORITY_SYSTYPE_INI, &error_string); else if (cursystem->flags & MACHINE_TYPE_OTHER) parse_one_ini("othersys", OPTION_PRIORITY_SYSTYPE_INI, &error_string); machine_config config(*cursystem, *this); screen_device_iterator iter(config.root_device()); for (const screen_device *device = iter.first(); device != nullptr; device = iter.next()) { // parse "raster.ini" for raster games if (device->screen_type() == SCREEN_TYPE_RASTER) { parse_one_ini("raster", OPTION_PRIORITY_SCREEN_INI, &error_string); break; } // parse "vector.ini" for vector games if (device->screen_type() == SCREEN_TYPE_VECTOR) { parse_one_ini("vector", OPTION_PRIORITY_SCREEN_INI, &error_string); break; } // parse "lcd.ini" for lcd games if (device->screen_type() == SCREEN_TYPE_LCD) { parse_one_ini("lcd", OPTION_PRIORITY_SCREEN_INI, &error_string); break; } } // next parse "source/<sourcefile>.ini"; if that doesn't exist, try <sourcefile>.ini std::string sourcename = core_filename_extract_base(cursystem->source_file, true).insert(0, "source" PATH_SEPARATOR); if (!parse_one_ini(sourcename.c_str(), OPTION_PRIORITY_SOURCE_INI, &error_string)) { sourcename = core_filename_extract_base(cursystem->source_file, true); parse_one_ini(sourcename.c_str(), OPTION_PRIORITY_SOURCE_INI, &error_string); } // then parse the grandparent, parent, and system-specific INIs int parent = driver_list::clone(*cursystem); int gparent = (parent != -1) ? driver_list::clone(parent) : -1; if (gparent != -1) parse_one_ini(driver_list::driver(gparent).name, OPTION_PRIORITY_GPARENT_INI, &error_string); if (parent != -1) parse_one_ini(driver_list::driver(parent).name, OPTION_PRIORITY_PARENT_INI, &error_string); parse_one_ini(cursystem->name, OPTION_PRIORITY_DRIVER_INI, &error_string); // Re-evaluate slot options after loading ini files update_slot_options(); update_cached_options(); }