Previous 15994 Revisions Next

r4112 Sunday 11th January, 2009 at 22:36:56 UTC by Nathan Woods
Cartridge cleanups
[src/mess/devices]cartslot.c

src/mess/devices/cartslot.c
r4111r4112
166166
167167
168168/*-------------------------------------------------
169    DEVICE_START( cartslot_specified )
169    DEVICE_START( cartslot )
170170-------------------------------------------------*/
171171
172static DEVICE_START( cartslot_specified )
172static DEVICE_START( cartslot )
173173{
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);
179175
176   /* if this cartridge has a custom DEVICE_START, use it */
177   if (config->device_start != NULL)
178      return (*config->device_start)(device);
179   
180180   process_cartridge(device, NULL);
181181   return DEVICE_START_OK;
182182}
183183
184184
185185/*-------------------------------------------------
186    DEVICE_IMAGE_LOAD( cartslot_specified )
186    DEVICE_IMAGE_LOAD( cartslot )
187187-------------------------------------------------*/
188188
189static DEVICE_IMAGE_LOAD( cartslot_specified )
189static DEVICE_IMAGE_LOAD( cartslot )
190190{   
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
191197   return process_cartridge(image, image);
192198}
193199
194200
195201/*-------------------------------------------------
196    DEVICE_IMAGE_UNLOAD( cartslot_specified )
202    DEVICE_IMAGE_UNLOAD( cartslot )
197203-------------------------------------------------*/
198204
199static DEVICE_IMAGE_UNLOAD( cartslot_specified )
205static DEVICE_IMAGE_UNLOAD( cartslot )
200206{
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
201213   process_cartridge(image, NULL);
202214}
203215
r4111r4112
243255                                       break;
244256
245257      /* --- 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;
265262      case DEVINFO_FCT_IMAGE_PARTIAL_HASH:      if ( device && device->inline_config && get_config(device)->device_partialhash) {
266263                                          info->f = (genf *) get_config(device)->device_partialhash;
267264                                       } else {

Previous 15994 Revisions Next


© 1998-2018 The MESS Team