src/mess/devices/cartslot.c
| r7238 | r7239 | |
| 383 | 383 | /*------------------------------------------------- |
| 384 | 384 | DEVICE_GET_IMAGE_DEVICES(cartslot) |
| 385 | 385 | -------------------------------------------------*/ |
| 386 | static void add_device_with_subdevices(const running_device *_owner, device_type _type, const char *_tag, UINT32 _clock) |
| 387 | { |
| 388 | astring tempstring; |
| 389 | device_list *devlist = &_owner->machine->devicelist; |
| 390 | const device_config *cfg = new device_config(&_owner->baseconfig(), _type, _tag, _clock); |
| 391 | running_device *dev = devlist->append(_owner->subtag(tempstring,_tag), new running_device(*_owner->machine, *cfg)); |
| 392 | |
| 393 | const machine_config_token *tokens = (const machine_config_token *)dev->get_config_ptr(DEVINFO_PTR_MACHINE_CONFIG); |
| 394 | machine_config *config; |
| 395 | const device_config *config_dev; |
| 396 | running_device *new_dev = NULL; |
| 397 | if (tokens != NULL) |
| 398 | { |
| 399 | config = machine_config_alloc(tokens); |
| 400 | for (config_dev = config->devicelist.first(); config_dev != NULL; config_dev = config_dev->next) |
| 401 | { |
| 402 | device_config *new_cfg = new device_config(cfg, config_dev->type, config_dev->tag, config_dev->clock); |
| 403 | new_cfg->static_config = config_dev->static_config; |
| 404 | memcpy( |
| 405 | new_cfg->inline_config, |
| 406 | config_dev->inline_config, |
| 407 | new_cfg->get_config_int(DEVINFO_INT_INLINE_CONFIG_BYTES)); |
| 408 | new_dev = devlist->append(dev->subtag(tempstring,config_dev->tag), new running_device(*_owner->machine, *new_cfg)); |
| 409 | new_dev->owner = dev; |
| 410 | } |
| 411 | machine_config_free(config); |
| 412 | } |
| 413 | } |
| 386 | 414 | |
| 387 | 415 | static DEVICE_GET_IMAGE_DEVICES(cartslot) |
| 388 | 416 | { |
| 389 | | const cartslot_pcb_type *pcb_type; |
| 390 | | astring tempstring; |
| 391 | | |
| 417 | const cartslot_pcb_type *pcb_type; |
| 418 | |
| 392 | 419 | pcb_type = identify_pcb(device); |
| 393 | 420 | if (pcb_type != NULL) |
| 394 | 421 | { |
| 395 | | const device_config *cfg = new device_config(&device->baseconfig(), pcb_type->devtype, TAG_PCB, 0); |
| 396 | | running_device *dev = devlist->append(device->subtag(tempstring,TAG_PCB), new running_device(*machine, *cfg)); |
| 397 | | |
| 398 | | const machine_config_token *tokens = (const machine_config_token *)dev->get_config_ptr(DEVINFO_PTR_MACHINE_CONFIG); |
| 399 | | machine_config *config; |
| 400 | | const device_config *config_dev; |
| 401 | | running_device *new_dev = NULL; |
| 402 | | if (tokens != NULL) |
| 403 | | { |
| 404 | | config = machine_config_alloc(tokens); |
| 405 | | for (config_dev = config->devicelist.first(); config_dev != NULL; config_dev = config_dev->next) |
| 406 | | { |
| 407 | | device_config *new_cfg = new device_config(cfg, config_dev->type, config_dev->tag, config_dev->clock); |
| 408 | | new_cfg->static_config = config_dev->static_config; |
| 409 | | memcpy( |
| 410 | | new_cfg->inline_config, |
| 411 | | config_dev->inline_config, |
| 412 | | new_cfg->get_config_int(DEVINFO_INT_INLINE_CONFIG_BYTES)); |
| 413 | | new_dev = devlist->append(dev->subtag(tempstring,config_dev->tag), new running_device(*machine, *new_cfg)); |
| 414 | | new_dev->owner = dev; |
| 415 | | } |
| 416 | | machine_config_free(config); |
| 417 | | } |
| 418 | | |
| 422 | add_device_with_subdevices(device,pcb_type->devtype,TAG_PCB,0); |
| 419 | 423 | } |
| 420 | 424 | } |
| 421 | 425 | |
src/mess/mess.c
| r7238 | r7239 | |
| 41 | 41 | running_device *image; |
| 42 | 42 | image_device_info info; |
| 43 | 43 | device_get_image_devices_func get_image_devices; |
| 44 | | device_list *devlist; |
| 45 | 44 | |
| 46 | 45 | /* initialize natural keyboard support */ |
| 47 | 46 | inputx_init(machine); |
| r7238 | r7239 | |
| 49 | 48 | /* init all devices */ |
| 50 | 49 | image_init(machine); |
| 51 | 50 | |
| 52 | | devlist = &machine->devicelist; |
| 53 | | |
| 54 | 51 | /* make sure that any required devices have been allocated */ |
| 55 | 52 | for (image = machine->devicelist.first(); image != NULL; image = image->next) |
| 56 | 53 | { |
| r7238 | r7239 | |
| 77 | 74 | /* get image-specific hardware */ |
| 78 | 75 | get_image_devices = (device_get_image_devices_func) image->get_config_fct(DEVINFO_FCT_GET_IMAGE_DEVICES); |
| 79 | 76 | if (get_image_devices != NULL) |
| 80 | | (*get_image_devices)(image, machine, devlist); |
| 77 | (*get_image_devices)(image); |
| 81 | 78 | } |
| 82 | 79 | } |
| 83 | 80 | } |
src/mess/image.h
| r7238 | r7239 | |
| 36 | 36 | typedef void (*device_display_func)(running_device *image); |
| 37 | 37 | typedef void (*device_image_partialhash_func)(char *, const unsigned char *, unsigned long, unsigned int); |
| 38 | 38 | typedef const char *(*device_get_name_func)(running_device *device, char *buffer, size_t buffer_length); |
| 39 | | typedef void (*device_get_image_devices_func)(running_device *device, running_machine *machine, device_list *devlist); |
| 39 | typedef void (*device_get_image_devices_func)(running_device *device); |
| 40 | 40 | |
| 41 | 41 | typedef enum |
| 42 | 42 | { |
| r7238 | r7239 | |
| 338 | 338 | #define DEVICE_IMAGE_UNLOAD(name) void DEVICE_IMAGE_UNLOAD_NAME(name)(running_device *image) |
| 339 | 339 | |
| 340 | 340 | #define DEVICE_GET_IMAGE_DEVICES_NAME(name) device_get_image_devices_##name |
| 341 | | #define DEVICE_GET_IMAGE_DEVICES(name) void DEVICE_GET_IMAGE_DEVICES_NAME(name)(running_device *device, running_machine *machine, device_list *devlist) |
| 341 | #define DEVICE_GET_IMAGE_DEVICES(name) void DEVICE_GET_IMAGE_DEVICES_NAME(name)(running_device *device) |
| 342 | 342 | |
| 343 | 343 | #endif /* __IMAGE_H__ */ |