fix a crash in matrix stack handling which was corrupting emulator state

This commit is contained in:
zeromus 2009-05-07 06:05:43 +00:00
parent 1de5957a3e
commit 832d168be0
1 changed files with 6 additions and 4 deletions

View File

@ -418,8 +418,9 @@ void gfx3d_glStoreMatrix(u32 v)
//this command always works on both pos and vector when either pos or pos-vector are the current mtx mode
short mymode = (mode==1?2:mode);
//for the projection matrix, the provided value is supposed to be reset to zero
if(mymode==0)
//limit height of these stacks.
//without the mymode==3 namco classics galaxian will try to use pos=1 and overrun the stack, corrupting emu
if(mymode==0 || mymode==3)
v = 0;
if(v==31) v=30; //? what should happen in this case?
@ -434,8 +435,9 @@ void gfx3d_glRestoreMatrix(u32 v)
//this command always works on both pos and vector when either pos or pos-vector are the current mtx mode
short mymode = (mode==1?2:mode);
//for the projection matrix, the provided value is supposed to be reset to zero
if(mymode==0)
//limit height of these stacks
//without the mymode==3 namco classics galaxian will try to use pos=1 and overrun the stack, corrupting emu
if(mymode==0 || mymode==3)
v = 0;
if(v==31) v=30; //? what should happen in this case?