Merge pull request #28 from project64/master

a good pull
This commit is contained in:
AmbientMalice 2016-01-23 21:43:40 +10:00
commit 11c3a9a927
61 changed files with 27582 additions and 27811 deletions

View File

@ -800,11 +800,13 @@ fix_tex_coord=16
[7ED67CD4-B4415E6D-C:50]
Good Name=Dark Rift (E)
Internal Name=DARK RIFT
fb_smart=0
force_microcheck=1
[A4A52B58-23759841-C:45]
Good Name=Dark Rift (U)
Internal Name=DARK RIFT
fb_smart=0
force_microcheck=1
[F5363349-DBF9D21B-C:45]

View File

@ -51,7 +51,7 @@ void calc_light (VERTEX *v)
{
float light_intensity = 0.0f;
register float color[3] = {rdp.light[rdp.num_lights].r, rdp.light[rdp.num_lights].g, rdp.light[rdp.num_lights].b};
for (wxUint32 l=0; l<rdp.num_lights; l++)
for (uint32_t l=0; l<rdp.num_lights; l++)
{
light_intensity = DotProduct (rdp.light_vector[l], v->vec);
@ -67,9 +67,9 @@ void calc_light (VERTEX *v)
if (color[1] > 1.0f) color[1] = 1.0f;
if (color[2] > 1.0f) color[2] = 1.0f;
v->r = (wxUint8)(color[0]*255.0f);
v->g = (wxUint8)(color[1]*255.0f);
v->b = (wxUint8)(color[2]*255.0f);
v->r = (uint8_t)(color[0]*255.0f);
v->g = (uint8_t)(color[1]*255.0f);
v->b = (uint8_t)(color[2]*255.0f);
}
//*

View File

@ -88,9 +88,9 @@ unsigned int CRC32( unsigned int crc, void *buffer, unsigned int count )
//*/
/*
wxUint32 CRC_Calculate( wxUint32 crc, void *buffer, wxUint32 count )
uint32_t CRC_Calculate( uint32_t crc, void *buffer, uint32_t count )
{
wxUint32 Crc32=crc;
uint32_t Crc32=crc;
__asm {
mov esi, buffer
mov ecx, count

View File

@ -44,10 +44,10 @@
#define FASTSEARCH // Enable fast combine mode searching algorithm
float percent_org, percent, r, g, b;
wxUint32 lod_frac;
uint32_t lod_frac;
wxUint32 cc_lookup[257];
wxUint32 ac_lookup[257];
uint32_t cc_lookup[257];
uint32_t ac_lookup[257];
COMBINE cmb;
//****************************************************************
@ -664,20 +664,20 @@ COMBINE cmb;
#define CC(color) cmb.ccolor=(color)&0xFFFFFF00
#define CC_BYTE(byte) { cmb.ccolor=(byte<<8)|(byte<<16)|(byte<<24); }
#define CC_C1MULC2(color1, color2) { \
cmb.ccolor=(wxUint8)( ((color1 & 0xFF000000) >> 24) * (((color2 & 0xFF000000) >> 24) /255.0f) ) << 24 | \
(wxUint8)( ((color1 & 0x00FF0000) >> 16) * (((color2 & 0x00FF0000) >> 16) /255.0f) ) << 16 | \
(wxUint8)( ((color1 & 0x0000FF00) >> 8) * (((color2 & 0x0000FF00) >> 8) /255.0f) ) << 8 ; \
cmb.ccolor=(uint8_t)( ((color1 & 0xFF000000) >> 24) * (((color2 & 0xFF000000) >> 24) /255.0f) ) << 24 | \
(uint8_t)( ((color1 & 0x00FF0000) >> 16) * (((color2 & 0x00FF0000) >> 16) /255.0f) ) << 16 | \
(uint8_t)( ((color1 & 0x0000FF00) >> 8) * (((color2 & 0x0000FF00) >> 8) /255.0f) ) << 8 ; \
}
#define CC_C1SUBC2(color1, color2) { \
cmb.ccolor=(wxUint8)( max(0, (int)((color1 & 0xFF000000) >> 24) - (int)((color2 & 0xFF000000) >> 24)) ) << 24 | \
(wxUint8)( max(0, (int)((color1 & 0x00FF0000) >> 16) - (int)((color2 & 0x00FF0000) >> 16)) ) << 16 | \
(wxUint8)( max(0, (int)((color1 & 0x0000FF00) >> 8) - (int)((color2 & 0x0000FF00) >> 8)) ) << 8 ; \
cmb.ccolor=(uint8_t)( max(0, (int)((color1 & 0xFF000000) >> 24) - (int)((color2 & 0xFF000000) >> 24)) ) << 24 | \
(uint8_t)( max(0, (int)((color1 & 0x00FF0000) >> 16) - (int)((color2 & 0x00FF0000) >> 16)) ) << 16 | \
(uint8_t)( max(0, (int)((color1 & 0x0000FF00) >> 8) - (int)((color2 & 0x0000FF00) >> 8)) ) << 8 ; \
}
#define CC_COLMULBYTE(color, byte) { \
float factor = byte/255.0f; \
cmb.ccolor = (wxUint8)( ((color & 0xFF000000) >> 24) * factor ) << 24 | \
(wxUint8)( ((color & 0x00FF0000) >> 16) * factor ) << 16 | \
(wxUint8)( ((color & 0x0000FF00) >> 8) * factor ) << 8 ; \
cmb.ccolor = (uint8_t)( ((color & 0xFF000000) >> 24) * factor ) << 24 | \
(uint8_t)( ((color & 0x00FF0000) >> 16) * factor ) << 16 | \
(uint8_t)( ((color & 0x0000FF00) >> 8) * factor ) << 8 ; \
}
#define CC_PRIM() CC(rdp.prim_color)
#define CC_ENV() CC(rdp.env_color)
@ -796,8 +796,8 @@ COMBINE cmb;
#define CA_ENV() CA(rdp.env_color)
#define CA_INVPRIM() cmb.ccolor|=0xFF-(rdp.prim_color&0xFF)
#define CA_INVENV() cmb.ccolor|=0xFF-(rdp.env_color&0xFF)
#define CA_ENV1MPRIM() cmb.ccolor|= (wxUint32)(((rdp.env_color&0xFF)/255.0f) * (((~(rdp.prim_color&0xFF)) & 0xff)/255.0f) * 255.0f);
#define CA_PRIMENV() cmb.ccolor |= (wxUint32)(((rdp.env_color&0xFF)/255.0f) * ((rdp.prim_color&0xFF)/255.0f) * 255.0f);
#define CA_ENV1MPRIM() cmb.ccolor|= (uint32_t)(((rdp.env_color&0xFF)/255.0f) * (((~(rdp.prim_color&0xFF)) & 0xff)/255.0f) * 255.0f);
#define CA_PRIMENV() cmb.ccolor |= (uint32_t)(((rdp.env_color&0xFF)/255.0f) * ((rdp.prim_color&0xFF)/255.0f) * 255.0f);
#define CA_PRIMLOD() cmb.ccolor |= rdp.prim_lodfrac;
#define CA_PRIM_MUL_PRIMLOD() cmb.ccolor |= (int)(((rdp.prim_color&0xFF) * rdp.prim_lodfrac) / 255.0f);
#define CA_ENV_MUL_PRIMLOD() cmb.ccolor |= (int)(((rdp.env_color&0xFF) * rdp.prim_lodfrac) / 255.0f);
@ -876,7 +876,7 @@ static void cc_t0 ()
{
if ((rdp.othermode_l & 0x4000) && (rdp.cycle_mode < 2))
{
wxUint32 blend_mode = (rdp.othermode_l >> 16);
uint32_t blend_mode = (rdp.othermode_l >> 16);
if (blend_mode == 0xa500)
{
CCMB(GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
@ -884,9 +884,9 @@ static void cc_t0 ()
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE);
float fog = (rdp.fog_color & 0xFF) / 255.0f;
wxUint32 R = (wxUint32)(((rdp.blend_color>>24)&0xFF)*fog);
wxUint32 G = (wxUint32)(((rdp.blend_color>>16)&0xFF)*fog);
wxUint32 B = (wxUint32)(((rdp.blend_color>> 8)&0xFF)*fog);
uint32_t R = (uint32_t)(((rdp.blend_color >> 24) & 0xFF)*fog);
uint32_t G = (uint32_t)(((rdp.blend_color >> 16) & 0xFF)*fog);
uint32_t B = (uint32_t)(((rdp.blend_color >> 8) & 0xFF)*fog);
CC((R << 24) | (G << 16) | (B << 8));
}
else if (blend_mode == 0x55f0) //cmem*afog + cfog*1ma
@ -961,7 +961,7 @@ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE);
wxUint32 col1 = (rdp.K5<<24) | (rdp.K5<<16) | (rdp.K5<<8);
uint32_t col1 = (rdp.K5<<24) | (rdp.K5<<16) | (rdp.K5<<8);
MOD_0 (TMOD_COL_INTER_TEX_USING_COL1);
MOD_0_COL (rdp.env_color & 0xFFFFFF00);
MOD_0_COL1 (col1 & 0xFFFFFF00);
@ -1098,7 +1098,7 @@ static void cc__t1_inter_t0_using_enva__mul_prim ()
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE);
CC_PRIM();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
T1_INTER_T0_USING_FACTOR(factor);
}
@ -1380,7 +1380,7 @@ static void cc__t0_mul_shade__add__t1_mul_shade ()
static void cc__t0_mul_prim__inter_env_using_enva()
{
wxUint32 enva = rdp.env_color&0xFF;
uint32_t enva = rdp.env_color & 0xFF;
if (enva == 0xFF)
cc_env();
else if (enva == 0)
@ -1415,7 +1415,6 @@ static void cc__t0_mul_prim__inter_env_using_enva ()
}
}
static void cc__t1_inter_t0_using_t1__mul_shade()
{
CCMB(GR_COMBINE_FUNCTION_SCALE_OTHER,
@ -1447,7 +1446,7 @@ static void cc__t1_inter_t0_using_enva__mul_shade ()
GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_TEXTURE);
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
T1_INTER_T0_USING_FACTOR(factor);
}
@ -1926,16 +1925,16 @@ static void cc__prim_inter_env_using_enva__mul_shade ()
{
const float ea = ((float)(rdp.env_color & 0xFF)) / 255.0f;
const float ea_i = 1.0f - ea;
wxUint32 pr = (rdp.prim_color >> 24)&0xFF;
wxUint32 pg = (rdp.prim_color >> 16)&0xFF;
wxUint32 pb = (rdp.prim_color >> 8)&0xFF;
wxUint32 er = (rdp.env_color >> 24)&0xFF;
wxUint32 eg = (rdp.env_color >> 16)&0xFF;
wxUint32 eb = (rdp.env_color >> 8)&0xFF;
wxUint32 r = min(255, (wxUint32)(er*ea + pr*ea_i));
wxUint32 g = min(255, (wxUint32)(eg*ea + pg*ea_i));
wxUint32 b = min(255, (wxUint32)(eb*ea + pb*ea_i));
wxUint32 col = (r << 24) | (g << 16) | (b << 8) | 0xFF;
uint32_t pr = (rdp.prim_color >> 24) & 0xFF;
uint32_t pg = (rdp.prim_color >> 16) & 0xFF;
uint32_t pb = (rdp.prim_color >> 8) & 0xFF;
uint32_t er = (rdp.env_color >> 24) & 0xFF;
uint32_t eg = (rdp.env_color >> 16) & 0xFF;
uint32_t eb = (rdp.env_color >> 8) & 0xFF;
uint32_t r = min(255, (uint32_t)(er*ea + pr*ea_i));
uint32_t g = min(255, (uint32_t)(eg*ea + pg*ea_i));
uint32_t b = min(255, (uint32_t)(eb*ea + pb*ea_i));
uint32_t col = (r << 24) | (g << 16) | (b << 8) | 0xFF;
CCMB(GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_ITERATED,
@ -2174,7 +2173,7 @@ static void cc__t0_inter_t1_using_enva__sub_env () //Aded by Gonetz
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE);
CC_ENV();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
T0_INTER_T1_USING_FACTOR(factor);
}
@ -2276,12 +2275,12 @@ static void cc_t0_add_env_mul_k5 ()
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE);
float scale = rdp.K5 / 255.0f;
wxUint8 r = (wxUint8)(rdp.env_color >> 24) & 0xFF;
r = (wxUint8)(r*scale);
wxUint8 g = (wxUint8)(rdp.env_color >> 16) & 0xFF;
g = (wxUint8)(g*scale);
wxUint8 b = (wxUint8)(rdp.env_color >> 8) & 0xFF;
b = (wxUint8)(b*scale);
uint8_t r = (uint8_t)(rdp.env_color >> 24) & 0xFF;
r = (uint8_t)(r*scale);
uint8_t g = (uint8_t)(rdp.env_color >> 16) & 0xFF;
g = (uint8_t)(g*scale);
uint8_t b = (uint8_t)(rdp.env_color >> 8) & 0xFF;
b = (uint8_t)(b*scale);
CC((r << 24) | (g << 16) | (b << 8));
USE_T0();
}
@ -2703,7 +2702,7 @@ static void cc__t0_inter_t1_using_enva__mul_shade_add_prim ()
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_ITERATED);
CC_PRIM();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
T0_INTER_T1_USING_FACTOR(factor);
}
@ -2714,7 +2713,7 @@ static void cc__t0_inter_t1_using_enva__mul_shade_add_env ()
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_ITERATED);
CC_ENV();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
T0_INTER_T1_USING_FACTOR(factor);
}
@ -3123,7 +3122,7 @@ static void cc__t0_add_primlod__mul_shade_add_env ()
GR_COMBINE_FACTOR_TEXTURE_RGB,
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_ITERATED);
wxUint32 color = (lod_frac<<24) | (lod_frac<<16) | (lod_frac<<8);
uint32_t color = (lod_frac << 24) | (lod_frac << 16) | (lod_frac << 8);
MOD_0(TMOD_TEX_ADD_COL);
MOD_0_COL(color & 0xFFFFFF00);
CC_ENV();
@ -3802,12 +3801,12 @@ static void cc_t0_mul_prima_mul_shade_add_prim_mul_one_sub_prima () //Aded by G
GR_COMBINE_OTHER_ITERATED);
MULSHADE_PRIMA();
USE_T0();
wxUint8 fac = 255 - (wxUint8)(rdp.prim_color&0xFF);
uint8_t fac = 255 - (uint8_t)(rdp.prim_color & 0xFF);
float col[3];
col[0] = (float)((rdp.prim_color & 0xFF000000) >> 24) / 255.0f;
col[1] = (float)((rdp.prim_color & 0x00FF0000) >> 16) / 255.0f;
col[2] = (float)((rdp.prim_color & 0x0000FF00) >> 8) / 255.0f;
CC ( ((wxUint8)(col[0]*fac))<<24 | ((wxUint8)(col[1]*fac))<<16 | ((wxUint8)(col[2]*fac))<<8 | fac );
CC(((uint8_t)(col[0] * fac)) << 24 | ((uint8_t)(col[1] * fac)) << 16 | ((uint8_t)(col[2] * fac)) << 8 | fac);
}
// ** A*(1-B)+C **
@ -4035,7 +4034,7 @@ static void cc__t0_mul_prima_add_t0__sub_center_mul_scale ()
GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
GR_CMBX_TMU_CCOLOR, 0,
GR_CMBX_B, 0);
wxUint32 prima = rdp.prim_color&0xFF;
uint32_t prima = rdp.prim_color & 0xFF;
cmb.tex_ccolor = (prima << 24) | (prima << 16) | (prima << 8) | prima;
cmb.tex |= 1;
CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
@ -4090,7 +4089,7 @@ static void cc__t0_inter_t1_using_enva__sub_shade_mul_prim ()
GR_COMBINE_OTHER_TEXTURE);
MULSHADE_PRIM();
}
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
T0_INTER_T1_USING_FACTOR(factor);
}
@ -4480,7 +4479,6 @@ static void cc__t0_inter_t1_using_shadea__sub_prim_mul_env_add_shade () //Aded
T0_INTER_T1_USING_SHADEA();
}
static void cc_t0_sub_prim_mul_env_add_prim() //Aded by Gonetz
{
CCMB(GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
@ -4574,7 +4572,7 @@ static void cc__t1_inter_t0_using_enva__sub_prim_mul_prima_add_prim () //Aded b
GR_COMBINE_OTHER_TEXTURE);
CC_PRIM();
CA_PRIM();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
T1_INTER_T0_USING_FACTOR(factor);
}
@ -4776,7 +4774,7 @@ static void cc_t0_sub_k4_mul_k5_add_t0 () //Aded by Gonetz
GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
GR_CMBX_CONSTANT_COLOR, 0,
GR_CMBX_B, 0);
wxUint32 temp = rdp.prim_lodfrac;
uint32_t temp = rdp.prim_lodfrac;
rdp.prim_lodfrac = rdp.K4;
SETSHADE_PRIMLOD();
rdp.prim_lodfrac = temp;
@ -4852,7 +4850,7 @@ static void cc_t0_sub_env_mul_prima_add_env () //Aded by Gonetz
{
MOD_0(TMOD_COL_INTER_TEX_USING_COL1);
MOD_0_COL(rdp.env_color & 0xFFFFFF00);
wxUint32 prima = rdp.prim_color & 0xFF;
uint32_t prima = rdp.prim_color & 0xFF;
MOD_0_COL1((prima << 24) | (prima | 16) | (prima << 8));
USE_T0();
}
@ -5025,7 +5023,6 @@ static void cc__t0_inter_t1_using_primlod__sub_env_mul_shade_add_env ()
T0_INTER_T1_USING_FACTOR(lod_frac);
}
static void cc_t0_sub_env_mul_enva_add_prim() //Aded by Gonetz
{
CCMB(GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
@ -5101,7 +5098,7 @@ static void cc_one_sub__t0_inter_t1_using_enva__mul_prim_add__t0_inter_t1_using_
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE);
CC_PRIM();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
T0_INTER_T1_USING_FACTOR(factor);
//(1-t)*prim+t == (1-prim)*t+prim
}
@ -5135,7 +5132,8 @@ static void cc_one_sub_prim_mul_t0a_add_prim ()
GR_CMBX_TEXTURE_ALPHA, 0,
GR_CMBX_B, 0);
CC_PRIM();
} else {
}
else {
CCMB(GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
@ -5398,7 +5396,7 @@ static void cc_one_sub_prim_mul__t0_inter_t1_using_enva__add_prim ()
GR_COMBINE_OTHER_CONSTANT);
CC_1SUBPRIM();
SETSHADE_PRIM();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
T0_INTER_T1_USING_FACTOR(factor);
}
@ -5962,12 +5960,12 @@ static void cc__prim_sub_env_mul_t0_add_env__mul_primlod ()
GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_CONSTANT);
float factor = (float)rdp.prim_lodfrac / 255.0f;
wxUint8 r = (wxUint8)((rdp.prim_color >> 24) & 0xFF);
r = (wxUint8)((float)r * factor);
wxUint8 g = (wxUint8)((rdp.prim_color >> 16) & 0xFF);
g = (wxUint8)((float)g * factor);
wxUint8 b = (wxUint8)((rdp.prim_color >> 8) & 0xFF);
b = (wxUint8)((float)b * factor);
uint8_t r = (uint8_t)((rdp.prim_color >> 24) & 0xFF);
r = (uint8_t)((float)r * factor);
uint8_t g = (uint8_t)((rdp.prim_color >> 16) & 0xFF);
g = (uint8_t)((float)g * factor);
uint8_t b = (uint8_t)((rdp.prim_color >> 8) & 0xFF);
b = (uint8_t)((float)b * factor);
CC((r << 24) | (g << 16) | (b << 8));
SETSHADE_ENV();
MULSHADE_PRIMLOD();
@ -5981,12 +5979,12 @@ static void cc__prim_sub_env_mul_t0_add_env__mul_k5 ()
GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_CONSTANT);
float factor = (float)rdp.K5 / 255.0f;
wxUint8 r = (wxUint8)((rdp.prim_color >> 24) & 0xFF);
r = (wxUint8)((float)r * factor);
wxUint8 g = (wxUint8)((rdp.prim_color >> 16) & 0xFF);
g = (wxUint8)((float)g * factor);
wxUint8 b = (wxUint8)((rdp.prim_color >> 8) & 0xFF);
b = (wxUint8)((float)b * factor);
uint8_t r = (uint8_t)((rdp.prim_color >> 24) & 0xFF);
r = (uint8_t)((float)r * factor);
uint8_t g = (uint8_t)((rdp.prim_color >> 16) & 0xFF);
g = (uint8_t)((float)g * factor);
uint8_t b = (uint8_t)((rdp.prim_color >> 8) & 0xFF);
b = (uint8_t)((float)b * factor);
CC((r << 24) | (g << 16) | (b << 8));
SETSHADE_ENV();
MULSHADE_K5();
@ -6282,7 +6280,7 @@ static void cc_prim_sub_env_mul__t0_inter_t1_using_enva_alpha__add_env ()
GR_COMBINE_OTHER_CONSTANT);
CC_PRIM();
SETSHADE_ENV();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
T0_INTER_T1_USING_FACTOR(factor);
A_T0_INTER_T1_USING_FACTOR(factor);
}
@ -6314,7 +6312,7 @@ static void cc__env_inter_prim_using_t0__sub_shade_mul_t0a_add_shade ()
GR_CMBX_B, 0);
cmb.tex_ccolor = rdp.env_color;
cmb.tex |= 1;
wxUint32 pse = (rdp.prim_color>>24) - (rdp.env_color>>24);
uint32_t pse = (rdp.prim_color >> 24) - (rdp.env_color >> 24);
percent = (float)(pse) / 255.0f;
cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
}
@ -6402,7 +6400,7 @@ static void cc_prim_sub_env_mul__t0_inter_t1_using_prima__add_env ()
GR_COMBINE_OTHER_ITERATED);
CC_ENV();
SETSHADE_PRIM();
wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
uint8_t factor = (uint8_t)(rdp.prim_color & 0xFF);
T0_INTER_T1_USING_FACTOR(factor);
}
@ -6415,7 +6413,7 @@ static void cc_prim_sub_env_mul__t1_inter_t0_using_prima__add_env ()
GR_COMBINE_OTHER_ITERATED);
CC_ENV();
SETSHADE_PRIM();
wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
uint8_t factor = (uint8_t)(rdp.prim_color & 0xFF);
T1_INTER_T0_USING_FACTOR(factor);
}
@ -6427,7 +6425,7 @@ static void cc_prim_sub_env_mul__t0_inter_t1_using_enva__add_env ()
GR_COMBINE_OTHER_ITERATED);
CC_ENV();
SETSHADE_PRIM();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
T0_INTER_T1_USING_FACTOR(factor);
}
@ -6439,7 +6437,7 @@ static void cc_prim_sub_center_mul__t0_inter_t1_using_enva__add_env ()
GR_COMBINE_OTHER_CONSTANT);
CC_C1SUBC2(rdp.prim_color, rdp.CENTER);
SETSHADE_ENV();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
T0_INTER_T1_USING_FACTOR(factor);
}
@ -6451,7 +6449,7 @@ static void cc_prim_sub_env_mul__t1_inter_t0_using_enva__add_env ()
GR_COMBINE_OTHER_ITERATED);
CC_ENV();
SETSHADE_PRIM();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
T1_INTER_T0_USING_FACTOR(factor);
}
@ -6768,7 +6766,7 @@ static void cc_prim_sub_shade_mul__t0_inter_t1_using_enva__add_shade ()
GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_CONSTANT);
CC_PRIM();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
T0_INTER_T1_USING_FACTOR(factor);
}
@ -6956,7 +6954,6 @@ static void cc_env_sub_prim_mul__t0a_mul_t1a__add_prim ()
A_T0_MUL_T1();
}
static void cc_env_sub_prim_mul_prima_add_prim() //Aded by Gonetz
{
// * not guaranteed to work if another iterated alpha is set
@ -7032,7 +7029,7 @@ static void cc_env_sub_prim_mul__t0_inter_t1_using_prima__add_prim ()
GR_COMBINE_OTHER_CONSTANT);
CC_ENV();
SETSHADE_PRIM();
wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
uint8_t factor = (uint8_t)(rdp.prim_color & 0xFF);
T0_INTER_T1_USING_FACTOR(factor);
}
@ -7161,7 +7158,6 @@ static void cc_shade_sub_t0_mul_shadea_add_t0 ()
USE_T0();
}
static void cc__t0_mul_shade_mul_shadea__add__t1_mul_one_sub_shadea()
{
// (t0-0)*shade+0, (cmb-t0)*shadea+t0
@ -7422,7 +7418,7 @@ static void cc_shade_sub_env_mul_k5_add_prim ()
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_ITERATED);
SUBSHADE_ENV();
wxUint32 temp = rdp.prim_color;
uint32_t temp = rdp.prim_color;
rdp.prim_color = rdp.K5;
MULSHADE_PRIMA();
rdp.prim_color = temp;
@ -7445,7 +7441,7 @@ static void cc_t0_inter_t1_using_prima ()
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE);
wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
uint8_t factor = (uint8_t)(rdp.prim_color & 0xFF);
T0_INTER_T1_USING_FACTOR(factor);
}
@ -7455,7 +7451,7 @@ static void cc_t1_inter_t0_using_prima ()
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE);
wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
uint8_t factor = (uint8_t)(rdp.prim_color & 0xFF);
T1_INTER_T0_USING_FACTOR(factor);
}
@ -7483,7 +7479,7 @@ static void cc_t0_inter_t1_using_enva ()
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE);
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
T0_INTER_T1_USING_FACTOR(factor);
}
@ -7938,7 +7934,7 @@ static void cc__t0_inter_t1_using_prima__mul_prim ()
GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE);
wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
uint8_t factor = (uint8_t)(rdp.prim_color & 0xFF);
T0_INTER_T1_USING_FACTOR(factor);
CC_PRIM();
}
@ -7950,7 +7946,7 @@ static void cc__t1_inter_t0_using_prima__mul_prim ()
GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE);
wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
uint8_t factor = (uint8_t)(rdp.prim_color & 0xFF);
T1_INTER_T0_USING_FACTOR(factor);
CC_PRIM();
}
@ -7972,7 +7968,7 @@ static void cc__t0_inter_t1_using_prima__mul_shade ()
GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_TEXTURE);
wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
uint8_t factor = (uint8_t)(rdp.prim_color & 0xFF);
T0_INTER_T1_USING_FACTOR(factor);
}
@ -7983,7 +7979,7 @@ static void cc__t1_inter_t0_using_prima__mul_shade ()
GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_TEXTURE);
wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
uint8_t factor = (uint8_t)(rdp.prim_color & 0xFF);
T1_INTER_T0_USING_FACTOR(factor);
}
@ -8002,7 +7998,7 @@ static void cc__t0_inter_t1_using_enva__mul_shade ()
GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_TEXTURE);
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
T0_INTER_T1_USING_FACTOR(factor);
}
@ -8013,7 +8009,7 @@ static void cc__t0_inter_t1_using_enva__mul_prim ()
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE);
CC_PRIM();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
T0_INTER_T1_USING_FACTOR(factor);
}
@ -8025,7 +8021,7 @@ static void cc__t0_inter_t1_using_enva__mul_env ()
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE);
CC_ENV();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
T0_INTER_T1_USING_FACTOR(factor);
}
@ -8419,7 +8415,7 @@ static void cc__prim_inter_t0_using_env__mul_shade ()
GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
GR_CMBX_ITRGB, 0,
GR_CMBX_ZERO, 0);
wxUint32 onesubenv = ~rdp.env_color;
uint32_t onesubenv = ~rdp.env_color;
CC_C1MULC2(rdp.prim_color, onesubenv);
}
else
@ -8518,7 +8514,7 @@ static void cc_prim_sub__prim_sub_t0_mul_prima__mul_shade ()
GR_COMBINE_OTHER_TEXTURE);
MOD_0(TMOD_COL_INTER_TEX_USING_COL1);
MOD_0_COL(rdp.prim_color & 0xFFFFFF00);
wxUint8 prima = (wxUint8)(rdp.prim_color&0xFF);
uint8_t prima = (uint8_t)(rdp.prim_color & 0xFF);
MOD_0_COL1((prima << 24) | (prima << 16) | (prima << 8));
USE_T0();
}
@ -8561,9 +8557,9 @@ static void cc__prim_inter_one_using_env__mul_shade ()
GR_COMBINE_OTHER_CONSTANT);
CC_1SUBPRIM();
CC_C1MULC2(cmb.ccolor, rdp.env_color);
cmb.ccolor=(wxUint8)( min(255, (int)((cmb.ccolor & 0xFF000000) >> 24) + (int)((rdp.prim_color & 0xFF000000) >> 24)) ) << 24 |
(wxUint8)( min(255, (int)((cmb.ccolor & 0x00FF0000) >> 16) + (int)((rdp.prim_color & 0x00FF0000) >> 16)) ) << 16 |
(wxUint8)( min(255, (int)((cmb.ccolor & 0x0000FF00) >> 8) + (int)((rdp.prim_color & 0x0000FF00) >> 8)) ) << 8 ;
cmb.ccolor = (uint8_t)(min(255, (int)((cmb.ccolor & 0xFF000000) >> 24) + (int)((rdp.prim_color & 0xFF000000) >> 24))) << 24 |
(uint8_t)(min(255, (int)((cmb.ccolor & 0x00FF0000) >> 16) + (int)((rdp.prim_color & 0x00FF0000) >> 16))) << 16 |
(uint8_t)(min(255, (int)((cmb.ccolor & 0x0000FF00) >> 8) + (int)((rdp.prim_color & 0x0000FF00) >> 8))) << 8;
}
static void cc__env_inter_prim_using_t0a__mul_t0()
@ -8657,7 +8653,7 @@ static void cc__env_inter_t0_using_prima__mul_shade ()
GR_COMBINE_OTHER_TEXTURE);
MOD_0(TMOD_COL_INTER_TEX_USING_COL1);
MOD_0_COL(rdp.env_color & 0xFFFFFF00);
wxUint32 prima = rdp.prim_color & 0xFF;
uint32_t prima = rdp.prim_color & 0xFF;
MOD_0_COL1((prima << 24) | (prima | 16) | (prima << 8));
USE_T0();
}
@ -8683,7 +8679,7 @@ static void cc_shade_mul_shadea ()
static void cc__t0_mul_shade__inter_env_using_enva()
{
// (t0-0)*shade+0, (env-cmb)*env_a+cmb ** INC **
wxUint32 enva = rdp.env_color&0xFF;
uint32_t enva = rdp.env_color & 0xFF;
if (enva == 0xFF)
cc_env();
else if (enva == 0)
@ -8770,7 +8766,6 @@ static void cc__prim_mul_shade__inter_env_using__prim_mul_shade_alpha ()
MULSHADE_A_PRIM();
}
//****************************************************************
static void ac_one()
@ -8786,7 +8781,7 @@ static void ac_t0 ()
{
if ((rdp.othermode_l & 0x4000) && (rdp.cycle_mode < 2))
{
wxUint32 blend_mode = (rdp.othermode_l >> 16);
uint32_t blend_mode = (rdp.othermode_l >> 16);
if (blend_mode == 0x0550)
{
ACMB(GR_COMBINE_FUNCTION_SCALE_OTHER,
@ -9253,7 +9248,7 @@ static void ac__t1_sub_t0_mul_enva_add_t1__mul_prim ()
}
else
{
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
A_T0_INTER_T1_USING_FACTOR(factor);
}
}
@ -9275,7 +9270,7 @@ static void ac__t1_sub_t0_mul_primlod__mul_env_add_prim ()
GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
GR_CMBX_TMU_CALPHA, 0,
GR_CMBX_ZERO, 0);
cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (wxUint32)((float)(rdp.env_color&0xFF)*(float)rdp.prim_lodfrac/255.0f);
cmb.tex_ccolor = (cmb.tex_ccolor & 0xFFFFFF00) | (uint32_t)((float)(rdp.env_color & 0xFF)*(float)rdp.prim_lodfrac / 255.0f);
}
else
{
@ -9832,7 +9827,7 @@ static void ac__t0_inter_t1_using_enva__mul_prim_add_env ()
GR_COMBINE_OTHER_ITERATED);
SETSHADE_A_PRIM();
CA_ENV();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
A_T0_INTER_T1_USING_FACTOR(factor);
}
@ -10260,7 +10255,7 @@ static void ac_t0_mul_primlod_mul_prim () //Aded by Gonetz
GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE);
cmb.ccolor |= (wxUint32)(lod_frac * (rdp.prim_color&0xFF) / 255);
cmb.ccolor |= (uint32_t)(lod_frac * (rdp.prim_color & 0xFF) / 255);
A_USE_T0();
}
@ -10304,7 +10299,8 @@ static void ac_t0_sub_prim_mul_shade ()
GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
GR_CMBX_ZERO, 1,
GR_CMBX_ZERO, 0);
} else {
}
else {
ACMB(GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_ITERATED,
@ -10329,7 +10325,8 @@ static void ac_t0_sub_prim_mul_shade_mul_env ()
GR_CMBX_CONSTANT_ALPHA, 0,
GR_CMBX_ZERO, 0);
CA_ENV();
} else {
}
else {
ACMB(GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_ITERATED,
@ -10354,7 +10351,8 @@ static void ac_t0_sub_shade_mul_prim ()
GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
GR_CMBX_ZERO, 1,
GR_CMBX_ZERO, 0);
} else {
}
else {
ACMB(GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_ITERATED,
@ -11100,7 +11098,7 @@ static void ac_t0_inter_t1_using_prima ()
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE);
wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
uint8_t factor = (uint8_t)(rdp.prim_color & 0xFF);
A_T0_INTER_T1_USING_FACTOR(factor);
}
@ -11110,7 +11108,7 @@ static void ac_t1_inter_t0_using_prima ()
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE);
wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
uint8_t factor = (uint8_t)(rdp.prim_color & 0xFF);
A_T1_INTER_T0_USING_FACTOR(factor);
}
@ -11129,7 +11127,7 @@ static void ac_t0_inter_t1_using_enva ()
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE);
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
A_T0_INTER_T1_USING_FACTOR(factor);
}
@ -11139,7 +11137,7 @@ static void ac_t1_inter_t0_using_enva ()
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE);
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
A_T1_INTER_T0_USING_FACTOR(factor);
}
@ -11257,7 +11255,7 @@ static void ac__t0_inter_t1_using_prima__mul_env ()
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE);
CA_ENV();
wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
uint8_t factor = (uint8_t)(rdp.prim_color & 0xFF);
A_T0_INTER_T1_USING_FACTOR(factor);
}
@ -11289,7 +11287,7 @@ static void ac__t1_inter_t0_using_prima__mul_env ()
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE);
CA_ENV();
wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
uint8_t factor = (uint8_t)(rdp.prim_color & 0xFF);
A_T1_INTER_T0_USING_FACTOR(factor);
}
@ -11300,7 +11298,7 @@ static void ac__t0_inter_t1_using_prima__mul_shade ()
GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_TEXTURE);
wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
uint8_t factor = (uint8_t)(rdp.prim_color & 0xFF);
A_T0_INTER_T1_USING_FACTOR(factor);
}
@ -11310,7 +11308,7 @@ static void ac__t1_inter_t0_using_prima__mul_shade ()
GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_TEXTURE);
wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
uint8_t factor = (uint8_t)(rdp.prim_color & 0xFF);
A_T1_INTER_T0_USING_FACTOR(factor);
}
@ -11321,7 +11319,7 @@ static void ac__t0_inter_t1_using_enva__mul_prim ()
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE);
CA_PRIM();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
A_T0_INTER_T1_USING_FACTOR(factor);
}
@ -11348,7 +11346,7 @@ static void ac__env_sub_one_mul_t1_add_t0__mul_prim ()
}
else
{
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
A_T0_INTER_T1_USING_FACTOR(factor);
}
}
@ -11360,7 +11358,7 @@ static void ac__t0_inter_t1_using_enva__mul_primlod ()
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE);
CA_PRIMLOD();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
A_T0_INTER_T1_USING_FACTOR(factor);
}
@ -11482,7 +11480,7 @@ static void ac__t0_inter_t1_using_enva__mul_shade ()
GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_TEXTURE);
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
A_T0_INTER_T1_USING_FACTOR(factor);
}
@ -11609,7 +11607,7 @@ static void ac__t1_sub_one_mul_enva_add_t0__mul_shade ()
}
else
{
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
uint8_t factor = (uint8_t)(rdp.env_color & 0xFF);
A_T0_INTER_T1_USING_FACTOR(factor);
}
}
@ -11648,7 +11646,7 @@ static void ac_one_sub_t0_mul_primshade ()
typedef void(*cmb_func)();
typedef struct {
wxUint32 key;
uint32_t key;
cmb_func func;
} COMBINER;
@ -15554,7 +15552,7 @@ void Combine ()
rdp.noise = RDP::noise_none;
wxUint32 found = TRUE;
uint32_t found = TRUE;
rdp.col[0] = rdp.col[1] = rdp.col[2] = rdp.col[3] =
rdp.coladd[0] = rdp.coladd[1] = rdp.coladd[2] = rdp.coladd[3] = 1.0f;
@ -15577,18 +15575,15 @@ void Combine ()
if (cmb.cmb_ext_use || cmb.tex_cmb_ext_use)
{
//have to draw something to allow use of standard combine functions
if (fullscreen)
{
VERTEX v;
memset(&v, 0, sizeof(v));
grDrawPoint(&v);
}
cmb.cmb_ext_use = 0;
cmb.tex_cmb_ext_use = 0;
}
wxUint32 cmb_mode_c = (rdp.cycle1 << 16) | (rdp.cycle2 & 0xFFFF);
wxUint32 cmb_mode_a = (rdp.cycle1 & 0x0FFF0000) | ((rdp.cycle2 >> 16) & 0x00000FFF);
uint32_t cmb_mode_c = (rdp.cycle1 << 16) | (rdp.cycle2 & 0xFFFF);
uint32_t cmb_mode_a = (rdp.cycle1 & 0x0FFF0000) | ((rdp.cycle2 >> 16) & 0x00000FFF);
cmb.abf1 = GR_BLEND_SRC_ALPHA;
cmb.abf2 = GR_BLEND_ONE_MINUS_SRC_ALPHA;
@ -15596,7 +15591,7 @@ void Combine ()
#ifdef FASTSEARCH
// Fast, ordered search
int current = 0x7FFFFFFF, last;
wxUint32 actual_combine, current_combine, color_combine, alpha_combine;
uint32_t actual_combine, current_combine, color_combine, alpha_combine;
int left, right;
actual_combine = current_combine = cmb_mode_c;
@ -15710,7 +15705,6 @@ void Combine ()
else
alpha_cmb_list[current].func();
if (color_combine == 0x69351fff) //text, PD, need to change texture alpha
{
A_USE_T1();
@ -15741,8 +15735,6 @@ void Combine ()
//*/
rdp.tex = cmb.tex;
if (fullscreen)
{
TBUFF_COLOR_IMAGE * aTBuff[2] = { 0, 0 };
if (rdp.aTBuffTex[0])
aTBuff[rdp.aTBuffTex[0]->tile] = rdp.aTBuffTex[0];
@ -15795,7 +15787,6 @@ void Combine ()
}
else
grChromakeyMode(GR_CHROMAKEY_DISABLE);
}
cmb.shade_mod_hash = (rdp.cmb_flags + rdp.cmb_flags_2) * (rdp.prim_color + rdp.env_color + rdp.K5);
LRDP(" | + Combine end\n");
@ -15803,7 +15794,7 @@ void Combine ()
void CombineBlender()
{
wxUint32 blendmode = rdp.othermode_l >> 16;
uint32_t blendmode = rdp.othermode_l >> 16;
// Check force-blending
if ((rdp.othermode_l & 0x4000) && (rdp.cycle_mode < 2))
{
@ -15857,9 +15848,9 @@ void CombineBlender ()
float percent = (rdp.fog_color & 0xFF) / 255.0f;
cmb.ccolor =
((wxUint32)(((cmb.ccolor >> 24) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>24) & 0xFF) * percent) << 24) |
((wxUint32)(((cmb.ccolor >> 16) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>16) & 0xFF) * percent) << 16) |
((wxUint32)(((cmb.ccolor >> 8) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>8) & 0xFF) * percent) << 8) |
((uint32_t)(((cmb.ccolor >> 24) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>24) & 0xFF) * percent) << 24) |
((uint32_t)(((cmb.ccolor >> 16) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>16) & 0xFF) * percent) << 16) |
((uint32_t)(((cmb.ccolor >> 8) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>8) & 0xFF) * percent) << 8) |
(cmb.ccolor & 0xFF);
rdp.col[0] = rdp.col[0] * (1.0f-percent) + ((rdp.fog_color>>24) & 0xFF) / 255.0f * percent;
@ -15872,7 +15863,7 @@ void CombineBlender ()
case 0xf550: //clr_fog * a_fog + clr_mem * (1-a)
A_BLEND(GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA);
{
wxUint32 prim = rdp.prim_color;
uint32_t prim = rdp.prim_color;
rdp.prim_color = rdp.fog_color;
cc_prim();
ac_prim();
@ -15885,7 +15876,7 @@ void CombineBlender ()
A_BLEND(GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA);
if (rdp.cycle_mode == 1 && rdp.cycle2 != 0x01ff1fff)
{
wxUint32 prim = rdp.prim_color;
uint32_t prim = rdp.prim_color;
rdp.prim_color = rdp.fog_color;
ac_prim();
rdp.prim_color = prim;
@ -15894,7 +15885,7 @@ void CombineBlender ()
case 0xc912: //40 winks, clr_in * a_fog + clr_mem * 1
{
wxUint32 prim = rdp.prim_color;
uint32_t prim = rdp.prim_color;
rdp.prim_color = rdp.fog_color;
ac_prim();
rdp.prim_color = prim;
@ -15920,9 +15911,9 @@ void CombineBlender ()
float percent = (rdp.fog_color & 0xFF) / 255.0f;
cmb.ccolor =
((wxUint32)(((cmb.ccolor >> 24) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>24) & 0xFF) * percent) << 24) |
((wxUint32)(((cmb.ccolor >> 16) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>16) & 0xFF) * percent) << 16) |
((wxUint32)(((cmb.ccolor >> 8) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>8) & 0xFF) * percent) << 8) |
((uint32_t)(((cmb.ccolor >> 24) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>24) & 0xFF) * percent) << 24) |
((uint32_t)(((cmb.ccolor >> 16) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>16) & 0xFF) * percent) << 16) |
((uint32_t)(((cmb.ccolor >> 8) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>8) & 0xFF) * percent) << 8) |
(cmb.ccolor & 0xFF);
rdp.col[0] = rdp.col[0] * (1.0f-percent) + ((rdp.fog_color>>24) & 0xFF) / 255.0f * percent;
@ -16013,7 +16004,7 @@ void InitCombine ()
void ColorCombinerToExtension()
{
wxUint32 ext_local, ext_local_a, ext_other, ext_other_a;
uint32_t ext_local, ext_local_a, ext_other, ext_other_a;
switch (cmb.c_loc)
{
@ -16202,7 +16193,7 @@ void ColorCombinerToExtension ()
void AlphaCombinerToExtension()
{
wxUint32 ext_local, ext_other;
uint32_t ext_local, ext_other;
switch (cmb.a_loc)
{
case GR_COMBINE_LOCAL_ITERATED:
@ -16340,9 +16331,9 @@ void AlphaCombinerToExtension ()
void TexColorCombinerToExtension(GrChipID_t tmu)
{
wxUint32 tc_ext_a, tc_ext_a_mode, tc_ext_b, tc_ext_b_mode, tc_ext_c, tc_ext_d;
uint32_t tc_ext_a, tc_ext_a_mode, tc_ext_b, tc_ext_b_mode, tc_ext_c, tc_ext_d;
int tc_ext_c_invert, tc_ext_d_invert;
wxUint32 tmu_func, tmu_fac;
uint32_t tmu_func, tmu_fac;
if (tmu == GR_TMU0)
{
@ -16539,9 +16530,9 @@ void TexColorCombinerToExtension (GrChipID_t tmu)
void TexAlphaCombinerToExtension(GrChipID_t tmu)
{
wxUint32 ta_ext_a, ta_ext_a_mode, ta_ext_b, ta_ext_b_mode, ta_ext_c, ta_ext_d;
uint32_t ta_ext_a, ta_ext_a_mode, ta_ext_b, ta_ext_b_mode, ta_ext_c, ta_ext_d;
int ta_ext_c_invert, ta_ext_d_invert;
wxUint32 tmu_a_func, tmu_a_fac;
uint32_t tmu_a_func, tmu_a_fac;
if (tmu == GR_TMU0)
{

View File

@ -69,41 +69,41 @@
typedef struct
{
wxUint32 ccolor; // constant color to set at the end, color and alpha
wxUint32 c_fnc, c_fac, c_loc, c_oth; // grColorCombine flags
wxUint32 a_fnc, a_fac, a_loc, a_oth; // grAlphaCombine flags
wxUint32 tex, tmu0_func, tmu0_fac, tmu0_invert, tmu1_func, tmu1_fac, tmu1_invert;
wxUint32 tmu0_a_func, tmu0_a_fac, tmu0_a_invert, tmu1_a_func, tmu1_a_fac, tmu1_a_invert;
uint32_t ccolor; // constant color to set at the end, color and alpha
uint32_t c_fnc, c_fac, c_loc, c_oth; // grColorCombine flags
uint32_t a_fnc, a_fac, a_loc, a_oth; // grAlphaCombine flags
uint32_t tex, tmu0_func, tmu0_fac, tmu0_invert, tmu1_func, tmu1_fac, tmu1_invert;
uint32_t tmu0_a_func, tmu0_a_fac, tmu0_a_invert, tmu1_a_func, tmu1_a_fac, tmu1_a_invert;
int dc0_lodbias, dc1_lodbias;
wxUint8 dc0_detailscale, dc1_detailscale;
uint8_t dc0_detailscale, dc1_detailscale;
float dc0_detailmax, dc1_detailmax;
float lodbias0, lodbias1;
wxUint32 abf1, abf2;
wxUint32 mod_0, modcolor_0, modcolor1_0, modcolor2_0, modfactor_0;
wxUint32 mod_1, modcolor_1, modcolor1_1, modcolor2_1, modfactor_1;
uint32_t abf1, abf2;
uint32_t mod_0, modcolor_0, modcolor1_0, modcolor2_0, modfactor_0;
uint32_t mod_1, modcolor_1, modcolor1_1, modcolor2_1, modfactor_1;
//combine extensions
wxUint32 c_ext_a, c_ext_a_mode, c_ext_b, c_ext_b_mode, c_ext_c, c_ext_d;
uint32_t c_ext_a, c_ext_a_mode, c_ext_b, c_ext_b_mode, c_ext_c, c_ext_d;
int c_ext_c_invert, c_ext_d_invert;
wxUint32 a_ext_a, a_ext_a_mode, a_ext_b, a_ext_b_mode, a_ext_c, a_ext_d;
uint32_t a_ext_a, a_ext_a_mode, a_ext_b, a_ext_b_mode, a_ext_c, a_ext_d;
int a_ext_c_invert, a_ext_d_invert;
wxUint32 t0c_ext_a, t0c_ext_a_mode, t0c_ext_b, t0c_ext_b_mode, t0c_ext_c, t0c_ext_d;
uint32_t t0c_ext_a, t0c_ext_a_mode, t0c_ext_b, t0c_ext_b_mode, t0c_ext_c, t0c_ext_d;
int t0c_ext_c_invert, t0c_ext_d_invert;
wxUint32 t0a_ext_a, t0a_ext_a_mode, t0a_ext_b, t0a_ext_b_mode, t0a_ext_c, t0a_ext_d;
uint32_t t0a_ext_a, t0a_ext_a_mode, t0a_ext_b, t0a_ext_b_mode, t0a_ext_c, t0a_ext_d;
int t0a_ext_c_invert, t0a_ext_d_invert;
wxUint32 t1c_ext_a, t1c_ext_a_mode, t1c_ext_b, t1c_ext_b_mode, t1c_ext_c, t1c_ext_d;
uint32_t t1c_ext_a, t1c_ext_a_mode, t1c_ext_b, t1c_ext_b_mode, t1c_ext_c, t1c_ext_d;
int t1c_ext_c_invert, t1c_ext_d_invert;
wxUint32 t1a_ext_a, t1a_ext_a_mode, t1a_ext_b, t1a_ext_b_mode, t1a_ext_c, t1a_ext_d;
uint32_t t1a_ext_a, t1a_ext_a_mode, t1a_ext_b, t1a_ext_b_mode, t1a_ext_c, t1a_ext_d;
int t1a_ext_c_invert, t1a_ext_d_invert;
GRCOLORCOMBINEEXT grColorCombineExt;
GRCOLORCOMBINEEXT grAlphaCombineExt;
GRTEXCOLORCOMBINEEXT grTexColorCombineExt;
GRTEXCOLORCOMBINEEXT grTexAlphaCombineExt;
GRCONSTANTCOLORVALUEEXT grConstantColorValueExt;
wxUint32 tex_ccolor;
uint32_t tex_ccolor;
int combine_ext;
wxUint8 cmb_ext_use;
wxUint8 tex_cmb_ext_use;
wxUint32 shade_mod_hash;
uint8_t cmb_ext_use;
uint8_t tex_cmb_ext_use;
uint32_t shade_mod_hash;
} COMBINE;
extern COMBINE cmb;

View File

@ -42,7 +42,6 @@
//
//****************************************************************
// -*- C++ -*- generated by wxGlade 0.6.3 on Tue Oct 07 22:39:28 2008
#include "Gfx_1.3.h"
@ -171,7 +170,7 @@ wxNotebook(parent, id, pos, size, 0)
#ifdef TEXTURE_FILTER
if (settings.texenh_options)
{
if (!fullscreen)
if (!GfxInitDone)
{
grGlideInit();
grSstSelect(settings.card_id);
@ -185,7 +184,7 @@ wxNotebook(parent, id, pos, size, 0)
voodoo.sup_32bit_tex = TRUE;
else
voodoo.sup_32bit_tex = FALSE;
if (!fullscreen)
if (!GfxInitDone)
grGlideShutdown();
TexturePanel = new wxPanel(this, wxID_ANY);
@ -290,7 +289,6 @@ wxNotebook(parent, id, pos, size, 0)
// end wxGlade
}
BEGIN_EVENT_TABLE(ConfigNotebook, wxNotebook)
// begin wxGlade: ConfigNotebook::event_table
EVT_CHECKBOX(wxID_VRAM, ConfigNotebook::OnClickVRAM)
@ -357,7 +355,6 @@ void ConfigNotebook::onPerformace(wxCommandEvent & /*event*/)
// wxLogDebug(wxT("Event handler (ConfigNotebook::onPerformace) not implemented yet")); //notify the user that he hasn't implemented the event handler yet
}
void ConfigNotebook::onQuality(wxCommandEvent & /*event*/)
{
cbxEnhCompressCache->SetValue(true);
@ -404,7 +401,6 @@ event.Skip();
wxLogDebug(wxT("Event handler (ConfigNotebook::onPageChanged) not implemented yet")); //notify the user that he hasn't implemented the event handler yet
}
void ConfigNotebook::onPageChanging(wxNotebookEvent &event)
{
event.Skip();
@ -414,7 +410,6 @@ wxLogDebug(wxT("Event handler (ConfigNotebook::onPageChanging) not implemented y
// wxGlade: add ConfigNotebook event handlers
void ConfigNotebook::set_properties()
{
// begin wxGlade: ConfigNotebook::set_properties
@ -482,7 +477,6 @@ void ConfigNotebook::set_properties()
cbxFBO->SetValue(settings.wrpFBO > 0);
cbxAnisotropic->SetValue(settings.wrpAnisotropic > 0);
//emulation settings panel
if (settings.advanced_options)
{
@ -623,7 +617,6 @@ void ConfigNotebook::set_properties()
// end wxGlade
}
void ConfigNotebook::do_layout()
{
// begin wxGlade: ConfigNotebook::do_layout
@ -951,7 +944,6 @@ wxDialog(parent, id, title, pos, size, wxDEFAULT_DIALOG_STYLE)
// end wxGlade
}
BEGIN_EVENT_TABLE(Glide64ConfigDialog, wxDialog)
// begin wxGlade: Glide64ConfigDialog::event_table
// EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, Glide64ConfigDialog::onPageChanged)
@ -969,7 +961,6 @@ event.Skip();
wxLogDebug(wxT("Event handler (Glide64ConfigDialog::onPageChanged) not implemented yet")); //notify the user that he hasn't implemented the event handler yet
}
void Glide64ConfigDialog::onPageChanging(wxNotebookEvent &event)
{
event.Skip();
@ -993,7 +984,6 @@ void Glide64ConfigDialog::OnOK(wxCommandEvent &event)
// wxLogDebug(wxT("Event handler (Glide64ConfigDialog::OnOK) not implemented yet")); //notify the user that he hasn't implemented the event handler yet
}
void Glide64ConfigDialog::OnCancel(wxCommandEvent &event)
{
event.Skip();
@ -1001,10 +991,8 @@ void Glide64ConfigDialog::OnCancel(wxCommandEvent &event)
// wxLogDebug(wxT("Event handler (Glide64ConfigDialog::OnCancel) not implemented yet")); //notify the user that he hasn't implemented the event handler yet
}
// wxGlade: add Glide64ConfigDialog event handlers
void Glide64ConfigDialog::set_properties()
{
// begin wxGlade: Glide64ConfigDialog::set_properties
@ -1012,7 +1000,6 @@ void Glide64ConfigDialog::set_properties()
// end wxGlade
}
void Glide64ConfigDialog::do_layout()
{
// begin wxGlade: Glide64ConfigDialog::do_layout
@ -1033,10 +1020,8 @@ void Glide64ConfigDialog::do_layout()
// end wxGlade
}
#ifdef TEXTURE_FILTER
wxUint32 texfltr[] = {
uint32_t texfltr[] = {
NO_FILTER, //"None"
SMOOTH_FILTER_1, //"Smooth filtering 1"
SMOOTH_FILTER_2, //"Smooth filtering 2"
@ -1046,7 +1031,7 @@ wxUint32 texfltr[] = {
SHARP_FILTER_2, //"Sharp filtering 2"
};
wxUint32 texenht[] = {
uint32_t texenht[] = {
NO_ENHANCEMENT, //"None"
NO_ENHANCEMENT, //"Store"
X2_ENHANCEMENT, //"X2"
@ -1058,14 +1043,14 @@ wxUint32 texenht[] = {
HQ4X_ENHANCEMENT, //"HQ4X"
};
wxUint32 texcmpr[] = {
uint32_t texcmpr[] = {
//NO_COMPRESSION, //"None"
// NCC_COMPRESSION, //"NCC"
S3TC_COMPRESSION, //"S3TC"
FXT1_COMPRESSION, //"FXT1"
};
wxUint32 texhirs[] = {
uint32_t texhirs[] = {
NO_HIRESTEXTURES, //"Do not use"
RICE_HIRESTEXTURES, //"Rice format"
// GHQ_HIRESTEXTURES, //"GlideHQ format"
@ -1085,7 +1070,6 @@ output: none
void CALL DllConfig(HWND hParent)
{
LOG("DllConfig ()\n");
mutexProcessDList->Lock();
ReadSettings();
if (romopen)
@ -1153,10 +1137,8 @@ void CloseConfig()
// hostWindow->UnsubclassWin();
hostWindow->SetHWND(NULL);
#endif
mutexProcessDList->Unlock();
}
AboutDialog::AboutDialog(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long /*style*/) :
wxDialog(parent, id, title, pos, size, wxDEFAULT_DIALOG_STYLE)
{
@ -1168,7 +1150,6 @@ wxDialog(parent, id, title, pos, size, wxDEFAULT_DIALOG_STYLE)
// end wxGlade
}
void AboutDialog::set_properties()
{
// begin wxGlade: AboutDialog::set_properties
@ -1177,7 +1158,6 @@ void AboutDialog::set_properties()
// end wxGlade
}
void AboutDialog::do_layout()
{
// begin wxGlade: AboutDialog::do_layout

View File

@ -198,10 +198,10 @@ void debug_cacheviewer ()
// Draw texture memory
for (i=0; i<4; i++)
{
for (wxUint32 x=0; x<16; x++)
for (uint32_t x=0; x<16; x++)
{
wxUint32 y = i+_debugger.tex_scroll;
if (x+y*16 >= (wxUint32)rdp.n_cached[_debugger.tmu]) break;
uint32_t y = i+_debugger.tex_scroll;
if (x+y*16 >= (uint32_t)rdp.n_cached[_debugger.tmu]) break;
CACHE_LUT * cache = voodoo.tex_UMA?rdp.cache[0]:rdp.cache[_debugger.tmu];
VERTEX v[4] = {
@ -237,7 +237,7 @@ void debug_cacheviewer ()
void debug_capture ()
{
wxUint32 i,j;
uint32_t i,j;
if (_debugger.tri_list == NULL) goto END;
_debugger.tri_sel = _debugger.tri_list;
@ -313,8 +313,8 @@ void debug_capture ()
else
{
// on a texture
_debugger.tex_sel = (((wxUint32)((pt.y-SY(512))/SY(64))+_debugger.tex_scroll)*16) +
(wxUint32)(pt.x/SX(64));
_debugger.tex_sel = (((uint32_t)((pt.y-SY(512))/SY(64))+_debugger.tex_scroll)*16) +
(uint32_t)(pt.x/SX(64));
}
}
@ -324,8 +324,8 @@ void debug_capture ()
// Copy the screen capture back to the screen:
grLfbWriteRegion(GR_BUFFER_BACKBUFFER,
(wxUint32)rdp.offset_x,
(wxUint32)rdp.offset_y,
(uint32_t)rdp.offset_x,
(uint32_t)rdp.offset_y,
GR_LFB_SRC_FMT_565,
settings.res_x,
settings.res_y,
@ -403,8 +403,8 @@ void debug_capture ()
}
// and the selected texture
wxUint32 t_y = ((_debugger.tex_sel & 0xFFFFFFF0) >> 4) - _debugger.tex_scroll;
wxUint32 t_x = _debugger.tex_sel & 0xF;
uint32_t t_y = ((_debugger.tex_sel & 0xFFFFFFF0) >> 4) - _debugger.tex_scroll;
uint32_t t_x = _debugger.tex_sel & 0xF;
VERTEX vt[4] = {
{ SX(t_x*64.0f), SY(512+64.0f*t_y), 1, 1 },
{ SX(t_x*64.0f+64.0f), SY(512+64.0f*t_y), 1, 1 },
@ -615,7 +615,7 @@ void debug_capture ()
}
if (_debugger.page == PAGE_OTHERMODE_L && _debugger.tri_sel)
{
wxUint32 othermode_l = _debugger.tri_sel->othermode_l;
uint32_t othermode_l = _debugger.tri_sel->othermode_l;
COL_CATEGORY ();
OUTPUT ("OTHERMODE_L: %08lx", othermode_l);
OUTPUT_ ("AC_NONE", (othermode_l & 3) == 0);
@ -655,7 +655,7 @@ void debug_capture ()
}
if (_debugger.page == PAGE_OTHERMODE_H && _debugger.tri_sel)
{
wxUint32 othermode_h = _debugger.tri_sel->othermode_h;
uint32_t othermode_h = _debugger.tri_sel->othermode_h;
COL_CATEGORY ();
OUTPUT ("OTHERMODE_H: %08lx", othermode_h);
OUTPUT_ ("CK_NONE", (othermode_h & 0x100) == 0);
@ -726,7 +726,7 @@ void debug_capture ()
OUTPUT1 ("v[%d].a: %d", j, _debugger.tri_sel->v[j].a);
}
}
if (_debugger.page == PAGE_TEX_INFO && _debugger.tex_sel < (wxUint32)rdp.n_cached[_debugger.tmu])
if (_debugger.page == PAGE_TEX_INFO && _debugger.tex_sel < (uint32_t)rdp.n_cached[_debugger.tmu])
{
COL_CATEGORY();
OUTPUT ("CACHE (page 0)", 0);
@ -756,9 +756,9 @@ void debug_capture ()
output(800,(float)i,1,"crc: %08lx", cache[_debugger.tex_sel].crc);
i-=16;
#ifdef TEXTURE_FILTER
output(800,(float)i,1,"RiceCrc: %08lx", (wxUint32)(rdp.cache[_debugger.tmu][_debugger.tex_sel].ricecrc&0xFFFFFFFF));
output(800,(float)i,1,"RiceCrc: %08lx", (uint32_t)(rdp.cache[_debugger.tmu][_debugger.tex_sel].ricecrc&0xFFFFFFFF));
i-=16;
output(800,(float)i,1,"RicePalCrc: %08lx", (wxUint32)(rdp.cache[_debugger.tmu][_debugger.tex_sel].ricecrc>>32));
output(800,(float)i,1,"RicePalCrc: %08lx", (uint32_t)(rdp.cache[_debugger.tmu][_debugger.tex_sel].ricecrc>>32));
i-=16;
#endif
output(800,(float)i,1,"flags: %08lx", cache[_debugger.tex_sel].flags);
@ -984,8 +984,8 @@ void output (float x, float y, int scale, const char *fmt, ...)
vsprintf(out_buf, fmt, ap);
va_end(ap);
wxUint8 c,r;
for (wxUint32 i=0; i<strlen(out_buf); i++)
uint8_t c,r;
for (uint32_t i=0; i<strlen(out_buf); i++)
{
c = ((out_buf[i]-32) & 0x1F) * 8;//<< 3;
r = (((out_buf[i]-32) & 0xE0) >> 5) * 16;//<< 4;

View File

@ -43,33 +43,33 @@
typedef struct TEX_INFO_t
{
wxUint32 cur_cache[2]; // Current cache #
wxUint8 format;
wxUint8 size;
wxUint32 width, height;
wxUint16 line, wid;
wxUint8 palette;
wxUint8 clamp_s, clamp_t;
wxUint8 mirror_s, mirror_t;
wxUint8 mask_s, mask_t;
wxUint8 shift_s, shift_t;
wxUint16 ul_s, ul_t, lr_s, lr_t;
wxUint16 t_ul_s, t_ul_t, t_lr_s, t_lr_t;
uint32_t cur_cache[2]; // Current cache #
uint8_t format;
uint8_t size;
uint32_t width, height;
uint16_t line, wid;
uint8_t palette;
uint8_t clamp_s, clamp_t;
uint8_t mirror_s, mirror_t;
uint8_t mask_s, mask_t;
uint8_t shift_s, shift_t;
uint16_t ul_s, ul_t, lr_s, lr_t;
uint16_t t_ul_s, t_ul_t, t_lr_s, t_lr_t;
float scale_s, scale_t;
int tmu;
} TEX_INFO;
typedef struct TRI_INFO_t
{
wxUint32 nv; // Number of vertices
uint32_t nv; // Number of vertices
VERTEX *v; // Vertices (2d screen coords) of the triangle, used to outline
wxUint32 cycle1, cycle2, cycle_mode; // Combine mode at the time of rendering
wxUint8 uncombined; // which is uncombined: 0x01=color 0x02=alpha 0x03=both
wxUint32 geom_mode; // geometry mode flags
wxUint32 othermode_h; // setothermode_h flags
wxUint32 othermode_l; // setothermode_l flags
wxUint32 tri_n; // Triangle number
wxUint32 flags;
uint32_t cycle1, cycle2, cycle_mode; // Combine mode at the time of rendering
uint8_t uncombined; // which is uncombined: 0x01=color 0x02=alpha 0x03=both
uint32_t geom_mode; // geometry mode flags
uint32_t othermode_h; // setothermode_h flags
uint32_t othermode_l; // setothermode_l flags
uint32_t tri_n; // Triangle number
uint32_t flags;
int type; // 0-normal, 1-texrect, 2-fillrect
@ -77,12 +77,12 @@ typedef struct TRI_INFO_t
TEX_INFO t[2];
// colors
wxUint32 fog_color;
wxUint32 fill_color;
wxUint32 prim_color;
wxUint32 blend_color;
wxUint32 env_color;
wxUint32 prim_lodmin, prim_lodfrac;
uint32_t fog_color;
uint32_t fill_color;
uint32_t prim_color;
uint32_t blend_color;
uint32_t env_color;
uint32_t prim_lodmin, prim_lodfrac;
TRI_INFO_t *pNext;
} TRI_INFO;
@ -91,20 +91,20 @@ typedef struct DEBUGGER_t
{
int capture; // Capture moment for debugging?
wxUint32 selected; // Selected object (see flags above)
uint32_t selected; // Selected object (see flags above)
TRI_INFO *tri_sel;
wxUint32 tex_scroll; // texture scrolling
wxUint32 tex_sel;
uint32_t tex_scroll; // texture scrolling
uint32_t tex_sel;
// CAPTURE INFORMATION
wxUint8 *screen; // Screen capture
uint8_t *screen; // Screen capture
TRI_INFO *tri_list; // Triangle information list
TRI_INFO *tri_last; // Last in the list (first in)
wxUint32 tmu; // tmu #
uint32_t tmu; // tmu #
wxUint32 draw_mode;
uint32_t draw_mode;
// Page number
int page;

View File

@ -49,25 +49,25 @@
#include "rdp.h"
#include "DepthBufferRender.h"
wxUint16 * zLUT = 0;
uint16_t * zLUT = 0;
void ZLUT_init()
{
if (zLUT)
return;
zLUT = new wxUint16[0x40000];
zLUT = new uint16_t[0x40000];
for(int i=0; i<0x40000; i++)
{
wxUint32 exponent = 0;
wxUint32 testbit = 1 << 17;
uint32_t exponent = 0;
uint32_t testbit = 1 << 17;
while((i & testbit) && (exponent < 7))
{
exponent++;
testbit = 1 << (17 - exponent);
}
wxUint32 mantissa = (i >> (6 - (6 < exponent ? 6 : exponent))) & 0x7ff;
zLUT[i] = (wxUint16)(((exponent << 11) | mantissa) << 2);
uint32_t mantissa = (i >> (6 - (6 < exponent ? 6 : exponent))) & 0x7ff;
zLUT[i] = (uint16_t)(((exponent << 11) | mantissa) << 2);
}
}
@ -242,7 +242,7 @@ void Rasterize(vertexi * vtx, int vertices, int dzdx)
LeftSection();
} while(left_height <= 0);
wxUint16 * destptr = (wxUint16*)(gfx.RDRAM+rdp.zimg);
uint16_t * destptr = (uint16_t*)(gfx.RDRAM+rdp.zimg);
int y1 = iceil(min_y);
if (y1 >= (int)rdp.scissor_o.lr_y) return;
int shift;
@ -267,7 +267,7 @@ void Rasterize(vertexi * vtx, int vertices, int dzdx)
//draw to depth buffer
int trueZ;
int idx;
wxUint16 encodedZ;
uint16_t encodedZ;
for (int x = 0; x < width; x++)
{
trueZ = z/8192;

View File

@ -51,7 +51,7 @@ struct vertexi
int z; // z value in 16:16 bit fixed point
};
extern wxUint16 * zLUT;
extern uint16_t * zLUT;
void ZLUT_init();
void ZLUT_release();

View File

@ -47,7 +47,7 @@
#include "FBtoScreen.h"
#include "TexCache.h"
static int SetupFBtoScreenCombiner(wxUint32 texture_size, wxUint32 opaque)
static int SetupFBtoScreenCombiner(uint32_t texture_size, uint32_t opaque)
{
int tmu;
if (voodoo.tmem_ptr[GR_TMU0]+texture_size < voodoo.tex_max_addr[0])
@ -150,27 +150,27 @@ static void DrawRE2Video(FB_TO_SCREEN_INFO & fb_info, float scale)
static void DrawRE2Video256(FB_TO_SCREEN_INFO & fb_info)
{
FRDP("DrawRE2Video256. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
wxUint32 * src = (wxUint32*)(gfx.RDRAM+fb_info.addr);
uint32_t * src = (uint32_t*)(gfx.RDRAM+fb_info.addr);
GrTexInfo t_info;
t_info.smallLodLog2 = GR_LOD_LOG2_256;
t_info.largeLodLog2 = GR_LOD_LOG2_256;
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
wxUint16 * tex = (wxUint16*)texture_buffer;
wxUint16 * dst = tex;
wxUint32 col;
wxUint8 r, g, b;
uint16_t * tex = (uint16_t*)texture_buffer;
uint16_t * dst = tex;
uint32_t col;
uint8_t r, g, b;
fb_info.height = min(256, fb_info.height);
for (wxUint32 h = 0; h < fb_info.height; h++)
for (uint32_t h = 0; h < fb_info.height; h++)
{
for (wxUint32 w = 0; w < 256; w++)
for (uint32_t w = 0; w < 256; w++)
{
col = *(src++);
r = (wxUint8)((col >> 24)&0xFF);
r = (wxUint8)((float)r / 255.0f * 31.0f);
g = (wxUint8)((col >> 16)&0xFF);
g = (wxUint8)((float)g / 255.0f * 63.0f);
b = (wxUint8)((col >> 8)&0xFF);
b = (wxUint8)((float)b / 255.0f * 31.0f);
r = (uint8_t)((col >> 24)&0xFF);
r = (uint8_t)((float)r / 255.0f * 31.0f);
g = (uint8_t)((col >> 16)&0xFF);
g = (uint8_t)((float)g / 255.0f * 63.0f);
b = (uint8_t)((col >> 8)&0xFF);
b = (uint8_t)((float)b / 255.0f * 31.0f);
*(dst++) = (r << 11) | (g << 5) | b;
}
src += (fb_info.width - 256);
@ -197,50 +197,50 @@ static void DrawFrameBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
return;
}
FRDP("DrawFrameBufferToScreen256. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
wxUint32 width = fb_info.lr_x - fb_info.ul_x + 1;
wxUint32 height = fb_info.lr_y - fb_info.ul_y + 1;
uint32_t width = fb_info.lr_x - fb_info.ul_x + 1;
uint32_t height = fb_info.lr_y - fb_info.ul_y + 1;
GrTexInfo t_info;
wxUint8 * image = gfx.RDRAM+fb_info.addr;
wxUint32 width256 = ((width-1) >> 8) + 1;
wxUint32 height256 = ((height-1) >> 8) + 1;
uint8_t * image = gfx.RDRAM+fb_info.addr;
uint32_t width256 = ((width-1) >> 8) + 1;
uint32_t height256 = ((height-1) >> 8) + 1;
t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256;
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
t_info.format = GR_TEXFMT_ARGB_1555;
wxUint16 * tex = (wxUint16*)texture_buffer;
uint16_t * tex = (uint16_t*)texture_buffer;
t_info.data = tex;
wxUint32 tex_size = grTexTextureMemRequired (GR_MIPMAPLEVELMASK_BOTH, &t_info);
uint32_t tex_size = grTexTextureMemRequired (GR_MIPMAPLEVELMASK_BOTH, &t_info);
int tmu = SetupFBtoScreenCombiner(tex_size*width256*height256, fb_info.opaque);
wxUint16 * src = (wxUint16*)image;
uint16_t * src = (uint16_t*)image;
src += fb_info.ul_x + fb_info.ul_y * fb_info.width;
wxUint32 * src32 = (wxUint32*)image;
uint32_t * src32 = (uint32_t*)image;
src32 += fb_info.ul_x + fb_info.ul_y * fb_info.width;
wxUint32 w_tail = width%256;
wxUint32 h_tail = height%256;
wxUint16 c;
wxUint32 c32;
wxUint32 idx;
wxUint32 bound = BMASK+1-fb_info.addr;
uint32_t w_tail = width%256;
uint32_t h_tail = height%256;
uint16_t c;
uint32_t c32;
uint32_t idx;
uint32_t bound = BMASK+1-fb_info.addr;
bound = fb_info.size == 2 ? bound >> 1 : bound >> 2;
wxUint8 r, g, b, a;
wxUint32 cur_width, cur_height, cur_tail;
wxUint32 tex_adr = voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu];
uint8_t r, g, b, a;
uint32_t cur_width, cur_height, cur_tail;
uint32_t tex_adr = voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu];
if ((voodoo.tmem_ptr[tmu] < TEXMEM_2MB_EDGE) && (voodoo.tmem_ptr[tmu]+tex_size*width256*height256 > TEXMEM_2MB_EDGE))
{
tex_adr = TEXMEM_2MB_EDGE;
}
for (wxUint32 h = 0; h < height256; h++)
for (uint32_t h = 0; h < height256; h++)
{
for (wxUint32 w = 0; w < width256; w++)
for (uint32_t w = 0; w < width256; w++)
{
cur_width = (256*(w+1) < width) ? 256 : w_tail;
cur_height = (256*(h+1) < height) ? 256 : h_tail;
cur_tail = 256 - cur_width;
wxUint16 * dst = tex;
uint16_t * dst = tex;
if (fb_info.size == 2)
{
for (wxUint32 y=0; y < cur_height; y++)
for (uint32_t y=0; y < cur_height; y++)
{
for (wxUint32 x=0; x < cur_width; x++)
for (uint32_t x=0; x < cur_width; x++)
{
idx = (x+256*w+(y+256*h)*fb_info.width)^1;
if (idx >= bound)
@ -253,20 +253,20 @@ static void DrawFrameBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
}
else
{
for (wxUint32 y=0; y < cur_height; y++)
for (uint32_t y=0; y < cur_height; y++)
{
for (wxUint32 x=0; x < cur_width; x++)
for (uint32_t x=0; x < cur_width; x++)
{
idx = (x+256*w+(y+256*h)*fb_info.width);
if (idx >= bound)
break;
c32 = src32[idx];
r = (wxUint8)((c32 >> 24)&0xFF);
r = (wxUint8)((float)r / 255.0f * 31.0f);
g = (wxUint8)((c32 >> 16)&0xFF);
g = (wxUint8)((float)g / 255.0f * 63.0f);
b = (wxUint8)((c32 >> 8)&0xFF);
b = (wxUint8)((float)b / 255.0f * 31.0f);
r = (uint8_t)((c32 >> 24)&0xFF);
r = (uint8_t)((float)r / 255.0f * 31.0f);
g = (uint8_t)((c32 >> 16)&0xFF);
g = (uint8_t)((float)g / 255.0f * 63.0f);
b = (uint8_t)((c32 >> 8)&0xFF);
b = (uint8_t)((float)b / 255.0f * 31.0f);
a = (c32&0xFF) ? 1 : 0;
*(dst++) = (a<<15) | (r << 10) | (g << 5) | b;
}
@ -306,18 +306,18 @@ bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
{
if (fb_info.width < 200 || fb_info.size < 2)
return false;
wxUint32 width = fb_info.lr_x - fb_info.ul_x + 1;
wxUint32 height = fb_info.lr_y - fb_info.ul_y + 1;
wxUint32 max_size = min(voodoo.max_tex_size, 512);
if (width > (wxUint32)max_size || height > (wxUint32)max_size)
uint32_t width = fb_info.lr_x - fb_info.ul_x + 1;
uint32_t height = fb_info.lr_y - fb_info.ul_y + 1;
uint32_t max_size = min(voodoo.max_tex_size, 512);
if (width > (uint32_t)max_size || height > (uint32_t)max_size)
{
DrawFrameBufferToScreen256(fb_info);
return true;
}
FRDP("DrawFrameBufferToScreen. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
GrTexInfo t_info;
wxUint8 * image = gfx.RDRAM+fb_info.addr;
wxUint32 texwidth;
uint8_t * image = gfx.RDRAM+fb_info.addr;
uint32_t texwidth;
float scale;
if (width <= 256)
{
@ -343,17 +343,17 @@ bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
if (fb_info.size == 2)
{
wxUint16 * tex = (wxUint16*)texture_buffer;
wxUint16 * dst = tex;
wxUint16 * src = (wxUint16*)image;
uint16_t * tex = (uint16_t*)texture_buffer;
uint16_t * dst = tex;
uint16_t * src = (uint16_t*)image;
src += fb_info.ul_x + fb_info.ul_y * fb_info.width;
wxUint16 c;
wxUint32 idx;
const wxUint32 bound = (BMASK+1-fb_info.addr) >> 1;
uint16_t c;
uint32_t idx;
const uint32_t bound = (BMASK+1-fb_info.addr) >> 1;
bool empty = true;
for (wxUint32 y=0; y < height; y++)
for (uint32_t y=0; y < height; y++)
{
for (wxUint32 x=0; x < width; x++)
for (uint32_t x=0; x < width; x++)
{
idx = (x+y*fb_info.width)^1;
if (idx >= bound)
@ -371,16 +371,16 @@ bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
}
else
{
wxUint32 * tex = (wxUint32*)texture_buffer;
wxUint32 * dst = tex;
wxUint32 * src = (wxUint32*)image;
uint32_t * tex = (uint32_t*)texture_buffer;
uint32_t * dst = tex;
uint32_t * src = (uint32_t*)image;
src += fb_info.ul_x + fb_info.ul_y * fb_info.width;
wxUint32 col;
wxUint32 idx;
const wxUint32 bound = (BMASK+1-fb_info.addr) >> 2;
for (wxUint32 y=0; y < height; y++)
uint32_t col;
uint32_t idx;
const uint32_t bound = (BMASK+1-fb_info.addr) >> 2;
for (uint32_t y=0; y < height; y++)
{
for (wxUint32 x=0; x < width; x++)
for (uint32_t x=0; x < width; x++)
{
idx = x+y*fb_info.width;
if (idx >= bound)
@ -431,18 +431,18 @@ bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
static void DrawDepthBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
{
FRDP("DrawDepthBufferToScreen256. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
wxUint32 width = fb_info.lr_x - fb_info.ul_x + 1;
wxUint32 height = fb_info.lr_y - fb_info.ul_y + 1;
uint32_t width = fb_info.lr_x - fb_info.ul_x + 1;
uint32_t height = fb_info.lr_y - fb_info.ul_y + 1;
GrTexInfo t_info;
wxUint8 * image = gfx.RDRAM+fb_info.addr;
wxUint32 width256 = ((width-1) >> 8) + 1;
wxUint32 height256 = ((height-1) >> 8) + 1;
uint8_t * image = gfx.RDRAM+fb_info.addr;
uint32_t width256 = ((width-1) >> 8) + 1;
uint32_t height256 = ((height-1) >> 8) + 1;
t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256;
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
t_info.format = GR_TEXFMT_ALPHA_INTENSITY_88;
wxUint16 * tex = (wxUint16*)texture_buffer;
uint16_t * tex = (uint16_t*)texture_buffer;
t_info.data = tex;
wxUint32 tex_size = grTexTextureMemRequired (GR_MIPMAPLEVELMASK_BOTH, &t_info);
uint32_t tex_size = grTexTextureMemRequired (GR_MIPMAPLEVELMASK_BOTH, &t_info);
int tmu = SetupFBtoScreenCombiner(tex_size*width256*height256, fb_info.opaque);
grConstantColorValue (rdp.fog_color);
grColorCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
@ -450,27 +450,27 @@ static void DrawDepthBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_CONSTANT,
FXFALSE);
wxUint16 * src = (wxUint16*)image;
uint16_t * src = (uint16_t*)image;
src += fb_info.ul_x + fb_info.ul_y * fb_info.width;
wxUint32 w_tail = width%256;
wxUint32 h_tail = height%256;
wxUint32 cur_width, cur_height, cur_tail;
wxUint32 tex_adr = voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu];
uint32_t w_tail = width%256;
uint32_t h_tail = height%256;
uint32_t cur_width, cur_height, cur_tail;
uint32_t tex_adr = voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu];
if ((voodoo.tmem_ptr[tmu] < TEXMEM_2MB_EDGE) && (voodoo.tmem_ptr[tmu]+tex_size*width256*height256 > TEXMEM_2MB_EDGE))
{
tex_adr = TEXMEM_2MB_EDGE;
}
for (wxUint32 h = 0; h < height256; h++)
for (uint32_t h = 0; h < height256; h++)
{
for (wxUint32 w = 0; w < width256; w++)
for (uint32_t w = 0; w < width256; w++)
{
cur_width = (256*(w+1) < width) ? 256 : w_tail;
cur_height = (256*(h+1) < height) ? 256 : h_tail;
cur_tail = 256 - cur_width;
wxUint16 * dst = tex;
for (wxUint32 y=0; y < cur_height; y++)
uint16_t * dst = tex;
for (uint32_t y=0; y < cur_height; y++)
{
for (wxUint32 x=0; x < cur_width; x++)
for (uint32_t x=0; x < cur_width; x++)
{
*(dst++) = rdp.pal_8[src[(x+256*w+(y+256*h)*fb_info.width)^1]>>8];
}
@ -571,9 +571,9 @@ static void DrawHiresDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
void DrawDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
{
wxUint32 width = fb_info.lr_x - fb_info.ul_x + 1;
wxUint32 height = fb_info.lr_y - fb_info.ul_y + 1;
if (width > (wxUint32)voodoo.max_tex_size || height > (wxUint32)voodoo.max_tex_size || width > 512)
uint32_t width = fb_info.lr_x - fb_info.ul_x + 1;
uint32_t height = fb_info.lr_y - fb_info.ul_y + 1;
if (width > (uint32_t)voodoo.max_tex_size || height > (uint32_t)voodoo.max_tex_size || width > 512)
{
DrawDepthBufferToScreen256(fb_info);
return;
@ -585,8 +585,8 @@ void DrawDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
}
FRDP("DrawDepthBufferToScreen. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
GrTexInfo t_info;
wxUint8 * image = gfx.RDRAM+fb_info.addr;
wxUint32 texwidth;
uint8_t * image = gfx.RDRAM+fb_info.addr;
uint32_t texwidth;
float scale;
if (width <= 256)
{
@ -610,13 +610,13 @@ void DrawDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
}
wxUint16 * tex = (wxUint16*)texture_buffer;
wxUint16 * dst = tex;
wxUint16 * src = (wxUint16*)image;
uint16_t * tex = (uint16_t*)texture_buffer;
uint16_t * dst = tex;
uint16_t * src = (uint16_t*)image;
src += fb_info.ul_x + fb_info.ul_y * fb_info.width;
for (wxUint32 y=0; y < height; y++)
for (uint32_t y=0; y < height; y++)
{
for (wxUint32 x=0; x < width; x++)
for (uint32_t x=0; x < width; x++)
{
*(dst++) = rdp.pal_8[src[(x+y*fb_info.width)^1]>>8];
}

View File

@ -46,15 +46,15 @@
typedef struct
{
wxUint32 addr; //color image address
wxUint32 size;
wxUint32 width;
wxUint32 height;
wxUint32 ul_x;
wxUint32 ul_y;
wxUint32 lr_x;
wxUint32 lr_y;
wxUint32 opaque;
uint32_t addr; //color image address
uint32_t size;
uint32_t width;
uint32_t height;
uint32_t ul_x;
uint32_t ul_y;
uint32_t lr_x;
uint32_t lr_y;
uint32_t opaque;
} FB_TO_SCREEN_INFO;
bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info);

View File

@ -142,7 +142,6 @@ extern "C" {
//#define SHOW_FULL_TEXVIEWER // shows the entire contents of the texture in the cache viewer,
// usually used to debug clamping issues.
// Usually enabled
#define LARGE_TEXTURE_HANDLING // allow large-textured objects to be split?
@ -175,7 +174,7 @@ extern std::ofstream extlog;
extern wxDateTime fps_last;
extern wxDateTime fps_next;
extern float fps;
extern wxUint32 fps_count;
extern uint32_t fps_count;
#endif
// rdram mask at 0x400000 bytes (bah, not right for majora's mask)
@ -184,8 +183,8 @@ extern unsigned int BMASK;
#define WMASK 0x3FFFFF
#define DMASK 0x1FFFFF
extern wxUint32 update_screen_count;
extern wxUint32 resolutions[0x18][2];
extern uint32_t update_screen_count;
extern uint32_t resolutions[0x18][2];
int CheckKeyPressed(int key, int mask);
@ -202,7 +201,6 @@ extern std::ofstream loga;
#define LOG(x)
#endif
#ifdef RDP_LOGGING
extern int log_open;
extern std::ofstream rdp_log;
@ -221,7 +219,6 @@ extern std::ofstream rdp_log;
#define LRDP(x)
#endif
#ifdef RDP_ERROR_LOG
extern int elog_open;
extern std::ofstream rdp_err;
@ -276,7 +273,7 @@ __inline void FRDP_E (const char *fmt, ...)
__inline void FRDP_E(const char * /*fmt*/, ...) {}
#endif
extern int fullscreen;
extern int GfxInitDone;
extern int romopen;
extern int to_fullscreen;
extern int debugging;
@ -285,14 +282,13 @@ extern int evoodoo;
extern int ev_fullscreen;
extern int exception;
extern wxMutex *mutexProcessDList;
int InitGfx();
void ReleaseGfx();
// The highest 8 bits are the segment # (1-16), and the lower 24 bits are the offset to
// add to it.
__inline wxUint32 segoffset (wxUint32 so)
__inline uint32_t segoffset(uint32_t so)
{
return (rdp.segment[(so >> 24) & 0x0f] + (so&BMASK))&BMASK;
}
@ -336,31 +332,31 @@ typedef struct {
wxUint8 * DMEM;
wxUint8 * IMEM;
wxUint32 * MI_INTR_REG;
uint32_t * MI_INTR_REG;
wxUint32 * DPC_START_REG;
wxUint32 * DPC_END_REG;
wxUint32 * DPC_CURRENT_REG;
wxUint32 * DPC_STATUS_REG;
wxUint32 * DPC_CLOCK_REG;
wxUint32 * DPC_BUFBUSY_REG;
wxUint32 * DPC_PIPEBUSY_REG;
wxUint32 * DPC_TMEM_REG;
uint32_t * DPC_START_REG;
uint32_t * DPC_END_REG;
uint32_t * DPC_CURRENT_REG;
uint32_t * DPC_STATUS_REG;
uint32_t * DPC_CLOCK_REG;
uint32_t * DPC_BUFBUSY_REG;
uint32_t * DPC_PIPEBUSY_REG;
uint32_t * DPC_TMEM_REG;
wxUint32 * VI_STATUS_REG;
wxUint32 * VI_ORIGIN_REG;
wxUint32 * VI_WIDTH_REG;
wxUint32 * VI_INTR_REG;
wxUint32 * VI_V_CURRENT_LINE_REG;
wxUint32 * VI_TIMING_REG;
wxUint32 * VI_V_SYNC_REG;
wxUint32 * VI_H_SYNC_REG;
wxUint32 * VI_LEAP_REG;
wxUint32 * VI_H_START_REG;
wxUint32 * VI_V_START_REG;
wxUint32 * VI_V_BURST_REG;
wxUint32 * VI_X_SCALE_REG;
wxUint32 * VI_Y_SCALE_REG;
uint32_t * VI_STATUS_REG;
uint32_t * VI_ORIGIN_REG;
uint32_t * VI_WIDTH_REG;
uint32_t * VI_INTR_REG;
uint32_t * VI_V_CURRENT_LINE_REG;
uint32_t * VI_TIMING_REG;
uint32_t * VI_V_SYNC_REG;
uint32_t * VI_H_SYNC_REG;
uint32_t * VI_LEAP_REG;
uint32_t * VI_H_START_REG;
uint32_t * VI_V_START_REG;
uint32_t * VI_V_BURST_REG;
uint32_t * VI_X_SCALE_REG;
uint32_t * VI_Y_SCALE_REG;
void(*CheckInterrupts)(void);
} GFX_INFO;
@ -369,8 +365,6 @@ extern GFX_INFO gfx;
extern wxWindow * GFXWindow;
extern bool no_dlist;
typedef void (FX_CALL *GRCOLORCOMBINEEXT) (GrCCUColor_t a,
GrCombineMode_t a_mode,
GrCCUColor_t b,
@ -400,7 +394,6 @@ typedef void (FX_CALL *GRCONSTANTCOLORVALUEEXT)
typedef void (FX_CALL *GRSTIPPLE)(FxI32 mode);
typedef int(*GETTEXADDR)(int tmu, int texsize);
extern GRSTIPPLE grStippleModeExt;
@ -471,7 +464,6 @@ EXPORT void CALL DllConfig ( HWND hParent );
*******************************************************************/
EXPORT void CALL DllTest(HWND hParent);
EXPORT void CALL ReadScreen(void **dest, int *width, int *height);
/******************************************************************
@ -597,23 +589,22 @@ EXPORT void CALL ViStatusChanged (void);
*******************************************************************/
EXPORT void CALL ViWidthChanged(void);
/******************************************************************
Function: FrameBufferWrite
Purpose: This function is called to notify the dll that the
frame buffer has been modified by CPU at the given address.
input: addr rdram address
val val
size 1 = wxUint8, 2 = wxUint16, 4 = wxUint32
size 1 = wxUint8, 2 = wxUint16, 4 = uint32_t
output: none
*******************************************************************/
EXPORT void CALL FBWrite(wxUint32, wxUint32);
EXPORT void CALL FBWrite(uint32_t, uint32_t);
typedef struct
{
wxUint32 addr;
wxUint32 val;
wxUint32 size; // 1 = wxUint8, 2 = wxUint16, 4=wxUint32
uint32_t addr;
uint32_t val;
uint32_t size; // 1 = wxUint8, 2 = wxUint16, 4=uint32_t
} FrameBufferModifyEntry;
/******************************************************************
@ -624,7 +615,7 @@ typedef struct
size = size of the plist, max = 1024
output: none
*******************************************************************/
EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, wxUint32 size);
EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, uint32_t size);
/******************************************************************
Function: FrameBufferRead
@ -638,10 +629,10 @@ EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, wxUint32 size);
is read within the same 4KB range
input: addr rdram address
val val
size 1 = wxUint8, 2 = wxUint16, 4 = wxUint32
size 1 = wxUint8, 2 = wxUint16, 4 = uint32_t
output: none
*******************************************************************/
EXPORT void CALL FBRead(wxUint32 addr);
EXPORT void CALL FBRead(uint32_t addr);
/************************************************************************
Function: FBGetFrameBufferInfo

View File

@ -50,6 +50,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="Gfx_1.3.h" />
<ClInclude Include="turbo3D.h" />
<ClInclude Include="ucode.h" />
<ClInclude Include="ucode00.h" />

View File

@ -127,6 +127,7 @@
<ClInclude Include="TexBuffer.h" />
<ClInclude Include="Util.h" />
<ClInclude Include="Version.h" />
<ClInclude Include="Gfx_1.3.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="CRC.cpp">

View File

@ -80,7 +80,7 @@ GFX_INFO gfx;
wxWindow * GFXWindow = NULL;
int to_fullscreen = FALSE;
int fullscreen = FALSE;
int GfxInitDone = FALSE;
int romopen = FALSE;
GrContext_t gfx_context = 0;
int debugging = FALSE;
@ -115,12 +115,12 @@ int64 perf_next;
wxDateTime fps_last;
wxDateTime fps_next;
float fps = 0.0f;
wxUint32 fps_count = 0;
uint32_t fps_count = 0;
wxUint32 vi_count = 0;
uint32_t vi_count = 0;
float vi = 0.0f;
wxUint32 region = 0;
uint32_t region = 0;
float ntsc_percent = 0.0f;
float pal_percent = 0.0f;
@ -128,7 +128,7 @@ float pal_percent = 0.0f;
#endif
// Resolutions, MUST be in the correct order (SST1VID.H)
wxUint32 resolutions[0x18][2] = {
uint32_t resolutions[0x18][2] = {
{ 320, 200 },
{ 320, 240 },
{ 400, 256 },
@ -175,10 +175,10 @@ VOODOO voodoo = {0, 0, 0, 0,
GrTexInfo fontTex;
GrTexInfo cursorTex;
wxUint32 offset_font = 0;
wxUint32 offset_cursor = 0;
wxUint32 offset_textures = 0;
wxUint32 offset_texbuf1 = 0;
uint32_t offset_font = 0;
uint32_t offset_cursor = 0;
uint32_t offset_textures = 0;
uint32_t offset_texbuf1 = 0;
int capture_screen = 0;
wxString capture_path;
@ -211,25 +211,25 @@ void _ChangeSize ()
// float res_scl_x = (float)settings.res_x / 320.0f;
float res_scl_y = (float)settings.res_y / 240.0f;
wxUint32 scale_x = *gfx.VI_X_SCALE_REG & 0xFFF;
uint32_t scale_x = *gfx.VI_X_SCALE_REG & 0xFFF;
if (!scale_x) return;
wxUint32 scale_y = *gfx.VI_Y_SCALE_REG & 0xFFF;
uint32_t scale_y = *gfx.VI_Y_SCALE_REG & 0xFFF;
if (!scale_y) return;
float fscale_x = (float)scale_x / 1024.0f;
float fscale_y = (float)scale_y / 2048.0f;
wxUint32 dwHStartReg = *gfx.VI_H_START_REG;
wxUint32 dwVStartReg = *gfx.VI_V_START_REG;
uint32_t dwHStartReg = *gfx.VI_H_START_REG;
uint32_t dwVStartReg = *gfx.VI_V_START_REG;
wxUint32 hstart = dwHStartReg >> 16;
wxUint32 hend = dwHStartReg & 0xFFFF;
uint32_t hstart = dwHStartReg >> 16;
uint32_t hend = dwHStartReg & 0xFFFF;
// dunno... but sometimes this happens
if (hend == hstart) hend = (int)(*gfx.VI_WIDTH_REG / fscale_x);
wxUint32 vstart = dwVStartReg >> 16;
wxUint32 vend = dwVStartReg & 0xFFFF;
uint32_t vstart = dwVStartReg >> 16;
uint32_t vend = dwVStartReg & 0xFFFF;
rdp.vi_width = (hend - hstart) * fscale_x;
rdp.vi_height = (vend - vstart) * fscale_y * 1.0126582f;
@ -257,13 +257,13 @@ void _ChangeSize ()
//rdp.offset_x = 0;
// rdp.offset_y = 0;
rdp.offset_y = ((float)settings.res_y - rdp.vi_height * rdp.scale_y) * 0.5f;
if (((wxUint32)rdp.vi_width <= (*gfx.VI_WIDTH_REG)/2) && (rdp.vi_width > rdp.vi_height))
if (((uint32_t)rdp.vi_width <= (*gfx.VI_WIDTH_REG) / 2) && (rdp.vi_width > rdp.vi_height))
rdp.scale_y *= 0.5f;
rdp.scissor_o.ul_x = 0;
rdp.scissor_o.ul_y = 0;
rdp.scissor_o.lr_x = (wxUint32)rdp.vi_width;
rdp.scissor_o.lr_y = (wxUint32)rdp.vi_height;
rdp.scissor_o.lr_x = (uint32_t)rdp.vi_width;
rdp.scissor_o.lr_y = (uint32_t)rdp.vi_height;
rdp.update |= UPDATE_VIEWPORT | UPDATE_SCISSOR;
}
@ -280,19 +280,21 @@ void ChangeSize ()
case 0: //4:3
if (settings.scr_res_x >= settings.scr_res_y * 4.0f / 3.0f) {
settings.res_y = settings.scr_res_y;
settings.res_x = (wxUint32)(settings.res_y * 4.0f / 3.0f);
} else {
settings.res_x = (uint32_t)(settings.res_y * 4.0f / 3.0f);
}
else {
settings.res_x = settings.scr_res_x;
settings.res_y = (wxUint32)(settings.res_x / 4.0f * 3.0f);
settings.res_y = (uint32_t)(settings.res_x / 4.0f * 3.0f);
}
break;
case 1: //16:9
if (settings.scr_res_x >= settings.scr_res_y * 16.0f / 9.0f) {
settings.res_y = settings.scr_res_y;
settings.res_x = (wxUint32)(settings.res_y * 16.0f / 9.0f);
} else {
settings.res_x = (uint32_t)(settings.res_y * 16.0f / 9.0f);
}
else {
settings.res_x = settings.scr_res_x;
settings.res_y = (wxUint32)(settings.res_x / 16.0f * 9.0f);
settings.res_y = (uint32_t)(settings.res_x / 16.0f * 9.0f);
}
break;
default: //stretch or original
@ -302,8 +304,8 @@ void ChangeSize ()
_ChangeSize();
rdp.offset_x = (settings.scr_res_x - settings.res_x) / 2.0f;
float offset_y = (settings.scr_res_y - settings.res_y) / 2.0f;
settings.res_x += (wxUint32)rdp.offset_x;
settings.res_y += (wxUint32)offset_y;
settings.res_x += (uint32_t)rdp.offset_x;
settings.res_y += (uint32_t)offset_y;
rdp.offset_y += offset_y;
if (settings.aspectmode == 3) // original
{
@ -328,13 +330,13 @@ void UseUnregisteredSetting (int /*SettingID*/)
void ReadSettings()
{
settings.card_id = GetSetting(Set_CardId);
settings.res_data = (wxUint32)GetSetting(Set_Resolution);
settings.res_data = (uint32_t)GetSetting(Set_Resolution);
if (settings.res_data >= 24) settings.res_data = 12;
settings.scr_res_x = settings.res_x = resolutions[settings.res_data][0];
settings.scr_res_y = settings.res_y = resolutions[settings.res_data][1];
settings.vsync = GetSetting(Set_vsync);
settings.ssformat = (wxUint8)GetSetting(Set_ssformat);
settings.show_fps = (wxUint8)GetSetting(Set_ShowFps);
settings.ssformat = (uint8_t)GetSetting(Set_ssformat);
settings.show_fps = (uint8_t)GetSetting(Set_ShowFps);
settings.clock = GetSetting(Set_clock);
settings.clock_24_hr = GetSetting(Set_clock_24_hr);
settings.advanced_options = Set_basic_mode ? !GetSystemSetting(Set_basic_mode) : 0;
@ -374,16 +376,15 @@ void ReadSettings ()
settings.unk_clear = FALSE;
#endif
#ifdef TEXTURE_FILTER
char texture_dir[MAX_PATH];
memset(texture_dir, 0, sizeof(texture_dir));
GetSystemSettingSz(Set_texture_dir, texture_dir, sizeof(texture_dir));
settings.texture_dir = texture_dir;
settings.ghq_fltr = (wxUint8)GetSetting(Set_ghq_fltr);
settings.ghq_cmpr = (wxUint8)GetSetting(Set_ghq_cmpr);
settings.ghq_enht = (wxUint8)GetSetting(Set_ghq_enht);
settings.ghq_hirs = (wxUint8)GetSetting(Set_ghq_hirs);
settings.ghq_fltr = (uint8_t)GetSetting(Set_ghq_fltr);
settings.ghq_cmpr = (uint8_t)GetSetting(Set_ghq_cmpr);
settings.ghq_enht = (uint8_t)GetSetting(Set_ghq_enht);
settings.ghq_hirs = (uint8_t)GetSetting(Set_ghq_hirs);
settings.ghq_enht_cmpr = GetSetting(Set_ghq_enht_cmpr);
settings.ghq_enht_tile = GetSetting(Set_ghq_enht_tile);
settings.ghq_enht_f16bpp = GetSetting(Set_ghq_enht_f16bpp);
@ -484,7 +485,7 @@ void ReadSpecialSettings (const char * name)
settings.pal230 = GetSetting(Set_pal230) == 1 ? 1 : 0;
settings.stipple_mode = GetSetting(Set_stipple_mode);
int stipple_pattern = GetSetting(Set_stipple_pattern);
settings.stipple_pattern = stipple_pattern > 0 ? (wxUint32)stipple_pattern : 0x3E0F83E0;
settings.stipple_pattern = stipple_pattern > 0 ? (uint32_t)stipple_pattern : 0x3E0F83E0;
settings.force_microcheck = GetSetting(Set_force_microcheck);
settings.force_quad3d = GetSetting(Set_force_quad3d);
settings.clip_zmin = GetSetting(Set_clip_zmin);
@ -528,7 +529,7 @@ void ReadSpecialSettings (const char * name)
int resolution = GetSetting(Set_Resolution);
if (resolution >= 0)
{
settings.res_data = (wxUint32)resolution;
settings.res_data = (uint32_t)resolution;
if (settings.res_data >= 0x18) settings.res_data = 12;
settings.scr_res_x = settings.res_x = resolutions[settings.res_data][0];
settings.scr_res_y = settings.res_y = resolutions[settings.res_data][1];
@ -713,11 +714,11 @@ void guLoadTextures ()
}
#include "font.h"
wxUint32 *data = (wxUint32*)font;
wxUint32 cur;
uint32_t *data = (uint32_t*)font;
uint32_t cur;
// ** Font texture **
wxUint8 *tex8 = (wxUint8*)malloc(256*64);
uint8_t *tex8 = (uint8_t*)malloc(256 * 64);
fontTex.smallLodLog2 = fontTex.largeLodLog2 = GR_LOD_LOG2_256;
fontTex.aspectRatioLog2 = GR_ASPECT_LOG2_4x1;
@ -725,7 +726,7 @@ void guLoadTextures ()
fontTex.data = tex8;
// Decompression: [1-bit inverse alpha --> 8-bit alpha]
wxUint32 i,b;
uint32_t i, b;
for (i = 0; i < 0x200; i++)
{
// cur = ~*(data++), byteswapped
@ -755,9 +756,9 @@ void guLoadTextures ()
// ** Cursor texture **
#include "cursor.h"
data = (wxUint32*)cursor;
data = (uint32_t*)cursor;
wxUint16 *tex16 = (wxUint16*)malloc(32*32*2);
uint16_t *tex16 = (uint16_t*)malloc(32 * 32 * 2);
cursorTex.smallLodLog2 = cursorTex.largeLodLog2 = GR_LOD_LOG2_32;
cursorTex.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
@ -768,8 +769,8 @@ void guLoadTextures ()
for (i = 0; i < 0x200; i++)
{
cur = *(data++);
*(tex16++) = (wxUint16)(((cur&0x000000FF)<<8)|((cur&0x0000FF00)>>8));
*(tex16++) = (wxUint16)(((cur&0x00FF0000)>>8)|((cur&0xFF000000)>>24));
*(tex16++) = (uint16_t)(((cur & 0x000000FF) << 8) | ((cur & 0x0000FF00) >> 8));
*(tex16++) = (uint16_t)(((cur & 0x00FF0000) >> 8) | ((cur & 0xFF000000) >> 24));
}
grTexDownloadMipMap(GR_TMU0,
@ -798,8 +799,6 @@ void DisplayLoadProgress(const wchar_t *format, ...)
// XXX: convert to multibyte
wcstombs(buf, wbuf, INFO_BUF);
if (fullscreen)
{
float x;
set_message_combiner();
output(382, 380, 1, "LOADING TEXTURES. PLEASE WAIT...");
@ -810,13 +809,14 @@ void DisplayLoadProgress(const wchar_t *format, ...)
grColorMask(FXTRUE, FXTRUE);
grBufferClear(0, 0, 0xFFFF);
}
}
#endif
int InitGfx()
{
if (fullscreen)
if (GfxInitDone)
{
ReleaseGfx();
}
OPEN_RDP_LOG(); // doesn't matter if opens again; it will check for it
OPEN_RDP_E_LOG();
@ -850,15 +850,20 @@ int InitGfx ()
unsigned int SST_type = GR_SSTTYPE_VOODOO;
if (strstr(hardware, "Rush")) {
SST_type = GR_SSTTYPE_SST96;
} else if (strstr(hardware, "Voodoo2")) {
}
else if (strstr(hardware, "Voodoo2")) {
SST_type = GR_SSTTYPE_Voodoo2;
} else if (strstr(hardware, "Voodoo Banshee")) {
}
else if (strstr(hardware, "Voodoo Banshee")) {
SST_type = GR_SSTTYPE_Banshee;
} else if (strstr(hardware, "Voodoo3")) {
}
else if (strstr(hardware, "Voodoo3")) {
SST_type = GR_SSTTYPE_Voodoo3;
} else if (strstr(hardware, "Voodoo4")) {
}
else if (strstr(hardware, "Voodoo4")) {
SST_type = GR_SSTTYPE_Voodoo4;
} else if (strstr(hardware, "Voodoo5")) {
}
else if (strstr(hardware, "Voodoo5")) {
SST_type = GR_SSTTYPE_Voodoo5;
}
// 2Mb Texture boundary
@ -874,10 +879,10 @@ int InitGfx ()
}
//*/
wxUint32 res_data = settings.res_data;
uint32_t res_data = settings.res_data;
if (ev_fullscreen)
{
wxUint32 _width, _height = 0;
uint32_t _width, _height = 0;
settings.res_data = grWrapperFullScreenResolutionExt((FxU32*)&_width, (FxU32*)&_height);
settings.scr_res_x = settings.res_x = _width;
settings.scr_res_y = settings.res_y = _height;
@ -923,7 +928,7 @@ int InitGfx ()
return FALSE;
}
fullscreen = TRUE;
GfxInitDone = TRUE;
to_fullscreen = FALSE;
#ifdef __WINDOWS__
@ -1126,7 +1131,7 @@ void ReleaseGfx ()
// Shutdown glide
grGlideShutdown();
fullscreen = FALSE;
GfxInitDone = FALSE;
rdp.window_changed = TRUE;
}
@ -1144,8 +1149,6 @@ IMPLEMENT_APP_NO_MAIN(wxDLLApp)
bool wxDLLApp::OnInit()
{
if (mutexProcessDList == NULL)
mutexProcessDList = new wxMutex(wxMUTEX_DEFAULT);
wxImage::AddHandler(new wxPNGHandler);
wxImage::AddHandler(new wxJPEGHandler);
PluginPath();
@ -1155,11 +1158,6 @@ bool wxDLLApp::OnInit()
void wxDLLApp::CleanUp()
{
wxApp::CleanUp();
if (mutexProcessDList)
{
delete mutexProcessDList;
mutexProcessDList = NULL;
}
if (GFXWindow)
{
GFXWindow->SetHWND(NULL);
@ -1223,25 +1221,10 @@ void CALL ReadScreen(void **dest, int *width, int *height)
{
*width = settings.res_x;
*height = settings.res_y;
wxUint8 * buff = (wxUint8*)malloc(settings.res_x * settings.res_y * 3);
wxUint8 * line = buff;
uint8_t * buff = (uint8_t*)malloc(settings.res_x * settings.res_y * 3);
uint8_t * line = buff;
*dest = (void*)buff;
if (!fullscreen)
{
for (wxUint32 y=0; y<settings.res_y; y++)
{
for (wxUint32 x=0; x<settings.res_x; x++)
{
line[x*3] = 0x20;
line[x*3+1] = 0x7f;
line[x*3+2] = 0x40;
}
}
LOG ("ReadScreen. not in the fullscreen!\n");
return;
}
GrLfbInfo_t info;
info.size = sizeof(GrLfbInfo_t);
if (grLfbLock(GR_LFB_READ_ONLY,
@ -1251,22 +1234,22 @@ void CALL ReadScreen(void **dest, int *width, int *height)
FXFALSE,
&info))
{
wxUint32 offset_src=info.strideInBytes*(settings.scr_res_y-1);
uint32_t offset_src = info.strideInBytes*(settings.scr_res_y - 1);
// Copy the screen
wxUint8 r, g, b;
uint8_t r, g, b;
if (info.writeMode == GR_LFBWRITEMODE_8888)
{
wxUint32 col;
for (wxUint32 y=0; y<settings.res_y; y++)
uint32_t col;
for (uint32_t y = 0; y < settings.res_y; y++)
{
wxUint32 *ptr = (wxUint32*)((wxUint8*)info.lfbPtr + offset_src);
for (wxUint32 x=0; x<settings.res_x; x++)
uint32_t *ptr = (uint32_t*)((uint8_t*)info.lfbPtr + offset_src);
for (uint32_t x = 0; x < settings.res_x; x++)
{
col = *(ptr++);
r = (wxUint8)((col >> 16) & 0xFF);
g = (wxUint8)((col >> 8) & 0xFF);
b = (wxUint8)(col & 0xFF);
r = (uint8_t)((col >> 16) & 0xFF);
g = (uint8_t)((col >> 8) & 0xFF);
b = (uint8_t)(col & 0xFF);
line[x * 3] = b;
line[x * 3 + 1] = g;
line[x * 3 + 2] = r;
@ -1277,16 +1260,16 @@ void CALL ReadScreen(void **dest, int *width, int *height)
}
else
{
wxUint16 col;
for (wxUint32 y=0; y<settings.res_y; y++)
uint16_t col;
for (uint32_t y = 0; y < settings.res_y; y++)
{
wxUint16 *ptr = (wxUint16*)((wxUint8*)info.lfbPtr + offset_src);
for (wxUint32 x=0; x<settings.res_x; x++)
uint16_t *ptr = (uint16_t*)((uint8_t*)info.lfbPtr + offset_src);
for (uint32_t x = 0; x < settings.res_x; x++)
{
col = *(ptr++);
r = (wxUint8)((float)(col >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col >> 5) & 0x3F) / 63.0f * 255.0f);
b = (wxUint8)((float)(col & 0x1F) / 31.0f * 255.0f);
r = (uint8_t)((float)(col >> 11) / 31.0f * 255.0f);
g = (uint8_t)((float)((col >> 5) & 0x3F) / 63.0f * 255.0f);
b = (uint8_t)((float)(col & 0x1F) / 31.0f * 255.0f);
line[x * 3] = b;
line[x * 3 + 1] = g;
line[x * 3 + 2] = r;
@ -1356,7 +1339,7 @@ EXPORT void CALL ChangeWindow (void)
// Go to fullscreen at next dlist
// This is for compatibility with 1964, which reloads the plugin
// when switching to fullscreen
if (!fullscreen)
if (!GfxInitDone)
{
to_fullscreen = TRUE;
#ifdef __WINDOWS__
@ -1414,7 +1397,6 @@ void CALL CloseDLL (void)
settings.ghq_use = 0;
}
#endif
if (fullscreen)
ReleaseGfx();
ZLUT_release();
ClearCache();
@ -1471,8 +1453,8 @@ void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo )
// If DLL supports memory these memory options then set them to TRUE or FALSE
// if it does not support it
PluginInfo->NormalMemory = FALSE; // a normal wxUint8 array
PluginInfo->MemoryBswaped = TRUE; // a normal wxUint8 array where the memory has been pre
PluginInfo->NormalMemory = FALSE; // a normal uint8_t array
PluginInfo->MemoryBswaped = TRUE; // a normal uint8_t array where the memory has been pre
// bswap on a dword (32 bits) boundry
}
@ -1682,13 +1664,13 @@ void CALL RomClosed (void)
CLOSE_RDP_E_LOG();
rdp.window_changed = TRUE;
romopen = FALSE;
if (fullscreen && evoodoo)
if (evoodoo)
ReleaseGfx();
}
static void CheckDRAMSize()
{
wxUint32 test;
uint32_t test;
GLIDE64_TRY
{
test = gfx.RDRAM[0x007FFFFF] + 1;
@ -1723,7 +1705,7 @@ void CALL RomOpen (void)
rdp_reset();
// Get the country code & translate to NTSC(0) or PAL(1)
wxUint16 code = ((wxUint16*)gfx.HEADER)[0x1F^1];
uint16_t code = ((uint16_t*)gfx.HEADER)[0x1F ^ 1];
if (code == 0x4400) region = 1; // Germany (PAL)
if (code == 0x4500) region = 0; // USA (NTSC)
@ -1770,16 +1752,13 @@ void CALL RomOpen (void)
OPEN_RDP_LOG();
OPEN_RDP_E_LOG();
// ** EVOODOO EXTENSIONS **
if (!fullscreen)
if (!GfxInitDone)
{
grGlideInit();
grSstSelect(0);
}
const char *extensions = grGetString(GR_EXTENSION);
if (!fullscreen)
{
grGlideShutdown();
if (strstr(extensions, "EVOODOO"))
@ -1789,7 +1768,6 @@ void CALL RomOpen (void)
if (evoodoo)
InitGfx();
}
if (strstr(extensions, "ROMNAME"))
{
@ -1819,10 +1797,10 @@ void CALL ShowCFB (void)
void drawViRegBG()
{
LRDP("drawViRegBG\n");
const wxUint32 VIwidth = *gfx.VI_WIDTH_REG;
const uint32_t VIwidth = *gfx.VI_WIDTH_REG;
FB_TO_SCREEN_INFO fb_info;
fb_info.width = VIwidth;
fb_info.height = (wxUint32)rdp.vi_height;
fb_info.height = (uint32_t)rdp.vi_height;
if (fb_info.height == 0)
{
LRDP("Image height = 0 - skipping\n");
@ -1831,7 +1809,7 @@ void drawViRegBG()
fb_info.ul_x = 0;
fb_info.lr_x = VIwidth - 1;
// fb_info.lr_x = (wxUint32)rdp.vi_width - 1;
// fb_info.lr_x = (uint32_t)rdp.vi_width - 1;
fb_info.ul_y = 0;
fb_info.lr_y = fb_info.height - 1;
fb_info.opaque = 1;
@ -1848,25 +1826,16 @@ void drawViRegBG()
}
}
void drawNoFullscreenMessage();
static void DrawFrameBuffer()
{
if (!fullscreen)
{
drawNoFullscreenMessage();
}
if (to_fullscreen)
GoToFullScreen();
if (fullscreen)
{
grDepthMask(FXTRUE);
grColorMask(FXTRUE, FXTRUE);
grBufferClear(0, 0, 0xFFFF);
drawViRegBG();
}
}
/******************************************************************
Function: UpdateScreen
@ -1876,7 +1845,7 @@ set
input: none
output: none
*******************************************************************/
wxUint32 update_screen_count = 0;
uint32_t update_screen_count = 0;
void CALL UpdateScreen(void)
{
#ifdef LOG_KEY
@ -1890,10 +1859,11 @@ void CALL UpdateScreen (void)
LOG(out_buf);
LRDP(out_buf);
wxUint32 width = (*gfx.VI_WIDTH_REG) << 1;
if (fullscreen && (*gfx.VI_ORIGIN_REG > width))
uint32_t width = (*gfx.VI_WIDTH_REG) << 1;
if (*gfx.VI_ORIGIN_REG > width)
{
update_screen_count++;
}
#ifdef FPS
// vertical interrupt has occurred, increment counter
vi_count++;
@ -1914,7 +1884,7 @@ void CALL UpdateScreen (void)
}
#endif
//*
wxUint32 limit = (settings.hacks&hack_Lego) ? 15 : 30;
uint32_t limit = (settings.hacks&hack_Lego) ? 15 : 30;
if ((settings.frame_buffer&fb_cpu_write_hack) && (update_screen_count > limit) && (rdp.last_bg == 0))
{
LRDP("DirectCPUWrite hack!\n");
@ -1946,7 +1916,7 @@ void CALL UpdateScreen (void)
static void DrawWholeFrameBufferToScreen()
{
static wxUint32 toScreenCI = 0;
static uint32_t toScreenCI = 0;
if (rdp.ci_width < 200)
return;
if (rdp.cimg == toScreenCI)
@ -1983,7 +1953,7 @@ static void GetGammaTable()
}
}
wxUint32 curframe = 0;
uint32_t curframe = 0;
void newSwapBuffers()
{
if (!rdp.updatescreen)
@ -1993,9 +1963,6 @@ void newSwapBuffers()
LRDP("swapped\n");
// Allow access to the whole screen
if (fullscreen)
{
rdp.update |= UPDATE_SCISSOR | UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE;
grClipWindow(0, 0, settings.scr_res_x, settings.scr_res_y);
grDepthBufferFunction(GR_CMP_ALWAYS);
@ -2103,7 +2070,6 @@ void newSwapBuffers()
}
output(120.0f, 0.0f, 1, message, 0);
}
}
if (capture_screen)
{
@ -2129,10 +2095,10 @@ void newSwapBuffers()
break;
}
const wxUint32 offset_x = (wxUint32)rdp.offset_x;
const wxUint32 offset_y = (wxUint32)rdp.offset_y;
const wxUint32 image_width = settings.scr_res_x - offset_x*2;
const wxUint32 image_height = settings.scr_res_y - offset_y*2;
const uint32_t offset_x = (uint32_t)rdp.offset_x;
const uint32_t offset_y = (uint32_t)rdp.offset_y;
const uint32_t image_width = settings.scr_res_x - offset_x * 2;
const uint32_t image_height = settings.scr_res_y - offset_y * 2;
GrLfbInfo_t info;
info.size = sizeof(GrLfbInfo_t);
@ -2143,41 +2109,41 @@ void newSwapBuffers()
FXFALSE,
&info))
{
wxUint8 *ssimg = (wxUint8*)malloc(image_width * image_height * 3); // will be free in wxImage destructor
uint8_t *ssimg = (uint8_t*)malloc(image_width * image_height * 3); // will be free in wxImage destructor
int sspos = 0;
wxUint32 offset_src = info.strideInBytes * offset_y;
uint32_t offset_src = info.strideInBytes * offset_y;
// Copy the screen
if (info.writeMode == GR_LFBWRITEMODE_8888)
{
wxUint32 col;
for (wxUint32 y = 0; y < image_height; y++)
uint32_t col;
for (uint32_t y = 0; y < image_height; y++)
{
wxUint32 *ptr = (wxUint32*)((wxUint8*)info.lfbPtr + offset_src);
uint32_t *ptr = (uint32_t*)((uint8_t*)info.lfbPtr + offset_src);
ptr += offset_x;
for (wxUint32 x = 0; x < image_width; x++)
for (uint32_t x = 0; x < image_width; x++)
{
col = *(ptr++);
ssimg[sspos++] = (wxUint8)((col >> 16) & 0xFF);
ssimg[sspos++] = (wxUint8)((col >> 8) & 0xFF);
ssimg[sspos++] = (wxUint8)(col & 0xFF);
ssimg[sspos++] = (uint8_t)((col >> 16) & 0xFF);
ssimg[sspos++] = (uint8_t)((col >> 8) & 0xFF);
ssimg[sspos++] = (uint8_t)(col & 0xFF);
}
offset_src += info.strideInBytes;
}
}
else
{
wxUint16 col;
for (wxUint32 y = 0; y < image_height; y++)
uint16_t col;
for (uint32_t y = 0; y < image_height; y++)
{
wxUint16 *ptr = (wxUint16*)((wxUint8*)info.lfbPtr + offset_src);
uint16_t *ptr = (uint16_t*)((uint8_t*)info.lfbPtr + offset_src);
ptr += offset_x;
for (wxUint32 x = 0; x < image_width; x++)
for (uint32_t x = 0; x < image_width; x++)
{
col = *(ptr++);
ssimg[sspos++] = (wxUint8)((float)(col >> 11) / 31.0f * 255.0f);
ssimg[sspos++] = (wxUint8)((float)((col >> 5) & 0x3F) / 63.0f * 255.0f);
ssimg[sspos++] = (wxUint8)((float)(col & 0x1F) / 31.0f * 255.0f);
ssimg[sspos++] = (uint8_t)((float)(col >> 11) / 31.0f * 255.0f);
ssimg[sspos++] = (uint8_t)((float)((col >> 5) & 0x3F) / 63.0f * 255.0f);
ssimg[sspos++] = (uint8_t)((float)(col & 0x1F) / 31.0f * 255.0f);
}
offset_src += info.strideInBytes;
}
@ -2194,7 +2160,7 @@ void newSwapBuffers()
if (_debugger.capture)
{
// Allocate the screen
_debugger.screen = new wxUint8 [(settings.res_x*settings.res_y) << 1];
_debugger.screen = new uint8_t[(settings.res_x*settings.res_y) << 1];
// Lock the backbuffer (already rendered)
GrLfbInfo_t info;
@ -2206,29 +2172,29 @@ void newSwapBuffers()
FXFALSE,
&info));
wxUint32 offset_src=0, offset_dst=0;
uint32_t offset_src = 0, offset_dst = 0;
// Copy the screen
for (wxUint32 y=0; y<settings.res_y; y++)
for (uint32_t y = 0; y < settings.res_y; y++)
{
if (info.writeMode == GR_LFBWRITEMODE_8888)
{
wxUint32 *src = (wxUint32*)((wxUint8*)info.lfbPtr + offset_src);
wxUint16 *dst = (wxUint16*)(_debugger.screen + offset_dst);
wxUint8 r, g, b;
wxUint32 col;
uint32_t *src = (uint32_t*)((uint8_t*)info.lfbPtr + offset_src);
uint16_t *dst = (uint16_t*)(_debugger.screen + offset_dst);
uint8_t r, g, b;
uint32_t col;
for (unsigned int x = 0; x < settings.res_x; x++)
{
col = src[x];
r = (wxUint8)((col >> 19) & 0x1F);
g = (wxUint8)((col >> 10) & 0x3F);
b = (wxUint8)((col >> 3) & 0x1F);
r = (uint8_t)((col >> 19) & 0x1F);
g = (uint8_t)((col >> 10) & 0x3F);
b = (uint8_t)((col >> 3) & 0x1F);
dst[x] = (r << 11) | (g << 5) | b;
}
}
else
{
memcpy (_debugger.screen + offset_dst, (wxUint8*)info.lfbPtr + offset_src, settings.res_x << 1);
memcpy(_debugger.screen + offset_dst, (uint8_t*)info.lfbPtr + offset_src, settings.res_x << 1);
}
offset_dst += settings.res_x << 1;
offset_src += info.strideInBytes;
@ -2238,7 +2204,7 @@ void newSwapBuffers()
grLfbUnlock(GR_LFB_READ_ONLY, GR_BUFFER_BACKBUFFER);
}
if (fullscreen && debugging)
if (debugging)
{
debug_keys();
debug_cacheviewer();
@ -2248,8 +2214,6 @@ void newSwapBuffers()
if (settings.frame_buffer & fb_read_back_to_screen)
DrawWholeFrameBufferToScreen();
if (fullscreen)
{
if (fb_hwfbe_enabled && !(settings.hacks&hack_RE2) && !evoodoo)
grAuxBufferExt(GR_BUFFER_AUXBUFFER);
LOG("BUFFER SWAPPED\n");
@ -2276,13 +2240,10 @@ void newSwapBuffers()
voodoo.gamma_correction = 0;
}
}
}
if (_debugger.capture)
debug_capture();
if (fullscreen)
{
if (debugging || settings.wireframe || settings.buff_clear || (settings.hacks&hack_PPL && settings.ucode == 6))
{
if (settings.hacks&hack_RE2 && fb_depth_render_enabled)
@ -2300,11 +2261,11 @@ void newSwapBuffers()
grColorMask (FXTRUE, FXTRUE);
}
*/
}
if (settings.frame_buffer & fb_read_back_to_screen2)
{
DrawWholeFrameBufferToScreen();
}
frame_count++;
// Open/close debugger?
@ -2317,8 +2278,8 @@ void newSwapBuffers()
debugging = 1;
// Recalculate screen size, don't resize screen
settings.res_x = (wxUint32)(settings.scr_res_x * 0.625f);
settings.res_y = (wxUint32)(settings.scr_res_y * 0.625f);
settings.res_x = (uint32_t)(settings.scr_res_x * 0.625f);
settings.res_y = (uint32_t)(settings.scr_res_y * 0.625f);
ChangeSize();
}
@ -2369,10 +2330,10 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
switch (msg)
{
case WM_ACTIVATEAPP:
if (wParam == TRUE && !fullscreen) rdp.window_changed = TRUE;
if (wParam == TRUE && !GfxInitDone) rdp.window_changed = TRUE;
break;
case WM_PAINT:
if (!fullscreen) rdp.window_changed = TRUE;
if (!GfxInitDone) rdp.window_changed = TRUE;
break;
/* case WM_DESTROY:
@ -2398,7 +2359,6 @@ static Glide64Keys g64Keys;
#endif
}
#ifdef ALTTAB_FIX
int k_ctl = 0, k_alt = 0, k_del = 0;

View File

@ -36,9 +36,9 @@
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
#include <common/stdtypes.h>
#include <Common/stdtypes.h>
#include <string.h>
typedef uint32_t wxUint32;
typedef uint32_t uint32_t;
static inline void mirror16bS(uint8_t *tex, uint8_t *start, int width, int height, int mask, int line, int full, int count)
{
@ -129,12 +129,12 @@ static inline void clamp16bS(uint8_t *tex, uint8_t *constant, int height, int li
//****************************************************************
// 16-bit Horizontal Mirror
void Mirror16bS (unsigned char * tex, wxUint32 mask, wxUint32 max_width, wxUint32 real_width, wxUint32 height)
void Mirror16bS (unsigned char * tex, uint32_t mask, uint32_t max_width, uint32_t real_width, uint32_t height)
{
if (mask == 0) return;
wxUint32 mask_width = (1 << mask);
wxUint32 mask_mask = (mask_width-1) << 1;
uint32_t mask_width = (1 << mask);
uint32_t mask_mask = (mask_width-1) << 1;
if (mask_width >= max_width) return;
int count = max_width - mask_width;
if (count <= 0) return;
@ -148,12 +148,12 @@ void Mirror16bS (unsigned char * tex, wxUint32 mask, wxUint32 max_width, wxUint3
//****************************************************************
// 16-bit Horizontal Wrap (like mirror)
void Wrap16bS (unsigned char * tex, wxUint32 mask, wxUint32 max_width, wxUint32 real_width, wxUint32 height)
void Wrap16bS (unsigned char * tex, uint32_t mask, uint32_t max_width, uint32_t real_width, uint32_t height)
{
if (mask == 0) return;
wxUint32 mask_width = (1 << mask);
wxUint32 mask_mask = (mask_width-1) >> 1;
uint32_t mask_width = (1 << mask);
uint32_t mask_mask = (mask_width-1) >> 1;
if (mask_width >= max_width) return;
int count = (max_width - mask_width) >> 1;
if (count <= 0) return;
@ -167,7 +167,7 @@ void Wrap16bS (unsigned char * tex, wxUint32 mask, wxUint32 max_width, wxUint32
//****************************************************************
// 16-bit Horizontal Clamp
void Clamp16bS (unsigned char * tex, wxUint32 width, wxUint32 clamp_to, wxUint32 real_width, wxUint32 real_height)
void Clamp16bS (unsigned char * tex, uint32_t width, uint32_t clamp_to, uint32_t real_width, uint32_t real_height)
{
if (real_width <= width) return;
@ -184,18 +184,18 @@ void Clamp16bS (unsigned char * tex, wxUint32 width, wxUint32 clamp_to, wxUint32
//****************************************************************
// 16-bit Vertical Mirror
void Mirror16bT (unsigned char * tex, wxUint32 mask, wxUint32 max_height, wxUint32 real_width)
void Mirror16bT (unsigned char * tex, uint32_t mask, uint32_t max_height, uint32_t real_width)
{
if (mask == 0) return;
wxUint32 mask_height = (1 << mask);
wxUint32 mask_mask = mask_height-1;
uint32_t mask_height = (1 << mask);
uint32_t mask_mask = mask_height-1;
if (max_height <= mask_height) return;
int line_full = real_width << 1;
unsigned char * dst = tex + mask_height * line_full;
for (wxUint32 y=mask_height; y<max_height; y++)
for (uint32_t y=mask_height; y<max_height; y++)
{
if (y & mask_height)
{
@ -215,18 +215,18 @@ void Mirror16bT (unsigned char * tex, wxUint32 mask, wxUint32 max_height, wxUint
//****************************************************************
// 16-bit Vertical Wrap
void Wrap16bT (unsigned char * tex, wxUint32 mask, wxUint32 max_height, wxUint32 real_width)
void Wrap16bT (unsigned char * tex, uint32_t mask, uint32_t max_height, uint32_t real_width)
{
if (mask == 0) return;
wxUint32 mask_height = (1 << mask);
wxUint32 mask_mask = mask_height-1;
uint32_t mask_height = (1 << mask);
uint32_t mask_mask = mask_height-1;
if (max_height <= mask_height) return;
int line_full = real_width << 1;
unsigned char * dst = tex + mask_height * line_full;
for (wxUint32 y=mask_height; y<max_height; y++)
for (uint32_t y=mask_height; y<max_height; y++)
{
// not mirrored
memcpy ((void*)dst, (void*)(tex + (y & mask_mask) * line_full), line_full);
@ -238,13 +238,13 @@ void Wrap16bT (unsigned char * tex, wxUint32 mask, wxUint32 max_height, wxUint32
//****************************************************************
// 16-bit Vertical Clamp
void Clamp16bT (unsigned char * tex, wxUint32 height, wxUint32 real_width, wxUint32 clamp_to)
void Clamp16bT (unsigned char * tex, uint32_t height, uint32_t real_width, uint32_t clamp_to)
{
int line_full = real_width << 1;
unsigned char * dst = tex + height * line_full;
unsigned char * const_line = dst - line_full;
for (wxUint32 y=height; y<clamp_to; y++)
for (uint32_t y=height; y<clamp_to; y++)
{
memcpy ((void*)dst, (void*)const_line, line_full);
dst += line_full;

View File

@ -131,12 +131,12 @@ static inline void clamp32bS(uint8_t *tex, uint8_t *constant, int height, int li
//****************************************************************
// 32-bit Horizontal Mirror
void Mirror32bS (unsigned char * tex, wxUint32 mask, wxUint32 max_width, wxUint32 real_width, wxUint32 height)
void Mirror32bS (unsigned char * tex, uint32_t mask, uint32_t max_width, uint32_t real_width, uint32_t height)
{
if (mask == 0) return;
wxUint32 mask_width = (1 << mask);
wxUint32 mask_mask = (mask_width-1) << 2;
uint32_t mask_width = (1 << mask);
uint32_t mask_mask = (mask_width-1) << 2;
if (mask_width >= max_width) return;
int count = max_width - mask_width;
if (count <= 0) return;
@ -150,12 +150,12 @@ void Mirror32bS (unsigned char * tex, wxUint32 mask, wxUint32 max_width, wxUint3
//****************************************************************
// 32-bit Horizontal Wrap
void Wrap32bS (unsigned char * tex, wxUint32 mask, wxUint32 max_width, wxUint32 real_width, wxUint32 height)
void Wrap32bS (unsigned char * tex, uint32_t mask, uint32_t max_width, uint32_t real_width, uint32_t height)
{
if (mask == 0) return;
wxUint32 mask_width = (1 << mask);
wxUint32 mask_mask = (mask_width-1);
uint32_t mask_width = (1 << mask);
uint32_t mask_mask = (mask_width-1);
if (mask_width >= max_width) return;
int count = (max_width - mask_width);
if (count <= 0) return;
@ -169,7 +169,7 @@ void Wrap32bS (unsigned char * tex, wxUint32 mask, wxUint32 max_width, wxUint32
//****************************************************************
// 32-bit Horizontal Clamp
void Clamp32bS (unsigned char * tex, wxUint32 width, wxUint32 clamp_to, wxUint32 real_width, wxUint32 real_height)
void Clamp32bS (unsigned char * tex, uint32_t width, uint32_t clamp_to, uint32_t real_width, uint32_t real_height)
{
if (real_width <= width) return;
@ -186,18 +186,18 @@ void Clamp32bS (unsigned char * tex, wxUint32 width, wxUint32 clamp_to, wxUint32
//****************************************************************
// 32-bit Vertical Mirror
void Mirror32bT (unsigned char * tex, wxUint32 mask, wxUint32 max_height, wxUint32 real_width)
void Mirror32bT (unsigned char * tex, uint32_t mask, uint32_t max_height, uint32_t real_width)
{
if (mask == 0) return;
wxUint32 mask_height = (1 << mask);
wxUint32 mask_mask = mask_height-1;
uint32_t mask_height = (1 << mask);
uint32_t mask_mask = mask_height-1;
if (max_height <= mask_height) return;
int line_full = real_width << 2;
unsigned char *dst = tex + mask_height * line_full;
for (wxUint32 y=mask_height; y<max_height; y++)
for (uint32_t y=mask_height; y<max_height; y++)
{
if (y & mask_height)
{
@ -217,18 +217,18 @@ void Mirror32bT (unsigned char * tex, wxUint32 mask, wxUint32 max_height, wxUint
//****************************************************************
// 32-bit Vertical Wrap
void Wrap32bT (unsigned char * tex, wxUint32 mask, wxUint32 max_height, wxUint32 real_width)
void Wrap32bT (unsigned char * tex, uint32_t mask, uint32_t max_height, uint32_t real_width)
{
if (mask == 0) return;
wxUint32 mask_height = (1 << mask);
wxUint32 mask_mask = mask_height-1;
uint32_t mask_height = (1 << mask);
uint32_t mask_mask = mask_height-1;
if (max_height <= mask_height) return;
int line_full = real_width << 2;
unsigned char *dst = tex + mask_height * line_full;
for (wxUint32 y=mask_height; y<max_height; y++)
for (uint32_t y=mask_height; y<max_height; y++)
{
// not mirrored
memcpy ((void*)dst, (void*)(tex + (y & mask_mask) * (line_full>>2)), (line_full>>2));
@ -240,13 +240,13 @@ void Wrap32bT (unsigned char * tex, wxUint32 mask, wxUint32 max_height, wxUint32
//****************************************************************
// 32-bit Vertical Clamp
void Clamp32bT (unsigned char * tex, wxUint32 height, wxUint32 real_width, wxUint32 clamp_to)
void Clamp32bT (unsigned char * tex, uint32_t height, uint32_t real_width, uint32_t clamp_to)
{
int line_full = real_width << 2;
unsigned char *dst = tex + height * line_full;
unsigned char *const_line = dst - line_full;
for (wxUint32 y=height; y<clamp_to; y++)
for (uint32_t y=height; y<clamp_to; y++)
{
memcpy ((void*)dst, (void*)const_line, line_full);
dst += line_full;

View File

@ -120,12 +120,12 @@ static inline void clamp8bS(uint8_t *tex, uint8_t *constant, int height, int lin
while ( v8 );
}
void Mirror8bS (unsigned char * tex, wxUint32 mask, wxUint32 max_width, wxUint32 real_width, wxUint32 height)
void Mirror8bS (unsigned char * tex, uint32_t mask, uint32_t max_width, uint32_t real_width, uint32_t height)
{
if (mask == 0) return;
wxUint32 mask_width = (1 << mask);
wxUint32 mask_mask = (mask_width-1);
uint32_t mask_width = (1 << mask);
uint32_t mask_mask = (mask_width-1);
if (mask_width >= max_width) return;
int count = max_width - mask_width;
if (count <= 0) return;
@ -140,12 +140,12 @@ void Mirror8bS (unsigned char * tex, wxUint32 mask, wxUint32 max_width, wxUint32
// 8-bit Horizontal Wrap (like mirror) ** UNTESTED **
void Wrap8bS (unsigned char * tex, wxUint32 mask, wxUint32 max_width, wxUint32 real_width, wxUint32 height)
void Wrap8bS (unsigned char * tex, uint32_t mask, uint32_t max_width, uint32_t real_width, uint32_t height)
{
if (mask == 0) return;
wxUint32 mask_width = (1 << mask);
wxUint32 mask_mask = (mask_width-1) >> 2;
uint32_t mask_width = (1 << mask);
uint32_t mask_mask = (mask_width-1) >> 2;
if (mask_width >= max_width) return;
int count = (max_width - mask_width) >> 2;
if (count <= 0) return;
@ -160,7 +160,7 @@ void Wrap8bS (unsigned char * tex, wxUint32 mask, wxUint32 max_width, wxUint32 r
// 8-bit Horizontal Clamp
void Clamp8bS (unsigned char * tex, wxUint32 width, wxUint32 clamp_to, wxUint32 real_width, wxUint32 real_height)
void Clamp8bS (unsigned char * tex, uint32_t width, uint32_t clamp_to, uint32_t real_width, uint32_t real_height)
{
if (real_width <= width) return;
@ -176,18 +176,18 @@ void Clamp8bS (unsigned char * tex, wxUint32 width, wxUint32 clamp_to, wxUint32
//****************************************************************
// 8-bit Vertical Mirror
void Mirror8bT (unsigned char * tex, wxUint32 mask, wxUint32 max_height, wxUint32 real_width)
void Mirror8bT (unsigned char * tex, uint32_t mask, uint32_t max_height, uint32_t real_width)
{
if (mask == 0) return;
wxUint32 mask_height = (1 << mask);
wxUint32 mask_mask = mask_height-1;
uint32_t mask_height = (1 << mask);
uint32_t mask_mask = mask_height-1;
if (max_height <= mask_height) return;
int line_full = real_width;
unsigned char * dst = tex + mask_height * line_full;
for (wxUint32 y=mask_height; y<max_height; y++)
for (uint32_t y=mask_height; y<max_height; y++)
{
if (y & mask_height)
{
@ -207,18 +207,18 @@ void Mirror8bT (unsigned char * tex, wxUint32 mask, wxUint32 max_height, wxUint3
//****************************************************************
// 8-bit Vertical Wrap
void Wrap8bT (unsigned char * tex, wxUint32 mask, wxUint32 max_height, wxUint32 real_width)
void Wrap8bT (unsigned char * tex, uint32_t mask, uint32_t max_height, uint32_t real_width)
{
if (mask == 0) return;
wxUint32 mask_height = (1 << mask);
wxUint32 mask_mask = mask_height-1;
uint32_t mask_height = (1 << mask);
uint32_t mask_mask = mask_height-1;
if (max_height <= mask_height) return;
int line_full = real_width;
unsigned char * dst = tex + mask_height * line_full;
for (wxUint32 y=mask_height; y<max_height; y++)
for (uint32_t y=mask_height; y<max_height; y++)
{
// not mirrored
memcpy ((void*)dst, (void*)(tex + (y & mask_mask) * line_full), line_full);
@ -230,13 +230,13 @@ void Wrap8bT (unsigned char * tex, wxUint32 mask, wxUint32 max_height, wxUint32
//****************************************************************
// 8-bit Vertical Clamp
void Clamp8bT (unsigned char * tex, wxUint32 height, wxUint32 real_width, wxUint32 clamp_to)
void Clamp8bT (unsigned char * tex, uint32_t height, uint32_t real_width, uint32_t clamp_to)
{
int line_full = real_width;
unsigned char * dst = tex + height * line_full;
unsigned char * const_line = dst - line_full;
for (wxUint32 y=height; y<clamp_to; y++)
for (uint32_t y=height; y<clamp_to; y++)
{
memcpy ((void*)dst, (void*)const_line, line_full);
dst += line_full;

View File

@ -62,10 +62,10 @@ static TBUFF_COLOR_IMAGE * AllocateTextureBuffer(COLOR_IMAGE & cimage)
texbuf.scr_height = height * rdp.scale_y;
// texbuf.scr_height = texbuf.height * rdp.scale_y;
wxUint16 max_size = max((wxUint16)texbuf.scr_width, (wxUint16)texbuf.scr_height);
uint16_t max_size = max((uint16_t)texbuf.scr_width, (uint16_t)texbuf.scr_height);
if (max_size > voodoo.max_tex_size) //texture size is too large
return 0;
wxUint32 tex_size;
uint32_t tex_size;
//calculate LOD
switch ((max_size - 1) >> 6)
{
@ -154,13 +154,13 @@ static TBUFF_COLOR_IMAGE * AllocateTextureBuffer(COLOR_IMAGE & cimage)
FRDP("\nAllocateTextureBuffer. width: %d, height: %d, scr_width: %f, scr_height: %f, vi_width: %f, vi_height:%f, scale_x: %f, scale_y: %f, lr_u: %f, lr_v: %f, u_scale: %f, v_scale: %f\n", texbuf.width, texbuf.height, texbuf.scr_width, texbuf.scr_height, rdp.vi_width, rdp.vi_height, rdp.scale_x, rdp.scale_y, texbuf.lr_u, texbuf.lr_v, texbuf.u_scale, texbuf.v_scale);
wxUint32 required = grTexCalcMemRequired(texbuf.info.smallLodLog2, texbuf.info.largeLodLog2,
uint32_t required = grTexCalcMemRequired(texbuf.info.smallLodLog2, texbuf.info.largeLodLog2,
texbuf.info.aspectRatioLog2, texbuf.info.format);
//find free space
for (int i = 0; i < voodoo.num_tmu; i++)
{
wxUint32 available = 0;
wxUint32 top = 0;
uint32_t available = 0;
uint32_t top = 0;
if (rdp.texbufs[i].count)
{
TBUFF_COLOR_IMAGE & t = rdp.texbufs[i].images[rdp.texbufs[i].count - 1];
@ -210,14 +210,13 @@ static TBUFF_COLOR_IMAGE * AllocateTextureBuffer(COLOR_IMAGE & cimage)
int OpenTextureBuffer(COLOR_IMAGE & cimage)
{
FRDP("OpenTextureBuffer. cur_tex_buf: %d, addr: %08lx, width: %d, height: %d", rdp.cur_tex_buf, cimage.addr, cimage.width, cimage.height);
if (!fullscreen) return FALSE;
int found = FALSE, search = TRUE;
TBUFF_COLOR_IMAGE *texbuf = 0;
wxUint32 addr = cimage.addr;
uint32_t addr = cimage.addr;
if ((settings.hacks&hack_Banjo2) && cimage.status == ci_copy_self)
addr = rdp.frame_buffers[rdp.copy_ci_index].addr;
wxUint32 end_addr = addr + ((cimage.width*cimage.height)<<cimage.size>>1);
uint32_t end_addr = addr + ((cimage.width*cimage.height) << cimage.size >> 1);
if (rdp.motionblur)
{
// if (cimage.format != 0)
@ -268,7 +267,7 @@ int OpenTextureBuffer(COLOR_IMAGE & cimage)
//texbuf->height = cimage.height;
//texbuf->end_addr = end_addr;
texbuf->drawn = FALSE;
texbuf->format = (wxUint16)cimage.format;
texbuf->format = (uint16_t)cimage.format;
if ((cimage.format != 0))
texbuf->info.format = GR_TEXFMT_ALPHA_INTENSITY_88;
else
@ -419,7 +418,7 @@ static GrTextureFormat_t TexBufSetupCombiner(int force_rgb = FALSE)
int CloseTextureBuffer(int draw)
{
if (!fullscreen || !rdp.cur_image)
if (!rdp.cur_image)
{
LRDP("CloseTextureBuffer KO\n");
return FALSE;
@ -447,7 +446,6 @@ int CloseTextureBuffer(int draw)
float lr_v = rdp.tbuff_tex->lr_v;
FRDP("lr_x: %f, lr_y: %f, lr_u: %f, lr_v: %f\n", lr_x, lr_y, lr_u, lr_v);
// Make the vertices
VERTEX v[4] = {
{ ul_x, ul_y, 1, 1, zero, zero, zero, zero, { zero, zero, zero, zero } },
@ -472,8 +470,6 @@ int CloseTextureBuffer(int draw)
int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to)
{
if (!fullscreen)
return FALSE;
FRDP("CopyTextureBuffer from %08x to %08x\n", fb_from.addr, fb_to.addr);
if (rdp.cur_image)
{
@ -482,7 +478,7 @@ int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to)
return CloseTextureBuffer(TRUE);
rdp.tbuff_tex = rdp.cur_image;
}
else if (!FindTextureBuffer(fb_from.addr, (wxUint16)fb_from.width))
else if (!FindTextureBuffer(fb_from.addr, (uint16_t)fb_from.width))
{
LRDP("Can't find 'from' buffer.\n");
return FALSE;
@ -505,7 +501,6 @@ int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to)
float lr_v = rdp.tbuff_tex->lr_v;
FRDP("lr_x: %f, lr_y: %f\n", lr_x, lr_y);
// Make the vertices
VERTEX v[4] = {
{ ul_x, ul_y, 1, 1, zero, zero, zero, zero, { zero, zero, zero, zero } },
@ -539,8 +534,6 @@ int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to)
int CopyDepthBuffer()
{
if (!fullscreen)
return FALSE;
LRDP("CopyDepthBuffer. ");
float bound = 1024.0f;
GrLOD_t LOD = GR_LOD_LOG2_1024;
@ -564,7 +557,6 @@ int CopyDepthBuffer()
float lr_v = 255.5f;
FRDP("lr_x: %f, lr_y: %f\n", lr_x, lr_y);
// Make the vertices
VERTEX v[4] = {
{ ul_x, ul_y, 1, 1, zero, zero, zero, zero, { zero, zero, zero, zero } },
@ -595,7 +587,7 @@ int CopyDepthBuffer()
int SwapTextureBuffer()
{
if (!fullscreen || !rdp.tbuff_tex)
if (!rdp.tbuff_tex)
return FALSE;
LRDP("SwapTextureBuffer.");
COLOR_IMAGE ci;
@ -668,17 +660,17 @@ int SwapTextureBuffer()
return TRUE;
}
static wxUint32 CalcCRC(TBUFF_COLOR_IMAGE * pTCI)
static uint32_t CalcCRC(TBUFF_COLOR_IMAGE * pTCI)
{
wxUint32 result = 0;
uint32_t result = 0;
if ((settings.frame_buffer&fb_ref) > 0)
pTCI->crc = 0; //Since fb content changes each frame, crc check is meaningless.
else if (settings.fb_crc_mode == SETTINGS::fbcrcFast)
result = *((wxUint32*)(gfx.RDRAM + pTCI->addr + (pTCI->end_addr-pTCI->addr)/2));
result = *((uint32_t*)(gfx.RDRAM + pTCI->addr + (pTCI->end_addr - pTCI->addr) / 2));
else if (settings.fb_crc_mode == SETTINGS::fbcrcSafe)
{
wxUint8 * pSrc = gfx.RDRAM + pTCI->addr;
const wxUint32 nSize = pTCI->end_addr-pTCI->addr;
uint8_t * pSrc = gfx.RDRAM + pTCI->addr;
const uint32_t nSize = pTCI->end_addr - pTCI->addr;
result = CRC32(0xFFFFFFFF, pSrc, 32);
result = CRC32(result, pSrc + (nSize >> 1), 32);
result = CRC32(result, pSrc + nSize - 32, 32);
@ -686,16 +678,16 @@ static wxUint32 CalcCRC(TBUFF_COLOR_IMAGE * pTCI)
return result;
}
int FindTextureBuffer(wxUint32 addr, wxUint16 width)
int FindTextureBuffer(uint32_t addr, uint16_t width)
{
if (rdp.skip_drawing)
return FALSE;
FRDP("FindTextureBuffer. addr: %08lx, width: %d, scale_x: %f\n", addr, width, rdp.scale_x);
int found = FALSE;
wxUint32 shift = 0;
uint32_t shift = 0;
for (int i = 0; i < voodoo.num_tmu && !found; i++)
{
wxUint8 index = rdp.cur_tex_buf^i;
uint8_t index = rdp.cur_tex_buf^i;
for (int j = 0; j < rdp.texbufs[index].count && !found; j++)
{
rdp.tbuff_tex = &(rdp.texbufs[index].images[j]);

View File

@ -55,6 +55,6 @@ int CopyDepthBuffer();
int SwapTextureBuffer();
int FindTextureBuffer(wxUint32 addr, wxUint16 width);
int FindTextureBuffer(uint32_t addr, uint16_t width);
#endif // ifndef TEXBUFFER

View File

@ -48,10 +48,10 @@
void LoadTex(int id, int tmu);
wxUint8 tex1[1024*1024*4]; // temporary texture
wxUint8 tex2[1024*1024*4];
wxUint8 *texture;
wxUint8 *texture_buffer = tex1;
uint8_t tex1[1024 * 1024 * 4]; // temporary texture
uint8_t tex2[1024 * 1024 * 4];
uint8_t *texture;
uint8_t *texture_buffer = tex1;
#include "TexLoad.h" // texture loading functions, ONLY INCLUDE IN THIS FILE!!!
#include "MiClWr32b.h"
@ -71,8 +71,8 @@ typedef struct TEXINFO_t {
int mask_width, mask_height;
int width, height;
int wid_64, line;
wxUint32 crc;
wxUint32 flags;
uint32_t crc;
uint32_t flags;
int splits, splitheight;
#ifdef TEXTURE_FILTER
uint64 ricecrc;
@ -85,8 +85,8 @@ int tex_found[2][MAX_TMU];
#ifdef TEXTURE_FILTER
typedef struct HIRESTEX_t {
int width, height;
wxUint16 format;
wxUint8 *data;
uint16_t format;
uint8_t *data;
} HIRESTEX;
#endif
@ -94,7 +94,7 @@ typedef struct HIRESTEX_t {
// List functions
typedef struct NODE_t {
wxUint32 crc;
uint32_t crc;
wxUIntPtr data;
int tmu;
int number;
@ -103,7 +103,7 @@ typedef struct NODE_t {
NODE *cachelut[65536];
void AddToList (NODE **list, wxUint32 crc, wxUIntPtr data, int tmu, int number)
void AddToList(NODE **list, uint32_t crc, wxUIntPtr data, int tmu, int number)
{
NODE *node = new NODE;
node->crc = crc;
@ -163,7 +163,7 @@ uint32_t textureCRC(uint8_t *addr, int width, int height, int line)
for (; height; height--) {
for (i = width; i; --i) {
twopixel_crc = i * (uint64_t)(pixelpos[1] + pixelpos[0] + crc);
crc = (uint32_t) ((twopixel_crc >> 32) + twopixel_crc);
crc = (uint32_t)(((twopixel_crc >> 32) + twopixel_crc) & 0xFFFFFFFF);
pixelpos += 2;
}
crc = ((unsigned int)height * (uint64_t)crc >> 32) + height * crc;
@ -357,7 +357,7 @@ void GetTexInfo (int id, int tile)
line = rdp.tiles[tile].line;
if (rdp.tiles[tile].size == 3)
line <<= 1;
wxUint32 crc = 0;
uint32_t crc = 0;
if (settings.fast_crc)
{
line = (line - wid_64) << 3;
@ -380,7 +380,7 @@ void GetTexInfo (int id, int tile)
{
crc = 0xFFFFFFFF;
wxUIntPtr addr = wxPtrToUInt(rdp.tmem) + (rdp.tiles[tile].t_mem << 3);
wxUint32 line2 = max(line,1);
uint32_t line2 = max(line, 1);
if (rdp.tiles[tile].size < 3)
{
line2 <<= 3;
@ -416,7 +416,7 @@ void GetTexInfo (int id, int tile)
FRDP("Done. CRC is: %08lx.\n", crc);
wxUint32 flags = (rdp.tiles[tile].clamp_s << 23) | (rdp.tiles[tile].mirror_s << 22) |
uint32_t flags = (rdp.tiles[tile].clamp_s << 23) | (rdp.tiles[tile].mirror_s << 22) |
(rdp.tiles[tile].mask_s << 18) | (rdp.tiles[tile].clamp_t << 17) |
(rdp.tiles[tile].mirror_t << 16) | (rdp.tiles[tile].mask_t << 12);
@ -441,7 +441,7 @@ void GetTexInfo (int id, int tile)
if (rdp.noise == RDP::noise_texture)
return;
wxUint32 mod, modcolor, modcolor1, modcolor2, modfactor;
uint32_t mod, modcolor, modcolor1, modcolor2, modfactor;
if (id == 0)
{
mod = cmb.mod_0;
@ -460,7 +460,7 @@ void GetTexInfo (int id, int tile)
}
NODE *node = cachelut[crc >> 16];
wxUint32 mod_mask = (rdp.tiles[tile].format == 2)?0xFFFFFFFF:0xF0F0F0F0;
uint32_t mod_mask = (rdp.tiles[tile].format == 2) ? 0xFFFFFFFF : 0xF0F0F0F0;
while (node)
{
if (node->crc == crc)
@ -501,7 +501,7 @@ void GetTexInfo (int id, int tile)
int ChooseBestTmu(int tmu1, int tmu2)
{
if (!fullscreen) return tmu1;
if (!GfxInitDone) return tmu1;
if (voodoo.tex_UMA) return 0;
if (tmu1 >= voodoo.num_tmu) return tmu2;
@ -542,7 +542,8 @@ void TexCache ()
if (ghq_dmptex_toggle_key) {
DisplayLoadProgress(L"Texture dump - ON\n");
ClearCache();
} else {
}
else {
DisplayLoadProgress(L"Texture dump - OFF\n");
}
#if defined(_WIN32)
@ -728,12 +729,11 @@ void TexCache ()
}
}
rdp.t0 = tmu_0;
rdp.t1 = tmu_1;
// SET the combiner
if (fullscreen)
if (GfxInitDone)
{
if (rdp.allow_combine)
{
@ -828,7 +828,7 @@ void TexCache ()
if (aTBuff[0] && aTBuff[0]->cache)
{
LRDP(" | |- Hires tex T0 found in cache.\n");
if (fullscreen)
if (GfxInitDone)
{
rdp.cur_cache[0] = aTBuff[0]->cache;
rdp.cur_cache[0]->last_used = frame_count;
@ -838,7 +838,7 @@ void TexCache ()
else if (tex_found[0][tmu_0] != -1)
{
LRDP(" | |- T0 found in cache.\n");
if (fullscreen)
if (GfxInitDone)
{
CACHE_LUT *cache = voodoo.tex_UMA ? &rdp.cache[0][tex_found[0][0]] : &rdp.cache[tmu_0][tex_found[0][tmu_0]];
rdp.cur_cache_n[0] = tex_found[0][tmu_0];
@ -859,7 +859,7 @@ void TexCache ()
if (aTBuff[1] && aTBuff[1]->cache)
{
LRDP(" | |- Hires tex T1 found in cache.\n");
if (fullscreen)
if (GfxInitDone)
{
rdp.cur_cache[1] = aTBuff[1]->cache;
rdp.cur_cache[1]->last_used = frame_count;
@ -869,7 +869,7 @@ void TexCache ()
else if (tex_found[1][tmu_1] != -1)
{
LRDP(" | |- T1 found in cache.\n");
if (fullscreen)
if (GfxInitDone)
{
CACHE_LUT *cache = voodoo.tex_UMA ? &rdp.cache[0][tex_found[1][0]] : &rdp.cache[tmu_1][tex_found[1][tmu_1]];
rdp.cur_cache_n[1] = tex_found[1][tmu_1];
@ -886,7 +886,7 @@ void TexCache ()
LoadTex(1, tmu_1);
}
if (fullscreen)
if (GfxInitDone)
{
int tmu_v[2];
@ -913,7 +913,7 @@ void TexCache ()
if (rdp.cur_cache[i])
{
wxUint32 mode_s, mode_t;
uint32_t mode_s, mode_t;
int clamp_s, clamp_t;
if (rdp.force_wrap && !rdp.texrecting)
{
@ -968,18 +968,17 @@ void TexCache ()
LRDP(" | +- TexCache End\n");
}
#ifdef TEXTURE_FILTER
/** cite from RiceVideo */
inline wxUint32 CalculateDXT(wxUint32 txl2words)
inline uint32_t CalculateDXT(uint32_t txl2words)
{
if (txl2words == 0) return 1;
else return (2048 + txl2words - 1) / txl2words;
}
wxUint32 sizeBytes[4] = {0,1,2,4};
uint32_t sizeBytes[4] = { 0, 1, 2, 4 };
inline wxUint32 Txl2Words(wxUint32 width, wxUint32 size)
inline uint32_t Txl2Words(uint32_t width, uint32_t size)
{
if (size == 0)
return max(1, width / 16);
@ -987,7 +986,7 @@ inline wxUint32 Txl2Words(wxUint32 width, wxUint32 size)
return max(1, width*sizeBytes[size] / 8);
}
inline wxUint32 ReverseDXT(wxUint32 val, wxUint32 /*lrs*/, wxUint32 width, wxUint32 size)
inline uint32_t ReverseDXT(uint32_t val, uint32_t /*lrs*/, uint32_t width, uint32_t size)
{
if (val == 0x800) return 1;
@ -999,7 +998,7 @@ inline wxUint32 ReverseDXT(wxUint32 val, wxUint32 /*lrs*/, wxUint32 width, wxUin
for (int i = low; i <= high; i++)
{
if( Txl2Words(width, size) == (wxUint32)i )
if (Txl2Words(width, size) == (uint32_t)i)
return i;
}
@ -1076,8 +1075,8 @@ void LoadTex (int id, int tmu)
cache->t_info.format = GR_TEXFMT_ARGB_1555;
// Calculate lod and aspect
wxUint32 size_x = rdp.tiles[td].width;
wxUint32 size_y = rdp.tiles[td].height;
uint32_t size_x = rdp.tiles[td].width;
uint32_t size_y = rdp.tiles[td].height;
// make size_x and size_y both powers of two
if (!voodoo.sup_large_tex)
@ -1103,7 +1102,7 @@ void LoadTex (int id, int tmu)
// Calculate the maximum size
int size_max = max(size_x, size_y);
wxUint32 real_x=size_max, real_y=size_max;
uint32_t real_x = size_max, real_y = size_max;
switch (size_max)
{
case 1:
@ -1238,7 +1237,7 @@ void LoadTex (int id, int tmu)
else cache->c_scl_y = 0.0f;
// **
wxUint32 mod, modcolor, modcolor1, modcolor2, modfactor;
uint32_t mod, modcolor, modcolor1, modcolor2, modfactor;
if (id == 0)
{
mod = cmb.mod_0;
@ -1256,7 +1255,7 @@ void LoadTex (int id, int tmu)
modfactor = cmb.modfactor_1;
}
wxUint16 tmp_pal[256];
uint16_t tmp_pal[256];
int modifyPalette = (mod && (cache->format == 2) && (rdp.tlut_mode == 2));
if (modifyPalette)
@ -1279,7 +1278,7 @@ void LoadTex (int id, int tmu)
}
}
wxUint32 result = 0; // keep =0 so it doesn't mess up on the first split
uint32_t result = 0; // keep =0 so it doesn't mess up on the first split
texture = tex1;
@ -1296,11 +1295,11 @@ void LoadTex (int id, int tmu)
#ifdef TEXTURE_FILTER // Hiroshi Morii <koolsmoky@users.sourceforge.net>
GHQTexInfo ghqTexInfo;
memset(&ghqTexInfo, 0, sizeof(GHQTexInfo));
wxUint32 g64_crc = cache->crc;
uint32_t g64_crc = cache->crc;
if (settings.ghq_use)
{
int bpl;
wxUint8* addr = (wxUint8*)(gfx.RDRAM+rdp.addr[rdp.tiles[td].t_mem]);
uint8_t* addr = (uint8_t*)(gfx.RDRAM + rdp.addr[rdp.tiles[td].t_mem]);
int tile_width = texinfo[id].width;
int tile_height = texinfo[id].height;
LOAD_TILE_INFO &info = rdp.load_info[rdp.tiles[td].t_mem];
@ -1325,24 +1324,24 @@ void LoadTex (int id, int tmu)
else if (info.dxt == 0)
bpl = rdp.tiles[td].line << 3;
else {
wxUint32 dxt = info.dxt;
uint32_t dxt = info.dxt;
if (dxt > 1)
dxt = ReverseDXT(dxt, info.tile_width, texinfo[id].width, rdp.tiles[td].size);
bpl = dxt << 3;
}
}
// wxUint8* addr = (wxUint8*)(gfx.RDRAM+rdp.addr[rdp.tiles[td].t_mem] + (rdp.tiles[td].ul_t * bpl) + (((rdp.tiles[td].ul_s<<rdp.tiles[td].size)+1)>>1));
wxUint8 * paladdr = 0;
wxUint16 * palette = 0;
// uint8_t* addr = (uint8_t*)(gfx.RDRAM+rdp.addr[rdp.tiles[td].t_mem] + (rdp.tiles[td].ul_t * bpl) + (((rdp.tiles[td].ul_s<<rdp.tiles[td].size)+1)>>1));
uint8_t * paladdr = 0;
uint16_t * palette = 0;
if ((rdp.tiles[td].size < 2) && (rdp.tlut_mode || rdp.tiles[td].format == 2))
{
if (rdp.tiles[td].size == 1)
paladdr = (wxUint8*)(rdp.pal_8_rice);
paladdr = (uint8_t*)(rdp.pal_8_rice);
else if (settings.ghq_hirs_altcrc)
paladdr = (wxUint8*)(rdp.pal_8_rice + (rdp.tiles[td].palette << 5));
paladdr = (uint8_t*)(rdp.pal_8_rice + (rdp.tiles[td].palette << 5));
else
paladdr = (wxUint8*)(rdp.pal_8_rice + (rdp.tiles[td].palette << 4));
paladdr = (uint8_t*)(rdp.pal_8_rice + (rdp.tiles[td].palette << 4));
palette = (rdp.pal_8 + (rdp.tiles[td].palette << 4));
}
@ -1356,7 +1355,7 @@ void LoadTex (int id, int tmu)
g64_crc = CRC32(g64_crc, &cache->mod_factor, 4);
cache->ricecrc = ext_ghq_checksum(addr, tile_width, tile_height, (unsigned short)(rdp.tiles[td].format << 8 | rdp.tiles[td].size), bpl, paladdr);
FRDP("CI RICE CRC. format: %d, size: %d, CRC: %08lx, PalCRC: %08lx\n", rdp.tiles[td].format, rdp.tiles[td].size, (wxUint32)(cache->ricecrc&0xFFFFFFFF), (wxUint32)(cache->ricecrc>>32));
FRDP("CI RICE CRC. format: %d, size: %d, CRC: %08lx, PalCRC: %08lx\n", rdp.tiles[td].format, rdp.tiles[td].size, (uint32_t)(cache->ricecrc & 0xFFFFFFFF), (uint32_t)(cache->ricecrc >> 32));
if (ext_ghq_hirestex((uint64)g64_crc, cache->ricecrc, palette, &ghqTexInfo))
{
cache->is_hires_tex = ghqTexInfo.is_hires_tex;
@ -1365,7 +1364,6 @@ void LoadTex (int id, int tmu)
}
}
// ** handle texture splitting **
if (ghqTexInfo.data)
;//do nothing
@ -1390,7 +1388,7 @@ void LoadTex (int id, int tmu)
(wxPtrToUInt(texture) + start_dst, wxPtrToUInt(rdp.tmem) + (rdp.tiles[td].t_mem << 3) + start_src,
texinfo[id].wid_64, texinfo[id].height, texinfo[id].line, real_x, td);
wxUint32 size = HIWORD(result);
uint32_t size = HIWORD(result);
// clamp so that it looks somewhat ok when wrapping
if (size == 1)
Clamp16bT((texture)+start_dst, texinfo[id].height, real_x, cache->splitheight);
@ -1407,7 +1405,7 @@ void LoadTex (int id, int tmu)
(wxPtrToUInt(texture), wxPtrToUInt(rdp.tmem) + (rdp.tiles[td].t_mem << 3),
texinfo[id].wid_64, texinfo[id].height, texinfo[id].line, real_x, td);
wxUint32 size = HIWORD(result);
uint32_t size = HIWORD(result);
int min_x, min_y;
if (rdp.tiles[td].mask_s != 0)
@ -1551,74 +1549,73 @@ void LoadTex (int id, int tmu)
switch (mod)
{
case TMOD_TEX_INTER_COLOR_USING_FACTOR:
mod_tex_inter_color_using_factor ((wxUint16*)texture, size, modcolor, modfactor);
mod_tex_inter_color_using_factor((uint16_t*)texture, size, modcolor, modfactor);
break;
case TMOD_TEX_INTER_COL_USING_COL1:
mod_tex_inter_col_using_col1 ((wxUint16*)texture, size, modcolor, modcolor1);
mod_tex_inter_col_using_col1((uint16_t*)texture, size, modcolor, modcolor1);
break;
case TMOD_FULL_COLOR_SUB_TEX:
mod_full_color_sub_tex ((wxUint16*)texture, size, modcolor);
mod_full_color_sub_tex((uint16_t*)texture, size, modcolor);
break;
case TMOD_COL_INTER_COL1_USING_TEX:
mod_col_inter_col1_using_tex ((wxUint16*)texture, size, modcolor, modcolor1);
mod_col_inter_col1_using_tex((uint16_t*)texture, size, modcolor, modcolor1);
break;
case TMOD_COL_INTER_COL1_USING_TEXA:
mod_col_inter_col1_using_texa ((wxUint16*)texture, size, modcolor, modcolor1);
mod_col_inter_col1_using_texa((uint16_t*)texture, size, modcolor, modcolor1);
break;
case TMOD_COL_INTER_COL1_USING_TEXA__MUL_TEX:
mod_col_inter_col1_using_texa__mul_tex ((wxUint16*)texture, size, modcolor, modcolor1);
mod_col_inter_col1_using_texa__mul_tex((uint16_t*)texture, size, modcolor, modcolor1);
break;
case TMOD_COL_INTER_TEX_USING_TEXA:
mod_col_inter_tex_using_texa ((wxUint16*)texture, size, modcolor);
mod_col_inter_tex_using_texa((uint16_t*)texture, size, modcolor);
break;
case TMOD_COL2_INTER__COL_INTER_COL1_USING_TEX__USING_TEXA:
mod_col2_inter__col_inter_col1_using_tex__using_texa ((wxUint16*)texture, size, modcolor, modcolor1, modcolor2);
mod_col2_inter__col_inter_col1_using_tex__using_texa((uint16_t*)texture, size, modcolor, modcolor1, modcolor2);
break;
case TMOD_TEX_SCALE_FAC_ADD_FAC:
mod_tex_scale_fac_add_fac ((wxUint16*)texture, size, modfactor);
mod_tex_scale_fac_add_fac((uint16_t*)texture, size, modfactor);
break;
case TMOD_TEX_SUB_COL_MUL_FAC_ADD_TEX:
mod_tex_sub_col_mul_fac_add_tex ((wxUint16*)texture, size, modcolor, modfactor);
mod_tex_sub_col_mul_fac_add_tex((uint16_t*)texture, size, modcolor, modfactor);
break;
case TMOD_TEX_SCALE_COL_ADD_COL:
mod_tex_scale_col_add_col ((wxUint16*)texture, size, modcolor, modcolor1);
mod_tex_scale_col_add_col((uint16_t*)texture, size, modcolor, modcolor1);
break;
case TMOD_TEX_ADD_COL:
mod_tex_add_col ((wxUint16*)texture, size, modcolor);
mod_tex_add_col((uint16_t*)texture, size, modcolor);
break;
case TMOD_TEX_SUB_COL:
mod_tex_sub_col ((wxUint16*)texture, size, modcolor);
mod_tex_sub_col((uint16_t*)texture, size, modcolor);
break;
case TMOD_TEX_SUB_COL_MUL_FAC:
mod_tex_sub_col_mul_fac ((wxUint16*)texture, size, modcolor, modfactor);
mod_tex_sub_col_mul_fac((uint16_t*)texture, size, modcolor, modfactor);
break;
case TMOD_COL_INTER_TEX_USING_COL1:
mod_col_inter_tex_using_col1 ((wxUint16*)texture, size, modcolor, modcolor1);
mod_col_inter_tex_using_col1((uint16_t*)texture, size, modcolor, modcolor1);
break;
case TMOD_COL_MUL_TEXA_ADD_TEX:
mod_col_mul_texa_add_tex((wxUint16*)texture, size, modcolor);
mod_col_mul_texa_add_tex((uint16_t*)texture, size, modcolor);
break;
case TMOD_COL_INTER_TEX_USING_TEX:
mod_col_inter_tex_using_tex ((wxUint16*)texture, size, modcolor);
mod_col_inter_tex_using_tex((uint16_t*)texture, size, modcolor);
break;
case TMOD_TEX_INTER_NOISE_USING_COL:
mod_tex_inter_noise_using_col ((wxUint16*)texture, size, modcolor);
mod_tex_inter_noise_using_col((uint16_t*)texture, size, modcolor);
break;
case TMOD_TEX_INTER_COL_USING_TEXA:
mod_tex_inter_col_using_texa ((wxUint16*)texture, size, modcolor);
mod_tex_inter_col_using_texa((uint16_t*)texture, size, modcolor);
break;
case TMOD_TEX_MUL_COL:
mod_tex_mul_col ((wxUint16*)texture, size, modcolor);
mod_tex_mul_col((uint16_t*)texture, size, modcolor);
break;
case TMOD_TEX_SCALE_FAC_ADD_COL:
mod_tex_scale_fac_add_col ((wxUint16*)texture, size, modcolor, modfactor);
mod_tex_scale_fac_add_col((uint16_t*)texture, size, modcolor, modfactor);
break;
default:
;
}
}
cache->t_info.format = LOWORD(result);
cache->realwidth = real_x;
@ -1626,7 +1623,7 @@ void LoadTex (int id, int tmu)
cache->lod = lod;
cache->aspect = aspect;
if (fullscreen)
if (GfxInitDone)
{
#ifdef TEXTURE_FILTER // Hiroshi Morii <koolsmoky@users.sourceforge.net>
if (settings.ghq_use)
@ -1681,7 +1678,7 @@ void LoadTex (int id, int tmu)
}
else
{
texture = (wxUint8 *)ghqTexInfo.data;
texture = (uint8_t *)ghqTexInfo.data;
lod = ghqTexInfo.largeLodLog2;
int splits = cache->splits;
if (ghqTexInfo.is_hires_tex)
@ -1796,7 +1793,7 @@ void LoadTex (int id, int tmu)
t_info->largeLodLog2 = lod;
t_info->aspectRatioLog2 = aspect;
wxUint32 texture_size = grTexTextureMemRequired (GR_MIPMAPLEVELMASK_BOTH, t_info);
uint32_t texture_size = grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, t_info);
// Check for 2mb boundary
// Hiroshi Morii <koolsmoky@users.sourceforge.net> required only for V1,Rush, and V2
@ -1821,7 +1818,7 @@ void LoadTex (int id, int tmu)
// DON'T CONTINUE (already done)
}
wxUint32 tex_addr = GetTexAddr(tmu, texture_size);
uint32_t tex_addr = GetTexAddr(tmu, texture_size);
grTexDownloadMipMap(tmu,
tex_addr,
GR_MIPMAPLEVELMASK_BOTH,

View File

@ -44,6 +44,6 @@ void TexCacheInit ();
void TexCache ();
void ClearCache ();
extern wxUint8 * texture_buffer;
extern uint8_t * texture_buffer;
#endif //TEXCACHE_H

View File

@ -42,13 +42,13 @@
#include "TexLoad16b.h"
#include "TexLoad32b.h"
wxUint32 LoadNone(wxUIntPtr /*dst*/,wxUIntPtr /*src*/,int /*wid_64*/,int /*height*/,int /*line*/,int /*real_width*/,int /*tile*/)
uint32_t LoadNone(wxUIntPtr /*dst*/,wxUIntPtr /*src*/,int /*wid_64*/,int /*height*/,int /*line*/,int /*real_width*/,int /*tile*/)
{
memset (texture, 0, 4096*4);
return (1 << 16) | GR_TEXFMT_ARGB_1555;
}
typedef wxUint32 (*texfunc)(wxUIntPtr, wxUIntPtr, int, int, int, int, int);
typedef uint32_t (*texfunc)(wxUIntPtr, wxUIntPtr, int, int, int, int, int);
texfunc load_table [4][5] = { // [size][format]
{ Load4bSelect,
LoadNone,

View File

@ -64,19 +64,18 @@ static inline void load16bRGBA(uint8_t *src, uint8_t *dst, int wid_64, int heigh
{
v10 = bswap32(*v6);
v11 = bswap32(v6[1]);
ALOWORD(v10) = __ROR__((uint16_t)v10, 1);
ALOWORD(v11) = __ROR__((uint16_t)v11, 1);
ALOWORD(v10) = __ROR__((uint16_t)(v10 & 0xFFFF), 1);
ALOWORD(v11) = __ROR__((uint16_t)(v11 & 0xFFFF), 1);
v10 = __ROR__(v10, 16);
v11 = __ROR__(v11, 16);
ALOWORD(v10) = __ROR__((uint16_t)v10, 1);
ALOWORD(v11) = __ROR__((uint16_t)v11, 1);
ALOWORD(v10) = __ROR__((uint16_t)(v10 & 0xFFFF), 1);
ALOWORD(v11) = __ROR__((uint16_t)(v11 & 0xFFFF), 1);
*v7 = v10;
v7[1] = v11;
v6 += 2;
v7 += 2;
--v9;
}
while ( v9 );
} while (v9);
if (v17 == 1)
break;
v18 = v17 - 1;
@ -87,24 +86,22 @@ static inline void load16bRGBA(uint8_t *src, uint8_t *dst, int wid_64, int heigh
{
v15 = bswap32(v12[1]);
v16 = bswap32(*v12);
ALOWORD(v15) = __ROR__((uint16_t)v15, 1);
ALOWORD(v16) = __ROR__((uint16_t)v16, 1);
ALOWORD(v15) = __ROR__((uint16_t)(v15 & 0xFFFF), 1);
ALOWORD(v16) = __ROR__((uint16_t)(v16 & 0xFFFF), 1);
v15 = __ROR__(v15, 16);
v16 = __ROR__(v16, 16);
ALOWORD(v15) = __ROR__((uint16_t)v15, 1);
ALOWORD(v16) = __ROR__((uint16_t)v16, 1);
ALOWORD(v15) = __ROR__((uint16_t)(v15 & 0xFFFF), 1);
ALOWORD(v16) = __ROR__((uint16_t)(v16 & 0xFFFF), 1);
*v13 = v15;
v13[1] = v16;
v12 += 2;
v13 += 2;
--v14;
}
while ( v14 );
} while (v14);
v6 = (uint32_t *)&src[(line + (uintptr_t)v12 - (uintptr_t)src) & 0xFFF];
v7 = (uint32_t *)((char *)v13 + ext);
v8 = v18 - 1;
}
while ( v18 != 1 );
} while (v18 != 1);
}
static inline void load16bIA(uint8_t *src, uint8_t *dst, int wid_64, int height, int line, int ext)
@ -136,8 +133,7 @@ static inline void load16bIA(uint8_t *src, uint8_t *dst, int wid_64, int height,
v6 += 2;
v7 += 2;
--v9;
}
while ( v9 );
} while (v9);
if (v15 == 1)
break;
v16 = v15 - 1;
@ -152,21 +148,18 @@ static inline void load16bIA(uint8_t *src, uint8_t *dst, int wid_64, int height,
v11 += 2;
v12 += 2;
--v13;
}
while ( v13 );
} while (v13);
v6 = (uint32_t *)((char *)v11 + line);
v7 = (uint32_t *)((char *)v12 + ext);
v8 = v16 - 1;
} while (v16 != 1);
}
while ( v16 != 1 );
}
//****************************************************************
// Size: 2, Format: 0
//
wxUint32 Load16bRGBA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int /*tile*/)
uint32_t Load16bRGBA(wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int /*tile*/)
{
if (wid_64 < 1) wid_64 = 1;
if (height < 1) height = 1;
@ -181,7 +174,7 @@ wxUint32 Load16bRGBA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int
// Size: 2, Format: 3
//
wxUint32 Load16bIA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int /*tile*/)
uint32_t Load16bIA(wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int /*tile*/)
{
if (wid_64 < 1) wid_64 = 1;
if (height < 1) height = 1;
@ -196,7 +189,7 @@ wxUint32 Load16bIA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int li
// Size: 2, Format: 1
//
wxUint16 yuv_to_rgb565(wxUint8 y, wxUint8 u, wxUint8 v)
uint16_t yuv_to_rgb565(uint8_t y, uint8_t u, uint8_t v)
{
//*
float r = y + (1.370705f * (v - 128));
@ -212,19 +205,19 @@ wxUint16 yuv_to_rgb565(wxUint8 y, wxUint8 u, wxUint8 v)
if (r < 0) r = 0;
if (g < 0) g = 0;
if (b < 0) b = 0;
wxUint16 c = (wxUint16)(((wxUint16)(r) << 11) |
((wxUint16)(g) << 5) |
(wxUint16)(b) );
uint16_t c = (uint16_t)(((uint16_t)(r) << 11) |
((uint16_t)(g) << 5) |
(uint16_t)(b));
return c;
//*/
/*
const wxUint32 c = y - 16;
const wxUint32 d = u - 128;
const wxUint32 e = v - 128;
const uint32_t c = y - 16;
const uint32_t d = u - 128;
const uint32_t e = v - 128;
wxUint32 r = (298 * c + 409 * e + 128) & 0xf800;
wxUint32 g = ((298 * c - 100 * d - 208 * e + 128) >> 5) & 0x7e0;
wxUint32 b = ((298 * c + 516 * d + 128) >> 11) & 0x1f;
uint32_t r = (298 * c + 409 * e + 128) & 0xf800;
uint32_t g = ((298 * c - 100 * d - 208 * e + 128) >> 5) & 0x7e0;
uint32_t b = ((298 * c + 516 * d + 128) >> 11) & 0x1f;
WORD texel = (WORD)(r | g | b);
@ -236,19 +229,19 @@ wxUint16 yuv_to_rgb565(wxUint8 y, wxUint8 u, wxUint8 v)
// Size: 2, Format: 1
//
wxUint32 Load16bYUV (wxUIntPtr dst, wxUIntPtr /*src*/, int /*wid_64*/, int /*height*/, int /*line*/, int /*real_width*/, int tile)
uint32_t Load16bYUV(wxUIntPtr dst, wxUIntPtr /*src*/, int /*wid_64*/, int /*height*/, int /*line*/, int /*real_width*/, int tile)
{
wxUint32 * mb = (wxUint32*)(gfx.RDRAM+rdp.addr[rdp.tiles[tile].t_mem]); //pointer to the macro block
wxUint16 * tex = (wxUint16*)dst;
wxUint16 i;
uint32_t * mb = (uint32_t*)(gfx.RDRAM + rdp.addr[rdp.tiles[tile].t_mem]); //pointer to the macro block
uint16_t * tex = (uint16_t*)dst;
uint16_t i;
for (i = 0; i < 128; i++)
{
wxUint32 t = mb[i]; //each wxUint32 contains 2 pixels
wxUint8 y1 = (wxUint8)t&0xFF;
wxUint8 v = (wxUint8)(t>>8)&0xFF;
wxUint8 y0 = (wxUint8)(t>>16)&0xFF;
wxUint8 u = (wxUint8)(t>>24)&0xFF;
wxUint16 c = yuv_to_rgb565(y0, u, v);
uint32_t t = mb[i]; //each uint32_t contains 2 pixels
uint8_t y1 = (uint8_t)t & 0xFF;
uint8_t v = (uint8_t)(t >> 8) & 0xFF;
uint8_t y0 = (uint8_t)(t >> 16) & 0xFF;
uint8_t u = (uint8_t)(t >> 24) & 0xFF;
uint16_t c = yuv_to_rgb565(y0, u, v);
*(tex++) = c;
c = yuv_to_rgb565(y1, u, v);
*(tex++) = c;

View File

@ -43,24 +43,24 @@
// Load 32bit RGBA texture
// Based on sources of angrylion's software plugin.
//
wxUint32 Load32bRGBA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
uint32_t Load32bRGBA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
{
if (height < 1) height = 1;
const wxUint16 *tmem16 = (wxUint16*)rdp.tmem;
const wxUint32 tbase = (src - (wxUIntPtr)rdp.tmem) >> 1;
const wxUint32 width = max(1, wid_64 << 1);
const uint16_t *tmem16 = (uint16_t*)rdp.tmem;
const uint32_t tbase = (src - (wxUIntPtr)rdp.tmem) >> 1;
const uint32_t width = max(1, wid_64 << 1);
const int ext = real_width - width;
line = width + (line>>2);
wxUint32 s, t, c;
wxUint32 * tex = (wxUint32*)dst;
wxUint16 rg, ba;
for (t = 0; t < (wxUint32)height; t++)
uint32_t s, t, c;
uint32_t * tex = (uint32_t*)dst;
uint16_t rg, ba;
for (t = 0; t < (uint32_t)height; t++)
{
wxUint32 tline = tbase + line * t;
wxUint32 xorval = (t & 1) ? 3 : 1;
uint32_t tline = tbase + line * t;
uint32_t xorval = (t & 1) ? 3 : 1;
for (s = 0; s < width; s++)
{
wxUint32 taddr = ((tline + s) ^ xorval) & 0x3ff;
uint32_t taddr = ((tline + s) ^ xorval) & 0x3ff;
rg = tmem16[taddr];
ba = tmem16[taddr|0x400];
c = ((ba&0xFF)<<24) | (rg << 8) | (ba>>8);
@ -69,15 +69,15 @@ wxUint32 Load32bRGBA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int
tex += ext;
}
int id = tile - rdp.cur_tile;
wxUint32 mod = (id == 0) ? cmb.mod_0 : cmb.mod_1;
uint32_t mod = (id == 0) ? cmb.mod_0 : cmb.mod_1;
if (mod || !voodoo.sup_32bit_tex)
{
//convert to ARGB_4444
const wxUint32 tex_size = real_width * height;
tex = (wxUint32 *)dst;
wxUint16 *tex16 = (wxUint16*)dst;
wxUint16 a, r, g, b;
for (wxUint32 i = 0; i < tex_size; i++) {
const uint32_t tex_size = real_width * height;
tex = (uint32_t *)dst;
uint16_t *tex16 = (uint16_t*)dst;
uint16_t a, r, g, b;
for (uint32_t i = 0; i < tex_size; i++) {
c = tex[i];
a = (c >> 28) & 0xF;
r = (c >> 20) & 0xF;
@ -94,21 +94,21 @@ wxUint32 Load32bRGBA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int
// LoadTile for 32bit RGBA texture
// Based on sources of angrylion's software plugin.
//
void LoadTile32b (wxUint32 tile, wxUint32 ul_s, wxUint32 ul_t, wxUint32 width, wxUint32 height)
void LoadTile32b (uint32_t tile, uint32_t ul_s, uint32_t ul_t, uint32_t width, uint32_t height)
{
const wxUint32 line = rdp.tiles[tile].line << 2;
const wxUint32 tbase = rdp.tiles[tile].t_mem << 2;
const wxUint32 addr = rdp.timg.addr >> 2;
const wxUint32* src = (const wxUint32*)gfx.RDRAM;
wxUint16 *tmem16 = (wxUint16*)rdp.tmem;
wxUint32 c, ptr, tline, s, xorval;
const uint32_t line = rdp.tiles[tile].line << 2;
const uint32_t tbase = rdp.tiles[tile].t_mem << 2;
const uint32_t addr = rdp.timg.addr >> 2;
const uint32_t* src = (const uint32_t*)gfx.RDRAM;
uint16_t *tmem16 = (uint16_t*)rdp.tmem;
uint32_t c, ptr, tline, s, xorval;
for (wxUint32 j = 0; j < height; j++)
for (uint32_t j = 0; j < height; j++)
{
tline = tbase + line * j;
s = ((j + ul_t) * rdp.timg.width) + ul_s;
xorval = (j & 1) ? 3 : 1;
for (wxUint32 i = 0; i < width; i++)
for (uint32_t i = 0; i < width; i++)
{
c = src[addr + s + i];
ptr = ((tline + i) ^ xorval) & 0x3ff;
@ -122,30 +122,30 @@ void LoadTile32b (wxUint32 tile, wxUint32 ul_s, wxUint32 ul_t, wxUint32 width, w
// LoadBlock for 32bit RGBA texture
// Based on sources of angrylion's software plugin.
//
void LoadBlock32b(wxUint32 tile, wxUint32 ul_s, wxUint32 ul_t, wxUint32 lr_s, wxUint32 dxt)
void LoadBlock32b(uint32_t tile, uint32_t ul_s, uint32_t ul_t, uint32_t lr_s, uint32_t dxt)
{
const wxUint32 * src = (const wxUint32*)gfx.RDRAM;
const wxUint32 tb = rdp.tiles[tile].t_mem << 2;
const wxUint32 tiwindwords = rdp.timg.width;
const wxUint32 slindwords = ul_s;
const wxUint32 line = rdp.tiles[tile].line << 2;
const uint32_t * src = (const uint32_t*)gfx.RDRAM;
const uint32_t tb = rdp.tiles[tile].t_mem << 2;
const uint32_t tiwindwords = rdp.timg.width;
const uint32_t slindwords = ul_s;
const uint32_t line = rdp.tiles[tile].line << 2;
wxUint16 *tmem16 = (wxUint16*)rdp.tmem;
wxUint32 addr = rdp.timg.addr >> 2;
wxUint32 width = (lr_s - ul_s + 1) << 2;
uint16_t *tmem16 = (uint16_t*)rdp.tmem;
uint32_t addr = rdp.timg.addr >> 2;
uint32_t width = (lr_s - ul_s + 1) << 2;
if (width & 7)
width = (width & (~7)) + 8;
if (dxt != 0)
{
wxUint32 j= 0;
wxUint32 t = 0;
wxUint32 oldt = 0;
wxUint32 ptr;
uint32_t j= 0;
uint32_t t = 0;
uint32_t oldt = 0;
uint32_t ptr;
addr += (ul_t * tiwindwords) + slindwords;
wxUint32 c = 0;
for (wxUint32 i = 0; i < width; i += 2)
uint32_t c = 0;
for (uint32_t i = 0; i < width; i += 2)
{
oldt = t;
t = ((j >> 11) & 1) ? 3 : 1;
@ -165,8 +165,8 @@ void LoadBlock32b(wxUint32 tile, wxUint32 ul_s, wxUint32 ul_t, wxUint32 lr_s, wx
else
{
addr += (ul_t * tiwindwords) + slindwords;
wxUint32 c, ptr;
for (wxUint32 i = 0; i < width; i ++)
uint32_t c, ptr;
for (uint32_t i = 0; i < width; i ++)
{
ptr = ((tb + i) ^ 1) & 0x3ff;
c = src[addr + i];

View File

@ -590,7 +590,7 @@ static inline void load4bI(uint8_t *src, uint8_t *dst, int wid_64, int height, i
//****************************************************************
// Size: 0, Format: 2
wxUint32 Load4bCI (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
uint32_t Load4bCI (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
{
if (wid_64 < 1) wid_64 = 1;
if (height < 1) height = 1;
@ -622,7 +622,7 @@ wxUint32 Load4bCI (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int lin
//
// ** BY GUGAMAN **
wxUint32 Load4bIA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
uint32_t Load4bIA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
{
if (rdp.tlut_mode != 0)
return Load4bCI (dst, src, wid_64, height, line, real_width, tile);
@ -637,7 +637,7 @@ wxUint32 Load4bIA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int lin
//****************************************************************
// Size: 0, Format: 4
wxUint32 Load4bI (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
uint32_t Load4bI (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
{
if (rdp.tlut_mode != 0)
return Load4bCI (dst, src, wid_64, height, line, real_width, tile);
@ -653,7 +653,7 @@ wxUint32 Load4bI (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line
//****************************************************************
// Size: 0, Format: 0
wxUint32 Load4bSelect (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
uint32_t Load4bSelect (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
{
if (rdp.tlut_mode == 0)
return Load4bI (dst, src, wid_64, height, line, real_width, tile);

View File

@ -373,7 +373,7 @@ static inline void load8bI(uint8_t *src, uint8_t *dst, int wid_64, int height, i
// Size: 1, Format: 2
//
wxUint32 Load8bCI (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int /*tile*/)
uint32_t Load8bCI (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int /*tile*/)
{
if (wid_64 < 1) wid_64 = 1;
if (height < 1) height = 1;
@ -401,7 +401,7 @@ wxUint32 Load8bCI (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int lin
// Size: 1, Format: 3
//
wxUint32 Load8bIA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
uint32_t Load8bIA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
{
if (rdp.tlut_mode != 0)
return Load8bCI (dst, src, wid_64, height, line, real_width, tile);
@ -417,7 +417,7 @@ wxUint32 Load8bIA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int lin
// Size: 1, Format: 4
//
wxUint32 Load8bI (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
uint32_t Load8bI (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int tile)
{
if (rdp.tlut_mode != 0)
return Load8bCI (dst, src, wid_64, height, line, real_width, tile);

View File

@ -37,13 +37,13 @@
//
//****************************************************************
static void mod_tex_inter_color_using_factor (wxUint16 *dst, int size, wxUint32 color, wxUint32 factor)
static void mod_tex_inter_color_using_factor (uint16_t *dst, int size, uint32_t color, uint32_t factor)
{
float percent = factor / 255.0f;
float percent_i = 1 - percent;
wxUint32 cr, cg, cb;
wxUint16 col, a;
wxUint8 r, g, b;
uint32_t cr, cg, cb;
uint16_t col, a;
uint8_t r, g, b;
cr = (color >> 12) & 0xF;
cg = (color >> 8) & 0xF;
@ -53,18 +53,18 @@ static void mod_tex_inter_color_using_factor (wxUint16 *dst, int size, wxUint32
{
col = *dst;
a = col & 0xF000;
r = (wxUint8)(percent_i * ((col >> 8) & 0xF) + percent * cr);
g = (wxUint8)(percent_i * ((col >> 4) & 0xF) + percent * cg);
b = (wxUint8)(percent_i * (col & 0xF) + percent * cb);
r = (uint8_t)(percent_i * ((col >> 8) & 0xF) + percent * cr);
g = (uint8_t)(percent_i * ((col >> 4) & 0xF) + percent * cg);
b = (uint8_t)(percent_i * (col & 0xF) + percent * cb);
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_tex_inter_col_using_col1 (wxUint16 *dst, int size, wxUint32 color0, wxUint32 color1)
static void mod_tex_inter_col_using_col1 (uint16_t *dst, int size, uint32_t color0, uint32_t color1)
{
wxUint32 cr, cg, cb;
wxUint16 col, a;
wxUint8 r, g, b;
uint32_t cr, cg, cb;
uint16_t col, a;
uint8_t r, g, b;
float percent_r = ((color1 >> 12) & 0xF) / 15.0f;
float percent_g = ((color1 >> 8) & 0xF) / 15.0f;
@ -81,18 +81,18 @@ static void mod_tex_inter_col_using_col1 (wxUint16 *dst, int size, wxUint32 colo
{
col = *dst;
a = col & 0xF000;
r = (wxUint8)(percent_r_i * ((col >> 8) & 0xF) + percent_r * cr);
g = (wxUint8)(percent_g_i * ((col >> 4) & 0xF) + percent_g * cg);
b = (wxUint8)(percent_b_i * (col & 0xF) + percent_b * cb);
r = (uint8_t)(percent_r_i * ((col >> 8) & 0xF) + percent_r * cr);
g = (uint8_t)(percent_g_i * ((col >> 4) & 0xF) + percent_g * cg);
b = (uint8_t)(percent_b_i * (col & 0xF) + percent_b * cb);
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_full_color_sub_tex (wxUint16 *dst, int size, wxUint32 color)
static void mod_full_color_sub_tex (uint16_t *dst, int size, uint32_t color)
{
wxUint32 cr, cg, cb, ca;
wxUint16 col;
wxUint8 a, r, g, b;
uint32_t cr, cg, cb, ca;
uint16_t col;
uint8_t a, r, g, b;
cr = (color >> 12) & 0xF;
cg = (color >> 8) & 0xF;
@ -102,20 +102,20 @@ static void mod_full_color_sub_tex (wxUint16 *dst, int size, wxUint32 color)
for (int i=0; i<size; i++)
{
col = *dst;
a = (wxUint8)(ca - ((col >> 12) & 0xF));
r = (wxUint8)(cr - ((col >> 8) & 0xF));
g = (wxUint8)(cg - ((col >> 4) & 0xF));
b = (wxUint8)(cb - (col & 0xF));
a = (uint8_t)(ca - ((col >> 12) & 0xF));
r = (uint8_t)(cr - ((col >> 8) & 0xF));
g = (uint8_t)(cg - ((col >> 4) & 0xF));
b = (uint8_t)(cb - (col & 0xF));
*(dst++) = (a << 12) | (r << 8) | (g << 4) | b;
}
}
static void mod_col_inter_col1_using_tex (wxUint16 *dst, int size, wxUint32 color0, wxUint32 color1)
static void mod_col_inter_col1_using_tex (uint16_t *dst, int size, uint32_t color0, uint32_t color1)
{
wxUint32 cr0, cg0, cb0, cr1, cg1, cb1;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
uint32_t cr0, cg0, cb0, cr1, cg1, cb1;
uint16_t col;
uint8_t r, g, b;
uint16_t a;
float percent_r, percent_g, percent_b;
cr0 = (color0 >> 12) & 0xF;
@ -132,19 +132,19 @@ static void mod_col_inter_col1_using_tex (wxUint16 *dst, int size, wxUint32 colo
percent_r = ((col >> 8) & 0xF) / 15.0f;
percent_g = ((col >> 4) & 0xF) / 15.0f;
percent_b = (col & 0xF) / 15.0f;
r = min(15, (wxUint8)((1.0f-percent_r) * cr0 + percent_r * cr1 + 0.0001f));
g = min(15, (wxUint8)((1.0f-percent_g) * cg0 + percent_g * cg1 + 0.0001f));
b = min(15, (wxUint8)((1.0f-percent_b) * cb0 + percent_b * cb1 + 0.0001f));
r = min(15, (uint8_t)((1.0f-percent_r) * cr0 + percent_r * cr1 + 0.0001f));
g = min(15, (uint8_t)((1.0f-percent_g) * cg0 + percent_g * cg1 + 0.0001f));
b = min(15, (uint8_t)((1.0f-percent_b) * cb0 + percent_b * cb1 + 0.0001f));
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_col_inter_col1_using_texa (wxUint16 *dst, int size, wxUint32 color0, wxUint32 color1)
static void mod_col_inter_col1_using_texa (uint16_t *dst, int size, uint32_t color0, uint32_t color1)
{
wxUint32 cr0, cg0, cb0, cr1, cg1, cb1;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
uint32_t cr0, cg0, cb0, cr1, cg1, cb1;
uint16_t col;
uint8_t r, g, b;
uint16_t a;
float percent, percent_i;
cr0 = (color0 >> 12) & 0xF;
@ -160,19 +160,19 @@ static void mod_col_inter_col1_using_texa (wxUint16 *dst, int size, wxUint32 col
a = col & 0xF000;
percent = (a >> 12) / 15.0f;
percent_i = 1.0f - percent;
r = (wxUint8)(percent_i * cr0 + percent * cr1);
g = (wxUint8)(percent_i * cg0 + percent * cg1);
b = (wxUint8)(percent_i * cb0 + percent * cb1);
r = (uint8_t)(percent_i * cr0 + percent * cr1);
g = (uint8_t)(percent_i * cg0 + percent * cg1);
b = (uint8_t)(percent_i * cb0 + percent * cb1);
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_col_inter_col1_using_texa__mul_tex (wxUint16 *dst, int size, wxUint32 color0, wxUint32 color1)
static void mod_col_inter_col1_using_texa__mul_tex (uint16_t *dst, int size, uint32_t color0, uint32_t color1)
{
wxUint32 cr0, cg0, cb0, cr1, cg1, cb1;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
uint32_t cr0, cg0, cb0, cr1, cg1, cb1;
uint16_t col;
uint8_t r, g, b;
uint16_t a;
float percent, percent_i;
cr0 = (color0 >> 12) & 0xF;
@ -188,19 +188,19 @@ static void mod_col_inter_col1_using_texa__mul_tex (wxUint16 *dst, int size, wxU
a = col & 0xF000;
percent = (a >> 12) / 15.0f;
percent_i = 1.0f - percent;
r = (wxUint8)(((percent_i * cr0 + percent * cr1) / 15.0f) * (((col & 0x0F00) >> 8) / 15.0f) * 15.0f);
g = (wxUint8)(((percent_i * cg0 + percent * cg1) / 15.0f) * (((col & 0x00F0) >> 4) / 15.0f) * 15.0f);
b = (wxUint8)(((percent_i * cb0 + percent * cb1) / 15.0f) * ((col & 0x000F) / 15.0f) * 15.0f);
r = (uint8_t)(((percent_i * cr0 + percent * cr1) / 15.0f) * (((col & 0x0F00) >> 8) / 15.0f) * 15.0f);
g = (uint8_t)(((percent_i * cg0 + percent * cg1) / 15.0f) * (((col & 0x00F0) >> 4) / 15.0f) * 15.0f);
b = (uint8_t)(((percent_i * cb0 + percent * cb1) / 15.0f) * ((col & 0x000F) / 15.0f) * 15.0f);
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_col_inter_tex_using_tex (wxUint16 *dst, int size, wxUint32 color)
static void mod_col_inter_tex_using_tex (uint16_t *dst, int size, uint32_t color)
{
wxUint32 cr, cg, cb;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
uint32_t cr, cg, cb;
uint16_t col;
uint8_t r, g, b;
uint16_t a;
float percent_r, percent_g, percent_b;
cr = (color >> 12) & 0xF;
@ -214,19 +214,19 @@ static void mod_col_inter_tex_using_tex (wxUint16 *dst, int size, wxUint32 color
percent_r = ((col >> 8) & 0xF) / 15.0f;
percent_g = ((col >> 4) & 0xF) / 15.0f;
percent_b = (col & 0xF) / 15.0f;
r = (wxUint8)((1.0f-percent_r) * cr + percent_r * ((col & 0x0F00) >> 8));
g = (wxUint8)((1.0f-percent_g) * cg + percent_g * ((col & 0x00F0) >> 4));
b = (wxUint8)((1.0f-percent_b) * cb + percent_b * (col & 0x000F));
r = (uint8_t)((1.0f-percent_r) * cr + percent_r * ((col & 0x0F00) >> 8));
g = (uint8_t)((1.0f-percent_g) * cg + percent_g * ((col & 0x00F0) >> 4));
b = (uint8_t)((1.0f-percent_b) * cb + percent_b * (col & 0x000F));
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_col_inter_tex_using_texa (wxUint16 *dst, int size, wxUint32 color)
static void mod_col_inter_tex_using_texa (uint16_t *dst, int size, uint32_t color)
{
wxUint32 cr, cg, cb;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
uint32_t cr, cg, cb;
uint16_t col;
uint8_t r, g, b;
uint16_t a;
float percent, percent_i;
cr = (color >> 12) & 0xF;
@ -239,21 +239,21 @@ static void mod_col_inter_tex_using_texa (wxUint16 *dst, int size, wxUint32 colo
a = col & 0xF000;
percent = (a >> 12) / 15.0f;
percent_i = 1.0f - percent;
r = (wxUint8)(percent_i * cr + percent * ((col & 0x0F00) >> 8));
g = (wxUint8)(percent_i * cg + percent * ((col & 0x00F0) >> 4));
b = (wxUint8)(percent_i * cb + percent * (col & 0x000F));
r = (uint8_t)(percent_i * cr + percent * ((col & 0x0F00) >> 8));
g = (uint8_t)(percent_i * cg + percent * ((col & 0x00F0) >> 4));
b = (uint8_t)(percent_i * cb + percent * (col & 0x000F));
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_col2_inter__col_inter_col1_using_tex__using_texa (wxUint16 *dst, int size,
wxUint32 color0, wxUint32 color1,
wxUint32 color2)
static void mod_col2_inter__col_inter_col1_using_tex__using_texa (uint16_t *dst, int size,
uint32_t color0, uint32_t color1,
uint32_t color2)
{
wxUint32 cr0, cg0, cb0, cr1, cg1, cb1, cr2, cg2, cb2;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
uint32_t cr0, cg0, cb0, cr1, cg1, cb1, cr2, cg2, cb2;
uint16_t col;
uint8_t r, g, b;
uint16_t a;
float percent_r, percent_g, percent_b, percent_a;
cr0 = (color0 >> 12) & 0xF;
@ -274,33 +274,33 @@ static void mod_col2_inter__col_inter_col1_using_tex__using_texa (wxUint16 *dst,
percent_r = ((col >> 8) & 0xF) / 15.0f;
percent_g = ((col >> 4) & 0xF) / 15.0f;
percent_b = (col & 0xF) / 15.0f;
r = (wxUint8)(((1.0f-percent_r) * cr0 + percent_r * cr1) * percent_a + cr2 * (1.0f-percent_a));
g = (wxUint8)(((1.0f-percent_g) * cg0 + percent_g * cg1) * percent_a + cg2 * (1.0f-percent_a));
b = (wxUint8)(((1.0f-percent_b) * cb0 + percent_b * cb1) * percent_a + cb2 * (1.0f-percent_a));
r = (uint8_t)(((1.0f-percent_r) * cr0 + percent_r * cr1) * percent_a + cr2 * (1.0f-percent_a));
g = (uint8_t)(((1.0f-percent_g) * cg0 + percent_g * cg1) * percent_a + cg2 * (1.0f-percent_a));
b = (uint8_t)(((1.0f-percent_b) * cb0 + percent_b * cb1) * percent_a + cb2 * (1.0f-percent_a));
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_tex_scale_fac_add_fac (wxUint16 *dst, int size, wxUint32 factor)
static void mod_tex_scale_fac_add_fac (uint16_t *dst, int size, uint32_t factor)
{
float percent = factor / 255.0f;
wxUint16 col;
wxUint8 a;
uint16_t col;
uint8_t a;
float base_a = (1.0f - percent) * 15.0f;
for (int i=0; i<size; i++)
{
col = *dst;
a = (wxUint8)(base_a + percent * (col>>12));
a = (uint8_t)(base_a + percent * (col>>12));
*(dst++) = (a<<12) | (col & 0x0FFF);
}
}
static void mod_tex_sub_col_mul_fac_add_tex (wxUint16 *dst, int size, wxUint32 color, wxUint32 factor)
static void mod_tex_sub_col_mul_fac_add_tex (uint16_t *dst, int size, uint32_t color, uint32_t factor)
{
float percent = factor / 255.0f;
wxUint32 cr, cg, cb;
wxUint16 col, a;
uint32_t cr, cg, cb;
uint16_t col, a;
float r, g, b;
cr = (color >> 12) & 0xF;
@ -324,16 +324,16 @@ static void mod_tex_sub_col_mul_fac_add_tex (wxUint16 *dst, int size, wxUint32 c
if (b > 15.0f) b = 15.0f;
if (b < 0.0f) b = 0.0f;
*(dst++) = a | ((wxUint16)r << 8) | ((wxUint16)g << 4) | (wxUint16)b;
*(dst++) = a | ((uint16_t)r << 8) | ((uint16_t)g << 4) | (uint16_t)b;
}
}
static void mod_tex_scale_col_add_col (wxUint16 *dst, int size, wxUint32 color0, wxUint32 color1)
static void mod_tex_scale_col_add_col (uint16_t *dst, int size, uint32_t color0, uint32_t color1)
{
wxUint32 cr0, cg0, cb0, cr1, cg1, cb1;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
uint32_t cr0, cg0, cb0, cr1, cg1, cb1;
uint16_t col;
uint8_t r, g, b;
uint16_t a;
float percent_r, percent_g, percent_b;
cr0 = (color0 >> 12) & 0xF;
@ -350,18 +350,18 @@ static void mod_tex_scale_col_add_col (wxUint16 *dst, int size, wxUint32 color0,
percent_r = ((col >> 8) & 0xF) / 15.0f;
percent_g = ((col >> 4) & 0xF) / 15.0f;
percent_b = (col & 0xF) / 15.0f;
r = min(15, (wxUint8)(percent_r * cr0 + cr1 + 0.0001f));
g = min(15, (wxUint8)(percent_g * cg0 + cg1 + 0.0001f));
b = min(15, (wxUint8)(percent_b * cb0 + cb1 + 0.0001f));
r = min(15, (uint8_t)(percent_r * cr0 + cr1 + 0.0001f));
g = min(15, (uint8_t)(percent_g * cg0 + cg1 + 0.0001f));
b = min(15, (uint8_t)(percent_b * cb0 + cb1 + 0.0001f));
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_tex_add_col (wxUint16 *dst, int size, wxUint32 color)
static void mod_tex_add_col (uint16_t *dst, int size, uint32_t color)
{
wxUint32 cr, cg, cb;
wxUint16 col;
wxUint8 a, r, g, b;
uint32_t cr, cg, cb;
uint16_t col;
uint8_t a, r, g, b;
cr = (color >> 12) & 0xF;
cg = (color >> 8) & 0xF;
@ -370,21 +370,21 @@ static void mod_tex_add_col (wxUint16 *dst, int size, wxUint32 color)
for (int i=0; i<size; i++)
{
col = *dst;
a = (wxUint8)((col >> 12) & 0xF);
a = (uint8_t)((col >> 12) & 0xF);
// a = col & 0xF000;
r = (wxUint8)(cr + ((col >> 8) & 0xF))&0xF;
g = (wxUint8)(cg + ((col >> 4) & 0xF))&0xF;
b = (wxUint8)(cb + (col & 0xF))&0xF;
r = (uint8_t)(cr + ((col >> 8) & 0xF))&0xF;
g = (uint8_t)(cg + ((col >> 4) & 0xF))&0xF;
b = (uint8_t)(cb + (col & 0xF))&0xF;
*(dst++) = (a << 12) | (r << 8) | (g << 4) | b;
}
}
static void mod_col_mul_texa_add_tex (wxUint16 *dst, int size, wxUint32 color)
static void mod_col_mul_texa_add_tex (uint16_t *dst, int size, uint32_t color)
{
wxUint32 cr, cg, cb;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
uint32_t cr, cg, cb;
uint16_t col;
uint8_t r, g, b;
uint16_t a;
float factor;
cr = (color >> 12) & 0xF;
@ -396,18 +396,18 @@ static void mod_col_mul_texa_add_tex (wxUint16 *dst, int size, wxUint32 color)
col = *dst;
a = col & 0xF000;
factor = (a >> 12) / 15.0f;
r = (wxUint8)(cr*factor + ((col >> 8) & 0xF))&0xF;
g = (wxUint8)(cg*factor + ((col >> 4) & 0xF))&0xF;
b = (wxUint8)(cb*factor + (col & 0xF))&0xF;
r = (uint8_t)(cr*factor + ((col >> 8) & 0xF))&0xF;
g = (uint8_t)(cg*factor + ((col >> 4) & 0xF))&0xF;
b = (uint8_t)(cb*factor + (col & 0xF))&0xF;
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_tex_sub_col (wxUint16 *dst, int size, wxUint32 color)
static void mod_tex_sub_col (uint16_t *dst, int size, uint32_t color)
{
int cr, cg, cb;
wxUint16 col;
wxUint8 a, r, g, b;
uint16_t col;
uint8_t a, r, g, b;
cr = (color >> 12) & 0xF;
cg = (color >> 8) & 0xF;
@ -416,19 +416,19 @@ static void mod_tex_sub_col (wxUint16 *dst, int size, wxUint32 color)
for (int i=0; i<size; i++)
{
col = *dst;
a = (wxUint8)(col & 0xF000);
r = (wxUint8)max((((col >> 8) & 0xF) - cr), 0);
g = (wxUint8)max((((col >> 4) & 0xF) - cg), 0);
b = (wxUint8)max(((col & 0xF) - cb), 0);
a = (uint8_t)(col & 0xF000);
r = (uint8_t)max((((col >> 8) & 0xF) - cr), 0);
g = (uint8_t)max((((col >> 4) & 0xF) - cg), 0);
b = (uint8_t)max(((col & 0xF) - cb), 0);
*(dst++) = (a << 12) | (r << 8) | (g << 4) | b;
}
}
static void mod_tex_sub_col_mul_fac (wxUint16 *dst, int size, wxUint32 color, wxUint32 factor)
static void mod_tex_sub_col_mul_fac (uint16_t *dst, int size, uint32_t color, uint32_t factor)
{
float percent = factor / 255.0f;
wxUint32 cr, cg, cb;
wxUint16 col, a;
uint32_t cr, cg, cb;
uint16_t col, a;
float r, g, b;
cr = (color >> 12) & 0xF;
@ -438,7 +438,7 @@ static void mod_tex_sub_col_mul_fac (wxUint16 *dst, int size, wxUint32 color, wx
for (int i=0; i<size; i++)
{
col = *dst;
a = (wxUint8)((col >> 12) & 0xF);
a = (uint8_t)((col >> 12) & 0xF);
r = (float)((col >> 8) & 0xF);
r = (r - cr) * percent;
if (r > 15.0f) r = 15.0f;
@ -452,15 +452,15 @@ static void mod_tex_sub_col_mul_fac (wxUint16 *dst, int size, wxUint32 color, wx
if (b > 15.0f) b = 15.0f;
if (b < 0.0f) b = 0.0f;
*(dst++) = (a << 12) | ((wxUint16)r << 8) | ((wxUint16)g << 4) | (wxUint16)b;
*(dst++) = (a << 12) | ((uint16_t)r << 8) | ((uint16_t)g << 4) | (uint16_t)b;
}
}
static void mod_col_inter_tex_using_col1 (wxUint16 *dst, int size, wxUint32 color0, wxUint32 color1)
static void mod_col_inter_tex_using_col1 (uint16_t *dst, int size, uint32_t color0, uint32_t color1)
{
wxUint32 cr, cg, cb;
wxUint16 col, a;
wxUint8 r, g, b;
uint32_t cr, cg, cb;
uint16_t col, a;
uint8_t r, g, b;
float percent_r = ((color1 >> 12) & 0xF) / 15.0f;
float percent_g = ((color1 >> 8) & 0xF) / 15.0f;
@ -476,18 +476,18 @@ static void mod_col_inter_tex_using_col1 (wxUint16 *dst, int size, wxUint32 colo
for (int i=0; i<size; i++)
{
col = *dst;
a = (wxUint8)((col >> 12) & 0xF);
r = (wxUint8)(percent_r * ((col >> 8) & 0xF) + percent_r_i * cr);
g = (wxUint8)(percent_g * ((col >> 4) & 0xF) + percent_g_i * cg);
b = (wxUint8)(percent_b * (col & 0xF) + percent_b_i * cb);
a = (uint8_t)((col >> 12) & 0xF);
r = (uint8_t)(percent_r * ((col >> 8) & 0xF) + percent_r_i * cr);
g = (uint8_t)(percent_g * ((col >> 4) & 0xF) + percent_g_i * cg);
b = (uint8_t)(percent_b * (col & 0xF) + percent_b_i * cb);
*(dst++) = (a << 12) | (r << 8) | (g << 4) | b;
}
}
static void mod_tex_inter_noise_using_col (wxUint16 *dst, int size, wxUint32 color)
static void mod_tex_inter_noise_using_col (uint16_t *dst, int size, uint32_t color)
{
wxUint16 col, a;
wxUint8 r, g, b, noise;
uint16_t col, a;
uint8_t r, g, b, noise;
float percent_r = ((color >> 12) & 0xF) / 15.0f;
float percent_g = ((color >> 8) & 0xF) / 15.0f;
@ -501,19 +501,19 @@ static void mod_tex_inter_noise_using_col (wxUint16 *dst, int size, wxUint32 col
col = *dst;
a = col & 0xF000;
noise = rand()%16;
r = (wxUint8)(percent_r_i * ((col >> 8) & 0xF) + percent_r * noise);
g = (wxUint8)(percent_g_i * ((col >> 4) & 0xF) + percent_g * noise);
b = (wxUint8)(percent_b_i * (col & 0xF) + percent_b * noise);
r = (uint8_t)(percent_r_i * ((col >> 8) & 0xF) + percent_r * noise);
g = (uint8_t)(percent_g_i * ((col >> 4) & 0xF) + percent_g * noise);
b = (uint8_t)(percent_b_i * (col & 0xF) + percent_b * noise);
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_tex_inter_col_using_texa (wxUint16 *dst, int size, wxUint32 color)
static void mod_tex_inter_col_using_texa (uint16_t *dst, int size, uint32_t color)
{
wxUint32 cr, cg, cb;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
uint32_t cr, cg, cb;
uint16_t col;
uint8_t r, g, b;
uint16_t a;
float percent, percent_i;
cr = (color >> 12) & 0xF;
@ -526,19 +526,19 @@ static void mod_tex_inter_col_using_texa (wxUint16 *dst, int size, wxUint32 colo
a = col & 0xF000;
percent = (a >> 12) / 15.0f;
percent_i = 1.0f - percent;
r = (wxUint8)(percent * cr + percent_i * ((col & 0x0F00) >> 8));
g = (wxUint8)(percent * cg + percent_i * ((col & 0x00F0) >> 4));
b = (wxUint8)(percent * cb + percent_i * (col & 0x000F));
r = (uint8_t)(percent * cr + percent_i * ((col & 0x0F00) >> 8));
g = (uint8_t)(percent * cg + percent_i * ((col & 0x00F0) >> 4));
b = (uint8_t)(percent * cb + percent_i * (col & 0x000F));
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_tex_mul_col (wxUint16 *dst, int size, wxUint32 color)
static void mod_tex_mul_col (uint16_t *dst, int size, uint32_t color)
{
float cr, cg, cb;
wxUint16 col;
wxUint8 r, g, b;
wxUint16 a;
uint16_t col;
uint8_t r, g, b;
uint16_t a;
cr = (float)((color >> 12) & 0xF)/16.0f;
cg = (float)((color >> 8) & 0xF)/16.0f;
@ -548,18 +548,18 @@ static void mod_tex_mul_col (wxUint16 *dst, int size, wxUint32 color)
{
col = *dst;
a = col & 0xF000;
r = (wxUint8)(cr * ((col & 0x0F00) >> 8));
g = (wxUint8)(cg * ((col & 0x00F0) >> 4));
b = (wxUint8)(cb * (col & 0x000F));
r = (uint8_t)(cr * ((col & 0x0F00) >> 8));
g = (uint8_t)(cg * ((col & 0x00F0) >> 4));
b = (uint8_t)(cb * (col & 0x000F));
*(dst++) = a | (r << 8) | (g << 4) | b;
}
}
static void mod_tex_scale_fac_add_col (wxUint16 *dst, int size, wxUint32 color, wxUint32 factor)
static void mod_tex_scale_fac_add_col (uint16_t *dst, int size, uint32_t color, uint32_t factor)
{
float percent = factor / 255.0f;
wxUint32 cr, cg, cb;
wxUint16 col;
uint32_t cr, cg, cb;
uint16_t col;
float r, g, b;
cr = (color >> 12) & 0xF;
@ -572,6 +572,6 @@ static void mod_tex_scale_fac_add_col (wxUint16 *dst, int size, wxUint32 color,
r = cr + percent * (float)((col>>8)&0xF);
g = cg + percent * (float)((col>>4)&0xF);
b = cb + percent * (float)(col&0xF);
*(dst++) = (col&0xF000) | ((wxUint8)r << 8) | ((wxUint8)g << 4) | (wxUint8)b;
*(dst++) = (col&0xF000) | ((uint8_t)r << 8) | ((uint8_t)g << 4) | (uint8_t)b;
}
}

View File

@ -37,40 +37,40 @@
//
//****************************************************************
static void mod_tex_inter_color_using_factor_CI (wxUint32 color, wxUint32 factor)
static void mod_tex_inter_color_using_factor_CI (uint32_t color, uint32_t factor)
{
float percent = factor / 255.0f;
float percent_i = 1 - percent;
wxUint8 cr, cg, cb;
wxUint16 col;
wxUint8 a, r, g, b;
uint8_t cr, cg, cb;
uint16_t col;
uint8_t a, r, g, b;
cr = (wxUint8)((color >> 24) & 0xFF);
cg = (wxUint8)((color >> 16) & 0xFF);
cb = (wxUint8)((color >> 8) & 0xFF);
cr = (uint8_t)((color >> 24) & 0xFF);
cg = (uint8_t)((color >> 16) & 0xFF);
cb = (uint8_t)((color >> 8) & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = (wxUint8)(min(255, percent_i * r + percent * cr));
g = (wxUint8)(min(255, percent_i * g + percent * cg));
b = (wxUint8)(min(255, percent_i * b + percent * cb));
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) |
((wxUint16)(a ) << 0));
a = (uint8_t)(col&0x0001);;
r = (uint8_t)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (uint8_t)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (uint8_t)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = (uint8_t)(min(255, percent_i * r + percent * cr));
g = (uint8_t)(min(255, percent_i * g + percent * cg));
b = (uint8_t)(min(255, percent_i * b + percent * cb));
rdp.pal_8[i] = (uint16_t)(((uint16_t)(r >> 3) << 11) |
((uint16_t)(g >> 3) << 6) |
((uint16_t)(b >> 3) << 1) |
((uint16_t)(a ) << 0));
}
}
static void mod_tex_inter_col_using_col1_CI (wxUint32 color0, wxUint32 color1)
static void mod_tex_inter_col_using_col1_CI (uint32_t color0, uint32_t color1)
{
wxUint8 cr, cg, cb;
wxUint16 col;
wxUint8 a, r, g, b;
uint8_t cr, cg, cb;
uint16_t col;
uint8_t a, r, g, b;
float percent_r = ((color1 >> 24) & 0xFF) / 255.0f;
float percent_g = ((color1 >> 16) & 0xFF) / 255.0f;
@ -79,107 +79,107 @@ static void mod_tex_inter_col_using_col1_CI (wxUint32 color0, wxUint32 color1)
float percent_g_i = 1.0f - percent_g;
float percent_b_i = 1.0f - percent_b;
cr = (wxUint8)((color0 >> 24) & 0xFF);
cg = (wxUint8)((color0 >> 16) & 0xFF);
cb = (wxUint8)((color0 >> 8) & 0xFF);
cr = (uint8_t)((color0 >> 24) & 0xFF);
cg = (uint8_t)((color0 >> 16) & 0xFF);
cb = (uint8_t)((color0 >> 8) & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = (wxUint8)(min(255, percent_r_i * r + percent_r * cr));
g = (wxUint8)(min(255, percent_g_i * g + percent_g * cg));
b = (wxUint8)(min(255, percent_b_i * b + percent_b * cb));
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) |
((wxUint16)(a ) << 0));
a = (uint8_t)(col&0x0001);;
r = (uint8_t)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (uint8_t)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (uint8_t)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = (uint8_t)(min(255, percent_r_i * r + percent_r * cr));
g = (uint8_t)(min(255, percent_g_i * g + percent_g * cg));
b = (uint8_t)(min(255, percent_b_i * b + percent_b * cb));
rdp.pal_8[i] = (uint16_t)(((uint16_t)(r >> 3) << 11) |
((uint16_t)(g >> 3) << 6) |
((uint16_t)(b >> 3) << 1) |
((uint16_t)(a ) << 0));
}
}
static void mod_full_color_sub_tex_CI (wxUint32 color)
static void mod_full_color_sub_tex_CI (uint32_t color)
{
wxUint8 cr, cg, cb, ca;
wxUint16 col;
wxUint8 a, r, g, b;
uint8_t cr, cg, cb, ca;
uint16_t col;
uint8_t a, r, g, b;
cr = (wxUint8)((color >> 24) & 0xFF);
cg = (wxUint8)((color >> 16) & 0xFF);
cb = (wxUint8)((color >> 8) & 0xFF);
ca = (wxUint8)(color & 0xFF);
cr = (uint8_t)((color >> 24) & 0xFF);
cg = (uint8_t)((color >> 16) & 0xFF);
cb = (uint8_t)((color >> 8) & 0xFF);
ca = (uint8_t)(color & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
a = (uint8_t)(col&0x0001);;
r = (uint8_t)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (uint8_t)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (uint8_t)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
a = max(0, ca - a);
r = max(0, cr - r);
g = max(0, cg - g);
b = max(0, cb - b);
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) |
((wxUint16)(a ) << 0));
rdp.pal_8[i] = (uint16_t)(((uint16_t)(r >> 3) << 11) |
((uint16_t)(g >> 3) << 6) |
((uint16_t)(b >> 3) << 1) |
((uint16_t)(a ) << 0));
}
}
static void mod_col_inter_col1_using_tex_CI (wxUint32 color0, wxUint32 color1)
static void mod_col_inter_col1_using_tex_CI (uint32_t color0, uint32_t color1)
{
wxUint32 cr0, cg0, cb0, cr1, cg1, cb1;
wxUint16 col;
wxUint8 a, r, g, b;
uint32_t cr0, cg0, cb0, cr1, cg1, cb1;
uint16_t col;
uint8_t a, r, g, b;
float percent_r, percent_g, percent_b;
cr0 = (wxUint8)((color0 >> 24) & 0xFF);
cg0 = (wxUint8)((color0 >> 16) & 0xFF);
cb0 = (wxUint8)((color0 >> 8) & 0xFF);
cr1 = (wxUint8)((color1 >> 24) & 0xFF);
cg1 = (wxUint8)((color1 >> 16) & 0xFF);
cb1 = (wxUint8)((color1 >> 8) & 0xFF);
cr0 = (uint8_t)((color0 >> 24) & 0xFF);
cg0 = (uint8_t)((color0 >> 16) & 0xFF);
cb0 = (uint8_t)((color0 >> 8) & 0xFF);
cr1 = (uint8_t)((color1 >> 24) & 0xFF);
cg1 = (uint8_t)((color1 >> 16) & 0xFF);
cb1 = (uint8_t)((color1 >> 8) & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
a = (uint8_t)(col&0x0001);;
percent_r = ((col&0xF800) >> 11) / 31.0f;
percent_g = ((col&0x07C0) >> 6) / 31.0f;
percent_b = ((col&0x003E) >> 1) / 31.0f;
r = (wxUint8)(min((1.0f-percent_r) * cr0 + percent_r * cr1, 255));
g = (wxUint8)(min((1.0f-percent_g) * cg0 + percent_g * cg1, 255));
b = (wxUint8)(min((1.0f-percent_b) * cb0 + percent_b * cb1, 255));
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) |
((wxUint16)(a ) << 0));
r = (uint8_t)(min((1.0f-percent_r) * cr0 + percent_r * cr1, 255));
g = (uint8_t)(min((1.0f-percent_g) * cg0 + percent_g * cg1, 255));
b = (uint8_t)(min((1.0f-percent_b) * cb0 + percent_b * cb1, 255));
rdp.pal_8[i] = (uint16_t)(((uint16_t)(r >> 3) << 11) |
((uint16_t)(g >> 3) << 6) |
((uint16_t)(b >> 3) << 1) |
((uint16_t)(a ) << 0));
}
}
static void mod_tex_sub_col_mul_fac_add_tex_CI (wxUint32 color, wxUint32 factor)
static void mod_tex_sub_col_mul_fac_add_tex_CI (uint32_t color, uint32_t factor)
{
float percent = factor / 255.0f;
wxUint8 cr, cg, cb, a;
wxUint16 col;
uint8_t cr, cg, cb, a;
uint16_t col;
float r, g, b;
cr = (wxUint8)((color >> 24) & 0xFF);
cg = (wxUint8)((color >> 16) & 0xFF);
cb = (wxUint8)((color >> 8) & 0xFF);
cr = (uint8_t)((color >> 24) & 0xFF);
cg = (uint8_t)((color >> 16) & 0xFF);
cb = (uint8_t)((color >> 8) & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
a = (uint8_t)(col&0x0001);;
r = (uint8_t)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (uint8_t)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (uint8_t)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = (r - cr) * percent + r;
if (r > 255.0f) r = 255.0f;
if (r < 0.0f) r = 0.0f;
@ -189,113 +189,113 @@ static void mod_tex_sub_col_mul_fac_add_tex_CI (wxUint32 color, wxUint32 factor)
b = (b - cb) * percent + b;
if (b > 255.0f) g = 255.0f;
if (b < 0.0f) b = 0.0f;
rdp.pal_8[i] = (wxUint16)(((wxUint16)((wxUint8)(r) >> 3) << 11) |
((wxUint16)((wxUint8)(g) >> 3) << 6) |
((wxUint16)((wxUint8)(b) >> 3) << 1) |
(wxUint16)(a) );
rdp.pal_8[i] = (uint16_t)(((uint16_t)((uint8_t)(r) >> 3) << 11) |
((uint16_t)((uint8_t)(g) >> 3) << 6) |
((uint16_t)((uint8_t)(b) >> 3) << 1) |
(uint16_t)(a) );
}
}
static void mod_tex_scale_col_add_col_CI (wxUint32 color0, wxUint32 color1)
static void mod_tex_scale_col_add_col_CI (uint32_t color0, uint32_t color1)
{
wxUint8 cr, cg, cb;
wxUint16 col;
wxUint8 a, r, g, b;
uint8_t cr, cg, cb;
uint16_t col;
uint8_t a, r, g, b;
float percent_r = ((color0 >> 24) & 0xFF) / 255.0f;
float percent_g = ((color0 >> 16) & 0xFF) / 255.0f;
float percent_b = ((color0 >> 8) & 0xFF) / 255.0f;
cr = (wxUint8)((color1 >> 24) & 0xFF);
cg = (wxUint8)((color1 >> 16) & 0xFF);
cb = (wxUint8)((color1 >> 8) & 0xFF);
cr = (uint8_t)((color1 >> 24) & 0xFF);
cg = (uint8_t)((color1 >> 16) & 0xFF);
cb = (uint8_t)((color1 >> 8) & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = (wxUint8)(min(255, percent_r * r + cr));
g = (wxUint8)(min(255, percent_g * g + cg));
b = (wxUint8)(min(255, percent_b * b + cb));
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) |
((wxUint16)(a ) << 0));
a = (uint8_t)(col&0x0001);;
r = (uint8_t)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (uint8_t)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (uint8_t)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = (uint8_t)(min(255, percent_r * r + cr));
g = (uint8_t)(min(255, percent_g * g + cg));
b = (uint8_t)(min(255, percent_b * b + cb));
rdp.pal_8[i] = (uint16_t)(((uint16_t)(r >> 3) << 11) |
((uint16_t)(g >> 3) << 6) |
((uint16_t)(b >> 3) << 1) |
((uint16_t)(a ) << 0));
}
}
static void mod_tex_add_col_CI (wxUint32 color)
static void mod_tex_add_col_CI (uint32_t color)
{
wxUint8 cr, cg, cb;
wxUint16 col;
wxUint8 a, r, g, b;
uint8_t cr, cg, cb;
uint16_t col;
uint8_t a, r, g, b;
cr = (wxUint8)((color >> 24) & 0xFF);
cg = (wxUint8)((color >> 16) & 0xFF);
cb = (wxUint8)((color >> 8) & 0xFF);
cr = (uint8_t)((color >> 24) & 0xFF);
cg = (uint8_t)((color >> 16) & 0xFF);
cb = (uint8_t)((color >> 8) & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
a = (uint8_t)(col&0x0001);;
r = (uint8_t)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (uint8_t)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (uint8_t)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = min(cr + r, 255);
g = min(cg + g, 255);
b = min(cb + b, 255);
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) |
((wxUint16)(a ) << 0));
rdp.pal_8[i] = (uint16_t)(((uint16_t)(r >> 3) << 11) |
((uint16_t)(g >> 3) << 6) |
((uint16_t)(b >> 3) << 1) |
((uint16_t)(a ) << 0));
}
}
static void mod_tex_sub_col_CI (wxUint32 color)
static void mod_tex_sub_col_CI (uint32_t color)
{
wxUint8 cr, cg, cb;
wxUint16 col;
wxUint8 a, r, g, b;
uint8_t cr, cg, cb;
uint16_t col;
uint8_t a, r, g, b;
cr = (wxUint8)((color >> 24) & 0xFF);
cg = (wxUint8)((color >> 16) & 0xFF);
cb = (wxUint8)((color >> 8) & 0xFF);
cr = (uint8_t)((color >> 24) & 0xFF);
cg = (uint8_t)((color >> 16) & 0xFF);
cb = (uint8_t)((color >> 8) & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
a = (uint8_t)(col&0x0001);;
r = (uint8_t)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (uint8_t)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (uint8_t)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = max(r - cr, 0);
g = max(g - cg, 0);
b = max(b - cb, 0);
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) |
((wxUint16)(a ) << 0));
rdp.pal_8[i] = (uint16_t)(((uint16_t)(r >> 3) << 11) |
((uint16_t)(g >> 3) << 6) |
((uint16_t)(b >> 3) << 1) |
((uint16_t)(a ) << 0));
}
}
static void mod_tex_sub_col_mul_fac_CI (wxUint32 color, wxUint32 factor)
static void mod_tex_sub_col_mul_fac_CI (uint32_t color, uint32_t factor)
{
float percent = factor / 255.0f;
wxUint8 cr, cg, cb;
wxUint16 col;
wxUint8 a;
uint8_t cr, cg, cb;
uint16_t col;
uint8_t a;
float r, g, b;
cr = (wxUint8)((color >> 24) & 0xFF);
cg = (wxUint8)((color >> 16) & 0xFF);
cb = (wxUint8)((color >> 8) & 0xFF);
cr = (uint8_t)((color >> 24) & 0xFF);
cg = (uint8_t)((color >> 16) & 0xFF);
cb = (uint8_t)((color >> 8) & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);
a = (uint8_t)(col&0x0001);
r = (float)((col&0xF800) >> 11) / 31.0f * 255.0f;
g = (float)((col&0x07C0) >> 6) / 31.0f * 255.0f;
b = (float)((col&0x003E) >> 1) / 31.0f * 255.0f;
@ -309,18 +309,18 @@ static void mod_tex_sub_col_mul_fac_CI (wxUint32 color, wxUint32 factor)
if (b > 255.0f) g = 255.0f;
if (b < 0.0f) b = 0.0f;
rdp.pal_8[i] = (wxUint16)(((wxUint16)((wxUint8)(r) >> 3) << 11) |
((wxUint16)((wxUint8)(g) >> 3) << 6) |
((wxUint16)((wxUint8)(b) >> 3) << 1) |
(wxUint16)(a) );
rdp.pal_8[i] = (uint16_t)(((uint16_t)((uint8_t)(r) >> 3) << 11) |
((uint16_t)((uint8_t)(g) >> 3) << 6) |
((uint16_t)((uint8_t)(b) >> 3) << 1) |
(uint16_t)(a) );
}
}
static void mod_col_inter_tex_using_col1_CI (wxUint32 color0, wxUint32 color1)
static void mod_col_inter_tex_using_col1_CI (uint32_t color0, uint32_t color1)
{
wxUint8 cr, cg, cb;
wxUint16 col;
wxUint8 a, r, g, b;
uint8_t cr, cg, cb;
uint16_t col;
uint8_t a, r, g, b;
float percent_r = ((color1 >> 24) & 0xFF) / 255.0f;
float percent_g = ((color1 >> 16) & 0xFF) / 255.0f;
@ -329,36 +329,36 @@ static void mod_col_inter_tex_using_col1_CI (wxUint32 color0, wxUint32 color1)
float percent_g_i = 1.0f - percent_g;
float percent_b_i = 1.0f - percent_b;
cr = (wxUint8)((color0 >> 24) & 0xFF);
cg = (wxUint8)((color0 >> 16) & 0xFF);
cb = (wxUint8)((color0 >> 8) & 0xFF);
cr = (uint8_t)((color0 >> 24) & 0xFF);
cg = (uint8_t)((color0 >> 16) & 0xFF);
cb = (uint8_t)((color0 >> 8) & 0xFF);
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = (wxUint8)(min(255, percent_r * r + percent_r_i * cr));
g = (wxUint8)(min(255, percent_g * g + percent_g_i * cg));
b = (wxUint8)(min(255, percent_b * b + percent_b_i * cb));
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) |
((wxUint16)(a ) << 0));
a = (uint8_t)(col&0x0001);;
r = (uint8_t)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (uint8_t)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (uint8_t)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = (uint8_t)(min(255, percent_r * r + percent_r_i * cr));
g = (uint8_t)(min(255, percent_g * g + percent_g_i * cg));
b = (uint8_t)(min(255, percent_b * b + percent_b_i * cb));
rdp.pal_8[i] = (uint16_t)(((uint16_t)(r >> 3) << 11) |
((uint16_t)(g >> 3) << 6) |
((uint16_t)(b >> 3) << 1) |
((uint16_t)(a ) << 0));
}
}
static void mod_tex_inter_col_using_texa_CI (wxUint32 color)
static void mod_tex_inter_col_using_texa_CI (uint32_t color)
{
wxUint8 a, r, g, b;
uint8_t a, r, g, b;
r = (wxUint8)((float)((color >> 24) & 0xFF) / 255.0f * 31.0f);
g = (wxUint8)((float)((color >> 16) & 0xFF) / 255.0f * 31.0f);
b = (wxUint8)((float)((color >> 8) & 0xFF) / 255.0f * 31.0f);
r = (uint8_t)((float)((color >> 24) & 0xFF) / 255.0f * 31.0f);
g = (uint8_t)((float)((color >> 16) & 0xFF) / 255.0f * 31.0f);
b = (uint8_t)((float)((color >> 8) & 0xFF) / 255.0f * 31.0f);
a = (color&0xFF) ? 1 : 0;
wxUint16 col16 = (wxUint16)((r<<11)|(g<<6)|(b<<1)|a);
uint16_t col16 = (uint16_t)((r<<11)|(g<<6)|(b<<1)|a);
for (int i=0; i<256; i++)
{
@ -367,10 +367,10 @@ static void mod_tex_inter_col_using_texa_CI (wxUint32 color)
}
}
static void mod_tex_mul_col_CI (wxUint32 color)
static void mod_tex_mul_col_CI (uint32_t color)
{
wxUint8 a, r, g, b;
wxUint16 col;
uint8_t a, r, g, b;
uint16_t col;
float cr, cg, cb;
cr = (float)((color >> 24) & 0xFF) / 255.0f;
@ -380,18 +380,18 @@ static void mod_tex_mul_col_CI (wxUint32 color)
for (int i=0; i<256; i++)
{
col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) * cr);
g = (wxUint8)((float)((col&0x07C0) >> 6) * cg);
b = (wxUint8)((float)((col&0x003E) >> 1) * cb);
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) |
((wxUint16)(a ) << 0));
a = (uint8_t)(col&0x0001);;
r = (uint8_t)((float)((col&0xF800) >> 11) * cr);
g = (uint8_t)((float)((col&0x07C0) >> 6) * cg);
b = (uint8_t)((float)((col&0x003E) >> 1) * cb);
rdp.pal_8[i] = (uint16_t)(((uint16_t)(r >> 3) << 11) |
((uint16_t)(g >> 3) << 6) |
((uint16_t)(b >> 3) << 1) |
((uint16_t)(a ) << 0));
}
}
static void ModifyPalette(wxUint32 mod, wxUint32 modcolor, wxUint32 modcolor1, wxUint32 modfactor)
static void ModifyPalette(uint32_t mod, uint32_t modcolor, uint32_t modcolor1, uint32_t modfactor)
{
switch (mod)
{

View File

@ -65,7 +65,7 @@ void util_init ()
}
}
static wxUint32 u_cull_mode = 0;
static uint32_t u_cull_mode = 0;
//software backface culling. Gonetz
// mega modifications by Dave2001
@ -160,19 +160,18 @@ int cull_tri(VERTEX **v) // type changed to VERTEX** [Dave2001]
return FALSE;
}
void apply_shade_mods(VERTEX *v)
{
float col[4];
wxUint32 mod;
uint32_t mod;
memcpy(col, rdp.col, 16);
if (rdp.cmb_flags)
{
if (v->shade_mod == 0)
v->color_backup = *(wxUint32*)(&(v->b));
v->color_backup = *(uint32_t*)(&(v->b));
else
*(wxUint32*)(&(v->b)) = v->color_backup;
*(uint32_t*)(&(v->b)) = v->color_backup;
mod = rdp.cmb_flags;
if (mod & CMB_SET)
{
@ -182,15 +181,15 @@ void apply_shade_mods (VERTEX *v)
if (col[0] < 0.0f) col[0] = 0.0f;
if (col[1] < 0.0f) col[1] = 0.0f;
if (col[2] < 0.0f) col[2] = 0.0f;
v->r = (wxUint8)(255.0f * col[0]);
v->g = (wxUint8)(255.0f * col[1]);
v->b = (wxUint8)(255.0f * col[2]);
v->r = (uint8_t)(255.0f * col[0]);
v->g = (uint8_t)(255.0f * col[1]);
v->b = (uint8_t)(255.0f * col[2]);
}
if (mod & CMB_A_SET)
{
if (col[3] > 1.0f) col[3] = 1.0f;
if (col[3] < 0.0f) col[3] = 0.0f;
v->a = (wxUint8)(255.0f * col[3]);
v->a = (uint8_t)(255.0f * col[3]);
}
if (mod & CMB_SETSHADE_SHADEALPHA)
{
@ -199,9 +198,9 @@ void apply_shade_mods (VERTEX *v)
if (mod & CMB_MULT_OWN_ALPHA)
{
float percent = v->a / 255.0f;
v->r = (wxUint8)(v->r * percent);
v->g = (wxUint8)(v->g * percent);
v->b = (wxUint8)(v->b * percent);
v->r = (uint8_t)(v->r * percent);
v->g = (uint8_t)(v->g * percent);
v->b = (uint8_t)(v->b * percent);
}
if (mod & CMB_MULT)
{
@ -211,15 +210,15 @@ void apply_shade_mods (VERTEX *v)
if (col[0] < 0.0f) col[0] = 0.0f;
if (col[1] < 0.0f) col[1] = 0.0f;
if (col[2] < 0.0f) col[2] = 0.0f;
v->r = (wxUint8)(v->r * col[0]);
v->g = (wxUint8)(v->g * col[1]);
v->b = (wxUint8)(v->b * col[2]);
v->r = (uint8_t)(v->r * col[0]);
v->g = (uint8_t)(v->g * col[1]);
v->b = (uint8_t)(v->b * col[2]);
}
if (mod & CMB_A_MULT)
{
if (col[3] > 1.0f) col[3] = 1.0f;
if (col[3] < 0.0f) col[3] = 0.0f;
v->a = (wxUint8)(v->a * col[3]);
v->a = (uint8_t)(v->a * col[3]);
}
if (mod & CMB_SUB)
{
@ -229,15 +228,15 @@ void apply_shade_mods (VERTEX *v)
if (r < 0) r = 0;
if (g < 0) g = 0;
if (b < 0) b = 0;
v->r = (wxUint8)r;
v->g = (wxUint8)g;
v->b = (wxUint8)b;
v->r = (uint8_t)r;
v->g = (uint8_t)g;
v->b = (uint8_t)b;
}
if (mod & CMB_A_SUB)
{
int a = v->a - (int)(255.0f * rdp.coladd[3]);
if (a < 0) a = 0;
v->a = (wxUint8)a;
v->a = (uint8_t)a;
}
if (mod & CMB_ADD)
{
@ -247,35 +246,35 @@ void apply_shade_mods (VERTEX *v)
if (r > 255) r = 255;
if (g > 255) g = 255;
if (b > 255) b = 255;
v->r = (wxUint8)r;
v->g = (wxUint8)g;
v->b = (wxUint8)b;
v->r = (uint8_t)r;
v->g = (uint8_t)g;
v->b = (uint8_t)b;
}
if (mod & CMB_A_ADD)
{
int a = v->a + (int)(255.0f * rdp.coladd[3]);
if (a > 255) a = 255;
v->a = (wxUint8)a;
v->a = (uint8_t)a;
}
if (mod & CMB_COL_SUB_OWN)
{
int r = (wxUint8)(255.0f * rdp.coladd[0]) - v->r;
int g = (wxUint8)(255.0f * rdp.coladd[1]) - v->g;
int b = (wxUint8)(255.0f * rdp.coladd[2]) - v->b;
int r = (uint8_t)(255.0f * rdp.coladd[0]) - v->r;
int g = (uint8_t)(255.0f * rdp.coladd[1]) - v->g;
int b = (uint8_t)(255.0f * rdp.coladd[2]) - v->b;
if (r < 0) r = 0;
if (g < 0) g = 0;
if (b < 0) b = 0;
v->r = (wxUint8)r;
v->g = (wxUint8)g;
v->b = (wxUint8)b;
v->r = (uint8_t)r;
v->g = (uint8_t)g;
v->b = (uint8_t)b;
}
v->shade_mod = cmb.shade_mod_hash;
}
if (rdp.cmb_flags_2 & CMB_INTER)
{
v->r = (wxUint8)(rdp.col_2[0] * rdp.shade_factor * 255.0f + v->r * (1.0f - rdp.shade_factor));
v->g = (wxUint8)(rdp.col_2[1] * rdp.shade_factor * 255.0f + v->g * (1.0f - rdp.shade_factor));
v->b = (wxUint8)(rdp.col_2[2] * rdp.shade_factor * 255.0f + v->b * (1.0f - rdp.shade_factor));
v->r = (uint8_t)(rdp.col_2[0] * rdp.shade_factor * 255.0f + v->r * (1.0f - rdp.shade_factor));
v->g = (uint8_t)(rdp.col_2[1] * rdp.shade_factor * 255.0f + v->g * (1.0f - rdp.shade_factor));
v->b = (uint8_t)(rdp.col_2[2] * rdp.shade_factor * 255.0f + v->b * (1.0f - rdp.shade_factor));
v->shade_mod = cmb.shade_mod_hash;
}
}
@ -284,7 +283,7 @@ static int dzdx = 0;
static int deltaZ = 0;
VERTEX **org_vtx;
void draw_tri (VERTEX **vtx, wxUint16 linew)
void draw_tri(VERTEX **vtx, uint16_t linew)
{
deltaZ = dzdx = 0;
if (linew == 0 && (fb_depth_render_enabled || (rdp.rm & 0xC00) == 0xC00))
@ -351,10 +350,10 @@ void draw_tri (VERTEX **vtx, wxUint16 linew)
#ifdef EXTREME_LOGGING
FRDP(" * Prim shaded %08lx\n", rdp.prim_color);
#endif
v->a = (wxUint8)(rdp.prim_color & 0xFF);
v->b = (wxUint8)((rdp.prim_color >> 8) & 0xFF);
v->g = (wxUint8)((rdp.prim_color >> 16) & 0xFF);
v->r = (wxUint8)((rdp.prim_color >> 24) & 0xFF);
v->a = (uint8_t)(rdp.prim_color & 0xFF);
v->b = (uint8_t)((rdp.prim_color >> 8) & 0xFF);
v->g = (uint8_t)((rdp.prim_color >> 16) & 0xFF);
v->r = (uint8_t)((rdp.prim_color >> 24) & 0xFF);
}
}
}
@ -535,10 +534,10 @@ void draw_tri (VERTEX **vtx, wxUint16 linew)
cur_256 * rdp.cur_cache[0]->splitheight;
rdp.vtxbuf[index].u1 = v1->u1 + (v2->u1 - v1->u1) * percent;
rdp.vtxbuf[index].v1 = v1->v1 + (v2->v1 - v1->v1) * percent;
rdp.vtxbuf[index].b = (wxUint8)(v1->b + (v2->b - v1->b) * percent);
rdp.vtxbuf[index].g = (wxUint8)(v1->g + (v2->g - v1->g) * percent);
rdp.vtxbuf[index].r = (wxUint8)(v1->r + (v2->r - v1->r) * percent);
rdp.vtxbuf[index++].a = (wxUint8)(v1->a + (v2->a - v1->a) * percent);
rdp.vtxbuf[index].b = (uint8_t)(v1->b + (v2->b - v1->b) * percent);
rdp.vtxbuf[index].g = (uint8_t)(v1->g + (v2->g - v1->g) * percent);
rdp.vtxbuf[index].r = (uint8_t)(v1->r + (v2->r - v1->r) * percent);
rdp.vtxbuf[index++].a = (uint8_t)(v1->a + (v2->a - v1->a) * percent);
}
}
else
@ -557,10 +556,10 @@ void draw_tri (VERTEX **vtx, wxUint16 linew)
cur_256 * rdp.cur_cache[0]->splitheight;
rdp.vtxbuf[index].u1 = v2->u1 + (v1->u1 - v2->u1) * percent;
rdp.vtxbuf[index].v1 = v2->v1 + (v1->v1 - v2->v1) * percent;
rdp.vtxbuf[index].b = (wxUint8)(v2->b + (v1->b - v2->b) * percent);
rdp.vtxbuf[index].g = (wxUint8)(v2->g + (v1->g - v2->g) * percent);
rdp.vtxbuf[index].r = (wxUint8)(v2->r + (v1->r - v2->r) * percent);
rdp.vtxbuf[index++].a = (wxUint8)(v2->a + (v1->a - v2->a) * percent);
rdp.vtxbuf[index].b = (uint8_t)(v2->b + (v1->b - v2->b) * percent);
rdp.vtxbuf[index].g = (uint8_t)(v2->g + (v1->g - v2->g) * percent);
rdp.vtxbuf[index].r = (uint8_t)(v2->r + (v1->r - v2->r) * percent);
rdp.vtxbuf[index++].a = (uint8_t)(v2->a + (v1->a - v2->a) * percent);
// Save the in point
rdp.vtxbuf[index] = *v2;
@ -604,10 +603,10 @@ void draw_tri (VERTEX **vtx, wxUint16 linew)
rdp.vtxbuf[index].v0 = v1->v0 + (v2->v0 - v1->v0) * percent;
rdp.vtxbuf[index].u1 = v1->u1 + (v2->u1 - v1->u1) * percent;
rdp.vtxbuf[index].v1 = v1->v1 + (v2->v1 - v1->v1) * percent;
rdp.vtxbuf[index].b = (wxUint8)(v1->b + (v2->b - v1->b) * percent);
rdp.vtxbuf[index].g = (wxUint8)(v1->g + (v2->g - v1->g) * percent);
rdp.vtxbuf[index].r = (wxUint8)(v1->r + (v2->r - v1->r) * percent);
rdp.vtxbuf[index].a = (wxUint8)(v1->a + (v2->a - v1->a) * percent);
rdp.vtxbuf[index].b = (uint8_t)(v1->b + (v2->b - v1->b) * percent);
rdp.vtxbuf[index].g = (uint8_t)(v1->g + (v2->g - v1->g) * percent);
rdp.vtxbuf[index].r = (uint8_t)(v1->r + (v2->r - v1->r) * percent);
rdp.vtxbuf[index].a = (uint8_t)(v1->a + (v2->a - v1->a) * percent);
rdp.vtxbuf[index++].not_zclipped = 0;
}
}
@ -626,10 +625,10 @@ void draw_tri (VERTEX **vtx, wxUint16 linew)
rdp.vtxbuf[index].v0 = v2->v0 + (v1->v0 - v2->v0) * percent;
rdp.vtxbuf[index].u1 = v2->u1 + (v1->u1 - v2->u1) * percent;
rdp.vtxbuf[index].v1 = v2->v1 + (v1->v1 - v2->v1) * percent;
rdp.vtxbuf[index].b = (wxUint8)(v2->b + (v1->b - v2->b) * percent);
rdp.vtxbuf[index].g = (wxUint8)(v2->g + (v1->g - v2->g) * percent);
rdp.vtxbuf[index].r = (wxUint8)(v2->r + (v1->r - v2->r) * percent);
rdp.vtxbuf[index].a = (wxUint8)(v2->a + (v1->a - v2->a) * percent);
rdp.vtxbuf[index].b = (uint8_t)(v2->b + (v1->b - v2->b) * percent);
rdp.vtxbuf[index].g = (uint8_t)(v2->g + (v1->g - v2->g) * percent);
rdp.vtxbuf[index].r = (uint8_t)(v2->r + (v1->r - v2->r) * percent);
rdp.vtxbuf[index].a = (uint8_t)(v2->a + (v1->a - v2->a) * percent);
rdp.vtxbuf[index++].not_zclipped = 0;
// Save the in point
@ -667,10 +666,10 @@ void draw_tri (VERTEX **vtx, wxUint16 linew)
//*
static void InterpolateColors(VERTEX & va, VERTEX & vb, VERTEX & res, float percent)
{
res.b = (wxUint8)interp2p(va.b, vb.b, percent);
res.g = (wxUint8)interp2p(va.g, vb.g, percent);;
res.r = (wxUint8)interp2p(va.r, vb.r, percent);;
res.a = (wxUint8)interp2p(va.a, vb.a, percent);;
res.b = (uint8_t)interp2p(va.b, vb.b, percent);
res.g = (uint8_t)interp2p(va.g, vb.g, percent);;
res.r = (uint8_t)interp2p(va.r, vb.r, percent);;
res.a = (uint8_t)interp2p(va.a, vb.a, percent);;
res.f = interp2p(va.f, vb.f, percent);;
}
//*/
@ -748,9 +747,9 @@ static void clip_w (int interpolate_colors)
rdp.n_global = index;
}
static void render_tri (wxUint16 linew, int old_interpolate);
static void render_tri(uint16_t linew, int old_interpolate);
void do_triangle_stuff (wxUint16 linew, int old_interpolate) // what else?? do the triangle stuff :P (to keep from writing code twice)
void do_triangle_stuff(uint16_t linew, int old_interpolate) // what else?? do the triangle stuff :P (to keep from writing code twice)
{
int i;
@ -759,7 +758,7 @@ void do_triangle_stuff (wxUint16 linew, int old_interpolate) // what else?? do t
float maxZ = (rdp.zsrc != 1) ? rdp.view_trans[2] + rdp.view_scale[2] : rdp.prim_depth;
wxUint8 no_clip = 2;
uint8_t no_clip = 2;
for (i = 0; i < rdp.n_global; i++)
{
if (rdp.vtxbuf[i].not_zclipped)// && rdp.zsrc != 1)
@ -821,7 +820,7 @@ void do_triangle_stuff (wxUint16 linew, int old_interpolate) // what else?? do t
render_tri(linew, old_interpolate);
}
void do_triangle_stuff_2 (wxUint16 linew)
void do_triangle_stuff_2(uint16_t linew)
{
rdp.clip = 0;
@ -837,9 +836,9 @@ void do_triangle_stuff_2 (wxUint16 linew)
render_tri(linew, TRUE);
}
__inline wxUint8 real_to_char(double x)
__inline uint8_t real_to_char(double x)
{
return (wxUint8)(((int)floor(x+0.5))&0xFF);
return (uint8_t)(((int)floor(x + 0.5)) & 0xFF);
}
//*
@ -905,7 +904,6 @@ static void Create1LineEq(LineEuqationType &l, VERTEX &v1, VERTEX &v2, VERTEX &v
}
}
__inline double interp3p(float a, float b, float c, double r1, double r2)
{
return (a)+(((b)+((c)-(b))*(r2)) - (a))*(r1);
@ -917,7 +915,6 @@ __inline double interp3p(float a, float b, float c, double r1, double r2)
static void InterpolateColors3(VERTEX &v1, VERTEX &v2, VERTEX &v3, VERTEX &out)
{
LineEuqationType line;
Create1LineEq(line, v2, v3, v1);
@ -1091,7 +1088,6 @@ va_end(ap);
//#define LOGG(x)
//#define FRDP2(x)
void clip_tri(int interpolate_colors)
{
int i, j, index, n = rdp.n_global;
@ -1488,7 +1484,7 @@ void clip_tri(int interpolate_colors)
rdp.n_global = n;
}
static void render_tri (wxUint16 linew, int old_interpolate)
static void render_tri(uint16_t linew, int old_interpolate)
{
if (rdp.clip)
clip_tri(old_interpolate);
@ -1502,7 +1498,6 @@ static void render_tri (wxUint16 linew, int old_interpolate)
//*
if ((rdp.clip & CLIP_ZMIN) && (rdp.othermode_l & 0x00000030))
{
int to_render = FALSE;
for (i = 0; i < n; i++)
{
@ -1625,8 +1620,6 @@ static void render_tri (wxUint16 linew, int old_interpolate)
}
}
*/
if (fullscreen)
{
if (settings.wireframe)
{
SetWireframeCol();
@ -1639,7 +1632,6 @@ static void render_tri (wxUint16 linew, int old_interpolate)
}
else
{
// VERTEX ** pv = rdp.vtx_buffer?(vtx_list2):(vtx_list1);
// for (int k = 0; k < n; k ++)
// FRDP ("DRAW[%d]: v.x = %f, v.y = %f, v.z = %f, v.u = %f, v.v = %f\n", k, pv[k]->x, pv[k]->y, pv[k]->z, pv[k]->coord[rdp.t0<<1], pv[k]->coord[(rdp.t0<<1)+1]);
@ -1704,7 +1696,6 @@ static void render_tri (wxUint16 linew, int old_interpolate)
grDrawVertexArray(GR_TRIANGLE_FAN, n, rdp.vtx_buffer ? (&vtx_list2) : (&vtx_list1));
}
}
}
if (_debugger.capture) add_tri(rdp.vtxbuf, n, TRI_TRIANGLE);
}
@ -1791,17 +1782,15 @@ void update_scissor ()
rdp.update ^= UPDATE_SCISSOR;
// KILL the floating point error with 0.01f
rdp.scissor.ul_x = (wxUint32)max(min((rdp.scissor_o.ul_x * rdp.scale_x + rdp.offset_x + 0.01f),settings.res_x),0);
rdp.scissor.lr_x = (wxUint32)max(min((rdp.scissor_o.lr_x * rdp.scale_x + rdp.offset_x + 0.01f),settings.res_x),0);
rdp.scissor.ul_y = (wxUint32)max(min((rdp.scissor_o.ul_y * rdp.scale_y + rdp.offset_y + 0.01f),settings.res_y),0);
rdp.scissor.lr_y = (wxUint32)max(min((rdp.scissor_o.lr_y * rdp.scale_y + rdp.offset_y + 0.01f),settings.res_y),0);
rdp.scissor.ul_x = (uint32_t)max(min((rdp.scissor_o.ul_x * rdp.scale_x + rdp.offset_x + 0.01f), settings.res_x), 0);
rdp.scissor.lr_x = (uint32_t)max(min((rdp.scissor_o.lr_x * rdp.scale_x + rdp.offset_x + 0.01f), settings.res_x), 0);
rdp.scissor.ul_y = (uint32_t)max(min((rdp.scissor_o.ul_y * rdp.scale_y + rdp.offset_y + 0.01f), settings.res_y), 0);
rdp.scissor.lr_y = (uint32_t)max(min((rdp.scissor_o.lr_y * rdp.scale_y + rdp.offset_y + 0.01f), settings.res_y), 0);
//grClipWindow specifies the hardware clipping window. Any pixels outside the clipping window are rejected.
//Values are inclusive for minimum x and y values and exclusive for maximum x and y values.
// grClipWindow (rdp.scissor.ul_x?rdp.scissor.ul_x+1:0, rdp.scissor.ul_y?rdp.scissor.ul_y+1:0, rdp.scissor.lr_x, rdp.scissor.lr_y);
if (fullscreen)
grClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
FRDP (" |- scissor - (%d, %d) -> (%d, %d)\n", rdp.scissor.ul_x, rdp.scissor.ul_y,
rdp.scissor.lr_x, rdp.scissor.lr_y);
FRDP(" |- scissor - (%d, %d) -> (%d, %d)\n", rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
}
}
@ -1878,14 +1867,14 @@ void update ()
FRDP(" |- render_mode_changed force_blend - %08lx\n", rdp.othermode_l & 0xFFFF0000);
rdp.render_mode_changed &= 0x0000FFFF;
rdp.fbl_a0 = (wxUint8)((rdp.othermode_l>>30)&0x3);
rdp.fbl_b0 = (wxUint8)((rdp.othermode_l>>26)&0x3);
rdp.fbl_c0 = (wxUint8)((rdp.othermode_l>>22)&0x3);
rdp.fbl_d0 = (wxUint8)((rdp.othermode_l>>18)&0x3);
rdp.fbl_a1 = (wxUint8)((rdp.othermode_l>>28)&0x3);
rdp.fbl_b1 = (wxUint8)((rdp.othermode_l>>24)&0x3);
rdp.fbl_c1 = (wxUint8)((rdp.othermode_l>>20)&0x3);
rdp.fbl_d1 = (wxUint8)((rdp.othermode_l>>16)&0x3);
rdp.fbl_a0 = (uint8_t)((rdp.othermode_l >> 30) & 0x3);
rdp.fbl_b0 = (uint8_t)((rdp.othermode_l >> 26) & 0x3);
rdp.fbl_c0 = (uint8_t)((rdp.othermode_l >> 22) & 0x3);
rdp.fbl_d0 = (uint8_t)((rdp.othermode_l >> 18) & 0x3);
rdp.fbl_a1 = (uint8_t)((rdp.othermode_l >> 28) & 0x3);
rdp.fbl_b1 = (uint8_t)((rdp.othermode_l >> 24) & 0x3);
rdp.fbl_c1 = (uint8_t)((rdp.othermode_l >> 20) & 0x3);
rdp.fbl_d1 = (uint8_t)((rdp.othermode_l >> 16) & 0x3);
rdp.update |= UPDATE_COMBINE;
}
@ -1916,8 +1905,6 @@ void update ()
rdp.update ^= UPDATE_TEXTURE;
}
if (fullscreen)
{
// Z buffer
if (rdp.update & UPDATE_ZBUF_ENABLED)
{
@ -1977,7 +1964,7 @@ void update ()
// if (rdp.acmp == 1 && !(rdp.othermode_l & 0x00002000) && (rdp.blend_color&0xFF))
if (rdp.acmp == 1 && !(rdp.othermode_l & 0x00002000) && (!(rdp.othermode_l & 0x00004000) || (rdp.blend_color & 0xFF)))
{
wxUint8 reference = (wxUint8)(rdp.blend_color&0xFF);
uint8_t reference = (uint8_t)(rdp.blend_color & 0xFF);
grAlphaTestFunction(reference ? GR_CMP_GEQUAL : GR_CMP_GREATER);
grAlphaTestReferenceValue(reference);
FRDP(" |- alpha compare: blend: %02lx\n", reference);
@ -1997,7 +1984,7 @@ void update ()
grAlphaTestFunction(GR_CMP_GREATER);
if (rdp.acmp == 3)
{
grAlphaTestReferenceValue ((wxUint8)(rdp.blend_color&0xFF));
grAlphaTestReferenceValue((uint8_t)(rdp.blend_color & 0xFF));
FRDP(" |- alpha compare: blend: %02lx\n", rdp.blend_color & 0xFF);
}
else
@ -2038,7 +2025,7 @@ void update ()
if (rdp.update & UPDATE_CULL_MODE)
{
rdp.update ^= UPDATE_CULL_MODE;
wxUint32 mode = (rdp.flags & CULLMASK) >> CULLSHIFT;
uint32_t mode = (rdp.flags & CULLMASK) >> CULLSHIFT;
FRDP(" |- cull_mode - mode: %s\n", str_cull[mode]);
switch (mode)
{
@ -2062,7 +2049,7 @@ void update ()
{
rdp.update ^= UPDATE_FOG_ENABLED;
wxUint16 blender = (wxUint16)(rdp.othermode_l >> 16);
uint16_t blender = (uint16_t)(rdp.othermode_l >> 16);
if (rdp.flags & FOG_ENABLED)
{
rdp_blender_setting &bl = *(rdp_blender_setting*)(&(blender));
@ -2101,13 +2088,10 @@ void update ()
grFogMode(GR_FOG_DISABLE);
}
}
}
if (rdp.update & UPDATE_VIEWPORT)
{
rdp.update ^= UPDATE_VIEWPORT;
if (fullscreen)
{
float scale_x = (float)fabs(rdp.view_scale[0]);
float scale_y = (float)fabs(rdp.view_scale[1]);
@ -2116,20 +2100,21 @@ void update ()
rdp.clip_max_x = min((rdp.view_trans[0] + scale_x + rdp.offset_x) * rdp.clip_ratio, settings.res_x);
rdp.clip_max_y = min((rdp.view_trans[1] + scale_y + rdp.offset_y) * rdp.clip_ratio, settings.res_y);
FRDP (" |- viewport - (%d, %d, %d, %d)\n", (wxUint32)rdp.clip_min_x, (wxUint32)rdp.clip_min_y, (wxUint32)rdp.clip_max_x, (wxUint32)rdp.clip_max_y);
FRDP(" |- viewport - (%d, %d, %d, %d)\n", (uint32_t)rdp.clip_min_x, (uint32_t)rdp.clip_min_y, (uint32_t)rdp.clip_max_x, (uint32_t)rdp.clip_max_y);
if (!rdp.scissor_set)
{
rdp.scissor.ul_x = (wxUint32)rdp.clip_min_x;
rdp.scissor.lr_x = (wxUint32)rdp.clip_max_x;
rdp.scissor.ul_y = (wxUint32)rdp.clip_min_y;
rdp.scissor.lr_y = (wxUint32)rdp.clip_max_y;
rdp.scissor.ul_x = (uint32_t)rdp.clip_min_x;
rdp.scissor.lr_x = (uint32_t)rdp.clip_max_x;
rdp.scissor.ul_y = (uint32_t)rdp.clip_min_y;
rdp.scissor.lr_y = (uint32_t)rdp.clip_max_y;
grClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
}
}
}
if (rdp.update & UPDATE_SCISSOR)
{
update_scissor();
}
LRDP(" + update end\n");
}
@ -2180,4 +2165,3 @@ void set_message_combiner ()
&fontTex);
grFogMode(GR_FOG_DISABLE);
}

View File

@ -45,12 +45,12 @@
#define NOT_TMU2 0x02
void util_init();
void render_tri (wxUint16 linew = 0);
void render_tri(uint16_t linew = 0);
int cull_tri(VERTEX **v);
void draw_tri (VERTEX **v, wxUint16 linew = 0);
void do_triangle_stuff (wxUint16 linew = 0, int old_interpolate = TRUE);
void do_triangle_stuff_2 (wxUint16 linew = 0);
void draw_tri(VERTEX **v, uint16_t linew = 0);
void do_triangle_stuff(uint16_t linew = 0, int old_interpolate = TRUE);
void do_triangle_stuff_2(uint16_t linew = 0);
void add_tri(VERTEX *v, int n, int type);
void apply_shade_mods(VERTEX *v);
@ -105,6 +105,17 @@ static inline uint32_t bswap32(uint32_t val)
#define ALOWORD(x) (*((uint16_t*)&(x))) // low word
static inline uint16_t __ROR__(uint16_t value, unsigned int count)
{
const unsigned int nbits = sizeof(uint16_t) * 8;
count %= nbits;
uint16_t low = (value << (nbits - count)) & 0xFFFF;
value >>= count;
value |= low;
return value;
}
template<class T> static inline T __ROR__(T value, unsigned int count)
{
const unsigned int nbits = sizeof(T) * 8;

View File

@ -1,4 +1,4 @@
wxUint8 cursor[] = {127,
uint8_t cursor[] = {127,
255,
127,
255,

View File

@ -1,4 +1,4 @@
wxUint8 font[] = {255,
uint8_t font[] = {255,
255,
255,
255,

File diff suppressed because it is too large Load Diff

View File

@ -44,12 +44,12 @@
/******************Turbo3D microcode*************************/
struct t3dGlobState {
wxUint16 pad0;
wxUint16 perspNorm;
wxUint32 flag;
wxUint32 othermode0;
wxUint32 othermode1;
wxUint32 segBases[16];
uint16_t pad0;
uint16_t perspNorm;
uint32_t flag;
uint32_t othermode0;
uint32_t othermode1;
uint32_t segBases[16];
/* the viewport to use */
short vsacle1;
short vsacle0;
@ -59,50 +59,50 @@ struct t3dGlobState {
short vtrans0;
short vtrans3;
short vtrans2;
wxUint32 rdpCmds;
uint32_t rdpCmds;
};
struct t3dState {
wxUint32 renderState; /* render state */
wxUint32 textureState; /* texture state */
wxUint8 flag;
wxUint8 triCount; /* how many tris? */
wxUint8 vtxV0; /* where to load verts? */
wxUint8 vtxCount; /* how many verts? */
wxUint32 rdpCmds; /* ptr (segment address) to RDP DL */
wxUint32 othermode0;
wxUint32 othermode1;
uint32_t renderState; /* render state */
uint32_t textureState; /* texture state */
uint8_t flag;
uint8_t triCount; /* how many tris? */
uint8_t vtxV0; /* where to load verts? */
uint8_t vtxCount; /* how many verts? */
uint32_t rdpCmds; /* ptr (segment address) to RDP DL */
uint32_t othermode0;
uint32_t othermode1;
};
struct t3dTriN{
wxUint8 flag, v2, v1, v0; /* flag is which one for flat shade */
uint8_t flag, v2, v1, v0; /* flag is which one for flat shade */
};
static void t3dProcessRDP(wxUint32 a)
static void t3dProcessRDP(uint32_t a)
{
if (a)
{
rdp.LLE = 1;
rdp.cmd0 = ((wxUint32*)gfx.RDRAM)[a++];
rdp.cmd1 = ((wxUint32*)gfx.RDRAM)[a++];
rdp.cmd0 = ((uint32_t*)gfx.RDRAM)[a++];
rdp.cmd1 = ((uint32_t*)gfx.RDRAM)[a++];
while (rdp.cmd0 + rdp.cmd1) {
gfx_instruction[0][rdp.cmd0>>24] ();
rdp.cmd0 = ((wxUint32*)gfx.RDRAM)[a++];
rdp.cmd1 = ((wxUint32*)gfx.RDRAM)[a++];
wxUint32 cmd = rdp.cmd0>>24;
rdp.cmd0 = ((uint32_t*)gfx.RDRAM)[a++];
rdp.cmd1 = ((uint32_t*)gfx.RDRAM)[a++];
uint32_t cmd = rdp.cmd0>>24;
if (cmd == 0xE4 || cmd == 0xE5)
{
rdp.cmd2 = ((wxUint32*)gfx.RDRAM)[a++];
rdp.cmd3 = ((wxUint32*)gfx.RDRAM)[a++];
rdp.cmd2 = ((uint32_t*)gfx.RDRAM)[a++];
rdp.cmd3 = ((uint32_t*)gfx.RDRAM)[a++];
}
}
rdp.LLE = 0;
}
}
static void t3dLoadGlobState(wxUint32 pgstate)
static void t3dLoadGlobState(uint32_t pgstate)
{
t3dGlobState *gstate = (t3dGlobState*)&gfx.RDRAM[segoffset(pgstate)];
FRDP ("Global state. pad0: %04lx, perspNorm: %04lx, flag: %08lx\n", gstate->pad0, gstate->perspNorm, gstate->flag);
@ -135,7 +135,7 @@ static void t3dLoadGlobState(wxUint32 pgstate)
t3dProcessRDP(segoffset(gstate->rdpCmds) >> 2);
}
static void t3d_vertex(wxUint32 addr, wxUint32 v0, wxUint32 n)
static void t3d_vertex(uint32_t addr, uint32_t v0, uint32_t n)
{
float x, y, z;
@ -143,20 +143,20 @@ static void t3d_vertex(wxUint32 addr, wxUint32 v0, wxUint32 n)
rdp.vn = n; // Number of vertices to copy
n <<= 4;
for (wxUint32 i=0; i < n; i+=16)
for (uint32_t i=0; i < n; i+=16)
{
VERTEX *v = &rdp.vtx[v0 + (i>>4)];
x = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 0)^1];
y = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 1)^1];
z = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 2)^1];
v->flags = ((wxUint16*)gfx.RDRAM)[(((addr+i) >> 1) + 3)^1];
v->flags = ((uint16_t*)gfx.RDRAM)[(((addr+i) >> 1) + 3)^1];
v->ou = 2.0f * (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 4)^1];
v->ov = 2.0f * (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 5)^1];
v->uv_scaled = 0;
v->r = ((wxUint8*)gfx.RDRAM)[(addr+i + 12)^3];
v->g = ((wxUint8*)gfx.RDRAM)[(addr+i + 13)^3];
v->b = ((wxUint8*)gfx.RDRAM)[(addr+i + 14)^3];
v->a = ((wxUint8*)gfx.RDRAM)[(addr+i + 15)^3];
v->r = ((uint8_t*)gfx.RDRAM)[(addr+i + 12)^3];
v->g = ((uint8_t*)gfx.RDRAM)[(addr+i + 13)^3];
v->b = ((uint8_t*)gfx.RDRAM)[(addr+i + 14)^3];
v->a = ((uint8_t*)gfx.RDRAM)[(addr+i + 15)^3];
v->x = x*rdp.combined[0][0] + y*rdp.combined[1][0] + z*rdp.combined[2][0] + rdp.combined[3][0];
v->y = x*rdp.combined[0][1] + y*rdp.combined[1][1] + z*rdp.combined[2][1] + rdp.combined[3][1];
@ -185,7 +185,7 @@ static void t3d_vertex(wxUint32 addr, wxUint32 v0, wxUint32 n)
}
}
static void t3dLoadObject(wxUint32 pstate, wxUint32 pvtx, wxUint32 ptri)
static void t3dLoadObject(uint32_t pstate, uint32_t pvtx, uint32_t ptri)
{
LRDP("Loading Turbo3D object\n");
t3dState *ostate = (t3dState*)&gfx.RDRAM[segoffset(pstate)];
@ -210,7 +210,7 @@ static void t3dLoadObject(wxUint32 pstate, wxUint32 pvtx, wxUint32 ptri)
if (!(ostate->flag&1)) //load matrix
{
wxUint32 addr = segoffset(pstate+sizeof(t3dState)) & BMASK;
uint32_t addr = segoffset(pstate+sizeof(t3dState)) & BMASK;
load_matrix(rdp.combined, addr);
#ifdef EXTREME_LOGGING
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[0][0], rdp.combined[0][1], rdp.combined[0][2], rdp.combined[0][3]);
@ -230,7 +230,7 @@ static void t3dLoadObject(wxUint32 pstate, wxUint32 pvtx, wxUint32 ptri)
if (ptri)
{
update ();
wxUint32 a = segoffset(ptri);
uint32_t a = segoffset(ptri);
for (int t=0; t < ostate->triCount; t++)
{
t3dTriN * tri = (t3dTriN*)&gfx.RDRAM[a];
@ -252,13 +252,13 @@ static void Turbo3D()
{
LRDP("Start Turbo3D microcode\n");
settings.ucode = ucode_Fast3D;
wxUint32 a = 0, pgstate = 0, pstate = 0, pvtx = 0, ptri = 0;
uint32_t a = 0, pgstate = 0, pstate = 0, pvtx = 0, ptri = 0;
do {
a = rdp.pc[rdp.pc_i] & BMASK;
pgstate = ((wxUint32*)gfx.RDRAM)[a>>2];
pstate = ((wxUint32*)gfx.RDRAM)[(a>>2)+1];
pvtx = ((wxUint32*)gfx.RDRAM)[(a>>2)+2];
ptri = ((wxUint32*)gfx.RDRAM)[(a>>2)+3];
pgstate = ((uint32_t*)gfx.RDRAM)[a>>2];
pstate = ((uint32_t*)gfx.RDRAM)[(a>>2)+1];
pvtx = ((uint32_t*)gfx.RDRAM)[(a>>2)+2];
ptri = ((uint32_t*)gfx.RDRAM)[(a>>2)+3];
FRDP("GlobalState: %08lx, Object: %08lx, Vertices: %08lx, Triangles: %08lx\n", pgstate, pstate, pvtx, ptri);
if (!pstate)
{

View File

@ -51,7 +51,7 @@
static void rsp_vertex(int v0, int n)
{
wxUint32 addr = segoffset(rdp.cmd1) & 0x00FFFFFF;
uint32_t addr = segoffset(rdp.cmd1) & 0x00FFFFFF;
int i;
float x, y, z;
@ -73,7 +73,7 @@ static void rsp_vertex(int v0, int n)
rdp.update ^= UPDATE_LIGHTS;
// Calculate light vectors
for (wxUint32 l=0; l<rdp.num_lights; l++)
for (uint32_t l=0; l<rdp.num_lights; l++)
{
InverseTransformVector(&rdp.light[l].dir_x, rdp.light_vector[l], rdp.model);
NormalizeVector (rdp.light_vector[l]);
@ -88,11 +88,11 @@ static void rsp_vertex(int v0, int n)
x = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 0)^1];
y = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 1)^1];
z = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 2)^1];
v->flags = ((wxUint16*)gfx.RDRAM)[(((addr+i) >> 1) + 3)^1];
v->flags = ((uint16_t*)gfx.RDRAM)[(((addr+i) >> 1) + 3)^1];
v->ou = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 4)^1];
v->ov = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 5)^1];
v->uv_scaled = 0;
v->a = ((wxUint8*)gfx.RDRAM)[(addr+i + 15)^3];
v->a = ((uint8_t*)gfx.RDRAM)[(addr+i + 15)^3];
v->x = x*rdp.combined[0][0] + y*rdp.combined[1][0] + z*rdp.combined[2][0] + rdp.combined[3][0];
v->y = x*rdp.combined[0][1] + y*rdp.combined[1][1] + z*rdp.combined[2][1] + rdp.combined[3][1];
@ -137,9 +137,9 @@ static void rsp_vertex(int v0, int n)
}
else
{
v->r = ((wxUint8*)gfx.RDRAM)[(addr+i + 12)^3];
v->g = ((wxUint8*)gfx.RDRAM)[(addr+i + 13)^3];
v->b = ((wxUint8*)gfx.RDRAM)[(addr+i + 14)^3];
v->r = ((uint8_t*)gfx.RDRAM)[(addr+i + 12)^3];
v->g = ((uint8_t*)gfx.RDRAM)[(addr+i + 13)^3];
v->b = ((uint8_t*)gfx.RDRAM)[(addr+i + 14)^3];
}
#ifdef EXTREME_LOGGING
FRDP ("v%d - x: %f, y: %f, z: %f, w: %f, u: %f, v: %f, f: %f, z_w: %f, r=%d, g=%d, b=%d, a=%d\n", i>>4, v->x, v->y, v->z, v->w, v->ou*rdp.tiles[rdp.cur_tile].s_scale, v->ov*rdp.tiles[rdp.cur_tile].t_scale, v->f, v->z_w, v->r, v->g, v->b, v->a);
@ -148,7 +148,7 @@ static void rsp_vertex(int v0, int n)
}
}
static void rsp_tri1(VERTEX **v, wxUint16 linew = 0)
static void rsp_tri1(VERTEX **v, uint16_t linew = 0)
{
if (cull_tri(v))
rdp.tri_n ++;
@ -270,12 +270,12 @@ void projection_mul (float m[4][4])
rdp.update |= UPDATE_MULT_MAT;
}
void load_matrix (float m[4][4], wxUint32 addr)
void load_matrix (float m[4][4], uint32_t addr)
{
FRDP ("matrix - addr: %08lx\n", addr);
int x,y; // matrix index
addr >>= 1;
wxUint16 * src = (wxUint16*)gfx.RDRAM;
uint16_t * src = (uint16_t*)gfx.RDRAM;
for (x=0; x<16; x+=4) { // Adding 4 instead of one, just to remove mult. later
for (y=0; y<4; y++) {
m[x>>2][y] = (float)(
@ -294,8 +294,8 @@ static void uc0_matrix()
LRDP("uc0:matrix ");
// Use segment offset to get the address
wxUint32 addr = segoffset(rdp.cmd1) & 0x00FFFFFF;
wxUint8 command = (wxUint8)((rdp.cmd0 >> 16) & 0xFF);
uint32_t addr = segoffset(rdp.cmd1) & 0x00FFFFFF;
uint8_t command = (uint8_t)((rdp.cmd0 >> 16) & 0xFF);
DECLAREALIGN16VAR(m[4][4]);
load_matrix(m, addr);
@ -363,7 +363,7 @@ static void uc0_movemem()
{
LRDP("uc0:movemem ");
wxUint32 i,a;
uint32_t i,a;
// Check the command
switch ((rdp.cmd0 >> 16) & 0xFF)
@ -438,9 +438,9 @@ static void uc0_movemem()
a = segoffset(rdp.cmd1) & 0x00ffffff;
// Get the data
rdp.light[i].r = (float)(((wxUint8*)gfx.RDRAM)[(a+0)^3]) / 255.0f;
rdp.light[i].g = (float)(((wxUint8*)gfx.RDRAM)[(a+1)^3]) / 255.0f;
rdp.light[i].b = (float)(((wxUint8*)gfx.RDRAM)[(a+2)^3]) / 255.0f;
rdp.light[i].r = (float)(((uint8_t*)gfx.RDRAM)[(a+0)^3]) / 255.0f;
rdp.light[i].g = (float)(((uint8_t*)gfx.RDRAM)[(a+1)^3]) / 255.0f;
rdp.light[i].b = (float)(((uint8_t*)gfx.RDRAM)[(a+2)^3]) / 255.0f;
rdp.light[i].a = 1.0f;
// ** Thanks to Icepir8 for pointing this out **
// Lighting must be signed byte instead of byte
@ -462,7 +462,7 @@ static void uc0_movemem()
// do not update the combined matrix!
rdp.update &= ~UPDATE_MULT_MAT;
wxUint32 addr = segoffset(rdp.cmd1) & 0x00FFFFFF;
uint32_t addr = segoffset(rdp.cmd1) & 0x00FFFFFF;
load_matrix(rdp.combined, addr);
addr = rdp.pc[rdp.pc_i] & BMASK;
@ -504,12 +504,12 @@ static void uc0_movemem()
//
static void uc0_displaylist()
{
wxUint32 addr = segoffset(rdp.cmd1) & 0x00FFFFFF;
uint32_t addr = segoffset(rdp.cmd1) & 0x00FFFFFF;
// This fixes partially Gauntlet: Legends
if (addr == rdp.pc[rdp.pc_i] - 8) { LRDP("display list not executed!\n"); return; }
wxUint32 push = (rdp.cmd0 >> 16) & 0xFF; // push the old location?
uint32_t push = (rdp.cmd0 >> 16) & 0xFF; // push the old location?
FRDP("uc0:displaylist: %08lx, push:%s", addr, push?"no":"yes");
FRDP(" (seg %d, offset %08lx)\n", (rdp.cmd1>>24)&0x0F, rdp.cmd1&0x00FFFFFF);
@ -586,15 +586,15 @@ static void uc0_enddl()
static void uc0_culldl()
{
wxUint8 vStart = (wxUint8)((rdp.cmd0 & 0x00FFFFFF) / 40) & 0xF;
wxUint8 vEnd = (wxUint8)(rdp.cmd1 / 40) & 0x0F;
wxUint32 cond = 0;
uint8_t vStart = (uint8_t)((rdp.cmd0 & 0x00FFFFFF) / 40) & 0xF;
uint8_t vEnd = (uint8_t)(rdp.cmd1 / 40) & 0x0F;
uint32_t cond = 0;
VERTEX *v;
FRDP("uc0:culldl start: %d, end: %d\n", vStart, vEnd);
if (vEnd < vStart) return;
for (wxUint16 i=vStart; i<=vEnd; i++)
for (uint16_t i=vStart; i<=vEnd; i++)
{
v = &rdp.vtx[i];
// Check if completely off the screen (quick frustrum clipping for 90 FOV)
@ -621,7 +621,7 @@ static void uc0_popmatrix()
{
LRDP("uc0:popmatrix\n");
wxUint32 param = rdp.cmd1;
uint32_t param = rdp.cmd1;
switch (param)
{
@ -640,7 +640,7 @@ static void uc0_popmatrix()
static void uc6_obj_sprite ();
static void uc0_modifyvtx(wxUint8 where, wxUint16 vtx, wxUint32 val)
static void uc0_modifyvtx(uint8_t where, uint16_t vtx, uint32_t val)
{
VERTEX *v = &rdp.vtx[vtx];
@ -651,10 +651,10 @@ static void uc0_modifyvtx(wxUint8 where, wxUint16 vtx, wxUint32 val)
break;
case 0x10: // RGBA
v->r = (wxUint8)(val >> 24);
v->g = (wxUint8)((val >> 16) & 0xFF);
v->b = (wxUint8)((val >> 8) & 0xFF);
v->a = (wxUint8)(val & 0xFF);
v->r = (uint8_t)(val >> 24);
v->g = (uint8_t)((val >> 16) & 0xFF);
v->b = (uint8_t)((val >> 8) & 0xFF);
v->a = (uint8_t)(val & 0xFF);
v->shade_mod = 0;
FRDP ("RGBA: %d, %d, %d, %d\n", v->r, v->g, v->b, v->a);
@ -773,9 +773,9 @@ static void uc0_moveword()
case 0x0c:
{
wxUint16 val = (wxUint16)((rdp.cmd0 >> 8) & 0xFFFF);
wxUint16 vtx = val / 40;
wxUint8 where = val%40;
uint16_t val = (uint16_t)((rdp.cmd0 >> 8) & 0xFFFF);
uint16_t vtx = val / 40;
uint8_t where = val%40;
uc0_modifyvtx(where, vtx, rdp.cmd1);
FRDP ("uc0:modifyvtx: vtx: %d, where: 0x%02lx, val: %08lx - ", vtx, where, rdp.cmd1);
}
@ -796,13 +796,13 @@ static void uc0_texture()
int tile = (rdp.cmd0 >> 8) & 0x07;
if (tile == 7 && (settings.hacks&hack_Supercross)) tile = 0; //fix for supercross 2000
rdp.mipmap_level = (rdp.cmd0 >> 11) & 0x07;
wxUint32 on = (rdp.cmd0 & 0xFF);
uint32_t on = (rdp.cmd0 & 0xFF);
rdp.cur_tile = tile;
if (on)
{
wxUint16 s = (wxUint16)((rdp.cmd1 >> 16) & 0xFFFF);
wxUint16 t = (wxUint16)(rdp.cmd1 & 0xFFFF);
uint16_t s = (uint16_t)((rdp.cmd1 >> 16) & 0xFFFF);
uint16_t t = (uint16_t)(rdp.cmd1 & 0xFFFF);
TILE *tmp_tile = &rdp.tiles[tile];
tmp_tile->on = 1;
@ -842,7 +842,7 @@ static void uc0_setothermode_h()
len = rdp.cmd0 & 0xFF;
}
wxUint32 mask = 0;
uint32_t mask = 0;
int i = len;
for (; i; i--)
mask = (mask << 1) | 1;
@ -860,7 +860,7 @@ static void uc0_setothermode_h()
if (mask & 0x000000C0) // rgb dither mode
{
wxUint32 dither_mode = (rdp.othermode_h >> 6) & 0x3;
uint32_t dither_mode = (rdp.othermode_h >> 6) & 0x3;
FRDP ("rgb dither mode: %s\n", str_dither[dither_mode]);
}
@ -873,13 +873,13 @@ static void uc0_setothermode_h()
if (mask & 0x0000C000) // tlut mode
{
rdp.tlut_mode = (wxUint8)((rdp.othermode_h & 0x0000C000) >> 14);
rdp.tlut_mode = (uint8_t)((rdp.othermode_h & 0x0000C000) >> 14);
FRDP ("tlut mode: %s\n", str_tlut[rdp.tlut_mode]);
}
if (mask & 0x00300000) // cycle type
{
rdp.cycle_mode = (wxUint8)((rdp.othermode_h & 0x00300000) >> 20);
rdp.cycle_mode = (uint8_t)((rdp.othermode_h & 0x00300000) >> 20);
rdp.update |= UPDATE_ZBUF_ENABLED;
FRDP ("cycletype: %d\n", rdp.cycle_mode);
}
@ -897,7 +897,7 @@ static void uc0_setothermode_h()
FRDP ("Persp_en: %d\n", rdp.Persp_en);
}
wxUint32 unk = mask & 0x0FFC60F0F;
uint32_t unk = mask & 0x0FFC60F0F;
if (unk) // unknown portions, LARGE
{
FRDP ("UNKNOWN PORTIONS: shift: %d, len: %d, unknowns: %08lx\n", shift, len, unk);
@ -921,7 +921,7 @@ static void uc0_setothermode_l()
shift = (rdp.cmd0 >> 8) & 0xFF;
}
wxUint32 mask = 0;
uint32_t mask = 0;
int i = len;
for (; i; i--)
mask = (mask << 1) | 1;
@ -1044,16 +1044,16 @@ static void uc0_cleargeometrymode()
static void uc0_line3d()
{
wxUint32 v0 = ((rdp.cmd1 >> 16) & 0xff) / 10;
wxUint32 v1 = ((rdp.cmd1 >> 8) & 0xff) / 10;
wxUint16 width = (wxUint16)(rdp.cmd1 & 0xFF) + 3;
uint32_t v0 = ((rdp.cmd1 >> 16) & 0xff) / 10;
uint32_t v1 = ((rdp.cmd1 >> 8) & 0xff) / 10;
uint16_t width = (uint16_t)(rdp.cmd1 & 0xFF) + 3;
VERTEX *v[3] = {
&rdp.vtx[v1],
&rdp.vtx[v0],
&rdp.vtx[v0]
};
wxUint32 cull_mode = (rdp.flags & CULLMASK) >> CULLSHIFT;
uint32_t cull_mode = (rdp.flags & CULLMASK) >> CULLSHIFT;
rdp.flags |= CULLMASK;
rdp.update |= UPDATE_CULL_MODE;
rsp_tri1(v, width);

View File

@ -106,7 +106,7 @@ static void uc1_line3d()
{
if (!settings.force_quad3d && ((rdp.cmd1&0xFF000000) == 0) && ((rdp.cmd0&0x00FFFFFF) == 0))
{
wxUint16 width = (wxUint16)(rdp.cmd1&0xFF) + 3;
uint16_t width = (uint16_t)(rdp.cmd1&0xFF) + 3;
FRDP("uc1:line3d width: %d #%d, #%d - %d, %d\n", width, rdp.tri_n, rdp.tri_n+1,
(rdp.cmd1 >> 17) & 0x7F,
@ -117,7 +117,7 @@ static void uc1_line3d()
&rdp.vtx[(rdp.cmd1 >> 9) & 0x7F],
&rdp.vtx[(rdp.cmd1 >> 9) & 0x7F]
};
wxUint32 cull_mode = (rdp.flags & CULLMASK) >> CULLSHIFT;
uint32_t cull_mode = (rdp.flags & CULLMASK) >> CULLSHIFT;
rdp.flags |= CULLMASK;
rdp.update |= UPDATE_CULL_MODE;
rsp_tri1(v, width);
@ -142,7 +142,7 @@ static void uc1_line3d()
}
}
wxUint32 branch_dl = 0;
uint32_t branch_dl = 0;
static void uc1_rdphalf_1()
{
@ -153,9 +153,9 @@ static void uc1_rdphalf_1()
static void uc1_branch_z()
{
wxUint32 addr = segoffset(branch_dl);
uint32_t addr = segoffset(branch_dl);
FRDP ("uc1:branch_less_z, addr: %08lx\n", addr);
wxUint32 vtx = (rdp.cmd0 & 0xFFF) >> 1;
uint32_t vtx = (rdp.cmd0 & 0xFFF) >> 1;
if( fabs(rdp.vtx[vtx].z) <= (rdp.cmd1/*&0xFFFF*/) )
{
rdp.pc[rdp.pc_i] = addr;

View File

@ -41,7 +41,7 @@ static void calc_point_light (VERTEX *v, float * vpos)
{
float light_intensity = 0.0f;
register float color[3] = {rdp.light[rdp.num_lights].r, rdp.light[rdp.num_lights].g, rdp.light[rdp.num_lights].b};
for (wxUint32 l=0; l<rdp.num_lights; l++)
for (uint32_t l=0; l<rdp.num_lights; l++)
{
if (rdp.light[l].nonblack)
{
@ -75,9 +75,9 @@ static void calc_point_light (VERTEX *v, float * vpos)
if (color[1] > 1.0f) color[1] = 1.0f;
if (color[2] > 1.0f) color[2] = 1.0f;
v->r = (wxUint8)(color[0]*255.0f);
v->g = (wxUint8)(color[1]*255.0f);
v->b = (wxUint8)(color[2]*255.0f);
v->r = (uint8_t)(color[0]*255.0f);
v->g = (uint8_t)(color[1]*255.0f);
v->b = (uint8_t)(color[2]*255.0f);
}
static void uc6_obj_rectangle();
@ -102,14 +102,14 @@ static void uc2_vertex ()
rdp.update ^= UPDATE_LIGHTS;
// Calculate light vectors
for (wxUint32 l=0; l<rdp.num_lights; l++)
for (uint32_t l=0; l<rdp.num_lights; l++)
{
InverseTransformVector(&rdp.light[l].dir_x, rdp.light_vector[l], rdp.model);
NormalizeVector (rdp.light_vector[l]);
}
}
wxUint32 addr = segoffset(rdp.cmd1);
uint32_t addr = segoffset(rdp.cmd1);
int v0, i, n;
float x, y, z;
@ -125,7 +125,7 @@ static void uc2_vertex ()
return;
}
wxUint32 geom_mode = rdp.geom_mode;
uint32_t geom_mode = rdp.geom_mode;
if ((settings.hacks&hack_Fzero) && (rdp.geom_mode & 0x40000))
{
if (((short*)gfx.RDRAM)[(((addr) >> 1) + 4)^1] || ((short*)gfx.RDRAM)[(((addr) >> 1) + 5)^1])
@ -137,11 +137,11 @@ static void uc2_vertex ()
x = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 0)^1];
y = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 1)^1];
z = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 2)^1];
v->flags = ((wxUint16*)gfx.RDRAM)[(((addr+i) >> 1) + 3)^1];
v->flags = ((uint16_t*)gfx.RDRAM)[(((addr+i) >> 1) + 3)^1];
v->ou = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 4)^1];
v->ov = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 5)^1];
v->uv_scaled = 0;
v->a = ((wxUint8*)gfx.RDRAM)[(addr+i + 15)^3];
v->a = ((uint8_t*)gfx.RDRAM)[(addr+i + 15)^3];
v->x = x*rdp.combined[0][0] + y*rdp.combined[1][0] + z*rdp.combined[2][0] + rdp.combined[3][0];
v->y = x*rdp.combined[0][1] + y*rdp.combined[1][1] + z*rdp.combined[2][1] + rdp.combined[3][1];
@ -206,9 +206,9 @@ static void uc2_vertex ()
}
else
{
v->r = ((wxUint8*)gfx.RDRAM)[(addr+i + 12)^3];
v->g = ((wxUint8*)gfx.RDRAM)[(addr+i + 13)^3];
v->b = ((wxUint8*)gfx.RDRAM)[(addr+i + 14)^3];
v->r = ((uint8_t*)gfx.RDRAM)[(addr+i + 12)^3];
v->g = ((uint8_t*)gfx.RDRAM)[(addr+i + 13)^3];
v->b = ((uint8_t*)gfx.RDRAM)[(addr+i + 14)^3];
}
#ifdef EXTREME_LOGGING
FRDP ("v%d - x: %f, y: %f, z: %f, w: %f, u: %f, v: %f, f: %f, z_w: %f, r=%d, g=%d, b=%d, a=%d\n", i>>4, v->x, v->y, v->z, v->w, v->ou*rdp.tiles[rdp.cur_tile].s_scale, v->ov*rdp.tiles[rdp.cur_tile].t_scale, v->f, v->z_w, v->r, v->g, v->b, v->a);
@ -219,8 +219,8 @@ static void uc2_vertex ()
static void uc2_modifyvtx ()
{
wxUint8 where = (wxUint8)((rdp.cmd0 >> 16) & 0xFF);
wxUint16 vtx = (wxUint16)((rdp.cmd0 >> 1) & 0xFFFF);
uint8_t where = (uint8_t)((rdp.cmd0 >> 16) & 0xFF);
uint16_t vtx = (uint16_t)((rdp.cmd0 >> 1) & 0xFFFF);
FRDP ("uc2:modifyvtx: vtx: %d, where: 0x%02lx, val: %08lx - ", vtx, where, rdp.cmd1);
uc0_modifyvtx(where, vtx, rdp.cmd1);
@ -228,13 +228,13 @@ static void uc2_modifyvtx ()
static void uc2_culldl ()
{
wxUint16 vStart = (wxUint16)(rdp.cmd0 & 0xFFFF) >> 1;
wxUint16 vEnd = (wxUint16)(rdp.cmd1 & 0xFFFF) >> 1;
wxUint32 cond = 0;
uint16_t vStart = (uint16_t)(rdp.cmd0 & 0xFFFF) >> 1;
uint16_t vEnd = (uint16_t)(rdp.cmd1 & 0xFFFF) >> 1;
uint32_t cond = 0;
FRDP ("uc2:culldl start: %d, end: %d\n", vStart, vEnd);
if (vEnd < vStart) return;
for (wxUint16 i=vStart; i<=vEnd; i++)
for (uint16_t i=vStart; i<=vEnd; i++)
{
/*
VERTEX v = &rdp.vtx[i];
@ -303,7 +303,7 @@ static void uc2_quad ()
{
if ((rdp.cmd0 & 0x00FFFFFF) == 0x2F)
{
wxUint32 command = rdp.cmd0>>24;
uint32_t command = rdp.cmd0>>24;
if (command == 0x6)
{
uc6_obj_ldtx_sprite ();
@ -361,8 +361,8 @@ static void uc2_line3d ()
&rdp.vtx[(rdp.cmd0 >> 9) & 0x7F],
&rdp.vtx[(rdp.cmd0 >> 9) & 0x7F]
};
wxUint16 width = (wxUint16)(rdp.cmd0 + 3)&0xFF;
wxUint32 cull_mode = (rdp.flags & CULLMASK) >> CULLSHIFT;
uint16_t width = (uint16_t)(rdp.cmd0 + 3)&0xFF;
uint32_t cull_mode = (rdp.flags & CULLMASK) >> CULLSHIFT;
rdp.flags |= CULLMASK;
rdp.update |= UPDATE_CULL_MODE;
rsp_tri1(v, width);
@ -398,10 +398,10 @@ static void uc2_pop_matrix ()
static void uc2_geom_mode ()
{
// Switch around some things
wxUint32 clr_mode = (rdp.cmd0 & 0x00DFC9FF) |
uint32_t clr_mode = (rdp.cmd0 & 0x00DFC9FF) |
((rdp.cmd0 & 0x00000600) << 3) |
((rdp.cmd0 & 0x00200000) >> 12) | 0xFF000000;
wxUint32 set_mode = (rdp.cmd1 & 0xFFDFC9FF) |
uint32_t set_mode = (rdp.cmd1 & 0xFFDFC9FF) |
((rdp.cmd1 & 0x00000600) << 3) |
((rdp.cmd1 & 0x00200000) >> 12);
@ -495,7 +495,7 @@ static void uc2_matrix ()
DECLAREALIGN16VAR(m[4][4]);
load_matrix(m, segoffset(rdp.cmd1));
wxUint8 command = (wxUint8)((rdp.cmd0 ^ 1) & 0xFF);
uint8_t command = (uint8_t)((rdp.cmd0 ^ 1) & 0xFF);
switch (command)
{
case 0: // modelview mul nopush
@ -553,9 +553,9 @@ static void uc2_matrix ()
static void uc2_moveword ()
{
wxUint8 index = (wxUint8)((rdp.cmd0 >> 16) & 0xFF);
wxUint16 offset = (wxUint16)(rdp.cmd0 & 0xFFFF);
wxUint32 data = rdp.cmd1;
uint8_t index = (uint8_t)((rdp.cmd0 >> 16) & 0xFF);
uint16_t offset = (uint16_t)(rdp.cmd0 & 0xFFFF);
uint32_t data = rdp.cmd1;
FRDP ("uc2:moveword ");
@ -670,7 +670,7 @@ static void uc6_obj_movemem ();
static void uc2_movemem ()
{
int idx = rdp.cmd0 & 0xFF;
wxUint32 addr = segoffset(rdp.cmd1);
uint32_t addr = segoffset(rdp.cmd1);
int ofs = (rdp.cmd0 >> 5) & 0x7F8;
FRDP ("uc2:movemem ofs:%d ", ofs);
@ -684,7 +684,7 @@ static void uc2_movemem ()
case 8: // VIEWPORT
{
wxUint32 a = addr >> 1;
uint32_t a = addr >> 1;
short scale_x = ((short*)gfx.RDRAM)[(a+0)^1] >> 2;
short scale_y = ((short*)gfx.RDRAM)[(a+1)^1] >> 2;
short scale_z = ((short*)gfx.RDRAM)[(a+2)^1];
@ -730,7 +730,7 @@ static void uc2_movemem ()
if (n > 7) return;
// Get the data
wxUint8 col = gfx.RDRAM[(addr+0)^3];
uint8_t col = gfx.RDRAM[(addr+0)^3];
rdp.light[n].r = (float)col / 255.0f;
rdp.light[n].nonblack = col;
col = gfx.RDRAM[(addr+1)^3];
@ -745,7 +745,7 @@ static void uc2_movemem ()
rdp.light[n].dir_x = (float)(((char*)gfx.RDRAM)[(addr+8)^3]) / 127.0f;
rdp.light[n].dir_y = (float)(((char*)gfx.RDRAM)[(addr+9)^3]) / 127.0f;
rdp.light[n].dir_z = (float)(((char*)gfx.RDRAM)[(addr+10)^3]) / 127.0f;
wxUint32 a = addr >> 1;
uint32_t a = addr >> 1;
rdp.light[n].x = (float)(((short*)gfx.RDRAM)[(a+4)^1]);
rdp.light[n].y = (float)(((short*)gfx.RDRAM)[(a+5)^1]);
rdp.light[n].z = (float)(((short*)gfx.RDRAM)[(a+6)^1]);
@ -795,7 +795,7 @@ static void uc2_rdphalf_2 ()
static void uc2_dlist_cnt ()
{
wxUint32 addr = segoffset(rdp.cmd1) & BMASK;
uint32_t addr = segoffset(rdp.cmd1) & BMASK;
int count = rdp.cmd0 & 0x000000FF;
FRDP ("dl_count - addr: %08lx, count: %d\n", addr, count);
if (addr == 0)

View File

@ -44,7 +44,7 @@
static void uc3_vertex()
{
int v0 = ((rdp.cmd0 >> 16) & 0xFF)/5; // Current vertex
int n = (wxUint16)((rdp.cmd0&0xFFFF) + 1)/0x210; // Number to copy
int n = (uint16_t)((rdp.cmd0&0xFFFF) + 1)/0x210; // Number to copy
if (v0 >= 32)
v0 = 31;

View File

@ -40,8 +40,8 @@
int cur_mtx = 0;
int billboarding = 0;
int vtx_last = 0;
wxUint32 dma_offset_mtx = 0;
wxUint32 dma_offset_vtx = 0;
uint32_t dma_offset_mtx = 0;
uint32_t dma_offset_vtx = 0;
static void uc5_dma_offsets ()
{
@ -54,19 +54,19 @@ static void uc5_dma_offsets ()
static void uc5_matrix ()
{
// Use segment offset to get the address
wxUint32 addr = dma_offset_mtx + (segoffset(rdp.cmd1) & BMASK);
uint32_t addr = dma_offset_mtx + (segoffset(rdp.cmd1) & BMASK);
wxUint8 n = (wxUint8)((rdp.cmd0 >> 16) & 0xF);
wxUint8 multiply;
uint8_t n = (uint8_t)((rdp.cmd0 >> 16) & 0xF);
uint8_t multiply;
if (n == 0) //DKR
{
n = (wxUint8)((rdp.cmd0 >> 22) & 0x3);
n = (uint8_t)((rdp.cmd0 >> 22) & 0x3);
multiply = 0;
}
else //JF
{
multiply = (wxUint8)((rdp.cmd0 >> 23) & 0x1);
multiply = (uint8_t)((rdp.cmd0 >> 23) & 0x1);
}
cur_mtx = n;
@ -106,7 +106,7 @@ static void uc5_matrix ()
static void uc5_vertex ()
{
wxUint32 addr = dma_offset_vtx + (segoffset(rdp.cmd1) & BMASK);
uint32_t addr = dma_offset_vtx + (segoffset(rdp.cmd1) & BMASK);
// | cccc cccc 1111 1??? 0000 0002 2222 2222 | cmd1 = address |
// c = vtx command
@ -173,10 +173,10 @@ static void uc5_vertex ()
if (v->w < 0.1f) v->scr_off |= 16;
if (fabs(v->z_w) > 1.0) v->scr_off |= 32;
v->r = ((wxUint8*)gfx.RDRAM)[(addr+start + 6)^3];
v->g = ((wxUint8*)gfx.RDRAM)[(addr+start + 7)^3];
v->b = ((wxUint8*)gfx.RDRAM)[(addr+start + 8)^3];
v->a = ((wxUint8*)gfx.RDRAM)[(addr+start + 9)^3];
v->r = ((uint8_t*)gfx.RDRAM)[(addr+start + 6)^3];
v->g = ((uint8_t*)gfx.RDRAM)[(addr+start + 7)^3];
v->b = ((uint8_t*)gfx.RDRAM)[(addr+start + 8)^3];
v->a = ((uint8_t*)gfx.RDRAM)[(addr+start + 9)^3];
CalculateFog (v);
#ifdef EXTREME_LOGGING
@ -199,7 +199,7 @@ static void uc5_tridma ()
// 2 = method #2 of getting count
// 0 = unused
wxUint32 addr = segoffset(rdp.cmd1) & BMASK;
uint32_t addr = segoffset(rdp.cmd1) & BMASK;
int num = (rdp.cmd0 & 0xFFF0) >> 4;
//int num = ((rdp.cmd0 & 0x00F00000) >> 20) + 1; // same thing!
FRDP("uc5:tridma #%d - addr: %08lx, count: %d\n", rdp.tri_n, addr, num);
@ -264,7 +264,7 @@ static void uc5_tridma ()
static void uc5_dl_in_mem ()
{
wxUint32 addr = segoffset(rdp.cmd1) & BMASK;
uint32_t addr = segoffset(rdp.cmd1) & BMASK;
int count = (rdp.cmd0 & 0x00FF0000) >> 16;
FRDP ("uc5:dl_in_mem - addr: %08lx, count: %d\n", addr, count);

View File

@ -118,18 +118,18 @@ void uc6_sprite2d ();
typedef struct DRAWIMAGE_t {
float frameX;
float frameY;
wxUint16 frameW;
wxUint16 frameH;
wxUint16 imageX;
wxUint16 imageY;
wxUint16 imageW;
wxUint16 imageH;
wxUint32 imagePtr;
wxUint8 imageFmt;
wxUint8 imageSiz;
wxUint16 imagePal;
wxUint8 flipX;
wxUint8 flipY;
uint16_t frameW;
uint16_t frameH;
uint16_t imageX;
uint16_t imageY;
uint16_t imageW;
uint16_t imageH;
uint32_t imagePtr;
uint8_t imageFmt;
uint8_t imageSiz;
uint16_t imagePal;
uint8_t flipX;
uint8_t flipY;
float scaleX;
float scaleY;
} DRAWIMAGE;
@ -142,19 +142,19 @@ typedef struct DRAWOBJECT_t {
short imageW;
short imageH;
wxUint16 imageStride;
wxUint16 imageAdrs;
wxUint8 imageFmt;
wxUint8 imageSiz;
wxUint8 imagePal;
wxUint8 imageFlags;
uint16_t imageStride;
uint16_t imageAdrs;
uint8_t imageFmt;
uint8_t imageSiz;
uint8_t imagePal;
uint8_t imageFlags;
} DRAWOBJECT;
void DrawHiresDepthImage(const DRAWIMAGE & d)
{
wxUint16 * src = (wxUint16*)(gfx.RDRAM+d.imagePtr);
wxUint16 image[512*512];
wxUint16 * dst = image;
uint16_t * src = (uint16_t*)(gfx.RDRAM + d.imagePtr);
uint16_t image[512 * 512];
uint16_t * dst = image;
for (int h = 0; h < d.imageH; h++)
{
for (int w = 0; w < d.imageW; w++)
@ -244,10 +244,9 @@ void DrawHiresDepthImage (const DRAWIMAGE & d)
grDepthMask(FXTRUE);
}
void DrawDepthImage(const DRAWIMAGE & d)
{
if (!fullscreen || !fb_depth_render_enabled)
if (!fb_depth_render_enabled)
return;
if (d.imageH > d.imageW)
return;
@ -265,8 +264,8 @@ void DrawDepthImage (const DRAWIMAGE & d)
int src_height = d.imageH;
int dst_width = min(int(src_width*scale_x_dst), (int)settings.scr_res_x);
int dst_height = min(int(src_height*scale_y_dst), (int)settings.scr_res_y);
wxUint16 * src = (wxUint16*)(gfx.RDRAM+d.imagePtr);
wxUint16 * dst = new wxUint16[dst_width*dst_height];
uint16_t * src = (uint16_t*)(gfx.RDRAM + d.imagePtr);
uint16_t * dst = new uint16_t[dst_width*dst_height];
for (int y = 0; y < dst_height; y++)
{
for (int x = 0; x < dst_width; x++)
@ -345,7 +344,7 @@ void DrawImage (DRAWIMAGE & d)
if (rdp.ci_width == 512 && !no_dlist) //RE2
{
wxUint16 width = (wxUint16)(*gfx.VI_WIDTH_REG & 0xFFF);
uint16_t width = (uint16_t)(*gfx.VI_WIDTH_REG & 0xFFF);
d.frameH = d.imageH = (d.frameW*d.frameH) / width;
d.frameW = d.imageW = width;
if (rdp.zimg == rdp.cimg)
@ -370,9 +369,9 @@ void DrawImage (DRAWIMAGE & d)
else
{
if ((d.frameX > 0) && (d.frameW == rdp.ci_width))
d.frameW -= (wxUint16)(2.0f*d.frameX);
d.frameW -= (uint16_t)(2.0f*d.frameX);
if ((d.frameY > 0) && (d.frameH == rdp.ci_height))
d.frameH -= (wxUint16)(2.0f*d.frameY);
d.frameH -= (uint16_t)(2.0f*d.frameY);
}
int ul_u = (int)d.imageX;
@ -411,7 +410,6 @@ void DrawImage (DRAWIMAGE & d)
int min_256_v = ul_v >> y_shift;
//int max_256_v = (lr_v-1) >> y_shift;
// SetTextureImage ()
rdp.timg.format = d.imageFmt; // RGBA
rdp.timg.size = d.imageSiz; // 16-bit
@ -425,7 +423,7 @@ void DrawImage (DRAWIMAGE & d)
tile->size = d.imageSiz; // 16-bit
tile->line = line;
tile->t_mem = 0;
tile->palette = (wxUint8)d.imagePal;
tile->palette = (uint8_t)d.imagePal;
tile->clamp_t = 1;
tile->mirror_t = 0;
tile->mask_t = 0;
@ -444,16 +442,13 @@ void DrawImage (DRAWIMAGE & d)
if (rdp.cycle_mode == 2)
rdp.allow_combine = 0;
if (fullscreen)
{
if (rdp.ci_width == 512 && !no_dlist)
grClipWindow(0, 0, settings.scr_res_x, settings.scr_res_y);
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, (uint32_t)((d.frameX + d.imageW / d.scaleX + 0.5f)*rdp.scale_x)), min(rdp.scissor.lr_y, (uint32_t)((d.frameY + d.imageH / d.scaleY + 0.5f)*rdp.scale_y)));
rdp.update |= UPDATE_SCISSOR;
}
// Texture ()
rdp.cur_tile = 0;
@ -550,7 +545,6 @@ void DrawImage (DRAWIMAGE & d)
apply_shade_mods(&(v[s]));
ConvertCoordsConvert(v, 4);
if (fullscreen)
grDrawVertexArrayContiguous(GR_TRIANGLE_STRIP, 4, v, sizeof(VERTEX));
if (_debugger.capture)
@ -607,8 +601,6 @@ void DrawImage (DRAWIMAGE & d)
void DrawHiresImage(DRAWIMAGE & d, int screensize = FALSE)
{
if (!fullscreen)
return;
TBUFF_COLOR_IMAGE *tbuff_tex = rdp.tbuff_tex;
if (rdp.motionblur)
rdp.tbuff_tex = &(rdp.texbufs[rdp.cur_tex_buf ^ 1].images[0]);
@ -628,9 +620,9 @@ void DrawHiresImage(DRAWIMAGE & d, int screensize = FALSE)
if (!(settings.hacks&hack_PPL))
{
if ((d.frameX > 0) && (d.frameW == rdp.ci_width))
d.frameW -= (wxUint16)(2.0f*d.frameX);
d.frameW -= (uint16_t)(2.0f*d.frameX);
if ((d.frameY > 0) && (d.frameH == rdp.ci_height))
d.frameH -= (wxUint16)(2.0f*d.frameY);
d.frameH -= (uint16_t)(2.0f*d.frameY);
}
float ul_x, ul_y, ul_u, ul_v, lr_x, lr_y, lr_u, lr_v;
@ -701,12 +693,10 @@ void DrawHiresImage(DRAWIMAGE & d, int screensize = FALSE)
else
rdp.tri_n += 2;
rdp.tbuff_tex = tbuff_tex;
}
//****************************************************************
struct MAT2D {
float A, B, C, D;
float X, Y;
@ -716,24 +706,24 @@ struct MAT2D {
static void uc6_read_background_data(DRAWIMAGE & d, bool bReadScale)
{
wxUint32 addr = segoffset(rdp.cmd1) >> 1;
uint32_t 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.imageX = (((uint16_t *)gfx.RDRAM)[(addr + 0) ^ 1] >> 5); // 0
d.imageW = (((uint16_t *)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.frameW = ((uint16_t *)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.imageY = (((uint16_t *)gfx.RDRAM)[(addr + 4) ^ 1] >> 5); // 4
d.imageH = (((uint16_t *)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.frameH = ((uint16_t *)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;
d.imagePtr = segoffset(((uint32_t*)gfx.RDRAM)[(addr + 8) >> 1]); // 8,9
d.imageFmt = ((uint8_t *)gfx.RDRAM)[(((addr + 11) << 1) + 0) ^ 3]; // 11
d.imageSiz = ((uint8_t *)gfx.RDRAM)[(((addr + 11) << 1) + 1) ^ 3]; // |
d.imagePal = ((uint16_t *)gfx.RDRAM)[(addr + 12) ^ 1]; // 12
uint16_t imageFlip = ((uint16_t *)gfx.RDRAM)[(addr + 13) ^ 1]; // 13;
d.flipX = (uint8_t)imageFlip & 0x01;
if (bReadScale)
{
@ -851,10 +841,10 @@ static void draw_split_triangle(VERTEX **vtx)
rdp.vtxbuf[index].u0 = 0.5f;
rdp.vtxbuf[index].v0 = v1->v0 + (v2->v0 - v1->v0) * percent +
rdp.cur_cache[0]->c_scl_y * cur_256 * rdp.cur_cache[0]->splitheight;
rdp.vtxbuf[index].b = (wxUint8)(v1->b + (v2->b - v1->b) * percent);
rdp.vtxbuf[index].g = (wxUint8)(v1->g + (v2->g - v1->g) * percent);
rdp.vtxbuf[index].r = (wxUint8)(v1->r + (v2->r - v1->r) * percent);
rdp.vtxbuf[index++].a = (wxUint8)(v1->a + (v2->a - v1->a) * percent);
rdp.vtxbuf[index].b = (uint8_t)(v1->b + (v2->b - v1->b) * percent);
rdp.vtxbuf[index].g = (uint8_t)(v1->g + (v2->g - v1->g) * percent);
rdp.vtxbuf[index].r = (uint8_t)(v1->r + (v2->r - v1->r) * percent);
rdp.vtxbuf[index++].a = (uint8_t)(v1->a + (v2->a - v1->a) * percent);
}
}
else
@ -870,10 +860,10 @@ static void draw_split_triangle(VERTEX **vtx)
rdp.vtxbuf[index].u0 = 0.5f;
rdp.vtxbuf[index].v0 = v2->v0 + (v1->v0 - v2->v0) * percent +
rdp.cur_cache[0]->c_scl_y * cur_256 * rdp.cur_cache[0]->splitheight;
rdp.vtxbuf[index].b = (wxUint8)(v2->b + (v1->b - v2->b) * percent);
rdp.vtxbuf[index].g = (wxUint8)(v2->g + (v1->g - v2->g) * percent);
rdp.vtxbuf[index].r = (wxUint8)(v2->r + (v1->r - v2->r) * percent);
rdp.vtxbuf[index++].a = (wxUint8)(v2->a + (v1->a - v2->a) * percent);
rdp.vtxbuf[index].b = (uint8_t)(v2->b + (v1->b - v2->b) * percent);
rdp.vtxbuf[index].g = (uint8_t)(v2->g + (v1->g - v2->g) * percent);
rdp.vtxbuf[index].r = (uint8_t)(v2->r + (v1->r - v2->r) * percent);
rdp.vtxbuf[index++].a = (uint8_t)(v2->a + (v1->a - v2->a) * percent);
// Save the in point
rdp.vtxbuf[index] = *v2;
@ -913,10 +903,10 @@ static void draw_split_triangle(VERTEX **vtx)
rdp.vtxbuf[index].q = 1;
rdp.vtxbuf[index].u0 = 255.5f;
rdp.vtxbuf[index].v0 = v1->v0 + (v2->v0 - v1->v0) * percent;
rdp.vtxbuf[index].b = (wxUint8)(v1->b + (v2->b - v1->b) * percent);
rdp.vtxbuf[index].g = (wxUint8)(v1->g + (v2->g - v1->g) * percent);
rdp.vtxbuf[index].r = (wxUint8)(v1->r + (v2->r - v1->r) * percent);
rdp.vtxbuf[index++].a = (wxUint8)(v1->a + (v2->a - v1->a) * percent);
rdp.vtxbuf[index].b = (uint8_t)(v1->b + (v2->b - v1->b) * percent);
rdp.vtxbuf[index].g = (uint8_t)(v1->g + (v2->g - v1->g) * percent);
rdp.vtxbuf[index].r = (uint8_t)(v1->r + (v2->r - v1->r) * percent);
rdp.vtxbuf[index++].a = (uint8_t)(v1->a + (v2->a - v1->a) * percent);
}
}
else
@ -931,10 +921,10 @@ static void draw_split_triangle(VERTEX **vtx)
rdp.vtxbuf[index].q = 1;
rdp.vtxbuf[index].u0 = 255.5f;
rdp.vtxbuf[index].v0 = v2->v0 + (v1->v0 - v2->v0) * percent;
rdp.vtxbuf[index].b = (wxUint8)(v2->b + (v1->b - v2->b) * percent);
rdp.vtxbuf[index].g = (wxUint8)(v2->g + (v1->g - v2->g) * percent);
rdp.vtxbuf[index].r = (wxUint8)(v2->r + (v1->r - v2->r) * percent);
rdp.vtxbuf[index++].a = (wxUint8)(v2->a + (v1->a - v2->a) * percent);
rdp.vtxbuf[index].b = (uint8_t)(v2->b + (v1->b - v2->b) * percent);
rdp.vtxbuf[index].g = (uint8_t)(v2->g + (v1->g - v2->g) * percent);
rdp.vtxbuf[index].r = (uint8_t)(v2->r + (v1->r - v2->r) * percent);
rdp.vtxbuf[index++].a = (uint8_t)(v2->a + (v1->a - v2->a) * percent);
// Save the in point
rdp.vtxbuf[index++] = *v2;
@ -989,7 +979,7 @@ static void uc6_draw_polygons (VERTEX v[4])
}
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_VIEWPORT;
if (fullscreen && settings.fog && (rdp.flags & FOG_ENABLED))
if (settings.fog && (rdp.flags & FOG_ENABLED))
{
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
}
@ -997,21 +987,21 @@ static void uc6_draw_polygons (VERTEX v[4])
static void uc6_read_object_data(DRAWOBJECT & d)
{
wxUint32 addr = segoffset(rdp.cmd1) >> 1;
uint32_t 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.scaleW = ((uint16_t *)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.scaleH = ((uint16_t *)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]; // |
d.imageStride = ((uint16_t *)gfx.RDRAM)[(addr + 8) ^ 1]; // 8
d.imageAdrs = ((uint16_t *)gfx.RDRAM)[(addr + 9) ^ 1]; // 9
d.imageFmt = ((uint8_t *)gfx.RDRAM)[(((addr + 10) << 1) + 0) ^ 3]; // 10
d.imageSiz = ((uint8_t *)gfx.RDRAM)[(((addr + 10) << 1) + 1) ^ 3]; // |
d.imagePal = ((uint8_t *)gfx.RDRAM)[(((addr + 10) << 1) + 2) ^ 3]; // 11
d.imageFlags = ((uint8_t *)gfx.RDRAM)[(((addr + 10) << 1) + 3) ^ 3]; // |
if (d.imageW < 0)
d.imageW = (short)rdp.scissor_o.lr_x - (short)d.objX - d.imageW;
@ -1185,7 +1175,7 @@ static void uc6_obj_movemem ()
LRDP("uc6:obj_movemem\n");
int index = rdp.cmd0 & 0xFFFF;
wxUint32 addr = segoffset(rdp.cmd1) >> 1;
uint32_t addr = segoffset(rdp.cmd1) >> 1;
if (index == 0) { // movemem matrix
mat_2d.A = ((int*)gfx.RDRAM)[(addr + 0) >> 1] / 65536.0f;
@ -1194,8 +1184,8 @@ static void uc6_obj_movemem ()
mat_2d.D = ((int*)gfx.RDRAM)[(addr + 6) >> 1] / 65536.0f;
mat_2d.X = ((short*)gfx.RDRAM)[(addr + 8) ^ 1] / 4.0f;
mat_2d.Y = ((short*)gfx.RDRAM)[(addr + 9) ^ 1] / 4.0f;
mat_2d.BaseScaleX = ((wxUint16*)gfx.RDRAM)[(addr+10)^1] / 1024.0f;
mat_2d.BaseScaleY = ((wxUint16*)gfx.RDRAM)[(addr+11)^1] / 1024.0f;
mat_2d.BaseScaleX = ((uint16_t*)gfx.RDRAM)[(addr + 10) ^ 1] / 1024.0f;
mat_2d.BaseScaleY = ((uint16_t*)gfx.RDRAM)[(addr + 11) ^ 1] / 1024.0f;
FRDP("mat_2d\nA: %f, B: %f, c: %f, D: %f\nX: %f, Y: %f\nBaseScaleX: %f, BaseScaleY: %f\n",
mat_2d.A, mat_2d.B, mat_2d.C, mat_2d.D, mat_2d.X, mat_2d.Y, mat_2d.BaseScaleX, mat_2d.BaseScaleY);
@ -1203,8 +1193,8 @@ static void uc6_obj_movemem ()
else if (index == 2) { // movemem submatrix
mat_2d.X = ((short*)gfx.RDRAM)[(addr + 0) ^ 1] / 4.0f;
mat_2d.Y = ((short*)gfx.RDRAM)[(addr + 1) ^ 1] / 4.0f;
mat_2d.BaseScaleX = ((wxUint16*)gfx.RDRAM)[(addr+2)^1] / 1024.0f;
mat_2d.BaseScaleY = ((wxUint16*)gfx.RDRAM)[(addr+3)^1] / 1024.0f;
mat_2d.BaseScaleX = ((uint16_t*)gfx.RDRAM)[(addr + 2) ^ 1] / 1024.0f;
mat_2d.BaseScaleY = ((uint16_t*)gfx.RDRAM)[(addr + 3) ^ 1] / 1024.0f;
FRDP("submatrix\nX: %f, Y: %f\nBaseScaleX: %f, BaseScaleY: %f\n",
mat_2d.X, mat_2d.Y, mat_2d.BaseScaleX, mat_2d.BaseScaleY);
@ -1223,7 +1213,7 @@ static void uc6_obj_rendermode ()
RDP_E("uc6:obj_rendermode\n");
}
static wxUint16 uc6_yuv_to_rgba(wxUint8 y, wxUint8 u, wxUint8 v)
static uint16_t uc6_yuv_to_rgba(uint8_t y, uint8_t u, uint8_t v)
{
float r = y + (1.370705f * (v - 128));
float g = y - (0.698001f * (v - 128)) - (0.337633f * (u - 128));
@ -1239,41 +1229,41 @@ static wxUint16 uc6_yuv_to_rgba(wxUint8 y, wxUint8 u, wxUint8 v)
if (g < 0) g = 0;
if (b < 0) b = 0;
wxUint16 c = (wxUint16)(((wxUint16)(r) << 11) |
((wxUint16)(g) << 6) |
((wxUint16)(b) << 1) | 1);
uint16_t c = (uint16_t)(((uint16_t)(r) << 11) |
((uint16_t)(g) << 6) |
((uint16_t)(b) << 1) | 1);
return c;
}
static void uc6_DrawYUVImageToFrameBuffer(wxUint16 ul_x, wxUint16 ul_y, wxUint16 lr_x, wxUint16 lr_y)
static void uc6_DrawYUVImageToFrameBuffer(uint16_t ul_x, uint16_t ul_y, uint16_t lr_x, uint16_t lr_y)
{
FRDP("uc6:DrawYUVImageToFrameBuffer ul_x%d, ul_y%d, lr_x%d, lr_y%d\n", ul_x, ul_y, lr_x, lr_y);
wxUint32 ci_width = rdp.ci_width;
wxUint32 ci_height = rdp.ci_lower_bound;
uint32_t ci_width = rdp.ci_width;
uint32_t ci_height = rdp.ci_lower_bound;
if (ul_x >= ci_width)
return;
if (ul_y >= ci_height)
return;
wxUint32 width = 16, height = 16;
uint32_t width = 16, height = 16;
if (lr_x > ci_width)
width = ci_width - ul_x;
if (lr_y > ci_height)
height = ci_height - ul_y;
wxUint32 * mb = (wxUint32*)(gfx.RDRAM+rdp.timg.addr); //pointer to the first macro block
wxUint16 * dst = (wxUint16*)(gfx.RDRAM+rdp.cimg);
uint32_t * mb = (uint32_t*)(gfx.RDRAM + rdp.timg.addr); //pointer to the first macro block
uint16_t * dst = (uint16_t*)(gfx.RDRAM + rdp.cimg);
dst += ul_x + ul_y * ci_width;
//yuv macro block contains 16x16 texture. we need to put it in the proper place inside cimg
for (wxUint16 h = 0; h < 16; h++)
for (uint16_t h = 0; h < 16; h++)
{
for (wxUint16 w = 0; w < 16; w+=2)
for (uint16_t w = 0; w < 16; w += 2)
{
wxUint32 t = *(mb++); //each wxUint32 contains 2 pixels
uint32_t t = *(mb++); //each uint32_t contains 2 pixels
if ((h < height) && (w < width)) //clipping. texture image may be larger than color image
{
wxUint8 y0 = (wxUint8)t&0xFF;
wxUint8 v = (wxUint8)(t>>8)&0xFF;
wxUint8 y1 = (wxUint8)(t>>16)&0xFF;
wxUint8 u = (wxUint8)(t>>24)&0xFF;
uint8_t y0 = (uint8_t)t & 0xFF;
uint8_t v = (uint8_t)(t >> 8) & 0xFF;
uint8_t y1 = (uint8_t)(t >> 16) & 0xFF;
uint8_t u = (uint8_t)(t >> 24) & 0xFF;
*(dst++) = uc6_yuv_to_rgba(y0, u, v);
*(dst++) = uc6_yuv_to_rgba(y1, u, v);
}
@ -1294,7 +1284,7 @@ static void uc6_obj_rectangle_r ()
float lr_x = (d.objX + d.imageW / d.scaleW) / mat_2d.BaseScaleX + mat_2d.X;
float ul_y = d.objY / mat_2d.BaseScaleY + mat_2d.Y;
float lr_y = (d.objY + d.imageH / d.scaleH) / mat_2d.BaseScaleY + mat_2d.Y;
uc6_DrawYUVImageToFrameBuffer((wxUint16)ul_x, (wxUint16)ul_y, (wxUint16)lr_x, (wxUint16)lr_y);
uc6_DrawYUVImageToFrameBuffer((uint16_t)ul_x, (uint16_t)ul_y, (uint16_t)lr_x, (uint16_t)lr_y);
rdp.tri_n += 2;
return;
}
@ -1359,22 +1349,22 @@ static void uc6_obj_loadtxtr ()
rdp.s2dex_tex_loaded = TRUE;
rdp.update |= UPDATE_TEXTURE;
wxUint32 addr = segoffset(rdp.cmd1) >> 1;
wxUint32 type = ((wxUint32*)gfx.RDRAM)[(addr + 0) >> 1]; // 0, 1
uint32_t addr = segoffset(rdp.cmd1) >> 1;
uint32_t type = ((uint32_t*)gfx.RDRAM)[(addr + 0) >> 1]; // 0, 1
if (type == 0x00000030) { // TLUT
wxUint32 image = segoffset(((wxUint32*)gfx.RDRAM)[(addr + 2) >> 1]); // 2, 3
wxUint16 phead = ((wxUint16 *)gfx.RDRAM)[(addr + 4) ^ 1] - 256; // 4
wxUint16 pnum = ((wxUint16 *)gfx.RDRAM)[(addr + 5) ^ 1] + 1; // 5
uint32_t image = segoffset(((uint32_t*)gfx.RDRAM)[(addr + 2) >> 1]); // 2, 3
uint16_t phead = ((uint16_t *)gfx.RDRAM)[(addr + 4) ^ 1] - 256; // 4
uint16_t pnum = ((uint16_t *)gfx.RDRAM)[(addr + 5) ^ 1] + 1; // 5
FRDP("palette addr: %08lx, start: %d, num: %d\n", image, phead, pnum);
load_palette(image, phead, pnum);
}
else if (type == 0x00001033) { // TxtrBlock
wxUint32 image = segoffset(((wxUint32*)gfx.RDRAM)[(addr + 2) >> 1]); // 2, 3
wxUint16 tmem = ((wxUint16 *)gfx.RDRAM)[(addr + 4) ^ 1]; // 4
wxUint16 tsize = ((wxUint16 *)gfx.RDRAM)[(addr + 5) ^ 1]; // 5
wxUint16 tline = ((wxUint16 *)gfx.RDRAM)[(addr + 6) ^ 1]; // 6
uint32_t image = segoffset(((uint32_t*)gfx.RDRAM)[(addr + 2) >> 1]); // 2, 3
uint16_t tmem = ((uint16_t *)gfx.RDRAM)[(addr + 4) ^ 1]; // 4
uint16_t tsize = ((uint16_t *)gfx.RDRAM)[(addr + 5) ^ 1]; // 5
uint16_t tline = ((uint16_t *)gfx.RDRAM)[(addr + 6) ^ 1]; // 6
FRDP("addr: %08lx, tmem: %08lx, size: %d\n", image, tmem, tsize);
rdp.timg.addr = image;
@ -1389,10 +1379,10 @@ static void uc6_obj_loadtxtr ()
}
else if (type == 0x00fc1034)
{
wxUint32 image = segoffset(((wxUint32*)gfx.RDRAM)[(addr + 2) >> 1]); // 2, 3
wxUint16 tmem = ((wxUint16 *)gfx.RDRAM)[(addr + 4) ^ 1]; // 4
wxUint16 twidth = ((wxUint16 *)gfx.RDRAM)[(addr + 5) ^ 1]; // 5
wxUint16 theight = ((wxUint16 *)gfx.RDRAM)[(addr + 6) ^ 1]; // 6
uint32_t image = segoffset(((uint32_t*)gfx.RDRAM)[(addr + 2) >> 1]); // 2, 3
uint16_t tmem = ((uint16_t *)gfx.RDRAM)[(addr + 4) ^ 1]; // 4
uint16_t twidth = ((uint16_t *)gfx.RDRAM)[(addr + 5) ^ 1]; // 5
uint16_t theight = ((uint16_t *)gfx.RDRAM)[(addr + 6) ^ 1]; // 6
FRDP("tile addr: %08lx, tmem: %08lx, twidth: %d, theight: %d\n", image, tmem, twidth, theight);
@ -1422,7 +1412,7 @@ static void uc6_obj_ldtx_sprite ()
{
LRDP("uc6:obj_ldtx_sprite\n");
wxUint32 addr = rdp.cmd1;
uint32_t addr = rdp.cmd1;
uc6_obj_loadtxtr();
rdp.cmd1 = addr + 24;
uc6_obj_sprite();
@ -1432,7 +1422,7 @@ static void uc6_obj_ldtx_rect ()
{
LRDP("uc6:obj_ldtx_rect\n");
wxUint32 addr = rdp.cmd1;
uint32_t addr = rdp.cmd1;
uc6_obj_loadtxtr();
rdp.cmd1 = addr + 24;
uc6_obj_rectangle();
@ -1442,7 +1432,7 @@ static void uc6_ldtx_rect_r ()
{
LRDP("uc6:ldtx_rect_r\n");
wxUint32 addr = rdp.cmd1;
uint32_t addr = rdp.cmd1;
uc6_obj_loadtxtr();
rdp.cmd1 = addr + 24;
uc6_obj_rectangle_r();
@ -1454,8 +1444,8 @@ static void uc6_loaducode ()
RDP_E("uc6:load_ucode\n");
// copy the microcode data
wxUint32 addr = segoffset(rdp.cmd1);
wxUint32 size = (rdp.cmd0 & 0xFFFF) + 1;
uint32_t addr = segoffset(rdp.cmd1);
uint32_t size = (rdp.cmd0 & 0xFFFF) + 1;
memcpy(microcode, gfx.RDRAM + addr, size);
microcheck();
@ -1463,25 +1453,25 @@ static void uc6_loaducode ()
void uc6_sprite2d()
{
wxUint32 a = rdp.pc[rdp.pc_i] & BMASK;
wxUint32 cmd0 = ((wxUint32*)gfx.RDRAM)[a>>2]; //check next command
uint32_t a = rdp.pc[rdp.pc_i] & BMASK;
uint32_t cmd0 = ((uint32_t*)gfx.RDRAM)[a >> 2]; //check next command
if ((cmd0 >> 24) != 0xBE)
return;
FRDP("uc6:uc6_sprite2d #%d, #%d\n", rdp.tri_n, rdp.tri_n + 1);
wxUint32 addr = segoffset(rdp.cmd1) >> 1;
uint32_t addr = segoffset(rdp.cmd1) >> 1;
DRAWIMAGE d;
d.imagePtr = segoffset(((wxUint32*)gfx.RDRAM)[(addr+0)>>1]); // 0,1
wxUint16 stride = (((wxUint16 *)gfx.RDRAM)[(addr+4)^1]); // 4
d.imageW = (((wxUint16 *)gfx.RDRAM)[(addr+5)^1]); // 5
d.imageH = (((wxUint16 *)gfx.RDRAM)[(addr+6)^1]); // 6
d.imageFmt = ((wxUint8 *)gfx.RDRAM)[(((addr+7)<<1)+0)^3]; // 7
d.imageSiz = ((wxUint8 *)gfx.RDRAM)[(((addr+7)<<1)+1)^3]; // |
d.imagePtr = segoffset(((uint32_t*)gfx.RDRAM)[(addr + 0) >> 1]); // 0,1
uint16_t stride = (((uint16_t *)gfx.RDRAM)[(addr + 4) ^ 1]); // 4
d.imageW = (((uint16_t *)gfx.RDRAM)[(addr + 5) ^ 1]); // 5
d.imageH = (((uint16_t *)gfx.RDRAM)[(addr + 6) ^ 1]); // 6
d.imageFmt = ((uint8_t *)gfx.RDRAM)[(((addr + 7) << 1) + 0) ^ 3]; // 7
d.imageSiz = ((uint8_t *)gfx.RDRAM)[(((addr + 7) << 1) + 1) ^ 3]; // |
d.imagePal = 0;
d.imageX = (((wxUint16 *)gfx.RDRAM)[(addr+8)^1]); // 8
d.imageY = (((wxUint16 *)gfx.RDRAM)[(addr+9)^1]); // 9
wxUint32 tlut = ((wxUint32*)gfx.RDRAM)[(addr + 2) >> 1]; // 2, 3
d.imageX = (((uint16_t *)gfx.RDRAM)[(addr + 8) ^ 1]); // 8
d.imageY = (((uint16_t *)gfx.RDRAM)[(addr + 9) ^ 1]); // 9
uint32_t tlut = ((uint32_t*)gfx.RDRAM)[(addr + 2) >> 1]; // 2, 3
//low-level implementation of sprite2d apparently calls setothermode command to set tlut mode
//However, description of sprite2d microcode just says that
//TlutPointer should be Null when CI images will not be used.
@ -1504,12 +1494,12 @@ void uc6_sprite2d ()
if (d.imageW == 0)
return;// d.imageW = stride;
cmd0 = ((wxUint32*)gfx.RDRAM)[a>>2]; //check next command
cmd0 = ((uint32_t*)gfx.RDRAM)[a >> 2]; //check next command
while (1)
{
if ((cmd0 >> 24) == 0xBE)
{
wxUint32 cmd1 = ((wxUint32*)gfx.RDRAM)[(a>>2)+1];
uint32_t cmd1 = ((uint32_t*)gfx.RDRAM)[(a >> 2) + 1];
rdp.pc[rdp.pc_i] = (a + 8) & BMASK;
d.scaleX = ((cmd1 >> 16) & 0xFFFF) / 1024.0f;
@ -1518,21 +1508,21 @@ void uc6_sprite2d ()
//need to find, for which game this hack was made
//if( (cmd1&0xFFFF) < 0x100 )
// d.scaleY = d.scaleX;
d.flipX = (wxUint8)((cmd0>>8)&0xFF);
d.flipY = (wxUint8)(cmd0&0xFF);
d.flipX = (uint8_t)((cmd0 >> 8) & 0xFF);
d.flipY = (uint8_t)(cmd0 & 0xFF);
a = rdp.pc[rdp.pc_i] & BMASK;
rdp.pc[rdp.pc_i] = (a + 8) & BMASK;
cmd0 = ((wxUint32*)gfx.RDRAM)[a>>2]; //check next command
cmd0 = ((uint32_t*)gfx.RDRAM)[a >> 2]; //check next command
}
if ((cmd0 >> 24) == 0xBD)
{
wxUint32 cmd1 = ((wxUint32*)gfx.RDRAM)[(a>>2)+1];
uint32_t cmd1 = ((uint32_t*)gfx.RDRAM)[(a >> 2) + 1];
d.frameX = ((short)((cmd1 >> 16) & 0xFFFF)) / 4.0f;
d.frameY = ((short)(cmd1 & 0xFFFF)) / 4.0f;
d.frameW = (wxUint16) (d.imageW / d.scaleX);
d.frameH = (wxUint16) (d.imageH / d.scaleY);
d.frameW = (uint16_t)(d.imageW / d.scaleX);
d.frameH = (uint16_t)(d.imageH / d.scaleY);
if (settings.hacks&hack_WCWnitro)
{
int scaleY = (int)d.scaleY;
@ -1552,8 +1542,8 @@ void uc6_sprite2d ()
return;
}
const wxUint32 texsize = (d.imageW * d.imageH) << d.imageSiz >> 1;
const wxUint32 maxTexSize = rdp.tlut_mode < 2 ? 4096 : 2048;
const uint32_t texsize = (d.imageW * d.imageH) << d.imageSiz >> 1;
const uint32_t maxTexSize = rdp.tlut_mode < 2 ? 4096 : 2048;
if (texsize > maxTexSize)
{
@ -1565,7 +1555,7 @@ void uc6_sprite2d ()
}
else
{
wxUint16 line = d.imageW;
uint16_t line = d.imageW;
if (line & 7) line += 8; // round up
line >>= 3;
if (d.imageSiz == 0)
@ -1702,14 +1692,13 @@ void uc6_sprite2d ()
}
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_VIEWPORT;
if (fullscreen && settings.fog && (rdp.flags & FOG_ENABLED))
if (settings.fog && (rdp.flags & FOG_ENABLED))
{
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
}
}
a = rdp.pc[rdp.pc_i] & BMASK;
cmd0 = ((wxUint32*)gfx.RDRAM)[a>>2]; //check next command
cmd0 = ((uint32_t*)gfx.RDRAM)[a >> 2]; //check next command
if (((cmd0 >> 24) == 0xBD) || ((cmd0 >> 24) == 0xBE))
rdp.pc[rdp.pc_i] = (a + 8) & BMASK;
else

View File

@ -43,7 +43,7 @@
// Bugs fixed with help from glN64 sources. Thanks, Orkin!
//****************************************************************
wxUint32 pd_col_addr = 0;
uint32_t pd_col_addr = 0;
static void uc7_colorbase ()
{
@ -56,7 +56,7 @@ typedef struct
{
short y;
short x;
wxUint16 idx;
uint16_t idx;
short z;
@ -79,15 +79,15 @@ static void uc7_vertex ()
rdp.update ^= UPDATE_LIGHTS;
// Calculate light vectors
for (wxUint32 l=0; l<rdp.num_lights; l++)
for (uint32_t l=0; l<rdp.num_lights; l++)
{
InverseTransformVector(&rdp.light[l].dir_x, rdp.light_vector[l], rdp.model);
NormalizeVector (rdp.light_vector[l]);
}
}
wxUint32 addr = segoffset(rdp.cmd1);
wxUint32 v0, i, n;
uint32_t addr = segoffset(rdp.cmd1);
uint32_t v0, i, n;
float x, y, z;
rdp.v0 = v0 = (rdp.cmd0 & 0x0F0000) >> 16;
@ -134,7 +134,7 @@ static void uc7_vertex ()
if (v->y > v->w) v->scr_off |= 8;
if (v->w < 0.1f) v->scr_off |= 16;
wxUint8 *color = &gfx.RDRAM[pd_col_addr + (vertex->idx & 0xff)];
uint8_t *color = &gfx.RDRAM[pd_col_addr + (vertex->idx & 0xff)];
v->a = color[0];
CalculateFog (v);

View File

@ -41,7 +41,7 @@
//
//****************************************************************
wxUint32 uc8_normale_addr = 0;
uint32_t uc8_normale_addr = 0;
float uc8_coord_mod[16];
static void uc8_vertex ()
@ -52,7 +52,7 @@ static void uc8_vertex ()
MulMatrices(rdp.model, rdp.proj, rdp.combined);
}
wxUint32 addr = segoffset(rdp.cmd1);
uint32_t addr = segoffset(rdp.cmd1);
int v0, i, n;
float x, y, z;
@ -74,7 +74,7 @@ static void uc8_vertex ()
rdp.update ^= UPDATE_LIGHTS;
// Calculate light vectors
for (wxUint32 l=0; l<rdp.num_lights; l++)
for (uint32_t l=0; l<rdp.num_lights; l++)
{
InverseTransformVector(&rdp.light[l].dir_x, rdp.light_vector[l], rdp.model);
NormalizeVector (rdp.light_vector[l]);
@ -90,11 +90,11 @@ static void uc8_vertex ()
x = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 0)^1];
y = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 1)^1];
z = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 2)^1];
v->flags = ((wxUint16*)gfx.RDRAM)[(((addr+i) >> 1) + 3)^1];
v->flags = ((uint16_t*)gfx.RDRAM)[(((addr+i) >> 1) + 3)^1];
v->ou = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 4)^1];
v->ov = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 5)^1];
v->uv_scaled = 0;
v->a = ((wxUint8*)gfx.RDRAM)[(addr+i + 15)^3];
v->a = ((uint8_t*)gfx.RDRAM)[(addr+i + 15)^3];
#ifdef EXTREME_LOGGING
FRDP ("before v%d - x: %f, y: %f, z: %f\n", i>>4, x, y, z);
@ -125,16 +125,16 @@ static void uc8_vertex ()
if (v->y > v->w) v->scr_off |= 8;
if (v->w < 0.1f) v->scr_off |= 16;
///*
v->r = ((wxUint8*)gfx.RDRAM)[(addr+i + 12)^3];
v->g = ((wxUint8*)gfx.RDRAM)[(addr+i + 13)^3];
v->b = ((wxUint8*)gfx.RDRAM)[(addr+i + 14)^3];
v->r = ((uint8_t*)gfx.RDRAM)[(addr+i + 12)^3];
v->g = ((uint8_t*)gfx.RDRAM)[(addr+i + 13)^3];
v->b = ((uint8_t*)gfx.RDRAM)[(addr+i + 14)^3];
#ifdef EXTREME_LOGGING
FRDP ("r: %02lx, g: %02lx, b: %02lx, a: %02lx\n", v->r, v->g, v->b, v->a);
#endif
if ((rdp.geom_mode & 0x00020000))
{
wxUint32 shift = v0 << 1;
uint32_t shift = v0 << 1;
v->vec[0] = ((char*)gfx.RDRAM)[(uc8_normale_addr + (i>>3) + shift + 0)^3];
v->vec[1] = ((char*)gfx.RDRAM)[(uc8_normale_addr + (i>>3) + shift + 1)^3];
v->vec[2] = (char)(v->flags&0xff);
@ -158,7 +158,7 @@ static void uc8_vertex ()
float color[3] = {rdp.light[rdp.num_lights].r, rdp.light[rdp.num_lights].g, rdp.light[rdp.num_lights].b};
FRDP("ambient light. r: %f, g: %f, b: %f\n", color[0], color[1], color[2]);
float light_intensity = 0.0f;
wxUint32 l;
uint32_t l;
if (rdp.geom_mode & 0x00400000)
{
NormalizeVector (v->vec);
@ -223,9 +223,9 @@ static void uc8_vertex ()
if (color[0] > 1.0f) color[0] = 1.0f;
if (color[1] > 1.0f) color[1] = 1.0f;
if (color[2] > 1.0f) color[2] = 1.0f;
v->r = (wxUint8)(((float)v->r)*color[0]);
v->g = (wxUint8)(((float)v->g)*color[1]);
v->b = (wxUint8)(((float)v->b)*color[2]);
v->r = (uint8_t)(((float)v->r)*color[0]);
v->g = (uint8_t)(((float)v->g)*color[1]);
v->b = (uint8_t)(((float)v->b)*color[2]);
#ifdef EXTREME_LOGGING
FRDP("color after light: r: 0x%02lx, g: 0x%02lx, b: 0x%02lx\n", v->r, v->g, v->b);
#endif
@ -235,9 +235,9 @@ static void uc8_vertex ()
static void uc8_moveword ()
{
wxUint8 index = (wxUint8)((rdp.cmd0 >> 16) & 0xFF);
wxUint16 offset = (wxUint16)(rdp.cmd0 & 0xFFFF);
wxUint32 data = rdp.cmd1;
uint8_t index = (uint8_t)((rdp.cmd0 >> 16) & 0xFF);
uint16_t offset = (uint16_t)(rdp.cmd0 & 0xFFFF);
uint32_t data = rdp.cmd1;
FRDP ("uc8:moveword ");
@ -287,13 +287,13 @@ static void uc8_moveword ()
case 0x10: // moveword coord mod
{
wxUint8 n = offset >> 2;
uint8_t n = offset >> 2;
FRDP ("coord mod:%d, %08lx\n", n, data);
if (rdp.cmd0&8)
return;
wxUint32 idx = (rdp.cmd0>>1)&3;
wxUint32 pos = rdp.cmd0&0x30;
uint32_t idx = (rdp.cmd0>>1)&3;
uint32_t pos = rdp.cmd0&0x30;
if (pos == 0)
{
uc8_coord_mod[0+idx] = (short)(rdp.cmd1>>16);
@ -334,7 +334,7 @@ static void uc8_moveword ()
static void uc8_movemem ()
{
int idx = rdp.cmd0 & 0xFF;
wxUint32 addr = segoffset(rdp.cmd1);
uint32_t addr = segoffset(rdp.cmd1);
int ofs = (rdp.cmd0 >> 5) & 0x3FFF;
FRDP ("uc8:movemem ofs:%d ", ofs);
@ -343,7 +343,7 @@ static void uc8_movemem ()
{
case 8: // VIEWPORT
{
wxUint32 a = addr >> 1;
uint32_t a = addr >> 1;
short scale_x = ((short*)gfx.RDRAM)[(a+0)^1] >> 2;
short scale_y = ((short*)gfx.RDRAM)[(a+1)^1] >> 2;
short scale_z = ((short*)gfx.RDRAM)[(a+2)^1];
@ -385,7 +385,7 @@ static void uc8_movemem ()
return;
}
n -= 2;
wxUint8 col = gfx.RDRAM[(addr+0)^3];
uint8_t col = gfx.RDRAM[(addr+0)^3];
rdp.light[n].r = (float)col / 255.0f;
rdp.light[n].nonblack = col;
col = gfx.RDRAM[(addr+1)^3];
@ -399,7 +399,7 @@ static void uc8_movemem ()
rdp.light[n].dir_y = (float)(((char*)gfx.RDRAM)[(addr+9)^3]) / 127.0f;
rdp.light[n].dir_z = (float)(((char*)gfx.RDRAM)[(addr+10)^3]) / 127.0f;
// **
wxUint32 a = addr >> 1;
uint32_t a = addr >> 1;
rdp.light[n].x = (float)(((short*)gfx.RDRAM)[(a+16)^1]);
rdp.light[n].y = (float)(((short*)gfx.RDRAM)[(a+17)^1]);
rdp.light[n].z = (float)(((short*)gfx.RDRAM)[(a+18)^1]);
@ -417,7 +417,7 @@ static void uc8_movemem ()
#ifdef EXTREME_LOGGING
for (int t=0; t < 24; t++)
{
FRDP ("light[%d] = 0x%04lx \n", t, ((wxUint16*)gfx.RDRAM)[(a+t)^1]);
FRDP ("light[%d] = 0x%04lx \n", t, ((uint16_t*)gfx.RDRAM)[(a+t)^1]);
}
#endif
}
@ -435,10 +435,10 @@ static void uc8_movemem ()
char y = ((char*)gfx.RDRAM)[uc8_normale_addr + ((i<<1) + 1)^3];
FRDP("#%d x = %d, y = %d\n", i, x, y);
}
wxUint32 a = uc8_normale_addr >> 1;
uint32_t a = uc8_normale_addr >> 1;
for (i = 0; i < 32; i++)
{
FRDP ("n[%d] = 0x%04lx \n", i, ((wxUint16*)gfx.RDRAM)[(a+i)^1]);
FRDP ("n[%d] = 0x%04lx \n", i, ((uint16_t*)gfx.RDRAM)[(a+i)^1]);
}
#endif
}

View File

@ -57,9 +57,9 @@ static int Calc_invw (int w) {
int count, neg;
union {
wxInt32 W;
wxUint32 UW;
uint32_t UW;
wxInt16 HW[2];
wxUint16 UHW[2];
uint16_t UHW[2];
} Result;
Result.W = w;
if (Result.UW == 0) {
@ -95,9 +95,9 @@ static int Calc_invw (int w) {
return Result.W;
}
static void uc9_draw_object (wxUint8 * addr, wxUint32 type)
static void uc9_draw_object (uint8_t * addr, uint32_t type)
{
wxUint32 textured, vnum, vsize;
uint32_t textured, vnum, vsize;
switch (type) {
case 0: //null
textured = vnum = vsize = 0;
@ -128,7 +128,7 @@ static void uc9_draw_object (wxUint8 * addr, wxUint32 type)
break;
}
VERTEX vtx[4];
for (wxUint32 i = 0; i < vnum; i++)
for (uint32_t i = 0; i < vnum; i++)
{
VERTEX &v = vtx[i];
v.sx = zSortRdp.scale_x * ((short*)addr)[0^1];
@ -181,15 +181,15 @@ static void uc9_draw_object (wxUint8 * addr, wxUint32 type)
}
}
static wxUint32 uc9_load_object (wxUint32 zHeader, wxUint32 * rdpcmds)
static uint32_t uc9_load_object (uint32_t zHeader, uint32_t * rdpcmds)
{
wxUint32 type = zHeader & 7;
wxUint8 * addr = gfx.RDRAM + (zHeader&0xFFFFFFF8);
uint32_t type = zHeader & 7;
uint8_t * addr = gfx.RDRAM + (zHeader&0xFFFFFFF8);
switch (type) {
case 1: //sh tri
case 3: //sh quad
{
rdp.cmd1 = ((wxUint32*)addr)[1];
rdp.cmd1 = ((uint32_t*)addr)[1];
if (rdp.cmd1 != rdpcmds[0])
{
rdpcmds[0] = rdp.cmd1;
@ -203,19 +203,19 @@ static wxUint32 uc9_load_object (wxUint32 zHeader, wxUint32 * rdpcmds)
case 2: //tx tri
case 4: //tx quad
{
rdp.cmd1 = ((wxUint32*)addr)[1];
rdp.cmd1 = ((uint32_t*)addr)[1];
if (rdp.cmd1 != rdpcmds[0])
{
rdpcmds[0] = rdp.cmd1;
uc9_rpdcmd ();
}
rdp.cmd1 = ((wxUint32*)addr)[2];
rdp.cmd1 = ((uint32_t*)addr)[2];
if (rdp.cmd1 != rdpcmds[1])
{
uc9_rpdcmd ();
rdpcmds[1] = rdp.cmd1;
}
rdp.cmd1 = ((wxUint32*)addr)[3];
rdp.cmd1 = ((uint32_t*)addr)[3];
if (rdp.cmd1 != rdpcmds[2])
{
uc9_rpdcmd ();
@ -229,15 +229,15 @@ static wxUint32 uc9_load_object (wxUint32 zHeader, wxUint32 * rdpcmds)
}
break;
}
return segoffset(((wxUint32*)addr)[0]);
return segoffset(((uint32_t*)addr)[0]);
}
static void uc9_object ()
{
LRDP("uc9:object\n");
wxUint32 rdpcmds[3] = {0, 0, 0};
wxUint32 cmd1 = rdp.cmd1;
wxUint32 zHeader = segoffset(rdp.cmd0);
uint32_t rdpcmds[3] = {0, 0, 0};
uint32_t cmd1 = rdp.cmd1;
uint32_t zHeader = segoffset(rdp.cmd0);
while (zHeader)
zHeader = uc9_load_object(zHeader, rdpcmds);
zHeader = segoffset(cmd1);
@ -254,7 +254,7 @@ static void uc9_fmlight ()
{
int mid = rdp.cmd0&0xFF;
rdp.num_lights = 1 + ((rdp.cmd1>>12)&0xFF);
wxUint32 a = -1024 + (rdp.cmd1&0xFFF);
uint32_t a = -1024 + (rdp.cmd1&0xFFF);
FRDP ("uc9:fmlight matrix: %d, num: %d, dmem: %04lx\n", mid, rdp.num_lights, a);
M44 *m = NULL;
@ -274,18 +274,18 @@ static void uc9_fmlight ()
break;
}
rdp.light[rdp.num_lights].r = (float)(((wxUint8*)gfx.DMEM)[(a+0)^3]) / 255.0f;
rdp.light[rdp.num_lights].g = (float)(((wxUint8*)gfx.DMEM)[(a+1)^3]) / 255.0f;
rdp.light[rdp.num_lights].b = (float)(((wxUint8*)gfx.DMEM)[(a+2)^3]) / 255.0f;
rdp.light[rdp.num_lights].r = (float)(((uint8_t*)gfx.DMEM)[(a+0)^3]) / 255.0f;
rdp.light[rdp.num_lights].g = (float)(((uint8_t*)gfx.DMEM)[(a+1)^3]) / 255.0f;
rdp.light[rdp.num_lights].b = (float)(((uint8_t*)gfx.DMEM)[(a+2)^3]) / 255.0f;
rdp.light[rdp.num_lights].a = 1.0f;
FRDP ("ambient light: r: %.3f, g: %.3f, b: %.3f\n", rdp.light[rdp.num_lights].r, rdp.light[rdp.num_lights].g, rdp.light[rdp.num_lights].b);
a += 8;
wxUint32 i;
uint32_t i;
for (i = 0; i < rdp.num_lights; i++)
{
rdp.light[i].r = (float)(((wxUint8*)gfx.DMEM)[(a+0)^3]) / 255.0f;
rdp.light[i].g = (float)(((wxUint8*)gfx.DMEM)[(a+1)^3]) / 255.0f;
rdp.light[i].b = (float)(((wxUint8*)gfx.DMEM)[(a+2)^3]) / 255.0f;
rdp.light[i].r = (float)(((uint8_t*)gfx.DMEM)[(a+0)^3]) / 255.0f;
rdp.light[i].g = (float)(((uint8_t*)gfx.DMEM)[(a+1)^3]) / 255.0f;
rdp.light[i].b = (float)(((uint8_t*)gfx.DMEM)[(a+2)^3]) / 255.0f;
rdp.light[i].a = 1.0f;
rdp.light[i].dir_x = (float)(((char*)gfx.DMEM)[(a+8)^3]) / 127.0f;
rdp.light[i].dir_y = (float)(((char*)gfx.DMEM)[(a+9)^3]) / 127.0f;
@ -320,16 +320,16 @@ static void uc9_fmlight ()
static void uc9_light ()
{
wxUint32 csrs = -1024 + ((rdp.cmd0>>12)&0xFFF);
wxUint32 nsrs = -1024 + (rdp.cmd0&0xFFF);
wxUint32 num = 1 + ((rdp.cmd1>>24)&0xFF);
wxUint32 cdest = -1024 + ((rdp.cmd1>>12)&0xFFF);
wxUint32 tdest = -1024 + (rdp.cmd1&0xFFF);
uint32_t csrs = -1024 + ((rdp.cmd0>>12)&0xFFF);
uint32_t nsrs = -1024 + (rdp.cmd0&0xFFF);
uint32_t num = 1 + ((rdp.cmd1>>24)&0xFF);
uint32_t cdest = -1024 + ((rdp.cmd1>>12)&0xFFF);
uint32_t tdest = -1024 + (rdp.cmd1&0xFFF);
int use_material = (csrs != 0x0ff0);
tdest >>= 1;
FRDP ("uc9:light n: %d, colsrs: %04lx, normales: %04lx, coldst: %04lx, texdst: %04lx\n", num, csrs, nsrs, cdest, tdest);
VERTEX v;
for (wxUint32 i = 0; i < num; i++)
for (uint32_t i = 0; i < num; i++)
{
v.vec[0] = ((char*)gfx.DMEM)[(nsrs++)^3];
v.vec[1] = ((char*)gfx.DMEM)[(nsrs++)^3];
@ -341,9 +341,9 @@ static void uc9_light ()
v.a = 0xFF;
if (use_material)
{
v.r = (wxUint8)(((wxUint32)v.r * gfx.DMEM[(csrs++)^3])>>8);
v.g = (wxUint8)(((wxUint32)v.g * gfx.DMEM[(csrs++)^3])>>8);
v.b = (wxUint8)(((wxUint32)v.b * gfx.DMEM[(csrs++)^3])>>8);
v.r = (uint8_t)(((uint32_t)v.r * gfx.DMEM[(csrs++)^3])>>8);
v.g = (uint8_t)(((uint32_t)v.g * gfx.DMEM[(csrs++)^3])>>8);
v.b = (uint8_t)(((uint32_t)v.b * gfx.DMEM[(csrs++)^3])>>8);
v.a = gfx.DMEM[(csrs++)^3];
}
gfx.DMEM[(cdest++)^3] = v.r;
@ -392,9 +392,9 @@ static void uc9_mtxcat ()
LRDP("uc9:mtxcat ");
M44 *s = NULL;
M44 *t = NULL;
wxUint32 S = rdp.cmd0&0xF;
wxUint32 T = (rdp.cmd1>>16)&0xF;
wxUint32 D = rdp.cmd1&0xF;
uint32_t S = rdp.cmd0&0xF;
uint32_t T = (rdp.cmd1>>16)&0xF;
uint32_t D = rdp.cmd1&0xF;
switch (S) {
case 4:
s = (M44*)rdp.model;
@ -471,8 +471,8 @@ typedef struct {
short yi;
short xi;
short wi;
wxUint8 fog;
wxUint8 cc;
uint8_t fog;
uint8_t cc;
} zSortVDest;
static void uc9_mult_mpmtx ()
@ -513,7 +513,7 @@ static void uc9_mult_mpmtx ()
int fog = (int)(z / w * rdp.fog_multiplier + rdp.fog_offset);
if (fog > 255)
fog = 255;
v.fog = (fog >= 0) ? (wxUint8)fog : 0;
v.fog = (fog >= 0) ? (uint8_t)fog : 0;
}
v.cc = 0;
@ -558,7 +558,7 @@ void uc9_movemem ()
int len = (1 + ((rdp.cmd0>>15)&0x1ff))<<3;
FRDP ("uc9:movemem ofs: %d, len: %d. ", ofs, len);
int flag = rdp.cmd0 & 0x01;
wxUint32 addr = segoffset(rdp.cmd1);
uint32_t addr = segoffset(rdp.cmd1);
switch (idx)
{
@ -622,7 +622,7 @@ void uc9_movemem ()
case 12: // VIEWPORT
{
wxUint32 a = addr >> 1;
uint32_t a = addr >> 1;
short scale_x = ((short*)gfx.RDRAM)[(a+0)^1] >> 2;
short scale_y = ((short*)gfx.RDRAM)[(a+1)^1] >> 2;
short scale_z = ((short*)gfx.RDRAM)[(a+2)^1];

View File

@ -43,25 +43,25 @@
void uc9_rpdcmd ()
{
wxUint32 a = segoffset(rdp.cmd1) >> 2;
uint32_t a = segoffset(rdp.cmd1) >> 2;
FRDP ("uc9:rdpcmd addr: %08lx\n", a);
if (a)
{
rdp.LLE = 1;
wxUint32 cmd = 0;
uint32_t cmd = 0;
while(1)
{
rdp.cmd0 = ((wxUint32*)gfx.RDRAM)[a++];
rdp.cmd0 = ((uint32_t*)gfx.RDRAM)[a++];
cmd = rdp.cmd0>>24;
if (cmd == 0xDF)
break;
rdp.cmd1 = ((wxUint32*)gfx.RDRAM)[a++];
rdp.cmd1 = ((uint32_t*)gfx.RDRAM)[a++];
if (cmd == 0xE4 || cmd == 0xE5)
{
a++;
rdp.cmd2 = ((wxUint32*)gfx.RDRAM)[a++];
rdp.cmd2 = ((uint32_t*)gfx.RDRAM)[a++];
a++;
rdp.cmd3 = ((wxUint32*)gfx.RDRAM)[a++];
rdp.cmd3 = ((uint32_t*)gfx.RDRAM)[a++];
}
gfx_instruction[ucode_zSort][cmd] ();
};

View File

@ -65,16 +65,16 @@ static void fb_bg_copy ()
if ( (status == ci_copy) )
return;
wxUint32 addr = segoffset(rdp.cmd1) >> 1;
wxUint8 imageFmt = ((wxUint8 *)gfx.RDRAM)[(((addr+11)<<1)+0)^3];
wxUint8 imageSiz = ((wxUint8 *)gfx.RDRAM)[(((addr+11)<<1)+1)^3];
wxUint32 imagePtr = segoffset(((wxUint32*)gfx.RDRAM)[(addr+8)>>1]);
uint32_t addr = segoffset(rdp.cmd1) >> 1;
uint8_t imageFmt = ((uint8_t *)gfx.RDRAM)[(((addr+11)<<1)+0)^3];
uint8_t imageSiz = ((uint8_t *)gfx.RDRAM)[(((addr+11)<<1)+1)^3];
uint32_t imagePtr = segoffset(((uint32_t*)gfx.RDRAM)[(addr+8)>>1]);
FRDP ("fb_bg_copy. fmt: %d, size: %d, imagePtr %08lx, main_ci: %08lx, cur_ci: %08lx \n", imageFmt, imageSiz, imagePtr, rdp.main_ci, rdp.frame_buffers[rdp.ci_count-1].addr);
if (status == ci_main)
{
wxUint16 frameW = ((wxUint16 *)gfx.RDRAM)[(addr+3)^1] >> 2;
wxUint16 frameH = ((wxUint16 *)gfx.RDRAM)[(addr+7)^1] >> 2;
uint16_t frameW = ((uint16_t *)gfx.RDRAM)[(addr+3)^1] >> 2;
uint16_t frameH = ((uint16_t *)gfx.RDRAM)[(addr+7)^1] >> 2;
if ( (frameW == rdp.frame_buffers[rdp.ci_count-1].width) && (frameH == rdp.frame_buffers[rdp.ci_count-1].height) )
rdp.main_ci_bg = imagePtr;
}
@ -112,13 +112,13 @@ static void fb_bg_copy ()
static void fb_setscissor()
{
rdp.scissor_o.lr_y = (wxUint32)(((rdp.cmd1 & 0x00000FFF) >> 2));
rdp.scissor_o.lr_y = (uint32_t)(((rdp.cmd1 & 0x00000FFF) >> 2));
if (rdp.ci_count)
{
rdp.scissor_o.ul_x = (wxUint32)(((rdp.cmd0 & 0x00FFF000) >> 14));
rdp.scissor_o.lr_x = (wxUint32)(((rdp.cmd1 & 0x00FFF000) >> 14));
rdp.scissor_o.ul_x = (uint32_t)(((rdp.cmd0 & 0x00FFF000) >> 14));
rdp.scissor_o.lr_x = (uint32_t)(((rdp.cmd1 & 0x00FFF000) >> 14));
COLOR_IMAGE & cur_fb = rdp.frame_buffers[rdp.ci_count-1];
if (rdp.scissor_o.lr_x - rdp.scissor_o.ul_x > (wxUint32)(cur_fb.width >> 1))
if (rdp.scissor_o.lr_x - rdp.scissor_o.ul_x > (uint32_t)(cur_fb.width >> 1))
{
if (cur_fb.height == 0 || (cur_fb.width >= rdp.scissor_o.lr_x-1 && cur_fb.width <= rdp.scissor_o.lr_x+1))
cur_fb.height = rdp.scissor_o.lr_y;
@ -131,7 +131,7 @@ static void fb_uc2_movemem()
{
if ((rdp.cmd0 & 0xFF) == 8)
{
wxUint32 a = segoffset(rdp.cmd1) >> 1;
uint32_t a = segoffset(rdp.cmd1) >> 1;
short scale_x = ((short*)gfx.RDRAM)[(a+0)^1] >> 2;
short trans_x = ((short*)gfx.RDRAM)[(a+4)^1] >> 2;
COLOR_IMAGE & cur_fb = rdp.frame_buffers[rdp.ci_count-1];
@ -139,7 +139,7 @@ static void fb_uc2_movemem()
{
short scale_y = ((short*)gfx.RDRAM)[(a+1)^1] >> 2;
short trans_y = ((short*)gfx.RDRAM)[(a+5)^1] >> 2;
wxUint32 height = scale_y + trans_y;
uint32_t height = scale_y + trans_y;
if (height < rdp.scissor_o.lr_y)
cur_fb.height = height;
}
@ -156,7 +156,7 @@ static void fb_rect()
int diff = abs((int)rdp.frame_buffers[rdp.ci_count-1].width - width);
if (diff < 4)
{
wxUint32 lr_y = min(rdp.scissor_o.lr_y, (rdp.cmd0 & 0xFFF) >> 2);
uint32_t lr_y = min(rdp.scissor_o.lr_y, (rdp.cmd0 & 0xFFF) >> 2);
if (rdp.frame_buffers[rdp.ci_count-1].height < lr_y)
{
FRDP("fb_rect. ul_x: %d, lr_x: %d, fb_height: %d -> %d\n", ul_x, lr_x, rdp.frame_buffers[rdp.ci_count-1].height, lr_y);
@ -181,7 +181,7 @@ static void fb_settextureimage()
if (((rdp.cmd0 >> 19) & 0x03) >= 2) //check that texture is 16/32bit
{
int tex_format = ((rdp.cmd0 >> 21) & 0x07);
wxUint32 addr = segoffset(rdp.cmd1);
uint32_t addr = segoffset(rdp.cmd1);
if ( tex_format == 0 )
{
FRDP ("fb_settextureimage. fmt: %d, size: %d, imagePtr %08lx, main_ci: %08lx, cur_ci: %08lx \n", ((rdp.cmd0 >> 21) & 0x07), ((rdp.cmd0 >> 19) & 0x03), addr, rdp.main_ci, rdp.frame_buffers[rdp.ci_count-1].addr);
@ -419,7 +419,7 @@ static void fb_setcolorimage()
{
rdp.frame_buffers[rdp.ci_count-1].status = ci_useless;
/*
wxUint32 addr = rdp.frame_buffers[rdp.ci_count-1].addr;
uint32_t addr = rdp.frame_buffers[rdp.ci_count-1].addr;
for (int i = 0; i < rdp.ci_count - 1; i++)
{
if (rdp.frame_buffers[i].addr == addr)

View File

@ -29,7 +29,7 @@
#include "TxDbg.h"
#include <zlib/zlib.h>
#include <Common/path.h>
#include <common/StdString.h>
#include <Common/StdString.h>
TxCache::~TxCache()
{

View File

@ -26,7 +26,7 @@
#include "TxDbg.h"
#include <string.h>
#include <stdarg.h>
#include <common/StdString.h>
#include <Common/StdString.h>
#include <Common/path.h>
TxDbg::TxDbg()

View File

@ -25,8 +25,8 @@
#pragma warning(disable: 4786)
#endif
#include <common/path.h>
#include <common/StdString.h>
#include <Common/path.h>
#include <Common/StdString.h>
#include "TxFilter.h"
#include "TextureFilters.h"
#include "TxDbg.h"

View File

@ -60,8 +60,8 @@
#include "TxDbg.h"
#include <zlib/zlib.h>
#include <string>
#include <common/path.h>
#include <common/StdString.h>
#include <Common/path.h>
#include <Common/StdString.h>
#include <io.h>
TxHiResCache::~TxHiResCache()

View File

@ -33,7 +33,7 @@
#include <zlib/zlib.h>
#include <string>
#include <Common/path.h>
#include <common/StdString.h>
#include <Common/StdString.h>
TxTexCache::~TxTexCache()
{

View File

@ -26,7 +26,7 @@
#include <zlib/zlib.h>
#include <malloc.h>
#include <stdlib.h>
#include <common/stdtypes.h>
#include <Common/stdtypes.h>
/*

View File

@ -26,7 +26,7 @@
* `GetSystemSetting` and `FindSystemSettingId` from Project64 debugger
* used only in DisplayError when OpenGL extension loading fails on WGL
*/
#include "../Settings/Settings.h"
#include <Settings/Settings.h>
struct ResolutionInfo
{

View File

@ -364,6 +364,10 @@
RelativePath=".\N64System\Mips\Audio.cpp"
>
</File>
<File
RelativePath=".\N64System\Mips\Disk.cpp"
>
</File>
<File
RelativePath=".\N64System\Mips\Dma.cpp"
>
@ -535,6 +539,10 @@
RelativePath=".\N64System\CheatClass.h"
>
</File>
<File
RelativePath=".\N64System\Mips\Disk.h"
>
</File>
<File
RelativePath=".\N64System\FramePerSecondClass.h"
>

View File

@ -1,12 +1,12 @@
#include <windows.h>
#include <common/memtest.h>
#include <common/CriticalSection.h>
#include <common/StdString.h>
#include <common/FileClass.h>
#include <common/LogClass.h>
#include <common/Trace.h>
#include <common/path.h>
#include <common/SmartPointer.h>
#include <common/IniFileClass.h>
#include <common/md5.h>
#include <Common/memtest.h>
#include <Common/CriticalSection.h>
#include <Common/StdString.h>
#include <Common/FileClass.h>
#include <Common/LogClass.h>
#include <Common/Trace.h>
#include <Common/path.h>
#include <Common/SmartPointer.h>
#include <Common/IniFileClass.h>
#include <Common/md5.h>

View File

@ -94,7 +94,7 @@ BEGIN
END
IDD_Settings_Directory DIALOGEX 0, 0, 231, 206
STYLE DS_SETFONT | WS_CHILD
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN

View File

@ -15,8 +15,8 @@
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#include <common/MemTest.h>
#include <common/CriticalSection.h>
#include <Common/MemTest.h>
#include <Common/CriticalSection.h>
#include <Project64-core/Multilanguage.h>
#include "UserInterface.h"
#include "N64System.h"

View File

@ -31,9 +31,9 @@ extern "C" {
#include "profiling.h"
}
#pragma warning(disable:4786)
#include <common/StdString.h>
#include <common/FileClass.h>
#include <common/LogClass.h>
#include <Common/StdString.h>
#include <Common/FileClass.h>
#include <Common/LogClass.h>
#include <map>
#include <vector>

View File

@ -27,7 +27,7 @@
#ifndef __Types_h
#define __Types_h
#include <common/stdtypes.h>
#include <Common/stdtypes.h>
/*
* pointer to RSP operation code functions or "func"

View File

@ -26,7 +26,7 @@
#include <stdio.h>
#include <windows.h>
#include <common/StdString.h>
#include <Common/StdString.h>
#include <Common/FileClass.h>
#include <Common/LogClass.h>
#include <Common/path.h>