all repos — mgba @ 3c70b046dd890c67bb631f5f85e62da0e4cf6197

mGBA Game Boy Advance Emulator

DS GX: Fix unpacking to a full FIFO
Vicki Pfau vi@endrift.com
Wed, 08 Mar 2017 22:55:59 -0800
commit

3c70b046dd890c67bb631f5f85e62da0e4cf6197

parent

fd2869603a8ead37a697ac3340e5f75c39843a55

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

jump to
M src/ds/gx.csrc/ds/gx.c

@@ -358,19 +358,16 @@ }

} static void _flushOutstanding(struct DSGX* gx) { - if (CircleBufferSize(&gx->fifo) == (DS_GX_FIFO_SIZE * sizeof(struct DSGXEntry))) { - return; - } if (gx->p->cpuBlocked & DS_CPU_BLOCK_GX) { gx->p->cpuBlocked &= ~DS_CPU_BLOCK_GX; DSGXWriteFIFO(gx, gx->outstandingEntry); gx->outstandingEntry.command = 0; } while (gx->outstandingCommand[0] && !gx->outstandingParams[0]) { + DSGXWriteFIFO(gx, (struct DSGXEntry) { 0 }); if (CircleBufferSize(&gx->fifo) == (DS_GX_FIFO_SIZE * sizeof(struct DSGXEntry))) { return; } - DSGXWriteFIFO(gx, (struct DSGXEntry) { 0 }); } }

@@ -959,7 +956,9 @@ }

if (cycles && !gx->swapBuffers) { mTimingSchedule(timing, &gx->fifoEvent, cycles - cyclesLate); } - _flushOutstanding(gx); + if (CircleBufferSize(&gx->fifo) < (DS_GX_FIFO_SIZE * sizeof(struct DSGXEntry))) { + _flushOutstanding(gx); + } DSGXUpdateGXSTAT(gx); }