Disable mirroring for ROMs > 32MB

In doMirroring() do nothing if the ROM size is greater than 32MB. This
fixes these ROMs automatically working without disabling mirroring in
settings.

Fix #1046

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2023-09-06 18:50:03 +00:00
parent ea5cbba016
commit 93a24bee3c
2 changed files with 6 additions and 0 deletions

View File

@ -20,6 +20,8 @@ constexpr size_t k1MiB = 2 * k512KiB;
constexpr size_t k2MiB = 2 * k1MiB; constexpr size_t k2MiB = 2 * k1MiB;
constexpr size_t k4MiB = 2 * k2MiB; constexpr size_t k4MiB = 2 * k2MiB;
constexpr size_t k8MiB = 2 * k4MiB; constexpr size_t k8MiB = 2 * k4MiB;
constexpr size_t k16MiB = 2 * k8MiB;
constexpr size_t k32MiB = 2 * k16MiB;
// Game Boy BIOS Sizes. // Game Boy BIOS Sizes.
constexpr size_t kGBBiosSize = k256B; constexpr size_t kGBBiosSize = k256B;

View File

@ -12,6 +12,7 @@
#include "../System.h" #include "../System.h"
#include "../Util.h" #include "../Util.h"
#include "../common/Port.h" #include "../common/Port.h"
#include "../common/sizes.h"
#include "Cheats.h" #include "Cheats.h"
#include "EEprom.h" #include "EEprom.h"
#include "Flash.h" #include "Flash.h"
@ -1688,6 +1689,9 @@ int CPULoadRomData(const char* data, int size)
void doMirroring(bool b) void doMirroring(bool b)
{ {
if (romSize > k32MiB)
return;
int romSizeRounded = romSize; int romSizeRounded = romSize;
romSizeRounded--; romSizeRounded--;
romSizeRounded |= romSizeRounded >> 1; romSizeRounded |= romSizeRounded >> 1;