mirror of https://github.com/mgba-emu/mgba.git
GBA DMA: Fix temporal sorting of DMAs of different priorities
This commit is contained in:
parent
ce658ff3a5
commit
108b0fc867
1
CHANGES
1
CHANGES
|
@ -54,6 +54,7 @@ Bugfixes:
|
|||
- PSP2: Fix more issues causing poor audio
|
||||
- GBA Memory: Fix Vast Fame support (taizou) (fixes mgba.io/i/1170)
|
||||
- GB, GBA Savedata: Fix unmasking savedata crash
|
||||
- GBA DMA: Fix temporal sorting of DMAs of different priorities
|
||||
Misc:
|
||||
- GBA Timer: Use global cycles for timers
|
||||
- GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722)
|
||||
|
|
|
@ -202,13 +202,17 @@ void _dmaEvent(struct mTiming* timing, void* context, uint32_t cyclesLate) {
|
|||
void GBADMAUpdate(struct GBA* gba) {
|
||||
int i;
|
||||
struct GBAMemory* memory = &gba->memory;
|
||||
memory->activeDMA = -1;
|
||||
uint32_t currentTime = mTimingCurrentTime(&gba->timing);
|
||||
int32_t leastTime = INT_MAX;
|
||||
memory->activeDMA = -1;
|
||||
for (i = 0; i < 4; ++i) {
|
||||
struct GBADMA* dma = &memory->dma[i];
|
||||
if (GBADMARegisterIsEnable(dma->reg) && dma->nextCount) {
|
||||
memory->activeDMA = i;
|
||||
break;
|
||||
int32_t time = dma->when - currentTime;
|
||||
if (memory->activeDMA == -1 || (dma->count == dma->nextCount && time < leastTime)) {
|
||||
leastTime = time;
|
||||
memory->activeDMA = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue