From d8c0ca6f5b68008ec0102fb06c157c00a8391744 Mon Sep 17 00:00:00 2001 From: zeromus Date: Wed, 31 Oct 2018 23:30:40 -0400 Subject: [PATCH] notify the lua script of an updated projection, in more cases (re: #130) --- desmume/src/gfx3d.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/desmume/src/gfx3d.cpp b/desmume/src/gfx3d.cpp index ac348fc3e..24fe2512e 100755 --- a/desmume/src/gfx3d.cpp +++ b/desmume/src/gfx3d.cpp @@ -1234,6 +1234,11 @@ static BOOL gfx3d_glMultMatrix4x4(s32 v) GFX_DELAY_M2(30); } + if(mode == MATRIXMODE_PROJECTION) + { + UpdateProjection(); + } + //printf("mult4x4: matrix %d to: \n",mode); MatrixPrint(mtxCurrent[1]); MatrixIdentity(mtxTemporal); @@ -1265,6 +1270,11 @@ static BOOL gfx3d_glMultMatrix4x3(s32 v) GFX_DELAY_M2(30); } + if(mode == MATRIXMODE_PROJECTION) + { + UpdateProjection(); + } + //printf("mult4x3: matrix %d to: \n",mode); MatrixPrint(mtxCurrent[1]); //does this really need to be done? @@ -1298,6 +1308,11 @@ static BOOL gfx3d_glMultMatrix3x3(s32 v) GFX_DELAY_M2(30); } + if(mode == MATRIXMODE_PROJECTION) + { + UpdateProjection(); + } + //printf("mult3x3: matrix %d to: \n",mode); MatrixPrint(mtxCurrent[1]); @@ -2421,6 +2436,10 @@ void gfx3d_VBlankSignal() gfx3d_doFlush(); GFX_DELAY(392); isSwapBuffers = FALSE; + + //let's consider this the beginning of the next 3d frame. + //in case the game isn't constantly restoring the projection matrix, we want to ping lua + UpdateProjection(); } }