From 7e70ed64bb8493807a0201934972463264b5b46b Mon Sep 17 00:00:00 2001 From: mtabachenko Date: Sat, 3 Oct 2009 08:26:43 +0000 Subject: [PATCH] - ops, sorry, I forgot commit some stuff (bug #2868470); --- desmume/src/MMU.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/desmume/src/MMU.cpp b/desmume/src/MMU.cpp index e769defe0..dd1b360fc 100644 --- a/desmume/src/MMU.cpp +++ b/desmume/src/MMU.cpp @@ -1792,6 +1792,7 @@ void TGXSTAT::reset() gxfifo_irq = se = tr = tb = 0; } +extern CACHE_ALIGN MatrixStack mtxStack[4]; u32 TGXSTAT::read32() { u32 ret = 0; @@ -1829,8 +1830,13 @@ u32 TGXSTAT::read32() void TGXSTAT::write32(const u32 val) { gxfifo_irq = (val>>30)&3; - if(BIT15(val)) se = 0; //clear stack error flag - //if(BIT15(val)) gfx3d_ClearStack(); //?? + if(BIT15(val)) + { + // Writing "1" to Bit15 does reset the Error Flag (Bit15), + // and additionally resets the Projection Stack Pointer (Bit13) + mtxStack[0].position = 0; + se = 0; //clear stack error flag + } //printf("gxstat write: %08X while gxfifo.size=%d\n",val,gxFIFO.size); //if (val & (1<<29)) // clear? (only in homebrew?)