[Core/MD] fixed ROM padding for Sonic & Knuckles

This commit is contained in:
EkeEke 2014-06-18 23:09:19 +02:00
parent 053c66c19f
commit 331ec8b7cb
4 changed files with 16 additions and 8 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 MiB

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 MiB

After

Width:  |  Height:  |  Size: 3.8 MiB

View File

@ -292,14 +292,6 @@ void md_cart_init(void)
while (cart.romsize > size)
size <<= 1;
/* total ROM size is not a factor of 2 */
/* TODO: handle all possible ROM configurations using cartridge database */
if ((size < MAXROMSIZE) && (cart.romsize < size))
{
/* ROM is padded up to 2^k bytes */
memset(cart.rom + cart.romsize, 0xff, size - cart.romsize);
}
/* Sonic & Knuckles */
if (strstr(rominfo.international,"SONIC & KNUCKLES"))
{
@ -307,6 +299,22 @@ void md_cart_init(void)
size = 0x400000;
}
/* total ROM size is not a factor of 2 */
/* TODO: handle all possible ROM configurations using cartridge database */
if (cart.romsize < size)
{
if (size < MAXROMSIZE)
{
/* ROM is padded up to 2^k bytes */
memset(cart.rom + cart.romsize, 0xff, size - cart.romsize);
}
else
{
/* ROM is padded up to max ROM size */
memset(cart.rom + cart.romsize, 0xff, MAXROMSIZE - cart.romsize);
}
}
/* ROM is mirrored each 2^k bytes */
cart.mask = size - 1;