src/mess/machine/gb.c
| r8056 | r8057 | |
| 338 | 338 | { |
| 339 | 339 | sgb_tile_data = auto_alloc_array_clear(machine, UINT8, 0x2000 ); |
| 340 | 340 | |
| 341 | add_exit_callback(machine, gb_machine_stop); |
| 342 | |
| 341 | 343 | /* Allocate the serial timer, and disable it */ |
| 342 | 344 | gb_driver_data.gb_serial_timer = timer_alloc(machine, gb_serial_timer_proc , NULL); |
| 343 | 345 | timer_enable( gb_driver_data.gb_serial_timer, 0 ); |
| r8056 | r8057 | |
| 425 | 427 | static void gb_machine_stop(running_machine *machine) |
| 426 | 428 | { |
| 427 | 429 | /* Don't save if there was no battery */ |
| 428 | | if( !(gb_driver_data.CartType & BATTERY) || ! gb_driver_data.RAMBanks ) |
| 430 | if(!(gb_driver_data.CartType & BATTERY) || !gb_driver_data.RAMBanks) |
| 429 | 431 | return; |
| 430 | 432 | |
| 431 | 433 | /* NOTE: The reason we save the carts RAM this way instead of using MAME's |
| 432 | 434 | built in macros is because they force the filename to be the name of |
| 433 | 435 | the machine. We need to have a separate name for each game. */ |
| 434 | | image_battery_save(devtag_get_device(machine, "cart"), gb_driver_data.gb_cart_ram, gb_driver_data.RAMBanks * 0x2000 ); |
| 436 | image_battery_save(devtag_get_device(machine, "cart"), gb_driver_data.gb_cart_ram, gb_driver_data.RAMBanks * 0x2000); |
| 435 | 437 | } |
| 436 | 438 | |
| 437 | 439 | static void gb_set_mbc1_banks( running_machine *machine ) |