diff --git a/src/gba/GBA.cpp b/src/gba/GBA.cpp index 72b5e33c..a76c4468 100644 --- a/src/gba/GBA.cpp +++ b/src/gba/GBA.cpp @@ -1764,11 +1764,18 @@ int CPULoadRomData(const char *data, int size) void doMirroring (bool b) { - u32 mirroredRomSize = (((romSize)>>20) & 0x3F)<<20; - u32 mirroredRomAddress = romSize; + int romSizeRounded = romSize; + romSizeRounded--; + romSizeRounded |= romSizeRounded >> 1; + romSizeRounded |= romSizeRounded >> 2; + romSizeRounded |= romSizeRounded >> 4; + romSizeRounded |= romSizeRounded >> 8; + romSizeRounded |= romSizeRounded >> 16; + romSizeRounded++; + u32 mirroredRomSize = (((romSizeRounded) >> 20) & 0x3F) << 20; + u32 mirroredRomAddress = mirroredRomSize; if ((mirroredRomSize <=0x800000) && (b)) { - mirroredRomAddress = mirroredRomSize; if (mirroredRomSize==0) mirroredRomSize=0x100000; while (mirroredRomAddress<0x01000000) diff --git a/src/sdl/SDL.cpp b/src/sdl/SDL.cpp index 703f8ca8..dd03d1ce 100644 --- a/src/sdl/SDL.cpp +++ b/src/sdl/SDL.cpp @@ -180,7 +180,7 @@ enum VIDEO_SIZE{ u32 throttleLastTime = 0; bool pauseNextFrame = false; -int sdlMirroringEnable = 0; +int sdlMirroringEnable = 1; static int ignore_first_resize_event = 0; diff --git a/src/wx/panel.cpp b/src/wx/panel.cpp index e12acc7d..1a2e4b0d 100644 --- a/src/wx/panel.cpp +++ b/src/wx/panel.cpp @@ -207,20 +207,21 @@ void GameArea::LoadGame(const wxString &name) flashSetSize(fsz); cpuSaveType = cfg->Read(wxT("saveType"), cpuSaveType); if(cpuSaveType < 0 || cpuSaveType > 5) - cpuSaveType = cpuSaveType; + cpuSaveType = 0; if (cpuSaveType == 0) utilGBAFindSave(rom_size); else saveType = cpuSaveType; - mirroringEnable = cfg->Read(wxT("mirroringEnabled"), (long)0); + mirroringEnable = cfg->Read(wxT("mirroringEnabled"), (long)1); cfg->SetPath(wxT("/")); } else { rtcEnable(rtcEnabled); flashSetSize(0x10000 << winFlashSize); - cpuSaveType = cpuSaveType; + if (cpuSaveType < 0 || cpuSaveType > 5) + cpuSaveType = 0; if (cpuSaveType == 0) utilGBAFindSave(rom_size); else