src/mess/machine/gb.c
| r4068 | r4069 | |
| 38 | 38 | #include "driver.h" |
| 39 | 39 | #include "includes/gb.h" |
| 40 | 40 | #include "cpu/lr35902/lr35902.h" |
| 41 | #include "devices/cartslot.h" |
| 41 | 42 | #include "image.h" |
| 42 | 43 | |
| 43 | 44 | /* Memory bank controller types */ |
| r4068 | r4069 | |
| 402 | 403 | /* NOTE: The reason we save the carts RAM this way instead of using MAME's |
| 403 | 404 | built in macros is because they force the filename to be the name of |
| 404 | 405 | the machine. We need to have a separate name for each game. */ |
| 405 | | image_battery_save(image_from_devtype_and_index(machine, IO_CARTSLOT, 0), gb_cart_ram, RAMBanks * 0x2000 ); |
| 406 | image_battery_save(device_list_find_by_tag(machine->config->devicelist, CARTSLOT, "cart"), gb_cart_ram, RAMBanks * 0x2000 ); |
| 406 | 407 | } |
| 407 | 408 | |
| 408 | 409 | static void gb_set_mbc1_banks( running_machine *machine ) { |
src/mess/machine/sms.c
| r4068 | r4069 | |
| 4 | 4 | #include "video/smsvdp.h" |
| 5 | 5 | #include "sound/2413intf.h" |
| 6 | 6 | #include "machine/eeprom.h" |
| 7 | #include "devices/cartslot.h" |
| 7 | 8 | |
| 8 | 9 | #define VERBOSE 0 |
| 9 | 10 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| r4068 | r4069 | |
| 581 | 582 | static void sms_machine_stop(running_machine *machine) { |
| 582 | 583 | /* Does the cartridge have SRAM that should be saved? */ |
| 583 | 584 | if ( sms_cartridge[sms_current_cartridge].sram_save ) { |
| 584 | | image_battery_save( image_from_devtype_and_index(machine, IO_CARTSLOT, 0), sms_cartridge[sms_current_cartridge].cartSRAM, sizeof(UINT8) * NVRAM_SIZE ); |
| 585 | image_battery_save(device_list_find_by_tag(machine->config->devicelist, CARTSLOT, "cart"), sms_cartridge[sms_current_cartridge].cartSRAM, sizeof(UINT8) * NVRAM_SIZE ); |
| 585 | 586 | } |
| 586 | 587 | } |
| 587 | 588 | |
src/mess/machine/nes.c
| r4068 | r4069 | |
| 4 | 4 | #include "includes/nes.h" |
| 5 | 5 | #include "machine/nes_mmc.h" |
| 6 | 6 | #include "sound/nes_apu.h" |
| 7 | #include "devices/cartslot.h" |
| 7 | 8 | #include "image.h" |
| 8 | 9 | #include "hash.h" |
| 9 | 10 | |
| r4068 | r4069 | |
| 65 | 66 | |
| 66 | 67 | static const device_config *cartslot_image(running_machine *machine) |
| 67 | 68 | { |
| 68 | | return image_from_devtype_and_index(machine, IO_CARTSLOT, 0); |
| 69 | return device_list_find_by_tag(machine->config->devicelist, CARTSLOT, "cart"); |
| 69 | 70 | } |
| 70 | 71 | |
| 71 | 72 | static void init_nes_core (running_machine *machine) |
src/mess/machine/snescart.c
| r4068 | r4069 | |
| 126 | 126 | |
| 127 | 127 | battery_ram = malloc_or_die(snes_cart.sram_max); |
| 128 | 128 | ptr = battery_ram; |
| 129 | | image_battery_load(image_from_devtype_and_index(machine, IO_CARTSLOT,0), battery_ram, snes_cart.sram_max); |
| 129 | image_battery_load(device_list_find_by_tag(machine->config->devicelist, CARTSLOT, "cart"), battery_ram, snes_cart.sram_max); |
| 130 | 130 | |
| 131 | 131 | if (snes_cart.mode == SNES_MODE_20) |
| 132 | 132 | { |
| r4068 | r4069 | |
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | | image_battery_save(image_from_devtype_and_index(machine, IO_CARTSLOT,0), battery_ram, snes_cart.sram_max); |
| 201 | image_battery_save(device_list_find_by_tag(machine->config->devicelist, CARTSLOT, "cart"), battery_ram, snes_cart.sram_max); |
| 202 | 202 | |
| 203 | 203 | free(battery_ram); |
| 204 | 204 | } |
src/mess/machine/genesis.c
| r4068 | r4069 | |
| 1205 | 1205 | genesis_sram_end += 1; |
| 1206 | 1206 | |
| 1207 | 1207 | genesis_sram = malloc_or_die(genesis_sram_end - genesis_sram_start); |
| 1208 | | image_battery_load(image_from_devtype_and_index(image->machine, IO_CARTSLOT, 0), genesis_sram, genesis_sram_end - genesis_sram_start); |
| 1208 | image_battery_load(device_list_find_by_tag(image->machine->config->devicelist, CARTSLOT, "cart"), genesis_sram, genesis_sram_end - genesis_sram_start); |
| 1209 | 1209 | |
| 1210 | 1210 | megadriv_backupram = (UINT16*)ROM + ((genesis_sram_start & 0x3fffff) / 2); |
| 1211 | 1211 | memmove(&megadriv_backupram[0], genesis_sram, genesis_sram_end - genesis_sram_start); |