Previous 15994 Revisions Next

r2287 Sunday 6th April, 2008 at 00:28:06 UTC by Nathan Woods
More IODevice cleanups
[src/mess]mess.c messopts.c messopts.h

src/mess/mess.c
r2286r2287
127127
128128void mess_postdevice_init(running_machine *machine)
129129{
130   const struct IODevice *dev;
131130   int result = INIT_FAIL;
132131   const char *image_name;
133132   const device_config *image;
133   image_device_info info;
134134
135135   /* init all devices */
136136   image_init(machine);
r2286r2287
138138   /* make sure that any required devices have been allocated */
139139   for (image = image_device_first(machine->config); image != NULL; image = image_device_next(image))
140140   {
141      /* identify the legacy device */
142      dev = mess_device_from_core_device(image);
141      /* get the device info */
142      info = image_device_getinfo(image);
143143
144144      /* 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
146147      if ((image_name != NULL) && (image_name[0] != '\0'))
147148      {
148149         /* try to load this image */
r2286r2287
152153         if (result)
153154         {
154155            fatalerror_exitcode(MAMERR_DEVICE, "Device %s load (%s) failed: %s\n",
155               device_typename(dev->type),
156               info.name,
156157               osd_basename((char *) image_name),
157158               image_error(image));
158159         }
r2286r2287
160161      else
161162      {
162163         /* no image... must this device be loaded? */
163         if (dev->must_be_loaded)
164         if (info.must_be_loaded)
164165         {
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);
166167         }
167168      }
168169   }
src/mess/messopts.c
r2286r2287
4242   option, by device and index
4343-------------------------------------------------*/
4444
45const char *mess_get_device_option(const mess_device_class *devclass, int device_index)
45const char *mess_get_device_option(const device_config *device)
4646{
4747   const char *result = NULL;
48   const char *dev_name;
48   image_device_info info;
4949
5050   if (options_get_bool(mame_options(), OPTION_ADDED_DEVICE_OPTIONS))
5151   {
52      /* identify the option name */
53      dev_name = device_instancename(devclass, device_index);
52      /* get the device information */
53      info = image_device_getinfo(device);
5454
5555      /* access the option */
56      result = options_get_string(mame_options(), dev_name);
56      result = options_get_string(mame_options(), info.instance_name);
5757   }
5858   return result;
5959}
src/mess/messopts.h
r2286r2287
3838void mess_add_device_options(core_options *opts, const game_driver *driver);
3939
4040/* accesses a device option, by device and index */
41const char *mess_get_device_option(const mess_device_class *devclass, int device_index);
41const char *mess_get_device_option(const device_config *device);
4242
4343#endif /* __MESSOPTS_H__ */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team