Previous 15994 Revisions Next

r10070 Monday 17th January, 2011 at 13:36:59 UTC by Miodrag Milanović
Made MESS drivers too load config from parent drivers (as MAME) but images are only taken from driver itself or command line
[src/emu]emuopts.c mame.c
[src/lib/util]options.c options.h

src/emu/emuopts.c
r10069r10070
216216   if (options_get_bool(image->device().machine->options(), OPTION_ADDED_DEVICE_OPTIONS))
217217   {
218218      /* access the option */
219      result = options_get_string(image->device().machine->options(),  image->image_config().instance_name());
219      result = options_get_string_priority(image->device().machine->options(),  image->image_config().instance_name(), OPTION_PRIORITY_DRIVER_INI);
220220   }
221221   return result;
222222}
src/emu/mame.c
r10069r10070
516516   /* if we have a valid game driver, parse game-specific INI files */
517517   if (driver != NULL && driver != &GAME_NAME(empty))
518518   {
519#ifndef MESS
520519      const game_driver *parent = driver_get_clone(driver);
521520      const game_driver *gparent = (parent != NULL) ? driver_get_clone(parent) : NULL;
522521
r10069r10070
551550         parse_ini_file(options, gparent->name, OPTION_PRIORITY_GPARENT_INI);
552551      if (parent != NULL)
553552         parse_ini_file(options, parent->name, OPTION_PRIORITY_PARENT_INI);
554#endif   /* MESS */
555553      parse_ini_file(options, driver->name, OPTION_PRIORITY_DRIVER_INI);
556554   }
557555}
src/lib/util/options.h
r10069r10070
193193/* read an option as a string */
194194const char *options_get_string(core_options *opts, const char *name);
195195
196/* read an option as a string with priority */
197const char *options_get_string_priority(core_options *opts, const char *name, int priority);
198
196199/* read an option as a boolean */
197200int options_get_bool(core_options *opts, const char *name);
198201
src/lib/util/options.c
r10069r10070
733733
734734
735735/*-------------------------------------------------
736    options_get_string_priority - return data
737    formatted as a string if priority is equal
738   or better
739-------------------------------------------------*/
740
741const char *options_get_string_priority(core_options *opts, const char *name, int priority)
742{
743   options_data *data = find_entry_data(opts, name, FALSE);
744   const char *value = "";
745
746   /* error if not found */
747   if (data == NULL)
748      message(opts, OPTMSG_ERROR, "Unexpected option %s queried\n", name);
749
750   /* copy if non-NULL */
751   else {   
752      if (data->priority!=OPTION_PRIORITY_DEFAULT) {
753         if (priority > data->priority) return value;   
754      }
755      value = astring_c(data->data);
756   }
757
758   return value;
759}
760
761
762/*-------------------------------------------------
736763    options_get_bool - return data formatted as
737764    a boolean
738765-------------------------------------------------*/
r10069r10070
10781105         }
10791106         break;
10801107   }
1081
1108   
10821109   /* ignore if we don't have priority */
1083   if (priority < data->priority)
1110   if (priority < data->priority) {   
10841111      return;
1085
1112   }
10861113   /* allocate a copy of the data */
10871114   astring_cpych(data->data, datastart, dataend + 1 - datastart);
10881115   data->priority = priority;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team