src/emu/diimage.h
| r8420 | r8421 | |
| 115 | 115 | typedef void (*device_image_display_func)(device_image_interface &image); |
| 116 | 116 | typedef void (*device_image_partialhash_func)(char *, const unsigned char *, unsigned long, unsigned int); |
| 117 | 117 | typedef void (*device_image_get_devices_func)(device_image_interface &device); |
| 118 | typedef bool (*device_image_softlist_load_func)(device_image_interface &image, char *swlist, char *swname, rom_entry *start_entry); |
| 118 | 119 | |
| 119 | | |
| 120 | 120 | //************************************************************************** |
| 121 | 121 | // MACROS |
| 122 | 122 | //************************************************************************** |
| r8420 | r8421 | |
| 141 | 141 | #define DEVICE_IMAGE_GET_DEVICES_NAME(name) device_image_get_devices_##name |
| 142 | 142 | #define DEVICE_IMAGE_GET_DEVICES(name) void DEVICE_IMAGE_GET_DEVICES_NAME(name)(device_image_interface &image) |
| 143 | 143 | |
| 144 | #define DEVICE_IMAGE_SOFTLIST_LOAD_NAME(name) device_softlist_load_##name |
| 145 | #define DEVICE_IMAGE_SOFTLIST_LOAD(name) bool DEVICE_IMAGE_SOFTLIST_LOAD_NAME(name)(device_image_interface &image, char *swlist, char *swname, rom_entry *start_entry) |
| 144 | 146 | |
| 145 | 147 | // ======================> device_config_image_interface |
| 146 | 148 | |
| r8420 | r8421 | |
| 200 | 202 | virtual void unload() = 0; |
| 201 | 203 | |
| 202 | 204 | virtual int call_load() = 0; |
| 205 | virtual bool call_softlist_load(char *swlist, char *swname, rom_entry *start_entry) = 0; |
| 203 | 206 | virtual int call_create(int format_type, option_resolution *format_options) = 0; |
| 204 | 207 | virtual void call_unload() = 0; |
| 205 | 208 | virtual void call_display() = 0; |
| r8420 | r8421 | |
| 234 | 237 | UINT64 ftell() { check_for_file(); return core_ftell(m_file); } |
| 235 | 238 | int fgetc() { char ch; if (fread(&ch, 1) != 1) ch = '\0'; return ch; } |
| 236 | 239 | char *fgets(char *buffer, UINT32 length) { check_for_file(); return core_fgets(buffer, length, m_file); } |
| 237 | | int feof() { check_for_file(); return core_feof(m_file); } |
| 240 | int image_feof() { check_for_file(); return core_feof(m_file); } |
| 238 | 241 | void *ptr() {check_for_file(); return (void *) core_fbuffer(m_file); } |
| 239 | 242 | // configuration access |
| 240 | 243 | const device_config_image_interface &image_config() const { return m_image_config; } |
src/emu/devlegcy.h
| r8420 | r8421 | |
| 159 | 159 | DEVINFO_FCT_IMAGE_DISPLAY, /* R/O: device_image_display_func */ |
| 160 | 160 | DEVINFO_FCT_IMAGE_PARTIAL_HASH, /* R/O: device_image_partialhash_func */ |
| 161 | 161 | DEVINFO_FCT_IMAGE_GET_DEVICES, /* R/O: device_image_get_devices_func */ |
| 162 | DEVINFO_FCT_IMAGE_SOFTLIST_LOAD, /* R/O: device_image_softlist_load_func */ |
| 162 | 163 | DEVINFO_FCT_IMAGE_LAST = DEVINFO_FCT_FIRST + 0x0fff, |
| 163 | 164 | |
| 164 | 165 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| r8420 | r8421 | |
| 633 | 634 | virtual bool create(const char *path, const image_device_format *create_format, option_resolution *create_args); |
| 634 | 635 | |
| 635 | 636 | virtual int call_load(); |
| 637 | virtual bool call_softlist_load(char *swlist, char *swname, rom_entry *start_entry); |
| 636 | 638 | virtual int call_create(int format_type, option_resolution *format_options); |
| 637 | 639 | virtual void call_unload(); |
| 638 | 640 | virtual void call_display(); |
src/emu/softlist.c
| r8420 | r8421 | |
| 1087 | 1087 | { |
| 1088 | 1088 | /* Load the software part */ |
| 1089 | 1089 | try { |
| 1090 | | load_software_part_region( &image->device(), (char *)swlist_name, (char *)software_info_ptr->shortname, software_part_ptr->romdata ); |
| 1090 | result = image->call_softlist_load((char *)swlist_name, (char *)software_info_ptr->shortname, software_part_ptr->romdata ); |
| 1091 | 1091 | } |
| 1092 | 1092 | catch (emu_fatalerror &fatal) |
| 1093 | 1093 | { |
| r8420 | r8421 | |
| 1136 | 1136 | |
| 1137 | 1137 | /* Tell the world which part we actually loaded */ |
| 1138 | 1138 | *full_sw_name = auto_alloc_array( image->device().machine, char, strlen(swlist_name) + strlen(software_info_ptr->shortname) + strlen(software_part_ptr->name) + 3 ); |
| 1139 | | sprintf( *full_sw_name, "%s:%s:%s", swlist_name, software_info_ptr->shortname, software_part_ptr->name ); |
| 1140 | | |
| 1141 | | result = true; |
| 1139 | sprintf( *full_sw_name, "%s:%s:%s", swlist_name, software_info_ptr->shortname, software_part_ptr->name ); |
| 1142 | 1140 | } |
| 1143 | 1141 | |
| 1144 | 1142 | /* Close the software list if it's still open */ |
src/emu/devimage.c
| r8420 | r8421 | |
| 303 | 303 | image_error_t err; |
| 304 | 304 | UINT32 open_plan[4]; |
| 305 | 305 | int i; |
| 306 | bool softload = FALSE; |
| 306 | 307 | |
| 307 | 308 | /* first unload the image */ |
| 308 | 309 | unload(); |
| r8420 | r8421 | |
| 319 | 320 | goto done; |
| 320 | 321 | |
| 321 | 322 | /* Check if there's a software list defined for this device and use that if we're not creating an image */ |
| 322 | | if (is_create || !load_software_part( this, path, &m_software_info_ptr, &m_software_part_ptr, &m_full_software_name ) ) |
| 323 | if (is_create || !(softload=load_software_part( this, path, &m_software_info_ptr, &m_software_part_ptr, &m_full_software_name )) ) |
| 323 | 324 | { |
| 324 | 325 | /* determine open plan */ |
| 325 | 326 | determine_open_plan(is_create, open_plan); |
| r8420 | r8421 | |
| 333 | 334 | goto done; |
| 334 | 335 | } |
| 335 | 336 | } |
| 336 | | |
| 337 | |
| 337 | 338 | /* Copy some image information when we have been loaded through a software list */ |
| 338 | 339 | if ( m_software_info_ptr ) |
| 339 | 340 | { |
| r8420 | r8421 | |
| 344 | 345 | } |
| 345 | 346 | |
| 346 | 347 | /* did we fail to find the file? */ |
| 347 | | if (!is_loaded()) |
| 348 | if (!is_loaded() && !softload) |
| 348 | 349 | { |
| 349 | 350 | err = IMAGE_ERROR_FILENOTFOUND; |
| 350 | 351 | goto done; |
| r8420 | r8421 | |
| 502 | 503 | } |
| 503 | 504 | } |
| 504 | 505 | |
| 506 | bool legacy_image_device_base::call_softlist_load(char *swlist, char *swname, rom_entry *start_entry) |
| 507 | { |
| 508 | device_image_softlist_load_func func = reinterpret_cast<device_image_softlist_load_func>(m_config.get_legacy_config_fct(DEVINFO_FCT_IMAGE_SOFTLIST_LOAD)); |
| 509 | if (func) { |
| 510 | return (*func)(*this,swlist,swname,start_entry); |
| 511 | } else { |
| 512 | return FALSE; |
| 513 | } |
| 514 | } |
| 515 | |
| 505 | 516 | int legacy_image_device_base::call_create(int format_type, option_resolution *format_options) |
| 506 | 517 | { |
| 507 | 518 | device_image_create_func func = reinterpret_cast<device_image_create_func>(m_config.get_legacy_config_fct(DEVINFO_FCT_IMAGE_CREATE)); |
src/mess/devices/snapquik.h
| r8420 | r8421 | |
| 57 | 57 | const char * file_extensions; /* file extensions */ |
| 58 | 58 | seconds_t delay_seconds; /* loading delay (seconds) */ |
| 59 | 59 | attoseconds_t delay_attoseconds; /* loading delay (attoseconds) */ |
| 60 | | const char * interface; |
| 61 | 60 | }; |
| 62 | 61 | |
| 63 | 62 | |
| r8420 | r8421 | |
| 73 | 72 | MDRV_DEVICE_CONFIG_DATA64(snapquick_config, delay_seconds, (seconds_t) (_delay)) \ |
| 74 | 73 | MDRV_DEVICE_CONFIG_DATA64(snapquick_config, delay_attoseconds, (attoseconds_t) (((_delay) - (int)(_delay)) * ATTOSECONDS_PER_SECOND)) \ |
| 75 | 74 | |
| 76 | | #define MDRV_SNAPSHOT_INTERFACE(_interface) \ |
| 77 | | MDRV_DEVICE_CONFIG_DATAPTR(snapquick_config, interface, _interface ) |
| 78 | | |
| 79 | | |
| 80 | 75 | /*************************************************************************** |
| 81 | 76 | QUICKLOAD DEVICE CONFIGURATION MACROS |
| 82 | 77 | ***************************************************************************/ |
| r8420 | r8421 | |
| 88 | 83 | MDRV_DEVICE_CONFIG_DATA64(snapquick_config, delay_seconds, (seconds_t) (_delay)) \ |
| 89 | 84 | MDRV_DEVICE_CONFIG_DATA64(snapquick_config, delay_attoseconds, (attoseconds_t) (((_delay) - (int)(_delay)) * ATTOSECONDS_PER_SECOND)) \ |
| 90 | 85 | |
| 91 | | #define MDRV_QUICKLOAD_INTERFACE(_interface) \ |
| 92 | | MDRV_DEVICE_CONFIG_DATAPTR(snapquick_config, interface, _interface ) |
| 93 | | |
| 94 | | |
| 95 | | |
| 96 | 86 | /*************************************************************************** |
| 97 | 87 | FUNCTION PROTOTYPES |
| 98 | 88 | ***************************************************************************/ |
src/mess/devices/cassette.c
| r8420 | r8421 | |
| 396 | 396 | ui_draw_text_box(render_container_get_ui(), buf, JUSTIFY_LEFT, x, y, UI_BACKGROUND_COLOR); |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | /*------------------------------------------------- |
| 400 | DEVICE_IMAGE_SOFTLIST_LOAD(cassette) |
| 401 | -------------------------------------------------*/ |
| 402 | static DEVICE_IMAGE_SOFTLIST_LOAD(cassette) |
| 403 | { |
| 404 | return FALSE; |
| 405 | } |
| 399 | 406 | |
| 400 | 407 | DEVICE_GET_INFO(cassette) |
| 401 | 408 | { |
| r8420 | r8421 | |
| 414 | 421 | case DEVINFO_FCT_IMAGE_LOAD: info->f = (genf *) DEVICE_IMAGE_LOAD_NAME(cassette); break; |
| 415 | 422 | case DEVINFO_FCT_IMAGE_UNLOAD: info->f = (genf *) DEVICE_IMAGE_UNLOAD_NAME(cassette); break; |
| 416 | 423 | case DEVINFO_FCT_IMAGE_DISPLAY: info->f = (genf *) DEVICE_IMAGE_DISPLAY_NAME(cassette); break; |
| 424 | case DEVINFO_FCT_IMAGE_SOFTLIST_LOAD: info->f = (genf *) DEVICE_IMAGE_SOFTLIST_LOAD_NAME(cassette); break; |
| 417 | 425 | |
| 418 | 426 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 419 | 427 | case DEVINFO_STR_NAME: strcpy(info->s, "Cassette"); break; |
src/mess/devices/flopdrv.c
| r8420 | r8421 | |
| 993 | 993 | return !floppy_get_heads_per_disk(drive->floppy); |
| 994 | 994 | } |
| 995 | 995 | |
| 996 | /*------------------------------------------------- |
| 997 | DEVICE_IMAGE_SOFTLIST_LOAD(floppy) |
| 998 | -------------------------------------------------*/ |
| 999 | static DEVICE_IMAGE_SOFTLIST_LOAD(floppy) |
| 1000 | { |
| 1001 | return FALSE; |
| 1002 | } |
| 1003 | |
| 996 | 1004 | /************************************* |
| 997 | 1005 | * |
| 998 | 1006 | * Device specification function |
| r8420 | r8421 | |
| 1036 | 1044 | case DEVINFO_FCT_IMAGE_CREATE: info->f = (genf *) DEVICE_IMAGE_CREATE_NAME(floppy); break; |
| 1037 | 1045 | case DEVINFO_FCT_IMAGE_LOAD: info->f = (genf *) DEVICE_IMAGE_LOAD_NAME(floppy); break; |
| 1038 | 1046 | case DEVINFO_FCT_IMAGE_UNLOAD: info->f = (genf *) DEVICE_IMAGE_UNLOAD_NAME(floppy); break; |
| 1047 | case DEVINFO_FCT_IMAGE_SOFTLIST_LOAD: info->f = (genf *) DEVICE_IMAGE_SOFTLIST_LOAD_NAME(floppy); break; |
| 1039 | 1048 | case DEVINFO_PTR_IMAGE_CREATE_OPTGUIDE: info->p = (void *)floppy_option_guide; break; |
| 1040 | 1049 | case DEVINFO_INT_IMAGE_CREATE_OPTCOUNT: |
| 1041 | 1050 | { |
src/mess/devices/cartslot.c
| r8420 | r8421 | |
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | /*------------------------------------------------- |
| 402 | DEVICE_IMAGE_SOFTLIST_LOAD(cartslot) |
| 403 | -------------------------------------------------*/ |
| 404 | static DEVICE_IMAGE_SOFTLIST_LOAD(cartslot) |
| 405 | { |
| 406 | load_software_part_region( &image.device(), swlist, swname, start_entry ); |
| 407 | return TRUE; |
| 408 | } |
| 401 | 409 | |
| 402 | 410 | /*------------------------------------------------- |
| 403 | 411 | DEVICE_GET_INFO( cartslot ) |
| r8420 | r8421 | |
| 428 | 436 | case DEVINFO_FCT_IMAGE_LOAD: info->f = (genf *) DEVICE_IMAGE_LOAD_NAME(cartslot); break; |
| 429 | 437 | case DEVINFO_FCT_IMAGE_UNLOAD: info->f = (genf *) DEVICE_IMAGE_UNLOAD_NAME(cartslot); break; |
| 430 | 438 | case DEVINFO_FCT_IMAGE_GET_DEVICES: info->f = (genf *) DEVICE_IMAGE_GET_DEVICES_NAME(cartslot); break; |
| 439 | case DEVINFO_FCT_IMAGE_SOFTLIST_LOAD: info->f = (genf *) DEVICE_IMAGE_SOFTLIST_LOAD_NAME(cartslot); break; |
| 431 | 440 | case DEVINFO_FCT_IMAGE_PARTIAL_HASH: |
| 432 | 441 | if ( device && downcast<const legacy_image_device_config_base *>(device)->inline_config() && get_config_dev(device)->device_partialhash) { |
| 433 | 442 | info->f = (genf *) get_config_dev(device)->device_partialhash; |
src/mess/devices/kermit.c
| r8420 | r8421 | |
| 223 | 223 | for ( len = 2; len < state->maxl-2; len++ ) |
| 224 | 224 | { |
| 225 | 225 | UINT8 c; |
| 226 | | if ( state->image->feof() ) break; |
| 226 | if ( state->image->image_feof() ) break; |
| 227 | 227 | c = state->image->fgetc(); |
| 228 | 228 | if ( kermit_is_ctl( c ) ) |
| 229 | 229 | { |
| r8420 | r8421 | |
| 552 | 552 | |
| 553 | 553 | case KERMIT_SEND_DATA: |
| 554 | 554 | /* send next data packet or EOF */ |
| 555 | | if ( state->image->feof() ) |
| 555 | if ( state->image->image_feof() ) |
| 556 | 556 | { |
| 557 | 557 | kermit_send_simple_packet( state, KERMIT_EOF ); |
| 558 | 558 | state->state = KERMIT_SEND_EOF; |