diff options
Diffstat (limited to 'src/emu/validity.c')
-rw-r--r-- | src/emu/validity.c | 74 |
1 files changed, 36 insertions, 38 deletions
diff --git a/src/emu/validity.c b/src/emu/validity.c index e15082da3c4..2e0fbbb84d1 100644 --- a/src/emu/validity.c +++ b/src/emu/validity.c @@ -314,12 +314,11 @@ static bool validate_inlines(void) information -------------------------------------------------*/ -static bool validate_driver(const machine_config &config, game_driver_map &names, game_driver_map &descriptions) +static bool validate_driver(driver_enumerator &drivlist, game_driver_map &names, game_driver_map &descriptions) { - const game_driver &driver = config.gamedrv(); - const game_driver *clone_of; + const game_driver &driver = drivlist.driver(); + const machine_config &config = drivlist.config(); const char *compatible_with; - const game_driver *other_drv; bool error = FALSE, is_clone; const char *s; @@ -343,27 +342,27 @@ static bool validate_driver(const machine_config &config, game_driver_map &names /* determine the clone */ is_clone = (strcmp(driver.parent, "0") != 0); - clone_of = driver_get_clone(&driver); - if (clone_of && (clone_of->flags & GAME_IS_BIOS_ROOT)) + int clone_of = drivlist.clone(driver); + if (clone_of != -1 && (drivlist.driver(clone_of).flags & GAME_IS_BIOS_ROOT)) is_clone = false; /* if we have at least 100 drivers, validate the clone */ /* (100 is arbitrary, but tries to avoid tiny.mak dependencies) */ - if (driver_list_get_count(drivers) > 100 && !clone_of && is_clone) + if (driver_list::total() > 100 && clone_of == -1 && is_clone) { mame_printf_error("%s: %s is a non-existant clone\n", driver.source_file, driver.parent); error = true; } /* look for recursive cloning */ - if (clone_of == &driver) + if (clone_of != -1 && &drivlist.driver(clone_of) == &driver) { mame_printf_error("%s: %s is set as a clone of itself\n", driver.source_file, driver.name); error = true; } /* look for clones that are too deep */ - if (clone_of != NULL && (clone_of = driver_get_clone(clone_of)) != NULL && (clone_of->flags & GAME_IS_BIOS_ROOT) == 0) + if (clone_of != -1 && (clone_of = drivlist.non_bios_clone(clone_of)) != -1) { mame_printf_error("%s: %s is a clone of a clone\n", driver.source_file, driver.name); error = true; @@ -392,23 +391,23 @@ static bool validate_driver(const machine_config &config, game_driver_map &names compatible_with = NULL; /* check for this driver being compatible with a non-existant driver */ - if ((compatible_with != NULL) && (driver_get_name(driver.compatible_with) == NULL)) + if ((compatible_with != NULL) && (drivlist.find(driver.compatible_with) == -1)) { mame_printf_error("%s: is compatible with %s, which is not in drivers[]\n", driver.name, driver.compatible_with); error = true; } /* check for clone_of and compatible_with being specified at the same time */ - if ((driver_get_clone(&driver) != NULL) && (compatible_with != NULL)) + if ((drivlist.clone(driver) != -1) && (compatible_with != NULL)) { mame_printf_error("%s: both compatible_with and clone_of are specified\n", driver.name); error = true; } /* find any recursive dependencies on the current driver */ - for (other_drv = driver_get_compatible(&driver); other_drv != NULL; other_drv = driver_get_compatible(other_drv)) + for (int other_drv = drivlist.compatible_with(driver); other_drv != -1; other_drv = drivlist.compatible_with(other_drv)) { - if (&driver == other_drv) + if (&driver == &drivlist.driver(other_drv)) { mame_printf_error("%s: recursive compatibility\n", driver.name); error = true; @@ -432,9 +431,10 @@ static bool validate_driver(const machine_config &config, game_driver_map &names validate_roms - validate ROM definitions -------------------------------------------------*/ -static bool validate_roms(const machine_config &config, region_array *rgninfo, game_driver_map &roms) +static bool validate_roms(driver_enumerator &drivlist, region_array *rgninfo, game_driver_map &roms) { - const game_driver &driver = config.gamedrv(); + const game_driver &driver = drivlist.driver(); + const machine_config &config = drivlist.config(); int bios_flags = 0, last_bios = 0; const char *last_rgnname = "???"; const char *last_name = "???"; @@ -579,9 +579,10 @@ static bool validate_roms(const machine_config &config, region_array *rgninfo, g configurations -------------------------------------------------*/ -static bool validate_display(const machine_config &config) +static bool validate_display(driver_enumerator &drivlist) { - const game_driver &driver = config.gamedrv(); + const game_driver &driver = drivlist.driver(); + const machine_config &config = drivlist.config(); bool palette_modes = false; bool error = false; @@ -605,9 +606,10 @@ static bool validate_display(const machine_config &config) configuration -------------------------------------------------*/ -static bool validate_gfx(const machine_config &config, region_array *rgninfo) +static bool validate_gfx(driver_enumerator &drivlist, region_array *rgninfo) { - const game_driver &driver = config.gamedrv(); + const game_driver &driver = drivlist.driver(); + const machine_config &config = drivlist.config(); bool error = false; int gfxnum; @@ -939,12 +941,13 @@ static void validate_dip_settings(const input_field_config *field, const game_dr validate_inputs - validate input configuration -------------------------------------------------*/ -static bool validate_inputs(const machine_config &config, int_map &defstr_map, ioport_list &portlist) +static bool validate_inputs(driver_enumerator &drivlist, int_map &defstr_map, ioport_list &portlist) { const input_port_config *scanport; const input_port_config *port; const input_field_config *field; - const game_driver &driver = config.gamedrv(); + const game_driver &driver = drivlist.driver(); + const machine_config &config = drivlist.config(); int empty_string_found = FALSE; char errorbuf[1024]; bool error = false; @@ -1088,10 +1091,11 @@ static bool validate_inputs(const machine_config &config, int_map &defstr_map, i checks -------------------------------------------------*/ -static bool validate_devices(const machine_config &config, const ioport_list &portlist, region_array *rgninfo) +static bool validate_devices(driver_enumerator &drivlist, const ioport_list &portlist, region_array *rgninfo) { bool error = false; - const game_driver &driver = config.gamedrv(); + const game_driver &driver = drivlist.driver(); + const machine_config &config = drivlist.config(); for (const device_config *devconfig = config.m_devicelist.first(); devconfig != NULL; devconfig = devconfig->next()) { @@ -1126,7 +1130,6 @@ static bool validate_devices(const machine_config &config, const ioport_list &po void validate_drivers(emu_options &options, const game_driver *curdriver) { osd_ticks_t prep = 0; - osd_ticks_t expansion = 0; osd_ticks_t driver_checks = 0; osd_ticks_t rom_checks = 0; osd_ticks_t gfx_checks = 0; @@ -1186,9 +1189,10 @@ void validate_drivers(emu_options &options, const game_driver *curdriver) prep += get_profile_ticks(); /* iterate over all drivers */ - for (int drivnum = 0; drivers[drivnum]; drivnum++) + driver_enumerator drivlist(options); + while (drivlist.next()) { - const game_driver &driver = *drivers[drivnum]; + const game_driver &driver = drivlist.driver(); ioport_list portlist; region_array rgninfo; @@ -1198,39 +1202,34 @@ void validate_drivers(emu_options &options, const game_driver *curdriver) try { - /* expand the machine driver */ - expansion -= get_profile_ticks(); - machine_config config(driver, options); - expansion += get_profile_ticks(); - /* validate the driver entry */ driver_checks -= get_profile_ticks(); - error = validate_driver(config, names, descriptions) || error; + error = validate_driver(drivlist, names, descriptions) || error; driver_checks += get_profile_ticks(); /* validate the ROM information */ rom_checks -= get_profile_ticks(); - error = validate_roms(config, &rgninfo, roms) || error; + error = validate_roms(drivlist, &rgninfo, roms) || error; rom_checks += get_profile_ticks(); /* validate input ports */ input_checks -= get_profile_ticks(); - error = validate_inputs(config, defstr, portlist) || error; + error = validate_inputs(drivlist, defstr, portlist) || error; input_checks += get_profile_ticks(); /* validate the display */ display_checks -= get_profile_ticks(); - error = validate_display(config) || error; + error = validate_display(drivlist) || error; display_checks += get_profile_ticks(); /* validate the graphics decoding */ gfx_checks -= get_profile_ticks(); - error = validate_gfx(config, &rgninfo) || error; + error = validate_gfx(drivlist, &rgninfo) || error; gfx_checks += get_profile_ticks(); /* validate devices */ device_checks -= get_profile_ticks(); - error = validate_devices(config, portlist, &rgninfo) || error; + error = validate_devices(drivlist, portlist, &rgninfo) || error; device_checks += get_profile_ticks(); } catch (emu_fatalerror &err) @@ -1241,7 +1240,6 @@ void validate_drivers(emu_options &options, const game_driver *curdriver) #if (REPORT_TIMES) mame_printf_info("Prep: %8dm\n", (int)(prep / 1000000)); - mame_printf_info("Expansion: %8dm\n", (int)(expansion / 1000000)); mame_printf_info("Driver: %8dm\n", (int)(driver_checks / 1000000)); mame_printf_info("ROM: %8dm\n", (int)(rom_checks / 1000000)); mame_printf_info("CPU: %8dm\n", (int)(cpu_checks / 1000000)); |