Merge pull request #28 from project64/master

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

View File

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

View File

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

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

File diff suppressed because it is too large Load Diff

View File

@ -69,41 +69,41 @@
typedef struct typedef struct
{ {
wxUint32 ccolor; // constant color to set at the end, color and alpha uint32_t ccolor; // constant color to set at the end, color and alpha
wxUint32 c_fnc, c_fac, c_loc, c_oth; // grColorCombine flags uint32_t c_fnc, c_fac, c_loc, c_oth; // grColorCombine flags
wxUint32 a_fnc, a_fac, a_loc, a_oth; // grAlphaCombine flags uint32_t a_fnc, a_fac, a_loc, a_oth; // grAlphaCombine flags
wxUint32 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;
wxUint32 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;
wxUint32 abf1, abf2; uint32_t abf1, abf2;
wxUint32 mod_0, modcolor_0, modcolor1_0, modcolor2_0, modfactor_0; uint32_t mod_0, modcolor_0, modcolor1_0, modcolor2_0, modfactor_0;
wxUint32 mod_1, modcolor_1, modcolor1_1, modcolor2_1, modfactor_1; uint32_t mod_1, modcolor_1, modcolor1_1, modcolor2_1, modfactor_1;
//combine extensions //combine extensions
wxUint32 c_ext_a, c_ext_a_mode, c_ext_b, c_ext_b_mode, c_ext_c, c_ext_d; uint32_t c_ext_a, c_ext_a_mode, c_ext_b, c_ext_b_mode, c_ext_c, c_ext_d;
int c_ext_c_invert, c_ext_d_invert; int c_ext_c_invert, c_ext_d_invert;
wxUint32 a_ext_a, a_ext_a_mode, a_ext_b, a_ext_b_mode, a_ext_c, a_ext_d; uint32_t a_ext_a, a_ext_a_mode, a_ext_b, a_ext_b_mode, a_ext_c, a_ext_d;
int a_ext_c_invert, a_ext_d_invert; int a_ext_c_invert, a_ext_d_invert;
wxUint32 t0c_ext_a, t0c_ext_a_mode, t0c_ext_b, t0c_ext_b_mode, t0c_ext_c, t0c_ext_d; uint32_t t0c_ext_a, t0c_ext_a_mode, t0c_ext_b, t0c_ext_b_mode, t0c_ext_c, t0c_ext_d;
int t0c_ext_c_invert, t0c_ext_d_invert; int t0c_ext_c_invert, t0c_ext_d_invert;
wxUint32 t0a_ext_a, t0a_ext_a_mode, t0a_ext_b, t0a_ext_b_mode, t0a_ext_c, t0a_ext_d; uint32_t t0a_ext_a, t0a_ext_a_mode, t0a_ext_b, t0a_ext_b_mode, t0a_ext_c, t0a_ext_d;
int t0a_ext_c_invert, t0a_ext_d_invert; int t0a_ext_c_invert, t0a_ext_d_invert;
wxUint32 t1c_ext_a, t1c_ext_a_mode, t1c_ext_b, t1c_ext_b_mode, t1c_ext_c, t1c_ext_d; uint32_t t1c_ext_a, t1c_ext_a_mode, t1c_ext_b, t1c_ext_b_mode, t1c_ext_c, t1c_ext_d;
int t1c_ext_c_invert, t1c_ext_d_invert; int t1c_ext_c_invert, t1c_ext_d_invert;
wxUint32 t1a_ext_a, t1a_ext_a_mode, t1a_ext_b, t1a_ext_b_mode, t1a_ext_c, t1a_ext_d; uint32_t t1a_ext_a, t1a_ext_a_mode, t1a_ext_b, t1a_ext_b_mode, t1a_ext_c, t1a_ext_d;
int t1a_ext_c_invert, t1a_ext_d_invert; int t1a_ext_c_invert, t1a_ext_d_invert;
GRCOLORCOMBINEEXT grColorCombineExt; GRCOLORCOMBINEEXT grColorCombineExt;
GRCOLORCOMBINEEXT grAlphaCombineExt; GRCOLORCOMBINEEXT grAlphaCombineExt;
GRTEXCOLORCOMBINEEXT grTexColorCombineExt; GRTEXCOLORCOMBINEEXT grTexColorCombineExt;
GRTEXCOLORCOMBINEEXT grTexAlphaCombineExt; GRTEXCOLORCOMBINEEXT grTexAlphaCombineExt;
GRCONSTANTCOLORVALUEEXT grConstantColorValueExt; GRCONSTANTCOLORVALUEEXT grConstantColorValueExt;
wxUint32 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;
wxUint32 shade_mod_hash; uint32_t shade_mod_hash;
} COMBINE; } COMBINE;
extern COMBINE cmb; extern COMBINE cmb;

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -43,33 +43,33 @@
typedef struct TEX_INFO_t typedef struct TEX_INFO_t
{ {
wxUint32 cur_cache[2]; // Current cache # uint32_t cur_cache[2]; // Current cache #
wxUint8 format; uint8_t format;
wxUint8 size; uint8_t size;
wxUint32 width, height; uint32_t width, height;
wxUint16 line, wid; uint16_t 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; uint16_t ul_s, ul_t, lr_s, lr_t;
wxUint16 t_ul_s, t_ul_t, t_lr_s, t_lr_t; uint16_t t_ul_s, t_ul_t, t_lr_s, t_lr_t;
float scale_s, scale_t; float scale_s, scale_t;
int tmu; int tmu;
} TEX_INFO; } TEX_INFO;
typedef struct TRI_INFO_t typedef struct TRI_INFO_t
{ {
wxUint32 nv; // Number of vertices uint32_t nv; // Number of vertices
VERTEX *v; // Vertices (2d screen coords) of the triangle, used to outline VERTEX *v; // Vertices (2d screen coords) of the triangle, used to outline
wxUint32 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
wxUint32 geom_mode; // geometry mode flags uint32_t geom_mode; // geometry mode flags
wxUint32 othermode_h; // setothermode_h flags uint32_t othermode_h; // setothermode_h flags
wxUint32 othermode_l; // setothermode_l flags uint32_t othermode_l; // setothermode_l flags
wxUint32 tri_n; // Triangle number uint32_t tri_n; // Triangle number
wxUint32 flags; uint32_t flags;
int type; // 0-normal, 1-texrect, 2-fillrect int type; // 0-normal, 1-texrect, 2-fillrect
@ -77,12 +77,12 @@ typedef struct TRI_INFO_t
TEX_INFO t[2]; TEX_INFO t[2];
// colors // colors
wxUint32 fog_color; uint32_t fog_color;
wxUint32 fill_color; uint32_t fill_color;
wxUint32 prim_color; uint32_t prim_color;
wxUint32 blend_color; uint32_t blend_color;
wxUint32 env_color; uint32_t env_color;
wxUint32 prim_lodmin, prim_lodfrac; uint32_t prim_lodmin, prim_lodfrac;
TRI_INFO_t *pNext; TRI_INFO_t *pNext;
} TRI_INFO; } TRI_INFO;
@ -91,20 +91,20 @@ typedef struct DEBUGGER_t
{ {
int capture; // Capture moment for debugging? int capture; // Capture moment for debugging?
wxUint32 selected; // Selected object (see flags above) uint32_t selected; // Selected object (see flags above)
TRI_INFO *tri_sel; TRI_INFO *tri_sel;
wxUint32 tex_scroll; // texture scrolling uint32_t tex_scroll; // texture scrolling
wxUint32 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)
wxUint32 tmu; // tmu # uint32_t tmu; // tmu #
wxUint32 draw_mode; uint32_t draw_mode;
// Page number // Page number
int page; int page;

View File

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

View File

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

View File

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

View File

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

View File

@ -99,24 +99,24 @@ extern "C" {
#define _ENDUSER_RELEASE_ #define _ENDUSER_RELEASE_
//******** //********
// Logging // Logging
// ******************************** // ********************************
// ** TAKE OUT BEFORE RELEASE!!! ** // ** TAKE OUT BEFORE RELEASE!!! **
//#define LOGGING // log of spec functions called //#define LOGGING // log of spec functions called
//#define LOG_KEY // says "Key!!!" in the log when space bar is pressed //#define LOG_KEY // says "Key!!!" in the log when space bar is pressed
//#define LOG_UCODE //#define LOG_UCODE
//#define ALTTAB_FIX //#define ALTTAB_FIX
//#define EXTREME_LOGGING // lots of logging //#define EXTREME_LOGGING // lots of logging
// note that some of these things are inserted/removed // note that some of these things are inserted/removed
// from within the code & may not be changed by this define. // from within the code & may not be changed by this define.
//#define TLUT_LOGGING // log every entry of the TLUT? //#define TLUT_LOGGING // log every entry of the TLUT?
// ******************************** // ********************************
#define FPS // fps counter able? (not enabled necessarily) #define FPS // fps counter able? (not enabled necessarily)
@ -125,40 +125,39 @@ extern "C" {
#define LOG_COMMANDS // log the whole 64-bit command as (0x........, 0x........) #define LOG_COMMANDS // log the whole 64-bit command as (0x........, 0x........)
//#define CATCH_EXCEPTIONS // catch exceptions so it doesn't freeze and will report //#define CATCH_EXCEPTIONS // catch exceptions so it doesn't freeze and will report
// "The gfx plugin has caused an exception" instead. // "The gfx plugin has caused an exception" instead.
#define FLUSH // flush the file buffer. slower logging, but makes sure #define FLUSH // flush the file buffer. slower logging, but makes sure
// the command is logged before continuing (in case of // the command is logged before continuing (in case of
// crash or exception, the log will not be cut short) // crash or exception, the log will not be cut short)
#ifndef _ENDUSER_RELEASE_ #ifndef _ENDUSER_RELEASE_
#define RDP_LOGGING // Allow logging (will not log unless checked, but allows the option) #define RDP_LOGGING // Allow logging (will not log unless checked, but allows the option)
// Logging functions will not be compiled if this is not present. // Logging functions will not be compiled if this is not present.
//#define RDP_ERROR_LOG //#define RDP_ERROR_LOG
#endif #endif
#define FPS_FRAMES 10 // Number of frames in which to make an FPS count #define FPS_FRAMES 10 // Number of frames in which to make an FPS count
//#define SHOW_FULL_TEXVIEWER // shows the entire contents of the texture in the cache viewer, //#define SHOW_FULL_TEXVIEWER // shows the entire contents of the texture in the cache viewer,
// usually used to debug clamping issues. // usually used to debug clamping issues.
// Usually enabled
// Usually enabled
#define LARGE_TEXTURE_HANDLING // allow large-textured objects to be split? #define LARGE_TEXTURE_HANDLING // allow large-textured objects to be split?
#ifdef ALTTAB_FIX #ifdef ALTTAB_FIX
extern HHOOK hhkLowLevelKybd; extern HHOOK hhkLowLevelKybd;
extern LRESULT CALLBACK LowLevelKeyboardProc(int nCode, extern LRESULT CALLBACK LowLevelKeyboardProc(int nCode,
WPARAM wParam, LPARAM lParam); WPARAM wParam, LPARAM lParam);
#endif #endif
// Simulations // Simulations
//#define SIMULATE_VOODOO1 //#define SIMULATE_VOODOO1
//#define SIMULATE_BANSHEE //#define SIMULATE_BANSHEE
//******** //********
#ifdef EXT_LOGGING #ifdef EXT_LOGGING
extern std::ofstream extlog; extern std::ofstream extlog;
#define EXT(x) extlog.open("ext.txt",std::ios::app); extlog << x; extlog.close(); #define EXT(x) extlog.open("ext.txt",std::ios::app); extlog << x; extlog.close();
#else #else
#define EXT(x) #define EXT(x)
@ -172,40 +171,39 @@ extern std::ofstream extlog;
#define COLORED_DEBUGGER // ;) pretty colors #define COLORED_DEBUGGER // ;) pretty colors
#ifdef FPS #ifdef FPS
extern wxDateTime fps_last; extern wxDateTime fps_last;
extern wxDateTime fps_next; extern wxDateTime fps_next;
extern float fps; extern float fps;
extern wxUint32 fps_count; extern uint32_t fps_count;
#endif #endif
// rdram mask at 0x400000 bytes (bah, not right for majora's mask) // rdram mask at 0x400000 bytes (bah, not right for majora's mask)
//#define BMASK 0x7FFFFF //#define BMASK 0x7FFFFF
extern unsigned int BMASK; extern unsigned int BMASK;
#define WMASK 0x3FFFFF #define WMASK 0x3FFFFF
#define DMASK 0x1FFFFF #define DMASK 0x1FFFFF
extern wxUint32 update_screen_count; extern uint32_t update_screen_count;
extern wxUint32 resolutions[0x18][2]; extern uint32_t resolutions[0x18][2];
int CheckKeyPressed(int key, int mask); int CheckKeyPressed(int key, int mask);
//#define PERFORMANCE //#define PERFORMANCE
#ifdef PERFORMANCE #ifdef PERFORMANCE
extern int64 perf_cur; extern int64 perf_cur;
extern int64 perf_next; extern int64 perf_next;
#endif #endif
#ifdef LOGGING #ifdef LOGGING
extern std::ofstream loga; extern std::ofstream loga;
#define LOG(x) loga.open("glide64_log.txt",std::ios::app); loga << x; loga.flush(); loga.close(); #define LOG(x) loga.open("glide64_log.txt",std::ios::app); loga << x; loga.flush(); loga.close();
#else #else
#define LOG(x) #define LOG(x)
#endif #endif
#ifdef RDP_LOGGING #ifdef RDP_LOGGING
extern int log_open; extern int log_open;
extern std::ofstream rdp_log; extern std::ofstream rdp_log;
#define OPEN_RDP_LOG() EXT("OPEN_RDP_LOG ()\n"); if (settings.logging && !log_open) { rdp_log.open ("rdp.txt"); log_open=TRUE; } #define OPEN_RDP_LOG() EXT("OPEN_RDP_LOG ()\n"); if (settings.logging && !log_open) { rdp_log.open ("rdp.txt"); log_open=TRUE; }
#define CLOSE_RDP_LOG() EXT("CLOSE_RDP_LOG ()\n"); if (settings.logging && log_open) { rdp_log.close (); log_open=FALSE; } #define CLOSE_RDP_LOG() EXT("CLOSE_RDP_LOG ()\n"); if (settings.logging && log_open) { rdp_log.close (); log_open=FALSE; }
@ -221,10 +219,9 @@ extern std::ofstream rdp_log;
#define LRDP(x) #define LRDP(x)
#endif #endif
#ifdef RDP_ERROR_LOG #ifdef RDP_ERROR_LOG
extern int elog_open; extern int elog_open;
extern std::ofstream rdp_err; extern std::ofstream rdp_err;
#define OPEN_RDP_E_LOG() EXT("OPEN_RDP_E_LOG ()\n"); if (settings.elogging && !elog_open) { rdp_err.open ("rdp_e.txt"); elog_open=TRUE; } #define OPEN_RDP_E_LOG() EXT("OPEN_RDP_E_LOG ()\n"); if (settings.elogging && !elog_open) { rdp_err.open ("rdp_e.txt"); elog_open=TRUE; }
#define CLOSE_RDP_E_LOG() EXT("CLOSE_RDP_LOG ()\n"); if (settings.elogging && elog_open) { rdp_err.close (); elog_open=FALSE; } #define CLOSE_RDP_E_LOG() EXT("CLOSE_RDP_LOG ()\n"); if (settings.elogging && elog_open) { rdp_err.close (); elog_open=FALSE; }
#define RDP_E(x) if (settings.elogging) { FRDP_E (x); } #define RDP_E(x) if (settings.elogging) { FRDP_E (x); }
@ -235,69 +232,68 @@ extern std::ofstream rdp_err;
#endif #endif
#ifdef RDP_LOGGING #ifdef RDP_LOGGING
__inline void FRDP (const char *fmt, ...) __inline void FRDP(const char *fmt, ...)
{ {
if (!settings.logging || !log_open) return; if (!settings.logging || !log_open) return;
#ifdef LOGNOTKEY #ifdef LOGNOTKEY
if (CheckKeyPressed(LOGKEY,0x8000)) return; if (CheckKeyPressed(LOGKEY, 0x8000)) return;
#endif #endif
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
vsprintf(out_buf, fmt, ap); vsprintf(out_buf, fmt, ap);
LRDP (out_buf); LRDP(out_buf);
va_end(ap); va_end(ap);
} }
#else #else
__inline void FRDP (const char * /*fmt*/, ...) {} __inline void FRDP(const char * /*fmt*/, ...) {}
#endif #endif
#ifdef RDP_ERROR_LOG #ifdef RDP_ERROR_LOG
__inline void FRDP_E (const char *fmt, ...) __inline void FRDP_E(const char *fmt, ...)
{ {
if (!settings.elogging || !elog_open) return; if (!settings.elogging || !elog_open) return;
#ifdef LOGNOTKEY #ifdef LOGNOTKEY
if (CheckKeyPressed(LOGKEY,0x8000)) return; if (CheckKeyPressed(LOGKEY, 0x8000)) return;
#endif #endif
sprintf (out_buf, "%08lx: (%08lx, %08lx) ", rdp.pc[rdp.pc_i]-8, rdp.cmd0, rdp.cmd1); sprintf(out_buf, "%08lx: (%08lx, %08lx) ", rdp.pc[rdp.pc_i] - 8, rdp.cmd0, rdp.cmd1);
rdp_err << out_buf; rdp_err << out_buf;
va_list ap2; va_list ap2;
va_start(ap2, fmt); va_start(ap2, fmt);
vsprintf(out_buf, fmt, ap2); vsprintf(out_buf, fmt, ap2);
rdp_err << out_buf; rdp_err << out_buf;
rdp_err.flush(); rdp_err.flush();
va_end(ap2); va_end(ap2);
} }
#else #else
__inline void FRDP_E (const char * /*fmt*/, ...) {} __inline void FRDP_E(const char * /*fmt*/, ...) {}
#endif #endif
extern int fullscreen; extern int GfxInitDone;
extern int romopen; extern int romopen;
extern int to_fullscreen; extern int to_fullscreen;
extern int debugging; extern int debugging;
extern int evoodoo; extern int evoodoo;
extern int ev_fullscreen; extern int ev_fullscreen;
extern int exception; extern int exception;
extern wxMutex *mutexProcessDList;
int InitGfx (); int InitGfx();
void ReleaseGfx (); void ReleaseGfx();
// The highest 8 bits are the segment # (1-16), and the lower 24 bits are the offset to // The highest 8 bits are the segment # (1-16), and the lower 24 bits are the offset to
// add to it. // add to it.
__inline wxUint32 segoffset (wxUint32 so) __inline uint32_t segoffset(uint32_t so)
{ {
return (rdp.segment[(so>>24)&0x0f] + (so&BMASK))&BMASK; return (rdp.segment[(so >> 24) & 0x0f] + (so&BMASK))&BMASK;
} }
/* Plugin types */ /* Plugin types */
#define PLUGIN_TYPE_GFX 2 #define PLUGIN_TYPE_GFX 2
#ifdef __WINDOWS__ #ifdef __WINDOWS__
@ -308,104 +304,101 @@ __inline wxUint32 segoffset (wxUint32 so)
#define CALL #define CALL
#endif #endif
/***** Structures *****/ /***** Structures *****/
typedef struct { typedef struct {
wxUint16 Version; /* Set to 0x0103 */ wxUint16 Version; /* Set to 0x0103 */
wxUint16 Type; /* Set to PLUGIN_TYPE_GFX */ wxUint16 Type; /* Set to PLUGIN_TYPE_GFX */
char Name[100]; /* Name of the DLL */ char Name[100]; /* Name of the DLL */
/* 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 */
int NormalMemory; /* a normal wxUint8 array */ int NormalMemory; /* a normal wxUint8 array */
int MemoryBswaped; /* a normal wxUint8 array where the memory has been pre int MemoryBswaped; /* a normal wxUint8 array where the memory has been pre
bswap on a dword (32 bits) boundry */ bswap on a dword (32 bits) boundry */
} PLUGIN_INFO; } PLUGIN_INFO;
typedef struct { typedef struct {
HWND hWnd; /* Render window */ HWND hWnd; /* Render window */
HWND hStatusBar; /* if render window does not have a status bar then this is NULL */ HWND hStatusBar; /* if render window does not have a status bar then this is NULL */
int MemoryBswaped; // If this is set to TRUE, then the memory has been pre int MemoryBswaped; // If this is set to TRUE, then the memory has been pre
// bswap on a dword (32 bits) boundry // bswap on a dword (32 bits) boundry
// eg. the first 8 bytes are stored like this: // eg. the first 8 bytes are stored like this:
// 4 3 2 1 8 7 6 5 // 4 3 2 1 8 7 6 5
wxUint8 * HEADER; // This is the rom header (first 40h bytes of the rom wxUint8 * HEADER; // This is the rom header (first 40h bytes of the rom
// This will be in the same memory format as the rest of the memory. // This will be in the same memory format as the rest of the memory.
wxUint8 * RDRAM; wxUint8 * RDRAM;
wxUint8 * DMEM; wxUint8 * DMEM;
wxUint8 * IMEM; wxUint8 * IMEM;
wxUint32 * MI_INTR_REG; uint32_t * MI_INTR_REG;
wxUint32 * DPC_START_REG; uint32_t * DPC_START_REG;
wxUint32 * DPC_END_REG; uint32_t * DPC_END_REG;
wxUint32 * DPC_CURRENT_REG; uint32_t * DPC_CURRENT_REG;
wxUint32 * DPC_STATUS_REG; uint32_t * DPC_STATUS_REG;
wxUint32 * DPC_CLOCK_REG; uint32_t * DPC_CLOCK_REG;
wxUint32 * DPC_BUFBUSY_REG; uint32_t * DPC_BUFBUSY_REG;
wxUint32 * DPC_PIPEBUSY_REG; uint32_t * DPC_PIPEBUSY_REG;
wxUint32 * DPC_TMEM_REG; uint32_t * DPC_TMEM_REG;
wxUint32 * VI_STATUS_REG; uint32_t * VI_STATUS_REG;
wxUint32 * VI_ORIGIN_REG; uint32_t * VI_ORIGIN_REG;
wxUint32 * VI_WIDTH_REG; uint32_t * VI_WIDTH_REG;
wxUint32 * VI_INTR_REG; uint32_t * VI_INTR_REG;
wxUint32 * VI_V_CURRENT_LINE_REG; uint32_t * VI_V_CURRENT_LINE_REG;
wxUint32 * VI_TIMING_REG; uint32_t * VI_TIMING_REG;
wxUint32 * VI_V_SYNC_REG; uint32_t * VI_V_SYNC_REG;
wxUint32 * VI_H_SYNC_REG; uint32_t * VI_H_SYNC_REG;
wxUint32 * VI_LEAP_REG; uint32_t * VI_LEAP_REG;
wxUint32 * VI_H_START_REG; uint32_t * VI_H_START_REG;
wxUint32 * VI_V_START_REG; uint32_t * VI_V_START_REG;
wxUint32 * VI_V_BURST_REG; uint32_t * VI_V_BURST_REG;
wxUint32 * VI_X_SCALE_REG; uint32_t * VI_X_SCALE_REG;
wxUint32 * VI_Y_SCALE_REG; uint32_t * VI_Y_SCALE_REG;
void (*CheckInterrupts)( void ); void(*CheckInterrupts)(void);
} GFX_INFO; } GFX_INFO;
extern GFX_INFO gfx; extern GFX_INFO gfx;
extern wxWindow * GFXWindow; extern wxWindow * GFXWindow;
extern bool no_dlist; extern bool no_dlist;
typedef void (FX_CALL *GRCOLORCOMBINEEXT) (GrCCUColor_t a,
GrCombineMode_t a_mode,
GrCCUColor_t b,
GrCombineMode_t b_mode,
GrCCUColor_t c,
FxBool c_invert,
GrCCUColor_t d,
FxBool d_invert,
FxU32 shift,
FxBool invert);
typedef void (FX_CALL *GRTEXCOLORCOMBINEEXT) (GrChipID_t tmu,
GrTCCUColor_t a,
GrCombineMode_t a_mode,
GrTCCUColor_t b,
GrCombineMode_t b_mode,
GrTCCUColor_t c,
FxBool c_invert,
GrTCCUColor_t d,
FxBool d_invert,
FxU32 shift,
FxBool invert);
typedef void (FX_CALL *GRCOLORCOMBINEEXT) (GrCCUColor_t a, typedef void (FX_CALL *GRCONSTANTCOLORVALUEEXT)
GrCombineMode_t a_mode, (GrChipID_t tmu,
GrCCUColor_t b, GrColor_t value);
GrCombineMode_t b_mode,
GrCCUColor_t c,
FxBool c_invert,
GrCCUColor_t d,
FxBool d_invert,
FxU32 shift,
FxBool invert) ;
typedef void (FX_CALL *GRTEXCOLORCOMBINEEXT) (GrChipID_t tmu, typedef void (FX_CALL *GRSTIPPLE)(FxI32 mode);
GrTCCUColor_t a,
GrCombineMode_t a_mode,
GrTCCUColor_t b,
GrCombineMode_t b_mode,
GrTCCUColor_t c,
FxBool c_invert,
GrTCCUColor_t d,
FxBool d_invert,
FxU32 shift,
FxBool invert);
typedef void (FX_CALL *GRCONSTANTCOLORVALUEEXT) typedef int(*GETTEXADDR)(int tmu, int texsize);
(GrChipID_t tmu,
GrColor_t value);
typedef void (FX_CALL *GRSTIPPLE)( FxI32 mode) ; extern GRSTIPPLE grStippleModeExt;
extern GRSTIPPLE grStipplePatternExt;
extern GETTEXADDR GetTexAddr;
typedef int (*GETTEXADDR)(int tmu, int texsize);
extern GRSTIPPLE grStippleModeExt;
extern GRSTIPPLE grStipplePatternExt;
extern GETTEXADDR GetTexAddr;
#ifndef GR_STIPPLE_DISABLE #ifndef GR_STIPPLE_DISABLE
#define GR_STIPPLE_DISABLE 0x0 #define GR_STIPPLE_DISABLE 0x0
@ -413,259 +406,257 @@ extern GETTEXADDR GetTexAddr;
#define GR_STIPPLE_ROTATE 0x2 #define GR_STIPPLE_ROTATE 0x2
#endif #endif
void ReadSettings (); void ReadSettings();
void ReadSpecialSettings (const char * name); void ReadSpecialSettings(const char * name);
void WriteSettings (bool saveEmulationSettings = false); void WriteSettings(bool saveEmulationSettings = false);
/****************************************************************** /******************************************************************
Function: CaptureScreen Function: CaptureScreen
Purpose: This function dumps the current frame to a file Purpose: This function dumps the current frame to a file
input: pointer to the directory to save the file to input: pointer to the directory to save the file to
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL CaptureScreen ( char * Directory ); EXPORT void CALL CaptureScreen(char * Directory);
/****************************************************************** /******************************************************************
Function: ChangeWindow Function: ChangeWindow
Purpose: to change the window between fullscreen and window Purpose: to change the window between fullscreen and window
mode. If the window was in fullscreen this should mode. If the window was in fullscreen this should
change the screen to window mode and vice vesa. change the screen to window mode and vice vesa.
input: none input: none
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL ChangeWindow (void); EXPORT void CALL ChangeWindow(void);
/****************************************************************** /******************************************************************
Function: CloseDLL Function: CloseDLL
Purpose: This function is called when the emulator is closing Purpose: This function is called when the emulator is closing
down allowing the dll to de-initialise. down allowing the dll to de-initialise.
input: none input: none
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL CloseDLL (void); EXPORT void CALL CloseDLL(void);
/****************************************************************** /******************************************************************
Function: DllAbout Function: DllAbout
Purpose: This function is optional function that is provided Purpose: This function is optional function that is provided
to give further information about the DLL. to give further information about the DLL.
input: a handle to the window that calls this function input: a handle to the window that calls this function
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL DllAbout ( HWND hParent ); EXPORT void CALL DllAbout(HWND hParent);
/****************************************************************** /******************************************************************
Function: DllConfig Function: DllConfig
Purpose: This function is optional function that is provided Purpose: This function is optional function that is provided
to allow the user to configure the dll to allow the user to configure the dll
input: a handle to the window that calls this function input: a handle to the window that calls this function
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL DllConfig ( HWND hParent ); EXPORT void CALL DllConfig(HWND hParent);
/****************************************************************** /******************************************************************
Function: DllTest Function: DllTest
Purpose: This function is optional function that is provided Purpose: This function is optional function that is provided
to allow the user to test the dll to allow the user to test the dll
input: a handle to the window that calls this function input: a handle to the window that calls this function
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL DllTest ( HWND hParent ); EXPORT void CALL DllTest(HWND hParent);
EXPORT void CALL ReadScreen(void **dest, int *width, int *height);
EXPORT void CALL ReadScreen(void **dest, int *width, int *height); /******************************************************************
Function: DrawScreen
Purpose: This function is called when the emulator receives a
WM_PAINT message. This allows the gfx to fit in when
it is being used in the desktop.
input: none
output: none
*******************************************************************/
EXPORT void CALL DrawScreen(void);
/****************************************************************** /******************************************************************
Function: DrawScreen Function: GetDllInfo
Purpose: This function is called when the emulator receives a Purpose: This function allows the emulator to gather information
WM_PAINT message. This allows the gfx to fit in when about the dll by filling in the PluginInfo structure.
it is being used in the desktop. input: a pointer to a PLUGIN_INFO stucture that needs to be
input: none filled by the function. (see def above)
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL DrawScreen (void); EXPORT void CALL GetDllInfo(PLUGIN_INFO * PluginInfo);
/****************************************************************** /******************************************************************
Function: GetDllInfo Function: InitiateGFX
Purpose: This function allows the emulator to gather information Purpose: This function is called when the DLL is started to give
about the dll by filling in the PluginInfo structure. information from the emulator that the n64 graphics
input: a pointer to a PLUGIN_INFO stucture that needs to be uses. This is not called from the emulation thread.
filled by the function. (see def above) Input: Gfx_Info is passed to this function which is defined
output: none above.
*******************************************************************/ Output: TRUE on success
EXPORT void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo ); FALSE on failure to initialise
/****************************************************************** ** note on interrupts **:
Function: InitiateGFX To generate an interrupt set the appropriate bit in MI_INTR_REG
Purpose: This function is called when the DLL is started to give and then call the function CheckInterrupts to tell the emulator
information from the emulator that the n64 graphics that there is a waiting interrupt.
uses. This is not called from the emulation thread. *******************************************************************/
Input: Gfx_Info is passed to this function which is defined EXPORT int CALL InitiateGFX(GFX_INFO Gfx_Info);
above.
Output: TRUE on success
FALSE on failure to initialise
** note on interrupts **: /******************************************************************
To generate an interrupt set the appropriate bit in MI_INTR_REG Function: MoveScreen
and then call the function CheckInterrupts to tell the emulator Purpose: This function is called in response to the emulator
that there is a waiting interrupt. receiving a WM_MOVE passing the xpos and ypos passed
*******************************************************************/ from that message.
EXPORT int CALL InitiateGFX (GFX_INFO Gfx_Info); input: xpos - the x-coordinate of the upper-left corner of the
client area of the window.
ypos - y-coordinate of the upper-left corner of the
client area of the window.
output: none
*******************************************************************/
EXPORT void CALL MoveScreen(int xpos, int ypos);
/****************************************************************** /******************************************************************
Function: MoveScreen Function: ProcessDList
Purpose: This function is called in response to the emulator Purpose: This function is called when there is a Dlist to be
receiving a WM_MOVE passing the xpos and ypos passed processed. (High level GFX list)
from that message. input: none
input: xpos - the x-coordinate of the upper-left corner of the output: none
client area of the window. *******************************************************************/
ypos - y-coordinate of the upper-left corner of the EXPORT void CALL ProcessDList(void);
client area of the window.
output: none
*******************************************************************/
EXPORT void CALL MoveScreen (int xpos, int ypos);
/****************************************************************** /******************************************************************
Function: ProcessDList Function: ProcessRDPList
Purpose: This function is called when there is a Dlist to be Purpose: This function is called when there is a Dlist to be
processed. (High level GFX list) processed. (Low level GFX list)
input: none input: none
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL ProcessDList(void); EXPORT void CALL ProcessRDPList(void);
/****************************************************************** /******************************************************************
Function: ProcessRDPList Function: RomClosed
Purpose: This function is called when there is a Dlist to be Purpose: This function is called when a rom is closed.
processed. (Low level GFX list) input: none
input: none output: none
output: none *******************************************************************/
*******************************************************************/ EXPORT void CALL RomClosed(void);
EXPORT void CALL ProcessRDPList(void);
/****************************************************************** /******************************************************************
Function: RomClosed Function: RomOpen
Purpose: This function is called when a rom is closed. Purpose: This function is called when a rom is open. (from the
input: none emulation thread)
output: none input: none
*******************************************************************/ output: none
EXPORT void CALL RomClosed (void); *******************************************************************/
EXPORT void CALL RomOpen(void);
/****************************************************************** /******************************************************************
Function: RomOpen Function: ShowCFB
Purpose: This function is called when a rom is open. (from the Purpose: Useally once Dlists are started being displayed, cfb is
emulation thread) ignored. This function tells the dll to start displaying
input: none them again.
output: none input: none
*******************************************************************/ output: none
EXPORT void CALL RomOpen (void); *******************************************************************/
EXPORT void CALL ShowCFB(void);
/****************************************************************** /******************************************************************
Function: ShowCFB Function: UpdateScreen
Purpose: Useally once Dlists are started being displayed, cfb is Purpose: This function is called in response to a vsync of the
ignored. This function tells the dll to start displaying screen were the VI bit in MI_INTR_REG has already been
them again. set
input: none input: none
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL ShowCFB (void); EXPORT void CALL UpdateScreen(void);
/****************************************************************** /******************************************************************
Function: UpdateScreen Function: ViStatusChanged
Purpose: This function is called in response to a vsync of the Purpose: This function is called to notify the dll that the
screen were the VI bit in MI_INTR_REG has already been ViStatus registers value has been changed.
set input: none
input: none output: none
output: none *******************************************************************/
*******************************************************************/ EXPORT void CALL ViStatusChanged(void);
EXPORT void CALL UpdateScreen (void);
/****************************************************************** /******************************************************************
Function: ViStatusChanged Function: ViWidthChanged
Purpose: This function is called to notify the dll that the Purpose: This function is called to notify the dll that the
ViStatus registers value has been changed. ViWidth registers value has been changed.
input: none input: none
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL ViStatusChanged (void); EXPORT void CALL ViWidthChanged(void);
/****************************************************************** /******************************************************************
Function: ViWidthChanged Function: FrameBufferWrite
Purpose: This function is called to notify the dll that the Purpose: This function is called to notify the dll that the
ViWidth registers value has been changed. frame buffer has been modified by CPU at the given address.
input: none input: addr rdram address
output: none val val
*******************************************************************/ size 1 = wxUint8, 2 = wxUint16, 4 = uint32_t
EXPORT void CALL ViWidthChanged (void); output: none
*******************************************************************/
EXPORT void CALL FBWrite(uint32_t, uint32_t);
typedef struct
{
uint32_t addr;
uint32_t val;
uint32_t size; // 1 = wxUint8, 2 = wxUint16, 4=uint32_t
} FrameBufferModifyEntry;
/****************************************************************** /******************************************************************
Function: FrameBufferWrite Function: FrameBufferWriteList
Purpose: This function is called to notify the dll that the 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: FrameBufferModifyEntry *plist
val val size = size of the plist, max = 1024
size 1 = wxUint8, 2 = wxUint16, 4 = wxUint32 output: none
output: none *******************************************************************/
*******************************************************************/ EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, uint32_t size);
EXPORT void CALL FBWrite(wxUint32, wxUint32);
typedef struct /******************************************************************
{ Function: FrameBufferRead
wxUint32 addr; Purpose: This function is called to notify the dll that the
wxUint32 val; frame buffer memory is beening read at the given address.
wxUint32 size; // 1 = wxUint8, 2 = wxUint16, 4=wxUint32 DLL should copy content from its render buffer to the frame buffer
} FrameBufferModifyEntry; in N64 RDRAM
DLL is responsible to maintain its own frame buffer memory addr list
DLL should copy 4KB block content back to RDRAM frame buffer.
Emulator should not call this function again if other memory
is read within the same 4KB range
input: addr rdram address
val val
size 1 = wxUint8, 2 = wxUint16, 4 = uint32_t
output: none
*******************************************************************/
EXPORT void CALL FBRead(uint32_t addr);
/****************************************************************** /************************************************************************
Function: FrameBufferWriteList Function: FBGetFrameBufferInfo
Purpose: This function is called to notify the dll that the Purpose: This function is called by the emulator core to retrieve depth
frame buffer has been modified by CPU at the given address. buffer information from the video plugin in order to be able
input: FrameBufferModifyEntry *plist to notify the video plugin about CPU depth buffer read/write
size = size of the plist, max = 1024 operations
output: none
*******************************************************************/
EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, wxUint32 size);
/****************************************************************** size:
Function: FrameBufferRead = 1 byte
Purpose: This function is called to notify the dll that the = 2 word (16 bit) <-- this is N64 default depth buffer format
frame buffer memory is beening read at the given address. = 4 dword (32 bit)
DLL should copy content from its render buffer to the frame buffer
in N64 RDRAM
DLL is responsible to maintain its own frame buffer memory addr list
DLL should copy 4KB block content back to RDRAM frame buffer.
Emulator should not call this function again if other memory
is read within the same 4KB range
input: addr rdram address
val val
size 1 = wxUint8, 2 = wxUint16, 4 = wxUint32
output: none
*******************************************************************/
EXPORT void CALL FBRead(wxUint32 addr);
/************************************************************************ when depth buffer information is not available yet, set all values
Function: FBGetFrameBufferInfo in the FrameBufferInfo structure to 0
Purpose: This function is called by the emulator core to retrieve depth
buffer information from the video plugin in order to be able
to notify the video plugin about CPU depth buffer read/write
operations
size: input: FrameBufferInfo *pinfo
= 1 byte pinfo is pointed to a FrameBufferInfo structure which to be
= 2 word (16 bit) <-- this is N64 default depth buffer format filled in by this function
= 4 dword (32 bit) output: Values are return in the FrameBufferInfo structure
************************************************************************/
EXPORT void CALL FBGetFrameBufferInfo(void *pinfo);
when depth buffer information is not available yet, set all values EXPORT void CALL PluginLoaded(void);
in the FrameBufferInfo structure to 0
input: FrameBufferInfo *pinfo
pinfo is pointed to a FrameBufferInfo structure which to be
filled in by this function
output: Values are return in the FrameBufferInfo structure
************************************************************************/
EXPORT void CALL FBGetFrameBufferInfo(void *pinfo);
EXPORT void CALL PluginLoaded (void);
#if defined(__cplusplus) #if defined(__cplusplus)
} }

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

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

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

View File

@ -39,219 +39,212 @@
static inline void load16bRGBA(uint8_t *src, uint8_t *dst, int wid_64, int height, int line, int ext) static inline void load16bRGBA(uint8_t *src, uint8_t *dst, int wid_64, int height, int line, int ext)
{ {
uint32_t *v6; uint32_t *v6;
uint32_t *v7; uint32_t *v7;
int v8; int v8;
int v9; int v9;
uint32_t v10; uint32_t v10;
uint32_t v11; uint32_t v11;
uint32_t *v12; uint32_t *v12;
uint32_t *v13; uint32_t *v13;
int v14; int v14;
uint32_t v15; uint32_t v15;
uint32_t v16; uint32_t v16;
int v17; int v17;
int v18; int v18;
v6 = (uint32_t *)src; v6 = (uint32_t *)src;
v7 = (uint32_t *)dst; v7 = (uint32_t *)dst;
v8 = height; v8 = height;
do
{
v17 = v8;
v9 = wid_64;
do do
{ {
v10 = bswap32(*v6); v17 = v8;
v11 = bswap32(v6[1]); v9 = wid_64;
ALOWORD(v10) = __ROR__((uint16_t)v10, 1); do
ALOWORD(v11) = __ROR__((uint16_t)v11, 1); {
v10 = __ROR__(v10, 16); v10 = bswap32(*v6);
v11 = __ROR__(v11, 16); v11 = bswap32(v6[1]);
ALOWORD(v10) = __ROR__((uint16_t)v10, 1); ALOWORD(v10) = __ROR__((uint16_t)(v10 & 0xFFFF), 1);
ALOWORD(v11) = __ROR__((uint16_t)v11, 1); ALOWORD(v11) = __ROR__((uint16_t)(v11 & 0xFFFF), 1);
*v7 = v10; v10 = __ROR__(v10, 16);
v7[1] = v11; v11 = __ROR__(v11, 16);
v6 += 2; ALOWORD(v10) = __ROR__((uint16_t)(v10 & 0xFFFF), 1);
v7 += 2; ALOWORD(v11) = __ROR__((uint16_t)(v11 & 0xFFFF), 1);
--v9; *v7 = v10;
} v7[1] = v11;
while ( v9 ); v6 += 2;
if ( v17 == 1 ) v7 += 2;
break; --v9;
v18 = v17 - 1; } while (v9);
v12 = (uint32_t *)&src[(line + (uintptr_t)v6 - (uintptr_t)src) & 0xFFF]; if (v17 == 1)
v13 = (uint32_t *)((char *)v7 + ext); break;
v14 = wid_64; v18 = v17 - 1;
do v12 = (uint32_t *)&src[(line + (uintptr_t)v6 - (uintptr_t)src) & 0xFFF];
{ v13 = (uint32_t *)((char *)v7 + ext);
v15 = bswap32(v12[1]); v14 = wid_64;
v16 = bswap32(*v12); do
ALOWORD(v15) = __ROR__((uint16_t)v15, 1); {
ALOWORD(v16) = __ROR__((uint16_t)v16, 1); v15 = bswap32(v12[1]);
v15 = __ROR__(v15, 16); v16 = bswap32(*v12);
v16 = __ROR__(v16, 16); ALOWORD(v15) = __ROR__((uint16_t)(v15 & 0xFFFF), 1);
ALOWORD(v15) = __ROR__((uint16_t)v15, 1); ALOWORD(v16) = __ROR__((uint16_t)(v16 & 0xFFFF), 1);
ALOWORD(v16) = __ROR__((uint16_t)v16, 1); v15 = __ROR__(v15, 16);
*v13 = v15; v16 = __ROR__(v16, 16);
v13[1] = v16; ALOWORD(v15) = __ROR__((uint16_t)(v15 & 0xFFFF), 1);
v12 += 2; ALOWORD(v16) = __ROR__((uint16_t)(v16 & 0xFFFF), 1);
v13 += 2; *v13 = v15;
--v14; v13[1] = v16;
} v12 += 2;
while ( v14 ); v13 += 2;
v6 = (uint32_t *)&src[(line + (uintptr_t)v12 - (uintptr_t)src) & 0xFFF]; --v14;
v7 = (uint32_t *)((char *)v13 + ext); } while (v14);
v8 = v18 - 1; v6 = (uint32_t *)&src[(line + (uintptr_t)v12 - (uintptr_t)src) & 0xFFF];
} v7 = (uint32_t *)((char *)v13 + ext);
while ( v18 != 1 ); v8 = v18 - 1;
} while (v18 != 1);
} }
static inline void load16bIA(uint8_t *src, uint8_t *dst, int wid_64, int height, int line, int ext) static inline void load16bIA(uint8_t *src, uint8_t *dst, int wid_64, int height, int line, int ext)
{ {
uint32_t *v6; uint32_t *v6;
uint32_t *v7; uint32_t *v7;
int v8; int v8;
int v9; int v9;
uint32_t v10; uint32_t v10;
uint32_t *v11; uint32_t *v11;
uint32_t *v12; uint32_t *v12;
int v13; int v13;
uint32_t v14; uint32_t v14;
int v15; int v15;
int v16; int v16;
v6 = (uint32_t *)src; v6 = (uint32_t *)src;
v7 = (uint32_t *)dst; v7 = (uint32_t *)dst;
v8 = height; v8 = height;
do
{
v15 = v8;
v9 = wid_64;
do do
{ {
v10 = v6[1]; v15 = v8;
*v7 = *v6; v9 = wid_64;
v7[1] = v10; do
v6 += 2; {
v7 += 2; v10 = v6[1];
--v9; *v7 = *v6;
} v7[1] = v10;
while ( v9 ); v6 += 2;
if ( v15 == 1 ) v7 += 2;
break; --v9;
v16 = v15 - 1; } while (v9);
v11 = (uint32_t *)((char *)v6 + line); if (v15 == 1)
v12 = (uint32_t *)((char *)v7 + ext); break;
v13 = wid_64; v16 = v15 - 1;
do v11 = (uint32_t *)((char *)v6 + line);
{ v12 = (uint32_t *)((char *)v7 + ext);
v14 = *v11; v13 = wid_64;
*v12 = v11[1]; do
v12[1] = v14; {
v11 += 2; v14 = *v11;
v12 += 2; *v12 = v11[1];
--v13; v12[1] = v14;
} v11 += 2;
while ( v13 ); v12 += 2;
v6 = (uint32_t *)((char *)v11 + line); --v13;
v7 = (uint32_t *)((char *)v12 + ext); } while (v13);
v8 = v16 - 1; v6 = (uint32_t *)((char *)v11 + line);
} v7 = (uint32_t *)((char *)v12 + ext);
while ( v16 != 1 ); v8 = v16 - 1;
} while (v16 != 1);
} }
//**************************************************************** //****************************************************************
// Size: 2, Format: 0 // Size: 2, Format: 0
// //
wxUint32 Load16bRGBA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int /*tile*/) uint32_t Load16bRGBA(wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int /*tile*/)
{ {
if (wid_64 < 1) wid_64 = 1; if (wid_64 < 1) wid_64 = 1;
if (height < 1) height = 1; if (height < 1) height = 1;
int ext = (real_width - (wid_64 << 2)) << 1; int ext = (real_width - (wid_64 << 2)) << 1;
load16bRGBA((uint8_t *)src, (uint8_t *)dst, wid_64, height, line, ext); load16bRGBA((uint8_t *)src, (uint8_t *)dst, wid_64, height, line, ext);
return (1 << 16) | GR_TEXFMT_ARGB_1555; return (1 << 16) | GR_TEXFMT_ARGB_1555;
} }
//**************************************************************** //****************************************************************
// Size: 2, Format: 3 // Size: 2, Format: 3
// //
wxUint32 Load16bIA (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int /*tile*/) uint32_t Load16bIA(wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int real_width, int /*tile*/)
{ {
if (wid_64 < 1) wid_64 = 1; if (wid_64 < 1) wid_64 = 1;
if (height < 1) height = 1; if (height < 1) height = 1;
int ext = (real_width - (wid_64 << 2)) << 1; int ext = (real_width - (wid_64 << 2)) << 1;
load16bIA((uint8_t *)src, (uint8_t *)dst, wid_64, height, line, ext); load16bIA((uint8_t *)src, (uint8_t *)dst, wid_64, height, line, ext);
return (1 << 16) | GR_TEXFMT_ALPHA_INTENSITY_88; return (1 << 16) | GR_TEXFMT_ALPHA_INTENSITY_88;
} }
//**************************************************************** //****************************************************************
// Size: 2, Format: 1 // Size: 2, Format: 1
// //
wxUint16 yuv_to_rgb565(wxUint8 y, wxUint8 u, wxUint8 v) uint16_t yuv_to_rgb565(uint8_t y, uint8_t u, uint8_t v)
{ {
//* //*
float r = y + (1.370705f * (v-128)); 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));
float b = y + (1.732446f * (u-128)); float b = y + (1.732446f * (u - 128));
r *= 0.125f; r *= 0.125f;
g *= 0.25f; g *= 0.25f;
b *= 0.125f; b *= 0.125f;
//clipping the result //clipping the result
if (r > 31) r = 31; if (r > 31) r = 31;
if (g > 63) g = 63; if (g > 63) g = 63;
if (b > 31) b = 31; if (b > 31) b = 31;
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;
wxUint16 c = (wxUint16)(((wxUint16)(r) << 11) | uint16_t c = (uint16_t)(((uint16_t)(r) << 11) |
((wxUint16)(g) << 5) | ((uint16_t)(g) << 5) |
(wxUint16)(b) ); (uint16_t)(b));
return c; return c;
//*/ //*/
/* /*
const wxUint32 c = y - 16; const uint32_t c = y - 16;
const wxUint32 d = u - 128; const uint32_t d = u - 128;
const wxUint32 e = v - 128; const uint32_t e = v - 128;
wxUint32 r = (298 * c + 409 * e + 128) & 0xf800; uint32_t r = (298 * c + 409 * e + 128) & 0xf800;
wxUint32 g = ((298 * c - 100 * d - 208 * e + 128) >> 5) & 0x7e0; uint32_t g = ((298 * c - 100 * d - 208 * e + 128) >> 5) & 0x7e0;
wxUint32 b = ((298 * c + 516 * d + 128) >> 11) & 0x1f; uint32_t b = ((298 * c + 516 * d + 128) >> 11) & 0x1f;
WORD texel = (WORD)(r | g | b); WORD texel = (WORD)(r | g | b);
return texel; return texel;
*/ */
} }
//**************************************************************** //****************************************************************
// Size: 2, Format: 1 // Size: 2, Format: 1
// //
wxUint32 Load16bYUV (wxUIntPtr dst, wxUIntPtr /*src*/, int /*wid_64*/, int /*height*/, int /*line*/, int /*real_width*/, int tile) uint32_t Load16bYUV(wxUIntPtr dst, wxUIntPtr /*src*/, int /*wid_64*/, int /*height*/, int /*line*/, int /*real_width*/, int tile)
{ {
wxUint32 * mb = (wxUint32*)(gfx.RDRAM+rdp.addr[rdp.tiles[tile].t_mem]); //pointer to the macro block uint32_t * mb = (uint32_t*)(gfx.RDRAM + rdp.addr[rdp.tiles[tile].t_mem]); //pointer to the macro block
wxUint16 * tex = (wxUint16*)dst; uint16_t * tex = (uint16_t*)dst;
wxUint16 i; uint16_t i;
for (i = 0; i < 128; i++) for (i = 0; i < 128; i++)
{ {
wxUint32 t = mb[i]; //each wxUint32 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); uint16_t 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);
*(tex++) = c; *(tex++) = c;
} }
return (1 << 16) | GR_TEXFMT_RGB_565; return (1 << 16) | GR_TEXFMT_RGB_565;
} }

View File

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

View File

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

View File

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

View File

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

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

File diff suppressed because it is too large Load Diff

View File

@ -44,20 +44,20 @@
#define NOT_TMU1 0x01 #define NOT_TMU1 0x01
#define NOT_TMU2 0x02 #define NOT_TMU2 0x02
void util_init (); void util_init();
void render_tri (wxUint16 linew = 0); void render_tri(uint16_t linew = 0);
int cull_tri (VERTEX **v); int cull_tri(VERTEX **v);
void draw_tri (VERTEX **v, wxUint16 linew = 0); void draw_tri(VERTEX **v, uint16_t linew = 0);
void do_triangle_stuff (wxUint16 linew = 0, int old_interpolate = TRUE); void do_triangle_stuff(uint16_t linew = 0, int old_interpolate = TRUE);
void do_triangle_stuff_2 (wxUint16 linew = 0); void do_triangle_stuff_2(uint16_t linew = 0);
void add_tri (VERTEX *v, int n, int type); void add_tri(VERTEX *v, int n, int type);
void apply_shade_mods (VERTEX *v); void apply_shade_mods(VERTEX *v);
void update (); void update();
void update_scissor (); void update_scissor();
void set_message_combiner (); void set_message_combiner();
float ScaleZ(float z); float ScaleZ(float z);
@ -68,12 +68,12 @@ float ScaleZ(float z);
float p = (uc-ux)/(lx-ux); \ float p = (uc-ux)/(lx-ux); \
ut = p*(lt-ut)+ut; \ ut = p*(lt-ut)+ut; \
ux = uc; \ ux = uc; \
} \ } \
if (lx > lc) { \ if (lx > lc) { \
float p = (lc-ux)/(lx-ux); \ float p = (lc-ux)/(lx-ux); \
lt = p*(lt-ut)+ut; \ lt = p*(lt-ut)+ut; \
lx = lc; \ lx = lc; \
} }
#define CCLIP2(ux,lx,ut,lt,un,ln,uc,lc) \ #define CCLIP2(ux,lx,ut,lt,un,ln,uc,lc) \
if (ux > lx || lx < uc || ux > lc) { rdp.tri_n += 2; return; } \ if (ux > lx || lx < uc || ux > lc) { rdp.tri_n += 2; return; } \
@ -82,50 +82,61 @@ float ScaleZ(float z);
ut = p*(lt-ut)+ut; \ ut = p*(lt-ut)+ut; \
un = p*(ln-un)+un; \ un = p*(ln-un)+un; \
ux = uc; \ ux = uc; \
} \ } \
if (lx > lc) { \ if (lx > lc) { \
float p = (lc-ux)/(lx-ux); \ float p = (lc-ux)/(lx-ux); \
lt = p*(lt-ut)+ut; \ lt = p*(lt-ut)+ut; \
ln = p*(ln-un)+un; \ ln = p*(ln-un)+un; \
lx = lc; \ lx = lc; \
} }
#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) #if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
#include <stdlib.h> #include <stdlib.h>
#define bswap32(x) _byteswap_ulong(x) #define bswap32(x) _byteswap_ulong(x)
#else #else
static inline uint32_t bswap32(uint32_t val) static inline uint32_t bswap32(uint32_t val)
{ {
return (((val & 0xff000000) >> 24) | return (((val & 0xff000000) >> 24) |
((val & 0x00ff0000) >> 8) | ((val & 0x00ff0000) >> 8) |
((val & 0x0000ff00) << 8) | ((val & 0x0000ff00) << 8) |
((val & 0x000000ff) << 24)); ((val & 0x000000ff) << 24));
} }
#endif #endif
#define ALOWORD(x) (*((uint16_t*)&(x))) // low word #define ALOWORD(x) (*((uint16_t*)&(x))) // low word
static inline uint16_t __ROR__(uint16_t value, unsigned int count)
{
const unsigned int nbits = sizeof(uint16_t) * 8;
count %= nbits;
uint16_t low = (value << (nbits - count)) & 0xFFFF;
value >>= count;
value |= low;
return value;
}
template<class T> static inline T __ROR__(T value, unsigned int count) template<class T> static inline T __ROR__(T value, unsigned int count)
{ {
const unsigned int nbits = sizeof(T) * 8; const unsigned int nbits = sizeof(T) * 8;
count %= nbits; count %= nbits;
T low = value << (nbits - count); T low = value << (nbits - count);
value >>= count; value >>= count;
value |= low; value |= low;
return value; return value;
} }
// rotate left // rotate left
template<class T> static T __ROL__(T value, unsigned int count) template<class T> static T __ROL__(T value, unsigned int count)
{ {
const unsigned int nbits = sizeof(T) * 8; const unsigned int nbits = sizeof(T) * 8;
count %= nbits; count %= nbits;
T high = value >> (nbits - count); T high = value >> (nbits - count);
value <<= count; value <<= count;
value |= high; value |= high;
return value; return value;
} }
#endif // ifndef Util_H #endif // ifndef Util_H

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,

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -40,8 +40,8 @@
int cur_mtx = 0; int cur_mtx = 0;
int billboarding = 0; int billboarding = 0;
int vtx_last = 0; int vtx_last = 0;
wxUint32 dma_offset_mtx = 0; uint32_t dma_offset_mtx = 0;
wxUint32 dma_offset_vtx = 0; uint32_t dma_offset_vtx = 0;
static void uc5_dma_offsets () static void uc5_dma_offsets ()
{ {
@ -54,19 +54,19 @@ static void uc5_dma_offsets ()
static void uc5_matrix () static void uc5_matrix ()
{ {
// Use segment offset to get the address // Use segment offset to get the address
wxUint32 addr = dma_offset_mtx + (segoffset(rdp.cmd1) & BMASK); uint32_t addr = dma_offset_mtx + (segoffset(rdp.cmd1) & BMASK);
wxUint8 n = (wxUint8)((rdp.cmd0 >> 16) & 0xF); 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;
@ -106,7 +106,7 @@ static void uc5_matrix ()
static void uc5_vertex () static void uc5_vertex ()
{ {
wxUint32 addr = dma_offset_vtx + (segoffset(rdp.cmd1) & BMASK); uint32_t addr = dma_offset_vtx + (segoffset(rdp.cmd1) & BMASK);
// | cccc cccc 1111 1??? 0000 0002 2222 2222 | cmd1 = address | // | cccc cccc 1111 1??? 0000 0002 2222 2222 | cmd1 = address |
// c = vtx command // c = vtx command
@ -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
@ -199,7 +199,7 @@ static void uc5_tridma ()
// 2 = method #2 of getting count // 2 = method #2 of getting count
// 0 = unused // 0 = unused
wxUint32 addr = segoffset(rdp.cmd1) & BMASK; uint32_t addr = segoffset(rdp.cmd1) & BMASK;
int num = (rdp.cmd0 & 0xFFF0) >> 4; int num = (rdp.cmd0 & 0xFFF0) >> 4;
//int num = ((rdp.cmd0 & 0x00F00000) >> 20) + 1; // same thing! //int num = ((rdp.cmd0 & 0x00F00000) >> 20) + 1; // same thing!
FRDP("uc5:tridma #%d - addr: %08lx, count: %d\n", rdp.tri_n, addr, num); FRDP("uc5:tridma #%d - addr: %08lx, count: %d\n", rdp.tri_n, addr, num);
@ -264,7 +264,7 @@ static void uc5_tridma ()
static void uc5_dl_in_mem () static void uc5_dl_in_mem ()
{ {
wxUint32 addr = segoffset(rdp.cmd1) & BMASK; uint32_t addr = segoffset(rdp.cmd1) & BMASK;
int count = (rdp.cmd0 & 0x00FF0000) >> 16; int count = (rdp.cmd0 & 0x00FF0000) >> 16;
FRDP ("uc5:dl_in_mem - addr: %08lx, count: %d\n", addr, count); FRDP ("uc5:dl_in_mem - addr: %08lx, count: %d\n", addr, count);

File diff suppressed because it is too large Load Diff

View File

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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