[Project64] Rename wxUint8 to uint8_t

This commit is contained in:
zilmar 2016-01-20 17:17:45 +11:00
parent dae0c8827c
commit d1bcbde69a
26 changed files with 589 additions and 589 deletions

View File

@ -67,9 +67,9 @@ void calc_light (VERTEX *v)
if (color[1] > 1.0f) color[1] = 1.0f; if (color[1] > 1.0f) color[1] = 1.0f;
if (color[2] > 1.0f) color[2] = 1.0f; if (color[2] > 1.0f) color[2] = 1.0f;
v->r = (wxUint8)(color[0]*255.0f); v->r = (uint8_t)(color[0]*255.0f);
v->g = (wxUint8)(color[1]*255.0f); v->g = (uint8_t)(color[1]*255.0f);
v->b = (wxUint8)(color[2]*255.0f); v->b = (uint8_t)(color[2]*255.0f);
} }
//* //*

View File

@ -664,20 +664,20 @@ COMBINE cmb;
#define CC(color) cmb.ccolor=(color)&0xFFFFFF00 #define CC(color) cmb.ccolor=(color)&0xFFFFFF00
#define CC_BYTE(byte) { cmb.ccolor=(byte<<8)|(byte<<16)|(byte<<24); } #define CC_BYTE(byte) { cmb.ccolor=(byte<<8)|(byte<<16)|(byte<<24); }
#define CC_C1MULC2(color1, color2) { \ #define CC_C1MULC2(color1, color2) { \
cmb.ccolor=(wxUint8)( ((color1 & 0xFF000000) >> 24) * (((color2 & 0xFF000000) >> 24) /255.0f) ) << 24 | \ cmb.ccolor=(uint8_t)( ((color1 & 0xFF000000) >> 24) * (((color2 & 0xFF000000) >> 24) /255.0f) ) << 24 | \
(wxUint8)( ((color1 & 0x00FF0000) >> 16) * (((color2 & 0x00FF0000) >> 16) /255.0f) ) << 16 | \ (uint8_t)( ((color1 & 0x00FF0000) >> 16) * (((color2 & 0x00FF0000) >> 16) /255.0f) ) << 16 | \
(wxUint8)( ((color1 & 0x0000FF00) >> 8) * (((color2 & 0x0000FF00) >> 8) /255.0f) ) << 8 ; \ (uint8_t)( ((color1 & 0x0000FF00) >> 8) * (((color2 & 0x0000FF00) >> 8) /255.0f) ) << 8 ; \
} }
#define CC_C1SUBC2(color1, color2) { \ #define CC_C1SUBC2(color1, color2) { \
cmb.ccolor=(wxUint8)( max(0, (int)((color1 & 0xFF000000) >> 24) - (int)((color2 & 0xFF000000) >> 24)) ) << 24 | \ cmb.ccolor=(uint8_t)( max(0, (int)((color1 & 0xFF000000) >> 24) - (int)((color2 & 0xFF000000) >> 24)) ) << 24 | \
(wxUint8)( max(0, (int)((color1 & 0x00FF0000) >> 16) - (int)((color2 & 0x00FF0000) >> 16)) ) << 16 | \ (uint8_t)( max(0, (int)((color1 & 0x00FF0000) >> 16) - (int)((color2 & 0x00FF0000) >> 16)) ) << 16 | \
(wxUint8)( max(0, (int)((color1 & 0x0000FF00) >> 8) - (int)((color2 & 0x0000FF00) >> 8)) ) << 8 ; \ (uint8_t)( max(0, (int)((color1 & 0x0000FF00) >> 8) - (int)((color2 & 0x0000FF00) >> 8)) ) << 8 ; \
} }
#define CC_COLMULBYTE(color, byte) { \ #define CC_COLMULBYTE(color, byte) { \
float factor = byte/255.0f; \ float factor = byte/255.0f; \
cmb.ccolor = (wxUint8)( ((color & 0xFF000000) >> 24) * factor ) << 24 | \ cmb.ccolor = (uint8_t)( ((color & 0xFF000000) >> 24) * factor ) << 24 | \
(wxUint8)( ((color & 0x00FF0000) >> 16) * factor ) << 16 | \ (uint8_t)( ((color & 0x00FF0000) >> 16) * factor ) << 16 | \
(wxUint8)( ((color & 0x0000FF00) >> 8) * factor ) << 8 ; \ (uint8_t)( ((color & 0x0000FF00) >> 8) * factor ) << 8 ; \
} }
#define CC_PRIM() CC(rdp.prim_color) #define CC_PRIM() CC(rdp.prim_color)
#define CC_ENV() CC(rdp.env_color) #define CC_ENV() CC(rdp.env_color)
@ -1098,7 +1098,7 @@ static void cc__t1_inter_t0_using_enva__mul_prim ()
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE); GR_COMBINE_OTHER_TEXTURE);
CC_PRIM (); CC_PRIM ();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF); uint8_t factor = (uint8_t)(rdp.env_color&0xFF);
T1_INTER_T0_USING_FACTOR (factor); T1_INTER_T0_USING_FACTOR (factor);
} }
@ -1447,7 +1447,7 @@ static void cc__t1_inter_t0_using_enva__mul_shade ()
GR_COMBINE_FACTOR_LOCAL, GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_TEXTURE); 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); T1_INTER_T0_USING_FACTOR (factor);
} }
@ -2174,7 +2174,7 @@ static void cc__t0_inter_t1_using_enva__sub_env () //Aded by Gonetz
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE); GR_COMBINE_OTHER_TEXTURE);
CC_ENV (); CC_ENV ();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF); uint8_t factor = (uint8_t)(rdp.env_color&0xFF);
T0_INTER_T1_USING_FACTOR (factor); T0_INTER_T1_USING_FACTOR (factor);
} }
@ -2276,12 +2276,12 @@ static void cc_t0_add_env_mul_k5 ()
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE); GR_COMBINE_OTHER_TEXTURE);
float scale = rdp.K5 / 255.0f; float scale = rdp.K5 / 255.0f;
wxUint8 r = (wxUint8)(rdp.env_color >> 24) & 0xFF; uint8_t r = (uint8_t)(rdp.env_color >> 24) & 0xFF;
r = (wxUint8)(r*scale); r = (uint8_t)(r*scale);
wxUint8 g = (wxUint8)(rdp.env_color >> 16) & 0xFF; uint8_t g = (uint8_t)(rdp.env_color >> 16) & 0xFF;
g = (wxUint8)(g*scale); g = (uint8_t)(g*scale);
wxUint8 b = (wxUint8)(rdp.env_color >> 8) & 0xFF; uint8_t b = (uint8_t)(rdp.env_color >> 8) & 0xFF;
b = (wxUint8)(b*scale); b = (uint8_t)(b*scale);
CC((r<<24)|(g<<16)|(b<<8)); CC((r<<24)|(g<<16)|(b<<8));
USE_T0 (); USE_T0 ();
} }
@ -2703,7 +2703,7 @@ static void cc__t0_inter_t1_using_enva__mul_shade_add_prim ()
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_ITERATED); GR_COMBINE_OTHER_ITERATED);
CC_PRIM (); CC_PRIM ();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF); uint8_t factor = (uint8_t)(rdp.env_color&0xFF);
T0_INTER_T1_USING_FACTOR (factor); T0_INTER_T1_USING_FACTOR (factor);
} }
@ -2714,7 +2714,7 @@ static void cc__t0_inter_t1_using_enva__mul_shade_add_env ()
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_ITERATED); GR_COMBINE_OTHER_ITERATED);
CC_ENV (); CC_ENV ();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF); uint8_t factor = (uint8_t)(rdp.env_color&0xFF);
T0_INTER_T1_USING_FACTOR (factor); T0_INTER_T1_USING_FACTOR (factor);
} }
@ -3802,12 +3802,12 @@ static void cc_t0_mul_prima_mul_shade_add_prim_mul_one_sub_prima () //Aded by G
GR_COMBINE_OTHER_ITERATED); GR_COMBINE_OTHER_ITERATED);
MULSHADE_PRIMA (); MULSHADE_PRIMA ();
USE_T0 (); USE_T0 ();
wxUint8 fac = 255 - (wxUint8)(rdp.prim_color&0xFF); uint8_t fac = 255 - (uint8_t)(rdp.prim_color&0xFF);
float col[3]; float col[3];
col[0] = (float)((rdp.prim_color & 0xFF000000) >> 24) / 255.0f; col[0] = (float)((rdp.prim_color & 0xFF000000) >> 24) / 255.0f;
col[1] = (float)((rdp.prim_color & 0x00FF0000) >> 16) / 255.0f; col[1] = (float)((rdp.prim_color & 0x00FF0000) >> 16) / 255.0f;
col[2] = (float)((rdp.prim_color & 0x0000FF00) >> 8) / 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 ** // ** A*(1-B)+C **
@ -4090,7 +4090,7 @@ static void cc__t0_inter_t1_using_enva__sub_shade_mul_prim ()
GR_COMBINE_OTHER_TEXTURE); GR_COMBINE_OTHER_TEXTURE);
MULSHADE_PRIM (); MULSHADE_PRIM ();
} }
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF); uint8_t factor = (uint8_t)(rdp.env_color&0xFF);
T0_INTER_T1_USING_FACTOR (factor); T0_INTER_T1_USING_FACTOR (factor);
} }
@ -4574,7 +4574,7 @@ static void cc__t1_inter_t0_using_enva__sub_prim_mul_prima_add_prim () //Aded b
GR_COMBINE_OTHER_TEXTURE); GR_COMBINE_OTHER_TEXTURE);
CC_PRIM (); CC_PRIM ();
CA_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); T1_INTER_T0_USING_FACTOR (factor);
} }
@ -5101,7 +5101,7 @@ static void cc_one_sub__t0_inter_t1_using_enva__mul_prim_add__t0_inter_t1_using_
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE); GR_COMBINE_OTHER_TEXTURE);
CC_PRIM (); CC_PRIM ();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF); uint8_t factor = (uint8_t)(rdp.env_color&0xFF);
T0_INTER_T1_USING_FACTOR (factor); T0_INTER_T1_USING_FACTOR (factor);
//(1-t)*prim+t == (1-prim)*t+prim //(1-t)*prim+t == (1-prim)*t+prim
} }
@ -5398,7 +5398,7 @@ static void cc_one_sub_prim_mul__t0_inter_t1_using_enva__add_prim ()
GR_COMBINE_OTHER_CONSTANT); GR_COMBINE_OTHER_CONSTANT);
CC_1SUBPRIM (); CC_1SUBPRIM ();
SETSHADE_PRIM (); SETSHADE_PRIM ();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF); uint8_t factor = (uint8_t)(rdp.env_color&0xFF);
T0_INTER_T1_USING_FACTOR (factor); T0_INTER_T1_USING_FACTOR (factor);
} }
@ -5962,12 +5962,12 @@ static void cc__prim_sub_env_mul_t0_add_env__mul_primlod ()
GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_CONSTANT); GR_COMBINE_OTHER_CONSTANT);
float factor = (float)rdp.prim_lodfrac / 255.0f; float factor = (float)rdp.prim_lodfrac / 255.0f;
wxUint8 r = (wxUint8)((rdp.prim_color >> 24) & 0xFF); uint8_t r = (uint8_t)((rdp.prim_color >> 24) & 0xFF);
r = (wxUint8)((float)r * factor); r = (uint8_t)((float)r * factor);
wxUint8 g = (wxUint8)((rdp.prim_color >> 16) & 0xFF); uint8_t g = (uint8_t)((rdp.prim_color >> 16) & 0xFF);
g = (wxUint8)((float)g * factor); g = (uint8_t)((float)g * factor);
wxUint8 b = (wxUint8)((rdp.prim_color >> 8) & 0xFF); uint8_t b = (uint8_t)((rdp.prim_color >> 8) & 0xFF);
b = (wxUint8)((float)b * factor); b = (uint8_t)((float)b * factor);
CC ((r<<24) | (g<<16) | (b<<8)); CC ((r<<24) | (g<<16) | (b<<8));
SETSHADE_ENV (); SETSHADE_ENV ();
MULSHADE_PRIMLOD (); MULSHADE_PRIMLOD ();
@ -5981,12 +5981,12 @@ static void cc__prim_sub_env_mul_t0_add_env__mul_k5 ()
GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_CONSTANT); GR_COMBINE_OTHER_CONSTANT);
float factor = (float)rdp.K5 / 255.0f; float factor = (float)rdp.K5 / 255.0f;
wxUint8 r = (wxUint8)((rdp.prim_color >> 24) & 0xFF); uint8_t r = (uint8_t)((rdp.prim_color >> 24) & 0xFF);
r = (wxUint8)((float)r * factor); r = (uint8_t)((float)r * factor);
wxUint8 g = (wxUint8)((rdp.prim_color >> 16) & 0xFF); uint8_t g = (uint8_t)((rdp.prim_color >> 16) & 0xFF);
g = (wxUint8)((float)g * factor); g = (uint8_t)((float)g * factor);
wxUint8 b = (wxUint8)((rdp.prim_color >> 8) & 0xFF); uint8_t b = (uint8_t)((rdp.prim_color >> 8) & 0xFF);
b = (wxUint8)((float)b * factor); b = (uint8_t)((float)b * factor);
CC ((r<<24) | (g<<16) | (b<<8)); CC ((r<<24) | (g<<16) | (b<<8));
SETSHADE_ENV (); SETSHADE_ENV ();
MULSHADE_K5 (); MULSHADE_K5 ();
@ -6282,7 +6282,7 @@ static void cc_prim_sub_env_mul__t0_inter_t1_using_enva_alpha__add_env ()
GR_COMBINE_OTHER_CONSTANT); GR_COMBINE_OTHER_CONSTANT);
CC_PRIM (); CC_PRIM ();
SETSHADE_ENV (); SETSHADE_ENV ();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF); uint8_t factor = (uint8_t)(rdp.env_color&0xFF);
T0_INTER_T1_USING_FACTOR (factor); T0_INTER_T1_USING_FACTOR (factor);
A_T0_INTER_T1_USING_FACTOR (factor); A_T0_INTER_T1_USING_FACTOR (factor);
} }
@ -6402,7 +6402,7 @@ static void cc_prim_sub_env_mul__t0_inter_t1_using_prima__add_env ()
GR_COMBINE_OTHER_ITERATED); GR_COMBINE_OTHER_ITERATED);
CC_ENV (); CC_ENV ();
SETSHADE_PRIM (); SETSHADE_PRIM ();
wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF); uint8_t factor = (uint8_t)(rdp.prim_color&0xFF);
T0_INTER_T1_USING_FACTOR (factor); T0_INTER_T1_USING_FACTOR (factor);
} }
@ -6415,7 +6415,7 @@ static void cc_prim_sub_env_mul__t1_inter_t0_using_prima__add_env ()
GR_COMBINE_OTHER_ITERATED); GR_COMBINE_OTHER_ITERATED);
CC_ENV (); CC_ENV ();
SETSHADE_PRIM (); SETSHADE_PRIM ();
wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF); uint8_t factor = (uint8_t)(rdp.prim_color&0xFF);
T1_INTER_T0_USING_FACTOR (factor); T1_INTER_T0_USING_FACTOR (factor);
} }
@ -6427,7 +6427,7 @@ static void cc_prim_sub_env_mul__t0_inter_t1_using_enva__add_env ()
GR_COMBINE_OTHER_ITERATED); GR_COMBINE_OTHER_ITERATED);
CC_ENV (); CC_ENV ();
SETSHADE_PRIM (); SETSHADE_PRIM ();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF); uint8_t factor = (uint8_t)(rdp.env_color&0xFF);
T0_INTER_T1_USING_FACTOR (factor); T0_INTER_T1_USING_FACTOR (factor);
} }
@ -6439,7 +6439,7 @@ static void cc_prim_sub_center_mul__t0_inter_t1_using_enva__add_env ()
GR_COMBINE_OTHER_CONSTANT); GR_COMBINE_OTHER_CONSTANT);
CC_C1SUBC2 (rdp.prim_color, rdp.CENTER); CC_C1SUBC2 (rdp.prim_color, rdp.CENTER);
SETSHADE_ENV (); SETSHADE_ENV ();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF); uint8_t factor = (uint8_t)(rdp.env_color&0xFF);
T0_INTER_T1_USING_FACTOR (factor); T0_INTER_T1_USING_FACTOR (factor);
} }
@ -6451,7 +6451,7 @@ static void cc_prim_sub_env_mul__t1_inter_t0_using_enva__add_env ()
GR_COMBINE_OTHER_ITERATED); GR_COMBINE_OTHER_ITERATED);
CC_ENV (); CC_ENV ();
SETSHADE_PRIM (); SETSHADE_PRIM ();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF); uint8_t factor = (uint8_t)(rdp.env_color&0xFF);
T1_INTER_T0_USING_FACTOR (factor); T1_INTER_T0_USING_FACTOR (factor);
} }
@ -6768,7 +6768,7 @@ static void cc_prim_sub_shade_mul__t0_inter_t1_using_enva__add_shade ()
GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_CONSTANT); GR_COMBINE_OTHER_CONSTANT);
CC_PRIM (); CC_PRIM ();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF); uint8_t factor = (uint8_t)(rdp.env_color&0xFF);
T0_INTER_T1_USING_FACTOR (factor); T0_INTER_T1_USING_FACTOR (factor);
} }
@ -7032,7 +7032,7 @@ static void cc_env_sub_prim_mul__t0_inter_t1_using_prima__add_prim ()
GR_COMBINE_OTHER_CONSTANT); GR_COMBINE_OTHER_CONSTANT);
CC_ENV (); CC_ENV ();
SETSHADE_PRIM (); SETSHADE_PRIM ();
wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF); uint8_t factor = (uint8_t)(rdp.prim_color&0xFF);
T0_INTER_T1_USING_FACTOR (factor); T0_INTER_T1_USING_FACTOR (factor);
} }
@ -7445,7 +7445,7 @@ static void cc_t0_inter_t1_using_prima ()
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE); 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); T0_INTER_T1_USING_FACTOR (factor);
} }
@ -7455,7 +7455,7 @@ static void cc_t1_inter_t0_using_prima ()
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE); 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); T1_INTER_T0_USING_FACTOR (factor);
} }
@ -7483,7 +7483,7 @@ static void cc_t0_inter_t1_using_enva ()
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE); 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); T0_INTER_T1_USING_FACTOR (factor);
} }
@ -7938,7 +7938,7 @@ static void cc__t0_inter_t1_using_prima__mul_prim ()
GR_COMBINE_FACTOR_LOCAL, GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE); 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); T0_INTER_T1_USING_FACTOR (factor);
CC_PRIM (); CC_PRIM ();
} }
@ -7950,7 +7950,7 @@ static void cc__t1_inter_t0_using_prima__mul_prim ()
GR_COMBINE_FACTOR_LOCAL, GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE); 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); T1_INTER_T0_USING_FACTOR (factor);
CC_PRIM (); CC_PRIM ();
} }
@ -7972,7 +7972,7 @@ static void cc__t0_inter_t1_using_prima__mul_shade ()
GR_COMBINE_FACTOR_LOCAL, GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_TEXTURE); 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); T0_INTER_T1_USING_FACTOR (factor);
} }
@ -7983,7 +7983,7 @@ static void cc__t1_inter_t0_using_prima__mul_shade ()
GR_COMBINE_FACTOR_LOCAL, GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_TEXTURE); 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); T1_INTER_T0_USING_FACTOR (factor);
} }
@ -8002,7 +8002,7 @@ static void cc__t0_inter_t1_using_enva__mul_shade ()
GR_COMBINE_FACTOR_LOCAL, GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_TEXTURE); 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); T0_INTER_T1_USING_FACTOR (factor);
} }
@ -8013,7 +8013,7 @@ static void cc__t0_inter_t1_using_enva__mul_prim ()
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE); GR_COMBINE_OTHER_TEXTURE);
CC_PRIM (); CC_PRIM ();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF); uint8_t factor = (uint8_t)(rdp.env_color&0xFF);
T0_INTER_T1_USING_FACTOR (factor); T0_INTER_T1_USING_FACTOR (factor);
} }
@ -8025,7 +8025,7 @@ static void cc__t0_inter_t1_using_enva__mul_env ()
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE); GR_COMBINE_OTHER_TEXTURE);
CC_ENV (); CC_ENV ();
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF); uint8_t factor = (uint8_t)(rdp.env_color&0xFF);
T0_INTER_T1_USING_FACTOR (factor); T0_INTER_T1_USING_FACTOR (factor);
} }
@ -8518,7 +8518,7 @@ static void cc_prim_sub__prim_sub_t0_mul_prima__mul_shade ()
GR_COMBINE_OTHER_TEXTURE); GR_COMBINE_OTHER_TEXTURE);
MOD_0 (TMOD_COL_INTER_TEX_USING_COL1); MOD_0 (TMOD_COL_INTER_TEX_USING_COL1);
MOD_0_COL (rdp.prim_color & 0xFFFFFF00); 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)); MOD_0_COL1 ((prima<<24)|(prima<<16)|(prima<<8));
USE_T0 (); USE_T0 ();
} }
@ -8561,9 +8561,9 @@ static void cc__prim_inter_one_using_env__mul_shade ()
GR_COMBINE_OTHER_CONSTANT); GR_COMBINE_OTHER_CONSTANT);
CC_1SUBPRIM (); CC_1SUBPRIM ();
CC_C1MULC2 (cmb.ccolor, rdp.env_color); CC_C1MULC2 (cmb.ccolor, rdp.env_color);
cmb.ccolor=(wxUint8)( min(255, (int)((cmb.ccolor & 0xFF000000) >> 24) + (int)((rdp.prim_color & 0xFF000000) >> 24)) ) << 24 | cmb.ccolor=(uint8_t)( 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 | (uint8_t)( 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 ; (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 () static void cc__env_inter_prim_using_t0a__mul_t0 ()
@ -9253,7 +9253,7 @@ static void ac__t1_sub_t0_mul_enva_add_t1__mul_prim ()
} }
else else
{ {
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF); uint8_t factor = (uint8_t)(rdp.env_color&0xFF);
A_T0_INTER_T1_USING_FACTOR (factor); A_T0_INTER_T1_USING_FACTOR (factor);
} }
} }
@ -9832,7 +9832,7 @@ static void ac__t0_inter_t1_using_enva__mul_prim_add_env ()
GR_COMBINE_OTHER_ITERATED); GR_COMBINE_OTHER_ITERATED);
SETSHADE_A_PRIM (); SETSHADE_A_PRIM ();
CA_ENV (); 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); A_T0_INTER_T1_USING_FACTOR (factor);
} }
@ -11100,7 +11100,7 @@ static void ac_t0_inter_t1_using_prima ()
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE); 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); A_T0_INTER_T1_USING_FACTOR (factor);
} }
@ -11110,7 +11110,7 @@ static void ac_t1_inter_t0_using_prima ()
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE); 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); A_T1_INTER_T0_USING_FACTOR (factor);
} }
@ -11129,7 +11129,7 @@ static void ac_t0_inter_t1_using_enva ()
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE); 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); A_T0_INTER_T1_USING_FACTOR (factor);
} }
@ -11139,7 +11139,7 @@ static void ac_t1_inter_t0_using_enva ()
GR_COMBINE_FACTOR_ONE, GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE, GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE); 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); A_T1_INTER_T0_USING_FACTOR (factor);
} }
@ -11257,7 +11257,7 @@ static void ac__t0_inter_t1_using_prima__mul_env ()
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE); GR_COMBINE_OTHER_TEXTURE);
CA_ENV (); 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); A_T0_INTER_T1_USING_FACTOR (factor);
} }
@ -11289,7 +11289,7 @@ static void ac__t1_inter_t0_using_prima__mul_env ()
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE); GR_COMBINE_OTHER_TEXTURE);
CA_ENV (); 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); A_T1_INTER_T0_USING_FACTOR (factor);
} }
@ -11300,7 +11300,7 @@ static void ac__t0_inter_t1_using_prima__mul_shade ()
GR_COMBINE_FACTOR_LOCAL, GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_TEXTURE); 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); A_T0_INTER_T1_USING_FACTOR (factor);
} }
@ -11310,7 +11310,7 @@ static void ac__t1_inter_t0_using_prima__mul_shade ()
GR_COMBINE_FACTOR_LOCAL, GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_TEXTURE); 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); A_T1_INTER_T0_USING_FACTOR (factor);
} }
@ -11321,7 +11321,7 @@ static void ac__t0_inter_t1_using_enva__mul_prim ()
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE); GR_COMBINE_OTHER_TEXTURE);
CA_PRIM (); 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); A_T0_INTER_T1_USING_FACTOR (factor);
} }
@ -11348,7 +11348,7 @@ static void ac__env_sub_one_mul_t1_add_t0__mul_prim ()
} }
else else
{ {
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF); uint8_t factor = (uint8_t)(rdp.env_color&0xFF);
A_T0_INTER_T1_USING_FACTOR (factor); A_T0_INTER_T1_USING_FACTOR (factor);
} }
} }
@ -11360,7 +11360,7 @@ static void ac__t0_inter_t1_using_enva__mul_primlod ()
GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_TEXTURE); GR_COMBINE_OTHER_TEXTURE);
CA_PRIMLOD (); 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); A_T0_INTER_T1_USING_FACTOR (factor);
} }
@ -11482,7 +11482,7 @@ static void ac__t0_inter_t1_using_enva__mul_shade ()
GR_COMBINE_FACTOR_LOCAL, GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_TEXTURE); 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); A_T0_INTER_T1_USING_FACTOR (factor);
} }
@ -11609,7 +11609,7 @@ static void ac__t1_sub_one_mul_enva_add_t0__mul_shade ()
} }
else else
{ {
wxUint8 factor = (wxUint8)(rdp.env_color&0xFF); uint8_t factor = (uint8_t)(rdp.env_color&0xFF);
A_T0_INTER_T1_USING_FACTOR (factor); A_T0_INTER_T1_USING_FACTOR (factor);
} }
} }

View File

@ -75,7 +75,7 @@ typedef struct
uint32_t tex, tmu0_func, tmu0_fac, tmu0_invert, tmu1_func, tmu1_fac, tmu1_invert; 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; 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; int dc0_lodbias, dc1_lodbias;
wxUint8 dc0_detailscale, dc1_detailscale; uint8_t dc0_detailscale, dc1_detailscale;
float dc0_detailmax, dc1_detailmax; float dc0_detailmax, dc1_detailmax;
float lodbias0, lodbias1; float lodbias0, lodbias1;
uint32_t abf1, abf2; uint32_t abf1, abf2;
@ -101,8 +101,8 @@ typedef struct
GRCONSTANTCOLORVALUEEXT grConstantColorValueExt; GRCONSTANTCOLORVALUEEXT grConstantColorValueExt;
uint32_t tex_ccolor; uint32_t tex_ccolor;
int combine_ext; int combine_ext;
wxUint8 cmb_ext_use; uint8_t cmb_ext_use;
wxUint8 tex_cmb_ext_use; uint8_t tex_cmb_ext_use;
uint32_t shade_mod_hash; uint32_t shade_mod_hash;
} COMBINE; } COMBINE;

View File

@ -984,7 +984,7 @@ void output (float x, float y, int scale, const char *fmt, ...)
vsprintf(out_buf, fmt, ap); vsprintf(out_buf, fmt, ap);
va_end(ap); va_end(ap);
wxUint8 c,r; uint8_t c,r;
for (uint32_t i=0; i<strlen(out_buf); i++) for (uint32_t i=0; i<strlen(out_buf); i++)
{ {
c = ((out_buf[i]-32) & 0x1F) * 8;//<< 3; c = ((out_buf[i]-32) & 0x1F) * 8;//<< 3;

View File

@ -44,15 +44,15 @@
typedef struct TEX_INFO_t typedef struct TEX_INFO_t
{ {
uint32_t cur_cache[2]; // Current cache # uint32_t cur_cache[2]; // Current cache #
wxUint8 format; uint8_t format;
wxUint8 size; uint8_t size;
uint32_t width, height; uint32_t width, height;
wxUint16 line, wid; wxUint16 line, wid;
wxUint8 palette; uint8_t palette;
wxUint8 clamp_s, clamp_t; uint8_t clamp_s, clamp_t;
wxUint8 mirror_s, mirror_t; uint8_t mirror_s, mirror_t;
wxUint8 mask_s, mask_t; uint8_t mask_s, mask_t;
wxUint8 shift_s, shift_t; uint8_t shift_s, shift_t;
wxUint16 ul_s, ul_t, lr_s, lr_t; wxUint16 ul_s, ul_t, lr_s, lr_t;
wxUint16 t_ul_s, t_ul_t, t_lr_s, t_lr_t; wxUint16 t_ul_s, t_ul_t, t_lr_s, t_lr_t;
float scale_s, scale_t; float scale_s, scale_t;
@ -64,7 +64,7 @@ typedef struct TRI_INFO_t
uint32_t nv; // Number of vertices uint32_t nv; // Number of vertices
VERTEX *v; // Vertices (2d screen coords) of the triangle, used to outline VERTEX *v; // Vertices (2d screen coords) of the triangle, used to outline
uint32_t cycle1, cycle2, cycle_mode; // Combine mode at the time of rendering uint32_t cycle1, cycle2, cycle_mode; // Combine mode at the time of rendering
wxUint8 uncombined; // which is uncombined: 0x01=color 0x02=alpha 0x03=both uint8_t uncombined; // which is uncombined: 0x01=color 0x02=alpha 0x03=both
uint32_t geom_mode; // geometry mode flags uint32_t geom_mode; // geometry mode flags
uint32_t othermode_h; // setothermode_h flags uint32_t othermode_h; // setothermode_h flags
uint32_t othermode_l; // setothermode_l flags uint32_t othermode_l; // setothermode_l flags
@ -98,7 +98,7 @@ typedef struct DEBUGGER_t
uint32_t tex_sel; uint32_t tex_sel;
// CAPTURE INFORMATION // CAPTURE INFORMATION
wxUint8 *screen; // Screen capture uint8_t *screen; // Screen capture
TRI_INFO *tri_list; // Triangle information list TRI_INFO *tri_list; // Triangle information list
TRI_INFO *tri_last; // Last in the list (first in) TRI_INFO *tri_last; // Last in the list (first in)

View File

@ -158,19 +158,19 @@ static void DrawRE2Video256(FB_TO_SCREEN_INFO & fb_info)
wxUint16 * tex = (wxUint16*)texture_buffer; wxUint16 * tex = (wxUint16*)texture_buffer;
wxUint16 * dst = tex; wxUint16 * dst = tex;
uint32_t col; uint32_t col;
wxUint8 r, g, b; uint8_t r, g, b;
fb_info.height = min(256, fb_info.height); fb_info.height = min(256, fb_info.height);
for (uint32_t h = 0; h < fb_info.height; h++) for (uint32_t h = 0; h < fb_info.height; h++)
{ {
for (uint32_t w = 0; w < 256; w++) for (uint32_t w = 0; w < 256; w++)
{ {
col = *(src++); col = *(src++);
r = (wxUint8)((col >> 24)&0xFF); r = (uint8_t)((col >> 24)&0xFF);
r = (wxUint8)((float)r / 255.0f * 31.0f); r = (uint8_t)((float)r / 255.0f * 31.0f);
g = (wxUint8)((col >> 16)&0xFF); g = (uint8_t)((col >> 16)&0xFF);
g = (wxUint8)((float)g / 255.0f * 63.0f); g = (uint8_t)((float)g / 255.0f * 63.0f);
b = (wxUint8)((col >> 8)&0xFF); b = (uint8_t)((col >> 8)&0xFF);
b = (wxUint8)((float)b / 255.0f * 31.0f); b = (uint8_t)((float)b / 255.0f * 31.0f);
*(dst++) = (r << 11) | (g << 5) | b; *(dst++) = (r << 11) | (g << 5) | b;
} }
src += (fb_info.width - 256); src += (fb_info.width - 256);
@ -200,7 +200,7 @@ static void DrawFrameBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
uint32_t width = fb_info.lr_x - fb_info.ul_x + 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; uint32_t height = fb_info.lr_y - fb_info.ul_y + 1;
GrTexInfo t_info; GrTexInfo t_info;
wxUint8 * image = gfx.RDRAM+fb_info.addr; uint8_t * image = gfx.RDRAM+fb_info.addr;
uint32_t width256 = ((width-1) >> 8) + 1; uint32_t width256 = ((width-1) >> 8) + 1;
uint32_t height256 = ((height-1) >> 8) + 1; uint32_t height256 = ((height-1) >> 8) + 1;
t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256; t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256;
@ -221,7 +221,7 @@ static void DrawFrameBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
uint32_t idx; uint32_t idx;
uint32_t bound = BMASK+1-fb_info.addr; uint32_t bound = BMASK+1-fb_info.addr;
bound = fb_info.size == 2 ? bound >> 1 : bound >> 2; bound = fb_info.size == 2 ? bound >> 1 : bound >> 2;
wxUint8 r, g, b, a; uint8_t r, g, b, a;
uint32_t cur_width, cur_height, cur_tail; uint32_t cur_width, cur_height, cur_tail;
uint32_t tex_adr = voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu]; 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)) if ((voodoo.tmem_ptr[tmu] < TEXMEM_2MB_EDGE) && (voodoo.tmem_ptr[tmu]+tex_size*width256*height256 > TEXMEM_2MB_EDGE))
@ -261,12 +261,12 @@ static void DrawFrameBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
if (idx >= bound) if (idx >= bound)
break; break;
c32 = src32[idx]; c32 = src32[idx];
r = (wxUint8)((c32 >> 24)&0xFF); r = (uint8_t)((c32 >> 24)&0xFF);
r = (wxUint8)((float)r / 255.0f * 31.0f); r = (uint8_t)((float)r / 255.0f * 31.0f);
g = (wxUint8)((c32 >> 16)&0xFF); g = (uint8_t)((c32 >> 16)&0xFF);
g = (wxUint8)((float)g / 255.0f * 63.0f); g = (uint8_t)((float)g / 255.0f * 63.0f);
b = (wxUint8)((c32 >> 8)&0xFF); b = (uint8_t)((c32 >> 8)&0xFF);
b = (wxUint8)((float)b / 255.0f * 31.0f); b = (uint8_t)((float)b / 255.0f * 31.0f);
a = (c32&0xFF) ? 1 : 0; a = (c32&0xFF) ? 1 : 0;
*(dst++) = (a<<15) | (r << 10) | (g << 5) | b; *(dst++) = (a<<15) | (r << 10) | (g << 5) | b;
} }
@ -316,7 +316,7 @@ bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
} }
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); 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; GrTexInfo t_info;
wxUint8 * image = gfx.RDRAM+fb_info.addr; uint8_t * image = gfx.RDRAM+fb_info.addr;
uint32_t texwidth; uint32_t texwidth;
float scale; float scale;
if (width <= 256) if (width <= 256)
@ -434,7 +434,7 @@ static void DrawDepthBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
uint32_t width = fb_info.lr_x - fb_info.ul_x + 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; uint32_t height = fb_info.lr_y - fb_info.ul_y + 1;
GrTexInfo t_info; GrTexInfo t_info;
wxUint8 * image = gfx.RDRAM+fb_info.addr; uint8_t * image = gfx.RDRAM+fb_info.addr;
uint32_t width256 = ((width-1) >> 8) + 1; uint32_t width256 = ((width-1) >> 8) + 1;
uint32_t height256 = ((height-1) >> 8) + 1; uint32_t height256 = ((height-1) >> 8) + 1;
t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256; t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256;
@ -585,7 +585,7 @@ 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); 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; GrTexInfo t_info;
wxUint8 * image = gfx.RDRAM+fb_info.addr; uint8_t * image = gfx.RDRAM+fb_info.addr;
uint32_t texwidth; uint32_t texwidth;
float scale; float scale;
if (width <= 256) if (width <= 256)

View File

@ -333,8 +333,8 @@ void ReadSettings ()
settings.scr_res_x = settings.res_x = resolutions[settings.res_data][0]; 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.scr_res_y = settings.res_y = resolutions[settings.res_data][1];
settings.vsync = GetSetting(Set_vsync); settings.vsync = GetSetting(Set_vsync);
settings.ssformat = (wxUint8)GetSetting(Set_ssformat); settings.ssformat = (uint8_t)GetSetting(Set_ssformat);
settings.show_fps = (wxUint8)GetSetting(Set_ShowFps); settings.show_fps = (uint8_t)GetSetting(Set_ShowFps);
settings.clock = GetSetting(Set_clock); settings.clock = GetSetting(Set_clock);
settings.clock_24_hr = GetSetting(Set_clock_24_hr); settings.clock_24_hr = GetSetting(Set_clock_24_hr);
settings.advanced_options = Set_basic_mode ? !GetSystemSetting(Set_basic_mode) : 0; settings.advanced_options = Set_basic_mode ? !GetSystemSetting(Set_basic_mode) : 0;
@ -380,10 +380,10 @@ void ReadSettings ()
memset(texture_dir,0,sizeof(texture_dir)); memset(texture_dir,0,sizeof(texture_dir));
GetSystemSettingSz(Set_texture_dir,texture_dir,sizeof(texture_dir)); GetSystemSettingSz(Set_texture_dir,texture_dir,sizeof(texture_dir));
settings.texture_dir = texture_dir; settings.texture_dir = texture_dir;
settings.ghq_fltr = (wxUint8)GetSetting(Set_ghq_fltr); settings.ghq_fltr = (uint8_t)GetSetting(Set_ghq_fltr);
settings.ghq_cmpr = (wxUint8)GetSetting(Set_ghq_cmpr); settings.ghq_cmpr = (uint8_t)GetSetting(Set_ghq_cmpr);
settings.ghq_enht = (wxUint8)GetSetting(Set_ghq_enht); settings.ghq_enht = (uint8_t)GetSetting(Set_ghq_enht);
settings.ghq_hirs = (wxUint8)GetSetting(Set_ghq_hirs); settings.ghq_hirs = (uint8_t)GetSetting(Set_ghq_hirs);
settings.ghq_enht_cmpr = GetSetting(Set_ghq_enht_cmpr); settings.ghq_enht_cmpr = GetSetting(Set_ghq_enht_cmpr);
settings.ghq_enht_tile = GetSetting(Set_ghq_enht_tile); settings.ghq_enht_tile = GetSetting(Set_ghq_enht_tile);
settings.ghq_enht_f16bpp = GetSetting(Set_ghq_enht_f16bpp); settings.ghq_enht_f16bpp = GetSetting(Set_ghq_enht_f16bpp);
@ -717,7 +717,7 @@ void guLoadTextures ()
uint32_t cur; uint32_t cur;
// ** Font texture ** // ** 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.smallLodLog2 = fontTex.largeLodLog2 = GR_LOD_LOG2_256;
fontTex.aspectRatioLog2 = GR_ASPECT_LOG2_4x1; fontTex.aspectRatioLog2 = GR_ASPECT_LOG2_4x1;
@ -1223,8 +1223,8 @@ void CALL ReadScreen(void **dest, int *width, int *height)
{ {
*width = settings.res_x; *width = settings.res_x;
*height = settings.res_y; *height = settings.res_y;
wxUint8 * buff = (wxUint8*)malloc(settings.res_x * settings.res_y * 3); uint8_t * buff = (uint8_t*)malloc(settings.res_x * settings.res_y * 3);
wxUint8 * line = buff; uint8_t * line = buff;
*dest = (void*)buff; *dest = (void*)buff;
if (!fullscreen) if (!fullscreen)
@ -1254,19 +1254,19 @@ void CALL ReadScreen(void **dest, int *width, int *height)
uint32_t offset_src=info.strideInBytes*(settings.scr_res_y-1); uint32_t offset_src=info.strideInBytes*(settings.scr_res_y-1);
// Copy the screen // Copy the screen
wxUint8 r, g, b; uint8_t r, g, b;
if (info.writeMode == GR_LFBWRITEMODE_8888) if (info.writeMode == GR_LFBWRITEMODE_8888)
{ {
uint32_t col; uint32_t col;
for (uint32_t y=0; y<settings.res_y; y++) for (uint32_t y=0; y<settings.res_y; y++)
{ {
uint32_t *ptr = (uint32_t*)((wxUint8*)info.lfbPtr + offset_src); uint32_t *ptr = (uint32_t*)((uint8_t*)info.lfbPtr + offset_src);
for (uint32_t x=0; x<settings.res_x; x++) for (uint32_t x=0; x<settings.res_x; x++)
{ {
col = *(ptr++); col = *(ptr++);
r = (wxUint8)((col >> 16) & 0xFF); r = (uint8_t)((col >> 16) & 0xFF);
g = (wxUint8)((col >> 8) & 0xFF); g = (uint8_t)((col >> 8) & 0xFF);
b = (wxUint8)(col & 0xFF); b = (uint8_t)(col & 0xFF);
line[x*3] = b; line[x*3] = b;
line[x*3+1] = g; line[x*3+1] = g;
line[x*3+2] = r; line[x*3+2] = r;
@ -1280,13 +1280,13 @@ void CALL ReadScreen(void **dest, int *width, int *height)
wxUint16 col; wxUint16 col;
for (uint32_t y=0; y<settings.res_y; y++) for (uint32_t y=0; y<settings.res_y; y++)
{ {
wxUint16 *ptr = (wxUint16*)((wxUint8*)info.lfbPtr + offset_src); wxUint16 *ptr = (wxUint16*)((uint8_t*)info.lfbPtr + offset_src);
for (uint32_t x=0; x<settings.res_x; x++) for (uint32_t x=0; x<settings.res_x; x++)
{ {
col = *(ptr++); col = *(ptr++);
r = (wxUint8)((float)(col >> 11) / 31.0f * 255.0f); r = (uint8_t)((float)(col >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col >> 5) & 0x3F) / 63.0f * 255.0f); g = (uint8_t)((float)((col >> 5) & 0x3F) / 63.0f * 255.0f);
b = (wxUint8)((float)(col & 0x1F) / 31.0f * 255.0f); b = (uint8_t)((float)(col & 0x1F) / 31.0f * 255.0f);
line[x*3] = b; line[x*3] = b;
line[x*3+1] = g; line[x*3+1] = g;
line[x*3+2] = r; line[x*3+2] = r;
@ -1471,8 +1471,8 @@ void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo )
// If DLL supports memory these memory options then set them to TRUE or FALSE // If DLL supports memory these memory options then set them to TRUE or FALSE
// if it does not support it // if it does not support it
PluginInfo->NormalMemory = FALSE; // a normal wxUint8 array PluginInfo->NormalMemory = FALSE; // a normal uint8_t array
PluginInfo->MemoryBswaped = TRUE; // a normal wxUint8 array where the memory has been pre PluginInfo->MemoryBswaped = TRUE; // a normal uint8_t array where the memory has been pre
// bswap on a dword (32 bits) boundry // bswap on a dword (32 bits) boundry
} }
@ -2143,7 +2143,7 @@ void newSwapBuffers()
FXFALSE, FXFALSE,
&info)) &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; int sspos = 0;
uint32_t offset_src = info.strideInBytes * offset_y; uint32_t offset_src = info.strideInBytes * offset_y;
@ -2153,14 +2153,14 @@ void newSwapBuffers()
uint32_t col; uint32_t col;
for (uint32_t y = 0; y < image_height; y++) for (uint32_t y = 0; y < image_height; y++)
{ {
uint32_t *ptr = (uint32_t*)((wxUint8*)info.lfbPtr + offset_src); uint32_t *ptr = (uint32_t*)((uint8_t*)info.lfbPtr + offset_src);
ptr += offset_x; ptr += offset_x;
for (uint32_t x = 0; x < image_width; x++) for (uint32_t x = 0; x < image_width; x++)
{ {
col = *(ptr++); col = *(ptr++);
ssimg[sspos++] = (wxUint8)((col >> 16) & 0xFF); ssimg[sspos++] = (uint8_t)((col >> 16) & 0xFF);
ssimg[sspos++] = (wxUint8)((col >> 8) & 0xFF); ssimg[sspos++] = (uint8_t)((col >> 8) & 0xFF);
ssimg[sspos++] = (wxUint8)(col & 0xFF); ssimg[sspos++] = (uint8_t)(col & 0xFF);
} }
offset_src += info.strideInBytes; offset_src += info.strideInBytes;
} }
@ -2170,14 +2170,14 @@ void newSwapBuffers()
wxUint16 col; wxUint16 col;
for (uint32_t y = 0; y < image_height; y++) for (uint32_t y = 0; y < image_height; y++)
{ {
wxUint16 *ptr = (wxUint16*)((wxUint8*)info.lfbPtr + offset_src); wxUint16 *ptr = (wxUint16*)((uint8_t*)info.lfbPtr + offset_src);
ptr += offset_x; ptr += offset_x;
for (uint32_t x = 0; x < image_width; x++) for (uint32_t x = 0; x < image_width; x++)
{ {
col = *(ptr++); col = *(ptr++);
ssimg[sspos++] = (wxUint8)((float)(col >> 11) / 31.0f * 255.0f); ssimg[sspos++] = (uint8_t)((float)(col >> 11) / 31.0f * 255.0f);
ssimg[sspos++] = (wxUint8)((float)((col >> 5) & 0x3F) / 63.0f * 255.0f); ssimg[sspos++] = (uint8_t)((float)((col >> 5) & 0x3F) / 63.0f * 255.0f);
ssimg[sspos++] = (wxUint8)((float)(col & 0x1F) / 31.0f * 255.0f); ssimg[sspos++] = (uint8_t)((float)(col & 0x1F) / 31.0f * 255.0f);
} }
offset_src += info.strideInBytes; offset_src += info.strideInBytes;
} }
@ -2194,7 +2194,7 @@ void newSwapBuffers()
if (_debugger.capture) if (_debugger.capture)
{ {
// Allocate the screen // 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) // Lock the backbuffer (already rendered)
GrLfbInfo_t info; GrLfbInfo_t info;
@ -2213,22 +2213,22 @@ void newSwapBuffers()
{ {
if (info.writeMode == GR_LFBWRITEMODE_8888) if (info.writeMode == GR_LFBWRITEMODE_8888)
{ {
uint32_t *src = (uint32_t*)((wxUint8*)info.lfbPtr + offset_src); uint32_t *src = (uint32_t*)((uint8_t*)info.lfbPtr + offset_src);
wxUint16 *dst = (wxUint16*)(_debugger.screen + offset_dst); wxUint16 *dst = (wxUint16*)(_debugger.screen + offset_dst);
wxUint8 r, g, b; uint8_t r, g, b;
uint32_t col; uint32_t col;
for (unsigned int x = 0; x < settings.res_x; x++) for (unsigned int x = 0; x < settings.res_x; x++)
{ {
col = src[x]; col = src[x];
r = (wxUint8)((col >> 19) & 0x1F); r = (uint8_t)((col >> 19) & 0x1F);
g = (wxUint8)((col >> 10) & 0x3F); g = (uint8_t)((col >> 10) & 0x3F);
b = (wxUint8)((col >> 3) & 0x1F); b = (uint8_t)((col >> 3) & 0x1F);
dst[x] = (r<<11)|(g<<5)|b; dst[x] = (r<<11)|(g<<5)|b;
} }
} }
else 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_dst += settings.res_x << 1;
offset_src += info.strideInBytes; offset_src += info.strideInBytes;

View File

@ -677,7 +677,7 @@ static uint32_t CalcCRC(TBUFF_COLOR_IMAGE * pTCI)
result = *((uint32_t*)(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) else if (settings.fb_crc_mode == SETTINGS::fbcrcSafe)
{ {
wxUint8 * pSrc = gfx.RDRAM + pTCI->addr; uint8_t * pSrc = gfx.RDRAM + pTCI->addr;
const uint32_t nSize = pTCI->end_addr-pTCI->addr; const uint32_t nSize = pTCI->end_addr-pTCI->addr;
result = CRC32(0xFFFFFFFF, pSrc, 32); result = CRC32(0xFFFFFFFF, pSrc, 32);
result = CRC32(result, pSrc + (nSize>>1), 32); result = CRC32(result, pSrc + (nSize>>1), 32);
@ -695,7 +695,7 @@ int FindTextureBuffer(uint32_t addr, wxUint16 width)
uint32_t shift = 0; uint32_t shift = 0;
for (int i = 0; i < voodoo.num_tmu && !found; i++) 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++) for (int j = 0; j < rdp.texbufs[index].count && !found; j++)
{ {
rdp.tbuff_tex = &(rdp.texbufs[index].images[j]); rdp.tbuff_tex = &(rdp.texbufs[index].images[j]);

View File

@ -48,10 +48,10 @@
void LoadTex (int id, int tmu); void LoadTex (int id, int tmu);
wxUint8 tex1[1024*1024*4]; // temporary texture uint8_t tex1[1024*1024*4]; // temporary texture
wxUint8 tex2[1024*1024*4]; uint8_t tex2[1024*1024*4];
wxUint8 *texture; uint8_t *texture;
wxUint8 *texture_buffer = tex1; uint8_t *texture_buffer = tex1;
#include "TexLoad.h" // texture loading functions, ONLY INCLUDE IN THIS FILE!!! #include "TexLoad.h" // texture loading functions, ONLY INCLUDE IN THIS FILE!!!
#include "MiClWr32b.h" #include "MiClWr32b.h"
@ -86,7 +86,7 @@ int tex_found[2][MAX_TMU];
typedef struct HIRESTEX_t { typedef struct HIRESTEX_t {
int width, height; int width, height;
wxUint16 format; wxUint16 format;
wxUint8 *data; uint8_t *data;
} HIRESTEX; } HIRESTEX;
#endif #endif
@ -1300,7 +1300,7 @@ void LoadTex (int id, int tmu)
if (settings.ghq_use) if (settings.ghq_use)
{ {
int bpl; 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_width = texinfo[id].width;
int tile_height = texinfo[id].height; int tile_height = texinfo[id].height;
LOAD_TILE_INFO &info = rdp.load_info[rdp.tiles[td].t_mem]; LOAD_TILE_INFO &info = rdp.load_info[rdp.tiles[td].t_mem];
@ -1332,17 +1332,17 @@ void LoadTex (int id, int tmu)
} }
} }
// 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)); // 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));
wxUint8 * paladdr = 0; uint8_t * paladdr = 0;
wxUint16 * palette = 0; wxUint16 * palette = 0;
if ((rdp.tiles[td].size < 2) && (rdp.tlut_mode || rdp.tiles[td].format == 2)) if ((rdp.tiles[td].size < 2) && (rdp.tlut_mode || rdp.tiles[td].format == 2))
{ {
if (rdp.tiles[td].size == 1) 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) 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 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)); palette = (rdp.pal_8 + (rdp.tiles[td].palette << 4));
} }
@ -1681,7 +1681,7 @@ void LoadTex (int id, int tmu)
} }
else else
{ {
texture = (wxUint8 *)ghqTexInfo.data; texture = (uint8_t *)ghqTexInfo.data;
lod = ghqTexInfo.largeLodLog2; lod = ghqTexInfo.largeLodLog2;
int splits = cache->splits; int splits = cache->splits;
if (ghqTexInfo.is_hires_tex) if (ghqTexInfo.is_hires_tex)

View File

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

View File

@ -196,7 +196,7 @@ uint32_t Load16bIA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int li
// Size: 2, Format: 1 // Size: 2, Format: 1
// //
wxUint16 yuv_to_rgb565(wxUint8 y, wxUint8 u, wxUint8 v) wxUint16 yuv_to_rgb565(uint8_t y, uint8_t u, uint8_t v)
{ {
//* //*
float r = y + (1.370705f * (v-128)); float r = y + (1.370705f * (v-128));
@ -244,10 +244,10 @@ uint32_t Load16bYUV (wxUIntPtr dst, wxUIntPtr /*src*/, int /*wid_64*/, int /*hei
for (i = 0; i < 128; i++) for (i = 0; i < 128; i++)
{ {
uint32_t t = mb[i]; //each uint32_t contains 2 pixels uint32_t t = mb[i]; //each uint32_t contains 2 pixels
wxUint8 y1 = (wxUint8)t&0xFF; uint8_t y1 = (uint8_t)t&0xFF;
wxUint8 v = (wxUint8)(t>>8)&0xFF; uint8_t v = (uint8_t)(t>>8)&0xFF;
wxUint8 y0 = (wxUint8)(t>>16)&0xFF; uint8_t y0 = (uint8_t)(t>>16)&0xFF;
wxUint8 u = (wxUint8)(t>>24)&0xFF; uint8_t u = (uint8_t)(t>>24)&0xFF;
wxUint16 c = yuv_to_rgb565(y0, u, v); wxUint16 c = yuv_to_rgb565(y0, u, v);
*(tex++) = c; *(tex++) = c;
c = yuv_to_rgb565(y1, u, v); c = yuv_to_rgb565(y1, u, v);

View File

@ -43,7 +43,7 @@ static void mod_tex_inter_color_using_factor (wxUint16 *dst, int size, uint32_t
float percent_i = 1 - percent; float percent_i = 1 - percent;
uint32_t cr, cg, cb; uint32_t cr, cg, cb;
wxUint16 col, a; wxUint16 col, a;
wxUint8 r, g, b; uint8_t r, g, b;
cr = (color >> 12) & 0xF; cr = (color >> 12) & 0xF;
cg = (color >> 8) & 0xF; cg = (color >> 8) & 0xF;
@ -53,9 +53,9 @@ static void mod_tex_inter_color_using_factor (wxUint16 *dst, int size, uint32_t
{ {
col = *dst; col = *dst;
a = col & 0xF000; a = col & 0xF000;
r = (wxUint8)(percent_i * ((col >> 8) & 0xF) + percent * cr); r = (uint8_t)(percent_i * ((col >> 8) & 0xF) + percent * cr);
g = (wxUint8)(percent_i * ((col >> 4) & 0xF) + percent * cg); g = (uint8_t)(percent_i * ((col >> 4) & 0xF) + percent * cg);
b = (wxUint8)(percent_i * (col & 0xF) + percent * cb); b = (uint8_t)(percent_i * (col & 0xF) + percent * cb);
*(dst++) = a | (r << 8) | (g << 4) | b; *(dst++) = a | (r << 8) | (g << 4) | b;
} }
} }
@ -64,7 +64,7 @@ static void mod_tex_inter_col_using_col1 (wxUint16 *dst, int size, uint32_t colo
{ {
uint32_t cr, cg, cb; uint32_t cr, cg, cb;
wxUint16 col, a; wxUint16 col, a;
wxUint8 r, g, b; uint8_t r, g, b;
float percent_r = ((color1 >> 12) & 0xF) / 15.0f; float percent_r = ((color1 >> 12) & 0xF) / 15.0f;
float percent_g = ((color1 >> 8) & 0xF) / 15.0f; float percent_g = ((color1 >> 8) & 0xF) / 15.0f;
@ -81,9 +81,9 @@ static void mod_tex_inter_col_using_col1 (wxUint16 *dst, int size, uint32_t colo
{ {
col = *dst; col = *dst;
a = col & 0xF000; a = col & 0xF000;
r = (wxUint8)(percent_r_i * ((col >> 8) & 0xF) + percent_r * cr); r = (uint8_t)(percent_r_i * ((col >> 8) & 0xF) + percent_r * cr);
g = (wxUint8)(percent_g_i * ((col >> 4) & 0xF) + percent_g * cg); g = (uint8_t)(percent_g_i * ((col >> 4) & 0xF) + percent_g * cg);
b = (wxUint8)(percent_b_i * (col & 0xF) + percent_b * cb); b = (uint8_t)(percent_b_i * (col & 0xF) + percent_b * cb);
*(dst++) = a | (r << 8) | (g << 4) | b; *(dst++) = a | (r << 8) | (g << 4) | b;
} }
} }
@ -92,7 +92,7 @@ static void mod_full_color_sub_tex (wxUint16 *dst, int size, uint32_t color)
{ {
uint32_t cr, cg, cb, ca; uint32_t cr, cg, cb, ca;
wxUint16 col; wxUint16 col;
wxUint8 a, r, g, b; uint8_t a, r, g, b;
cr = (color >> 12) & 0xF; cr = (color >> 12) & 0xF;
cg = (color >> 8) & 0xF; cg = (color >> 8) & 0xF;
@ -102,10 +102,10 @@ static void mod_full_color_sub_tex (wxUint16 *dst, int size, uint32_t color)
for (int i=0; i<size; i++) for (int i=0; i<size; i++)
{ {
col = *dst; col = *dst;
a = (wxUint8)(ca - ((col >> 12) & 0xF)); a = (uint8_t)(ca - ((col >> 12) & 0xF));
r = (wxUint8)(cr - ((col >> 8) & 0xF)); r = (uint8_t)(cr - ((col >> 8) & 0xF));
g = (wxUint8)(cg - ((col >> 4) & 0xF)); g = (uint8_t)(cg - ((col >> 4) & 0xF));
b = (wxUint8)(cb - (col & 0xF)); b = (uint8_t)(cb - (col & 0xF));
*(dst++) = (a << 12) | (r << 8) | (g << 4) | b; *(dst++) = (a << 12) | (r << 8) | (g << 4) | b;
} }
} }
@ -114,7 +114,7 @@ static void mod_col_inter_col1_using_tex (wxUint16 *dst, int size, uint32_t colo
{ {
uint32_t cr0, cg0, cb0, cr1, cg1, cb1; uint32_t cr0, cg0, cb0, cr1, cg1, cb1;
wxUint16 col; wxUint16 col;
wxUint8 r, g, b; uint8_t r, g, b;
wxUint16 a; wxUint16 a;
float percent_r, percent_g, percent_b; float percent_r, percent_g, percent_b;
@ -132,9 +132,9 @@ static void mod_col_inter_col1_using_tex (wxUint16 *dst, int size, uint32_t colo
percent_r = ((col >> 8) & 0xF) / 15.0f; percent_r = ((col >> 8) & 0xF) / 15.0f;
percent_g = ((col >> 4) & 0xF) / 15.0f; percent_g = ((col >> 4) & 0xF) / 15.0f;
percent_b = (col & 0xF) / 15.0f; percent_b = (col & 0xF) / 15.0f;
r = min(15, (wxUint8)((1.0f-percent_r) * cr0 + percent_r * cr1 + 0.0001f)); r = min(15, (uint8_t)((1.0f-percent_r) * cr0 + percent_r * cr1 + 0.0001f));
g = min(15, (wxUint8)((1.0f-percent_g) * cg0 + percent_g * cg1 + 0.0001f)); g = min(15, (uint8_t)((1.0f-percent_g) * cg0 + percent_g * cg1 + 0.0001f));
b = min(15, (wxUint8)((1.0f-percent_b) * cb0 + percent_b * cb1 + 0.0001f)); b = min(15, (uint8_t)((1.0f-percent_b) * cb0 + percent_b * cb1 + 0.0001f));
*(dst++) = a | (r << 8) | (g << 4) | b; *(dst++) = a | (r << 8) | (g << 4) | b;
} }
} }
@ -143,7 +143,7 @@ static void mod_col_inter_col1_using_texa (wxUint16 *dst, int size, uint32_t col
{ {
uint32_t cr0, cg0, cb0, cr1, cg1, cb1; uint32_t cr0, cg0, cb0, cr1, cg1, cb1;
wxUint16 col; wxUint16 col;
wxUint8 r, g, b; uint8_t r, g, b;
wxUint16 a; wxUint16 a;
float percent, percent_i; float percent, percent_i;
@ -160,9 +160,9 @@ static void mod_col_inter_col1_using_texa (wxUint16 *dst, int size, uint32_t col
a = col & 0xF000; a = col & 0xF000;
percent = (a >> 12) / 15.0f; percent = (a >> 12) / 15.0f;
percent_i = 1.0f - percent; percent_i = 1.0f - percent;
r = (wxUint8)(percent_i * cr0 + percent * cr1); r = (uint8_t)(percent_i * cr0 + percent * cr1);
g = (wxUint8)(percent_i * cg0 + percent * cg1); g = (uint8_t)(percent_i * cg0 + percent * cg1);
b = (wxUint8)(percent_i * cb0 + percent * cb1); b = (uint8_t)(percent_i * cb0 + percent * cb1);
*(dst++) = a | (r << 8) | (g << 4) | b; *(dst++) = a | (r << 8) | (g << 4) | b;
} }
} }
@ -171,7 +171,7 @@ static void mod_col_inter_col1_using_texa__mul_tex (wxUint16 *dst, int size, uin
{ {
uint32_t cr0, cg0, cb0, cr1, cg1, cb1; uint32_t cr0, cg0, cb0, cr1, cg1, cb1;
wxUint16 col; wxUint16 col;
wxUint8 r, g, b; uint8_t r, g, b;
wxUint16 a; wxUint16 a;
float percent, percent_i; float percent, percent_i;
@ -188,9 +188,9 @@ static void mod_col_inter_col1_using_texa__mul_tex (wxUint16 *dst, int size, uin
a = col & 0xF000; a = col & 0xF000;
percent = (a >> 12) / 15.0f; percent = (a >> 12) / 15.0f;
percent_i = 1.0f - percent; percent_i = 1.0f - percent;
r = (wxUint8)(((percent_i * cr0 + percent * cr1) / 15.0f) * (((col & 0x0F00) >> 8) / 15.0f) * 15.0f); r = (uint8_t)(((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); g = (uint8_t)(((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); b = (uint8_t)(((percent_i * cb0 + percent * cb1) / 15.0f) * ((col & 0x000F) / 15.0f) * 15.0f);
*(dst++) = a | (r << 8) | (g << 4) | b; *(dst++) = a | (r << 8) | (g << 4) | b;
} }
} }
@ -199,7 +199,7 @@ static void mod_col_inter_tex_using_tex (wxUint16 *dst, int size, uint32_t color
{ {
uint32_t cr, cg, cb; uint32_t cr, cg, cb;
wxUint16 col; wxUint16 col;
wxUint8 r, g, b; uint8_t r, g, b;
wxUint16 a; wxUint16 a;
float percent_r, percent_g, percent_b; float percent_r, percent_g, percent_b;
@ -214,9 +214,9 @@ static void mod_col_inter_tex_using_tex (wxUint16 *dst, int size, uint32_t color
percent_r = ((col >> 8) & 0xF) / 15.0f; percent_r = ((col >> 8) & 0xF) / 15.0f;
percent_g = ((col >> 4) & 0xF) / 15.0f; percent_g = ((col >> 4) & 0xF) / 15.0f;
percent_b = (col & 0xF) / 15.0f; percent_b = (col & 0xF) / 15.0f;
r = (wxUint8)((1.0f-percent_r) * cr + percent_r * ((col & 0x0F00) >> 8)); r = (uint8_t)((1.0f-percent_r) * cr + percent_r * ((col & 0x0F00) >> 8));
g = (wxUint8)((1.0f-percent_g) * cg + percent_g * ((col & 0x00F0) >> 4)); g = (uint8_t)((1.0f-percent_g) * cg + percent_g * ((col & 0x00F0) >> 4));
b = (wxUint8)((1.0f-percent_b) * cb + percent_b * (col & 0x000F)); b = (uint8_t)((1.0f-percent_b) * cb + percent_b * (col & 0x000F));
*(dst++) = a | (r << 8) | (g << 4) | b; *(dst++) = a | (r << 8) | (g << 4) | b;
} }
} }
@ -225,7 +225,7 @@ static void mod_col_inter_tex_using_texa (wxUint16 *dst, int size, uint32_t colo
{ {
uint32_t cr, cg, cb; uint32_t cr, cg, cb;
wxUint16 col; wxUint16 col;
wxUint8 r, g, b; uint8_t r, g, b;
wxUint16 a; wxUint16 a;
float percent, percent_i; float percent, percent_i;
@ -239,9 +239,9 @@ static void mod_col_inter_tex_using_texa (wxUint16 *dst, int size, uint32_t colo
a = col & 0xF000; a = col & 0xF000;
percent = (a >> 12) / 15.0f; percent = (a >> 12) / 15.0f;
percent_i = 1.0f - percent; percent_i = 1.0f - percent;
r = (wxUint8)(percent_i * cr + percent * ((col & 0x0F00) >> 8)); r = (uint8_t)(percent_i * cr + percent * ((col & 0x0F00) >> 8));
g = (wxUint8)(percent_i * cg + percent * ((col & 0x00F0) >> 4)); g = (uint8_t)(percent_i * cg + percent * ((col & 0x00F0) >> 4));
b = (wxUint8)(percent_i * cb + percent * (col & 0x000F)); b = (uint8_t)(percent_i * cb + percent * (col & 0x000F));
*(dst++) = a | (r << 8) | (g << 4) | b; *(dst++) = a | (r << 8) | (g << 4) | b;
} }
} }
@ -252,7 +252,7 @@ static void mod_col2_inter__col_inter_col1_using_tex__using_texa (wxUint16 *dst,
{ {
uint32_t cr0, cg0, cb0, cr1, cg1, cb1, cr2, cg2, cb2; uint32_t cr0, cg0, cb0, cr1, cg1, cb1, cr2, cg2, cb2;
wxUint16 col; wxUint16 col;
wxUint8 r, g, b; uint8_t r, g, b;
wxUint16 a; wxUint16 a;
float percent_r, percent_g, percent_b, percent_a; float percent_r, percent_g, percent_b, percent_a;
@ -274,9 +274,9 @@ static void mod_col2_inter__col_inter_col1_using_tex__using_texa (wxUint16 *dst,
percent_r = ((col >> 8) & 0xF) / 15.0f; percent_r = ((col >> 8) & 0xF) / 15.0f;
percent_g = ((col >> 4) & 0xF) / 15.0f; percent_g = ((col >> 4) & 0xF) / 15.0f;
percent_b = (col & 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)); r = (uint8_t)(((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)); g = (uint8_t)(((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)); 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; *(dst++) = a | (r << 8) | (g << 4) | b;
} }
} }
@ -285,13 +285,13 @@ static void mod_tex_scale_fac_add_fac (wxUint16 *dst, int size, uint32_t factor)
{ {
float percent = factor / 255.0f; float percent = factor / 255.0f;
wxUint16 col; wxUint16 col;
wxUint8 a; uint8_t a;
float base_a = (1.0f - percent) * 15.0f; float base_a = (1.0f - percent) * 15.0f;
for (int i=0; i<size; i++) for (int i=0; i<size; i++)
{ {
col = *dst; col = *dst;
a = (wxUint8)(base_a + percent * (col>>12)); a = (uint8_t)(base_a + percent * (col>>12));
*(dst++) = (a<<12) | (col & 0x0FFF); *(dst++) = (a<<12) | (col & 0x0FFF);
} }
} }
@ -332,7 +332,7 @@ static void mod_tex_scale_col_add_col (wxUint16 *dst, int size, uint32_t color0,
{ {
uint32_t cr0, cg0, cb0, cr1, cg1, cb1; uint32_t cr0, cg0, cb0, cr1, cg1, cb1;
wxUint16 col; wxUint16 col;
wxUint8 r, g, b; uint8_t r, g, b;
wxUint16 a; wxUint16 a;
float percent_r, percent_g, percent_b; float percent_r, percent_g, percent_b;
@ -350,9 +350,9 @@ static void mod_tex_scale_col_add_col (wxUint16 *dst, int size, uint32_t color0,
percent_r = ((col >> 8) & 0xF) / 15.0f; percent_r = ((col >> 8) & 0xF) / 15.0f;
percent_g = ((col >> 4) & 0xF) / 15.0f; percent_g = ((col >> 4) & 0xF) / 15.0f;
percent_b = (col & 0xF) / 15.0f; percent_b = (col & 0xF) / 15.0f;
r = min(15, (wxUint8)(percent_r * cr0 + cr1 + 0.0001f)); r = min(15, (uint8_t)(percent_r * cr0 + cr1 + 0.0001f));
g = min(15, (wxUint8)(percent_g * cg0 + cg1 + 0.0001f)); g = min(15, (uint8_t)(percent_g * cg0 + cg1 + 0.0001f));
b = min(15, (wxUint8)(percent_b * cb0 + cb1 + 0.0001f)); b = min(15, (uint8_t)(percent_b * cb0 + cb1 + 0.0001f));
*(dst++) = a | (r << 8) | (g << 4) | b; *(dst++) = a | (r << 8) | (g << 4) | b;
} }
} }
@ -361,7 +361,7 @@ static void mod_tex_add_col (wxUint16 *dst, int size, uint32_t color)
{ {
uint32_t cr, cg, cb; uint32_t cr, cg, cb;
wxUint16 col; wxUint16 col;
wxUint8 a, r, g, b; uint8_t a, r, g, b;
cr = (color >> 12) & 0xF; cr = (color >> 12) & 0xF;
cg = (color >> 8) & 0xF; cg = (color >> 8) & 0xF;
@ -370,11 +370,11 @@ static void mod_tex_add_col (wxUint16 *dst, int size, uint32_t color)
for (int i=0; i<size; i++) for (int i=0; i<size; i++)
{ {
col = *dst; col = *dst;
a = (wxUint8)((col >> 12) & 0xF); a = (uint8_t)((col >> 12) & 0xF);
// a = col & 0xF000; // a = col & 0xF000;
r = (wxUint8)(cr + ((col >> 8) & 0xF))&0xF; r = (uint8_t)(cr + ((col >> 8) & 0xF))&0xF;
g = (wxUint8)(cg + ((col >> 4) & 0xF))&0xF; g = (uint8_t)(cg + ((col >> 4) & 0xF))&0xF;
b = (wxUint8)(cb + (col & 0xF))&0xF; b = (uint8_t)(cb + (col & 0xF))&0xF;
*(dst++) = (a << 12) | (r << 8) | (g << 4) | b; *(dst++) = (a << 12) | (r << 8) | (g << 4) | b;
} }
} }
@ -383,7 +383,7 @@ static void mod_col_mul_texa_add_tex (wxUint16 *dst, int size, uint32_t color)
{ {
uint32_t cr, cg, cb; uint32_t cr, cg, cb;
wxUint16 col; wxUint16 col;
wxUint8 r, g, b; uint8_t r, g, b;
wxUint16 a; wxUint16 a;
float factor; float factor;
@ -396,9 +396,9 @@ static void mod_col_mul_texa_add_tex (wxUint16 *dst, int size, uint32_t color)
col = *dst; col = *dst;
a = col & 0xF000; a = col & 0xF000;
factor = (a >> 12) / 15.0f; factor = (a >> 12) / 15.0f;
r = (wxUint8)(cr*factor + ((col >> 8) & 0xF))&0xF; r = (uint8_t)(cr*factor + ((col >> 8) & 0xF))&0xF;
g = (wxUint8)(cg*factor + ((col >> 4) & 0xF))&0xF; g = (uint8_t)(cg*factor + ((col >> 4) & 0xF))&0xF;
b = (wxUint8)(cb*factor + (col & 0xF))&0xF; b = (uint8_t)(cb*factor + (col & 0xF))&0xF;
*(dst++) = a | (r << 8) | (g << 4) | b; *(dst++) = a | (r << 8) | (g << 4) | b;
} }
} }
@ -407,7 +407,7 @@ static void mod_tex_sub_col (wxUint16 *dst, int size, uint32_t color)
{ {
int cr, cg, cb; int cr, cg, cb;
wxUint16 col; wxUint16 col;
wxUint8 a, r, g, b; uint8_t a, r, g, b;
cr = (color >> 12) & 0xF; cr = (color >> 12) & 0xF;
cg = (color >> 8) & 0xF; cg = (color >> 8) & 0xF;
@ -416,10 +416,10 @@ static void mod_tex_sub_col (wxUint16 *dst, int size, uint32_t color)
for (int i=0; i<size; i++) for (int i=0; i<size; i++)
{ {
col = *dst; col = *dst;
a = (wxUint8)(col & 0xF000); a = (uint8_t)(col & 0xF000);
r = (wxUint8)max((((col >> 8) & 0xF) - cr), 0); r = (uint8_t)max((((col >> 8) & 0xF) - cr), 0);
g = (wxUint8)max((((col >> 4) & 0xF) - cg), 0); g = (uint8_t)max((((col >> 4) & 0xF) - cg), 0);
b = (wxUint8)max(((col & 0xF) - cb), 0); b = (uint8_t)max(((col & 0xF) - cb), 0);
*(dst++) = (a << 12) | (r << 8) | (g << 4) | b; *(dst++) = (a << 12) | (r << 8) | (g << 4) | b;
} }
} }
@ -438,7 +438,7 @@ static void mod_tex_sub_col_mul_fac (wxUint16 *dst, int size, uint32_t color, ui
for (int i=0; i<size; i++) for (int i=0; i<size; i++)
{ {
col = *dst; col = *dst;
a = (wxUint8)((col >> 12) & 0xF); a = (uint8_t)((col >> 12) & 0xF);
r = (float)((col >> 8) & 0xF); r = (float)((col >> 8) & 0xF);
r = (r - cr) * percent; r = (r - cr) * percent;
if (r > 15.0f) r = 15.0f; if (r > 15.0f) r = 15.0f;
@ -460,7 +460,7 @@ static void mod_col_inter_tex_using_col1 (wxUint16 *dst, int size, uint32_t colo
{ {
uint32_t cr, cg, cb; uint32_t cr, cg, cb;
wxUint16 col, a; wxUint16 col, a;
wxUint8 r, g, b; uint8_t r, g, b;
float percent_r = ((color1 >> 12) & 0xF) / 15.0f; float percent_r = ((color1 >> 12) & 0xF) / 15.0f;
float percent_g = ((color1 >> 8) & 0xF) / 15.0f; float percent_g = ((color1 >> 8) & 0xF) / 15.0f;
@ -476,10 +476,10 @@ static void mod_col_inter_tex_using_col1 (wxUint16 *dst, int size, uint32_t colo
for (int i=0; i<size; i++) for (int i=0; i<size; i++)
{ {
col = *dst; col = *dst;
a = (wxUint8)((col >> 12) & 0xF); a = (uint8_t)((col >> 12) & 0xF);
r = (wxUint8)(percent_r * ((col >> 8) & 0xF) + percent_r_i * cr); r = (uint8_t)(percent_r * ((col >> 8) & 0xF) + percent_r_i * cr);
g = (wxUint8)(percent_g * ((col >> 4) & 0xF) + percent_g_i * cg); g = (uint8_t)(percent_g * ((col >> 4) & 0xF) + percent_g_i * cg);
b = (wxUint8)(percent_b * (col & 0xF) + percent_b_i * cb); b = (uint8_t)(percent_b * (col & 0xF) + percent_b_i * cb);
*(dst++) = (a << 12) | (r << 8) | (g << 4) | b; *(dst++) = (a << 12) | (r << 8) | (g << 4) | b;
} }
} }
@ -487,7 +487,7 @@ static void mod_col_inter_tex_using_col1 (wxUint16 *dst, int size, uint32_t colo
static void mod_tex_inter_noise_using_col (wxUint16 *dst, int size, uint32_t color) static void mod_tex_inter_noise_using_col (wxUint16 *dst, int size, uint32_t color)
{ {
wxUint16 col, a; wxUint16 col, a;
wxUint8 r, g, b, noise; uint8_t r, g, b, noise;
float percent_r = ((color >> 12) & 0xF) / 15.0f; float percent_r = ((color >> 12) & 0xF) / 15.0f;
float percent_g = ((color >> 8) & 0xF) / 15.0f; float percent_g = ((color >> 8) & 0xF) / 15.0f;
@ -501,9 +501,9 @@ static void mod_tex_inter_noise_using_col (wxUint16 *dst, int size, uint32_t col
col = *dst; col = *dst;
a = col & 0xF000; a = col & 0xF000;
noise = rand()%16; noise = rand()%16;
r = (wxUint8)(percent_r_i * ((col >> 8) & 0xF) + percent_r * noise); r = (uint8_t)(percent_r_i * ((col >> 8) & 0xF) + percent_r * noise);
g = (wxUint8)(percent_g_i * ((col >> 4) & 0xF) + percent_g * noise); g = (uint8_t)(percent_g_i * ((col >> 4) & 0xF) + percent_g * noise);
b = (wxUint8)(percent_b_i * (col & 0xF) + percent_b * noise); b = (uint8_t)(percent_b_i * (col & 0xF) + percent_b * noise);
*(dst++) = a | (r << 8) | (g << 4) | b; *(dst++) = a | (r << 8) | (g << 4) | b;
} }
} }
@ -512,7 +512,7 @@ static void mod_tex_inter_col_using_texa (wxUint16 *dst, int size, uint32_t colo
{ {
uint32_t cr, cg, cb; uint32_t cr, cg, cb;
wxUint16 col; wxUint16 col;
wxUint8 r, g, b; uint8_t r, g, b;
wxUint16 a; wxUint16 a;
float percent, percent_i; float percent, percent_i;
@ -526,9 +526,9 @@ static void mod_tex_inter_col_using_texa (wxUint16 *dst, int size, uint32_t colo
a = col & 0xF000; a = col & 0xF000;
percent = (a >> 12) / 15.0f; percent = (a >> 12) / 15.0f;
percent_i = 1.0f - percent; percent_i = 1.0f - percent;
r = (wxUint8)(percent * cr + percent_i * ((col & 0x0F00) >> 8)); r = (uint8_t)(percent * cr + percent_i * ((col & 0x0F00) >> 8));
g = (wxUint8)(percent * cg + percent_i * ((col & 0x00F0) >> 4)); g = (uint8_t)(percent * cg + percent_i * ((col & 0x00F0) >> 4));
b = (wxUint8)(percent * cb + percent_i * (col & 0x000F)); b = (uint8_t)(percent * cb + percent_i * (col & 0x000F));
*(dst++) = a | (r << 8) | (g << 4) | b; *(dst++) = a | (r << 8) | (g << 4) | b;
} }
} }
@ -537,7 +537,7 @@ static void mod_tex_mul_col (wxUint16 *dst, int size, uint32_t color)
{ {
float cr, cg, cb; float cr, cg, cb;
wxUint16 col; wxUint16 col;
wxUint8 r, g, b; uint8_t r, g, b;
wxUint16 a; wxUint16 a;
cr = (float)((color >> 12) & 0xF)/16.0f; cr = (float)((color >> 12) & 0xF)/16.0f;
@ -548,9 +548,9 @@ static void mod_tex_mul_col (wxUint16 *dst, int size, uint32_t color)
{ {
col = *dst; col = *dst;
a = col & 0xF000; a = col & 0xF000;
r = (wxUint8)(cr * ((col & 0x0F00) >> 8)); r = (uint8_t)(cr * ((col & 0x0F00) >> 8));
g = (wxUint8)(cg * ((col & 0x00F0) >> 4)); g = (uint8_t)(cg * ((col & 0x00F0) >> 4));
b = (wxUint8)(cb * (col & 0x000F)); b = (uint8_t)(cb * (col & 0x000F));
*(dst++) = a | (r << 8) | (g << 4) | b; *(dst++) = a | (r << 8) | (g << 4) | b;
} }
} }
@ -572,6 +572,6 @@ static void mod_tex_scale_fac_add_col (wxUint16 *dst, int size, uint32_t color,
r = cr + percent * (float)((col>>8)&0xF); r = cr + percent * (float)((col>>8)&0xF);
g = cg + percent * (float)((col>>4)&0xF); g = cg + percent * (float)((col>>4)&0xF);
b = cb + percent * (float)(col&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

@ -41,24 +41,24 @@ static void mod_tex_inter_color_using_factor_CI (uint32_t color, uint32_t factor
{ {
float percent = factor / 255.0f; float percent = factor / 255.0f;
float percent_i = 1 - percent; float percent_i = 1 - percent;
wxUint8 cr, cg, cb; uint8_t cr, cg, cb;
wxUint16 col; wxUint16 col;
wxUint8 a, r, g, b; uint8_t a, r, g, b;
cr = (wxUint8)((color >> 24) & 0xFF); cr = (uint8_t)((color >> 24) & 0xFF);
cg = (wxUint8)((color >> 16) & 0xFF); cg = (uint8_t)((color >> 16) & 0xFF);
cb = (wxUint8)((color >> 8) & 0xFF); cb = (uint8_t)((color >> 8) & 0xFF);
for (int i=0; i<256; i++) for (int i=0; i<256; i++)
{ {
col = rdp.pal_8[i]; col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);; a = (uint8_t)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f); r = (uint8_t)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f); g = (uint8_t)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f); b = (uint8_t)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = (wxUint8)(min(255, percent_i * r + percent * cr)); r = (uint8_t)(min(255, percent_i * r + percent * cr));
g = (wxUint8)(min(255, percent_i * g + percent * cg)); g = (uint8_t)(min(255, percent_i * g + percent * cg));
b = (wxUint8)(min(255, percent_i * b + percent * cb)); b = (uint8_t)(min(255, percent_i * b + percent * cb));
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) | rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) | ((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) | ((wxUint16)(b >> 3) << 1) |
@ -68,9 +68,9 @@ static void mod_tex_inter_color_using_factor_CI (uint32_t color, uint32_t factor
static void mod_tex_inter_col_using_col1_CI (uint32_t color0, uint32_t color1) static void mod_tex_inter_col_using_col1_CI (uint32_t color0, uint32_t color1)
{ {
wxUint8 cr, cg, cb; uint8_t cr, cg, cb;
wxUint16 col; wxUint16 col;
wxUint8 a, r, g, b; uint8_t a, r, g, b;
float percent_r = ((color1 >> 24) & 0xFF) / 255.0f; float percent_r = ((color1 >> 24) & 0xFF) / 255.0f;
float percent_g = ((color1 >> 16) & 0xFF) / 255.0f; float percent_g = ((color1 >> 16) & 0xFF) / 255.0f;
@ -79,20 +79,20 @@ static void mod_tex_inter_col_using_col1_CI (uint32_t color0, uint32_t color1)
float percent_g_i = 1.0f - percent_g; float percent_g_i = 1.0f - percent_g;
float percent_b_i = 1.0f - percent_b; float percent_b_i = 1.0f - percent_b;
cr = (wxUint8)((color0 >> 24) & 0xFF); cr = (uint8_t)((color0 >> 24) & 0xFF);
cg = (wxUint8)((color0 >> 16) & 0xFF); cg = (uint8_t)((color0 >> 16) & 0xFF);
cb = (wxUint8)((color0 >> 8) & 0xFF); cb = (uint8_t)((color0 >> 8) & 0xFF);
for (int i=0; i<256; i++) for (int i=0; i<256; i++)
{ {
col = rdp.pal_8[i]; col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);; a = (uint8_t)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f); r = (uint8_t)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f); g = (uint8_t)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f); b = (uint8_t)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = (wxUint8)(min(255, percent_r_i * r + percent_r * cr)); r = (uint8_t)(min(255, percent_r_i * r + percent_r * cr));
g = (wxUint8)(min(255, percent_g_i * g + percent_g * cg)); g = (uint8_t)(min(255, percent_g_i * g + percent_g * cg));
b = (wxUint8)(min(255, percent_b_i * b + percent_b * cb)); b = (uint8_t)(min(255, percent_b_i * b + percent_b * cb));
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) | rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) | ((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) | ((wxUint16)(b >> 3) << 1) |
@ -102,22 +102,22 @@ static void mod_tex_inter_col_using_col1_CI (uint32_t color0, uint32_t color1)
static void mod_full_color_sub_tex_CI (uint32_t color) static void mod_full_color_sub_tex_CI (uint32_t color)
{ {
wxUint8 cr, cg, cb, ca; uint8_t cr, cg, cb, ca;
wxUint16 col; wxUint16 col;
wxUint8 a, r, g, b; uint8_t a, r, g, b;
cr = (wxUint8)((color >> 24) & 0xFF); cr = (uint8_t)((color >> 24) & 0xFF);
cg = (wxUint8)((color >> 16) & 0xFF); cg = (uint8_t)((color >> 16) & 0xFF);
cb = (wxUint8)((color >> 8) & 0xFF); cb = (uint8_t)((color >> 8) & 0xFF);
ca = (wxUint8)(color & 0xFF); ca = (uint8_t)(color & 0xFF);
for (int i=0; i<256; i++) for (int i=0; i<256; i++)
{ {
col = rdp.pal_8[i]; col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);; a = (uint8_t)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f); r = (uint8_t)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f); g = (uint8_t)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f); b = (uint8_t)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
a = max(0, ca - a); a = max(0, ca - a);
r = max(0, cr - r); r = max(0, cr - r);
g = max(0, cg - g); g = max(0, cg - g);
@ -133,26 +133,26 @@ static void mod_col_inter_col1_using_tex_CI (uint32_t color0, uint32_t color1)
{ {
uint32_t cr0, cg0, cb0, cr1, cg1, cb1; uint32_t cr0, cg0, cb0, cr1, cg1, cb1;
wxUint16 col; wxUint16 col;
wxUint8 a, r, g, b; uint8_t a, r, g, b;
float percent_r, percent_g, percent_b; float percent_r, percent_g, percent_b;
cr0 = (wxUint8)((color0 >> 24) & 0xFF); cr0 = (uint8_t)((color0 >> 24) & 0xFF);
cg0 = (wxUint8)((color0 >> 16) & 0xFF); cg0 = (uint8_t)((color0 >> 16) & 0xFF);
cb0 = (wxUint8)((color0 >> 8) & 0xFF); cb0 = (uint8_t)((color0 >> 8) & 0xFF);
cr1 = (wxUint8)((color1 >> 24) & 0xFF); cr1 = (uint8_t)((color1 >> 24) & 0xFF);
cg1 = (wxUint8)((color1 >> 16) & 0xFF); cg1 = (uint8_t)((color1 >> 16) & 0xFF);
cb1 = (wxUint8)((color1 >> 8) & 0xFF); cb1 = (uint8_t)((color1 >> 8) & 0xFF);
for (int i=0; i<256; i++) for (int i=0; i<256; i++)
{ {
col = rdp.pal_8[i]; col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);; a = (uint8_t)(col&0x0001);;
percent_r = ((col&0xF800) >> 11) / 31.0f; percent_r = ((col&0xF800) >> 11) / 31.0f;
percent_g = ((col&0x07C0) >> 6) / 31.0f; percent_g = ((col&0x07C0) >> 6) / 31.0f;
percent_b = ((col&0x003E) >> 1) / 31.0f; percent_b = ((col&0x003E) >> 1) / 31.0f;
r = (wxUint8)(min((1.0f-percent_r) * cr0 + percent_r * cr1, 255)); r = (uint8_t)(min((1.0f-percent_r) * cr0 + percent_r * cr1, 255));
g = (wxUint8)(min((1.0f-percent_g) * cg0 + percent_g * cg1, 255)); g = (uint8_t)(min((1.0f-percent_g) * cg0 + percent_g * cg1, 255));
b = (wxUint8)(min((1.0f-percent_b) * cb0 + percent_b * cb1, 255)); b = (uint8_t)(min((1.0f-percent_b) * cb0 + percent_b * cb1, 255));
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) | rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) | ((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) | ((wxUint16)(b >> 3) << 1) |
@ -165,21 +165,21 @@ static void mod_col_inter_col1_using_tex_CI (uint32_t color0, uint32_t color1)
static void mod_tex_sub_col_mul_fac_add_tex_CI (uint32_t color, uint32_t factor) static void mod_tex_sub_col_mul_fac_add_tex_CI (uint32_t color, uint32_t factor)
{ {
float percent = factor / 255.0f; float percent = factor / 255.0f;
wxUint8 cr, cg, cb, a; uint8_t cr, cg, cb, a;
wxUint16 col; wxUint16 col;
float r, g, b; float r, g, b;
cr = (wxUint8)((color >> 24) & 0xFF); cr = (uint8_t)((color >> 24) & 0xFF);
cg = (wxUint8)((color >> 16) & 0xFF); cg = (uint8_t)((color >> 16) & 0xFF);
cb = (wxUint8)((color >> 8) & 0xFF); cb = (uint8_t)((color >> 8) & 0xFF);
for (int i=0; i<256; i++) for (int i=0; i<256; i++)
{ {
col = rdp.pal_8[i]; col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);; a = (uint8_t)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f); r = (uint8_t)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f); g = (uint8_t)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f); b = (uint8_t)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = (r - cr) * percent + r; r = (r - cr) * percent + r;
if (r > 255.0f) r = 255.0f; if (r > 255.0f) r = 255.0f;
if (r < 0.0f) r = 0.0f; if (r < 0.0f) r = 0.0f;
@ -189,36 +189,36 @@ static void mod_tex_sub_col_mul_fac_add_tex_CI (uint32_t color, uint32_t factor)
b = (b - cb) * percent + b; b = (b - cb) * percent + b;
if (b > 255.0f) g = 255.0f; if (b > 255.0f) g = 255.0f;
if (b < 0.0f) b = 0.0f; if (b < 0.0f) b = 0.0f;
rdp.pal_8[i] = (wxUint16)(((wxUint16)((wxUint8)(r) >> 3) << 11) | rdp.pal_8[i] = (wxUint16)(((wxUint16)((uint8_t)(r) >> 3) << 11) |
((wxUint16)((wxUint8)(g) >> 3) << 6) | ((wxUint16)((uint8_t)(g) >> 3) << 6) |
((wxUint16)((wxUint8)(b) >> 3) << 1) | ((wxUint16)((uint8_t)(b) >> 3) << 1) |
(wxUint16)(a) ); (wxUint16)(a) );
} }
} }
static void mod_tex_scale_col_add_col_CI (uint32_t color0, uint32_t color1) static void mod_tex_scale_col_add_col_CI (uint32_t color0, uint32_t color1)
{ {
wxUint8 cr, cg, cb; uint8_t cr, cg, cb;
wxUint16 col; wxUint16 col;
wxUint8 a, r, g, b; uint8_t a, r, g, b;
float percent_r = ((color0 >> 24) & 0xFF) / 255.0f; float percent_r = ((color0 >> 24) & 0xFF) / 255.0f;
float percent_g = ((color0 >> 16) & 0xFF) / 255.0f; float percent_g = ((color0 >> 16) & 0xFF) / 255.0f;
float percent_b = ((color0 >> 8) & 0xFF) / 255.0f; float percent_b = ((color0 >> 8) & 0xFF) / 255.0f;
cr = (wxUint8)((color1 >> 24) & 0xFF); cr = (uint8_t)((color1 >> 24) & 0xFF);
cg = (wxUint8)((color1 >> 16) & 0xFF); cg = (uint8_t)((color1 >> 16) & 0xFF);
cb = (wxUint8)((color1 >> 8) & 0xFF); cb = (uint8_t)((color1 >> 8) & 0xFF);
for (int i=0; i<256; i++) for (int i=0; i<256; i++)
{ {
col = rdp.pal_8[i]; col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);; a = (uint8_t)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f); r = (uint8_t)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f); g = (uint8_t)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f); b = (uint8_t)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = (wxUint8)(min(255, percent_r * r + cr)); r = (uint8_t)(min(255, percent_r * r + cr));
g = (wxUint8)(min(255, percent_g * g + cg)); g = (uint8_t)(min(255, percent_g * g + cg));
b = (wxUint8)(min(255, percent_b * b + cb)); b = (uint8_t)(min(255, percent_b * b + cb));
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) | rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) | ((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) | ((wxUint16)(b >> 3) << 1) |
@ -228,21 +228,21 @@ static void mod_tex_scale_col_add_col_CI (uint32_t color0, uint32_t color1)
static void mod_tex_add_col_CI (uint32_t color) static void mod_tex_add_col_CI (uint32_t color)
{ {
wxUint8 cr, cg, cb; uint8_t cr, cg, cb;
wxUint16 col; wxUint16 col;
wxUint8 a, r, g, b; uint8_t a, r, g, b;
cr = (wxUint8)((color >> 24) & 0xFF); cr = (uint8_t)((color >> 24) & 0xFF);
cg = (wxUint8)((color >> 16) & 0xFF); cg = (uint8_t)((color >> 16) & 0xFF);
cb = (wxUint8)((color >> 8) & 0xFF); cb = (uint8_t)((color >> 8) & 0xFF);
for (int i=0; i<256; i++) for (int i=0; i<256; i++)
{ {
col = rdp.pal_8[i]; col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);; a = (uint8_t)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f); r = (uint8_t)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f); g = (uint8_t)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f); b = (uint8_t)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = min(cr + r, 255); r = min(cr + r, 255);
g = min(cg + g, 255); g = min(cg + g, 255);
b = min(cb + b, 255); b = min(cb + b, 255);
@ -255,21 +255,21 @@ static void mod_tex_add_col_CI (uint32_t color)
static void mod_tex_sub_col_CI (uint32_t color) static void mod_tex_sub_col_CI (uint32_t color)
{ {
wxUint8 cr, cg, cb; uint8_t cr, cg, cb;
wxUint16 col; wxUint16 col;
wxUint8 a, r, g, b; uint8_t a, r, g, b;
cr = (wxUint8)((color >> 24) & 0xFF); cr = (uint8_t)((color >> 24) & 0xFF);
cg = (wxUint8)((color >> 16) & 0xFF); cg = (uint8_t)((color >> 16) & 0xFF);
cb = (wxUint8)((color >> 8) & 0xFF); cb = (uint8_t)((color >> 8) & 0xFF);
for (int i=0; i<256; i++) for (int i=0; i<256; i++)
{ {
col = rdp.pal_8[i]; col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);; a = (uint8_t)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f); r = (uint8_t)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f); g = (uint8_t)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f); b = (uint8_t)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = max(r - cr, 0); r = max(r - cr, 0);
g = max(g - cg, 0); g = max(g - cg, 0);
b = max(b - cb, 0); b = max(b - cb, 0);
@ -283,19 +283,19 @@ static void mod_tex_sub_col_CI (uint32_t color)
static void mod_tex_sub_col_mul_fac_CI (uint32_t color, uint32_t factor) static void mod_tex_sub_col_mul_fac_CI (uint32_t color, uint32_t factor)
{ {
float percent = factor / 255.0f; float percent = factor / 255.0f;
wxUint8 cr, cg, cb; uint8_t cr, cg, cb;
wxUint16 col; wxUint16 col;
wxUint8 a; uint8_t a;
float r, g, b; float r, g, b;
cr = (wxUint8)((color >> 24) & 0xFF); cr = (uint8_t)((color >> 24) & 0xFF);
cg = (wxUint8)((color >> 16) & 0xFF); cg = (uint8_t)((color >> 16) & 0xFF);
cb = (wxUint8)((color >> 8) & 0xFF); cb = (uint8_t)((color >> 8) & 0xFF);
for (int i=0; i<256; i++) for (int i=0; i<256; i++)
{ {
col = rdp.pal_8[i]; col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001); a = (uint8_t)(col&0x0001);
r = (float)((col&0xF800) >> 11) / 31.0f * 255.0f; r = (float)((col&0xF800) >> 11) / 31.0f * 255.0f;
g = (float)((col&0x07C0) >> 6) / 31.0f * 255.0f; g = (float)((col&0x07C0) >> 6) / 31.0f * 255.0f;
b = (float)((col&0x003E) >> 1) / 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 (uint32_t color, uint32_t factor)
if (b > 255.0f) g = 255.0f; if (b > 255.0f) g = 255.0f;
if (b < 0.0f) b = 0.0f; if (b < 0.0f) b = 0.0f;
rdp.pal_8[i] = (wxUint16)(((wxUint16)((wxUint8)(r) >> 3) << 11) | rdp.pal_8[i] = (wxUint16)(((wxUint16)((uint8_t)(r) >> 3) << 11) |
((wxUint16)((wxUint8)(g) >> 3) << 6) | ((wxUint16)((uint8_t)(g) >> 3) << 6) |
((wxUint16)((wxUint8)(b) >> 3) << 1) | ((wxUint16)((uint8_t)(b) >> 3) << 1) |
(wxUint16)(a) ); (wxUint16)(a) );
} }
} }
static void mod_col_inter_tex_using_col1_CI (uint32_t color0, uint32_t color1) static void mod_col_inter_tex_using_col1_CI (uint32_t color0, uint32_t color1)
{ {
wxUint8 cr, cg, cb; uint8_t cr, cg, cb;
wxUint16 col; wxUint16 col;
wxUint8 a, r, g, b; uint8_t a, r, g, b;
float percent_r = ((color1 >> 24) & 0xFF) / 255.0f; float percent_r = ((color1 >> 24) & 0xFF) / 255.0f;
float percent_g = ((color1 >> 16) & 0xFF) / 255.0f; float percent_g = ((color1 >> 16) & 0xFF) / 255.0f;
@ -329,20 +329,20 @@ static void mod_col_inter_tex_using_col1_CI (uint32_t color0, uint32_t color1)
float percent_g_i = 1.0f - percent_g; float percent_g_i = 1.0f - percent_g;
float percent_b_i = 1.0f - percent_b; float percent_b_i = 1.0f - percent_b;
cr = (wxUint8)((color0 >> 24) & 0xFF); cr = (uint8_t)((color0 >> 24) & 0xFF);
cg = (wxUint8)((color0 >> 16) & 0xFF); cg = (uint8_t)((color0 >> 16) & 0xFF);
cb = (wxUint8)((color0 >> 8) & 0xFF); cb = (uint8_t)((color0 >> 8) & 0xFF);
for (int i=0; i<256; i++) for (int i=0; i<256; i++)
{ {
col = rdp.pal_8[i]; col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);; a = (uint8_t)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) / 31.0f * 255.0f); r = (uint8_t)((float)((col&0xF800) >> 11) / 31.0f * 255.0f);
g = (wxUint8)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f); g = (uint8_t)((float)((col&0x07C0) >> 6) / 31.0f * 255.0f);
b = (wxUint8)((float)((col&0x003E) >> 1) / 31.0f * 255.0f); b = (uint8_t)((float)((col&0x003E) >> 1) / 31.0f * 255.0f);
r = (wxUint8)(min(255, percent_r * r + percent_r_i * cr)); r = (uint8_t)(min(255, percent_r * r + percent_r_i * cr));
g = (wxUint8)(min(255, percent_g * g + percent_g_i * cg)); g = (uint8_t)(min(255, percent_g * g + percent_g_i * cg));
b = (wxUint8)(min(255, percent_b * b + percent_b_i * cb)); b = (uint8_t)(min(255, percent_b * b + percent_b_i * cb));
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) | rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) | ((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) | ((wxUint16)(b >> 3) << 1) |
@ -352,11 +352,11 @@ static void mod_col_inter_tex_using_col1_CI (uint32_t color0, uint32_t color1)
static void mod_tex_inter_col_using_texa_CI (uint32_t 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); r = (uint8_t)((float)((color >> 24) & 0xFF) / 255.0f * 31.0f);
g = (wxUint8)((float)((color >> 16) & 0xFF) / 255.0f * 31.0f); g = (uint8_t)((float)((color >> 16) & 0xFF) / 255.0f * 31.0f);
b = (wxUint8)((float)((color >> 8) & 0xFF) / 255.0f * 31.0f); b = (uint8_t)((float)((color >> 8) & 0xFF) / 255.0f * 31.0f);
a = (color&0xFF) ? 1 : 0; a = (color&0xFF) ? 1 : 0;
wxUint16 col16 = (wxUint16)((r<<11)|(g<<6)|(b<<1)|a); wxUint16 col16 = (wxUint16)((r<<11)|(g<<6)|(b<<1)|a);
@ -369,7 +369,7 @@ static void mod_tex_inter_col_using_texa_CI (uint32_t color)
static void mod_tex_mul_col_CI (uint32_t color) static void mod_tex_mul_col_CI (uint32_t color)
{ {
wxUint8 a, r, g, b; uint8_t a, r, g, b;
wxUint16 col; wxUint16 col;
float cr, cg, cb; float cr, cg, cb;
@ -380,10 +380,10 @@ static void mod_tex_mul_col_CI (uint32_t color)
for (int i=0; i<256; i++) for (int i=0; i<256; i++)
{ {
col = rdp.pal_8[i]; col = rdp.pal_8[i];
a = (wxUint8)(col&0x0001);; a = (uint8_t)(col&0x0001);;
r = (wxUint8)((float)((col&0xF800) >> 11) * cr); r = (uint8_t)((float)((col&0xF800) >> 11) * cr);
g = (wxUint8)((float)((col&0x07C0) >> 6) * cg); g = (uint8_t)((float)((col&0x07C0) >> 6) * cg);
b = (wxUint8)((float)((col&0x003E) >> 1) * cb); b = (uint8_t)((float)((col&0x003E) >> 1) * cb);
rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) | rdp.pal_8[i] = (wxUint16)(((wxUint16)(r >> 3) << 11) |
((wxUint16)(g >> 3) << 6) | ((wxUint16)(g >> 3) << 6) |
((wxUint16)(b >> 3) << 1) | ((wxUint16)(b >> 3) << 1) |

View File

@ -182,15 +182,15 @@ void apply_shade_mods (VERTEX *v)
if (col[0] < 0.0f) col[0] = 0.0f; if (col[0] < 0.0f) col[0] = 0.0f;
if (col[1] < 0.0f) col[1] = 0.0f; if (col[1] < 0.0f) col[1] = 0.0f;
if (col[2] < 0.0f) col[2] = 0.0f; if (col[2] < 0.0f) col[2] = 0.0f;
v->r = (wxUint8)(255.0f * col[0]); v->r = (uint8_t)(255.0f * col[0]);
v->g = (wxUint8)(255.0f * col[1]); v->g = (uint8_t)(255.0f * col[1]);
v->b = (wxUint8)(255.0f * col[2]); v->b = (uint8_t)(255.0f * col[2]);
} }
if (mod & CMB_A_SET) if (mod & CMB_A_SET)
{ {
if (col[3] > 1.0f) col[3] = 1.0f; if (col[3] > 1.0f) col[3] = 1.0f;
if (col[3] < 0.0f) col[3] = 0.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) if (mod & CMB_SETSHADE_SHADEALPHA)
{ {
@ -199,9 +199,9 @@ void apply_shade_mods (VERTEX *v)
if (mod & CMB_MULT_OWN_ALPHA) if (mod & CMB_MULT_OWN_ALPHA)
{ {
float percent = v->a / 255.0f; float percent = v->a / 255.0f;
v->r = (wxUint8)(v->r * percent); v->r = (uint8_t)(v->r * percent);
v->g = (wxUint8)(v->g * percent); v->g = (uint8_t)(v->g * percent);
v->b = (wxUint8)(v->b * percent); v->b = (uint8_t)(v->b * percent);
} }
if (mod & CMB_MULT) if (mod & CMB_MULT)
{ {
@ -211,15 +211,15 @@ void apply_shade_mods (VERTEX *v)
if (col[0] < 0.0f) col[0] = 0.0f; if (col[0] < 0.0f) col[0] = 0.0f;
if (col[1] < 0.0f) col[1] = 0.0f; if (col[1] < 0.0f) col[1] = 0.0f;
if (col[2] < 0.0f) col[2] = 0.0f; if (col[2] < 0.0f) col[2] = 0.0f;
v->r = (wxUint8)(v->r * col[0]); v->r = (uint8_t)(v->r * col[0]);
v->g = (wxUint8)(v->g * col[1]); v->g = (uint8_t)(v->g * col[1]);
v->b = (wxUint8)(v->b * col[2]); v->b = (uint8_t)(v->b * col[2]);
} }
if (mod & CMB_A_MULT) if (mod & CMB_A_MULT)
{ {
if (col[3] > 1.0f) col[3] = 1.0f; if (col[3] > 1.0f) col[3] = 1.0f;
if (col[3] < 0.0f) col[3] = 0.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) if (mod & CMB_SUB)
{ {
@ -229,15 +229,15 @@ void apply_shade_mods (VERTEX *v)
if (r < 0) r = 0; if (r < 0) r = 0;
if (g < 0) g = 0; if (g < 0) g = 0;
if (b < 0) b = 0; if (b < 0) b = 0;
v->r = (wxUint8)r; v->r = (uint8_t)r;
v->g = (wxUint8)g; v->g = (uint8_t)g;
v->b = (wxUint8)b; v->b = (uint8_t)b;
} }
if (mod & CMB_A_SUB) if (mod & CMB_A_SUB)
{ {
int a = v->a - (int)(255.0f * rdp.coladd[3]); int a = v->a - (int)(255.0f * rdp.coladd[3]);
if (a < 0) a = 0; if (a < 0) a = 0;
v->a = (wxUint8)a; v->a = (uint8_t)a;
} }
if (mod & CMB_ADD) if (mod & CMB_ADD)
{ {
@ -247,35 +247,35 @@ void apply_shade_mods (VERTEX *v)
if (r > 255) r = 255; if (r > 255) r = 255;
if (g > 255) g = 255; if (g > 255) g = 255;
if (b > 255) b = 255; if (b > 255) b = 255;
v->r = (wxUint8)r; v->r = (uint8_t)r;
v->g = (wxUint8)g; v->g = (uint8_t)g;
v->b = (wxUint8)b; v->b = (uint8_t)b;
} }
if (mod & CMB_A_ADD) if (mod & CMB_A_ADD)
{ {
int a = v->a + (int)(255.0f * rdp.coladd[3]); int a = v->a + (int)(255.0f * rdp.coladd[3]);
if (a > 255) a = 255; if (a > 255) a = 255;
v->a = (wxUint8)a; v->a = (uint8_t)a;
} }
if (mod & CMB_COL_SUB_OWN) if (mod & CMB_COL_SUB_OWN)
{ {
int r = (wxUint8)(255.0f * rdp.coladd[0]) - v->r; int r = (uint8_t)(255.0f * rdp.coladd[0]) - v->r;
int g = (wxUint8)(255.0f * rdp.coladd[1]) - v->g; int g = (uint8_t)(255.0f * rdp.coladd[1]) - v->g;
int b = (wxUint8)(255.0f * rdp.coladd[2]) - v->b; int b = (uint8_t)(255.0f * rdp.coladd[2]) - v->b;
if (r < 0) r = 0; if (r < 0) r = 0;
if (g < 0) g = 0; if (g < 0) g = 0;
if (b < 0) b = 0; if (b < 0) b = 0;
v->r = (wxUint8)r; v->r = (uint8_t)r;
v->g = (wxUint8)g; v->g = (uint8_t)g;
v->b = (wxUint8)b; v->b = (uint8_t)b;
} }
v->shade_mod = cmb.shade_mod_hash; v->shade_mod = cmb.shade_mod_hash;
} }
if (rdp.cmb_flags_2 & CMB_INTER) 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->r = (uint8_t)(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->g = (uint8_t)(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->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; v->shade_mod = cmb.shade_mod_hash;
} }
} }
@ -351,10 +351,10 @@ void draw_tri (VERTEX **vtx, wxUint16 linew)
#ifdef EXTREME_LOGGING #ifdef EXTREME_LOGGING
FRDP(" * Prim shaded %08lx\n", rdp.prim_color); FRDP(" * Prim shaded %08lx\n", rdp.prim_color);
#endif #endif
v->a = (wxUint8)(rdp.prim_color & 0xFF); v->a = (uint8_t)(rdp.prim_color & 0xFF);
v->b = (wxUint8)((rdp.prim_color >> 8) & 0xFF); v->b = (uint8_t)((rdp.prim_color >> 8) & 0xFF);
v->g = (wxUint8)((rdp.prim_color >> 16) & 0xFF); v->g = (uint8_t)((rdp.prim_color >> 16) & 0xFF);
v->r = (wxUint8)((rdp.prim_color >> 24) & 0xFF); v->r = (uint8_t)((rdp.prim_color >> 24) & 0xFF);
} }
} }
} }
@ -535,10 +535,10 @@ void draw_tri (VERTEX **vtx, wxUint16 linew)
cur_256 * rdp.cur_cache[0]->splitheight; cur_256 * rdp.cur_cache[0]->splitheight;
rdp.vtxbuf[index].u1 = v1->u1 + (v2->u1 - v1->u1) * 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].v1 = v1->v1 + (v2->v1 - v1->v1) * percent;
rdp.vtxbuf[index].b = (wxUint8)(v1->b + (v2->b - v1->b) * percent); rdp.vtxbuf[index].b = (uint8_t)(v1->b + (v2->b - v1->b) * percent);
rdp.vtxbuf[index].g = (wxUint8)(v1->g + (v2->g - v1->g) * percent); rdp.vtxbuf[index].g = (uint8_t)(v1->g + (v2->g - v1->g) * percent);
rdp.vtxbuf[index].r = (wxUint8)(v1->r + (v2->r - v1->r) * percent); rdp.vtxbuf[index].r = (uint8_t)(v1->r + (v2->r - v1->r) * percent);
rdp.vtxbuf[index++].a = (wxUint8)(v1->a + (v2->a - v1->a) * percent); rdp.vtxbuf[index++].a = (uint8_t)(v1->a + (v2->a - v1->a) * percent);
} }
} }
else else
@ -557,10 +557,10 @@ void draw_tri (VERTEX **vtx, wxUint16 linew)
cur_256 * rdp.cur_cache[0]->splitheight; cur_256 * rdp.cur_cache[0]->splitheight;
rdp.vtxbuf[index].u1 = v2->u1 + (v1->u1 - v2->u1) * 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].v1 = v2->v1 + (v1->v1 - v2->v1) * percent;
rdp.vtxbuf[index].b = (wxUint8)(v2->b + (v1->b - v2->b) * percent); rdp.vtxbuf[index].b = (uint8_t)(v2->b + (v1->b - v2->b) * percent);
rdp.vtxbuf[index].g = (wxUint8)(v2->g + (v1->g - v2->g) * percent); rdp.vtxbuf[index].g = (uint8_t)(v2->g + (v1->g - v2->g) * percent);
rdp.vtxbuf[index].r = (wxUint8)(v2->r + (v1->r - v2->r) * percent); rdp.vtxbuf[index].r = (uint8_t)(v2->r + (v1->r - v2->r) * percent);
rdp.vtxbuf[index++].a = (wxUint8)(v2->a + (v1->a - v2->a) * percent); rdp.vtxbuf[index++].a = (uint8_t)(v2->a + (v1->a - v2->a) * percent);
// Save the in point // Save the in point
rdp.vtxbuf[index] = *v2; rdp.vtxbuf[index] = *v2;
@ -604,10 +604,10 @@ void draw_tri (VERTEX **vtx, wxUint16 linew)
rdp.vtxbuf[index].v0 = v1->v0 + (v2->v0 - v1->v0) * percent; 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].u1 = v1->u1 + (v2->u1 - v1->u1) * percent;
rdp.vtxbuf[index].v1 = v1->v1 + (v2->v1 - v1->v1) * 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].b = (uint8_t)(v1->b + (v2->b - v1->b) * percent);
rdp.vtxbuf[index].g = (wxUint8)(v1->g + (v2->g - v1->g) * percent); rdp.vtxbuf[index].g = (uint8_t)(v1->g + (v2->g - v1->g) * percent);
rdp.vtxbuf[index].r = (wxUint8)(v1->r + (v2->r - v1->r) * percent); rdp.vtxbuf[index].r = (uint8_t)(v1->r + (v2->r - v1->r) * percent);
rdp.vtxbuf[index].a = (wxUint8)(v1->a + (v2->a - v1->a) * percent); rdp.vtxbuf[index].a = (uint8_t)(v1->a + (v2->a - v1->a) * percent);
rdp.vtxbuf[index++].not_zclipped = 0; rdp.vtxbuf[index++].not_zclipped = 0;
} }
} }
@ -626,10 +626,10 @@ void draw_tri (VERTEX **vtx, wxUint16 linew)
rdp.vtxbuf[index].v0 = v2->v0 + (v1->v0 - v2->v0) * percent; 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].u1 = v2->u1 + (v1->u1 - v2->u1) * percent;
rdp.vtxbuf[index].v1 = v2->v1 + (v1->v1 - v2->v1) * 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].b = (uint8_t)(v2->b + (v1->b - v2->b) * percent);
rdp.vtxbuf[index].g = (wxUint8)(v2->g + (v1->g - v2->g) * percent); rdp.vtxbuf[index].g = (uint8_t)(v2->g + (v1->g - v2->g) * percent);
rdp.vtxbuf[index].r = (wxUint8)(v2->r + (v1->r - v2->r) * percent); rdp.vtxbuf[index].r = (uint8_t)(v2->r + (v1->r - v2->r) * percent);
rdp.vtxbuf[index].a = (wxUint8)(v2->a + (v1->a - v2->a) * percent); rdp.vtxbuf[index].a = (uint8_t)(v2->a + (v1->a - v2->a) * percent);
rdp.vtxbuf[index++].not_zclipped = 0; rdp.vtxbuf[index++].not_zclipped = 0;
// Save the in point // Save the in point
@ -667,10 +667,10 @@ void draw_tri (VERTEX **vtx, wxUint16 linew)
//* //*
static void InterpolateColors(VERTEX & va, VERTEX & vb, VERTEX & res, float percent) static void InterpolateColors(VERTEX & va, VERTEX & vb, VERTEX & res, float percent)
{ {
res.b = (wxUint8)interp2p(va.b, vb.b, percent); res.b = (uint8_t)interp2p(va.b, vb.b, percent);
res.g = (wxUint8)interp2p(va.g, vb.g, percent);; res.g = (uint8_t)interp2p(va.g, vb.g, percent);;
res.r = (wxUint8)interp2p(va.r, vb.r, percent);; res.r = (uint8_t)interp2p(va.r, vb.r, percent);;
res.a = (wxUint8)interp2p(va.a, vb.a, percent);; res.a = (uint8_t)interp2p(va.a, vb.a, percent);;
res.f = interp2p(va.f, vb.f, percent);; res.f = interp2p(va.f, vb.f, percent);;
} }
//*/ //*/
@ -759,7 +759,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; 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++) for (i=0; i<rdp.n_global; i++)
{ {
if (rdp.vtxbuf[i].not_zclipped)// && rdp.zsrc != 1) if (rdp.vtxbuf[i].not_zclipped)// && rdp.zsrc != 1)
@ -837,9 +837,9 @@ void do_triangle_stuff_2 (wxUint16 linew)
render_tri (linew, TRUE); 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);
} }
//* //*
@ -1878,14 +1878,14 @@ void update ()
FRDP (" |- render_mode_changed force_blend - %08lx\n", rdp.othermode_l&0xFFFF0000); FRDP (" |- render_mode_changed force_blend - %08lx\n", rdp.othermode_l&0xFFFF0000);
rdp.render_mode_changed &= 0x0000FFFF; rdp.render_mode_changed &= 0x0000FFFF;
rdp.fbl_a0 = (wxUint8)((rdp.othermode_l>>30)&0x3); rdp.fbl_a0 = (uint8_t)((rdp.othermode_l>>30)&0x3);
rdp.fbl_b0 = (wxUint8)((rdp.othermode_l>>26)&0x3); rdp.fbl_b0 = (uint8_t)((rdp.othermode_l>>26)&0x3);
rdp.fbl_c0 = (wxUint8)((rdp.othermode_l>>22)&0x3); rdp.fbl_c0 = (uint8_t)((rdp.othermode_l>>22)&0x3);
rdp.fbl_d0 = (wxUint8)((rdp.othermode_l>>18)&0x3); rdp.fbl_d0 = (uint8_t)((rdp.othermode_l>>18)&0x3);
rdp.fbl_a1 = (wxUint8)((rdp.othermode_l>>28)&0x3); rdp.fbl_a1 = (uint8_t)((rdp.othermode_l>>28)&0x3);
rdp.fbl_b1 = (wxUint8)((rdp.othermode_l>>24)&0x3); rdp.fbl_b1 = (uint8_t)((rdp.othermode_l>>24)&0x3);
rdp.fbl_c1 = (wxUint8)((rdp.othermode_l>>20)&0x3); rdp.fbl_c1 = (uint8_t)((rdp.othermode_l>>20)&0x3);
rdp.fbl_d1 = (wxUint8)((rdp.othermode_l>>16)&0x3); rdp.fbl_d1 = (uint8_t)((rdp.othermode_l>>16)&0x3);
rdp.update |= UPDATE_COMBINE; rdp.update |= UPDATE_COMBINE;
} }
@ -1977,7 +1977,7 @@ void update ()
// if (rdp.acmp == 1 && !(rdp.othermode_l & 0x00002000) && (rdp.blend_color&0xFF)) // 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))) 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); grAlphaTestFunction (reference ? GR_CMP_GEQUAL : GR_CMP_GREATER);
grAlphaTestReferenceValue (reference); grAlphaTestReferenceValue (reference);
FRDP (" |- alpha compare: blend: %02lx\n", reference); FRDP (" |- alpha compare: blend: %02lx\n", reference);
@ -1997,7 +1997,7 @@ void update ()
grAlphaTestFunction (GR_CMP_GREATER); grAlphaTestFunction (GR_CMP_GREATER);
if (rdp.acmp == 3) 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); FRDP (" |- alpha compare: blend: %02lx\n", rdp.blend_color&0xFF);
} }
else else

View File

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

View File

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

View File

@ -195,7 +195,7 @@ static void rsp_reserved3();
static void ys_memrect(); static void ys_memrect();
wxUint8 microcode[4096]; uint8_t microcode[4096];
uint32_t uc_crc; uint32_t uc_crc;
void microcheck (); void microcheck ();
@ -948,25 +948,25 @@ static void ys_memrect ()
uint32_t y, width = lr_x - ul_x; uint32_t y, width = lr_x - ul_x;
uint32_t tex_width = rdp.tiles[tile].line << 3; uint32_t tex_width = rdp.tiles[tile].line << 3;
wxUint8 * texaddr = gfx.RDRAM + rdp.addr[rdp.tiles[tile].t_mem] + tex_width*off_y + off_x; uint8_t * texaddr = gfx.RDRAM + rdp.addr[rdp.tiles[tile].t_mem] + tex_width*off_y + off_x;
wxUint8 * fbaddr = gfx.RDRAM + rdp.cimg + ul_x; uint8_t * fbaddr = gfx.RDRAM + rdp.cimg + ul_x;
for (y = ul_y; y < lr_y; y++) { for (y = ul_y; y < lr_y; y++) {
wxUint8 *src = texaddr + (y - ul_y) * tex_width; uint8_t *src = texaddr + (y - ul_y) * tex_width;
wxUint8 *dst = fbaddr + y * rdp.ci_width; uint8_t *dst = fbaddr + y * rdp.ci_width;
memcpy (dst, src, width); memcpy (dst, src, width);
} }
} }
static void pm_palette_mod () static void pm_palette_mod ()
{ {
wxUint8 envr = (wxUint8)((float)((rdp.env_color >> 24)&0xFF)/255.0f*31.0f); uint8_t envr = (uint8_t)((float)((rdp.env_color >> 24)&0xFF)/255.0f*31.0f);
wxUint8 envg = (wxUint8)((float)((rdp.env_color >> 16)&0xFF)/255.0f*31.0f); uint8_t envg = (uint8_t)((float)((rdp.env_color >> 16)&0xFF)/255.0f*31.0f);
wxUint8 envb = (wxUint8)((float)((rdp.env_color >> 8)&0xFF)/255.0f*31.0f); uint8_t envb = (uint8_t)((float)((rdp.env_color >> 8)&0xFF)/255.0f*31.0f);
wxUint16 env16 = (wxUint16)((envr<<11)|(envg<<6)|(envb<<1)|1); wxUint16 env16 = (wxUint16)((envr<<11)|(envg<<6)|(envb<<1)|1);
wxUint8 prmr = (wxUint8)((float)((rdp.prim_color >> 24)&0xFF)/255.0f*31.0f); uint8_t prmr = (uint8_t)((float)((rdp.prim_color >> 24)&0xFF)/255.0f*31.0f);
wxUint8 prmg = (wxUint8)((float)((rdp.prim_color >> 16)&0xFF)/255.0f*31.0f); uint8_t prmg = (uint8_t)((float)((rdp.prim_color >> 16)&0xFF)/255.0f*31.0f);
wxUint8 prmb = (wxUint8)((float)((rdp.prim_color >> 8)&0xFF)/255.0f*31.0f); uint8_t prmb = (uint8_t)((float)((rdp.prim_color >> 8)&0xFF)/255.0f*31.0f);
wxUint16 prim16 = (wxUint16)((prmr<<11)|(prmg<<6)|(prmb<<1)|1); wxUint16 prim16 = (wxUint16)((prmr<<11)|(prmg<<6)|(prmb<<1)|1);
wxUint16 * dst = (wxUint16*)(gfx.RDRAM+rdp.cimg); wxUint16 * dst = (wxUint16*)(gfx.RDRAM+rdp.cimg);
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
@ -1016,8 +1016,8 @@ static void rdp_texrect()
if (!rdp.LLE) if (!rdp.LLE)
{ {
uint32_t a = rdp.pc[rdp.pc_i]; uint32_t a = rdp.pc[rdp.pc_i];
wxUint8 cmdHalf1 = gfx.RDRAM[a+3]; uint8_t cmdHalf1 = gfx.RDRAM[a+3];
wxUint8 cmdHalf2 = gfx.RDRAM[a+11]; uint8_t cmdHalf2 = gfx.RDRAM[a+11];
a >>= 2; a >>= 2;
if ((cmdHalf1 == 0xE1 && cmdHalf2 == 0xF1) || (cmdHalf1 == 0xB4 && cmdHalf2 == 0xB3) || (cmdHalf1 == 0xB3 && cmdHalf2 == 0xB2)) if ((cmdHalf1 == 0xE1 && cmdHalf2 == 0xF1) || (cmdHalf1 == 0xB4 && cmdHalf2 == 0xB3) || (cmdHalf1 == 0xB3 && cmdHalf2 == 0xB2))
{ {
@ -1280,13 +1280,13 @@ static void rdp_texrect()
{ {
if (tile.shift_s > 10) if (tile.shift_s > 10)
{ {
wxUint8 iShift = (16 - tile.shift_s); uint8_t iShift = (16 - tile.shift_s);
x_i <<= iShift; x_i <<= iShift;
sx = (float)(1 << iShift); sx = (float)(1 << iShift);
} }
else else
{ {
wxUint8 iShift = tile.shift_s; uint8_t iShift = tile.shift_s;
x_i >>= iShift; x_i >>= iShift;
sx = 1.0f/(float)(1 << iShift); sx = 1.0f/(float)(1 << iShift);
} }
@ -1295,13 +1295,13 @@ static void rdp_texrect()
{ {
if (tile.shift_t > 10) if (tile.shift_t > 10)
{ {
wxUint8 iShift = (16 - tile.shift_t); uint8_t iShift = (16 - tile.shift_t);
y_i <<= iShift; y_i <<= iShift;
sy = (float)(1 << iShift); sy = (float)(1 << iShift);
} }
else else
{ {
wxUint8 iShift = tile.shift_t; uint8_t iShift = tile.shift_t;
y_i >>= iShift; y_i >>= iShift;
sy = 1.0f/(float)(1 << iShift); sy = 1.0f/(float)(1 << iShift);
} }
@ -1617,8 +1617,8 @@ static void rdp_setconvert()
rdp.YUV_C3 = -0.40651f; rdp.YUV_C3 = -0.40651f;
rdp.YUV_C4 = 1.014f ; rdp.YUV_C4 = 1.014f ;
*/ */
rdp.K4 = (wxUint8)(rdp.cmd1>>9)&0x1FF; rdp.K4 = (uint8_t)(rdp.cmd1>>9)&0x1FF;
rdp.K5 = (wxUint8)(rdp.cmd1&0x1FF); rdp.K5 = (uint8_t)(rdp.cmd1&0x1FF);
// RDP_E("setconvert - IGNORED\n"); // RDP_E("setconvert - IGNORED\n");
FRDP("setconvert. K4=%02lx K5=%02lx\n", rdp.K4, rdp.K5); FRDP("setconvert. K4=%02lx K5=%02lx\n", rdp.K4, rdp.K5);
} }
@ -1711,7 +1711,7 @@ void load_palette (uint32_t addr, wxUint16 start, wxUint16 count)
} }
#ifdef TEXTURE_FILTER #ifdef TEXTURE_FILTER
if (settings.ghq_hirs) if (settings.ghq_hirs)
memcpy((wxUint8*)(rdp.pal_8_rice+start), spal, count<<1); memcpy((uint8_t*)(rdp.pal_8_rice+start), spal, count<<1);
#endif #endif
start >>= 4; start >>= 4;
end = start + (count >> 4); end = start + (count >> 4);
@ -2306,19 +2306,19 @@ static void rdp_settile()
rdp.last_tile = (uint32_t)((rdp.cmd1 >> 24) & 0x07); rdp.last_tile = (uint32_t)((rdp.cmd1 >> 24) & 0x07);
TILE *tile = &rdp.tiles[rdp.last_tile]; TILE *tile = &rdp.tiles[rdp.last_tile];
tile->format = (wxUint8)((rdp.cmd0 >> 21) & 0x07); tile->format = (uint8_t)((rdp.cmd0 >> 21) & 0x07);
tile->size = (wxUint8)((rdp.cmd0 >> 19) & 0x03); tile->size = (uint8_t)((rdp.cmd0 >> 19) & 0x03);
tile->line = (wxUint16)((rdp.cmd0 >> 9) & 0x01FF); tile->line = (wxUint16)((rdp.cmd0 >> 9) & 0x01FF);
tile->t_mem = (wxUint16)(rdp.cmd0 & 0x1FF); tile->t_mem = (wxUint16)(rdp.cmd0 & 0x1FF);
tile->palette = (wxUint8)((rdp.cmd1 >> 20) & 0x0F); tile->palette = (uint8_t)((rdp.cmd1 >> 20) & 0x0F);
tile->clamp_t = (wxUint8)((rdp.cmd1 >> 19) & 0x01); tile->clamp_t = (uint8_t)((rdp.cmd1 >> 19) & 0x01);
tile->mirror_t = (wxUint8)((rdp.cmd1 >> 18) & 0x01); tile->mirror_t = (uint8_t)((rdp.cmd1 >> 18) & 0x01);
tile->mask_t = (wxUint8)((rdp.cmd1 >> 14) & 0x0F); tile->mask_t = (uint8_t)((rdp.cmd1 >> 14) & 0x0F);
tile->shift_t = (wxUint8)((rdp.cmd1 >> 10) & 0x0F); tile->shift_t = (uint8_t)((rdp.cmd1 >> 10) & 0x0F);
tile->clamp_s = (wxUint8)((rdp.cmd1 >> 9) & 0x01); tile->clamp_s = (uint8_t)((rdp.cmd1 >> 9) & 0x01);
tile->mirror_s = (wxUint8)((rdp.cmd1 >> 8) & 0x01); tile->mirror_s = (uint8_t)((rdp.cmd1 >> 8) & 0x01);
tile->mask_s = (wxUint8)((rdp.cmd1 >> 4) & 0x0F); tile->mask_s = (uint8_t)((rdp.cmd1 >> 4) & 0x0F);
tile->shift_s = (wxUint8)(rdp.cmd1 & 0x0F); tile->shift_s = (uint8_t)(rdp.cmd1 & 0x0F);
rdp.update |= UPDATE_TEXTURE; rdp.update |= UPDATE_TEXTURE;
@ -2626,23 +2626,23 @@ static void rdp_setenvcolor()
static void rdp_setcombine() static void rdp_setcombine()
{ {
rdp.c_a0 = (wxUint8)((rdp.cmd0 >> 20) & 0xF); rdp.c_a0 = (uint8_t)((rdp.cmd0 >> 20) & 0xF);
rdp.c_b0 = (wxUint8)((rdp.cmd1 >> 28) & 0xF); rdp.c_b0 = (uint8_t)((rdp.cmd1 >> 28) & 0xF);
rdp.c_c0 = (wxUint8)((rdp.cmd0 >> 15) & 0x1F); rdp.c_c0 = (uint8_t)((rdp.cmd0 >> 15) & 0x1F);
rdp.c_d0 = (wxUint8)((rdp.cmd1 >> 15) & 0x7); rdp.c_d0 = (uint8_t)((rdp.cmd1 >> 15) & 0x7);
rdp.c_Aa0 = (wxUint8)((rdp.cmd0 >> 12) & 0x7); rdp.c_Aa0 = (uint8_t)((rdp.cmd0 >> 12) & 0x7);
rdp.c_Ab0 = (wxUint8)((rdp.cmd1 >> 12) & 0x7); rdp.c_Ab0 = (uint8_t)((rdp.cmd1 >> 12) & 0x7);
rdp.c_Ac0 = (wxUint8)((rdp.cmd0 >> 9) & 0x7); rdp.c_Ac0 = (uint8_t)((rdp.cmd0 >> 9) & 0x7);
rdp.c_Ad0 = (wxUint8)((rdp.cmd1 >> 9) & 0x7); rdp.c_Ad0 = (uint8_t)((rdp.cmd1 >> 9) & 0x7);
rdp.c_a1 = (wxUint8)((rdp.cmd0 >> 5) & 0xF); rdp.c_a1 = (uint8_t)((rdp.cmd0 >> 5) & 0xF);
rdp.c_b1 = (wxUint8)((rdp.cmd1 >> 24) & 0xF); rdp.c_b1 = (uint8_t)((rdp.cmd1 >> 24) & 0xF);
rdp.c_c1 = (wxUint8)((rdp.cmd0 >> 0) & 0x1F); rdp.c_c1 = (uint8_t)((rdp.cmd0 >> 0) & 0x1F);
rdp.c_d1 = (wxUint8)((rdp.cmd1 >> 6) & 0x7); rdp.c_d1 = (uint8_t)((rdp.cmd1 >> 6) & 0x7);
rdp.c_Aa1 = (wxUint8)((rdp.cmd1 >> 21) & 0x7); rdp.c_Aa1 = (uint8_t)((rdp.cmd1 >> 21) & 0x7);
rdp.c_Ab1 = (wxUint8)((rdp.cmd1 >> 3) & 0x7); rdp.c_Ab1 = (uint8_t)((rdp.cmd1 >> 3) & 0x7);
rdp.c_Ac1 = (wxUint8)((rdp.cmd1 >> 18) & 0x7); rdp.c_Ac1 = (uint8_t)((rdp.cmd1 >> 18) & 0x7);
rdp.c_Ad1 = (wxUint8)((rdp.cmd1 >> 0) & 0x7); rdp.c_Ad1 = (uint8_t)((rdp.cmd1 >> 0) & 0x7);
rdp.cycle1 = (rdp.c_a0<<0) | (rdp.c_b0<<4) | (rdp.c_c0<<8) | (rdp.c_d0<<13)| rdp.cycle1 = (rdp.c_a0<<0) | (rdp.c_b0<<4) | (rdp.c_c0<<8) | (rdp.c_d0<<13)|
(rdp.c_Aa0<<16)| (rdp.c_Ab0<<19)| (rdp.c_Ac0<<22)| (rdp.c_Ad0<<25); (rdp.c_Aa0<<16)| (rdp.c_Ab0<<19)| (rdp.c_Ac0<<22)| (rdp.c_Ad0<<25);
@ -2667,8 +2667,8 @@ static void rdp_settextureimage()
static const char *format[] = { "RGBA", "YUV", "CI", "IA", "I", "?", "?", "?" }; static const char *format[] = { "RGBA", "YUV", "CI", "IA", "I", "?", "?", "?" };
static const char *size[] = { "4bit", "8bit", "16bit", "32bit" }; static const char *size[] = { "4bit", "8bit", "16bit", "32bit" };
rdp.timg.format = (wxUint8)((rdp.cmd0 >> 21) & 0x07); rdp.timg.format = (uint8_t)((rdp.cmd0 >> 21) & 0x07);
rdp.timg.size = (wxUint8)((rdp.cmd0 >> 19) & 0x03); rdp.timg.size = (uint8_t)((rdp.cmd0 >> 19) & 0x03);
rdp.timg.width = (wxUint16)(1 + (rdp.cmd0 & 0x00000FFF)); rdp.timg.width = (wxUint16)(1 + (rdp.cmd0 & 0x00000FFF));
rdp.timg.addr = segoffset(rdp.cmd1); rdp.timg.addr = segoffset(rdp.cmd1);
if (ucode5_texshiftaddr) if (ucode5_texshiftaddr)
@ -3222,7 +3222,7 @@ Emulator should not call this function again if other memory
is read within the same 4KB range is read within the same 4KB range
input: addr rdram address input: addr rdram address
val val val val
size 1 = wxUint8, 2 = wxUint16, 4 = uint32_t size 1 = uint8_t, 2 = wxUint16, 4 = uint32_t
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL FBRead(uint32_t addr) EXPORT void CALL FBRead(uint32_t addr)
@ -3302,7 +3302,7 @@ Purpose: This function is called to notify the dll that the
frame buffer has been modified by CPU at the given address. frame buffer has been modified by CPU at the given address.
input: addr rdram address input: addr rdram address
val val val val
size 1 = wxUint8, 2 = wxUint16, 4 = uint32_t size 1 = uint8_t, 2 = wxUint16, 4 = uint32_t
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL FBWrite(uint32_t addr, uint32_t /*size*/) EXPORT void CALL FBWrite(uint32_t addr, uint32_t /*size*/)

View File

@ -65,10 +65,10 @@ struct t3dGlobState {
struct t3dState { struct t3dState {
uint32_t renderState; /* render state */ uint32_t renderState; /* render state */
uint32_t textureState; /* texture state */ uint32_t textureState; /* texture state */
wxUint8 flag; uint8_t flag;
wxUint8 triCount; /* how many tris? */ uint8_t triCount; /* how many tris? */
wxUint8 vtxV0; /* where to load verts? */ uint8_t vtxV0; /* where to load verts? */
wxUint8 vtxCount; /* how many verts? */ uint8_t vtxCount; /* how many verts? */
uint32_t rdpCmds; /* ptr (segment address) to RDP DL */ uint32_t rdpCmds; /* ptr (segment address) to RDP DL */
uint32_t othermode0; uint32_t othermode0;
uint32_t othermode1; uint32_t othermode1;
@ -76,7 +76,7 @@ struct t3dState {
struct t3dTriN{ 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 */
}; };
@ -153,10 +153,10 @@ static void t3d_vertex(uint32_t addr, uint32_t v0, uint32_t n)
v->ou = 2.0f * (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 4)^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->ov = 2.0f * (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 5)^1];
v->uv_scaled = 0; v->uv_scaled = 0;
v->r = ((wxUint8*)gfx.RDRAM)[(addr+i + 12)^3]; v->r = ((uint8_t*)gfx.RDRAM)[(addr+i + 12)^3];
v->g = ((wxUint8*)gfx.RDRAM)[(addr+i + 13)^3]; v->g = ((uint8_t*)gfx.RDRAM)[(addr+i + 13)^3];
v->b = ((wxUint8*)gfx.RDRAM)[(addr+i + 14)^3]; v->b = ((uint8_t*)gfx.RDRAM)[(addr+i + 14)^3];
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->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]; v->y = x*rdp.combined[0][1] + y*rdp.combined[1][1] + z*rdp.combined[2][1] + rdp.combined[3][1];

View File

@ -92,7 +92,7 @@ static void rsp_vertex(int v0, int n)
v->ou = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 4)^1]; v->ou = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 4)^1];
v->ov = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 5)^1]; v->ov = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 5)^1];
v->uv_scaled = 0; 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->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]; 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 else
{ {
v->r = ((wxUint8*)gfx.RDRAM)[(addr+i + 12)^3]; v->r = ((uint8_t*)gfx.RDRAM)[(addr+i + 12)^3];
v->g = ((wxUint8*)gfx.RDRAM)[(addr+i + 13)^3]; v->g = ((uint8_t*)gfx.RDRAM)[(addr+i + 13)^3];
v->b = ((wxUint8*)gfx.RDRAM)[(addr+i + 14)^3]; v->b = ((uint8_t*)gfx.RDRAM)[(addr+i + 14)^3];
} }
#ifdef EXTREME_LOGGING #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); 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);
@ -295,7 +295,7 @@ static void uc0_matrix()
// Use segment offset to get the address // Use segment offset to get the address
uint32_t addr = segoffset(rdp.cmd1) & 0x00FFFFFF; uint32_t addr = segoffset(rdp.cmd1) & 0x00FFFFFF;
wxUint8 command = (wxUint8)((rdp.cmd0 >> 16) & 0xFF); uint8_t command = (uint8_t)((rdp.cmd0 >> 16) & 0xFF);
DECLAREALIGN16VAR(m[4][4]); DECLAREALIGN16VAR(m[4][4]);
load_matrix(m, addr); load_matrix(m, addr);
@ -438,9 +438,9 @@ static void uc0_movemem()
a = segoffset(rdp.cmd1) & 0x00ffffff; a = segoffset(rdp.cmd1) & 0x00ffffff;
// Get the data // Get the data
rdp.light[i].r = (float)(((wxUint8*)gfx.RDRAM)[(a+0)^3]) / 255.0f; rdp.light[i].r = (float)(((uint8_t*)gfx.RDRAM)[(a+0)^3]) / 255.0f;
rdp.light[i].g = (float)(((wxUint8*)gfx.RDRAM)[(a+1)^3]) / 255.0f; rdp.light[i].g = (float)(((uint8_t*)gfx.RDRAM)[(a+1)^3]) / 255.0f;
rdp.light[i].b = (float)(((wxUint8*)gfx.RDRAM)[(a+2)^3]) / 255.0f; rdp.light[i].b = (float)(((uint8_t*)gfx.RDRAM)[(a+2)^3]) / 255.0f;
rdp.light[i].a = 1.0f; rdp.light[i].a = 1.0f;
// ** Thanks to Icepir8 for pointing this out ** // ** Thanks to Icepir8 for pointing this out **
// Lighting must be signed byte instead of byte // Lighting must be signed byte instead of byte
@ -586,8 +586,8 @@ static void uc0_enddl()
static void uc0_culldl() static void uc0_culldl()
{ {
wxUint8 vStart = (wxUint8)((rdp.cmd0 & 0x00FFFFFF) / 40) & 0xF; uint8_t vStart = (uint8_t)((rdp.cmd0 & 0x00FFFFFF) / 40) & 0xF;
wxUint8 vEnd = (wxUint8)(rdp.cmd1 / 40) & 0x0F; uint8_t vEnd = (uint8_t)(rdp.cmd1 / 40) & 0x0F;
uint32_t cond = 0; uint32_t cond = 0;
VERTEX *v; VERTEX *v;
@ -640,7 +640,7 @@ static void uc0_popmatrix()
static void uc6_obj_sprite (); static void uc6_obj_sprite ();
static void uc0_modifyvtx(wxUint8 where, wxUint16 vtx, uint32_t val) static void uc0_modifyvtx(uint8_t where, wxUint16 vtx, uint32_t val)
{ {
VERTEX *v = &rdp.vtx[vtx]; VERTEX *v = &rdp.vtx[vtx];
@ -651,10 +651,10 @@ static void uc0_modifyvtx(wxUint8 where, wxUint16 vtx, uint32_t val)
break; break;
case 0x10: // RGBA case 0x10: // RGBA
v->r = (wxUint8)(val >> 24); v->r = (uint8_t)(val >> 24);
v->g = (wxUint8)((val >> 16) & 0xFF); v->g = (uint8_t)((val >> 16) & 0xFF);
v->b = (wxUint8)((val >> 8) & 0xFF); v->b = (uint8_t)((val >> 8) & 0xFF);
v->a = (wxUint8)(val & 0xFF); v->a = (uint8_t)(val & 0xFF);
v->shade_mod = 0; v->shade_mod = 0;
FRDP ("RGBA: %d, %d, %d, %d\n", v->r, v->g, v->b, v->a); FRDP ("RGBA: %d, %d, %d, %d\n", v->r, v->g, v->b, v->a);
@ -775,7 +775,7 @@ static void uc0_moveword()
{ {
wxUint16 val = (wxUint16)((rdp.cmd0 >> 8) & 0xFFFF); wxUint16 val = (wxUint16)((rdp.cmd0 >> 8) & 0xFFFF);
wxUint16 vtx = val / 40; wxUint16 vtx = val / 40;
wxUint8 where = val%40; uint8_t where = val%40;
uc0_modifyvtx(where, vtx, rdp.cmd1); uc0_modifyvtx(where, vtx, rdp.cmd1);
FRDP ("uc0:modifyvtx: vtx: %d, where: 0x%02lx, val: %08lx - ", vtx, where, rdp.cmd1); FRDP ("uc0:modifyvtx: vtx: %d, where: 0x%02lx, val: %08lx - ", vtx, where, rdp.cmd1);
} }
@ -873,13 +873,13 @@ static void uc0_setothermode_h()
if (mask & 0x0000C000) // tlut mode 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]); FRDP ("tlut mode: %s\n", str_tlut[rdp.tlut_mode]);
} }
if (mask & 0x00300000) // cycle type 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; rdp.update |= UPDATE_ZBUF_ENABLED;
FRDP ("cycletype: %d\n", rdp.cycle_mode); FRDP ("cycletype: %d\n", rdp.cycle_mode);
} }

View File

@ -75,9 +75,9 @@ static void calc_point_light (VERTEX *v, float * vpos)
if (color[1] > 1.0f) color[1] = 1.0f; if (color[1] > 1.0f) color[1] = 1.0f;
if (color[2] > 1.0f) color[2] = 1.0f; if (color[2] > 1.0f) color[2] = 1.0f;
v->r = (wxUint8)(color[0]*255.0f); v->r = (uint8_t)(color[0]*255.0f);
v->g = (wxUint8)(color[1]*255.0f); v->g = (uint8_t)(color[1]*255.0f);
v->b = (wxUint8)(color[2]*255.0f); v->b = (uint8_t)(color[2]*255.0f);
} }
static void uc6_obj_rectangle(); static void uc6_obj_rectangle();
@ -141,7 +141,7 @@ static void uc2_vertex ()
v->ou = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 4)^1]; v->ou = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 4)^1];
v->ov = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 5)^1]; v->ov = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 5)^1];
v->uv_scaled = 0; 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->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]; 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 else
{ {
v->r = ((wxUint8*)gfx.RDRAM)[(addr+i + 12)^3]; v->r = ((uint8_t*)gfx.RDRAM)[(addr+i + 12)^3];
v->g = ((wxUint8*)gfx.RDRAM)[(addr+i + 13)^3]; v->g = ((uint8_t*)gfx.RDRAM)[(addr+i + 13)^3];
v->b = ((wxUint8*)gfx.RDRAM)[(addr+i + 14)^3]; v->b = ((uint8_t*)gfx.RDRAM)[(addr+i + 14)^3];
} }
#ifdef EXTREME_LOGGING #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); 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,7 +219,7 @@ static void uc2_vertex ()
static void uc2_modifyvtx () static void uc2_modifyvtx ()
{ {
wxUint8 where = (wxUint8)((rdp.cmd0 >> 16) & 0xFF); uint8_t where = (uint8_t)((rdp.cmd0 >> 16) & 0xFF);
wxUint16 vtx = (wxUint16)((rdp.cmd0 >> 1) & 0xFFFF); wxUint16 vtx = (wxUint16)((rdp.cmd0 >> 1) & 0xFFFF);
FRDP ("uc2:modifyvtx: vtx: %d, where: 0x%02lx, val: %08lx - ", vtx, where, rdp.cmd1); FRDP ("uc2:modifyvtx: vtx: %d, where: 0x%02lx, val: %08lx - ", vtx, where, rdp.cmd1);
@ -495,7 +495,7 @@ static void uc2_matrix ()
DECLAREALIGN16VAR(m[4][4]); DECLAREALIGN16VAR(m[4][4]);
load_matrix(m, segoffset(rdp.cmd1)); load_matrix(m, segoffset(rdp.cmd1));
wxUint8 command = (wxUint8)((rdp.cmd0 ^ 1) & 0xFF); uint8_t command = (uint8_t)((rdp.cmd0 ^ 1) & 0xFF);
switch (command) switch (command)
{ {
case 0: // modelview mul nopush case 0: // modelview mul nopush
@ -553,7 +553,7 @@ static void uc2_matrix ()
static void uc2_moveword () static void uc2_moveword ()
{ {
wxUint8 index = (wxUint8)((rdp.cmd0 >> 16) & 0xFF); uint8_t index = (uint8_t)((rdp.cmd0 >> 16) & 0xFF);
wxUint16 offset = (wxUint16)(rdp.cmd0 & 0xFFFF); wxUint16 offset = (wxUint16)(rdp.cmd0 & 0xFFFF);
uint32_t data = rdp.cmd1; uint32_t data = rdp.cmd1;
@ -730,7 +730,7 @@ static void uc2_movemem ()
if (n > 7) return; if (n > 7) return;
// Get the data // 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].r = (float)col / 255.0f;
rdp.light[n].nonblack = col; rdp.light[n].nonblack = col;
col = gfx.RDRAM[(addr+1)^3]; col = gfx.RDRAM[(addr+1)^3];

View File

@ -56,17 +56,17 @@ static void uc5_matrix ()
// Use segment offset to get the address // Use segment offset to get the address
uint32_t 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); uint8_t n = (uint8_t)((rdp.cmd0 >> 16) & 0xF);
wxUint8 multiply; uint8_t multiply;
if (n == 0) //DKR if (n == 0) //DKR
{ {
n = (wxUint8)((rdp.cmd0 >> 22) & 0x3); n = (uint8_t)((rdp.cmd0 >> 22) & 0x3);
multiply = 0; multiply = 0;
} }
else //JF else //JF
{ {
multiply = (wxUint8)((rdp.cmd0 >> 23) & 0x1); multiply = (uint8_t)((rdp.cmd0 >> 23) & 0x1);
} }
cur_mtx = n; cur_mtx = n;
@ -173,10 +173,10 @@ static void uc5_vertex ()
if (v->w < 0.1f) v->scr_off |= 16; if (v->w < 0.1f) v->scr_off |= 16;
if (fabs(v->z_w) > 1.0) v->scr_off |= 32; if (fabs(v->z_w) > 1.0) v->scr_off |= 32;
v->r = ((wxUint8*)gfx.RDRAM)[(addr+start + 6)^3]; v->r = ((uint8_t*)gfx.RDRAM)[(addr+start + 6)^3];
v->g = ((wxUint8*)gfx.RDRAM)[(addr+start + 7)^3]; v->g = ((uint8_t*)gfx.RDRAM)[(addr+start + 7)^3];
v->b = ((wxUint8*)gfx.RDRAM)[(addr+start + 8)^3]; v->b = ((uint8_t*)gfx.RDRAM)[(addr+start + 8)^3];
v->a = ((wxUint8*)gfx.RDRAM)[(addr+start + 9)^3]; v->a = ((uint8_t*)gfx.RDRAM)[(addr+start + 9)^3];
CalculateFog (v); CalculateFog (v);
#ifdef EXTREME_LOGGING #ifdef EXTREME_LOGGING

View File

@ -125,11 +125,11 @@ typedef struct DRAWIMAGE_t {
wxUint16 imageW; wxUint16 imageW;
wxUint16 imageH; wxUint16 imageH;
uint32_t imagePtr; uint32_t imagePtr;
wxUint8 imageFmt; uint8_t imageFmt;
wxUint8 imageSiz; uint8_t imageSiz;
wxUint16 imagePal; wxUint16 imagePal;
wxUint8 flipX; uint8_t flipX;
wxUint8 flipY; uint8_t flipY;
float scaleX; float scaleX;
float scaleY; float scaleY;
} DRAWIMAGE; } DRAWIMAGE;
@ -144,10 +144,10 @@ typedef struct DRAWOBJECT_t {
wxUint16 imageStride; wxUint16 imageStride;
wxUint16 imageAdrs; wxUint16 imageAdrs;
wxUint8 imageFmt; uint8_t imageFmt;
wxUint8 imageSiz; uint8_t imageSiz;
wxUint8 imagePal; uint8_t imagePal;
wxUint8 imageFlags; uint8_t imageFlags;
} DRAWOBJECT; } DRAWOBJECT;
void DrawHiresDepthImage (const DRAWIMAGE & d) void DrawHiresDepthImage (const DRAWIMAGE & d)
@ -425,7 +425,7 @@ void DrawImage (DRAWIMAGE & d)
tile->size = d.imageSiz; // 16-bit tile->size = d.imageSiz; // 16-bit
tile->line = line; tile->line = line;
tile->t_mem = 0; tile->t_mem = 0;
tile->palette = (wxUint8)d.imagePal; tile->palette = (uint8_t)d.imagePal;
tile->clamp_t = 1; tile->clamp_t = 1;
tile->mirror_t = 0; tile->mirror_t = 0;
tile->mask_t = 0; tile->mask_t = 0;
@ -729,11 +729,11 @@ static void uc6_read_background_data (DRAWIMAGE & d, bool bReadScale)
d.frameH = ((wxUint16 *)gfx.RDRAM)[(addr+7)^1] >> 2; // 7 d.frameH = ((wxUint16 *)gfx.RDRAM)[(addr+7)^1] >> 2; // 7
d.imagePtr = segoffset(((uint32_t*)gfx.RDRAM)[(addr+8)>>1]); // 8,9 d.imagePtr = segoffset(((uint32_t*)gfx.RDRAM)[(addr+8)>>1]); // 8,9
d.imageFmt = ((wxUint8 *)gfx.RDRAM)[(((addr+11)<<1)+0)^3]; // 11 d.imageFmt = ((uint8_t *)gfx.RDRAM)[(((addr+11)<<1)+0)^3]; // 11
d.imageSiz = ((wxUint8 *)gfx.RDRAM)[(((addr+11)<<1)+1)^3]; // | d.imageSiz = ((uint8_t *)gfx.RDRAM)[(((addr+11)<<1)+1)^3]; // |
d.imagePal = ((wxUint16 *)gfx.RDRAM)[(addr+12)^1]; // 12 d.imagePal = ((wxUint16 *)gfx.RDRAM)[(addr+12)^1]; // 12
wxUint16 imageFlip = ((wxUint16 *)gfx.RDRAM)[(addr+13)^1]; // 13; wxUint16 imageFlip = ((wxUint16 *)gfx.RDRAM)[(addr+13)^1]; // 13;
d.flipX = (wxUint8)imageFlip&0x01; d.flipX = (uint8_t)imageFlip&0x01;
if (bReadScale) if (bReadScale)
{ {
@ -851,10 +851,10 @@ static void draw_split_triangle(VERTEX **vtx)
rdp.vtxbuf[index].u0 = 0.5f; rdp.vtxbuf[index].u0 = 0.5f;
rdp.vtxbuf[index].v0 = v1->v0 + (v2->v0 - v1->v0) * percent + 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.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].b = (uint8_t)(v1->b + (v2->b - v1->b) * percent);
rdp.vtxbuf[index].g = (wxUint8)(v1->g + (v2->g - v1->g) * percent); rdp.vtxbuf[index].g = (uint8_t)(v1->g + (v2->g - v1->g) * percent);
rdp.vtxbuf[index].r = (wxUint8)(v1->r + (v2->r - v1->r) * percent); rdp.vtxbuf[index].r = (uint8_t)(v1->r + (v2->r - v1->r) * percent);
rdp.vtxbuf[index++].a = (wxUint8)(v1->a + (v2->a - v1->a) * percent); rdp.vtxbuf[index++].a = (uint8_t)(v1->a + (v2->a - v1->a) * percent);
} }
} }
else else
@ -870,10 +870,10 @@ static void draw_split_triangle(VERTEX **vtx)
rdp.vtxbuf[index].u0 = 0.5f; rdp.vtxbuf[index].u0 = 0.5f;
rdp.vtxbuf[index].v0 = v2->v0 + (v1->v0 - v2->v0) * percent + 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.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].b = (uint8_t)(v2->b + (v1->b - v2->b) * percent);
rdp.vtxbuf[index].g = (wxUint8)(v2->g + (v1->g - v2->g) * percent); rdp.vtxbuf[index].g = (uint8_t)(v2->g + (v1->g - v2->g) * percent);
rdp.vtxbuf[index].r = (wxUint8)(v2->r + (v1->r - v2->r) * percent); rdp.vtxbuf[index].r = (uint8_t)(v2->r + (v1->r - v2->r) * percent);
rdp.vtxbuf[index++].a = (wxUint8)(v2->a + (v1->a - v2->a) * percent); rdp.vtxbuf[index++].a = (uint8_t)(v2->a + (v1->a - v2->a) * percent);
// Save the in point // Save the in point
rdp.vtxbuf[index] = *v2; rdp.vtxbuf[index] = *v2;
@ -913,10 +913,10 @@ static void draw_split_triangle(VERTEX **vtx)
rdp.vtxbuf[index].q = 1; rdp.vtxbuf[index].q = 1;
rdp.vtxbuf[index].u0 = 255.5f; rdp.vtxbuf[index].u0 = 255.5f;
rdp.vtxbuf[index].v0 = v1->v0 + (v2->v0 - v1->v0) * percent; 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].b = (uint8_t)(v1->b + (v2->b - v1->b) * percent);
rdp.vtxbuf[index].g = (wxUint8)(v1->g + (v2->g - v1->g) * percent); rdp.vtxbuf[index].g = (uint8_t)(v1->g + (v2->g - v1->g) * percent);
rdp.vtxbuf[index].r = (wxUint8)(v1->r + (v2->r - v1->r) * percent); rdp.vtxbuf[index].r = (uint8_t)(v1->r + (v2->r - v1->r) * percent);
rdp.vtxbuf[index++].a = (wxUint8)(v1->a + (v2->a - v1->a) * percent); rdp.vtxbuf[index++].a = (uint8_t)(v1->a + (v2->a - v1->a) * percent);
} }
} }
else else
@ -931,10 +931,10 @@ static void draw_split_triangle(VERTEX **vtx)
rdp.vtxbuf[index].q = 1; rdp.vtxbuf[index].q = 1;
rdp.vtxbuf[index].u0 = 255.5f; rdp.vtxbuf[index].u0 = 255.5f;
rdp.vtxbuf[index].v0 = v2->v0 + (v1->v0 - v2->v0) * percent; 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].b = (uint8_t)(v2->b + (v1->b - v2->b) * percent);
rdp.vtxbuf[index].g = (wxUint8)(v2->g + (v1->g - v2->g) * percent); rdp.vtxbuf[index].g = (uint8_t)(v2->g + (v1->g - v2->g) * percent);
rdp.vtxbuf[index].r = (wxUint8)(v2->r + (v1->r - v2->r) * percent); rdp.vtxbuf[index].r = (uint8_t)(v2->r + (v1->r - v2->r) * percent);
rdp.vtxbuf[index++].a = (wxUint8)(v2->a + (v1->a - v2->a) * percent); rdp.vtxbuf[index++].a = (uint8_t)(v2->a + (v1->a - v2->a) * percent);
// Save the in point // Save the in point
rdp.vtxbuf[index++] = *v2; rdp.vtxbuf[index++] = *v2;
@ -1008,10 +1008,10 @@ static void uc6_read_object_data (DRAWOBJECT & d)
d.imageStride = ((wxUint16 *)gfx.RDRAM)[(addr+8)^1]; // 8 d.imageStride = ((wxUint16 *)gfx.RDRAM)[(addr+8)^1]; // 8
d.imageAdrs = ((wxUint16 *)gfx.RDRAM)[(addr+9)^1]; // 9 d.imageAdrs = ((wxUint16 *)gfx.RDRAM)[(addr+9)^1]; // 9
d.imageFmt = ((wxUint8 *)gfx.RDRAM)[(((addr+10)<<1)+0)^3]; // 10 d.imageFmt = ((uint8_t *)gfx.RDRAM)[(((addr+10)<<1)+0)^3]; // 10
d.imageSiz = ((wxUint8 *)gfx.RDRAM)[(((addr+10)<<1)+1)^3]; // | d.imageSiz = ((uint8_t *)gfx.RDRAM)[(((addr+10)<<1)+1)^3]; // |
d.imagePal = ((wxUint8 *)gfx.RDRAM)[(((addr+10)<<1)+2)^3]; // 11 d.imagePal = ((uint8_t *)gfx.RDRAM)[(((addr+10)<<1)+2)^3]; // 11
d.imageFlags = ((wxUint8 *)gfx.RDRAM)[(((addr+10)<<1)+3)^3]; // | d.imageFlags = ((uint8_t *)gfx.RDRAM)[(((addr+10)<<1)+3)^3]; // |
if (d.imageW < 0) if (d.imageW < 0)
d.imageW = (short)rdp.scissor_o.lr_x - (short)d.objX - d.imageW; d.imageW = (short)rdp.scissor_o.lr_x - (short)d.objX - d.imageW;
@ -1223,7 +1223,7 @@ static void uc6_obj_rendermode ()
RDP_E ("uc6:obj_rendermode\n"); RDP_E ("uc6:obj_rendermode\n");
} }
static wxUint16 uc6_yuv_to_rgba(wxUint8 y, wxUint8 u, wxUint8 v) static wxUint16 uc6_yuv_to_rgba(uint8_t y, uint8_t u, uint8_t v)
{ {
float r = y + (1.370705f * (v-128)); float r = y + (1.370705f * (v-128));
float g = y - (0.698001f * (v-128)) - (0.337633f * (u-128)); float g = y - (0.698001f * (v-128)) - (0.337633f * (u-128));
@ -1270,10 +1270,10 @@ static void uc6_DrawYUVImageToFrameBuffer(wxUint16 ul_x, wxUint16 ul_y, wxUint16
uint32_t t = *(mb++); //each uint32_t 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 if ((h < height) && (w < width)) //clipping. texture image may be larger than color image
{ {
wxUint8 y0 = (wxUint8)t&0xFF; uint8_t y0 = (uint8_t)t&0xFF;
wxUint8 v = (wxUint8)(t>>8)&0xFF; uint8_t v = (uint8_t)(t>>8)&0xFF;
wxUint8 y1 = (wxUint8)(t>>16)&0xFF; uint8_t y1 = (uint8_t)(t>>16)&0xFF;
wxUint8 u = (wxUint8)(t>>24)&0xFF; uint8_t u = (uint8_t)(t>>24)&0xFF;
*(dst++) = uc6_yuv_to_rgba(y0, u, v); *(dst++) = uc6_yuv_to_rgba(y0, u, v);
*(dst++) = uc6_yuv_to_rgba(y1, u, v); *(dst++) = uc6_yuv_to_rgba(y1, u, v);
} }
@ -1476,8 +1476,8 @@ void uc6_sprite2d ()
wxUint16 stride = (((wxUint16 *)gfx.RDRAM)[(addr+4)^1]); // 4 wxUint16 stride = (((wxUint16 *)gfx.RDRAM)[(addr+4)^1]); // 4
d.imageW = (((wxUint16 *)gfx.RDRAM)[(addr+5)^1]); // 5 d.imageW = (((wxUint16 *)gfx.RDRAM)[(addr+5)^1]); // 5
d.imageH = (((wxUint16 *)gfx.RDRAM)[(addr+6)^1]); // 6 d.imageH = (((wxUint16 *)gfx.RDRAM)[(addr+6)^1]); // 6
d.imageFmt = ((wxUint8 *)gfx.RDRAM)[(((addr+7)<<1)+0)^3]; // 7 d.imageFmt = ((uint8_t *)gfx.RDRAM)[(((addr+7)<<1)+0)^3]; // 7
d.imageSiz = ((wxUint8 *)gfx.RDRAM)[(((addr+7)<<1)+1)^3]; // | d.imageSiz = ((uint8_t *)gfx.RDRAM)[(((addr+7)<<1)+1)^3]; // |
d.imagePal = 0; d.imagePal = 0;
d.imageX = (((wxUint16 *)gfx.RDRAM)[(addr+8)^1]); // 8 d.imageX = (((wxUint16 *)gfx.RDRAM)[(addr+8)^1]); // 8
d.imageY = (((wxUint16 *)gfx.RDRAM)[(addr+9)^1]); // 9 d.imageY = (((wxUint16 *)gfx.RDRAM)[(addr+9)^1]); // 9
@ -1518,8 +1518,8 @@ void uc6_sprite2d ()
//need to find, for which game this hack was made //need to find, for which game this hack was made
//if( (cmd1&0xFFFF) < 0x100 ) //if( (cmd1&0xFFFF) < 0x100 )
// d.scaleY = d.scaleX; // d.scaleY = d.scaleX;
d.flipX = (wxUint8)((cmd0>>8)&0xFF); d.flipX = (uint8_t)((cmd0>>8)&0xFF);
d.flipY = (wxUint8)(cmd0&0xFF); d.flipY = (uint8_t)(cmd0&0xFF);
a = rdp.pc[rdp.pc_i] & BMASK; a = rdp.pc[rdp.pc_i] & BMASK;
rdp.pc[rdp.pc_i] = (a+8) & BMASK; rdp.pc[rdp.pc_i] = (a+8) & BMASK;

View File

@ -134,7 +134,7 @@ static void uc7_vertex ()
if (v->y > v->w) v->scr_off |= 8; if (v->y > v->w) v->scr_off |= 8;
if (v->w < 0.1f) v->scr_off |= 16; 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]; v->a = color[0];
CalculateFog (v); CalculateFog (v);

View File

@ -94,7 +94,7 @@ static void uc8_vertex ()
v->ou = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 4)^1]; v->ou = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 4)^1];
v->ov = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 5)^1]; v->ov = (float)((short*)gfx.RDRAM)[(((addr+i) >> 1) + 5)^1];
v->uv_scaled = 0; 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 #ifdef EXTREME_LOGGING
FRDP ("before v%d - x: %f, y: %f, z: %f\n", i>>4, x, y, z); FRDP ("before v%d - x: %f, y: %f, z: %f\n", i>>4, x, y, z);
@ -125,9 +125,9 @@ static void uc8_vertex ()
if (v->y > v->w) v->scr_off |= 8; if (v->y > v->w) v->scr_off |= 8;
if (v->w < 0.1f) v->scr_off |= 16; if (v->w < 0.1f) v->scr_off |= 16;
///* ///*
v->r = ((wxUint8*)gfx.RDRAM)[(addr+i + 12)^3]; v->r = ((uint8_t*)gfx.RDRAM)[(addr+i + 12)^3];
v->g = ((wxUint8*)gfx.RDRAM)[(addr+i + 13)^3]; v->g = ((uint8_t*)gfx.RDRAM)[(addr+i + 13)^3];
v->b = ((wxUint8*)gfx.RDRAM)[(addr+i + 14)^3]; v->b = ((uint8_t*)gfx.RDRAM)[(addr+i + 14)^3];
#ifdef EXTREME_LOGGING #ifdef EXTREME_LOGGING
FRDP ("r: %02lx, g: %02lx, b: %02lx, a: %02lx\n", v->r, v->g, v->b, v->a); FRDP ("r: %02lx, g: %02lx, b: %02lx, a: %02lx\n", v->r, v->g, v->b, v->a);
#endif #endif
@ -223,9 +223,9 @@ static void uc8_vertex ()
if (color[0] > 1.0f) color[0] = 1.0f; if (color[0] > 1.0f) color[0] = 1.0f;
if (color[1] > 1.0f) color[1] = 1.0f; if (color[1] > 1.0f) color[1] = 1.0f;
if (color[2] > 1.0f) color[2] = 1.0f; if (color[2] > 1.0f) color[2] = 1.0f;
v->r = (wxUint8)(((float)v->r)*color[0]); v->r = (uint8_t)(((float)v->r)*color[0]);
v->g = (wxUint8)(((float)v->g)*color[1]); v->g = (uint8_t)(((float)v->g)*color[1]);
v->b = (wxUint8)(((float)v->b)*color[2]); v->b = (uint8_t)(((float)v->b)*color[2]);
#ifdef EXTREME_LOGGING #ifdef EXTREME_LOGGING
FRDP("color after light: r: 0x%02lx, g: 0x%02lx, b: 0x%02lx\n", v->r, v->g, v->b); FRDP("color after light: r: 0x%02lx, g: 0x%02lx, b: 0x%02lx\n", v->r, v->g, v->b);
#endif #endif
@ -235,7 +235,7 @@ static void uc8_vertex ()
static void uc8_moveword () static void uc8_moveword ()
{ {
wxUint8 index = (wxUint8)((rdp.cmd0 >> 16) & 0xFF); uint8_t index = (uint8_t)((rdp.cmd0 >> 16) & 0xFF);
wxUint16 offset = (wxUint16)(rdp.cmd0 & 0xFFFF); wxUint16 offset = (wxUint16)(rdp.cmd0 & 0xFFFF);
uint32_t data = rdp.cmd1; uint32_t data = rdp.cmd1;
@ -287,7 +287,7 @@ static void uc8_moveword ()
case 0x10: // moveword coord mod case 0x10: // moveword coord mod
{ {
wxUint8 n = offset >> 2; uint8_t n = offset >> 2;
FRDP ("coord mod:%d, %08lx\n", n, data); FRDP ("coord mod:%d, %08lx\n", n, data);
if (rdp.cmd0&8) if (rdp.cmd0&8)
@ -385,7 +385,7 @@ static void uc8_movemem ()
return; return;
} }
n -= 2; 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].r = (float)col / 255.0f;
rdp.light[n].nonblack = col; rdp.light[n].nonblack = col;
col = gfx.RDRAM[(addr+1)^3]; col = gfx.RDRAM[(addr+1)^3];

View File

@ -95,7 +95,7 @@ static int Calc_invw (int w) {
return Result.W; return Result.W;
} }
static void uc9_draw_object (wxUint8 * addr, uint32_t type) static void uc9_draw_object (uint8_t * addr, uint32_t type)
{ {
uint32_t textured, vnum, vsize; uint32_t textured, vnum, vsize;
switch (type) { switch (type) {
@ -184,7 +184,7 @@ static void uc9_draw_object (wxUint8 * addr, uint32_t type)
static uint32_t uc9_load_object (uint32_t zHeader, uint32_t * rdpcmds) static uint32_t uc9_load_object (uint32_t zHeader, uint32_t * rdpcmds)
{ {
uint32_t type = zHeader & 7; uint32_t type = zHeader & 7;
wxUint8 * addr = gfx.RDRAM + (zHeader&0xFFFFFFF8); uint8_t * addr = gfx.RDRAM + (zHeader&0xFFFFFFF8);
switch (type) { switch (type) {
case 1: //sh tri case 1: //sh tri
case 3: //sh quad case 3: //sh quad
@ -274,18 +274,18 @@ static void uc9_fmlight ()
break; break;
} }
rdp.light[rdp.num_lights].r = (float)(((wxUint8*)gfx.DMEM)[(a+0)^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)(((wxUint8*)gfx.DMEM)[(a+1)^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)(((wxUint8*)gfx.DMEM)[(a+2)^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; 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); 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; a += 8;
uint32_t i; uint32_t i;
for (i = 0; i < rdp.num_lights; 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].r = (float)(((uint8_t*)gfx.DMEM)[(a+0)^3]) / 255.0f;
rdp.light[i].g = (float)(((wxUint8*)gfx.DMEM)[(a+1)^3]) / 255.0f; rdp.light[i].g = (float)(((uint8_t*)gfx.DMEM)[(a+1)^3]) / 255.0f;
rdp.light[i].b = (float)(((wxUint8*)gfx.DMEM)[(a+2)^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].a = 1.0f;
rdp.light[i].dir_x = (float)(((char*)gfx.DMEM)[(a+8)^3]) / 127.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; rdp.light[i].dir_y = (float)(((char*)gfx.DMEM)[(a+9)^3]) / 127.0f;
@ -341,9 +341,9 @@ static void uc9_light ()
v.a = 0xFF; v.a = 0xFF;
if (use_material) if (use_material)
{ {
v.r = (wxUint8)(((uint32_t)v.r * gfx.DMEM[(csrs++)^3])>>8); v.r = (uint8_t)(((uint32_t)v.r * gfx.DMEM[(csrs++)^3])>>8);
v.g = (wxUint8)(((uint32_t)v.g * gfx.DMEM[(csrs++)^3])>>8); v.g = (uint8_t)(((uint32_t)v.g * gfx.DMEM[(csrs++)^3])>>8);
v.b = (wxUint8)(((uint32_t)v.b * gfx.DMEM[(csrs++)^3])>>8); v.b = (uint8_t)(((uint32_t)v.b * gfx.DMEM[(csrs++)^3])>>8);
v.a = gfx.DMEM[(csrs++)^3]; v.a = gfx.DMEM[(csrs++)^3];
} }
gfx.DMEM[(cdest++)^3] = v.r; gfx.DMEM[(cdest++)^3] = v.r;
@ -471,8 +471,8 @@ typedef struct {
short yi; short yi;
short xi; short xi;
short wi; short wi;
wxUint8 fog; uint8_t fog;
wxUint8 cc; uint8_t cc;
} zSortVDest; } zSortVDest;
static void uc9_mult_mpmtx () 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); int fog = (int)(z / w * rdp.fog_multiplier + rdp.fog_offset);
if (fog > 255) if (fog > 255)
fog = 255; fog = 255;
v.fog = (fog >= 0) ? (wxUint8)fog : 0; v.fog = (fog >= 0) ? (uint8_t)fog : 0;
} }
v.cc = 0; v.cc = 0;

View File

@ -66,8 +66,8 @@ static void fb_bg_copy ()
return; return;
uint32_t addr = segoffset(rdp.cmd1) >> 1; uint32_t addr = segoffset(rdp.cmd1) >> 1;
wxUint8 imageFmt = ((wxUint8 *)gfx.RDRAM)[(((addr+11)<<1)+0)^3]; uint8_t imageFmt = ((uint8_t *)gfx.RDRAM)[(((addr+11)<<1)+0)^3];
wxUint8 imageSiz = ((wxUint8 *)gfx.RDRAM)[(((addr+11)<<1)+1)^3]; uint8_t imageSiz = ((uint8_t *)gfx.RDRAM)[(((addr+11)<<1)+1)^3];
uint32_t imagePtr = segoffset(((uint32_t*)gfx.RDRAM)[(addr+8)>>1]); 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); 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);