diff --git a/genplus-gx/core/cart_hw/md_cart.c b/genplus-gx/core/cart_hw/md_cart.c index c7ddf5850e..1db7c99574 100644 --- a/genplus-gx/core/cart_hw/md_cart.c +++ b/genplus-gx/core/cart_hw/md_cart.c @@ -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; diff --git a/output/dll/libgenplusgx.dll b/output/dll/libgenplusgx.dll index 58c8129f55..51593f25e4 100644 Binary files a/output/dll/libgenplusgx.dll and b/output/dll/libgenplusgx.dll differ