src/mess/devices/idedrive.c
| r2189 | r2190 | |
| 17 | 17 | static void ide_get_params(const device_config *image, int *which_bus, int *which_address, |
| 18 | 18 | struct ide_interface **intf, |
| 19 | 19 | device_start_func *parent_init, |
| 20 | | device_load_handler *parent_load, |
| 21 | | device_unload_handler *parent_unload) |
| 20 | device_image_load_func *parent_load, |
| 21 | device_image_unload_func *parent_unload) |
| 22 | 22 | { |
| 23 | 23 | const mess_device_class *devclass = &image_device(image)->devclass; |
| 24 | 24 | mess_device_class parent_devclass; |
| r2189 | r2190 | |
| 33 | 33 | if (parent_init) |
| 34 | 34 | *parent_init = (device_start_func) mess_device_get_info_fct(&parent_devclass, MESS_DEVINFO_PTR_START); |
| 35 | 35 | if (parent_load) |
| 36 | | *parent_load = (device_load_handler) mess_device_get_info_fct(&parent_devclass, MESS_DEVINFO_PTR_LOAD); |
| 36 | *parent_load = (device_image_load_func) mess_device_get_info_fct(&parent_devclass, MESS_DEVINFO_PTR_LOAD); |
| 37 | 37 | if (parent_unload) |
| 38 | | *parent_unload = (device_unload_handler) mess_device_get_info_fct(&parent_devclass, MESS_DEVINFO_PTR_UNLOAD); |
| 38 | *parent_unload = (device_image_unload_func) mess_device_get_info_fct(&parent_devclass, MESS_DEVINFO_PTR_UNLOAD); |
| 39 | 39 | |
| 40 | 40 | assert(*which_address == 0); |
| 41 | 41 | assert(*intf); |
| r2189 | r2190 | |
| 73 | 73 | { |
| 74 | 74 | int result, which_bus, which_address; |
| 75 | 75 | struct ide_interface *intf; |
| 76 | | device_load_handler parent_load; |
| 76 | device_image_load_func parent_load; |
| 77 | 77 | |
| 78 | 78 | /* get the basics */ |
| 79 | 79 | ide_get_params(image, &which_bus, &which_address, &intf, NULL, &parent_load, NULL); |
| r2189 | r2190 | |
| 99 | 99 | { |
| 100 | 100 | int which_bus, which_address; |
| 101 | 101 | struct ide_interface *intf; |
| 102 | | device_unload_handler parent_unload; |
| 102 | device_image_unload_func parent_unload; |
| 103 | 103 | |
| 104 | 104 | /* get the basics */ |
| 105 | 105 | ide_get_params(image, &which_bus, &which_address, &intf, NULL, NULL, &parent_unload); |
src/mess/devices/appldriv.c
| r2189 | r2190 | |
| 291 | 291 | static DEVICE_IMAGE_LOAD( apple525_floppy ) |
| 292 | 292 | { |
| 293 | 293 | int result; |
| 294 | | device_load_handler parent_load; |
| 294 | device_image_load_func parent_load; |
| 295 | 295 | |
| 296 | | parent_load = (device_load_handler) mess_device_get_info_fct(&parent_devclass, MESS_DEVINFO_PTR_LOAD); |
| 296 | parent_load = (device_image_load_func) mess_device_get_info_fct(&parent_devclass, MESS_DEVINFO_PTR_LOAD); |
| 297 | 297 | result = parent_load(image); |
| 298 | 298 | |
| 299 | 299 | floppy_drive_seek(image, -999); |
| r2189 | r2190 | |
| 305 | 305 | |
| 306 | 306 | static DEVICE_IMAGE_UNLOAD( apple525_floppy ) |
| 307 | 307 | { |
| 308 | | device_unload_handler parent_unload; |
| 308 | device_image_unload_func parent_unload; |
| 309 | 309 | |
| 310 | 310 | apple525_save_current_track(image, TRUE); |
| 311 | 311 | |
| 312 | | parent_unload = (device_unload_handler) mess_device_get_info_fct(&parent_devclass, MESS_DEVINFO_PTR_UNLOAD); |
| 312 | parent_unload = (device_image_unload_func) mess_device_get_info_fct(&parent_devclass, MESS_DEVINFO_PTR_UNLOAD); |
| 313 | 313 | parent_unload(image); |
| 314 | 314 | } |
| 315 | 315 | |
src/mess/device.c
| r2189 | r2190 | |
| 293 | 293 | int i, j, count; |
| 294 | 294 | size_t string_buffer_pos = 0; |
| 295 | 295 | int createimage_optcount; |
| 296 | | device_getdispositions_handler getdispositions; |
| 296 | device_getdispositions_func getdispositions; |
| 297 | 297 | unsigned int readable, writeable, creatable; |
| 298 | 298 | |
| 299 | 299 | /* set up MESS's device class */ |
| r2189 | r2190 | |
| 363 | 363 | |
| 364 | 364 | mess_device->io_device.start = (device_start_func) mess_device_get_info_fct(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_START); |
| 365 | 365 | mess_device->io_device.stop = (device_stop_func) mess_device_get_info_fct(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_STOP); |
| 366 | | mess_device->io_device.load = (device_load_handler) mess_device_get_info_fct(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_LOAD); |
| 367 | | mess_device->io_device.create = (device_create_handler) mess_device_get_info_fct(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_CREATE); |
| 368 | | mess_device->io_device.unload = (device_unload_handler) mess_device_get_info_fct(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_UNLOAD); |
| 369 | | mess_device->io_device.imgverify = (device_verify_handler) mess_device_get_info_fct(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_VERIFY); |
| 370 | | mess_device->io_device.partialhash = (device_partialhash_handler) mess_device_get_info_fct(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_PARTIAL_HASH); |
| 366 | mess_device->io_device.load = (device_image_load_func) mess_device_get_info_fct(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_LOAD); |
| 367 | mess_device->io_device.create = (device_image_create_func) mess_device_get_info_fct(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_CREATE); |
| 368 | mess_device->io_device.unload = (device_image_unload_func) mess_device_get_info_fct(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_UNLOAD); |
| 369 | mess_device->io_device.imgverify = (device_image_verify_func) mess_device_get_info_fct(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_VERIFY); |
| 370 | mess_device->io_device.partialhash = (device_image_partialhash_func) mess_device_get_info_fct(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_PARTIAL_HASH); |
| 371 | 371 | |
| 372 | | mess_device->io_device.display = (device_display_handler) mess_device_get_info_fct(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_DISPLAY); |
| 372 | mess_device->io_device.display = (device_display_func) mess_device_get_info_fct(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_DISPLAY); |
| 373 | 373 | mess_device->io_device.name = default_device_name; |
| 374 | 374 | |
| 375 | 375 | mess_device->io_device.createimage_optguide = (const struct OptionGuide *) mess_device_get_info_ptr(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_CREATE_OPTGUIDE); |
| r2189 | r2190 | |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | /* determine the dispositions */ |
| 406 | | getdispositions = (device_getdispositions_handler) mess_device_get_info_fct(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_GET_DISPOSITIONS); |
| 406 | getdispositions = (device_getdispositions_func) mess_device_get_info_fct(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_GET_DISPOSITIONS); |
| 407 | 407 | if (getdispositions != NULL) |
| 408 | 408 | { |
| 409 | 409 | getdispositions(&mess_device->io_device, i, &readable, &writeable, &creatable); |
src/mess/device.h
| r2189 | r2190 | |
| 91 | 91 | |
| 92 | 92 | struct IODevice; |
| 93 | 93 | |
| 94 | | typedef int (*device_load_handler)(const device_config *image); |
| 95 | | typedef int (*device_create_handler)(const device_config *image, int format_type, option_resolution *format_options); |
| 96 | | typedef void (*device_unload_handler)(const device_config *image); |
| 97 | | typedef int (*device_verify_handler)(const UINT8 *buf, size_t size); |
| 98 | | typedef void (*device_partialhash_handler)(char *, const unsigned char *, unsigned long, unsigned int); |
| 99 | | typedef void (*device_getdispositions_handler)(const struct IODevice *dev, int id, |
| 94 | typedef int (*device_image_load_func)(const device_config *image); |
| 95 | typedef int (*device_image_create_func)(const device_config *image, int format_type, option_resolution *format_options); |
| 96 | typedef void (*device_image_unload_func)(const device_config *image); |
| 97 | typedef int (*device_image_verify_func)(const UINT8 *buf, size_t size); |
| 98 | typedef void (*device_image_partialhash_func)(char *, const unsigned char *, unsigned long, unsigned int); |
| 99 | typedef void (*device_getdispositions_func)(const struct IODevice *dev, int id, |
| 100 | 100 | unsigned int *readable, unsigned int *writeable, unsigned int *creatable); |
| 101 | | typedef void (*device_display_handler)(const device_config *image); |
| 102 | | typedef const char *(*device_getname_handler)(const struct IODevice *dev, int id, char *buf, size_t bufsize); |
| 101 | typedef void (*device_display_func)(const device_config *image); |
| 102 | typedef const char *(*device_getname_func)(const struct IODevice *dev, int id, char *buf, size_t bufsize); |
| 103 | 103 | |
| 104 | 104 | struct _mess_device_class; |
| 105 | 105 | struct _machine_config; |
| r2189 | r2190 | |
| 114 | 114 | |
| 115 | 115 | device_start_func start; |
| 116 | 116 | device_stop_func stop; |
| 117 | | device_load_handler load; |
| 118 | | device_create_handler create; |
| 119 | | device_unload_handler unload; |
| 117 | device_image_load_func load; |
| 118 | device_image_create_func create; |
| 119 | device_image_unload_func unload; |
| 120 | 120 | |
| 121 | | device_partialhash_handler partialhash; |
| 122 | | device_verify_handler imgverify; |
| 123 | | device_getdispositions_handler getdispositions; |
| 121 | device_image_partialhash_func partialhash; |
| 122 | device_image_verify_func imgverify; |
| 123 | device_getdispositions_func getdispositions; |
| 124 | 124 | |
| 125 | | device_display_handler display; |
| 126 | | device_getname_handler name; |
| 125 | device_display_func display; |
| 126 | device_getname_func name; |
| 127 | 127 | |
| 128 | 128 | int (*validity_check)(const struct _mess_device_class *devclass); |
| 129 | 129 | }; |
| r2189 | r2190 | |
| 259 | 259 | /* image handling callbacks */ |
| 260 | 260 | device_start_func start; |
| 261 | 261 | device_stop_func stop; |
| 262 | | device_load_handler load; |
| 263 | | device_create_handler create; |
| 264 | | device_unload_handler unload; |
| 262 | device_image_load_func load; |
| 263 | device_image_create_func create; |
| 264 | device_image_unload_func unload; |
| 265 | 265 | int (*imgverify)(const UINT8 *buf, size_t size); |
| 266 | | device_partialhash_handler partialhash; |
| 266 | device_image_partialhash_func partialhash; |
| 267 | 267 | |
| 268 | 268 | /* cosmetic/UI callbacks */ |
| 269 | 269 | void (*display)(const device_config *img); |