all repos — mgba @ a72c77a3df79975cdb40a5fbd7e88df7b3934c46

mGBA Game Boy Advance Emulator

Update DMA timings, and higher priority DMAs always take precedence, regardless of timing
Jeffrey Pfau jeffrey@endrift.com
Tue, 28 Jan 2014 21:56:14 -0800
commit

a72c77a3df79975cdb40a5fbd7e88df7b3934c46

parent

d5bd5213134c69a32b10aa08cd1522189af53743

1 files changed, 5 insertions(+), 5 deletions(-)

jump to
M src/gba/gba-memory.csrc/gba/gba-memory.c

@@ -647,10 +647,10 @@ int i;

for (i = 0; i < 4; ++i) { dma = &memory->dma[i]; if (dma->enable && dma->timing == DMA_TIMING_HBLANK) { - dma->nextEvent = memory->p->cpu.cycles; + dma->nextEvent = cycles; } } - GBAMemoryUpdateDMAs(memory, -cycles); + GBAMemoryUpdateDMAs(memory, 0); } void GBAMemoryRunVblankDMAs(struct GBAMemory* memory, int32_t cycles) {

@@ -659,10 +659,10 @@ int i;

for (i = 0; i < 4; ++i) { dma = &memory->dma[i]; if (dma->enable && dma->timing == DMA_TIMING_VBLANK) { - dma->nextEvent = memory->p->cpu.cycles; + dma->nextEvent = cycles; } } - GBAMemoryUpdateDMAs(memory, -cycles); + GBAMemoryUpdateDMAs(memory, 0); } int32_t GBAMemoryRunDMAs(struct GBAMemory* memory, int32_t cycles) {

@@ -688,7 +688,7 @@ for (i = 3; i >= 0; --i) {

struct GBADMA* dma = &memory->dma[i]; if (dma->nextEvent != INT_MAX) { dma->nextEvent -= cycles; - if (dma->enable && memory->nextDMA >= dma->nextEvent) { + if (dma->enable) { memory->activeDMA = i; memory->nextDMA = dma->nextEvent; }