Made MESS drivers too load config from parent drivers (as MAME) but images are only taken from driver itself or command line (no whatsnew)

This commit is contained in:
Miodrag Milanovic 2011-01-17 13:37:26 +00:00
parent f5c03d12e2
commit 9fd74516f6
4 changed files with 34 additions and 6 deletions

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -732,6 +732,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;

View File

@ -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);