Added the ability for a ROMset to specify a default BIOS. Use

ROM_DEFAULT_BIOS("biosname") in the ROM definition. This can be
used to ensure a correct default BIOS for ROM versions that care.
This commit is contained in:
Aaron Giles 2008-12-31 02:58:30 +00:00
parent bd543ab54f
commit a748f24dae
2 changed files with 13 additions and 1 deletions

View File

@ -291,9 +291,16 @@ static void CLIB_DECL ATTR_PRINTF(1,2) debugload(const char *string, ...)
static int determine_bios_rom(rom_load_data *romdata, const rom_entry *romp) static int determine_bios_rom(rom_load_data *romdata, const rom_entry *romp)
{ {
const char *specbios = options_get_string(mame_options(), OPTION_BIOS); const char *specbios = options_get_string(mame_options(), OPTION_BIOS);
const char *defaultname = NULL;
const rom_entry *rom; const rom_entry *rom;
int default_no = 1;
int bios_count = 0; int bios_count = 0;
int bios_no = 0; int bios_no = 0;
/* first determine the default BIOS name */
for (rom = romp; !ROMENTRY_ISEND(rom); rom++)
if (ROMENTRY_ISDEFAULT_BIOS(rom))
defaultname = ROM_GETNAME(rom);
/* look for a BIOS with a matching name */ /* look for a BIOS with a matching name */
for (rom = romp; !ROMENTRY_ISEND(rom); rom++) for (rom = romp; !ROMENTRY_ISEND(rom); rom++)
@ -307,6 +314,8 @@ static int determine_bios_rom(rom_load_data *romdata, const rom_entry *romp)
sprintf(bios_number, "%d", bios_flags - 1); sprintf(bios_number, "%d", bios_flags - 1);
if (strcmp(bios_number, specbios) == 0 || strcmp(biosname, specbios) == 0) if (strcmp(bios_number, specbios) == 0 || strcmp(biosname, specbios) == 0)
bios_no = bios_flags; bios_no = bios_flags;
if (defaultname != NULL && strcmp(biosname, defaultname) == 0)
default_no = bios_flags;
bios_count++; bios_count++;
} }
@ -321,7 +330,7 @@ static int determine_bios_rom(rom_load_data *romdata, const rom_entry *romp)
} }
/* set to default */ /* set to default */
bios_no = 1; bios_no = default_no;
} }
LOG(("Using System BIOS: %d\n", bios_no)); LOG(("Using System BIOS: %d\n", bios_no));

View File

@ -38,6 +38,7 @@ enum
ROMENTRYTYPE_CARTRIDGE, /* this entry specifies a cartridge (MESS) */ ROMENTRYTYPE_CARTRIDGE, /* this entry specifies a cartridge (MESS) */
ROMENTRYTYPE_IGNORE, /* this entry continues loading the previous ROM but throws the data away */ ROMENTRYTYPE_IGNORE, /* this entry continues loading the previous ROM but throws the data away */
ROMENTRYTYPE_SYSTEM_BIOS, /* this entry specifies a bios */ ROMENTRYTYPE_SYSTEM_BIOS, /* this entry specifies a bios */
ROMENTRYTYPE_DEFAULT_BIOS, /* this entry specifies a default bios */
ROMENTRYTYPE_COUNT ROMENTRYTYPE_COUNT
}; };
@ -176,6 +177,7 @@ struct _rom_load_data
#define ROMENTRY_ISCOPY(r) (ROMENTRY_GETTYPE(r) == ROMENTRYTYPE_COPY) #define ROMENTRY_ISCOPY(r) (ROMENTRY_GETTYPE(r) == ROMENTRYTYPE_COPY)
#define ROMENTRY_ISIGNORE(r) (ROMENTRY_GETTYPE(r) == ROMENTRYTYPE_IGNORE) #define ROMENTRY_ISIGNORE(r) (ROMENTRY_GETTYPE(r) == ROMENTRYTYPE_IGNORE)
#define ROMENTRY_ISSYSTEM_BIOS(r) (ROMENTRY_GETTYPE(r) == ROMENTRYTYPE_SYSTEM_BIOS) #define ROMENTRY_ISSYSTEM_BIOS(r) (ROMENTRY_GETTYPE(r) == ROMENTRYTYPE_SYSTEM_BIOS)
#define ROMENTRY_ISDEFAULT_BIOS(r) (ROMENTRY_GETTYPE(r) == ROMENTRYTYPE_DEFAULT_BIOS)
#define ROMENTRY_ISREGIONEND(r) (ROMENTRY_ISREGION(r) || ROMENTRY_ISEND(r)) #define ROMENTRY_ISREGIONEND(r) (ROMENTRY_ISREGION(r) || ROMENTRY_ISEND(r))
/* ----- per-region macros ----- */ /* ----- per-region macros ----- */
@ -265,6 +267,7 @@ struct _rom_load_data
/* ----- system BIOS macros ----- */ /* ----- system BIOS macros ----- */
#define ROM_SYSTEM_BIOS(value,name,description) { name, description, 0, 0, ROMENTRYTYPE_SYSTEM_BIOS | ROM_BIOS(value+1) }, #define ROM_SYSTEM_BIOS(value,name,description) { name, description, 0, 0, ROMENTRYTYPE_SYSTEM_BIOS | ROM_BIOS(value+1) },
#define ROM_DEFAULT_BIOS(name) { name, NULL, 0, 0, ROMENTRYTYPE_DEFAULT_BIOS },
/* ----- disk loading macros ----- */ /* ----- disk loading macros ----- */