src/mess/mess.c
| r1003 | r1004 | |
| 130 | 130 | int id; |
| 131 | 131 | int result = INIT_FAIL; |
| 132 | 132 | const char *image_name; |
| 133 | | const char *dev_name; |
| 134 | 133 | mess_image *image; |
| 135 | 134 | |
| 136 | 135 | /* convienient place to call this */ |
| r1003 | r1004 | |
| 163 | 162 | /* identify the image */ |
| 164 | 163 | image = image_from_device_and_index(dev, id); |
| 165 | 164 | |
| 166 | | /* identify the option name */ |
| 167 | | dev_name = device_instancename(&dev->devclass, id); |
| 168 | | |
| 169 | 165 | /* is an image specified for this image */ |
| 170 | | image_name = options_get_string(mame_options(), dev_name); |
| 166 | image_name = mess_get_device_option(&dev->devclass, id); |
| 171 | 167 | if ((image_name != NULL) && (image_name[0] != '\0')) |
| 172 | 168 | { |
| 173 | 169 | /* try to load this image */ |
src/mess/messopts.c
| r1003 | r1004 | |
| 37 | 37 | ***************************************************************************/ |
| 38 | 38 | |
| 39 | 39 | /*------------------------------------------------- |
| 40 | mess_get_device_option - accesses a device |
| 41 | option, by device and index |
| 42 | -------------------------------------------------*/ |
| 43 | |
| 44 | const char *mess_get_device_option(const device_class *devclass, int device_index) |
| 45 | { |
| 46 | const char *result = NULL; |
| 47 | const char *dev_name; |
| 48 | |
| 49 | if (added_device_options) |
| 50 | { |
| 51 | /* identify the option name */ |
| 52 | dev_name = device_instancename(devclass, device_index); |
| 53 | |
| 54 | /* access the option */ |
| 55 | result = options_get_string(mame_options(), dev_name); |
| 56 | } |
| 57 | return result; |
| 58 | } |
| 59 | |
| 60 | |
| 61 | |
| 62 | /*------------------------------------------------- |
| 40 | 63 | mess_enumerate_devices - runs a specified proc |
| 41 | 64 | for all devices on a driver |
| 42 | 65 | -------------------------------------------------*/ |
| r1003 | r1004 | |
| 188 | 211 | const char *dev_name; |
| 189 | 212 | const char *filename; |
| 190 | 213 | |
| 214 | assert_always(added_device_options, "extract_device_options_for_device() called without device options"); |
| 215 | |
| 191 | 216 | /* identify the correct image */ |
| 192 | 217 | dev_tag = device_get_info_string(devclass, DEVINFO_STR_DEV_TAG); |
| 193 | 218 | if (dev_tag != NULL) |
| r1003 | r1004 | |
| 252 | 277 | |
| 253 | 278 | void mess_options_extract(void) |
| 254 | 279 | { |
| 255 | | mess_enumerate_devices(mame_options(), Machine->gamedrv, extract_device_options_for_device); |
| 280 | /* only extract the device options if we've added them */ |
| 281 | if (added_device_options) |
| 282 | mess_enumerate_devices(mame_options(), Machine->gamedrv, extract_device_options_for_device); |
| 256 | 283 | |
| 284 | /* write the config, if appropriate */ |
| 257 | 285 | if (options_get_bool(mame_options(), OPTION_WRITECONFIG)) |
| 258 | | { |
| 259 | 286 | write_config(NULL, Machine->gamedrv); |
| 260 | | } |
| 261 | 287 | } |