mirror of
https://github.com/holub/mame
synced 2025-06-03 19:36:26 +03:00
nvram - in case of multiple bioses, system nvram will be saved in [Miodrag Milanovic]
form systemname_biosnum.nv in cases when non-default bios is used. For default bios selection all stay the same.
This commit is contained in:
parent
9babf1fcf4
commit
bd598da61f
@ -311,6 +311,21 @@ void coin_lockout_global_w(running_machine &machine, int on)
|
||||
NVRAM MANAGEMENT
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
nvram_filename - returns filename of system's
|
||||
NVRAM depending of selected BIOS
|
||||
-------------------------------------------------*/
|
||||
|
||||
static astring nvram_filename(running_machine &machine, astring &result)
|
||||
{
|
||||
if (rom_default_bios(machine) == rom_system_bios(machine)) {
|
||||
result.printf("%s",machine.basename());
|
||||
} else {
|
||||
result.printf("%s_%d",machine.basename(),rom_system_bios(machine) - 1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
nvram_load - load a system's NVRAM
|
||||
-------------------------------------------------*/
|
||||
@ -323,8 +338,9 @@ void nvram_load(running_machine &machine)
|
||||
return;
|
||||
|
||||
// open the file; if it exists, call everyone to read from it
|
||||
astring filename;
|
||||
emu_file file(machine.options().nvram_directory(), OPEN_FLAG_READ);
|
||||
if (file.open(machine.basename(), ".nv") == FILERR_NONE)
|
||||
if (file.open(nvram_filename(machine,filename), ".nv") == FILERR_NONE)
|
||||
{
|
||||
// read data from general NVRAM handler first
|
||||
if (machine.config().m_nvram_handler != NULL)
|
||||
@ -361,8 +377,9 @@ void nvram_save(running_machine &machine)
|
||||
return;
|
||||
|
||||
// open the file; if it exists, call everyone to read from it
|
||||
astring filename;
|
||||
emu_file file(machine.options().nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
|
||||
if (file.open(machine.basename(), ".nv") == FILERR_NONE)
|
||||
if (file.open(nvram_filename(machine,filename), ".nv") == FILERR_NONE)
|
||||
{
|
||||
// write data via general NVRAM handler first
|
||||
if (machine.config().m_nvram_handler != NULL)
|
||||
|
@ -53,6 +53,7 @@ struct _romload_private
|
||||
|
||||
running_machine *m_machine; /* machine object where needed */
|
||||
int system_bios; /* the system BIOS we wish to load */
|
||||
int default_bios; /* the default system BIOS */
|
||||
|
||||
int warnings; /* warning count during processing */
|
||||
int knownbad; /* BAD_DUMP/NO_DUMP count during processing */
|
||||
@ -377,7 +378,7 @@ static void determine_bios_rom(rom_load_data *romdata)
|
||||
/* set to default */
|
||||
romdata->system_bios = default_no;
|
||||
}
|
||||
|
||||
romdata->default_bios = default_no;
|
||||
LOG(("Using System BIOS: %d\n", romdata->system_bios));
|
||||
}
|
||||
}
|
||||
@ -1582,3 +1583,22 @@ int rom_load_knownbad(running_machine &machine)
|
||||
{
|
||||
return machine.romload_data->knownbad;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
rom_system_bios - return id of selected bios
|
||||
-------------------------------------------------*/
|
||||
|
||||
int rom_system_bios(running_machine &machine)
|
||||
{
|
||||
return machine.romload_data->system_bios;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
rom_default_bios - return id of default bios
|
||||
-------------------------------------------------*/
|
||||
|
||||
int rom_default_bios(running_machine &machine)
|
||||
{
|
||||
return machine.romload_data->default_bios;
|
||||
}
|
@ -274,6 +274,11 @@ int rom_load_warnings(running_machine &machine);
|
||||
/* return the number of BAD_DUMP/NO_DUMP warnings we generated */
|
||||
int rom_load_knownbad(running_machine &machine);
|
||||
|
||||
/* return id of selected bios */
|
||||
int rom_system_bios(running_machine &machine);
|
||||
|
||||
/* return id of default bios */
|
||||
int rom_default_bios(running_machine &machine);
|
||||
|
||||
/* ----- Helpers ----- */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user