Previous 15994 Revisions Next

r3969 Tuesday 23rd December, 2008 at 18:52:00 UTC by Wilbert Pol
Made sure the machine member gets set for legacy mess devices.
[src/mess]device.c device.h mess.c

src/mess/mess.c
r3968r3969
112112   inputx_init(machine);
113113
114114   /* allocate the IODevice struct */
115   mess_devices_setup((machine_config *) machine->config, machine->gamedrv);
115   mess_devices_setup(machine, (machine_config *) machine->config, machine->gamedrv);
116116
117117   /* initialize RAM code */
118118   ram_init(machine, machine->gamedrv);
src/mess/device.c
r3968r3969
375375   MESS device
376376-------------------------------------------------*/
377377
378static void create_mess_device(device_config **listheadptr, device_getinfo_handler handler, const game_driver *gamedrv,
378static void create_mess_device(running_machine *machine, device_config **listheadptr, device_getinfo_handler handler, const game_driver *gamedrv,
379379   int count_override, int *position)
380380{
381381   mess_device_class mess_devclass;
r3968r3969
418418
419419      /* create a bonafide MAME device */
420420      device = device_list_add(listheadptr, NULL, MESS_DEVICE, mame_tag, 0);
421      device->machine = machine;
421422      mess_device = (mess_device_config *) device->inline_config;
422423
423424      /* we need to copy the mess_tag into the structure */
r3968r3969
469470    mess_devices_setup - allocate devices
470471-------------------------------------------------*/
471472
472void mess_devices_setup(machine_config *config, const game_driver *gamedrv)
473void mess_devices_setup(running_machine *machine, machine_config *config, const game_driver *gamedrv)
473474{
474475   device_getinfo_handler handlers[64];
475476   int count_overrides[sizeof(handlers) / sizeof(handlers[0])];
r3968r3969
493494   /* loop through all handlers */
494495   for (i = 0; handlers[i] != NULL; i++)
495496   {
496      create_mess_device(&config->devicelist, handlers[i], gamedrv, count_overrides[i], &position);
497      create_mess_device(machine, &config->devicelist, handlers[i], gamedrv, count_overrides[i], &position);
497498   }
498499}
499500
r3968r3969
507508machine_config *machine_config_alloc_with_mess_devices(const game_driver *gamedrv)
508509{
509510   machine_config *config = machine_config_alloc(gamedrv->machine_config);
510   mess_devices_setup(config, gamedrv);
511   mess_devices_setup(NULL/*machine?*/, config, gamedrv);
511512   return config;
512513}
513514
src/mess/device.h
r3968r3969
190190iodevice_t device_typeid(const char *name);
191191
192192/* device allocation */
193void mess_devices_setup(machine_config *config, const game_driver *gamedrv);
193void mess_devices_setup(running_machine *machine, machine_config *config, const game_driver *gamedrv);
194194
195195/* device lookup */
196196int device_count_tag_from_machine(const running_machine *machine, const char *tag);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team