Previous 15994 Revisions Next

r2190 Tuesday 1st April, 2008 at 00:28:06 UTC by Nathan Woods
Changed device/image callback names to follow MAME conventions
[src/mess]device.c device.h
[src/mess/devices]appldriv.c idedrive.c sonydriv.c
[src/mess/osd/winui]softwarepicker.c

src/mess/devices/sonydriv.c
r2189r2190
491491static DEVICE_IMAGE_UNLOAD( sonydriv_floppy )
492492{
493493   int id;
494   device_unload_handler parent_unload;
494   device_image_unload_func parent_unload;
495495
496496   id = image_index_in_device(image);
497497   save_track_data(id);
498498   memset(&sony_floppy[id], 0, sizeof(sony_floppy[id]));
499499
500   parent_unload = (device_unload_handler) mess_device_get_info_fct(&parent_devclass, MESS_DEVINFO_PTR_UNLOAD);
500   parent_unload = (device_image_unload_func) mess_device_get_info_fct(&parent_devclass, MESS_DEVINFO_PTR_UNLOAD);
501501   parent_unload(image);
502502}
503503
src/mess/devices/idedrive.c
r2189r2190
1717static void ide_get_params(const device_config *image, int *which_bus, int *which_address,
1818   struct ide_interface **intf,
1919   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)
2222{
2323   const mess_device_class *devclass = &image_device(image)->devclass;
2424   mess_device_class parent_devclass;
r2189r2190
3333   if (parent_init)
3434      *parent_init = (device_start_func) mess_device_get_info_fct(&parent_devclass, MESS_DEVINFO_PTR_START);
3535   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);
3737   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);
3939
4040   assert(*which_address == 0);
4141   assert(*intf);
r2189r2190
7373{
7474   int result, which_bus, which_address;
7575   struct ide_interface *intf;
76   device_load_handler parent_load;
76   device_image_load_func parent_load;
7777
7878   /* get the basics */
7979   ide_get_params(image, &which_bus, &which_address, &intf, NULL, &parent_load, NULL);
r2189r2190
9999{
100100   int which_bus, which_address;
101101   struct ide_interface *intf;
102   device_unload_handler parent_unload;
102   device_image_unload_func parent_unload;
103103
104104   /* get the basics */
105105   ide_get_params(image, &which_bus, &which_address, &intf, NULL, NULL, &parent_unload);
src/mess/devices/appldriv.c
r2189r2190
291291static DEVICE_IMAGE_LOAD( apple525_floppy )
292292{
293293   int result;
294   device_load_handler parent_load;
294   device_image_load_func parent_load;
295295
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);
297297   result = parent_load(image);
298298
299299   floppy_drive_seek(image, -999);
r2189r2190
305305
306306static DEVICE_IMAGE_UNLOAD( apple525_floppy )
307307{
308   device_unload_handler parent_unload;
308   device_image_unload_func parent_unload;
309309
310310   apple525_save_current_track(image, TRUE);
311311
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);
313313   parent_unload(image);
314314}
315315
src/mess/device.c
r2189r2190
293293   int i, j, count;
294294   size_t string_buffer_pos = 0;
295295   int createimage_optcount;
296   device_getdispositions_handler getdispositions;
296   device_getdispositions_func getdispositions;
297297   unsigned int readable, writeable, creatable;
298298
299299   /* set up MESS's device class */
r2189r2190
363363
364364      mess_device->io_device.start            = (device_start_func) mess_device_get_info_fct(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_START);
365365      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);
371371
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);
373373      mess_device->io_device.name               = default_device_name;
374374
375375      mess_device->io_device.createimage_optguide   = (const struct OptionGuide *) mess_device_get_info_ptr(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_CREATE_OPTGUIDE);
r2189r2190
403403      }
404404
405405      /* 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);
407407      if (getdispositions != NULL)
408408      {
409409         getdispositions(&mess_device->io_device, i, &readable, &writeable, &creatable);
src/mess/device.h
r2189r2190
9191
9292struct IODevice;
9393
94typedef int (*device_load_handler)(const device_config *image);
95typedef int (*device_create_handler)(const device_config *image, int format_type, option_resolution *format_options);
96typedef void (*device_unload_handler)(const device_config *image);
97typedef int (*device_verify_handler)(const UINT8 *buf, size_t size);
98typedef void (*device_partialhash_handler)(char *, const unsigned char *, unsigned long, unsigned int);
99typedef void (*device_getdispositions_handler)(const struct IODevice *dev, int id,
94typedef int (*device_image_load_func)(const device_config *image);
95typedef int (*device_image_create_func)(const device_config *image, int format_type, option_resolution *format_options);
96typedef void (*device_image_unload_func)(const device_config *image);
97typedef int (*device_image_verify_func)(const UINT8 *buf, size_t size);
98typedef void (*device_image_partialhash_func)(char *, const unsigned char *, unsigned long, unsigned int);
99typedef void (*device_getdispositions_func)(const struct IODevice *dev, int id,
100100   unsigned int *readable, unsigned int *writeable, unsigned int *creatable);
101typedef void (*device_display_handler)(const device_config *image);
102typedef const char *(*device_getname_handler)(const struct IODevice *dev, int id, char *buf, size_t bufsize);
101typedef void (*device_display_func)(const device_config *image);
102typedef const char *(*device_getname_func)(const struct IODevice *dev, int id, char *buf, size_t bufsize);
103103
104104struct _mess_device_class;
105105struct _machine_config;
r2189r2190
114114
115115   device_start_func start;
116116   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;
120120
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;
124124
125   device_display_handler display;
126   device_getname_handler name;
125   device_display_func display;
126   device_getname_func name;
127127
128128   int (*validity_check)(const struct _mess_device_class *devclass);
129129};
r2189r2190
259259   /* image handling callbacks */
260260   device_start_func start;
261261   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;
265265   int (*imgverify)(const UINT8 *buf, size_t size);
266   device_partialhash_handler partialhash;
266   device_image_partialhash_func partialhash;
267267
268268   /* cosmetic/UI callbacks */
269269   void (*display)(const device_config *img);
src/mess/osd/winui/softwarepicker.c
r2189r2190
253253{
254254   unsigned int nFunctions;
255255   iodevice_t type;
256   device_partialhash_handler partialhash;
256   device_image_partialhash_func partialhash;
257257
258258   type = (iodevice_t) (int) mess_device_get_info_int(&pFileInfo->devclass, MESS_DEVINFO_INT_TYPE);
259   partialhash = (device_partialhash_handler) mess_device_get_info_fct(&pFileInfo->devclass, MESS_DEVINFO_PTR_PARTIAL_HASH);
259   partialhash = (device_image_partialhash_func) mess_device_get_info_fct(&pFileInfo->devclass, MESS_DEVINFO_PTR_PARTIAL_HASH);
260260
261261   nFunctions = hashfile_functions_used(pPickerInfo->pHashFile, type);
262262

Previous 15994 Revisions Next


© 1998-2018 The MESS Team