summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/emu/mame.c8
-rw-r--r--src/lib/util/options.c24
-rw-r--r--src/lib/util/options.h3
3 files changed, 35 insertions, 0 deletions
diff --git a/src/emu/mame.c b/src/emu/mame.c
index 22defdd68b2..dc58f1e788f 100644
--- a/src/emu/mame.c
+++ b/src/emu/mame.c
@@ -565,6 +565,14 @@ static int parse_ini_file(core_options *options, const char *name, int priority)
if (filerr != FILERR_NONE)
return FALSE;
+ /* clear flag for added devices */
+ options_set_bool(options, OPTION_ADDED_DEVICE_OPTIONS, FALSE, OPTION_PRIORITY_CMDLINE);
+
+ /* update game name so depending callback options could be added */
+ if (priority==OPTION_PRIORITY_DRIVER_INI) {
+ options_force_option_callback(options, OPTION_GAMENAME, name, priority);
+ }
+
/* parse the file and close it */
mame_printf_verbose("Parsing %s.ini\n", name);
options_parse_ini_file(options, mame_core_file(file), priority);
diff --git a/src/lib/util/options.c b/src/lib/util/options.c
index cab6714ac7d..72fdfb8839a 100644
--- a/src/lib/util/options.c
+++ b/src/lib/util/options.c
@@ -495,6 +495,30 @@ int options_parse_command_line(core_options *opts, int argc, char **argv, int pr
/*-------------------------------------------------
+ options_force_option_callback - set option value
+ and execute callback call
+-------------------------------------------------*/
+
+int options_force_option_callback(core_options *opts, const char *optionname, const char *newval, int priority)
+{
+ options_data *data = find_entry_data(opts, optionname, TRUE);
+ if (data == NULL)
+ {
+ message(opts, OPTMSG_ERROR, "Error: unknown option: %s\n", optionname);
+ return 1;
+ }
+
+ /* invoke callback, if present */
+ if (data->callback != NULL)
+ (*data->callback)(opts, newval);
+
+ /* allocate a new copy of data for this */
+ update_data(opts, data, newval, priority);
+ return 0;
+}
+
+
+/*-------------------------------------------------
options_parse_ini_file - parse a series
of entries in an INI file
-------------------------------------------------*/
diff --git a/src/lib/util/options.h b/src/lib/util/options.h
index b16f0d1a60f..bbb3857b631 100644
--- a/src/lib/util/options.h
+++ b/src/lib/util/options.h
@@ -164,6 +164,9 @@ int options_set_option_callback(core_options *opts, const char *name, void (*cal
/* parse option data from a command line */
int options_parse_command_line(core_options *opts, int argc, char **argv, int priority);
+/* set option value and execute callback call */
+int options_force_option_callback(core_options *opts, const char *optionname, const char *newval, int priority);
+
/* parse option data from an INI file */
int options_parse_ini_file(core_options *opts, core_file *inifile, int priority);