Skip to content

Commit

Permalink
Revert "Revert "replace old GSU detection routine with the new curren…
Browse files Browse the repository at this point in the history
…t routine""

This reverts commit a1f3a03.
  • Loading branch information
saulfabregwiivc committed Oct 19, 2023
1 parent f7f0a45 commit 6ee3857
Showing 1 changed file with 42 additions and 8 deletions.
50 changes: 42 additions & 8 deletions source/snes9x/memmap.cpp
Expand Up @@ -3123,16 +3123,50 @@ void CMemory::Map_SuperFXLoROMMap (void)
memmove(&ROM[0x208000 + c * 0x10000], &ROM[c * 0x8000], 0x8000);
}

map_lorom(0x00, 0x3f, 0x8000, 0xffff, CalculatedSize);
map_lorom(0x80, 0xbf, 0x8000, 0xffff, CalculatedSize);
// Check GSU revision (not 100% accurate but it works)
// GSU2
if (CalculatedSize > 0x400000)
{
map_lorom(0x00, 0x3f, 0x8000, 0xffff, 0x200000);
map_lorom_offset(0x80, 0xbf, 0x8000, 0xffff, 0x200000, 0x200000);

map_hirom_offset(0x40, 0x7f, 0x0000, 0xffff, CalculatedSize, 0);
map_hirom_offset(0xc0, 0xff, 0x0000, 0xffff, CalculatedSize, 0);
map_hirom_offset(0x40, 0x5f, 0x0000, 0xffff, 0x200000, 0);
map_hirom_offset(0xc0, 0xff, 0x0000, 0xffff, CalculatedSize - 0x400000, 0x400000);

map_space(0x00, 0x3f, 0x6000, 0x7fff, SRAM - 0x6000);
map_space(0x80, 0xbf, 0x6000, 0x7fff, SRAM - 0x6000);
map_space(0x70, 0x70, 0x0000, 0xffff, SRAM);
map_space(0x71, 0x71, 0x0000, 0xffff, SRAM + 0x10000);
map_space(0x00, 0x3f, 0x6000, 0x7fff, SRAM - 0x6000);
map_space(0x80, 0xbf, 0x6000, 0x7fff, SRAM - 0x6000);
map_space(0x70, 0x70, 0x0000, 0xffff, SRAM);
map_space(0x71, 0x71, 0x0000, 0xffff, SRAM + 0x10000);
}
else if (CalculatedSize > 0x200000)
{
map_lorom(0x00, 0x3f, 0x8000, 0xffff, 0x200000);
map_lorom_offset(0x80, 0xbf, 0x8000, 0xffff, CalculatedSize - 0x200000, 0x200000);

map_hirom_offset(0x40, 0x5f, 0x0000, 0xffff, 0x200000, 0);
map_hirom_offset(0xc0, 0xff, 0x0000, 0xffff, CalculatedSize - 0x200000, 0x200000);

map_space(0x00, 0x3f, 0x6000, 0x7fff, SRAM - 0x6000);
map_space(0x80, 0xbf, 0x6000, 0x7fff, SRAM - 0x6000);
map_space(0x70, 0x70, 0x0000, 0xffff, SRAM);
map_space(0x71, 0x71, 0x0000, 0xffff, SRAM + 0x10000);
}
// GSU1
else
{
map_lorom(0x00, 0x3f, 0x8000, 0xffff, CalculatedSize);
map_lorom(0x80, 0xbf, 0x8000, 0xffff, CalculatedSize);

map_hirom_offset(0x40, 0x5f, 0x0000, 0xffff, CalculatedSize, 0);
map_hirom_offset(0xc0, 0xdf, 0x0000, 0xffff, CalculatedSize, 0);

map_space(0x00, 0x3f, 0x6000, 0x7fff, SRAM - 0x6000);
map_space(0x80, 0xbf, 0x6000, 0x7fff, SRAM - 0x6000);
map_space(0x70, 0x70, 0x0000, 0xffff, SRAM);
map_space(0x71, 0x71, 0x0000, 0xffff, SRAM + 0x10000);
map_space(0xf0, 0xf0, 0x0000, 0xffff, SRAM);
map_space(0xf1, 0xf1, 0x0000, 0xffff, SRAM + 0x10000);
}

map_WRAM();

Expand Down

0 comments on commit 6ee3857

Please sign in to comment.