GB Memory: Fix initial WRAM pattern when skipping BIOS in GBC mode (fixes #2704)

This commit is contained in:
Vicki Pfau 2025-05-20 01:07:19 -07:00
parent 2cab5f1705
commit 0418ae33d5
2 changed files with 12 additions and 0 deletions

View File

@ -18,6 +18,7 @@ Features:
Emulation fixes:
- ARM: Add framework for coprocessor support
- GB Memory: Initialize HRAM when skipping BIOS in GBC mode (fixes mgba.io/i/3420)
- GB Memory: Fix initial WRAM pattern when skipping BIOS in GBC mode (fixes mgba.io/i/2704)
- GB Serialize: Add missing Pocket Cam state to savestates
- GB Video: Implement DMG-style sprite ordering
- GB Video: Fix window enable edge case (fixes mgba.io/i/2640)

View File

@ -184,7 +184,18 @@ void GBMemoryReset(struct GB* gb) {
uint32_t* base = (uint32_t*) gb->memory.wram;
size_t i;
uint32_t pattern = 0;
// Banks 0, 1, 3, 6, and 7 are cleared with this pattern
for (i = 0; i < GB_SIZE_WORKING_RAM / 4; i += 4) {
if ((i & 0x1FFF) == 0x800) {
// Skip bank 2
i += 0x3FC;
continue;
}
if ((i & 0x1FFF) == 0x1000) {
// Skip banks 5 and 5
i += 0x7FC;
continue;
}
if ((i & 0x1FF) == 0) {
pattern = ~pattern;
}