Previous 199869 Revisions Next

r21701 Friday 8th March, 2013 at 10:40:53 UTC by Fabio Priuli
another small cleanup. nw.
[src/mess/machine]snescart.c

trunk/src/mess/machine/snescart.c
r21700r21701
643643DEVICE_IMAGE_LOAD_MEMBER( snes_state,snes_cart )
644644{
645645   int supported_type = 1;
646   running_machine &machine = image.device().machine();
647646   int has_bsx_slot = 0, st_bios = 0;
648647   UINT32 offset, int_header_offs;
649648   UINT8 *ROM = memregion("cart")->base();
r21700r21701
667666   if (SNES_CART_DEBUG) mame_printf_error("size %08X\n", m_cart_size - offset);
668667
669668   m_cart[0].m_rom_size = m_cart_size;
670   m_cart[0].m_rom = auto_alloc_array_clear(machine, UINT8, m_cart[0].m_rom_size);
669   m_cart[0].m_rom = auto_alloc_array_clear(machine(), UINT8, m_cart[0].m_rom_size);
671670   memcpy(m_cart[0].m_rom, ROM, m_cart[0].m_rom_size - offset);
672671   rom_map_setup(m_cart[0].m_rom_size);
673672
r21700r21701
731730   if (SNES_CART_DEBUG) mame_printf_error("mode %d\n", m_cart[0].mode);
732731
733732   /* Detect special chips */
734   supported_type = snes_find_addon_chip(machine, ROM, int_header_offs);
733   supported_type = snes_find_addon_chip(machine(), ROM, int_header_offs);
735734
736735   /* Find the amount of cart ram */
737736   m_cart[0].m_nvram_size = 0;
r21700r21701
769768   }
770769
771770   if (m_cart[0].m_nvram_size > 0)
772      m_cart[0].m_nvram = auto_alloc_array_clear(machine, UINT8, m_cart[0].m_nvram_size);
771      m_cart[0].m_nvram = auto_alloc_array_clear(machine(), UINT8, m_cart[0].m_nvram_size);
773772
774773   /* Log snes_cart information */
775   snes_cart_log_info(machine, ROM, supported_type);
774   snes_cart_log_info(machine(), ROM, supported_type);
776775
777776   /* Load SRAM */
778777   if (m_cart[0].m_nvram_size > 0)
779      snes_load_sram(machine);
778      snes_load_sram(machine());
780779
781780   /* All done */
782781   return IMAGE_INIT_PASS;
r21700r21701
784783
785784DEVICE_IMAGE_LOAD_MEMBER( snes_state,sufami_cart )
786785{
787   running_machine &machine = image.device().machine();
788786   int st_bios = 0, slot_id = 0;
789787   UINT32 offset;
790   UINT8 *ROM = image.device().machine().root_device().memregion(image.device().tag())->base();
788   UINT8 *ROM = machine().root_device().memregion(image.device().tag())->base();
791789
792790   if (strcmp(image.device().tag(), ":slot_a") == 0)
793791      slot_id = 0;
r21700r21701
836834
837835
838836   m_cart[slot_id].m_rom_size = m_cart_size;
839   m_cart[slot_id].m_rom = auto_alloc_array_clear(machine, UINT8, m_cart[0].m_rom_size);
837   m_cart[slot_id].m_rom = auto_alloc_array_clear(machine(), UINT8, m_cart[0].m_rom_size);
840838   memcpy(m_cart[slot_id].m_rom, ROM, m_cart[slot_id].m_rom_size - offset);
841839   rom_map_setup(m_cart[slot_id].m_rom_size);
842840
843841   m_cart[slot_id].m_nvram_size = 0x20000;
844   m_cart[slot_id].m_nvram = auto_alloc_array_clear(machine, UINT8, m_cart[slot_id].m_nvram_size);
842   m_cart[slot_id].m_nvram = auto_alloc_array_clear(machine(), UINT8, m_cart[slot_id].m_nvram_size);
845843
846   sufami_load_sram(machine, image.device().tag());
844   sufami_load_sram(machine(), image.device().tag());
847845
848846   m_cart[slot_id].slot_in_use = 1; // aknowledge the cart in this slot, for saving sram at exit
849847

Previous 199869 Revisions Next


© 1997-2024 The MAME Team