Previous 15994 Revisions Next

r6971 Thursday 7th January, 2010 at 19:11:58 UTC by Firewave
refactored DEVICE_IMAGE_LOAD( aes_cartridge ) a bit
[src/mess/devices]aescart.c

src/mess/devices/aescart.c
r6970r6971
414414static DEVICE_IMAGE_LOAD( aes_cartridge )
415415{
416416   const device_config *pcbdev = cartslot_get_pcb(image);
417   int result;
417   aes_pcb_t *pcb;
418   cartslot_t *cart;
419   multicart_open_error me;
418420
419   if (pcbdev != NULL)
420   {
421      /* If we are here, we have a multicart. */
422      aes_pcb_t *pcb = (aes_pcb_t *)pcbdev->token;
423      cartslot_t *cart = (cartslot_t *)image->token;
421   if (pcbdev == NULL)
422      fatalerror("Error loading multicart: no pcb found.\n");
424423
425      /* try opening this as a multicart */
426      /* This line requires that cartslot_t be included in cartslot.h,
427        otherwise one cannot make use of multicart handling within such a
428        custom LOAD function. */
429      multicart_open_error me = multicart_open(image_filename(image), image->machine->gamedrv->name, MULTICART_FLAGS_LOAD_RESOURCES, &cart->mc);
424   /* If we are here, we have a multicart. */
425   pcb = (aes_pcb_t *)pcbdev->token;
426   cart = (cartslot_t *)image->token;
430427
431      /* Now that we have loaded the image files, let the PCB put them all
432        together. This means we put the images in a structure which allows
433        for a quick access by the memory handlers. Every PCB defines an
434        own assembly method. */
435      if (me == MCERR_NONE)
436         result = pcb->assemble(pcbdev->machine, image);
437      else
438         fatalerror("Error loading multicart: %s\n", multicart_error_text(me));
439   }
440   else
441   {
442      fatalerror("Error loading multicart: no pcb found.\n");
443   }
444   return result;
428   /* try opening this as a multicart */
429   /* This line requires that cartslot_t be included in cartslot.h,
430    otherwise one cannot make use of multicart handling within such a
431    custom LOAD function. */
432   me = multicart_open(image_filename(image), image->machine->gamedrv->name, MULTICART_FLAGS_LOAD_RESOURCES, &cart->mc);
433
434   /* Now that we have loaded the image files, let the PCB put them all
435    together. This means we put the images in a structure which allows
436    for a quick access by the memory handlers. Every PCB defines an
437    own assembly method. */
438    if (me != MCERR_NONE)
439      fatalerror("Error loading multicart: %s\n", multicart_error_text(me));
440
441   return pcb->assemble(pcbdev->machine, image);
445442}
446443
447444/*
r6970r6971
527524}
528525
529526static MACHINE_DRIVER_START(aes_multicart)
530    MDRV_CARTSLOT_ADD("cartridge1")
527   MDRV_CARTSLOT_ADD("cartridge1")
531528   MDRV_CARTSLOT_EXTENSION_LIST("rpk,bin")
532529   MDRV_CARTSLOT_PCBTYPE(0, "none", AES_CARTRIDGE_PCB_NONE)
533530   MDRV_CARTSLOT_PCBTYPE(1, "standard", AES_CARTRIDGE_PCB_STD)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team