mirror of
https://github.com/holub/mame
synced 2025-05-18 11:39:29 +03:00
- Added writeconfig option to emuopts (default for MAME is off) to save ini on exit of driver
- Added saving of location of mounted images in ini (no whatsnew)
This commit is contained in:
parent
02f49429c6
commit
231ad67aef
@ -28,6 +28,11 @@ const options_entry mame_core_options[] =
|
|||||||
/* config options */
|
/* config options */
|
||||||
{ NULL, NULL, OPTION_HEADER, "CORE CONFIGURATION OPTIONS" },
|
{ NULL, NULL, OPTION_HEADER, "CORE CONFIGURATION OPTIONS" },
|
||||||
{ "readconfig;rc", "1", OPTION_BOOLEAN, "enable loading of configuration files" },
|
{ "readconfig;rc", "1", OPTION_BOOLEAN, "enable loading of configuration files" },
|
||||||
|
#ifdef MESS
|
||||||
|
{ "writeconfig;wc", "1", OPTION_BOOLEAN, "writes configuration to (driver).ini on exit" },
|
||||||
|
#else
|
||||||
|
{ "writeconfig;wc", "0", OPTION_BOOLEAN, "writes configuration to (driver).ini on exit" },
|
||||||
|
#endif /* MESS */
|
||||||
|
|
||||||
/* seach path options */
|
/* seach path options */
|
||||||
{ NULL, NULL, OPTION_HEADER, "CORE SEARCH PATH OPTIONS" },
|
{ NULL, NULL, OPTION_HEADER, "CORE SEARCH PATH OPTIONS" },
|
||||||
|
@ -83,6 +83,65 @@ static void image_dirs_save(running_machine *machine, int config_type, xml_data_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*-------------------------------------------------
|
||||||
|
write_config - emit current option statuses as
|
||||||
|
INI files
|
||||||
|
-------------------------------------------------*/
|
||||||
|
|
||||||
|
static int write_config(const char *filename, const game_driver *gamedrv)
|
||||||
|
{
|
||||||
|
file_error filerr;
|
||||||
|
mame_file *f;
|
||||||
|
char buffer[128];
|
||||||
|
int retval = 1;
|
||||||
|
|
||||||
|
if (gamedrv != NULL)
|
||||||
|
{
|
||||||
|
sprintf(buffer, "%s.ini", gamedrv->name);
|
||||||
|
filename = buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
filerr = mame_fopen(SEARCHPATH_INI, buffer, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &f);
|
||||||
|
if (filerr != FILERR_NONE)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
options_output_ini_file(mame_options(), mame_core_file(f));
|
||||||
|
retval = 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (f != NULL)
|
||||||
|
mame_fclose(f);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-------------------------------------------------
|
||||||
|
image_options_extract - extract device options
|
||||||
|
out of core into the options
|
||||||
|
-------------------------------------------------*/
|
||||||
|
|
||||||
|
static void image_options_extract(running_machine *machine)
|
||||||
|
{
|
||||||
|
/* only extract the device options if we've added them */
|
||||||
|
if (options_get_bool(mame_options(), OPTION_ADDED_DEVICE_OPTIONS)) {
|
||||||
|
int index = 0;
|
||||||
|
device_image_interface *image = NULL;
|
||||||
|
|
||||||
|
for (bool gotone = machine->devicelist.first(image); gotone; gotone = image->next(image))
|
||||||
|
{
|
||||||
|
const char *filename = image->filename();
|
||||||
|
|
||||||
|
/* and set the option */
|
||||||
|
options_set_string(mame_options(), image->image_config().instance_name() , filename ? filename : "", OPTION_PRIORITY_CMDLINE);
|
||||||
|
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* write the config, if appropriate */
|
||||||
|
if (options_get_bool(mame_options(), OPTION_WRITECONFIG))
|
||||||
|
write_config(NULL, machine->gamedrv);
|
||||||
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------
|
/*-------------------------------------------------
|
||||||
image_unload_all - unload all images and
|
image_unload_all - unload all images and
|
||||||
extract options
|
extract options
|
||||||
@ -93,7 +152,7 @@ void image_unload_all(running_machine *machine)
|
|||||||
device_image_interface *image = NULL;
|
device_image_interface *image = NULL;
|
||||||
|
|
||||||
// extract the options
|
// extract the options
|
||||||
//mess_options_extract(machine);
|
image_options_extract(machine);
|
||||||
|
|
||||||
for (bool gotone = machine->devicelist.first(image); gotone; gotone = image->next(image))
|
for (bool gotone = machine->devicelist.first(image); gotone; gotone = image->next(image))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user