all repos — mgba @ e71e4c69ed17c1f2ca208d71821fa337bf088b10

mGBA Game Boy Advance Emulator

GBA Memory: Partially revert fec4c0644 (fixes #840)
Vicki Pfau vi@endrift.com
Wed, 17 Jan 2018 23:22:54 -0800
commit

e71e4c69ed17c1f2ca208d71821fa337bf088b10

parent

a7a51a11373f74f2e42f2c46441a34c993113dcc

2 files changed, 4 insertions(+), 3 deletions(-)

jump to
M CHANGESCHANGES

@@ -17,6 +17,7 @@ - GB MBC: Fix MBC2 saves (fixes mgba.io/i/954)

- GBA Memory: Fix copy-on-write memory leak - Core: Fix ROM patches not being unloaded when disabled (fixes mgba.io/i/962) - GBA I/O: Fix writing to DISPCNT CGB flag (fixes mgba.io/i/902) + - GBA Memory: Partially revert prefetch changes (fixes mgba.io/i/840) Misc: - GBA: Improve multiboot image detection - GB MBC: Remove erroneous bank 0 wrapping
M src/gba/memory.csrc/gba/memory.c

@@ -1506,8 +1506,8 @@ previousLoads = dist >> 1;

maxLoads -= previousLoads; } - int32_t s = cpu->memory.activeSeqCycles16; - int32_t n2s = cpu->memory.activeNonseqCycles16 - cpu->memory.activeSeqCycles16; + int32_t s = cpu->memory.activeSeqCycles16 + 1; + int32_t n2s = cpu->memory.activeNonseqCycles16 - cpu->memory.activeSeqCycles16 + 1; // Figure out how many sequential loads we can jam in int32_t stall = s;

@@ -1528,7 +1528,7 @@

memory->lastPrefetchedPc = cpu->gprs[ARM_PC] + WORD_SIZE_THUMB * (loads + previousLoads - 1); // The next |loads|S waitstates disappear entirely, so long as they're all in a row - cpu->cycles -= stall; + cpu->cycles -= (s - 1) * loads; return wait; }