mirror of https://github.com/mgba-emu/mgba.git
GBA Memory: Fix STM to VRAM (fixes #1430)
This commit is contained in:
parent
3a2e5dec91
commit
fc2b043207
1
CHANGES
1
CHANGES
|
@ -1,6 +1,7 @@
|
||||||
0.7.3: (Future)
|
0.7.3: (Future)
|
||||||
Emulation fixes:
|
Emulation fixes:
|
||||||
- GBA Video: Fix wrapped sprite mosaic clamping (fixes mgba.io/i/1432)
|
- GBA Video: Fix wrapped sprite mosaic clamping (fixes mgba.io/i/1432)
|
||||||
|
- GBA Memory: Fix STM to VRAM (fixes mgba.io/i/1430)
|
||||||
Other fixes:
|
Other fixes:
|
||||||
- Switch: Fix threading-related crash on second launch
|
- Switch: Fix threading-related crash on second launch
|
||||||
- Qt: Fix FPS target maxing out at 59.727 (fixes mgba.io/i/1421)
|
- Qt: Fix FPS target maxing out at 59.727 (fixes mgba.io/i/1421)
|
||||||
|
|
|
@ -396,9 +396,10 @@ static void GBASetActiveRegion(struct ARMCore* cpu, uint32_t address) {
|
||||||
value = 0; \
|
value = 0; \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
address &= 0x00017FFC; \
|
LOAD_32(value, address & 0x00017FFC, gba->video.vram); \
|
||||||
} \
|
} else { \
|
||||||
LOAD_32(value, address & 0x0001FFFC, gba->video.vram); \
|
LOAD_32(value, address & 0x0001FFFC, gba->video.vram); \
|
||||||
|
} \
|
||||||
wait += waitstatesRegion[REGION_VRAM];
|
wait += waitstatesRegion[REGION_VRAM];
|
||||||
|
|
||||||
#define LOAD_OAM LOAD_32(value, address & (SIZE_OAM - 4), gba->video.oam.raw);
|
#define LOAD_OAM LOAD_32(value, address & (SIZE_OAM - 4), gba->video.oam.raw);
|
||||||
|
@ -530,9 +531,10 @@ uint32_t GBALoad16(struct ARMCore* cpu, uint32_t address, int* cycleCounter) {
|
||||||
value = 0;
|
value = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
address &= 0x00017FFE;
|
LOAD_16(value, address & 0x00017FFE, gba->video.vram);
|
||||||
}
|
} else {
|
||||||
LOAD_16(value, address & 0x0001FFFE, gba->video.vram);
|
LOAD_16(value, address & 0x0001FFFE, gba->video.vram);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case REGION_OAM:
|
case REGION_OAM:
|
||||||
LOAD_16(value, address & (SIZE_OAM - 2), gba->video.oam.raw);
|
LOAD_16(value, address & (SIZE_OAM - 2), gba->video.oam.raw);
|
||||||
|
@ -645,9 +647,10 @@ uint32_t GBALoad8(struct ARMCore* cpu, uint32_t address, int* cycleCounter) {
|
||||||
value = 0;
|
value = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
address &= 0x00017FFF;
|
value = ((uint8_t*) gba->video.vram)[address & 0x00017FFF];
|
||||||
}
|
} else {
|
||||||
value = ((uint8_t*) gba->video.vram)[address & 0x0001FFFF];
|
value = ((uint8_t*) gba->video.vram)[address & 0x0001FFFF];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case REGION_OAM:
|
case REGION_OAM:
|
||||||
value = ((uint8_t*) gba->video.oam.raw)[address & (SIZE_OAM - 1)];
|
value = ((uint8_t*) gba->video.oam.raw)[address & (SIZE_OAM - 1)];
|
||||||
|
@ -734,14 +737,20 @@ uint32_t GBALoad8(struct ARMCore* cpu, uint32_t address, int* cycleCounter) {
|
||||||
mLOG(GBA_MEM, GAME_ERROR, "Bad VRAM Store32: 0x%08X", address); \
|
mLOG(GBA_MEM, GAME_ERROR, "Bad VRAM Store32: 0x%08X", address); \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
address &= 0x00017FFC; \
|
LOAD_32(oldValue, address & 0x00017FFC, gba->video.vram); \
|
||||||
|
if (oldValue != value) { \
|
||||||
|
STORE_32(value, address & 0x00017FFC, gba->video.vram); \
|
||||||
|
gba->video.renderer->writeVRAM(gba->video.renderer, (address & 0x00017FFC) + 2); \
|
||||||
|
gba->video.renderer->writeVRAM(gba->video.renderer, (address & 0x00017FFC)); \
|
||||||
} \
|
} \
|
||||||
|
} else { \
|
||||||
LOAD_32(oldValue, address & 0x0001FFFC, gba->video.vram); \
|
LOAD_32(oldValue, address & 0x0001FFFC, gba->video.vram); \
|
||||||
if (oldValue != value) { \
|
if (oldValue != value) { \
|
||||||
STORE_32(value, address & 0x0001FFFC, gba->video.vram); \
|
STORE_32(value, address & 0x0001FFFC, gba->video.vram); \
|
||||||
gba->video.renderer->writeVRAM(gba->video.renderer, (address & 0x0001FFFC) + 2); \
|
gba->video.renderer->writeVRAM(gba->video.renderer, (address & 0x0001FFFC) + 2); \
|
||||||
gba->video.renderer->writeVRAM(gba->video.renderer, (address & 0x0001FFFC)); \
|
gba->video.renderer->writeVRAM(gba->video.renderer, (address & 0x0001FFFC)); \
|
||||||
} \
|
} \
|
||||||
|
} \
|
||||||
wait += waitstatesRegion[REGION_VRAM];
|
wait += waitstatesRegion[REGION_VRAM];
|
||||||
|
|
||||||
#define STORE_OAM \
|
#define STORE_OAM \
|
||||||
|
@ -855,13 +864,18 @@ void GBAStore16(struct ARMCore* cpu, uint32_t address, int16_t value, int* cycle
|
||||||
mLOG(GBA_MEM, GAME_ERROR, "Bad VRAM Store16: 0x%08X", address);
|
mLOG(GBA_MEM, GAME_ERROR, "Bad VRAM Store16: 0x%08X", address);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
address &= 0x00017FFE;
|
LOAD_16(oldValue, address & 0x00017FFE, gba->video.vram);
|
||||||
|
if (value != oldValue) {
|
||||||
|
STORE_16(value, address & 0x00017FFE, gba->video.vram);
|
||||||
|
gba->video.renderer->writeVRAM(gba->video.renderer, address & 0x00017FFE);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
LOAD_16(oldValue, address & 0x0001FFFE, gba->video.vram);
|
LOAD_16(oldValue, address & 0x0001FFFE, gba->video.vram);
|
||||||
if (value != oldValue) {
|
if (value != oldValue) {
|
||||||
STORE_16(value, address & 0x0001FFFE, gba->video.vram);
|
STORE_16(value, address & 0x0001FFFE, gba->video.vram);
|
||||||
gba->video.renderer->writeVRAM(gba->video.renderer, address & 0x0001FFFE);
|
gba->video.renderer->writeVRAM(gba->video.renderer, address & 0x0001FFFE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case REGION_OAM:
|
case REGION_OAM:
|
||||||
LOAD_16(oldValue, address & (SIZE_OAM - 2), gba->video.oam.raw);
|
LOAD_16(oldValue, address & (SIZE_OAM - 2), gba->video.oam.raw);
|
||||||
|
|
Loading…
Reference in New Issue