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
1 files changed,
5 insertions(+),
5 deletions(-)
jump to
M
src/gba/gba-memory.c
→
src/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; }