diff options
author | 2011-01-17 13:37:26 +0000 | |
---|---|---|
committer | 2011-01-17 13:37:26 +0000 | |
commit | 9fd74516f66f8e41cb611746b7e63a4dea06b575 (patch) | |
tree | 41ac1edc3c52c1362537d4fe5e8137b47960346f /src | |
parent | f5c03d12e27df20e704ae6e1af233aefabfaeaec (diff) |
Made MESS drivers too load config from parent drivers (as MAME) but images are only taken from driver itself or command line (no whatsnew)
Diffstat (limited to 'src')
-rw-r--r-- | src/emu/emuopts.c | 2 | ||||
-rw-r--r-- | src/emu/mame.c | 2 | ||||
-rw-r--r-- | src/lib/util/options.c | 33 | ||||
-rw-r--r-- | src/lib/util/options.h | 3 |
4 files changed, 34 insertions, 6 deletions
diff --git a/src/emu/emuopts.c b/src/emu/emuopts.c index 062ee0d6bb3..a6a754ae989 100644 --- a/src/emu/emuopts.c +++ b/src/emu/emuopts.c @@ -216,7 +216,7 @@ const char *image_get_device_option(device_image_interface *image) if (options_get_bool(image->device().machine->options(), OPTION_ADDED_DEVICE_OPTIONS)) { /* access the option */ - result = options_get_string(image->device().machine->options(), image->image_config().instance_name()); + result = options_get_string_priority(image->device().machine->options(), image->image_config().instance_name(), OPTION_PRIORITY_DRIVER_INI); } return result; } diff --git a/src/emu/mame.c b/src/emu/mame.c index c3d0f5cbd6f..9e1607cc05a 100644 --- a/src/emu/mame.c +++ b/src/emu/mame.c @@ -516,7 +516,6 @@ void mame_parse_ini_files(core_options *options, const game_driver *driver) /* if we have a valid game driver, parse game-specific INI files */ if (driver != NULL && driver != &GAME_NAME(empty)) { -#ifndef MESS const game_driver *parent = driver_get_clone(driver); const game_driver *gparent = (parent != NULL) ? driver_get_clone(parent) : NULL; @@ -551,7 +550,6 @@ void mame_parse_ini_files(core_options *options, const game_driver *driver) parse_ini_file(options, gparent->name, OPTION_PRIORITY_GPARENT_INI); if (parent != NULL) parse_ini_file(options, parent->name, OPTION_PRIORITY_PARENT_INI); -#endif /* MESS */ parse_ini_file(options, driver->name, OPTION_PRIORITY_DRIVER_INI); } } diff --git a/src/lib/util/options.c b/src/lib/util/options.c index ea66b2439b2..705d4dfda2f 100644 --- a/src/lib/util/options.c +++ b/src/lib/util/options.c @@ -733,6 +733,33 @@ const char *options_get_string(core_options *opts, const char *name) /*------------------------------------------------- + options_get_string_priority - return data + formatted as a string if priority is equal + or better +-------------------------------------------------*/ + +const char *options_get_string_priority(core_options *opts, const char *name, int priority) +{ + options_data *data = find_entry_data(opts, name, FALSE); + const char *value = ""; + + /* error if not found */ + if (data == NULL) + message(opts, OPTMSG_ERROR, "Unexpected option %s queried\n", name); + + /* copy if non-NULL */ + else { + if (data->priority!=OPTION_PRIORITY_DEFAULT) { + if (priority > data->priority) return value; + } + value = astring_c(data->data); + } + + return value; +} + + +/*------------------------------------------------- options_get_bool - return data formatted as a boolean -------------------------------------------------*/ @@ -1078,11 +1105,11 @@ static void update_data(core_options *opts, options_data *data, const char *newd } break; } - + /* ignore if we don't have priority */ - if (priority < data->priority) + if (priority < data->priority) { return; - + } /* allocate a copy of the data */ astring_cpych(data->data, datastart, dataend + 1 - datastart); data->priority = priority; diff --git a/src/lib/util/options.h b/src/lib/util/options.h index bbb3857b631..ea6ba5b0c76 100644 --- a/src/lib/util/options.h +++ b/src/lib/util/options.h @@ -193,6 +193,9 @@ void options_output_help(core_options *opts, void (*output)(const char *s)); /* read an option as a string */ const char *options_get_string(core_options *opts, const char *name); +/* read an option as a string with priority */ +const char *options_get_string_priority(core_options *opts, const char *name, int priority); + /* read an option as a boolean */ int options_get_bool(core_options *opts, const char *name); |