From fffa7ebb8c6861dd23b94b50ea8bd5f2988cb012 Mon Sep 17 00:00:00 2001 From: rogerman Date: Mon, 13 Sep 2021 10:42:39 -0700 Subject: [PATCH] FIFO: Oops! Fix a bug that snuck in from commit 31851c2. - In practice, no games seemed to be affected by this bug, but even so, this fix is correct. - While technically unnecessary, when the index is singly incremented, it's better to hard reset an overrunning index to zero in order to improve the theoretical stability of the code. --- desmume/src/FIFO.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/desmume/src/FIFO.cpp b/desmume/src/FIFO.cpp index 38fecc1e9..6fe2f8950 100755 --- a/desmume/src/FIFO.cpp +++ b/desmume/src/FIFO.cpp @@ -343,9 +343,9 @@ void DISP_FIFOsend_u32(u32 val) disp_fifo.buf[disp_fifo.tail] = val; disp_fifo.tail++; - if (disp_fifo.head >= 0x6000) + if (disp_fifo.tail >= 0x6000) { - disp_fifo.head -= 0x6000; + disp_fifo.tail = 0; } } @@ -357,7 +357,7 @@ u32 DISP_FIFOrecv_u32() disp_fifo.head++; if (disp_fifo.head >= 0x6000) { - disp_fifo.head -= 0x6000; + disp_fifo.head = 0; } return val;