void cassette_device_getinfo(const device_class *devclass, UINT32 state, union devinfo *info) { char *s; int i; const struct CassetteFormat **formats; switch(state) { /* --- the following bits of info are returned as 64-bit signed integers --- */ case DEVINFO_INT_TYPE: info->i = IO_CASSETTE; break; case DEVINFO_INT_READABLE: info->i = 1; break; case DEVINFO_INT_WRITEABLE: info->i = 1; break; case DEVINFO_INT_CREATABLE: info->i = 1; break; case DEVINFO_INT_CASSETTE_DEFAULT_STATE: info->i = CASSETTE_PLAY; break; /* --- the following bits of info are returned as pointers to data or functions --- */ case DEVINFO_PTR_INIT: info->init = device_init_cassette; break; case DEVINFO_PTR_LOAD: info->load = device_load_cassette; break; case DEVINFO_PTR_UNLOAD: info->unload = device_unload_cassette; break; case DEVINFO_PTR_DISPLAY: info->display = device_display_cassette; break; case DEVINFO_PTR_CASSETTE_FORMATS: info->p = (void *) cassette_default_formats; break; /* --- the following bits of info are returned as NULL-terminated strings --- */ case DEVINFO_STR_DEV_FILE: strcpy(info->s = device_temp_str(), __FILE__); break; case DEVINFO_STR_FILE_EXTENSIONS: formats = device_get_info_ptr(devclass, DEVINFO_PTR_CASSETTE_FORMATS); info->s = s = device_temp_str(); s[0] = '\0'; s[1] = '\0'; for (i = 0; formats[i]; i++) specify_extension(s, 256, formats[i]->extensions); while(s[strlen(s) + 1] != '\0') { s += strlen(s); *(s++) = ','; } break; } }
void floppy_device_getinfo(const device_class *devclass, UINT32 state, union devinfo *info) { char *s; int i, count; const struct FloppyFormat *floppy_options; switch(state) { /* --- the following bits of info are returned as 64-bit signed integers --- */ case DEVINFO_INT_TYPE: info->i = IO_FLOPPY; break; case DEVINFO_INT_READABLE: info->i = 1; break; case DEVINFO_INT_WRITEABLE: info->i = 1; break; case DEVINFO_INT_CREATABLE: floppy_options = device_get_info_ptr(devclass, DEVINFO_PTR_FLOPPY_OPTIONS); info->i = floppy_options->param_guidelines ? 1 : 0; break; case DEVINFO_INT_CREATE_OPTCOUNT: /* count total floppy options */ floppy_options = device_get_info_ptr(devclass, DEVINFO_PTR_FLOPPY_OPTIONS); for (count = 0; floppy_options[count].construct; count++) ; info->i = count; break; /* --- the following bits of info are returned as NULL-terminated strings --- */ case DEVINFO_STR_FILE_EXTENSIONS: floppy_options = device_get_info_ptr(devclass, DEVINFO_PTR_FLOPPY_OPTIONS); s = device_temp_str(); info->s = s; s[0] = '\0'; s[1] = '\0'; for (i = 0; floppy_options[i].construct; i++) specify_extension(s, 256, floppy_options[i].extensions); while(s[strlen(s) + 1] != '\0') { s += strlen(s); *(s++) = ','; } break; /* --- the following bits of info are returned as pointers to data or functions --- */ case DEVINFO_PTR_INIT: info->init = device_init_floppy; break; case DEVINFO_PTR_LOAD: info->load = device_load_floppy; break; case DEVINFO_PTR_CREATE: info->create = device_create_floppy; break; case DEVINFO_PTR_UNLOAD: info->unload = device_unload_floppy; break; case DEVINFO_PTR_CREATE_OPTGUIDE: info->p = (void *) floppy_option_guide; break; default: floppy_options = device_get_info_ptr(devclass, DEVINFO_PTR_FLOPPY_OPTIONS); if ((state >= DEVINFO_STR_CREATE_OPTNAME) && (state < DEVINFO_STR_CREATE_OPTNAME + DEVINFO_CREATE_OPTMAX)) { info->s = (void *) floppy_options[state - DEVINFO_STR_CREATE_OPTNAME].name; } else if ((state >= DEVINFO_STR_CREATE_OPTDESC) && (state < DEVINFO_STR_CREATE_OPTDESC + DEVINFO_CREATE_OPTMAX)) { info->s = (void *) floppy_options[state - DEVINFO_STR_CREATE_OPTDESC].description; } else if ((state >= DEVINFO_STR_CREATE_OPTEXTS) && (state < DEVINFO_STR_CREATE_OPTEXTS + DEVINFO_CREATE_OPTMAX)) { info->s = (void *) floppy_options[state - DEVINFO_STR_CREATE_OPTEXTS].extensions; } else if ((state >= DEVINFO_PTR_CREATE_OPTSPEC) && (state < DEVINFO_PTR_CREATE_OPTSPEC + DEVINFO_CREATE_OPTMAX)) { info->p = (void *) floppy_options[state - DEVINFO_PTR_CREATE_OPTSPEC].param_guidelines; } break; } }