src/mess/devices/cartslot.c
| r4111 | r4112 | |
| 166 | 166 | |
| 167 | 167 | |
| 168 | 168 | /*------------------------------------------------- |
| 169 | | DEVICE_START( cartslot_specified ) |
| 169 | DEVICE_START( cartslot ) |
| 170 | 170 | -------------------------------------------------*/ |
| 171 | 171 | |
| 172 | | static DEVICE_START( cartslot_specified ) |
| 172 | static DEVICE_START( cartslot ) |
| 173 | 173 | { |
| 174 | | /* validate arguments */ |
| 175 | | assert(device != NULL); |
| 176 | | assert(device->tag != NULL); |
| 177 | | assert(strlen(device->tag) < 20); |
| 178 | | assert(device->inline_config != NULL); |
| 174 | const cartslot_config *config = get_config(device); |
| 179 | 175 | |
| 176 | /* if this cartridge has a custom DEVICE_START, use it */ |
| 177 | if (config->device_start != NULL) |
| 178 | return (*config->device_start)(device); |
| 179 | |
| 180 | 180 | process_cartridge(device, NULL); |
| 181 | 181 | return DEVICE_START_OK; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | |
| 185 | 185 | /*------------------------------------------------- |
| 186 | | DEVICE_IMAGE_LOAD( cartslot_specified ) |
| 186 | DEVICE_IMAGE_LOAD( cartslot ) |
| 187 | 187 | -------------------------------------------------*/ |
| 188 | 188 | |
| 189 | | static DEVICE_IMAGE_LOAD( cartslot_specified ) |
| 189 | static DEVICE_IMAGE_LOAD( cartslot ) |
| 190 | 190 | { |
| 191 | const cartslot_config *config = get_config(image); |
| 192 | |
| 193 | /* if this cartridge has a custom DEVICE_IMAGE_LOAD, use it */ |
| 194 | if (config->device_load != NULL) |
| 195 | return (*config->device_load)(image); |
| 196 | |
| 191 | 197 | return process_cartridge(image, image); |
| 192 | 198 | } |
| 193 | 199 | |
| 194 | 200 | |
| 195 | 201 | /*------------------------------------------------- |
| 196 | | DEVICE_IMAGE_UNLOAD( cartslot_specified ) |
| 202 | DEVICE_IMAGE_UNLOAD( cartslot ) |
| 197 | 203 | -------------------------------------------------*/ |
| 198 | 204 | |
| 199 | | static DEVICE_IMAGE_UNLOAD( cartslot_specified ) |
| 205 | static DEVICE_IMAGE_UNLOAD( cartslot ) |
| 200 | 206 | { |
| 207 | const cartslot_config *config = get_config(image); |
| 208 | |
| 209 | /* if this cartridge has a custom DEVICE_IMAGE_UNLOAD, use it */ |
| 210 | if (config->device_unload != NULL) |
| 211 | return (*config->device_unload)(image); |
| 212 | |
| 201 | 213 | process_cartridge(image, NULL); |
| 202 | 214 | } |
| 203 | 215 | |
| r4111 | r4112 | |
| 243 | 255 | break; |
| 244 | 256 | |
| 245 | 257 | /* --- the following bits of info are returned as pointers to functions --- */ |
| 246 | | case DEVINFO_FCT_SET_INFO: info->set_info = DEVICE_SET_INFO_NAME(cartslot); break; |
| 247 | | case DEVINFO_FCT_START: if ( device && device->inline_config && get_config(device)->device_start) { |
| 248 | | info->start = get_config(device)->device_start; |
| 249 | | } else { |
| 250 | | info->start = DEVICE_START_NAME(cartslot_specified); |
| 251 | | } |
| 252 | | break; |
| 253 | | case DEVINFO_FCT_IMAGE_LOAD: if ( device && device->inline_config && get_config(device)->device_load) { |
| 254 | | info->f = (genf *) get_config(device)->device_load; |
| 255 | | } else { |
| 256 | | info->f = (genf *) DEVICE_IMAGE_LOAD_NAME(cartslot_specified); |
| 257 | | } |
| 258 | | break; |
| 259 | | case DEVINFO_FCT_IMAGE_UNLOAD: if ( device && device->inline_config && get_config(device)->device_unload) { |
| 260 | | info->f = (genf *) get_config(device)->device_unload; |
| 261 | | } else { |
| 262 | | info->f = (genf *) DEVICE_IMAGE_UNLOAD_NAME(cartslot_specified); |
| 263 | | } |
| 264 | | break; |
| 258 | case DEVINFO_FCT_SET_INFO: info->set_info = DEVICE_SET_INFO_NAME(cartslot); break; |
| 259 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(cartslot); break; |
| 260 | case DEVINFO_FCT_IMAGE_LOAD: info->f = (genf *) DEVICE_IMAGE_LOAD_NAME(cartslot); break; |
| 261 | case DEVINFO_FCT_IMAGE_UNLOAD: info->f = (genf *) DEVICE_IMAGE_UNLOAD_NAME(cartslot); break; |
| 265 | 262 | case DEVINFO_FCT_IMAGE_PARTIAL_HASH: if ( device && device->inline_config && get_config(device)->device_partialhash) { |
| 266 | 263 | info->f = (genf *) get_config(device)->device_partialhash; |
| 267 | 264 | } else { |