2 Commits
0.8 ... 0.9

Author SHA1 Message Date
Lesserkuma
d51437552e - 2023-12-17 01:03:38 +01:00
Lesserkuma
12d953d8fd - 2023-12-17 00:46:37 +01:00
4 changed files with 16 additions and 12 deletions

View File

@@ -75,6 +75,8 @@ If the cartridge has a battery installed, the ROMs must be SRAM-patched with [GB
If the cartridge has no battery installed, the ROMs must be patched for batteryless SRAM saving with maniac's [Automatic batteryless saving patcher](https://github.com/metroid-maniac/gba-auto-batteryless-patcher/). If the cartridge has no battery installed, the ROMs must be patched for batteryless SRAM saving with maniac's [Automatic batteryless saving patcher](https://github.com/metroid-maniac/gba-auto-batteryless-patcher/).
On battery-equipped cartridges, when starting a game from the menu, the previously played game's save data will be read from SRAM and stored to permanent flash memory. To skip this, you can hold the SELECT button while starting the game.
## Compatibility ## Compatibility
Tested repro cartridges: Tested repro cartridges:
- 100SOP with MSP55LV100S - 100SOP with MSP55LV100S

View File

@@ -5,7 +5,7 @@
import sys, os, glob, json, math, re, struct, hashlib, argparse, datetime import sys, os, glob, json, math, re, struct, hashlib, argparse, datetime
# Configuration # Configuration
app_version = "0.8" app_version = "0.9"
default_file = "LK_MULTIMENU_<CODE>.gba" default_file = "LK_MULTIMENU_<CODE>.gba"
################################ ################################

View File

@@ -301,16 +301,16 @@ IWRAM_CODE u8 BootGame(ItemConfig config, FlashStatus status)
FlashEraseSector((_flash_save_block_offset + status.last_boot_save_index) * _flash_sector_size); FlashEraseSector((_flash_save_block_offset + status.last_boot_save_index) * _flash_sector_size);
FlashWriteData((_flash_save_block_offset + status.last_boot_save_index) * _flash_sector_size, SRAM_SIZE); FlashWriteData((_flash_save_block_offset + status.last_boot_save_index) * _flash_sector_size, SRAM_SIZE);
} }
// Save status to flash
status.last_boot_save_index = config.save_index;
status.last_boot_save_type = config.save_type;
memset((void *)data_buffer, 0, 0x1000);
memcpy(data_buffer, &status, sizeof(status));
FlashEraseSector(_flash_status_block_offset * flash_sector_size);
FlashWriteData(_flash_status_block_offset * flash_sector_size, 0x1000);
} }
// Save status to flash
status.last_boot_save_index = config.save_index;
status.last_boot_save_type = config.save_type;
memset((void *)data_buffer, 0, 0x1000);
memcpy(data_buffer, &status, sizeof(status));
FlashEraseSector(_flash_status_block_offset * flash_sector_size);
FlashWriteData(_flash_status_block_offset * flash_sector_size, 0x1000);
// Disable SRAM access // Disable SRAM access
*(vu8 *)MAPPER_CONFIG4 = 0; *(vu8 *)MAPPER_CONFIG4 = 0;

View File

@@ -233,13 +233,15 @@ int main(void) {
sFlashStatus.last_boot_menu_index = page_active * 8 + cursor_pos; sFlashStatus.last_boot_menu_index = page_active * 8 + cursor_pos;
if (!show_credits && !show_debug) { if (!show_credits && !show_debug) {
LoadFont(0); LoadFont(0);
if (sFlashStatus.battery_present == 1) { DrawText(5, SCREEN_HEIGHT - sFontSpecs.max_height - 3 - FontMarginBottom, ALIGN_LEFT, u"Loading… Don't turn off the power!", 48, font, (void*)AGB_VRAM+0xA000, FALSE);
DrawText(5, SCREEN_HEIGHT - sFontSpecs.max_height - 3 - FontMarginBottom, ALIGN_LEFT, u"Loading… Don't turn off the power!", 48, font, (void*)AGB_VRAM+0xA000, FALSE);
}
REG_DISPCNT ^= 0x0010; REG_DISPCNT ^= 0x0010;
dmaCopy((void*)AGB_VRAM+0xA000, (void*)AGB_VRAM, SCREEN_WIDTH * SCREEN_HEIGHT); dmaCopy((void*)AGB_VRAM+0xA000, (void*)AGB_VRAM, SCREEN_WIDTH * SCREEN_HEIGHT);
REG_DISPCNT ^= 0x0010; REG_DISPCNT ^= 0x0010;
} }
if (kHeld & KEY_SELECT) {
// Skips reading latest save data from SRAM
sFlashStatus.last_boot_save_type = SRAM_NONE;
}
u8 error_code = BootGame(sItemConfig, sFlashStatus); u8 error_code = BootGame(sItemConfig, sFlashStatus);
boot_failed = error_code; boot_failed = error_code;
redraw_items = 0xFF; redraw_items = 0xFF;