line break consistency fix: ucode06.h
This commit is contained in:
parent
63c4ad0182
commit
822de92789
|
@ -39,82 +39,82 @@
|
|||
|
||||
// STANDARD DRAWIMAGE - draws a 2d image based on the following structure
|
||||
|
||||
static float set_sprite_combine_mode ()
|
||||
{
|
||||
if (rdp.cycle_mode == 2)
|
||||
{
|
||||
rdp.tex = 1;
|
||||
rdp.allow_combine = 0;
|
||||
// Now actually combine !
|
||||
static float set_sprite_combine_mode ()
|
||||
{
|
||||
if (rdp.cycle_mode == 2)
|
||||
{
|
||||
rdp.tex = 1;
|
||||
rdp.allow_combine = 0;
|
||||
// Now actually combine !
|
||||
GrCombineFunction_t color_source = GR_COMBINE_FUNCTION_LOCAL;
|
||||
if (rdp.tbuff_tex && rdp.tbuff_tex->info.format == GR_TEXFMT_ALPHA_INTENSITY_88)
|
||||
color_source = GR_COMBINE_FUNCTION_LOCAL_ALPHA;
|
||||
cmb.tmu1_func = cmb.tmu0_func = color_source;
|
||||
cmb.tmu1_fac = cmb.tmu0_fac = GR_COMBINE_FACTOR_NONE;
|
||||
cmb.tmu1_a_func = cmb.tmu0_a_func = GR_COMBINE_FUNCTION_LOCAL;
|
||||
cmb.tmu1_a_fac = cmb.tmu0_a_fac = GR_COMBINE_FACTOR_NONE;
|
||||
cmb.tmu1_invert = cmb.tmu0_invert = FXFALSE;
|
||||
cmb.tmu1_a_invert = cmb.tmu0_a_invert = FXFALSE;
|
||||
}
|
||||
|
||||
rdp.update |= UPDATE_COMBINE;
|
||||
update ();
|
||||
|
||||
rdp.allow_combine = 1;
|
||||
|
||||
// set z buffer mode
|
||||
float Z = 0.0f;
|
||||
if ((rdp.othermode_l & 0x00000030) && rdp.cycle_mode < 2)
|
||||
{
|
||||
wxUint16 prim_dz = 0;
|
||||
if (rdp.zsrc == 1)
|
||||
{
|
||||
Z = rdp.prim_depth;
|
||||
prim_dz = rdp.prim_dz;
|
||||
}
|
||||
FRDP ("prim_depth = %d, prim_dz = %d\n", rdp.prim_depth, rdp.prim_dz);
|
||||
Z = ScaleZ(Z);
|
||||
|
||||
if (rdp.othermode_l & 0x00000400)
|
||||
grDepthBiasLevel(rdp.prim_dz);
|
||||
}
|
||||
else
|
||||
{
|
||||
LRDP("z compare not used, using 0\n");
|
||||
}
|
||||
|
||||
grCullMode (GR_CULL_DISABLE);
|
||||
grFogMode (GR_FOG_DISABLE);
|
||||
rdp.update |= UPDATE_CULL_MODE | UPDATE_FOG_ENABLED;
|
||||
|
||||
if (rdp.cycle_mode == 2)
|
||||
{
|
||||
grColorCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
|
||||
GR_COMBINE_FACTOR_ONE,
|
||||
GR_COMBINE_LOCAL_NONE,
|
||||
GR_COMBINE_OTHER_TEXTURE,
|
||||
FXFALSE);
|
||||
grAlphaCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
|
||||
GR_COMBINE_FACTOR_ONE,
|
||||
GR_COMBINE_LOCAL_NONE,
|
||||
GR_COMBINE_OTHER_TEXTURE,
|
||||
FXFALSE);
|
||||
grAlphaBlendFunction (GR_BLEND_ONE,
|
||||
GR_BLEND_ZERO,
|
||||
GR_BLEND_ZERO,
|
||||
GR_BLEND_ZERO);
|
||||
if (rdp.othermode_l & 1)
|
||||
{
|
||||
grAlphaTestFunction (GR_CMP_GEQUAL);
|
||||
grAlphaTestReferenceValue (0x80);
|
||||
}
|
||||
else
|
||||
grAlphaTestFunction (GR_CMP_ALWAYS);
|
||||
rdp.update |= UPDATE_ALPHA_COMPARE | UPDATE_COMBINE;
|
||||
}
|
||||
return Z;
|
||||
}
|
||||
|
||||
cmb.tmu1_func = cmb.tmu0_func = color_source;
|
||||
cmb.tmu1_fac = cmb.tmu0_fac = GR_COMBINE_FACTOR_NONE;
|
||||
cmb.tmu1_a_func = cmb.tmu0_a_func = GR_COMBINE_FUNCTION_LOCAL;
|
||||
cmb.tmu1_a_fac = cmb.tmu0_a_fac = GR_COMBINE_FACTOR_NONE;
|
||||
cmb.tmu1_invert = cmb.tmu0_invert = FXFALSE;
|
||||
cmb.tmu1_a_invert = cmb.tmu0_a_invert = FXFALSE;
|
||||
}
|
||||
|
||||
rdp.update |= UPDATE_COMBINE;
|
||||
update ();
|
||||
|
||||
rdp.allow_combine = 1;
|
||||
|
||||
// set z buffer mode
|
||||
float Z = 0.0f;
|
||||
if ((rdp.othermode_l & 0x00000030) && rdp.cycle_mode < 2)
|
||||
{
|
||||
wxUint16 prim_dz = 0;
|
||||
if (rdp.zsrc == 1)
|
||||
{
|
||||
Z = rdp.prim_depth;
|
||||
prim_dz = rdp.prim_dz;
|
||||
}
|
||||
FRDP ("prim_depth = %d, prim_dz = %d\n", rdp.prim_depth, rdp.prim_dz);
|
||||
Z = ScaleZ(Z);
|
||||
|
||||
if (rdp.othermode_l & 0x00000400)
|
||||
grDepthBiasLevel(rdp.prim_dz);
|
||||
}
|
||||
else
|
||||
{
|
||||
LRDP("z compare not used, using 0\n");
|
||||
}
|
||||
|
||||
grCullMode (GR_CULL_DISABLE);
|
||||
grFogMode (GR_FOG_DISABLE);
|
||||
rdp.update |= UPDATE_CULL_MODE | UPDATE_FOG_ENABLED;
|
||||
|
||||
if (rdp.cycle_mode == 2)
|
||||
{
|
||||
grColorCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
|
||||
GR_COMBINE_FACTOR_ONE,
|
||||
GR_COMBINE_LOCAL_NONE,
|
||||
GR_COMBINE_OTHER_TEXTURE,
|
||||
FXFALSE);
|
||||
grAlphaCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
|
||||
GR_COMBINE_FACTOR_ONE,
|
||||
GR_COMBINE_LOCAL_NONE,
|
||||
GR_COMBINE_OTHER_TEXTURE,
|
||||
FXFALSE);
|
||||
grAlphaBlendFunction (GR_BLEND_ONE,
|
||||
GR_BLEND_ZERO,
|
||||
GR_BLEND_ZERO,
|
||||
GR_BLEND_ZERO);
|
||||
if (rdp.othermode_l & 1)
|
||||
{
|
||||
grAlphaTestFunction (GR_CMP_GEQUAL);
|
||||
grAlphaTestReferenceValue (0x80);
|
||||
}
|
||||
else
|
||||
grAlphaTestFunction (GR_CMP_ALWAYS);
|
||||
rdp.update |= UPDATE_ALPHA_COMPARE | UPDATE_COMBINE;
|
||||
}
|
||||
return Z;
|
||||
}
|
||||
|
||||
void uc6_sprite2d ();
|
||||
|
||||
typedef struct DRAWIMAGE_t {
|
||||
|
@ -135,23 +135,23 @@ typedef struct DRAWIMAGE_t {
|
|||
float scaleX;
|
||||
float scaleY;
|
||||
} DRAWIMAGE;
|
||||
|
||||
typedef struct DRAWOBJECT_t {
|
||||
float objX;
|
||||
float objY;
|
||||
float scaleW;
|
||||
float scaleH;
|
||||
short imageW;
|
||||
short imageH;
|
||||
|
||||
wxUint16 imageStride;
|
||||
wxUint16 imageAdrs;
|
||||
wxUint8 imageFmt;
|
||||
wxUint8 imageSiz;
|
||||
wxUint8 imagePal;
|
||||
wxUint8 imageFlags;
|
||||
} DRAWOBJECT;
|
||||
|
||||
|
||||
typedef struct DRAWOBJECT_t {
|
||||
float objX;
|
||||
float objY;
|
||||
float scaleW;
|
||||
float scaleH;
|
||||
short imageW;
|
||||
short imageH;
|
||||
|
||||
wxUint16 imageStride;
|
||||
wxUint16 imageAdrs;
|
||||
wxUint8 imageFmt;
|
||||
wxUint8 imageSiz;
|
||||
wxUint8 imagePal;
|
||||
wxUint8 imageFlags;
|
||||
} DRAWOBJECT;
|
||||
|
||||
void DrawHiresDepthImage (const DRAWIMAGE & d)
|
||||
{
|
||||
wxUint16 * src = (wxUint16*)(gfx.RDRAM+d.imagePtr);
|
||||
|
@ -293,56 +293,56 @@ void DrawImage (DRAWIMAGE & d)
|
|||
if (d.imageW == 0 || d.imageH == 0 || d.frameH == 0) return;
|
||||
|
||||
int x_size, y_size, x_shift, y_shift, line;
|
||||
// choose optimum size for the format/size
|
||||
switch (d.imageSiz)
|
||||
{
|
||||
// choose optimum size for the format/size
|
||||
switch (d.imageSiz)
|
||||
{
|
||||
case 0:
|
||||
if (rdp.tlut_mode < 2)
|
||||
{
|
||||
y_size = 64;
|
||||
y_shift = 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
y_size = 32;
|
||||
y_shift = 5;
|
||||
}
|
||||
}
|
||||
x_size = 128;
|
||||
x_shift = 7;
|
||||
line = 8;
|
||||
break;
|
||||
line = 8;
|
||||
break;
|
||||
case 1:
|
||||
if (rdp.tlut_mode < 2)
|
||||
{
|
||||
y_size = 64;
|
||||
y_shift = 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
y_size = 32;
|
||||
y_shift = 5;
|
||||
}
|
||||
}
|
||||
x_size = 64;
|
||||
x_shift = 6;
|
||||
line = 8;
|
||||
break;
|
||||
line = 8;
|
||||
break;
|
||||
case 2:
|
||||
x_size = 64;
|
||||
y_size = 32;
|
||||
x_shift = 6;
|
||||
y_shift = 5;
|
||||
line = 16;
|
||||
break;
|
||||
line = 16;
|
||||
break;
|
||||
case 3:
|
||||
x_size = 32;
|
||||
y_size = 16;
|
||||
x_shift = 4;
|
||||
y_shift = 3;
|
||||
line = 16;
|
||||
break;
|
||||
default:
|
||||
FRDP("DrawImage. unknown image size: %d\n", d.imageSiz);
|
||||
return;
|
||||
line = 16;
|
||||
break;
|
||||
default:
|
||||
FRDP("DrawImage. unknown image size: %d\n", d.imageSiz);
|
||||
return;
|
||||
}
|
||||
|
||||
if (rdp.ci_width == 512 && !no_dlist) //RE2
|
||||
|
@ -443,8 +443,8 @@ void DrawImage (DRAWIMAGE & d)
|
|||
rdp.tiles[0].lr_t = y_size-1;
|
||||
|
||||
const float Z = set_sprite_combine_mode ();
|
||||
if (rdp.cycle_mode == 2)
|
||||
rdp.allow_combine = 0;
|
||||
if (rdp.cycle_mode == 2)
|
||||
rdp.allow_combine = 0;
|
||||
|
||||
if (fullscreen)
|
||||
{
|
||||
|
@ -453,7 +453,7 @@ void DrawImage (DRAWIMAGE & d)
|
|||
else if (d.scaleX == 1.0f && d.scaleY == 1.0f)
|
||||
grClipWindow (rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
else
|
||||
grClipWindow (rdp.scissor.ul_x, rdp.scissor.ul_y, min(rdp.scissor.lr_x, (wxUint32)((d.frameX+d.imageW/d.scaleX+0.5f)*rdp.scale_x)), min(rdp.scissor.lr_y, (wxUint32)((d.frameY+d.imageH/d.scaleY+0.5f)*rdp.scale_y)));
|
||||
grClipWindow (rdp.scissor.ul_x, rdp.scissor.ul_y, min(rdp.scissor.lr_x, (wxUint32)((d.frameX+d.imageW/d.scaleX+0.5f)*rdp.scale_x)), min(rdp.scissor.lr_y, (wxUint32)((d.frameY+d.imageH/d.scaleY+0.5f)*rdp.scale_y)));
|
||||
rdp.update |= UPDATE_SCISSOR;
|
||||
}
|
||||
|
||||
|
@ -715,89 +715,89 @@ struct MAT2D {
|
|||
float BaseScaleX;
|
||||
float BaseScaleY;
|
||||
} mat_2d = {1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f};
|
||||
|
||||
static void uc6_read_background_data (DRAWIMAGE & d, bool bReadScale)
|
||||
{
|
||||
wxUint32 addr = segoffset(rdp.cmd1) >> 1;
|
||||
|
||||
d.imageX = (((wxUint16 *)gfx.RDRAM)[(addr+0)^1] >> 5); // 0
|
||||
d.imageW = (((wxUint16 *)gfx.RDRAM)[(addr+1)^1] >> 2); // 1
|
||||
d.frameX = ((short*)gfx.RDRAM)[(addr+2)^1] / 4.0f; // 2
|
||||
d.frameW = ((wxUint16 *)gfx.RDRAM)[(addr+3)^1] >> 2; // 3
|
||||
|
||||
d.imageY = (((wxUint16 *)gfx.RDRAM)[(addr+4)^1] >> 5); // 4
|
||||
d.imageH = (((wxUint16 *)gfx.RDRAM)[(addr+5)^1] >> 2); // 5
|
||||
d.frameY = ((short*)gfx.RDRAM)[(addr+6)^1] / 4.0f; // 6
|
||||
d.frameH = ((wxUint16 *)gfx.RDRAM)[(addr+7)^1] >> 2; // 7
|
||||
|
||||
d.imagePtr = segoffset(((wxUint32*)gfx.RDRAM)[(addr+8)>>1]); // 8,9
|
||||
d.imageFmt = ((wxUint8 *)gfx.RDRAM)[(((addr+11)<<1)+0)^3]; // 11
|
||||
d.imageSiz = ((wxUint8 *)gfx.RDRAM)[(((addr+11)<<1)+1)^3]; // |
|
||||
d.imagePal = ((wxUint16 *)gfx.RDRAM)[(addr+12)^1]; // 12
|
||||
wxUint16 imageFlip = ((wxUint16 *)gfx.RDRAM)[(addr+13)^1]; // 13;
|
||||
d.flipX = (wxUint8)imageFlip&0x01;
|
||||
|
||||
if (bReadScale)
|
||||
{
|
||||
d.scaleX = ((short *)gfx.RDRAM)[(addr+14)^1] / 1024.0f; // 14
|
||||
d.scaleY = ((short *)gfx.RDRAM)[(addr+15)^1] / 1024.0f; // 15
|
||||
}
|
||||
else
|
||||
d.scaleX = d.scaleY = 1.0f;
|
||||
|
||||
d.flipY = 0;
|
||||
int imageYorig= ((int *)gfx.RDRAM)[(addr+16)>>1] >> 5;
|
||||
rdp.last_bg = d.imagePtr;
|
||||
|
||||
FRDP ("imagePtr: %08lx\n", d.imagePtr);
|
||||
FRDP ("frameX: %f, frameW: %d, frameY: %f, frameH: %d\n", d.frameX, d.frameW, d.frameY, d.frameH);
|
||||
FRDP ("imageX: %d, imageW: %d, imageY: %d, imageH: %d\n", d.imageX, d.imageW, d.imageY, d.imageH);
|
||||
FRDP ("imageYorig: %d, scaleX: %f, scaleY: %f\n", imageYorig, d.scaleX, d.scaleY);
|
||||
FRDP ("imageFmt: %d, imageSiz: %d, imagePal: %d, imageFlip: %d\n", d.imageFmt, d.imageSiz, d.imagePal, d.flipX);
|
||||
}
|
||||
|
||||
static void uc6_bg (bool bg_1cyc)
|
||||
{
|
||||
static const char *strFuncNames[] = {"uc6:bg_1cyc", "uc6:bg_copy"};
|
||||
const char *strFuncName = bg_1cyc ? strFuncNames[0] : strFuncNames[1];
|
||||
if (rdp.skip_drawing)
|
||||
{
|
||||
FRDP("%s skipped\n", strFuncName);
|
||||
return;
|
||||
}
|
||||
FRDP ("%s #%d, #%d\n", strFuncName, rdp.tri_n, rdp.tri_n+1);
|
||||
|
||||
DRAWIMAGE d;
|
||||
uc6_read_background_data(d, bg_1cyc);
|
||||
|
||||
if (fb_hwfbe_enabled && FindTextureBuffer(d.imagePtr, d.imageW))
|
||||
{
|
||||
DrawHiresImage(d);
|
||||
return;
|
||||
}
|
||||
|
||||
if (settings.ucode == ucode_F3DEX2 || (settings.hacks&hack_PPL))
|
||||
{
|
||||
if ( (d.imagePtr != rdp.cimg) && (d.imagePtr != rdp.ocimg) && d.imagePtr) //can't draw from framebuffer
|
||||
DrawImage (d);
|
||||
else
|
||||
{
|
||||
FRDP("%s skipped\n", strFuncName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawImage (d);
|
||||
}
|
||||
}
|
||||
|
||||
static void uc6_read_background_data (DRAWIMAGE & d, bool bReadScale)
|
||||
{
|
||||
wxUint32 addr = segoffset(rdp.cmd1) >> 1;
|
||||
|
||||
d.imageX = (((wxUint16 *)gfx.RDRAM)[(addr+0)^1] >> 5); // 0
|
||||
d.imageW = (((wxUint16 *)gfx.RDRAM)[(addr+1)^1] >> 2); // 1
|
||||
d.frameX = ((short*)gfx.RDRAM)[(addr+2)^1] / 4.0f; // 2
|
||||
d.frameW = ((wxUint16 *)gfx.RDRAM)[(addr+3)^1] >> 2; // 3
|
||||
|
||||
d.imageY = (((wxUint16 *)gfx.RDRAM)[(addr+4)^1] >> 5); // 4
|
||||
d.imageH = (((wxUint16 *)gfx.RDRAM)[(addr+5)^1] >> 2); // 5
|
||||
d.frameY = ((short*)gfx.RDRAM)[(addr+6)^1] / 4.0f; // 6
|
||||
d.frameH = ((wxUint16 *)gfx.RDRAM)[(addr+7)^1] >> 2; // 7
|
||||
|
||||
d.imagePtr = segoffset(((wxUint32*)gfx.RDRAM)[(addr+8)>>1]); // 8,9
|
||||
d.imageFmt = ((wxUint8 *)gfx.RDRAM)[(((addr+11)<<1)+0)^3]; // 11
|
||||
d.imageSiz = ((wxUint8 *)gfx.RDRAM)[(((addr+11)<<1)+1)^3]; // |
|
||||
d.imagePal = ((wxUint16 *)gfx.RDRAM)[(addr+12)^1]; // 12
|
||||
wxUint16 imageFlip = ((wxUint16 *)gfx.RDRAM)[(addr+13)^1]; // 13;
|
||||
d.flipX = (wxUint8)imageFlip&0x01;
|
||||
|
||||
if (bReadScale)
|
||||
{
|
||||
d.scaleX = ((short *)gfx.RDRAM)[(addr+14)^1] / 1024.0f; // 14
|
||||
d.scaleY = ((short *)gfx.RDRAM)[(addr+15)^1] / 1024.0f; // 15
|
||||
}
|
||||
else
|
||||
d.scaleX = d.scaleY = 1.0f;
|
||||
|
||||
d.flipY = 0;
|
||||
int imageYorig= ((int *)gfx.RDRAM)[(addr+16)>>1] >> 5;
|
||||
rdp.last_bg = d.imagePtr;
|
||||
|
||||
FRDP ("imagePtr: %08lx\n", d.imagePtr);
|
||||
FRDP ("frameX: %f, frameW: %d, frameY: %f, frameH: %d\n", d.frameX, d.frameW, d.frameY, d.frameH);
|
||||
FRDP ("imageX: %d, imageW: %d, imageY: %d, imageH: %d\n", d.imageX, d.imageW, d.imageY, d.imageH);
|
||||
FRDP ("imageYorig: %d, scaleX: %f, scaleY: %f\n", imageYorig, d.scaleX, d.scaleY);
|
||||
FRDP ("imageFmt: %d, imageSiz: %d, imagePal: %d, imageFlip: %d\n", d.imageFmt, d.imageSiz, d.imagePal, d.flipX);
|
||||
}
|
||||
|
||||
static void uc6_bg (bool bg_1cyc)
|
||||
{
|
||||
static const char *strFuncNames[] = {"uc6:bg_1cyc", "uc6:bg_copy"};
|
||||
const char *strFuncName = bg_1cyc ? strFuncNames[0] : strFuncNames[1];
|
||||
if (rdp.skip_drawing)
|
||||
{
|
||||
FRDP("%s skipped\n", strFuncName);
|
||||
return;
|
||||
}
|
||||
FRDP ("%s #%d, #%d\n", strFuncName, rdp.tri_n, rdp.tri_n+1);
|
||||
|
||||
DRAWIMAGE d;
|
||||
uc6_read_background_data(d, bg_1cyc);
|
||||
|
||||
if (fb_hwfbe_enabled && FindTextureBuffer(d.imagePtr, d.imageW))
|
||||
{
|
||||
DrawHiresImage(d);
|
||||
return;
|
||||
}
|
||||
|
||||
if (settings.ucode == ucode_F3DEX2 || (settings.hacks&hack_PPL))
|
||||
{
|
||||
if ( (d.imagePtr != rdp.cimg) && (d.imagePtr != rdp.ocimg) && d.imagePtr) //can't draw from framebuffer
|
||||
DrawImage (d);
|
||||
else
|
||||
{
|
||||
FRDP("%s skipped\n", strFuncName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawImage (d);
|
||||
}
|
||||
}
|
||||
|
||||
static void uc6_bg_1cyc ()
|
||||
{
|
||||
{
|
||||
uc6_bg(true);
|
||||
}
|
||||
|
||||
|
||||
static void uc6_bg_copy ()
|
||||
{
|
||||
{
|
||||
uc6_bg(false);
|
||||
}
|
||||
|
||||
|
@ -997,67 +997,67 @@ static void uc6_draw_polygons (VERTEX v[4])
|
|||
}
|
||||
}
|
||||
|
||||
static void uc6_read_object_data (DRAWOBJECT & d)
|
||||
{
|
||||
wxUint32 addr = segoffset(rdp.cmd1) >> 1;
|
||||
|
||||
d.objX = ((short*)gfx.RDRAM)[(addr+0)^1] / 4.0f; // 0
|
||||
d.scaleW = ((wxUint16 *)gfx.RDRAM)[(addr+1)^1] / 1024.0f; // 1
|
||||
d.imageW = ((short*)gfx.RDRAM)[(addr+2)^1] >> 5; // 2, 3 is padding
|
||||
d.objY = ((short*)gfx.RDRAM)[(addr+4)^1] / 4.0f; // 4
|
||||
d.scaleH = ((wxUint16 *)gfx.RDRAM)[(addr+5)^1] / 1024.0f; // 5
|
||||
d.imageH = ((short*)gfx.RDRAM)[(addr+6)^1] >> 5; // 6, 7 is padding
|
||||
|
||||
d.imageStride = ((wxUint16 *)gfx.RDRAM)[(addr+8)^1]; // 8
|
||||
d.imageAdrs = ((wxUint16 *)gfx.RDRAM)[(addr+9)^1]; // 9
|
||||
d.imageFmt = ((wxUint8 *)gfx.RDRAM)[(((addr+10)<<1)+0)^3]; // 10
|
||||
d.imageSiz = ((wxUint8 *)gfx.RDRAM)[(((addr+10)<<1)+1)^3]; // |
|
||||
d.imagePal = ((wxUint8 *)gfx.RDRAM)[(((addr+10)<<1)+2)^3]; // 11
|
||||
d.imageFlags = ((wxUint8 *)gfx.RDRAM)[(((addr+10)<<1)+3)^3]; // |
|
||||
|
||||
if (d.imageW < 0)
|
||||
d.imageW = (short)rdp.scissor_o.lr_x - (short)d.objX - d.imageW;
|
||||
if (d.imageH < 0)
|
||||
d.imageH = (short)rdp.scissor_o.lr_y - (short)d.objY - d.imageH;
|
||||
|
||||
FRDP ("#%d, #%d\n"
|
||||
"objX: %f, scaleW: %f, imageW: %d\n"
|
||||
"objY: %f, scaleH: %f, imageH: %d\n"
|
||||
"size: %d, format: %d\n", rdp.tri_n, rdp.tri_n+1,
|
||||
d.objX, d.scaleW, d.imageW, d.objY, d.scaleH, d.imageH, d.imageSiz, d.imageFmt);
|
||||
}
|
||||
|
||||
static void uc6_init_tile(const DRAWOBJECT & d)
|
||||
{
|
||||
// SetTile ()
|
||||
TILE *tile = &rdp.tiles[0];
|
||||
tile->format = d.imageFmt; // RGBA
|
||||
tile->size = d.imageSiz; // 16-bit
|
||||
tile->line = d.imageStride;
|
||||
tile->t_mem = d.imageAdrs;
|
||||
tile->palette = d.imagePal;
|
||||
tile->clamp_t = 1;
|
||||
tile->mirror_t = 0;
|
||||
tile->mask_t = 0;
|
||||
tile->shift_t = 0;
|
||||
tile->clamp_s = 1;
|
||||
tile->mirror_s = 0;
|
||||
tile->mask_s = 0;
|
||||
tile->shift_s = 0;
|
||||
|
||||
// SetTileSize ()
|
||||
rdp.tiles[0].ul_s = 0;
|
||||
rdp.tiles[0].ul_t = 0;
|
||||
rdp.tiles[0].lr_s = (d.imageW>0)?d.imageW-1:0;
|
||||
rdp.tiles[0].lr_t = (d.imageH>0)?d.imageH-1:0;
|
||||
}
|
||||
|
||||
static void uc6_read_object_data (DRAWOBJECT & d)
|
||||
{
|
||||
wxUint32 addr = segoffset(rdp.cmd1) >> 1;
|
||||
|
||||
d.objX = ((short*)gfx.RDRAM)[(addr+0)^1] / 4.0f; // 0
|
||||
d.scaleW = ((wxUint16 *)gfx.RDRAM)[(addr+1)^1] / 1024.0f; // 1
|
||||
d.imageW = ((short*)gfx.RDRAM)[(addr+2)^1] >> 5; // 2, 3 is padding
|
||||
d.objY = ((short*)gfx.RDRAM)[(addr+4)^1] / 4.0f; // 4
|
||||
d.scaleH = ((wxUint16 *)gfx.RDRAM)[(addr+5)^1] / 1024.0f; // 5
|
||||
d.imageH = ((short*)gfx.RDRAM)[(addr+6)^1] >> 5; // 6, 7 is padding
|
||||
|
||||
d.imageStride = ((wxUint16 *)gfx.RDRAM)[(addr+8)^1]; // 8
|
||||
d.imageAdrs = ((wxUint16 *)gfx.RDRAM)[(addr+9)^1]; // 9
|
||||
d.imageFmt = ((wxUint8 *)gfx.RDRAM)[(((addr+10)<<1)+0)^3]; // 10
|
||||
d.imageSiz = ((wxUint8 *)gfx.RDRAM)[(((addr+10)<<1)+1)^3]; // |
|
||||
d.imagePal = ((wxUint8 *)gfx.RDRAM)[(((addr+10)<<1)+2)^3]; // 11
|
||||
d.imageFlags = ((wxUint8 *)gfx.RDRAM)[(((addr+10)<<1)+3)^3]; // |
|
||||
|
||||
if (d.imageW < 0)
|
||||
d.imageW = (short)rdp.scissor_o.lr_x - (short)d.objX - d.imageW;
|
||||
if (d.imageH < 0)
|
||||
d.imageH = (short)rdp.scissor_o.lr_y - (short)d.objY - d.imageH;
|
||||
|
||||
FRDP ("#%d, #%d\n"
|
||||
"objX: %f, scaleW: %f, imageW: %d\n"
|
||||
"objY: %f, scaleH: %f, imageH: %d\n"
|
||||
"size: %d, format: %d\n", rdp.tri_n, rdp.tri_n+1,
|
||||
d.objX, d.scaleW, d.imageW, d.objY, d.scaleH, d.imageH, d.imageSiz, d.imageFmt);
|
||||
}
|
||||
|
||||
static void uc6_init_tile(const DRAWOBJECT & d)
|
||||
{
|
||||
// SetTile ()
|
||||
TILE *tile = &rdp.tiles[0];
|
||||
tile->format = d.imageFmt; // RGBA
|
||||
tile->size = d.imageSiz; // 16-bit
|
||||
tile->line = d.imageStride;
|
||||
tile->t_mem = d.imageAdrs;
|
||||
tile->palette = d.imagePal;
|
||||
tile->clamp_t = 1;
|
||||
tile->mirror_t = 0;
|
||||
tile->mask_t = 0;
|
||||
tile->shift_t = 0;
|
||||
tile->clamp_s = 1;
|
||||
tile->mirror_s = 0;
|
||||
tile->mask_s = 0;
|
||||
tile->shift_s = 0;
|
||||
|
||||
// SetTileSize ()
|
||||
rdp.tiles[0].ul_s = 0;
|
||||
rdp.tiles[0].ul_t = 0;
|
||||
rdp.tiles[0].lr_s = (d.imageW>0)?d.imageW-1:0;
|
||||
rdp.tiles[0].lr_t = (d.imageH>0)?d.imageH-1:0;
|
||||
}
|
||||
|
||||
static void uc6_obj_rectangle ()
|
||||
{
|
||||
LRDP ("uc6:obj_rectangle ");
|
||||
DRAWOBJECT d;
|
||||
uc6_read_object_data(d);
|
||||
|
||||
LRDP ("uc6:obj_rectangle ");
|
||||
DRAWOBJECT d;
|
||||
uc6_read_object_data(d);
|
||||
|
||||
if (d.imageAdrs > 4096)
|
||||
{
|
||||
FRDP("tmem: %08lx is out of bounds! return\n", d.imageAdrs);
|
||||
|
@ -1068,8 +1068,8 @@ static void uc6_obj_rectangle ()
|
|||
LRDP("Texture was not loaded! return\n");
|
||||
return;
|
||||
}
|
||||
|
||||
uc6_init_tile(d);
|
||||
|
||||
uc6_init_tile(d);
|
||||
|
||||
float Z = set_sprite_combine_mode ();
|
||||
|
||||
|
@ -1123,10 +1123,10 @@ static void uc6_obj_rectangle ()
|
|||
|
||||
static void uc6_obj_sprite ()
|
||||
{
|
||||
LRDP ("uc6:obj_sprite ");
|
||||
DRAWOBJECT d;
|
||||
uc6_read_object_data(d);
|
||||
uc6_init_tile(d);
|
||||
LRDP ("uc6:obj_sprite ");
|
||||
DRAWOBJECT d;
|
||||
uc6_read_object_data(d);
|
||||
uc6_init_tile(d);
|
||||
|
||||
float Z = set_sprite_combine_mode ();
|
||||
|
||||
|
@ -1286,9 +1286,9 @@ static void uc6_DrawYUVImageToFrameBuffer(wxUint16 ul_x, wxUint16 ul_y, wxUint16
|
|||
|
||||
static void uc6_obj_rectangle_r ()
|
||||
{
|
||||
LRDP ("uc6:obj_rectangle_r ");
|
||||
DRAWOBJECT d;
|
||||
uc6_read_object_data(d);
|
||||
LRDP ("uc6:obj_rectangle_r ");
|
||||
DRAWOBJECT d;
|
||||
uc6_read_object_data(d);
|
||||
|
||||
if (d.imageFmt == 1 && (settings.hacks&hack_Ogre64)) //Ogre Battle needs to copy YUV texture to frame buffer
|
||||
{
|
||||
|
@ -1300,8 +1300,8 @@ static void uc6_obj_rectangle_r ()
|
|||
rdp.tri_n += 2;
|
||||
return;
|
||||
}
|
||||
|
||||
uc6_init_tile(d);
|
||||
|
||||
uc6_init_tile(d);
|
||||
|
||||
float Z = set_sprite_combine_mode ();
|
||||
|
||||
|
@ -1554,9 +1554,9 @@ void uc6_sprite2d ()
|
|||
return;
|
||||
}
|
||||
|
||||
const wxUint32 texsize = (d.imageW * d.imageH) << d.imageSiz >> 1;
|
||||
const wxUint32 maxTexSize = rdp.tlut_mode < 2 ? 4096 : 2048;
|
||||
|
||||
const wxUint32 texsize = (d.imageW * d.imageH) << d.imageSiz >> 1;
|
||||
const wxUint32 maxTexSize = rdp.tlut_mode < 2 ? 4096 : 2048;
|
||||
|
||||
if (texsize > maxTexSize)
|
||||
{
|
||||
if (d.scaleX != 1)
|
||||
|
|
Loading…
Reference in New Issue