[Core/MD] disable cartridge backup RAM when mapped as volatile RAM over internal RAM ("Feng Kuang Tao Hua Yuan" crash)

This commit is contained in:
EkeEke 2013-07-09 00:36:44 +02:00
parent a2bca0ac8c
commit 7033010412

View File

@ -77,6 +77,9 @@ void sram_init()
/* backup RAM detected */ /* backup RAM detected */
sram.detected = 1; sram.detected = 1;
/* enable backup RAM */
sram.on = 1;
/* retrieve backup RAM start & end addresses */ /* retrieve backup RAM start & end addresses */
sram.start = READ_WORD_LONG(cart.rom, 0x1b4); sram.start = READ_WORD_LONG(cart.rom, 0x1b4);
sram.end = READ_WORD_LONG(cart.rom, 0x1b8); sram.end = READ_WORD_LONG(cart.rom, 0x1b8);
@ -89,14 +92,18 @@ void sram_init()
sram.end = 0x203fff; sram.end = 0x203fff;
} }
/* fixe games indicating internal RAM as volatile external RAM (Feng Kuang Tao Hua Yuan) */
else if (sram.start == 0xff0000)
{
/* backup RAM should be disabled */
sram.on = 0;
}
/* fixe other bad header informations */ /* fixe other bad header informations */
else if ((sram.start > sram.end) || ((sram.end - sram.start) >= 0x10000)) else if ((sram.start > sram.end) || ((sram.end - sram.start) >= 0x10000))
{ {
sram.end = sram.start + 0xffff; sram.end = sram.start + 0xffff;
} }
/* enable backup RAM */
sram.on = 1;
} }
else else
{ {