Don't allow boneMatrixNumber to go outside bounds.

Just from the GLES code.

Fixes the Monster Hunter 3rd demo crash, but not sure why it's trying to
use crazy numbers in the first place...
This commit is contained in:
Unknown W. Brackets 2013-09-14 14:07:53 -07:00
parent dc81547d32
commit 8ddbc0a9ab

View File

@ -857,18 +857,30 @@ void SoftGPU::ExecuteOp(u32 op, u32 diff)
break;
case GE_CMD_TGENMATRIXDATA:
{
DEBUG_LOG(G3D,"DL TGEN matrix data # %f", getFloat24(data));
gstate.tgenMatrix[gstate.texmtxnum++] = getFloat24(data);
int num = gstate.texmtxnum & 0xF;
if (num < 12) {
gstate.tgenMatrix[num] = getFloat24(data);
}
gstate.texmtxnum = (++num) & 0xF;
}
break;
case GE_CMD_BONEMATRIXNUMBER:
DEBUG_LOG(G3D,"DL BONE matrix #%i", data);
gstate.boneMatrixNumber = data;
gstate.boneMatrixNumber = data & 0x7F;
break;
case GE_CMD_BONEMATRIXDATA:
{
DEBUG_LOG(G3D,"DL BONE matrix data #%i %f", gstate.boneMatrixNumber, getFloat24(data));
gstate.boneMatrix[gstate.boneMatrixNumber++] = getFloat24(data);
int num = gstate.boneMatrixNumber & 0x7F;
if (num < 96) {
gstate.boneMatrix[num] = getFloat24(data);
}
gstate.boneMatrixNumber = (++num) & 0x7F;
}
break;
default: