mirror of https://github.com/mgba-emu/mgba.git
Update DMA timings, and higher priority DMAs always take precedence, regardless of timing
This commit is contained in:
parent
d5bd521313
commit
a72c77a3df
|
@ -647,10 +647,10 @@ void GBAMemoryRunHblankDMAs(struct GBAMemory* memory, int32_t cycles) {
|
|||
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 @@ void GBAMemoryRunVblankDMAs(struct GBAMemory* memory, int32_t cycles) {
|
|||
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 @@ void GBAMemoryUpdateDMAs(struct GBAMemory* memory, int32_t cycles) {
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue