src/emu/imagedev/cartslot.h
| r13973 | r13974 | |
| 22 | 22 | #define ROM_FILL_FF 0x04000000 |
| 23 | 23 | #define ROM_NOCLEAR 0x08000000 |
| 24 | 24 | |
| 25 | | DECLARE_LEGACY_IMAGE_DEVICE(CARTSLOT, cartslot); |
| 26 | | |
| 27 | | |
| 28 | | |
| 29 | 25 | /*************************************************************************** |
| 30 | 26 | TYPE DEFINITIONS |
| 31 | 27 | ***************************************************************************/ |
| 32 | 28 | |
| 33 | | typedef struct _cartslot_config cartslot_config; |
| 34 | | struct _cartslot_config |
| 29 | // ======================> cartslot_image_device |
| 30 | |
| 31 | class cartslot_image_device : public device_t, |
| 32 | public device_image_interface |
| 35 | 33 | { |
| 36 | | const char * extensions; |
| 37 | | const char * interface; |
| 38 | | int must_be_loaded; |
| 39 | | device_start_func device_start; |
| 40 | | device_image_load_func device_load; |
| 41 | | device_image_unload_func device_unload; |
| 42 | | device_image_partialhash_func device_partialhash; |
| 43 | | device_image_display_info_func device_displayinfo; |
| 34 | public: |
| 35 | // construction/destruction |
| 36 | cartslot_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 37 | virtual ~cartslot_image_device(); |
| 38 | |
| 39 | // image-level overrides |
| 40 | virtual bool call_load(); |
| 41 | virtual void call_unload(); |
| 42 | virtual void call_display_info() { if (m_device_displayinfo) m_device_displayinfo(*this); } |
| 43 | virtual bool call_softlist_load(char *swlist, char *swname, rom_entry *start_entry) { load_software_part_region( this, swlist, swname, start_entry ); return TRUE; } |
| 44 | virtual device_image_partialhash_func get_partial_hash() const { return m_device_partialhash; } |
| 45 | |
| 46 | virtual iodevice_t image_type() const { return IO_CARTSLOT; } |
| 47 | |
| 48 | virtual bool is_readable() const { return 1; } |
| 49 | virtual bool is_writeable() const { return 0; } |
| 50 | virtual bool is_creatable() const { return 0; } |
| 51 | virtual bool must_be_loaded() const { return m_must_be_loaded; } |
| 52 | virtual bool is_reset_on_load() const { return 1; } |
| 53 | virtual const char *image_interface() const { return m_interface; } |
| 54 | virtual const char *file_extensions() const { return m_extensions; } |
| 55 | virtual const option_guide *create_option_guide() const { return NULL; } |
| 56 | |
| 57 | void set_extensions(const char *_extensions) { m_extensions = _extensions; } |
| 58 | void set_interface(const char *_interface) { m_interface = _interface; } |
| 59 | void set_must_be_loaded(bool _must_be_loaded) { m_must_be_loaded = _must_be_loaded; } |
| 60 | void set_device_start(device_start_func _start) { m_device_start = _start; } |
| 61 | void set_device_load(device_image_load_func _load) { m_device_load = _load; } |
| 62 | void set_device_unload(device_image_unload_func _unload) { m_device_unload = _unload; } |
| 63 | void set_partialhash(device_image_partialhash_func _partialhash) { m_device_partialhash = _partialhash; } |
| 64 | void set_displayinfo(device_image_display_info_func _displayinfo) { m_device_displayinfo = _displayinfo; } |
| 65 | |
| 66 | protected: |
| 67 | // device-level overrides |
| 68 | virtual void device_config_complete(); |
| 69 | virtual void device_start(); |
| 70 | |
| 71 | int load_cartridge(const rom_entry *romrgn, const rom_entry *roment, bool load); |
| 72 | int process_cartridge(bool load); |
| 73 | |
| 74 | |
| 75 | const char * m_extensions; |
| 76 | const char * m_interface; |
| 77 | bool m_must_be_loaded; |
| 78 | device_start_func m_device_start; |
| 79 | device_image_load_func m_device_load; |
| 80 | device_image_unload_func m_device_unload; |
| 81 | device_image_partialhash_func m_device_partialhash; |
| 82 | device_image_display_info_func m_device_displayinfo; |
| 44 | 83 | }; |
| 45 | 84 | |
| 85 | // device type definition |
| 86 | extern const device_type CARTSLOT; |
| 46 | 87 | |
| 47 | 88 | /*************************************************************************** |
| 48 | 89 | DEVICE CONFIGURATION MACROS |
| r13973 | r13974 | |
| 55 | 96 | MCFG_DEVICE_MODIFY(_tag) \ |
| 56 | 97 | |
| 57 | 98 | #define MCFG_CARTSLOT_EXTENSION_LIST(_extensions) \ |
| 58 | | MCFG_DEVICE_CONFIG_DATAPTR(cartslot_config, extensions, _extensions) |
| 99 | static_cast<cartslot_image_device *>(device)->set_extensions(_extensions); |
| 59 | 100 | |
| 101 | #define MCFG_CARTSLOT_INTERFACE(_interface) \ |
| 102 | static_cast<cartslot_image_device *>(device)->set_interface(_interface); |
| 103 | |
| 60 | 104 | #define MCFG_CARTSLOT_NOT_MANDATORY \ |
| 61 | | MCFG_DEVICE_CONFIG_DATA32(cartslot_config, must_be_loaded, FALSE) |
| 105 | static_cast<cartslot_image_device *>(device)->set_must_be_loaded(FALSE); |
| 62 | 106 | |
| 63 | 107 | #define MCFG_CARTSLOT_MANDATORY \ |
| 64 | | MCFG_DEVICE_CONFIG_DATA32(cartslot_config, must_be_loaded, TRUE) |
| 108 | static_cast<cartslot_image_device *>(device)->set_must_be_loaded(TRUE); |
| 65 | 109 | |
| 66 | 110 | #define MCFG_CARTSLOT_START(_start) \ |
| 67 | | MCFG_DEVICE_CONFIG_DATAPTR(cartslot_config, device_start, DEVICE_START_NAME(_start)) |
| 111 | static_cast<cartslot_image_device *>(device)->set_device_start(DEVICE_START_NAME(_start)); |
| 68 | 112 | |
| 69 | 113 | #define MCFG_CARTSLOT_LOAD(_load) \ |
| 70 | | MCFG_DEVICE_CONFIG_DATAPTR(cartslot_config, device_load, DEVICE_IMAGE_LOAD_NAME(_load)) |
| 114 | static_cast<cartslot_image_device *>(device)->set_device_load(DEVICE_IMAGE_LOAD_NAME(_load)); |
| 71 | 115 | |
| 72 | 116 | #define MCFG_CARTSLOT_UNLOAD(_unload) \ |
| 73 | | MCFG_DEVICE_CONFIG_DATAPTR(cartslot_config, device_unload, DEVICE_IMAGE_UNLOAD_NAME(_unload)) |
| 117 | static_cast<cartslot_image_device *>(device)->set_device_unload(DEVICE_IMAGE_UNLOAD_NAME(_unload)); |
| 74 | 118 | |
| 75 | | #define MCFG_CARTSLOT_DISPLAY_INFO(_displayinfo) \ |
| 76 | | MCFG_DEVICE_CONFIG_DATAPTR(cartslot_config, device_displayinfo, DEVICE_IMAGE_DISPLAY_INFO_NAME(_displayinfo)) |
| 77 | | |
| 78 | 119 | #define MCFG_CARTSLOT_PARTIALHASH(_partialhash) \ |
| 79 | | MCFG_DEVICE_CONFIG_DATAPTR(cartslot_config, device_partialhash, _partialhash) |
| 120 | static_cast<cartslot_image_device *>(device)->set_partialhash(_partialhash); |
| 80 | 121 | |
| 81 | | #define MCFG_CARTSLOT_INTERFACE(_interface) \ |
| 82 | | MCFG_DEVICE_CONFIG_DATAPTR(cartslot_config, interface, _interface ) |
| 122 | #define MCFG_CARTSLOT_DISPLAY_INFO(_displayinfo) \ |
| 123 | static_cast<cartslot_image_device *>(device)->set_displayinfo(DEVICE_IMAGE_DISPLAY_INFO_NAME(_displayinfo)); |
| 83 | 124 | |
| 84 | | #endif /* __cart_slot_H__ */ |
| 125 | #endif /* __CARTSLOT_H__ */ |
src/emu/imagedev/cartslot.c
| r13973 | r13974 | |
| 10 | 10 | #include "emu.h" |
| 11 | 11 | #include "cartslot.h" |
| 12 | 12 | |
| 13 | | /*************************************************************************** |
| 14 | | CONSTANTS |
| 15 | | ***************************************************************************/ |
| 16 | 13 | |
| 17 | | enum _process_mode |
| 14 | // device type definition |
| 15 | const device_type CARTSLOT = &device_creator<cartslot_image_device>; |
| 16 | |
| 17 | //------------------------------------------------- |
| 18 | // cartslot_image_device - constructor |
| 19 | //------------------------------------------------- |
| 20 | |
| 21 | cartslot_image_device::cartslot_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 22 | : device_t(mconfig, CARTSLOT, "Cartslot", tag, owner, clock), |
| 23 | device_image_interface(mconfig, *this), |
| 24 | m_extensions("bin"), |
| 25 | m_interface(NULL), |
| 26 | m_must_be_loaded(0), |
| 27 | m_device_start(NULL), |
| 28 | m_device_load(NULL), |
| 29 | m_device_unload(NULL), |
| 30 | m_device_partialhash(NULL), |
| 31 | m_device_displayinfo(NULL) |
| 18 | 32 | { |
| 19 | | PROCESS_CLEAR, |
| 20 | | PROCESS_LOAD |
| 21 | | }; |
| 22 | | typedef enum _process_mode process_mode; |
| 23 | 33 | |
| 34 | } |
| 24 | 35 | |
| 25 | | /*************************************************************************** |
| 26 | | INLINE FUNCTIONS |
| 27 | | ***************************************************************************/ |
| 36 | //------------------------------------------------- |
| 37 | // cartslot_image_device - destructor |
| 38 | //------------------------------------------------- |
| 28 | 39 | |
| 29 | | INLINE const cartslot_config *get_config(const device_t *device) |
| 40 | cartslot_image_device::~cartslot_image_device() |
| 30 | 41 | { |
| 31 | | assert(device != NULL); |
| 32 | | assert(device->type() == CARTSLOT); |
| 33 | | return (const cartslot_config *) downcast<const legacy_device_base *>(device)->inline_config(); |
| 34 | 42 | } |
| 35 | 43 | |
| 44 | //------------------------------------------------- |
| 45 | // device_config_complete - perform any |
| 46 | // operations now that the configuration is |
| 47 | // complete |
| 48 | //------------------------------------------------- |
| 49 | |
| 50 | void cartslot_image_device::device_config_complete() |
| 51 | { |
| 52 | // set brief and instance name |
| 53 | update_names(); |
| 54 | } |
| 55 | |
| 36 | 56 | /*************************************************************************** |
| 37 | 57 | IMPLEMENTATION |
| 38 | 58 | ***************************************************************************/ |
| r13973 | r13974 | |
| 41 | 61 | load_cartridge |
| 42 | 62 | -------------------------------------------------*/ |
| 43 | 63 | |
| 44 | | static int load_cartridge(device_image_interface *image, const rom_entry *romrgn, const rom_entry *roment, process_mode mode) |
| 64 | int cartslot_image_device::load_cartridge(const rom_entry *romrgn, const rom_entry *roment, bool load) |
| 45 | 65 | { |
| 46 | 66 | const char *region; |
| 47 | 67 | const char *type; |
| 48 | 68 | UINT32 flags; |
| 49 | | offs_t offset, length, read_length, pos = 0, len; |
| 69 | offs_t offset, size, read_length, pos = 0, len; |
| 50 | 70 | UINT8 *ptr; |
| 51 | 71 | UINT8 clear_val; |
| 52 | 72 | int datawidth, littleendian, i, j; |
| 53 | 73 | device_t *cpu; |
| 54 | 74 | |
| 55 | 75 | astring regiontag; |
| 56 | | image->device().siblingtag(regiontag, ROMREGION_GETTAG(romrgn)); |
| 76 | device().siblingtag(regiontag, ROMREGION_GETTAG(romrgn)); |
| 57 | 77 | region = regiontag.cstr(); |
| 58 | 78 | offset = ROM_GETOFFSET(roment); |
| 59 | | length = ROM_GETLENGTH(roment); |
| 79 | size = ROM_GETLENGTH(roment); |
| 60 | 80 | flags = ROM_GETFLAGS(roment); |
| 61 | | ptr = ((UINT8 *) image->device().machine().region(region)->base()) + offset; |
| 81 | ptr = ((UINT8 *) device().machine().region(region)->base()) + offset; |
| 62 | 82 | |
| 63 | | if (mode == PROCESS_LOAD) |
| 83 | if (load) |
| 64 | 84 | { |
| 65 | | if (image->software_entry() == NULL) |
| 85 | if (software_entry() == NULL) |
| 66 | 86 | { |
| 67 | 87 | /* must this be full size */ |
| 68 | 88 | if (flags & ROM_FULLSIZE) |
| 69 | 89 | { |
| 70 | | if (image->length() != length) |
| 90 | if (length() != size) |
| 71 | 91 | return IMAGE_INIT_FAIL; |
| 72 | 92 | } |
| 73 | 93 | |
| 74 | 94 | /* read the ROM */ |
| 75 | | pos = read_length = image->fread(ptr, length); |
| 95 | pos = read_length = fread(ptr, size); |
| 76 | 96 | |
| 77 | 97 | /* reset the ROM to the initial point. */ |
| 78 | 98 | /* eventually, we could add a flag to allow the ROM to continue instead of restarting whenever a new cart region is present */ |
| 79 | | image->fseek(0, SEEK_SET); |
| 99 | fseek(0, SEEK_SET); |
| 80 | 100 | } |
| 81 | 101 | else |
| 82 | 102 | { |
| 83 | 103 | /* must this be full size */ |
| 84 | 104 | if (flags & ROM_FULLSIZE) |
| 85 | 105 | { |
| 86 | | if (image->get_software_region_length("rom") != length) |
| 106 | if (get_software_region_length("rom") != size) |
| 87 | 107 | return IMAGE_INIT_FAIL; |
| 88 | 108 | } |
| 89 | 109 | |
| 90 | 110 | /* read the ROM */ |
| 91 | | pos = read_length = image->get_software_region_length("rom"); |
| 92 | | memcpy(ptr, image->get_software_region("rom"), read_length); |
| 111 | pos = read_length = get_software_region_length("rom"); |
| 112 | memcpy(ptr, get_software_region("rom"), read_length); |
| 93 | 113 | } |
| 94 | 114 | |
| 95 | 115 | /* do we need to mirror the ROM? */ |
| 96 | 116 | if (flags & ROM_MIRROR) |
| 97 | 117 | { |
| 98 | | while(pos < length) |
| 118 | while(pos < size) |
| 99 | 119 | { |
| 100 | | len = MIN(read_length, length - pos); |
| 120 | len = MIN(read_length, size - pos); |
| 101 | 121 | memcpy(ptr + pos, ptr, len); |
| 102 | 122 | pos += len; |
| 103 | 123 | } |
| r13973 | r13974 | |
| 110 | 130 | |
| 111 | 131 | /* if the region is inverted, do that now */ |
| 112 | 132 | device_memory_interface *memory; |
| 113 | | cpu = image->device().machine().device(type); |
| 133 | cpu = device().machine().device(type); |
| 114 | 134 | if (cpu!=NULL && cpu->interface(memory)) |
| 115 | 135 | { |
| 116 | 136 | datawidth = cpu->memory().space_config(AS_PROGRAM)->m_databus_width / 8; |
| r13973 | r13974 | |
| 124 | 144 | if (datawidth > 1 && littleendian) |
| 125 | 145 | #endif |
| 126 | 146 | { |
| 127 | | for (i = 0; i < length; i += datawidth) |
| 147 | for (i = 0; i < size; i += datawidth) |
| 128 | 148 | { |
| 129 | 149 | UINT8 temp[8]; |
| 130 | 150 | memcpy(temp, &ptr[i], datawidth); |
| r13973 | r13974 | |
| 138 | 158 | if (!(flags & ROM_NOCLEAR)) |
| 139 | 159 | { |
| 140 | 160 | clear_val = (flags & ROM_FILL_FF) ? 0xFF : 0x00; |
| 141 | | memset(ptr + pos, clear_val, length - pos); |
| 161 | memset(ptr + pos, clear_val, size - pos); |
| 142 | 162 | } |
| 143 | 163 | return IMAGE_INIT_PASS; |
| 144 | 164 | } |
| r13973 | r13974 | |
| 149 | 169 | process_cartridge |
| 150 | 170 | -------------------------------------------------*/ |
| 151 | 171 | |
| 152 | | static int process_cartridge(device_image_interface *image, process_mode mode) |
| 172 | int cartslot_image_device::process_cartridge(bool load) |
| 153 | 173 | { |
| 154 | 174 | const rom_source *source; |
| 155 | 175 | const rom_entry *romrgn, *roment; |
| 156 | 176 | int result = 0; |
| 157 | 177 | |
| 158 | | for (source = rom_first_source(image->device().machine().config()); source != NULL; source = rom_next_source(*source)) |
| 178 | for (source = rom_first_source(device().machine().config()); source != NULL; source = rom_next_source(*source)) |
| 159 | 179 | { |
| 160 | 180 | for (romrgn = rom_first_region(*source); romrgn != NULL; romrgn = rom_next_region(romrgn)) |
| 161 | 181 | { |
| r13973 | r13974 | |
| 165 | 185 | if (ROMENTRY_GETTYPE(roment) == ROMENTRYTYPE_CARTRIDGE) |
| 166 | 186 | { |
| 167 | 187 | astring regiontag; |
| 168 | | image->device().siblingtag(regiontag, roment->_hashdata); |
| 188 | device().siblingtag(regiontag, roment->_hashdata); |
| 169 | 189 | |
| 170 | | if (strcmp(regiontag.cstr(),image->device().tag())==0) |
| 190 | if (strcmp(regiontag.cstr(),device().tag())==0) |
| 171 | 191 | { |
| 172 | | result |= load_cartridge(image, romrgn, roment, mode); |
| 192 | result |= load_cartridge(romrgn, roment, load); |
| 173 | 193 | |
| 174 | 194 | /* if loading failed in any cart region, stop loading */ |
| 175 | 195 | if (result) |
| r13973 | r13974 | |
| 184 | 204 | return IMAGE_INIT_PASS; |
| 185 | 205 | } |
| 186 | 206 | |
| 187 | | /*------------------------------------------------- |
| 188 | | DEVICE_START( cartslot ) |
| 189 | | -------------------------------------------------*/ |
| 207 | //------------------------------------------------- |
| 208 | // device_start - device-specific startup |
| 209 | //------------------------------------------------- |
| 190 | 210 | |
| 191 | | static DEVICE_START( cartslot ) |
| 211 | void cartslot_image_device::device_start() |
| 192 | 212 | { |
| 193 | | const cartslot_config *config = get_config(device); |
| 194 | 213 | |
| 195 | 214 | /* if this cartridge has a custom DEVICE_START, use it */ |
| 196 | | if (config->device_start != NULL) |
| 215 | if (m_device_start != NULL) |
| 197 | 216 | { |
| 198 | | (*config->device_start)(device); |
| 217 | (*m_device_start)(this); |
| 199 | 218 | } |
| 200 | 219 | } |
| 201 | 220 | |
| 202 | 221 | |
| 203 | 222 | /*------------------------------------------------- |
| 204 | | DEVICE_IMAGE_LOAD( cartslot ) |
| 223 | call_load |
| 205 | 224 | -------------------------------------------------*/ |
| 206 | 225 | |
| 207 | | static DEVICE_IMAGE_LOAD( cartslot ) |
| 226 | bool cartslot_image_device::call_load() |
| 208 | 227 | { |
| 209 | | device_t *device = &image.device(); |
| 210 | | const cartslot_config *config = get_config(device); |
| 211 | | |
| 212 | 228 | /* if this cartridge has a custom DEVICE_IMAGE_LOAD, use it */ |
| 213 | | if (config->device_load != NULL) |
| 214 | | return (*config->device_load)(image); |
| 229 | if (m_device_load != NULL) |
| 230 | return (*m_device_load)(*this); |
| 215 | 231 | |
| 216 | 232 | /* otherwise try the normal route */ |
| 217 | | return process_cartridge(&image, PROCESS_LOAD); |
| 233 | return process_cartridge(true); |
| 218 | 234 | } |
| 219 | 235 | |
| 220 | 236 | |
| 221 | 237 | /*------------------------------------------------- |
| 222 | | DEVICE_IMAGE_UNLOAD( cartslot ) |
| 238 | call_unload |
| 223 | 239 | -------------------------------------------------*/ |
| 224 | | |
| 225 | | static DEVICE_IMAGE_UNLOAD( cartslot ) |
| 240 | void cartslot_image_device::call_unload() |
| 226 | 241 | { |
| 227 | | device_t *device = &image.device(); |
| 228 | | const cartslot_config *config = get_config(device); |
| 229 | | |
| 230 | 242 | /* if this cartridge has a custom DEVICE_IMAGE_UNLOAD, use it */ |
| 231 | | if (config->device_unload != NULL) |
| 243 | if (m_device_unload != NULL) |
| 232 | 244 | { |
| 233 | | (*config->device_unload)(image); |
| 245 | (*m_device_unload)(*this); |
| 234 | 246 | return; |
| 235 | 247 | } |
| 236 | | process_cartridge(&image, PROCESS_CLEAR); |
| 248 | process_cartridge(false); |
| 237 | 249 | } |
| 238 | 250 | |
| 239 | | /*------------------------------------------------- |
| 240 | | DEVICE_IMAGE_SOFTLIST_LOAD(cartslot) |
| 241 | | -------------------------------------------------*/ |
| 242 | | static DEVICE_IMAGE_SOFTLIST_LOAD(cartslot) |
| 243 | | { |
| 244 | | load_software_part_region( &image.device(), swlist, swname, start_entry ); |
| 245 | | return TRUE; |
| 246 | | } |
| 247 | 251 | |
| 248 | | /*------------------------------------------------- |
| 249 | | DEVICE_GET_INFO( cartslot ) |
| 250 | | -------------------------------------------------*/ |
| 251 | | |
| 252 | | DEVICE_GET_INFO( cartslot ) |
| 253 | | { |
| 254 | | switch(state) |
| 255 | | { |
| 256 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 257 | | case DEVINFO_INT_TOKEN_BYTES: info->i = 0; break; |
| 258 | | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = sizeof(cartslot_config); break; |
| 259 | | case DEVINFO_INT_IMAGE_TYPE: info->i = IO_CARTSLOT; break; |
| 260 | | case DEVINFO_INT_IMAGE_READABLE: info->i = 1; break; |
| 261 | | case DEVINFO_INT_IMAGE_WRITEABLE: info->i = 0; break; |
| 262 | | case DEVINFO_INT_IMAGE_CREATABLE: info->i = 0; break; |
| 263 | | case DEVINFO_INT_IMAGE_RESET_ON_LOAD: info->i = 1; break; |
| 264 | | case DEVINFO_INT_IMAGE_MUST_BE_LOADED: |
| 265 | | if ( device && downcast<const legacy_image_device_base *>(device)->inline_config()) { |
| 266 | | info->i = get_config(device)->must_be_loaded; |
| 267 | | } else { |
| 268 | | info->i = 0; |
| 269 | | } |
| 270 | | break; |
| 271 | | |
| 272 | | /* --- the following bits of info are returned as pointers to functions --- */ |
| 273 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(cartslot); break; |
| 274 | | case DEVINFO_FCT_IMAGE_LOAD: info->f = (genf *) DEVICE_IMAGE_LOAD_NAME(cartslot); break; |
| 275 | | case DEVINFO_FCT_IMAGE_UNLOAD: info->f = (genf *) DEVICE_IMAGE_UNLOAD_NAME(cartslot); break; |
| 276 | | case DEVINFO_FCT_IMAGE_SOFTLIST_LOAD: info->f = (genf *) DEVICE_IMAGE_SOFTLIST_LOAD_NAME(cartslot); break; |
| 277 | | case DEVINFO_FCT_IMAGE_PARTIAL_HASH: |
| 278 | | if ( device && downcast<const legacy_image_device_base *>(device)->inline_config() && get_config(device)->device_partialhash) { |
| 279 | | info->f = (genf *) get_config(device)->device_partialhash; |
| 280 | | } else { |
| 281 | | info->f = NULL; |
| 282 | | } |
| 283 | | break; |
| 284 | | case DEVINFO_FCT_IMAGE_DISPLAY_INFO: |
| 285 | | if ( device && downcast<const legacy_image_device_base *>(device)->inline_config() && get_config(device)->device_displayinfo) { |
| 286 | | info->f = (genf *) get_config(device)->device_displayinfo; |
| 287 | | } else { |
| 288 | | info->f = NULL; |
| 289 | | } |
| 290 | | break; |
| 291 | | |
| 292 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 293 | | case DEVINFO_STR_NAME: strcpy(info->s, "Cartslot"); break; |
| 294 | | case DEVINFO_STR_FAMILY: strcpy(info->s, "Cartslot"); break; |
| 295 | | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 296 | | case DEVINFO_STR_IMAGE_FILE_EXTENSIONS: |
| 297 | | if ( device && downcast<const legacy_image_device_base *>(device)->inline_config() && get_config(device)->extensions ) |
| 298 | | { |
| 299 | | strcpy(info->s, get_config(device)->extensions); |
| 300 | | } |
| 301 | | else |
| 302 | | { |
| 303 | | strcpy(info->s, "bin"); |
| 304 | | } |
| 305 | | break; |
| 306 | | case DEVINFO_STR_IMAGE_INTERFACE: |
| 307 | | if ( device && downcast<const legacy_image_device_base *>(device)->inline_config() && get_config(device)->interface ) |
| 308 | | { |
| 309 | | strcpy(info->s, get_config(device)->interface ); |
| 310 | | } |
| 311 | | break; |
| 312 | | } |
| 313 | | } |
| 314 | | |
| 315 | | DEFINE_LEGACY_IMAGE_DEVICE(CARTSLOT, cartslot); |