eliminate emulator crashes and freakouts when rendering some totally messed up 3d stuff. is this masking a deeper issue? quite possibly, but the checks need to be done anyway.
This commit is contained in:
parent
1a5944f90c
commit
b54baa86c6
|
@ -966,7 +966,20 @@ void gfx3d_glNormal(u32 v)
|
|||
|
||||
if(dsSpecular & 0x8000)
|
||||
{
|
||||
shininessLevel = shininessTable[(int)(shininessLevel * 128)];
|
||||
int shininessIndex = (int)(shininessLevel * 128);
|
||||
if(shininessIndex >= ARRAY_SIZE(shininessTable)) {
|
||||
//we can't print this right now, because when a game triggers this it triggers it _A_LOT_
|
||||
//so wait until we have per-frame diagnostics.
|
||||
//this was tested using Princess Debut (US) after proceeding through the intro and getting the tiara.
|
||||
//After much research, I determined that this was caused by the game feeding in a totally jacked matrix
|
||||
//to mult4x4 from 0x02129B80 (after feeding two other valid matrices)
|
||||
//the game seems to internally index these as: ?, 0x37, 0x2B <-- error
|
||||
//but, man... this is seriously messed up. there must be something going wrong.
|
||||
//maybe it has something to do with what looks like a mirror room effect that is going on during this time?
|
||||
//PROGINFO("ERROR: shininess table out of bounds.\n maybe an emulator error; maybe a non-unit normal; setting to 0\n");
|
||||
shininessIndex = 0;
|
||||
}
|
||||
shininessLevel = shininessTable[shininessIndex];
|
||||
}
|
||||
|
||||
for(c = 0; c < 3; c++)
|
||||
|
|
|
@ -771,6 +771,7 @@ static void drawscanline(edge_fx_fl *pLeft, edge_fx_fl *pRight)
|
|||
{
|
||||
if(x<0 || x>255) {
|
||||
printf("rasterizer rendering at x=%d! oops!\n",x);
|
||||
return;
|
||||
}
|
||||
pixel(adr,color[0],color[1],color[2],u,v,1.0f/invw,z);
|
||||
adr++;
|
||||
|
@ -1216,10 +1217,12 @@ static void SoftRastRender()
|
|||
vert.coord[0] += viewport.x;
|
||||
vert.coord[1] *= viewport.height;
|
||||
vert.coord[1] += viewport.y;
|
||||
if(vert.coord[1]>192||vert.color[1]<0) {
|
||||
int zzz=9;
|
||||
}
|
||||
vert.coord[1] = 192 - vert.coord[1];
|
||||
|
||||
//well, i guess we need to do this to keep Princess Debut from rendering huge polys.
|
||||
//there must be something strange going on
|
||||
vert.coord[0] = max(0.0f,min(256.0f,vert.coord[0]));
|
||||
vert.coord[1] = max(0.0f,min(192.0f,vert.coord[1]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue