src/mess/mess.c
| r2286 | r2287 | |
| 127 | 127 | |
| 128 | 128 | void mess_postdevice_init(running_machine *machine) |
| 129 | 129 | { |
| 130 | | const struct IODevice *dev; |
| 131 | 130 | int result = INIT_FAIL; |
| 132 | 131 | const char *image_name; |
| 133 | 132 | const device_config *image; |
| 133 | image_device_info info; |
| 134 | 134 | |
| 135 | 135 | /* init all devices */ |
| 136 | 136 | image_init(machine); |
| r2286 | r2287 | |
| 138 | 138 | /* make sure that any required devices have been allocated */ |
| 139 | 139 | for (image = image_device_first(machine->config); image != NULL; image = image_device_next(image)) |
| 140 | 140 | { |
| 141 | | /* identify the legacy device */ |
| 142 | | dev = mess_device_from_core_device(image); |
| 141 | /* get the device info */ |
| 142 | info = image_device_getinfo(image); |
| 143 | 143 | |
| 144 | 144 | /* is an image specified for this image */ |
| 145 | | image_name = mess_get_device_option(&dev->devclass, dev->index_in_device); |
| 145 | image_name = mess_get_device_option(image); |
| 146 | |
| 146 | 147 | if ((image_name != NULL) && (image_name[0] != '\0')) |
| 147 | 148 | { |
| 148 | 149 | /* try to load this image */ |
| r2286 | r2287 | |
| 152 | 153 | if (result) |
| 153 | 154 | { |
| 154 | 155 | fatalerror_exitcode(MAMERR_DEVICE, "Device %s load (%s) failed: %s\n", |
| 155 | | device_typename(dev->type), |
| 156 | info.name, |
| 156 | 157 | osd_basename((char *) image_name), |
| 157 | 158 | image_error(image)); |
| 158 | 159 | } |
| r2286 | r2287 | |
| 160 | 161 | else |
| 161 | 162 | { |
| 162 | 163 | /* no image... must this device be loaded? */ |
| 163 | | if (dev->must_be_loaded) |
| 164 | if (info.must_be_loaded) |
| 164 | 165 | { |
| 165 | | fatalerror_exitcode(MAMERR_DEVICE, "Driver requires that device %s must have an image to load\n", device_typename(dev->type)); |
| 166 | fatalerror_exitcode(MAMERR_DEVICE, "Driver requires that device %s must have an image to load\n", info.name); |
| 166 | 167 | } |
| 167 | 168 | } |
| 168 | 169 | } |
src/mess/messopts.c
| r2286 | r2287 | |
| 42 | 42 | option, by device and index |
| 43 | 43 | -------------------------------------------------*/ |
| 44 | 44 | |
| 45 | | const char *mess_get_device_option(const mess_device_class *devclass, int device_index) |
| 45 | const char *mess_get_device_option(const device_config *device) |
| 46 | 46 | { |
| 47 | 47 | const char *result = NULL; |
| 48 | | const char *dev_name; |
| 48 | image_device_info info; |
| 49 | 49 | |
| 50 | 50 | if (options_get_bool(mame_options(), OPTION_ADDED_DEVICE_OPTIONS)) |
| 51 | 51 | { |
| 52 | | /* identify the option name */ |
| 53 | | dev_name = device_instancename(devclass, device_index); |
| 52 | /* get the device information */ |
| 53 | info = image_device_getinfo(device); |
| 54 | 54 | |
| 55 | 55 | /* access the option */ |
| 56 | | result = options_get_string(mame_options(), dev_name); |
| 56 | result = options_get_string(mame_options(), info.instance_name); |
| 57 | 57 | } |
| 58 | 58 | return result; |
| 59 | 59 | } |