diff options
| author | 2011-07-06 13:08:47 +0000 | |
|---|---|---|
| committer | 2011-07-06 13:08:47 +0000 | |
| commit | bd598da61fc2a6124578725275af4f5f91636fc6 (patch) | |
| tree | a55cdcab80732234644bbf376ccaa3ffff9abb05 | |
| parent | 9babf1fcf48ff30f443d995283f2db592a08d4f1 (diff) | |
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.
| -rw-r--r-- | src/emu/machine/generic.c | 21 | ||||
| -rw-r--r-- | src/emu/romload.c | 22 | ||||
| -rw-r--r-- | src/emu/romload.h | 5 |
3 files changed, 45 insertions, 3 deletions
diff --git a/src/emu/machine/generic.c b/src/emu/machine/generic.c index f6e6691571c..2d99a3c20eb 100644 --- a/src/emu/machine/generic.c +++ b/src/emu/machine/generic.c @@ -312,6 +312,21 @@ void coin_lockout_global_w(running_machine &machine, int on) ***************************************************************************/ /*------------------------------------------------- + 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) diff --git a/src/emu/romload.c b/src/emu/romload.c index 78f25f17621..de55d36a6f3 100644 --- a/src/emu/romload.c +++ b/src/emu/romload.c @@ -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; +}
\ No newline at end of file diff --git a/src/emu/romload.h b/src/emu/romload.h index 7025ddcfa17..29f9988e59e 100644 --- a/src/emu/romload.h +++ b/src/emu/romload.h @@ -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 ----- */ |
