static int count_roms(const struct RomModule *romp) { const struct RomModule *region, *rom; int count = 0; /* determine the correct biosset to load based on options.bios string */ int this_bios = determine_bios_rom(Machine->gamedrv->bios); /* loop over regions, then over files */ for (region = romp; region; region = rom_next_region(region)) for (rom = rom_first_file(region); rom; rom = rom_next_file(rom)) if (!ROM_GETBIOSFLAGS(romp) || (ROM_GETBIOSFLAGS(romp) == (this_bios+1))) /* alternate bios sets */ count++; /* return the total count */ return count; }
void rom_load_manager::count_roms() { const rom_entry *region, *rom; /* start with 0 */ m_romstotal = 0; m_romstotalsize = 0; /* loop over regions, then over files */ for (device_t &device : device_iterator(machine().config().root_device())) for (region = rom_first_region(device); region != nullptr; region = rom_next_region(region)) for (rom = rom_first_file(region); rom != nullptr; rom = rom_next_file(rom)) if (ROM_GETBIOSFLAGS(rom) == 0 || ROM_GETBIOSFLAGS(rom) == device.system_bios()) { m_romstotal++; m_romstotalsize += rom_file_size(rom); } }
static void count_roms(romload_private *romdata) { const rom_entry *region, *rom; /* start with 0 */ romdata->romstotal = 0; romdata->romstotalsize = 0; /* loop over regions, then over files */ device_iterator deviter(romdata->machine().config().root_device()); for (device_t *device = deviter.first(); device != NULL; device = deviter.next()) for (region = rom_first_region(*device); region != NULL; region = rom_next_region(region)) for (rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom)) if (ROM_GETBIOSFLAGS(rom) == 0 || ROM_GETBIOSFLAGS(rom) == device->system_bios()) { romdata->romstotal++; romdata->romstotalsize += rom_file_size(rom); } }
static void determine_bios_rom(rom_load_data *romdata) { const char *specbios = romdata->machine().options().bios(); const char *defaultname = NULL; const rom_entry *rom; int default_no = 1; int bios_count = 0; device_t &rootdevice = romdata->machine().config().root_device(); rootdevice.set_system_bios(0); /* first determine the default BIOS name */ for (rom = rootdevice.rom_region(); !ROMENTRY_ISEND(rom); rom++) if (ROMENTRY_ISDEFAULT_BIOS(rom)) defaultname = ROM_GETNAME(rom); /* look for a BIOS with a matching name */ for (rom = rootdevice.rom_region(); !ROMENTRY_ISEND(rom); rom++) if (ROMENTRY_ISSYSTEM_BIOS(rom)) { const char *biosname = ROM_GETNAME(rom); int bios_flags = ROM_GETBIOSFLAGS(rom); char bios_number[20]; /* Allow '-bios n' to still be used */ sprintf(bios_number, "%d", bios_flags - 1); if (mame_stricmp(bios_number, specbios) == 0 || mame_stricmp(biosname, specbios) == 0) rootdevice.set_system_bios(bios_flags); if (defaultname != NULL && mame_stricmp(biosname, defaultname) == 0) default_no = bios_flags; bios_count++; } /* if none found, use the default */ if (rootdevice.system_bios() == 0 && bios_count > 0) { /* if we got neither an empty string nor 'default' then warn the user */ if (specbios[0] != 0 && strcmp(specbios, "default") != 0 && romdata != NULL) { romdata->errorstring.catprintf("%s: invalid bios\n", specbios); romdata->warnings++; } /* set to default */ rootdevice.set_system_bios(default_no); } rootdevice.set_default_bios(default_no); LOG(("Using System BIOS: %d\n", rootdevice.system_bios())); }
void rom_load_manager::determine_bios_rom(device_t *device, const char *specbios) { const char *defaultname = nullptr; const rom_entry *rom; int default_no = 1; int bios_count = 0; device->set_system_bios(0); /* first determine the default BIOS name */ for (rom = device->rom_region(); !ROMENTRY_ISEND(rom); rom++) if (ROMENTRY_ISDEFAULT_BIOS(rom)) defaultname = ROM_GETNAME(rom); /* look for a BIOS with a matching name */ for (rom = device->rom_region(); !ROMENTRY_ISEND(rom); rom++) if (ROMENTRY_ISSYSTEM_BIOS(rom)) { const char *biosname = ROM_GETNAME(rom); int bios_flags = ROM_GETBIOSFLAGS(rom); char bios_number[20]; /* Allow '-bios n' to still be used */ sprintf(bios_number, "%d", bios_flags - 1); if (core_stricmp(bios_number, specbios) == 0 || core_stricmp(biosname, specbios) == 0) device->set_system_bios(bios_flags); if (defaultname != nullptr && core_stricmp(biosname, defaultname) == 0) default_no = bios_flags; bios_count++; } /* if none found, use the default */ if (device->system_bios() == 0 && bios_count > 0) { /* if we got neither an empty string nor 'default' then warn the user */ if (specbios[0] != 0 && strcmp(specbios, "default") != 0) { strcatprintf(m_errorstring, "%s: invalid bios\n", specbios); m_errors++; } /* set to default */ device->set_system_bios(default_no); } device->set_default_bios(default_no); LOG(("For \"%s\" using System BIOS: %d\n", device->tag().c_str(), device->system_bios())); }
void info_xml_creator::output_bios() { // skip if no ROMs if (m_drivlist.driver().rom == NULL) return; // iterate over ROM entries and look for BIOSes for (const rom_entry *rom = m_drivlist.driver().rom; !ROMENTRY_ISEND(rom); rom++) if (ROMENTRY_ISSYSTEM_BIOS(rom)) { // output extracted name and descriptions fprintf(m_output, "\t\t<biosset"); fprintf(m_output, " name=\"%s\"", xml_normalize_string(ROM_GETNAME(rom))); fprintf(m_output, " description=\"%s\"", xml_normalize_string(ROM_GETHASHDATA(rom))); if (ROM_GETBIOSFLAGS(rom) == 1) fprintf(m_output, " default=\"yes\""); fprintf(m_output, "/>\n"); } }
void ui_menu_bios_selection::populate() { /* cycle through all devices for this system */ device_iterator deviter(machine().root_device()); for (device_t *device = deviter.first(); device != nullptr; device = deviter.next()) { if (device->rom_region()) { const char *val = "default"; for (const rom_entry *rom = device->rom_region(); !ROMENTRY_ISEND(rom); rom++) { if (ROMENTRY_ISSYSTEM_BIOS(rom) && ROM_GETBIOSFLAGS(rom)==device->system_bios()) { val = ROM_GETHASHDATA(rom); } } item_append(strcmp(device->tag(),":")==0 ? "driver" : device->tag()+1, val, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)device); } } item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); item_append(_("Reset"), nullptr, 0, (void *)1); }
void ui_menu_bios_selection::populate() { /* cycle through all devices for this system */ for (device_t &device : device_iterator(machine().root_device())) { if (device.rom_region()) { const char *val = "default"; for (const rom_entry *rom = device.rom_region(); !ROMENTRY_ISEND(rom); rom++) { if (ROMENTRY_ISSYSTEM_BIOS(rom) && ROM_GETBIOSFLAGS(rom) == device.system_bios()) { val = ROM_GETHASHDATA(rom); } } item_append(device.owner() == nullptr ? "driver" : device.tag()+1, val, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)&device); } } item_append(ui_menu_item_type::SEPARATOR); item_append(_("Reset"), nullptr, 0, (void *)1); }
void ui_menu_machine_configure::setup_bios() { if (m_drv->rom == nullptr) return; std::string specbios(m_opts.bios()); std::string default_name; for (const rom_entry *rom = m_drv->rom; !ROMENTRY_ISEND(rom); ++rom) if (ROMENTRY_ISDEFAULT_BIOS(rom)) default_name = ROM_GETNAME(rom); int bios_count = 0; for (const rom_entry *rom = m_drv->rom; !ROMENTRY_ISEND(rom); ++rom) { if (ROMENTRY_ISSYSTEM_BIOS(rom)) { std::string name(ROM_GETHASHDATA(rom)); std::string biosname(ROM_GETNAME(rom)); int bios_flags = ROM_GETBIOSFLAGS(rom); std::string bios_number = std::to_string(bios_flags - 1); // check biosnumber and name if (bios_number == specbios || biosname == specbios) m_curbios = bios_count; if (biosname == default_name) { name.append(_(" (default)")); if (specbios == "default") m_curbios = bios_count; } m_bios.emplace_back(name, bios_flags - 1); bios_count++; } } }
static void print_game_bios(FILE *out, const game_driver *game) { const rom_entry *rom; /* skip if no ROMs */ if (game->rom == NULL) return; /* iterate over ROM entries and look for BIOSes */ for (rom = game->rom; !ROMENTRY_ISEND(rom); rom++) if (ROMENTRY_ISSYSTEM_BIOS(rom)) { const char *name = ROM_GETNAME(rom); const char *description = ROM_GETHASHDATA(rom); /* output extracted name and descriptions */ fprintf(out, "\t\t<biosset"); fprintf(out, " name=\"%s\"", xml_normalize_string(name)); fprintf(out, " description=\"%s\"", xml_normalize_string(description)); if (ROM_GETBIOSFLAGS(rom) == 1) fprintf(out, " default=\"yes\""); fprintf(out, "/>\n"); } }
static void process_rom_entries(romload_private *romdata, const char *regiontag, const rom_entry *parent_region, const rom_entry *romp, device_t *device, bool from_list) { UINT32 lastflags = 0; /* loop until we hit the end of this region */ while (!ROMENTRY_ISREGIONEND(romp)) { /* if this is a continue entry, it's invalid */ if (ROMENTRY_ISCONTINUE(romp)) fatalerror("Error in RomModule definition: ROM_CONTINUE not preceded by ROM_LOAD\n"); /* if this is an ignore entry, it's invalid */ if (ROMENTRY_ISIGNORE(romp)) fatalerror("Error in RomModule definition: ROM_IGNORE not preceded by ROM_LOAD\n"); /* if this is a reload entry, it's invalid */ if (ROMENTRY_ISRELOAD(romp)) fatalerror("Error in RomModule definition: ROM_RELOAD not preceded by ROM_LOAD\n"); /* handle fills */ if (ROMENTRY_ISFILL(romp)) fill_rom_data(romdata, romp++); /* handle copies */ else if (ROMENTRY_ISCOPY(romp)) copy_rom_data(romdata, romp++); /* handle files */ else if (ROMENTRY_ISFILE(romp)) { int irrelevantbios = (ROM_GETBIOSFLAGS(romp) != 0 && ROM_GETBIOSFLAGS(romp) != device->system_bios()); const rom_entry *baserom = romp; int explength = 0; /* open the file if it is a non-BIOS or matches the current BIOS */ LOG(("Opening ROM file: %s\n", ROM_GETNAME(romp))); astring tried_file_names; if (!irrelevantbios && !open_rom_file(romdata, regiontag, romp, tried_file_names, from_list)) handle_missing_file(romdata, romp, tried_file_names, CHDERR_NONE); /* loop until we run out of reloads */ do { /* loop until we run out of continues/ignores */ do { rom_entry modified_romp = *romp++; //int readresult; /* handle flag inheritance */ if (!ROM_INHERITSFLAGS(&modified_romp)) lastflags = modified_romp._flags; else modified_romp._flags = (modified_romp._flags & ~ROM_INHERITEDFLAGS) | lastflags; explength += ROM_GETLENGTH(&modified_romp); /* attempt to read using the modified entry */ if (!ROMENTRY_ISIGNORE(&modified_romp) && !irrelevantbios) /*readresult = */read_rom_data(romdata, parent_region, &modified_romp); } while (ROMENTRY_ISCONTINUE(romp) || ROMENTRY_ISIGNORE(romp)); /* if this was the first use of this file, verify the length and CRC */ if (baserom) { LOG(("Verifying length (%X) and checksums\n", explength)); verify_length_and_hash(romdata, ROM_GETNAME(baserom), explength, hash_collection(ROM_GETHASHDATA(baserom))); LOG(("Verify finished\n")); } /* reseek to the start and clear the baserom so we don't reverify */ if (romdata->file != NULL) romdata->file->seek(0, SEEK_SET); baserom = NULL; explength = 0; } while (ROMENTRY_ISRELOAD(romp)); /* close the file */ if (romdata->file != NULL) { LOG(("Closing ROM file\n")); global_free(romdata->file); romdata->file = NULL; } } else { romp++; /* something else; skip */ } } }
static void print_game_rom(FILE *out, const game_driver *game, const machine_config *config) { const game_driver *clone_of = driver_get_clone(game); int rom_type; machine_config *pconfig = (clone_of != NULL) ? machine_config_alloc(clone_of->machine_config) : NULL; /* iterate over 3 different ROM "types": BIOS, ROMs, DISKs */ for (rom_type = 0; rom_type < 3; rom_type++) { const rom_source *source; const rom_entry *region; /* iterate over ROM sources: first the game, then any devices */ for (source = rom_first_source(game, config); source != NULL; source = rom_next_source(game, config, source)) for (region = rom_first_region(game, source); region != NULL; region = rom_next_region(region)) { int is_disk = ROMREGION_ISDISKDATA(region); const rom_entry *rom; /* disk regions only work for disks */ if ((is_disk && rom_type != 2) || (!is_disk && rom_type == 2)) continue; /* iterate through ROM entries */ for (rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom)) { int is_bios = ROM_GETBIOSFLAGS(rom); const char *name = ROM_GETNAME(rom); int offset = ROM_GETOFFSET(rom); const rom_entry *parent_rom = NULL; char bios_name[100]; /* BIOS ROMs only apply to bioses */ if ((is_bios && rom_type != 0) || (!is_bios && rom_type == 0)) continue; /* if we have a valid ROM and we are a clone, see if we can find the parent ROM */ if (!ROM_NOGOODDUMP(rom) && clone_of != NULL) { const rom_source *psource; const rom_entry *pregion, *prom; /* scan the clone_of ROM for a matching ROM entry */ for (psource = rom_first_source(clone_of, pconfig); psource != NULL; psource = rom_next_source(clone_of, pconfig, psource)) for (pregion = rom_first_region(clone_of, psource); pregion != NULL; pregion = rom_next_region(pregion)) for (prom = rom_first_file(pregion); prom != NULL; prom = rom_next_file(prom)) if (hash_data_is_equal(ROM_GETHASHDATA(rom), ROM_GETHASHDATA(prom), 0)) { parent_rom = prom; break; } } /* scan for a BIOS name */ bios_name[0] = 0; if (!is_disk && is_bios) { const rom_entry *brom; /* scan backwards through the ROM entries */ for (brom = rom - 1; brom != game->rom; brom--) if (ROMENTRY_ISSYSTEM_BIOS(brom)) { strcpy(bios_name, ROM_GETNAME(brom)); break; } } /* opening tag */ if (!is_disk) fprintf(out, "\t\t<rom"); else fprintf(out, "\t\t<disk"); /* add name, merge, bios, and size tags */ if (name != NULL && name[0] != 0) fprintf(out, " name=\"%s\"", xml_normalize_string(name)); if (parent_rom != NULL) fprintf(out, " merge=\"%s\"", xml_normalize_string(ROM_GETNAME(parent_rom))); if (bios_name[0] != 0) fprintf(out, " bios=\"%s\"", xml_normalize_string(bios_name)); if (!is_disk) fprintf(out, " size=\"%d\"", rom_file_size(rom)); /* dump checksum information only if there is a known dump */ if (!hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_NO_DUMP)) { char checksum[HASH_BUF_SIZE]; int hashtype; /* iterate over hash function types and print out their values */ for (hashtype = 0; hashtype < HASH_NUM_FUNCTIONS; hashtype++) if (hash_data_extract_printable_checksum(ROM_GETHASHDATA(rom), 1 << hashtype, checksum)) fprintf(out, " %s=\"%s\"", hash_function_name(1 << hashtype), checksum); } /* append a region name */ fprintf(out, " region=\"%s\"", ROMREGION_GETTAG(region)); /* add nodump/baddump flags */ if (hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_NO_DUMP)) fprintf(out, " status=\"nodump\""); if (hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_BAD_DUMP)) fprintf(out, " status=\"baddump\""); /* for non-disk entries, print offset */ if (!is_disk) fprintf(out, " offset=\"%x\"", offset); /* for disk entries, add the disk index */ else fprintf(out, " index=\"%x\"", DISK_GETINDEX(rom)); /* add optional flag */ if ((!is_disk && ROM_ISOPTIONAL(rom)) || (is_disk && DISK_ISOPTIONAL(rom))) fprintf(out, " optional=\"yes\""); fprintf(out, "/>\n"); } } } if (pconfig != NULL) machine_config_free(pconfig); }
void info_xml_creator::output_rom(device_t &device) { // iterate over 3 different ROM "types": BIOS, ROMs, DISKs for (int rom_type = 0; rom_type < 3; rom_type++) for (const rom_entry *region = rom_first_region(device); region != NULL; region = rom_next_region(region)) { bool is_disk = ROMREGION_ISDISKDATA(region); // disk regions only work for disks if ((is_disk && rom_type != 2) || (!is_disk && rom_type == 2)) continue; // iterate through ROM entries for (const rom_entry *rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom)) { bool is_bios = ROM_GETBIOSFLAGS(rom); const char *name = ROM_GETNAME(rom); int offset = ROM_GETOFFSET(rom); const char *merge_name = NULL; char bios_name[100]; // BIOS ROMs only apply to bioses if ((is_bios && rom_type != 0) || (!is_bios && rom_type == 0)) continue; // if we have a valid ROM and we are a clone, see if we can find the parent ROM hash_collection hashes(ROM_GETHASHDATA(rom)); if (!hashes.flag(hash_collection::FLAG_NO_DUMP)) merge_name = get_merge_name(hashes); if (&device != &m_drivlist.config().root_device()) merge_name = NULL; // scan for a BIOS name bios_name[0] = 0; if (!is_disk && is_bios) { // scan backwards through the ROM entries for (const rom_entry *brom = rom - 1; brom != m_drivlist.driver().rom; brom--) if (ROMENTRY_ISSYSTEM_BIOS(brom)) { strcpy(bios_name, ROM_GETNAME(brom)); break; } } astring output; // opening tag if (!is_disk) output.cat("\t\t<rom"); else output.cat("\t\t<disk"); // add name, merge, bios, and size tags */ if (name != NULL && name[0] != 0) output.catprintf(" name=\"%s\"", xml_normalize_string(name)); if (merge_name != NULL) output.catprintf(" merge=\"%s\"", xml_normalize_string(merge_name)); if (bios_name[0] != 0) output.catprintf(" bios=\"%s\"", xml_normalize_string(bios_name)); if (!is_disk) output.catprintf(" size=\"%d\"", rom_file_size(rom)); // dump checksum information only if there is a known dump if (!hashes.flag(hash_collection::FLAG_NO_DUMP)) { // iterate over hash function types and print m_output their values astring tempstr; output.catprintf(" %s", hashes.attribute_string(tempstr)); } else output.cat(" status=\"nodump\""); // append a region name output.catprintf(" region=\"%s\"", ROMREGION_GETTAG(region)); // for non-disk entries, print offset if (!is_disk) output.catprintf(" offset=\"%x\"", offset); // for disk entries, add the disk index else { output.catprintf(" index=\"%x\"", DISK_GETINDEX(rom)); output.catprintf(" writable=\"%s\"", DISK_ISREADONLY(rom) ? "no" : "yes"); } // add optional flag if (ROM_ISOPTIONAL(rom)) output.cat(" optional=\"yes\""); output.cat("/>\n"); fprintf(m_output, "%s", output.cstr()); } } }
static int process_rom_entries(struct rom_load_data *romdata, const struct RomModule *romp) { UINT32 lastflags = 0; /* loop until we hit the end of this region */ while (!ROMENTRY_ISREGIONEND(romp)) { /* if this is a continue entry, it's invalid */ if (ROMENTRY_ISCONTINUE(romp)) { printf("Error in RomModule definition: ROM_CONTINUE not preceded by ROM_LOAD\n"); goto fatalerror; } /* if this is a reload entry, it's invalid */ if (ROMENTRY_ISRELOAD(romp)) { printf("Error in RomModule definition: ROM_RELOAD not preceded by ROM_LOAD\n"); goto fatalerror; } /* handle fills */ if (ROMENTRY_ISFILL(romp)) { if (!fill_rom_data(romdata, romp++)) goto fatalerror; } /* handle copies */ else if (ROMENTRY_ISCOPY(romp)) { if (!copy_rom_data(romdata, romp++)) goto fatalerror; } /* handle files */ else if (ROMENTRY_ISFILE(romp)) { if (!ROM_GETBIOSFLAGS(romp) || (ROM_GETBIOSFLAGS(romp) == (system_bios+1))) /* alternate bios sets */ { const struct RomModule *baserom = romp; int explength = 0; /* open the file */ debugload("Opening ROM file: %s\n", ROM_GETNAME(romp)); if (!open_rom_file(romdata, romp)) handle_missing_file(romdata, romp); /* loop until we run out of reloads */ do { /* loop until we run out of continues */ do { struct RomModule modified_romp = *romp++; int readresult; /* handle flag inheritance */ if (!ROM_INHERITSFLAGS(&modified_romp)) lastflags = modified_romp._flags; else modified_romp._flags = (modified_romp._flags & ~ROM_INHERITEDFLAGS) | lastflags; explength += ROM_GETLENGTH(&modified_romp); /* attempt to read using the modified entry */ readresult = read_rom_data(romdata, &modified_romp); if (readresult == -1) goto fatalerror; } while (ROMENTRY_ISCONTINUE(romp)); /* if this was the first use of this file, verify the length and CRC */ if (baserom) { debugload("Verifying length (%X) and checksums\n", explength); verify_length_and_hash(romdata, ROM_GETNAME(baserom), explength, ROM_GETHASHDATA(baserom)); debugload("Verify finished\n"); } /* reseek to the start and clear the baserom so we don't reverify */ if (romdata->file) mame_fseek(romdata->file, 0, SEEK_SET); baserom = NULL; explength = 0; } while (ROMENTRY_ISRELOAD(romp)); /* close the file */ if (romdata->file) { debugload("Closing ROM file\n"); mame_fclose(romdata->file); romdata->file = NULL; } } else { romp++; /* skip over file */ } } } return 1; /* error case */ fatalerror: if (romdata->file) mame_fclose(romdata->file); romdata->file = NULL; return 0; }
static void print_game_rom(FILE* out, const game_driver* game) { const rom_entry *region, *rom, *chunk; const rom_entry *pregion, *prom, *fprom=NULL; const game_driver *clone_of; if (!game->rom) return; clone_of = driver_get_clone(game); for (region = rom_first_region(game); region; region = rom_next_region(region)) for (rom = rom_first_file(region); rom; rom = rom_next_file(rom)) { int offset, length, in_parent, is_disk, is_bios, found_bios, i; char name[100], bios_name[100]; strcpy(name,ROM_GETNAME(rom)); offset = ROM_GETOFFSET(rom); is_disk = ROMREGION_ISDISKDATA(region); is_bios = ROM_GETBIOSFLAGS(rom); in_parent = 0; length = 0; for (chunk = rom_first_chunk(rom); chunk; chunk = rom_next_chunk(chunk)) length += ROM_GETLENGTH(chunk); if (!ROM_NOGOODDUMP(rom) && clone_of) { fprom=NULL; for (pregion = rom_first_region(clone_of); pregion; pregion = rom_next_region(pregion)) for (prom = rom_first_file(pregion); prom; prom = rom_next_file(prom)) if (hash_data_is_equal(ROM_GETHASHDATA(rom), ROM_GETHASHDATA(prom), 0)) { if (!fprom || !strcmp(ROM_GETNAME(prom), name)) fprom=prom; in_parent = 1; } } found_bios = 0; if(!is_disk && is_bios && game->bios) { const bios_entry *thisbios = game->bios; /* Match against bios short names */ while(!found_bios && !BIOSENTRY_ISEND(thisbios) ) { if((is_bios-1) == thisbios->value) /* Note '-1' */ { strcpy(bios_name,thisbios->_name); found_bios = 1; } thisbios++; } } if (!is_disk) fprintf(out, "\t\t<rom"); else fprintf(out, "\t\t<disk"); if (*name) fprintf(out, " name=\"%s\"", normalize_string(name)); if (in_parent) fprintf(out, " merge=\"%s\"", normalize_string(ROM_GETNAME(fprom))); if (!is_disk && found_bios) fprintf(out, " bios=\"%s\"", normalize_string(bios_name)); if (!is_disk) fprintf(out, " size=\"%d\"", length); /* dump checksum information only if there is a known dump */ if (!hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_NO_DUMP)) { for (i=0;i<HASH_NUM_FUNCTIONS;i++) { int func = 1<<i; const char* func_name = hash_function_name(func); char checksum[1000]; if (hash_data_extract_printable_checksum(ROM_GETHASHDATA(rom), func, checksum)) { fprintf(out, " %s=\"%s\"", func_name, checksum); } } } switch (ROMREGION_GETTYPE(region)) { case REGION_CPU1: fprintf(out, " region=\"cpu1\""); break; case REGION_CPU2: fprintf(out, " region=\"cpu2\""); break; case REGION_CPU3: fprintf(out, " region=\"cpu3\""); break; case REGION_CPU4: fprintf(out, " region=\"cpu4\""); break; case REGION_CPU5: fprintf(out, " region=\"cpu5\""); break; case REGION_CPU6: fprintf(out, " region=\"cpu6\""); break; case REGION_CPU7: fprintf(out, " region=\"cpu7\""); break; case REGION_CPU8: fprintf(out, " region=\"cpu8\""); break; case REGION_GFX1: fprintf(out, " region=\"gfx1\""); break; case REGION_GFX2: fprintf(out, " region=\"gfx2\""); break; case REGION_GFX3: fprintf(out, " region=\"gfx3\""); break; case REGION_GFX4: fprintf(out, " region=\"gfx4\""); break; case REGION_GFX5: fprintf(out, " region=\"gfx5\""); break; case REGION_GFX6: fprintf(out, " region=\"gfx6\""); break; case REGION_GFX7: fprintf(out, " region=\"gfx7\""); break; case REGION_GFX8: fprintf(out, " region=\"gfx8\""); break; case REGION_PROMS: fprintf(out, " region=\"proms\""); break; case REGION_SOUND1: fprintf(out, " region=\"sound1\""); break; case REGION_SOUND2: fprintf(out, " region=\"sound2\""); break; case REGION_SOUND3: fprintf(out, " region=\"sound3\""); break; case REGION_SOUND4: fprintf(out, " region=\"sound4\""); break; case REGION_SOUND5: fprintf(out, " region=\"sound5\""); break; case REGION_SOUND6: fprintf(out, " region=\"sound6\""); break; case REGION_SOUND7: fprintf(out, " region=\"sound7\""); break; case REGION_SOUND8: fprintf(out, " region=\"sound8\""); break; case REGION_USER1: fprintf(out, " region=\"user1\""); break; case REGION_USER2: fprintf(out, " region=\"user2\""); break; case REGION_USER3: fprintf(out, " region=\"user3\""); break; case REGION_USER4: fprintf(out, " region=\"user4\""); break; case REGION_USER5: fprintf(out, " region=\"user5\""); break; case REGION_USER6: fprintf(out, " region=\"user6\""); break; case REGION_USER7: fprintf(out, " region=\"user7\""); break; case REGION_USER8: fprintf(out, " region=\"user8\""); break; case REGION_DISKS: fprintf(out, " region=\"disks\""); break; default: fprintf(out, " region=\"0x%x\"", ROMREGION_GETTYPE(region)); } if (hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_NO_DUMP)) fprintf(out, " status=\"nodump\""); if (hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_BAD_DUMP)) fprintf(out, " status=\"baddump\""); if (!is_disk) { if (ROMREGION_GETFLAGS(region) & ROMREGION_DISPOSE) fprintf(out, " dispose=\"yes\""); fprintf(out, " offset=\"%x\"", offset); fprintf(out, "/>\n"); } else { fprintf(out, " index=\"%x\"", DISK_GETINDEX(rom)); fprintf(out, "/>\n"); } } }