[Glide64] Remove debugger

This commit is contained in:
zilmar 2017-01-23 17:24:01 +11:00
parent 52ab4949b4
commit 5961d9cb1d
15 changed files with 5 additions and 1666 deletions

View File

@ -44,938 +44,9 @@
#include "Util.h" #include "Util.h"
#include "Debugger.h" #include "Debugger.h"
GLIDE64_DEBUGGER _debugger;
#define SX(x) ((x)*rdp.scale_1024) #define SX(x) ((x)*rdp.scale_1024)
#define SY(x) ((x)*rdp.scale_768) #define SY(x) ((x)*rdp.scale_768)
#ifdef COLORED_DEBUGGER
#define COL_CATEGORY() grConstantColorValue(0xD288F400)
#define COL_UCC() grConstantColorValue(0xFF000000)
#define COL_CC() grConstantColorValue(0x88C3F400)
#define COL_UAC() grConstantColorValue(0xFF808000)
#define COL_AC() grConstantColorValue(0x3CEE5E00)
#define COL_TEXT() grConstantColorValue(0xFFFFFF00)
#define COL_SEL(x) grConstantColorValue((x)?0x00FF00FF:0x800000FF)
#else
#define COL_CATEGORY()
#define COL_UCC()
#define COL_CC()
#define COL_UAC()
#define COL_AC()
#define COL_TEXT()
#define COL_SEL(x)
#endif
#define COL_GRID 0xFFFFFF80
int grid = 0;
static const char *tri_type[4] = { "TRIANGLE", "TEXRECT", "FILLRECT", "BACKGROUND" };
//Platform-specific stuff
#ifndef _WIN32
typedef struct dbgPOINT {
int x;
int y;
} POINT;
#endif
void DbgCursorPos(POINT * pt)
{
pt->x = pt->y = 0;
}
//
// debug_init - initialize the debugger
//
void debug_init ()
{
_debugger.capture = 0;
_debugger.selected = SELECTED_TRI;
_debugger.screen = NULL;
_debugger.tri_list = NULL;
_debugger.tri_last = NULL;
_debugger.tri_sel = NULL;
_debugger.tmu = 0;
_debugger.tex_scroll = 0;
_debugger.tex_sel = 0;
_debugger.draw_mode = 0;
}
//
// debug_cacheviewer - views the debugger's cache
//
void debug_cacheviewer ()
{
grCullMode (GR_CULL_DISABLE);
int i;
for (i=0; i<2; i++)
{
grTexFilterMode (i,
(g_settings->filter_cache)?GR_TEXTUREFILTER_BILINEAR:GR_TEXTUREFILTER_POINT_SAMPLED,
(g_settings->filter_cache)?GR_TEXTUREFILTER_BILINEAR:GR_TEXTUREFILTER_POINT_SAMPLED);
grTexClampMode (i,
GR_TEXTURECLAMP_CLAMP,
GR_TEXTURECLAMP_CLAMP);
}
switch (_debugger.draw_mode)
{
case 0:
grColorCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
grAlphaCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
break;
case 1:
grColorCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
grAlphaCombine (GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
FXFALSE);
grConstantColorValue (0xFFFFFFFF);
break;
case 2:
grColorCombine (GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
FXFALSE);
grAlphaCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
grConstantColorValue (0xFFFFFFFF);
}
if (_debugger.tmu == 1)
{
grTexCombine (GR_TMU1,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
FXFALSE,
FXFALSE);
grTexCombine (GR_TMU0,
GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
FXFALSE,
FXFALSE);
}
else
{
grTexCombine (GR_TMU0,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
FXFALSE,
FXFALSE);
}
grAlphaBlendFunction (GR_BLEND_SRC_ALPHA,
GR_BLEND_ONE_MINUS_SRC_ALPHA,
GR_BLEND_ONE,
GR_BLEND_ZERO);
// Draw texture memory
for (i=0; i<4; i++)
{
for (uint32_t x=0; x<16; x++)
{
uint32_t y = i+_debugger.tex_scroll;
if (x+y*16 >= (uint32_t)rdp.n_cached[_debugger.tmu]) break;
CACHE_LUT * cache = voodoo.tex_UMA?rdp.cache[0]:rdp.cache[_debugger.tmu];
VERTEX v[4] = {
{ SX(x*64.0f), SY(512+64.0f*i), 1, 1, 0, 0, 0, 0, {0, 0, 0, 0} },
{ SX(x*64.0f+64.0f*cache[x+y*16].scale_x), SY(512+64.0f*i), 1, 1, 255*cache[x+y*16].scale_x, 0, 0, 0, {0, 0, 0, 0} },
{ SX(x*64.0f), SY(512+64.0f*i+64.0f*cache[x+y*16].scale_y), 1, 1, 0, 255*cache[x+y*16].scale_y, 0, 0, {0, 0, 0, 0} },
{ SX(x*64.0f+64.0f*cache[x+y*16].scale_x), SY(512+64.0f*i+64.0f*cache[x+y*16].scale_y), 1, 1, 255*cache[x+y*16].scale_x, 255*cache[x+y*16].scale_y, 0, 0, {0, 0, 0, 0} }
};
for
(int i=0; i<4; i++)
{
v[i].u1 = v[i].u0;
v[i].v1 = v[i].v0;
}
ConvertCoordsConvert (v, 4);
grTexSource(_debugger.tmu,
voodoo.tex_min_addr[_debugger.tmu] + cache[x+y*16].tmem_addr,
GR_MIPMAPLEVELMASK_BOTH,
&cache[x+y*16].t_info);
grDrawTriangle (&v[2], &v[1], &v[0]);
grDrawTriangle (&v[2], &v[3], &v[1]);
}
}
}
//
// debug_capture - does a frame capture event (for debugging)
//
void debug_capture ()
{
uint32_t i,j;
if (_debugger.tri_list == NULL) goto END;
_debugger.tri_sel = _debugger.tri_list;
_debugger.selected = SELECTED_TRI;
// Connect the list
_debugger.tri_last->pNext = _debugger.tri_list;
while (!CheckKeyPressed(G64_VK_INSERT, 0x0001)) //INSERT
{
// Check for clicks
if (CheckKeyPressed(G64_VK_LBUTTON, 0x0001)) //LBUTTON
{
POINT pt;
DbgCursorPos(&pt);
//int diff = g_settings->scr_res_y-g_settings->res_y;
if (pt.y <= (int)g_settings->res_y)
{
int x = pt.x;
int y = pt.y;//g_settings->res_y - (pt.y - diff);
TRI_INFO *start;
TRI_INFO *tri;
if (_debugger.tri_sel == NULL) tri = _debugger.tri_list, start = _debugger.tri_list;
else tri = _debugger.tri_sel->pNext, start = _debugger.tri_sel;
// Select a triangle (start from the currently selected one)
do {
if (tri->v[0].x == tri->v[1].x &&
tri->v[0].y == tri->v[1].y)
{
tri = tri->pNext;
continue;
}
for (i=0; i<tri->nv; i++)
{
j=i+1;
if (j==tri->nv) j=0;
if ((y-tri->v[i].y)*(tri->v[j].x-tri->v[i].x) -
(x-tri->v[i].x)*(tri->v[j].y-tri->v[i].y) < 0)
break; // It's outside
}
if (i==tri->nv) // all lines passed
{
_debugger.tri_sel = tri;
break;
}
for (i=0; i<tri->nv; i++)
{
j=i+1;
if (j==tri->nv) j=0;
if ((y-tri->v[i].y)*(tri->v[j].x-tri->v[i].x) -
(x-tri->v[i].x)*(tri->v[j].y-tri->v[i].y) > 0)
break; // It's outside
}
if (i==tri->nv) // all lines passed
{
_debugger.tri_sel = tri;
break;
}
tri = tri->pNext;
} while (tri != start);
}
else
{
// on a texture
_debugger.tex_sel = (((uint32_t)((pt.y-SY(512))/SY(64))+_debugger.tex_scroll)*16) +
(uint32_t)(pt.x/SX(64));
}
}
debug_keys ();
grBufferClear (0, 0, 0xFFFF);
// Copy the screen capture back to the screen:
grLfbWriteRegion(GR_BUFFER_BACKBUFFER,
(uint32_t)rdp.offset_x,
(uint32_t)rdp.offset_y,
GR_LFB_SRC_FMT_565,
g_settings->res_x,
g_settings->res_y,
FXFALSE,
g_settings->res_x<<1,
_debugger.screen);
// Do the cacheviewer
debug_cacheviewer ();
// **
// 3/16/02: Moved texture viewer out of loop, remade it. Now it's simpler, and
// supports TMU1. [Dave2001]
// Original by Gugaman
CACHE_LUT * cache = voodoo.tex_UMA?rdp.cache[0]:rdp.cache[_debugger.tmu];
if (_debugger.page == PAGE_TEX_INFO)
{
grTexSource(_debugger.tmu,
voodoo.tex_min_addr[_debugger.tmu] + cache[_debugger.tex_sel].tmem_addr,
GR_MIPMAPLEVELMASK_BOTH,
&cache[_debugger.tex_sel].t_info);
#ifdef SHOW_FULL_TEXVIEWER
float scx = 1.0f;
float scy = 1.0f;
#else
float scx = cache[_debugger.tex_sel].scale_x;
float scy = cache[_debugger.tex_sel].scale_y;
#endif
VERTEX v[4] = {
{ SX(704.0f), SY(221.0f), 1, 1, 0, 0, 0, 0, {0, 0, 0, 0} },
{ SX(704.0f+256.0f*scx), SY(221.0f), 1, 1, 255*scx, 0, 255*scx, 0, {0, 0, 0, 0} },
{ SX(704.0f), SY(221.0f+256.0f*scy), 1, 1, 0, 255*scy, 0, 255*scy, {0, 0, 0, 0} },
{ SX(704.0f+256.0f*scx), SY(221.0f+256.0f*scy), 1, 1, 255*scx, 255*scy, 255*scx, 255*scy, {0, 0, 0, 0} }
};
ConvertCoordsConvert (v, 4);
VERTEX *varr[4] = { &v[0], &v[1], &v[2], &v[3] };
grDrawVertexArray (GR_TRIANGLE_STRIP, 4, varr);
}
// **
grTexFilterMode (GR_TMU0,
GR_TEXTUREFILTER_BILINEAR,
GR_TEXTUREFILTER_BILINEAR);
grColorCombine (GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
FXFALSE);
grAlphaCombine (GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
FXFALSE);
grConstantColorValue (0x0000FFFF);
VERTEX *v[8];
if (_debugger.tri_sel)
{
// Draw the outline around the selected triangle
for (i=0; i<_debugger.tri_sel->nv; i++)
{
j=i+1;
if (j>=_debugger.tri_sel->nv) j=0;
grDrawLine (&_debugger.tri_sel->v[i], &_debugger.tri_sel->v[j]);
v[i] = &_debugger.tri_sel->v[i];
}
}
// and the selected texture
uint32_t t_y = ((_debugger.tex_sel & 0xFFFFFFF0) >> 4) - _debugger.tex_scroll;
uint32_t t_x = _debugger.tex_sel & 0xF;
VERTEX vt[4] = {
{ SX(t_x*64.0f), SY(512+64.0f*t_y), 1, 1 },
{ SX(t_x*64.0f+64.0f), SY(512+64.0f*t_y), 1, 1 },
{ SX(t_x*64.0f), SY(512+64.0f*t_y+64.0f), 1, 1 },
{ SX(t_x*64.0f+64.0f), SY(512+64.0f*t_y+64.0f), 1, 1 } };
if (t_y < 4)
{
grDrawLine (&vt[0], &vt[1]);
grDrawLine (&vt[1], &vt[3]);
grDrawLine (&vt[3], &vt[2]);
grDrawLine (&vt[2], &vt[0]);
}
grConstantColorValue (0xFF000020);
if (t_y < 4)
{
grDrawTriangle (&vt[2], &vt[1], &vt[0]);
grDrawTriangle (&vt[2], &vt[3], &vt[1]);
}
if (_debugger.tri_sel)
grDrawVertexArray (GR_TRIANGLE_FAN, _debugger.tri_sel->nv, &v);
// Draw the outline of the cacheviewer
if (_debugger.page == PAGE_TEX_INFO)
{
float scx = cache[_debugger.tex_sel].scale_x;
float scy = cache[_debugger.tex_sel].scale_y;
// And the grid
if (grid)
{
grConstantColorValue (COL_GRID);
float scale_y = (256.0f * scy) / (float)cache[_debugger.tex_sel].height;
for (int y=0; y<=(int)cache[_debugger.tex_sel].height; y++)
{
float y_val = SY(221.0f+y*scale_y);
VERTEX vh[2] = {
{ SX(704.0f), y_val, 1, 1 },
{ SX(704.0f+255.0f*scx), y_val, 1, 1 } };
grDrawLine (&vh[0], &vh[1]);
}
float scale_x = (256.0f * scx) / (float)cache[_debugger.tex_sel].width;
for (int x=0; x<=(int)cache[_debugger.tex_sel].width; x++)
{
float x_val = SX(704.0f+x*scale_x);
VERTEX vv[2] = {
{ x_val, SX(221.0f), 1, 1 },
{ x_val, SX(221.0f+256.0f*scy), 1, 1 } };
grDrawLine (&vv[0], &vv[1]);
}
}
}
grTexCombine (GR_TMU0,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
FXFALSE,
FXFALSE);
grColorCombine (GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
FXFALSE);
grAlphaCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
grConstantColorValue (0xFFFFFF00);
// Output the information about the selected triangle
grTexSource(GR_TMU0, // Text
voodoo.tex_min_addr[_debugger.tmu]+ offset_font,
GR_MIPMAPLEVELMASK_BOTH,
&fontTex);
static const char *cycle_mode_s[4] = { "1 cycle (0)", "2 cycle (1)", "copy (2)", "fill (3)" };
#define OUTPUT(fmt,other) output(642,(float)i,1,fmt,other); i-=16;
#define OUTPUT1(fmt,other,other1) output(642,(float)i,1,fmt,other,other1); i-=16;
#define OUTPUT_(fmt,cc) COL_SEL(cc); x=642; output(x,(float)i,1,fmt,0); x+=8*(strlen(fmt)+1)
#define _OUTPUT(fmt,cc) COL_SEL(cc); output(x,(float)i,1,fmt,0); x+=8*(strlen(fmt)+1)
i = 740;
float x;
if (_debugger.page == PAGE_GENERAL && _debugger.tri_sel)
{
COL_CATEGORY();
OUTPUT ("GENERAL (page 1):",0);
COL_TEXT();
OUTPUT ("tri #%d", _debugger.tri_sel->tri_n);
OUTPUT ("type: %s", tri_type[_debugger.tri_sel->type]);
OUTPUT ("geom: 0x%08lx", _debugger.tri_sel->geom_mode);
OUTPUT ("othermode_h: 0x%08lx", _debugger.tri_sel->othermode_h);
OUTPUT ("othermode_l: 0x%08lx", _debugger.tri_sel->othermode_l);
OUTPUT ("flags: 0x%08lx", _debugger.tri_sel->flags);
OUTPUT ("",0);
COL_CATEGORY();
OUTPUT ("COMBINE:",0);
COL_TEXT();
OUTPUT ("cycle_mode: %s", cycle_mode_s[_debugger.tri_sel->cycle_mode]);
OUTPUT ("cycle1: 0x%08lx", _debugger.tri_sel->cycle1);
OUTPUT ("cycle2: 0x%08lx", _debugger.tri_sel->cycle2);
if (_debugger.tri_sel->uncombined & 1)
COL_UCC();
else
COL_CC();
OUTPUT ("a0: %s", Mode0[(_debugger.tri_sel->cycle1)&0x0000000F]);
OUTPUT ("b0: %s", Mode1[(_debugger.tri_sel->cycle1>>4)&0x0000000F]);
OUTPUT ("c0: %s", Mode2[(_debugger.tri_sel->cycle1>>8)&0x0000001F]);
OUTPUT ("d0: %s", Mode3[(_debugger.tri_sel->cycle1>>13)&0x00000007]);
if (_debugger.tri_sel->uncombined & 2)
COL_UAC();
else
COL_AC();
OUTPUT ("Aa0: %s", Alpha0[(_debugger.tri_sel->cycle1>>16)&0x00000007]);
OUTPUT ("Ab0: %s", Alpha1[(_debugger.tri_sel->cycle1>>19)&0x00000007]);
OUTPUT ("Ac0: %s", Alpha2[(_debugger.tri_sel->cycle1>>22)&0x00000007]);
OUTPUT ("Ad0: %s", Alpha3[(_debugger.tri_sel->cycle1>>25)&0x00000007]);
if (_debugger.tri_sel->uncombined & 1)
COL_UCC();
else
COL_CC();
OUTPUT ("a1: %s", Mode0[(_debugger.tri_sel->cycle2)&0x0000000F]);
OUTPUT ("b1: %s", Mode1[(_debugger.tri_sel->cycle2>>4)&0x0000000F]);
OUTPUT ("c1: %s", Mode2[(_debugger.tri_sel->cycle2>>8)&0x0000001F]);
OUTPUT ("d1: %s", Mode3[(_debugger.tri_sel->cycle2>>13)&0x00000007]);
if (_debugger.tri_sel->uncombined & 2)
COL_UAC();
else
COL_AC();
OUTPUT ("Aa1: %s", Alpha0[(_debugger.tri_sel->cycle2>>16)&0x00000007]);
OUTPUT ("Ab1: %s", Alpha1[(_debugger.tri_sel->cycle2>>19)&0x00000007]);
OUTPUT ("Ac1: %s", Alpha2[(_debugger.tri_sel->cycle2>>22)&0x00000007]);
OUTPUT ("Ad1: %s", Alpha3[(_debugger.tri_sel->cycle2>>25)&0x00000007]);
}
if ((_debugger.page == PAGE_TEX1 || _debugger.page == PAGE_TEX2) && _debugger.tri_sel)
{
COL_CATEGORY ();
OUTPUT1 ("TEXTURE %d (page %d):", _debugger.page-PAGE_TEX1, 2+_debugger.page-PAGE_TEX1);
COL_TEXT();
int tmu = _debugger.page - PAGE_TEX1;
OUTPUT1 ("cur cache: %d,%d", _debugger.tri_sel->t[tmu].cur_cache[tmu]&0x0F, _debugger.tri_sel->t[tmu].cur_cache[tmu]>>4);
OUTPUT ("tex_size: %d", _debugger.tri_sel->t[tmu].size);
OUTPUT ("tex_format: %d", _debugger.tri_sel->t[tmu].format);
OUTPUT ("width: %d", _debugger.tri_sel->t[tmu].width);
OUTPUT ("height: %d", _debugger.tri_sel->t[tmu].height);
OUTPUT ("palette: %d", _debugger.tri_sel->t[tmu].palette);
OUTPUT ("clamp_s: %d", _debugger.tri_sel->t[tmu].clamp_s);
OUTPUT ("clamp_t: %d", _debugger.tri_sel->t[tmu].clamp_t);
OUTPUT ("mirror_s: %d", _debugger.tri_sel->t[tmu].mirror_s);
OUTPUT ("mirror_t: %d", _debugger.tri_sel->t[tmu].mirror_t);
OUTPUT ("mask_s: %d", _debugger.tri_sel->t[tmu].mask_s);
OUTPUT ("mask_t: %d", _debugger.tri_sel->t[tmu].mask_t);
OUTPUT ("shift_s: %d", _debugger.tri_sel->t[tmu].shift_s);
OUTPUT ("shift_t: %d", _debugger.tri_sel->t[tmu].shift_t);
OUTPUT ("ul_s: %d", _debugger.tri_sel->t[tmu].ul_s);
OUTPUT ("ul_t: %d", _debugger.tri_sel->t[tmu].ul_t);
OUTPUT ("lr_s: %d", _debugger.tri_sel->t[tmu].lr_s);
OUTPUT ("lr_t: %d", _debugger.tri_sel->t[tmu].lr_t);
OUTPUT ("t_ul_s: %d", _debugger.tri_sel->t[tmu].t_ul_s);
OUTPUT ("t_ul_t: %d", _debugger.tri_sel->t[tmu].t_ul_t);
OUTPUT ("t_lr_s: %d", _debugger.tri_sel->t[tmu].t_lr_s);
OUTPUT ("t_lr_t: %d", _debugger.tri_sel->t[tmu].t_lr_t);
OUTPUT ("scale_s: %f", _debugger.tri_sel->t[tmu].scale_s);
OUTPUT ("scale_t: %f", _debugger.tri_sel->t[tmu].scale_t);
OUTPUT ("s_mode: %s", str_cm[((_debugger.tri_sel->t[tmu].clamp_s << 1) | _debugger.tri_sel->t[tmu].mirror_s)&3]);
OUTPUT ("t_mode: %s", str_cm[((_debugger.tri_sel->t[tmu].clamp_t << 1) | _debugger.tri_sel->t[tmu].mirror_t)&3]);
}
if (_debugger.page == PAGE_COLORS && _debugger.tri_sel)
{
COL_CATEGORY();
OUTPUT ("COLORS (page 4)", 0);
COL_TEXT();
OUTPUT ("fill: %08lx", _debugger.tri_sel->fill_color);
OUTPUT ("prim: %08lx", _debugger.tri_sel->prim_color);
OUTPUT ("blend: %08lx", _debugger.tri_sel->blend_color);
OUTPUT ("env: %08lx", _debugger.tri_sel->env_color);
OUTPUT ("fog: %08lx", _debugger.tri_sel->fog_color);
OUTPUT ("prim_lodmin: %d", _debugger.tri_sel->prim_lodmin);
OUTPUT ("prim_lodfrac: %d", _debugger.tri_sel->prim_lodfrac);
}
if (_debugger.page == PAGE_FBL && _debugger.tri_sel)
{
COL_CATEGORY();
OUTPUT ("BLENDER", 0);
COL_TEXT();
OUTPUT ("fbl_a0: %s", FBLa[(_debugger.tri_sel->othermode_l>>30)&0x3]);
OUTPUT ("fbl_b0: %s", FBLb[(_debugger.tri_sel->othermode_l>>26)&0x3]);
OUTPUT ("fbl_c0: %s", FBLc[(_debugger.tri_sel->othermode_l>>22)&0x3]);
OUTPUT ("fbl_d0: %s", FBLd[(_debugger.tri_sel->othermode_l>>18)&0x3]);
OUTPUT ("fbl_a1: %s", FBLa[(_debugger.tri_sel->othermode_l>>28)&0x3]);
OUTPUT ("fbl_b1: %s", FBLb[(_debugger.tri_sel->othermode_l>>24)&0x3]);
OUTPUT ("fbl_c1: %s", FBLc[(_debugger.tri_sel->othermode_l>>20)&0x3]);
OUTPUT ("fbl_d1: %s", FBLd[(_debugger.tri_sel->othermode_l>>16)&0x3]);
OUTPUT ("", 0);
OUTPUT ("fbl: %08lx", _debugger.tri_sel->othermode_l&0xFFFF0000);
OUTPUT ("fbl #1: %08lx", _debugger.tri_sel->othermode_l&0xCCCC0000);
OUTPUT ("fbl #2: %08lx", _debugger.tri_sel->othermode_l&0x33330000);
}
if (_debugger.page == PAGE_OTHERMODE_L && _debugger.tri_sel)
{
uint32_t othermode_l = _debugger.tri_sel->othermode_l;
COL_CATEGORY ();
OUTPUT ("OTHERMODE_L: %08lx", othermode_l);
OUTPUT_ ("AC_NONE", (othermode_l & 3) == 0);
_OUTPUT ("AC_THRESHOLD", (othermode_l & 3) == 1);
_OUTPUT ("AC_DITHER", (othermode_l & 3) == 3);
i -= 16;
OUTPUT_ ("ZS_PIXEL", !(othermode_l & 4));
_OUTPUT ("ZS_PRIM", (othermode_l & 4));
i -= 32;
COL_CATEGORY ();
OUTPUT ("RENDERMODE: %08lx", othermode_l);
OUTPUT_ ("AA_EN", othermode_l & 0x08);
i -= 16;
OUTPUT_ ("Z_CMP", othermode_l & 0x10);
i -= 16;
OUTPUT_ ("Z_UPD", othermode_l & 0x20);
i -= 16;
OUTPUT_ ("IM_RD", othermode_l & 0x40);
i -= 16;
OUTPUT_ ("CLR_ON_CVG", othermode_l & 0x80);
i -= 16;
OUTPUT_ ("CVG_DST_CLAMP", (othermode_l & 0x300) == 0x000);
_OUTPUT ("CVG_DST_WRAP", (othermode_l & 0x300) == 0x100);
_OUTPUT (".._FULL", (othermode_l & 0x300) == 0x200);
_OUTPUT (".._SAVE", (othermode_l & 0x300) == 0x300);
i -= 16;
OUTPUT_ ("ZM_OPA", (othermode_l & 0xC00) == 0x000);
_OUTPUT ("ZM_INTER", (othermode_l & 0xC00) == 0x400);
_OUTPUT ("ZM_XLU", (othermode_l & 0xC00) == 0x800);
_OUTPUT ("ZM_DEC", (othermode_l & 0xC00) == 0xC00);
i -= 16;
OUTPUT_ ("CVG_X_ALPHA", othermode_l & 0x1000);
i -= 16;
OUTPUT_ ("ALPHA_CVG_SEL", othermode_l & 0x2000);
i -= 16;
OUTPUT_ ("FORCE_BL", othermode_l & 0x4000);
}
if (_debugger.page == PAGE_OTHERMODE_H && _debugger.tri_sel)
{
uint32_t othermode_h = _debugger.tri_sel->othermode_h;
COL_CATEGORY ();
OUTPUT ("OTHERMODE_H: %08lx", othermode_h);
OUTPUT_ ("CK_NONE", (othermode_h & 0x100) == 0);
_OUTPUT ("CK_KEY", (othermode_h & 0x100) == 1);
i -= 16;
OUTPUT_ ("TC_CONV", (othermode_h & 0xE00) == 0x200);
_OUTPUT ("TC_FILTCONV", (othermode_h & 0xE00) == 0xA00);
_OUTPUT ("TC_FILT", (othermode_h & 0xE00) == 0xC00);
i -= 16;
OUTPUT_ ("TF_POINT", (othermode_h & 0x3000) == 0x0000);
_OUTPUT ("TF_AVERAGE", (othermode_h & 0x3000) == 0x3000);
_OUTPUT ("TF_BILERP", (othermode_h & 0x3000) == 0x2000);
i -= 16;
OUTPUT_ ("TT_NONE", (othermode_h & 0xC000) == 0x0000);
_OUTPUT ("TT_RGBA16", (othermode_h & 0xC000) == 0x8000);
_OUTPUT ("TT_IA16", (othermode_h & 0xC000) == 0xC000);
i -= 16;
OUTPUT_ ("TL_TILE", (othermode_h & 0x10000) == 0x00000);
_OUTPUT ("TL_LOD", (othermode_h & 0x10000) == 0x10000);
i -= 16;
OUTPUT_ ("TD_CLAMP", (othermode_h & 0x60000) == 0x00000);
_OUTPUT ("TD_SHARPEN", (othermode_h & 0x60000) == 0x20000);
_OUTPUT ("TD_DETAIL", (othermode_h & 0x60000) == 0x40000);
i -= 16;
OUTPUT_ ("TP_NONE", (othermode_h & 0x80000) == 0x00000);
_OUTPUT ("TP_PERSP", (othermode_h & 0x80000) == 0x80000);
i -= 16;
OUTPUT_ ("1CYCLE", (othermode_h & 0x300000) == 0x000000);
_OUTPUT ("2CYCLE", (othermode_h & 0x300000) == 0x100000);
_OUTPUT ("COPY", (othermode_h & 0x300000) == 0x200000);
_OUTPUT ("FILL", (othermode_h & 0x300000) == 0x300000);
i -= 16;
OUTPUT_ ("PM_1PRIM", (othermode_h & 0x400000) == 0x000000);
_OUTPUT ("PM_NPRIM", (othermode_h & 0x400000) == 0x400000);
}
if (_debugger.page == PAGE_TEXELS && _debugger.tri_sel)
{
// change these to output whatever you need, ou for triangles, or u0 for texrects
COL_TEXT();
OUTPUT ("n: %d", _debugger.tri_sel->nv);
OUTPUT ("",0);
for (j=0; j<_debugger.tri_sel->nv; j++)
{
OUTPUT1 ("v[%d].s0: %f", j, _debugger.tri_sel->v[j].ou);
OUTPUT1 ("v[%d].t0: %f", j, _debugger.tri_sel->v[j].ov);
}
OUTPUT ("",0);
for (j=0; j<_debugger.tri_sel->nv; j++)
{
OUTPUT1 ("v[%d].s1: %f", j, _debugger.tri_sel->v[j].u0);
OUTPUT1 ("v[%d].t1: %f", j, _debugger.tri_sel->v[j].v0);
}
}
if (_debugger.page == PAGE_COORDS && _debugger.tri_sel)
{
COL_TEXT();
OUTPUT ("n: %d", _debugger.tri_sel->nv);
for (j=0; j<_debugger.tri_sel->nv; j++)
{
OUTPUT1 ("v[%d].x: %f", j, _debugger.tri_sel->v[j].x);
OUTPUT1 ("v[%d].y: %f", j, _debugger.tri_sel->v[j].y);
OUTPUT1 ("v[%d].z: %f", j, _debugger.tri_sel->v[j].z);
OUTPUT1 ("v[%d].w: %f", j, _debugger.tri_sel->v[j].w);
OUTPUT1 ("v[%d].f: %f", j, 1.0f/_debugger.tri_sel->v[j].f);
OUTPUT1 ("v[%d].r: %d", j, _debugger.tri_sel->v[j].r);
OUTPUT1 ("v[%d].g: %d", j, _debugger.tri_sel->v[j].g);
OUTPUT1 ("v[%d].b: %d", j, _debugger.tri_sel->v[j].b);
OUTPUT1 ("v[%d].a: %d", j, _debugger.tri_sel->v[j].a);
}
}
if (_debugger.page == PAGE_TEX_INFO && _debugger.tex_sel < (uint32_t)rdp.n_cached[_debugger.tmu])
{
COL_CATEGORY();
OUTPUT ("CACHE (page 0)", 0);
COL_TEXT();
//OUTPUT ("t_mem: %08lx", rdp.cache[0][_debugger.tex_sel].t_mem);
//OUTPUT ("crc: %08lx", rdp.cache[0][_debugger.tex_sel].crc);
OUTPUT ("addr: %08lx", cache[_debugger.tex_sel].addr);
OUTPUT ("scale_x: %f", cache[_debugger.tex_sel].scale_x);
OUTPUT ("scale_y: %f", cache[_debugger.tex_sel].scale_y);
OUTPUT ("tmem_addr: %08lx", cache[_debugger.tex_sel].tmem_addr);
OUTPUT ("palette: %08lx", cache[_debugger.tex_sel].palette);
OUTPUT ("set_by: %08lx", cache[_debugger.tex_sel].set_by);
OUTPUT ("texrecting: %d", cache[_debugger.tex_sel].texrecting);
OUTPUT ("mod: %08lx", cache[_debugger.tex_sel].mod);
OUTPUT ("mod_col: %08lx", cache[_debugger.tex_sel].mod_color);
OUTPUT ("mod_col1: %08lx", cache[_debugger.tex_sel].mod_color1);
i=740;
output(800,(float)i,1,"width: %d", cache[_debugger.tex_sel].width);
i-=16;
output(800,(float)i,1,"height: %d", cache[_debugger.tex_sel].height);
i-=16;
output(800,(float)i,1,"format: %d", cache[_debugger.tex_sel].format);
i-=16;
output(800,(float)i,1,"size: %d", cache[_debugger.tex_sel].size);
i-=16;
output(800,(float)i,1,"crc: %08lx", cache[_debugger.tex_sel].crc);
i-=16;
#ifdef TEXTURE_FILTER
output(800,(float)i,1,"RiceCrc: %08lx", (uint32_t)(rdp.cache[_debugger.tmu][_debugger.tex_sel].ricecrc&0xFFFFFFFF));
i-=16;
output(800,(float)i,1,"RicePalCrc: %08lx", (uint32_t)(rdp.cache[_debugger.tmu][_debugger.tex_sel].ricecrc>>32));
i-=16;
#endif
output(800,(float)i,1,"flags: %08lx", cache[_debugger.tex_sel].flags);
i-=16;
output(800,(float)i,1,"line: %d", cache[_debugger.tex_sel].line);
i-=16;
output(800,(float)i,1,"mod_factor: %08lx", cache[_debugger.tex_sel].mod_factor);
i-=32;
output(800,(float)i,1,"lod: %s", str_lod[cache[_debugger.tex_sel].lod]);
i-=16;
output(800,(float)i,1,"aspect: %s", str_aspect[cache[_debugger.tex_sel].aspect + 3]);
// debug_texture(_debugger.tmu, cache[_debugger.tex_sel].addr, _debugger.tex_sel);
}
// Draw the vertex numbers
if (_debugger.tri_sel)
{
for (i=0; i<_debugger.tri_sel->nv; i++)
{
grConstantColorValue (0x000000FF);
output (_debugger.tri_sel->v[i].x+1, g_settings->scr_res_y-_debugger.tri_sel->v[i].y+1, 1,
"%d", i);
grConstantColorValue (0xFFFFFFFF);
output (_debugger.tri_sel->v[i].x, g_settings->scr_res_y-_debugger.tri_sel->v[i].y, 1,
"%d", i);
}
}
// Draw the cursor
debug_mouse ();
grBufferSwap (1);
}
END:
// Release all data
delete [] _debugger.screen;
TRI_INFO *tri;
for (tri=_debugger.tri_list; tri != _debugger.tri_last;)
{
TRI_INFO *tmp = tri;
tri = tri->pNext;
delete [] tmp->v;
delete tmp;
}
delete [] tri->v;
delete tri;
// Reset all values
_debugger.capture = 0;
_debugger.selected = SELECTED_TRI;
_debugger.screen = NULL;
_debugger.tri_list = NULL;
_debugger.tri_last = NULL;
_debugger.tri_sel = NULL;
_debugger.tex_sel = 0;
}
//
// debug_mouse - draws the debugger mouse
//
void debug_mouse ()
{
grColorCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
grAlphaCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
// Draw the cursor
POINT pt;
DbgCursorPos(&pt);
float cx = (float)pt.x;
float cy = (float)pt.y;
VERTEX v[4] = {
{ cx, cy, 1, 1, 0, 0, 0, 0, {0, 0, 0, 0} },
{ cx+32, cy, 1, 1, 255, 0, 0, 0, {0, 0, 0, 0} },
{ cx, cy+32, 1, 1, 0, 255, 0, 0, {0, 0, 0, 0} },
{ cx+32, cy+32, 1, 1, 255, 255, 0, 0, {0, 0, 0, 0} }
};
ConvertCoordsKeep (v, 4);
grTexSource(GR_TMU0,
voodoo.tex_min_addr[GR_TMU0] + offset_cursor,
GR_MIPMAPLEVELMASK_BOTH,
&cursorTex);
if (voodoo.num_tmu >= 3)
grTexCombine (GR_TMU2,
GR_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE);
if (voodoo.num_tmu >= 2)
grTexCombine (GR_TMU1,
GR_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE);
grTexCombine (GR_TMU0,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE);
grDrawTriangle (&v[0], &v[1], &v[2]);
grDrawTriangle (&v[1], &v[3], &v[2]);
}
//
// debug_keys - receives debugger key input
//
void debug_keys ()
{
if (CheckKeyPressed(G64_VK_RIGHT, 0x0001) && _debugger.tri_sel)
{
TRI_INFO *start = _debugger.tri_sel;
while (_debugger.tri_sel->pNext != start)
_debugger.tri_sel = _debugger.tri_sel->pNext;
}
if (CheckKeyPressed(G64_VK_LEFT, 0x0001) && _debugger.tri_sel)
_debugger.tri_sel = _debugger.tri_sel->pNext;
// Check for page changes
if (CheckKeyPressed(G64_VK_1, 0x0001))
_debugger.page = PAGE_GENERAL;
if (CheckKeyPressed(G64_VK_2, 0x0001))
_debugger.page = PAGE_TEX1;
if (CheckKeyPressed(G64_VK_3, 0x0001))
_debugger.page = PAGE_TEX2;
if (CheckKeyPressed(G64_VK_4, 0x0001))
_debugger.page = PAGE_COLORS;
if (CheckKeyPressed(G64_VK_5, 0x0001))
_debugger.page = PAGE_FBL;
if (CheckKeyPressed(G64_VK_6, 0x0001))
_debugger.page = PAGE_OTHERMODE_L;
if (CheckKeyPressed(G64_VK_7, 0x0001))
_debugger.page = PAGE_OTHERMODE_H;
if (CheckKeyPressed(G64_VK_8, 0x0001))
_debugger.page = PAGE_TEXELS;
if (CheckKeyPressed(G64_VK_9, 0x0001))
_debugger.page = PAGE_COORDS;
if (CheckKeyPressed(G64_VK_0, 0x0001))
_debugger.page = PAGE_TEX_INFO;
if (CheckKeyPressed(G64_VK_Q, 0x0001))
_debugger.tmu = 0;
if (CheckKeyPressed(G64_VK_W, 0x0001))
_debugger.tmu = 1;
if (CheckKeyPressed(G64_VK_G, 0x0001))
grid = !grid;
// Go to texture
if (CheckKeyPressed(G64_VK_SPACE, 0x0001))
{
int tile = -1;
if (_debugger.page == PAGE_TEX2)
tile = 1;
else
tile = 0;
if (tile != -1)
{
_debugger.tmu = _debugger.tri_sel->t[tile].tmu;
_debugger.tex_sel = _debugger.tri_sel->t[tile].cur_cache[_debugger.tmu];
_debugger.tex_scroll = (_debugger.tri_sel->t[tile].cur_cache[_debugger.tmu] >> 4) - 1;
}
}
// Go to triangle
CACHE_LUT * cache = voodoo.tex_UMA?rdp.cache[0]:rdp.cache[_debugger.tmu];
if (CheckKeyPressed(G64_VK_CONTROL, 0x0001))
{
int count = rdp.debug_n - cache[_debugger.tex_sel].uses - 1;
if (cache[_debugger.tex_sel].last_used == frame_count)
{
TRI_INFO *t = _debugger.tri_list;
while (count && t) {
t = t->pNext;
count --;
}
_debugger.tri_sel = t;
}
else
_debugger.tri_sel = NULL;
}
if (CheckKeyPressed(G64_VK_A, 0x0001))
_debugger.draw_mode = 0; // texture & texture alpha
if (CheckKeyPressed(G64_VK_S, 0x0001))
_debugger.draw_mode = 1; // texture
if (CheckKeyPressed(G64_VK_D, 0x0001))
_debugger.draw_mode = 2; // texture alpha
// Check for texture scrolling
if (CheckKeyPressed(G64_VK_DOWN, 0x0001))
_debugger.tex_scroll ++;
if (CheckKeyPressed(G64_VK_UP, 0x0001))
_debugger.tex_scroll --;
}
// //
// output - output debugger text // output - output debugger text
// //

View File

@ -37,101 +37,4 @@
// //
//**************************************************************** //****************************************************************
#define SELECTED_NONE 0x00000000
#define SELECTED_TRI 0x00000001
#define SELECTED_TEX 0x00000002
typedef struct TEX_INFO_t
{
uint32_t cur_cache[2]; // Current cache #
uint8_t format;
uint8_t size;
uint32_t width, height;
uint16_t line, wid;
uint8_t palette;
uint8_t clamp_s, clamp_t;
uint8_t mirror_s, mirror_t;
uint8_t mask_s, mask_t;
uint8_t shift_s, shift_t;
uint16_t ul_s, ul_t, lr_s, lr_t;
uint16_t t_ul_s, t_ul_t, t_lr_s, t_lr_t;
float scale_s, scale_t;
int tmu;
} TEX_INFO;
typedef struct TRI_INFO_t
{
uint32_t nv; // Number of vertices
VERTEX *v; // Vertices (2d screen coords) of the triangle, used to outline
uint32_t cycle1, cycle2, cycle_mode; // Combine mode at the time of rendering
uint8_t uncombined; // which is uncombined: 0x01=color 0x02=alpha 0x03=both
uint32_t geom_mode; // geometry mode flags
uint32_t othermode_h; // setothermode_h flags
uint32_t othermode_l; // setothermode_l flags
uint32_t tri_n; // Triangle number
uint32_t flags;
int type; // 0-normal, 1-texrect, 2-fillrect
// texture info
TEX_INFO t[2];
// colors
uint32_t fog_color;
uint32_t fill_color;
uint32_t prim_color;
uint32_t blend_color;
uint32_t env_color;
uint32_t prim_lodmin, prim_lodfrac;
TRI_INFO_t *pNext;
} TRI_INFO;
typedef struct DEBUGGER_t
{
int capture; // Capture moment for debugging?
uint32_t selected; // Selected object (see flags above)
TRI_INFO *tri_sel;
uint32_t tex_scroll; // texture scrolling
uint32_t tex_sel;
// CAPTURE INFORMATION
uint8_t *screen; // Screen capture
TRI_INFO *tri_list; // Triangle information list
TRI_INFO *tri_last; // Last in the list (first in)
uint32_t tmu; // tmu #
uint32_t draw_mode;
// Page number
int page;
} GLIDE64_DEBUGGER;
#define PAGE_GENERAL 0
#define PAGE_TEX1 1
#define PAGE_TEX2 2
#define PAGE_COLORS 3
#define PAGE_FBL 4
#define PAGE_OTHERMODE_L 5
#define PAGE_OTHERMODE_H 6
#define PAGE_TEXELS 7
#define PAGE_COORDS 8
#define PAGE_TEX_INFO 9
#define TRI_TRIANGLE 0
#define TRI_TEXRECT 1
#define TRI_FILLRECT 2
#define TRI_BACKGROUND 3
extern GLIDE64_DEBUGGER _debugger;
void debug_init ();
void debug_capture ();
void debug_cacheviewer ();
void debug_mouse ();
void debug_keys ();
void output (float x, float y, int scale, const char *fmt, ...); void output (float x, float y, int scale, const char *fmt, ...);

View File

@ -73,7 +73,6 @@ the plugin
#include <Settings/Settings.h> #include <Settings/Settings.h>
#include "GlideExtensions.h" #include "GlideExtensions.h"
#include "rdp.h" #include "rdp.h"
#include "Keys.h"
#include "Config.h" #include "Config.h"
#include "Settings.h" #include "Settings.h"
@ -99,8 +98,6 @@ extern "C" {
// ** TAKE OUT BEFORE RELEASE!!! ** // ** TAKE OUT BEFORE RELEASE!!! **
//#define LOG_UCODE //#define LOG_UCODE
//#define ALTTAB_FIX
// 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.
@ -127,12 +124,6 @@ extern "C" {
// 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
extern HHOOK hhkLowLevelKybd;
extern LRESULT CALLBACK LowLevelKeyboardProc(int nCode,
WPARAM wParam, LPARAM lParam);
#endif
// Simulations // Simulations
//#define SIMULATE_VOODOO1 //#define SIMULATE_VOODOO1
//#define SIMULATE_BANSHEE //#define SIMULATE_BANSHEE
@ -164,7 +155,6 @@ extern "C" {
extern int GfxInitDone; extern int GfxInitDone;
extern bool g_romopen; extern bool g_romopen;
extern int to_fullscreen; extern int to_fullscreen;
extern int debugging;
extern int evoodoo; extern int evoodoo;
extern int ev_fullscreen; extern int ev_fullscreen;

View File

@ -88,7 +88,6 @@
<ClInclude Include="Ext_TxFilter.h" /> <ClInclude Include="Ext_TxFilter.h" />
<ClInclude Include="FBtoScreen.h" /> <ClInclude Include="FBtoScreen.h" />
<ClInclude Include="GlideExtensions.h" /> <ClInclude Include="GlideExtensions.h" />
<ClInclude Include="Keys.h" />
<ClInclude Include="rdp.h" /> <ClInclude Include="rdp.h" />
<ClInclude Include="TexBuffer.h" /> <ClInclude Include="TexBuffer.h" />
<ClInclude Include="Util.h" /> <ClInclude Include="Util.h" />
@ -105,7 +104,6 @@
<ClCompile Include="DepthBufferRender.cpp" /> <ClCompile Include="DepthBufferRender.cpp" />
<ClCompile Include="Ext_TxFilter.cpp" /> <ClCompile Include="Ext_TxFilter.cpp" />
<ClCompile Include="FBtoScreen.cpp" /> <ClCompile Include="FBtoScreen.cpp" />
<ClCompile Include="Keys.cpp" />
<ClCompile Include="Main.cpp" /> <ClCompile Include="Main.cpp" />
<ClCompile Include="rdp.cpp" /> <ClCompile Include="rdp.cpp" />
<ClCompile Include="TexBuffer.cpp" /> <ClCompile Include="TexBuffer.cpp" />

View File

@ -122,7 +122,6 @@
<ClInclude Include="Ext_TxFilter.h" /> <ClInclude Include="Ext_TxFilter.h" />
<ClInclude Include="FBtoScreen.h" /> <ClInclude Include="FBtoScreen.h" />
<ClInclude Include="GlideExtensions.h" /> <ClInclude Include="GlideExtensions.h" />
<ClInclude Include="Keys.h" />
<ClInclude Include="rdp.h" /> <ClInclude Include="rdp.h" />
<ClInclude Include="TexBuffer.h" /> <ClInclude Include="TexBuffer.h" />
<ClInclude Include="Util.h" /> <ClInclude Include="Util.h" />
@ -147,7 +146,6 @@
<ClCompile Include="DepthBufferRender.cpp" /> <ClCompile Include="DepthBufferRender.cpp" />
<ClCompile Include="Ext_TxFilter.cpp" /> <ClCompile Include="Ext_TxFilter.cpp" />
<ClCompile Include="FBtoScreen.cpp" /> <ClCompile Include="FBtoScreen.cpp" />
<ClCompile Include="Keys.cpp" />
<ClCompile Include="Main.cpp" /> <ClCompile Include="Main.cpp" />
<ClCompile Include="rdp.cpp" /> <ClCompile Include="rdp.cpp" />
<ClCompile Include="TexBuffer.cpp" /> <ClCompile Include="TexBuffer.cpp" />

View File

@ -54,7 +54,6 @@ FX_ENTRY void FX_CALL grConfigWrapperExt(
); );
FX_ENTRY GrScreenResolution_t FX_CALL grWrapperFullScreenResolutionExt(FxU32*, FxU32*); FX_ENTRY GrScreenResolution_t FX_CALL grWrapperFullScreenResolutionExt(FxU32*, FxU32*);
FX_ENTRY char ** FX_CALL grQueryResolutionsExt(int32_t*); FX_ENTRY char ** FX_CALL grQueryResolutionsExt(int32_t*);
FX_ENTRY FxBool FX_CALL grKeyPressedExt(FxU32 key);
FX_ENTRY void FX_CALL grGetGammaTableExt(FxU32, FxU32*, FxU32*, FxU32*); FX_ENTRY void FX_CALL grGetGammaTableExt(FxU32, FxU32*, FxU32*, FxU32*);
FX_ENTRY GrContext_t FX_CALL grSstWinOpenExt( FX_ENTRY GrContext_t FX_CALL grSstWinOpenExt(

View File

@ -1,80 +0,0 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * 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.
//
//****************************************************************
//
// Keys, used by Glide64.
// Since key codes are different for WinAPI and SDL, this difference is managed here
// Created by Sergey 'Gonetz' Lipski, July 2009
//
//****************************************************************
#include "Gfx_1.3.h"
Glide64Keys::Glide64Keys()
{
_keys[G64_VK_CONTROL] = 306;
_keys[G64_VK_ALT] = 308;
_keys[G64_VK_INSERT] = 277;
_keys[G64_VK_LBUTTON] = 1;
_keys[G64_VK_UP] = 273;
_keys[G64_VK_DOWN] = 274;
_keys[G64_VK_LEFT] = 276;
_keys[G64_VK_RIGHT] = 275;
_keys[G64_VK_SPACE] = 32;
_keys[G64_VK_BACK] = 8;
_keys[G64_VK_SCROLL] = 302;
_keys[G64_VK_1] = 49;
_keys[G64_VK_2] = 50;
_keys[G64_VK_3] = 51;
_keys[G64_VK_4] = 52;
_keys[G64_VK_5] = 53;
_keys[G64_VK_6] = 54;
_keys[G64_VK_7] = 55;
_keys[G64_VK_8] = 56;
_keys[G64_VK_9] = 57;
_keys[G64_VK_0] = 48;
_keys[G64_VK_A] = 97;
_keys[G64_VK_B] = 98;
_keys[G64_VK_D] = 100;
_keys[G64_VK_G] = 103;
_keys[G64_VK_Q] = 113;
_keys[G64_VK_R] = 114;
_keys[G64_VK_S] = 115;
_keys[G64_VK_V] = 118;
_keys[G64_VK_W] = 119;
}

View File

@ -1,93 +0,0 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * 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.
//
//****************************************************************
//
// Keys, used by Glide64.
// Since key codes are different for WinAPI and SDL, this difference is managed here
// Created by Sergey 'Gonetz' Lipski, July 2009
//
//****************************************************************
#ifndef Keys_H
#define Keys_H
#define G64_VK_CONTROL 0
#define G64_VK_ALT 1
#define G64_VK_INSERT 2
#define G64_VK_LBUTTON 3
#define G64_VK_UP 4
#define G64_VK_DOWN 5
#define G64_VK_LEFT 6
#define G64_VK_RIGHT 7
#define G64_VK_SPACE 8
#define G64_VK_BACK 9
#define G64_VK_SCROLL 10
#define G64_VK_1 11
#define G64_VK_2 12
#define G64_VK_3 13
#define G64_VK_4 14
#define G64_VK_5 15
#define G64_VK_6 16
#define G64_VK_7 17
#define G64_VK_8 18
#define G64_VK_9 19
#define G64_VK_0 20
#define G64_VK_A 21
#define G64_VK_B 22
#define G64_VK_D 23
#define G64_VK_G 24
#define G64_VK_Q 25
#define G64_VK_R 26
#define G64_VK_S 27
#define G64_VK_V 28
#define G64_VK_W 29
#define G64_NUM_KEYS 30
class Glide64Keys
{
public:
Glide64Keys();
~Glide64Keys(){}
int operator[](unsigned int index){return _keys[index];}
private:
int _keys[G64_NUM_KEYS];
};
#endif //Keys_H

View File

@ -71,7 +71,6 @@ int to_fullscreen = FALSE;
int GfxInitDone = FALSE; int GfxInitDone = FALSE;
bool g_romopen = false; bool g_romopen = false;
GrContext_t gfx_context = 0; GrContext_t gfx_context = 0;
int debugging = FALSE;
int exception = FALSE; int exception = FALSE;
int evoodoo = 0; int evoodoo = 0;
@ -81,12 +80,6 @@ int ev_fullscreen = 0;
HINSTANCE hinstDLL = NULL; HINSTANCE hinstDLL = NULL;
#endif #endif
#ifdef ALTTAB_FIX
HHOOK hhkLowLevelKybd = NULL;
LRESULT CALLBACK LowLevelKeyboardProc(int nCode,
WPARAM wParam, LPARAM lParam);
#endif
#ifdef PERFORMANCE #ifdef PERFORMANCE
int64 perf_cur; int64 perf_cur;
int64 perf_next; int64 perf_next;
@ -133,8 +126,6 @@ RDP rdp;
CSettings * g_settings; CSettings * g_settings;
HOTKEY_INFO hotkey_info;
VOODOO voodoo = { 0, 0, 0, 0, VOODOO voodoo = { 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0 0, 0, 0, 0
@ -213,11 +204,6 @@ void _ChangeSize()
void ChangeSize() void ChangeSize()
{ {
if (debugging)
{
_ChangeSize();
return;
}
switch (g_settings->aspectmode) switch (g_settings->aspectmode)
{ {
case 0: //4:3 case 0: //4:3
@ -600,7 +586,6 @@ void WriteSettings(void)
GRSTIPPLE grStippleModeExt = NULL; GRSTIPPLE grStippleModeExt = NULL;
GRSTIPPLE grStipplePatternExt = NULL; GRSTIPPLE grStipplePatternExt = NULL;
FxBool(FX_CALL *grKeyPressed)(FxU32) = NULL;
int GetTexAddrUMA(int /*tmu*/, int texsize) int GetTexAddrUMA(int /*tmu*/, int texsize)
{ {
@ -775,7 +760,6 @@ int InitGfx()
WriteTrace(TraceGlide64, TraceDebug, "-"); WriteTrace(TraceGlide64, TraceDebug, "-");
debugging = FALSE;
rdp_reset(); rdp_reset();
// Initialize Glide // Initialize Glide
@ -921,9 +905,6 @@ int InitGfx()
if (grStipplePatternExt) if (grStipplePatternExt)
grStipplePatternExt(g_settings->stipple_pattern); grStipplePatternExt(g_settings->stipple_pattern);
char strKeyPressedExt[] = "grKeyPressedExt";
grKeyPressed = (FxBool(FX_CALL *)(FxU32))grGetProcAddress(strKeyPressedExt);
InitCombine(); InitCombine();
#ifdef SIMULATE_VOODOO1 #ifdef SIMULATE_VOODOO1
@ -1259,14 +1240,6 @@ void CALL CloseDLL(void)
{ {
WriteTrace(TraceGlide64, TraceDebug, "-"); WriteTrace(TraceGlide64, TraceDebug, "-");
#ifdef ALTTAB_FIX
if (hhkLowLevelKybd)
{
UnhookWindowsHookEx(hhkLowLevelKybd);
hhkLowLevelKybd = 0;
}
#endif
//CLOSELOG (); //CLOSELOG ();
#ifdef TEXTURE_FILTER // Hiroshi Morii <koolsmoky@users.sourceforge.net> #ifdef TEXTURE_FILTER // Hiroshi Morii <koolsmoky@users.sourceforge.net>
@ -1376,8 +1349,6 @@ int CALL InitiateGFX(GFX_INFO Gfx_Info)
g_settings->res_data_org = g_settings->res_data; g_settings->res_data_org = g_settings->res_data;
#endif #endif
debug_init(); // Initialize debugger
gfx = Gfx_Info; gfx = Gfx_Info;
util_init(); util_init();
@ -1956,64 +1927,6 @@ void newSwapBuffers()
output(930.0f, 0, 1, CDateTime().SetToNow().Format("%I:%M:%S %p").c_str(), 0); output(930.0f, 0, 1, CDateTime().SetToNow().Format("%I:%M:%S %p").c_str(), 0);
} }
} }
//hotkeys
if ((abs((int)(frame_count - curframe)) > 3) && CheckKeyPressed(G64_VK_ALT, 0x8000)) //alt +
{
if (CheckKeyPressed(G64_VK_B, 0x8000)) //b
{
hotkey_info.hk_motionblur = 100;
hotkey_info.hk_ref = 0;
curframe = frame_count;
g_settings->frame_buffer ^= fb_motionblur;
}
else if (CheckKeyPressed(G64_VK_V, 0x8000)) //v
{
hotkey_info.hk_ref = 100;
hotkey_info.hk_motionblur = 0;
curframe = frame_count;
g_settings->frame_buffer ^= fb_ref;
}
}
if (hotkey_info.hk_ref || hotkey_info.hk_motionblur || hotkey_info.hk_filtering)
{
set_message_combiner();
char buf[256];
buf[0] = 0;
char * message = 0;
if (hotkey_info.hk_ref)
{
if (g_settings->frame_buffer & fb_ref)
message = strcat(buf, "FB READ ALWAYS: ON");
else
message = strcat(buf, "FB READ ALWAYS: OFF");
hotkey_info.hk_ref--;
}
if (hotkey_info.hk_motionblur)
{
if (g_settings->frame_buffer & fb_motionblur)
message = strcat(buf, " MOTION BLUR: ON");
else
message = strcat(buf, " MOTION BLUR: OFF");
hotkey_info.hk_motionblur--;
}
if (hotkey_info.hk_filtering)
{
switch (g_settings->filtering)
{
case 0:
message = strcat(buf, " FILTERING MODE: AUTOMATIC");
break;
case 1:
message = strcat(buf, " FILTERING MODE: FORCE BILINEAR");
break;
case 2:
message = strcat(buf, " FILTERING MODE: FORCE POINT-SAMPLED");
break;
}
hotkey_info.hk_filtering--;
}
output(120.0f, 0.0f, 1, message, 0);
}
if (capture_screen) if (capture_screen)
{ {
@ -2099,61 +2012,6 @@ void newSwapBuffers()
} }
} }
// Capture the screen if debug capture is set
if (_debugger.capture)
{
// Allocate the screen
_debugger.screen = new uint8_t[(g_settings->res_x*g_settings->res_y) << 1];
// Lock the backbuffer (already rendered)
GrLfbInfo_t info;
info.size = sizeof(GrLfbInfo_t);
while (!grLfbLock(GR_LFB_READ_ONLY,
GR_BUFFER_BACKBUFFER,
GR_LFBWRITEMODE_565,
GR_ORIGIN_UPPER_LEFT,
FXFALSE,
&info));
uint32_t offset_src = 0, offset_dst = 0;
// Copy the screen
for (uint32_t y = 0; y < g_settings->res_y; y++)
{
if (info.writeMode == GR_LFBWRITEMODE_8888)
{
uint32_t *src = (uint32_t*)((uint8_t*)info.lfbPtr + offset_src);
uint16_t *dst = (uint16_t*)(_debugger.screen + offset_dst);
uint8_t r, g, b;
uint32_t col;
for (unsigned int x = 0; x < g_settings->res_x; x++)
{
col = src[x];
r = (uint8_t)((col >> 19) & 0x1F);
g = (uint8_t)((col >> 10) & 0x3F);
b = (uint8_t)((col >> 3) & 0x1F);
dst[x] = (r << 11) | (g << 5) | b;
}
}
else
{
memcpy(_debugger.screen + offset_dst, (uint8_t*)info.lfbPtr + offset_src, g_settings->res_x << 1);
}
offset_dst += g_settings->res_x << 1;
offset_src += info.strideInBytes;
}
// Unlock the backbuffer
grLfbUnlock(GR_LFB_READ_ONLY, GR_BUFFER_BACKBUFFER);
}
if (debugging)
{
debug_keys();
debug_cacheviewer();
debug_mouse();
}
if (g_settings->frame_buffer & fb_read_back_to_screen) if (g_settings->frame_buffer & fb_read_back_to_screen)
DrawWholeFrameBufferToScreen(); DrawWholeFrameBufferToScreen();
@ -2183,10 +2041,7 @@ void newSwapBuffers()
} }
} }
if (_debugger.capture) if (g_settings->wireframe || g_settings->buff_clear || (g_settings->hacks&hack_PPL && g_settings->ucode == 6))
debug_capture();
if (debugging || g_settings->wireframe || g_settings->buff_clear || (g_settings->hacks&hack_PPL && g_settings->ucode == 6))
{ {
if (g_settings->hacks&hack_RE2 && fb_depth_render_enabled) if (g_settings->hacks&hack_RE2 && fb_depth_render_enabled)
grDepthMask(FXFALSE); grDepthMask(FXFALSE);
@ -2209,39 +2064,6 @@ void newSwapBuffers()
DrawWholeFrameBufferToScreen(); DrawWholeFrameBufferToScreen();
} }
frame_count++; frame_count++;
// Open/close debugger?
if (CheckKeyPressed(G64_VK_SCROLL, 0x0001))
{
if (!debugging)
{
//if (g_settings->scr_res_x == 1024 && g_settings->scr_res_y == 768)
{
debugging = 1;
// Recalculate screen size, don't resize screen
g_settings->res_x = (uint32_t)(g_settings->scr_res_x * 0.625f);
g_settings->res_y = (uint32_t)(g_settings->scr_res_y * 0.625f);
ChangeSize();
}
}
else
{
debugging = 0;
g_settings->res_x = g_settings->scr_res_x;
g_settings->res_y = g_settings->scr_res_y;
ChangeSize();
}
}
// Debug capture?
if (/*fullscreen && */debugging && CheckKeyPressed(G64_VK_INSERT, 0x0001))
{
_debugger.capture = 1;
}
} }
/****************************************************************** /******************************************************************
@ -2292,72 +2114,6 @@ void CALL SurfaceChanged(int width, int height)
} }
#endif #endif
int CheckKeyPressed(int key, int mask)
{
static Glide64Keys g64Keys;
if (g_settings->use_hotkeys == 0)
return 0;
#ifdef __WINDOWS__
return (GetAsyncKeyState(g64Keys[key]) & mask);
#else
if (grKeyPressed)
return grKeyPressed(g64Keys[key]);
return 0;
#endif
}
#ifdef ALTTAB_FIX
int k_ctl = 0, k_alt = 0, k_del = 0;
LRESULT CALLBACK LowLevelKeyboardProc(int nCode,
WPARAM wParam, LPARAM lParam)
{
if (!fullscreen) return CallNextHookEx(NULL, nCode, wParam, lParam);
int TabKey = FALSE;
PKBDLLHOOKSTRUCT p;
if (nCode == HC_ACTION)
{
switch (wParam) {
case WM_KEYUP: case WM_SYSKEYUP:
p = (PKBDLLHOOKSTRUCT) lParam;
if (p->vkCode == 162) k_ctl = 0;
if (p->vkCode == 164) k_alt = 0;
if (p->vkCode == 46) k_del = 0;
goto do_it;
case WM_KEYDOWN: case WM_SYSKEYDOWN:
p = (PKBDLLHOOKSTRUCT) lParam;
if (p->vkCode == 162) k_ctl = 1;
if (p->vkCode == 164) k_alt = 1;
if (p->vkCode == 46) k_del = 1;
goto do_it;
do_it:
TabKey =
((p->vkCode == VK_TAB) && ((p->flags & LLKHF_ALTDOWN) != 0)) ||
((p->vkCode == VK_ESCAPE) && ((p->flags & LLKHF_ALTDOWN) != 0)) ||
((p->vkCode == VK_ESCAPE) && ((GetKeyState(VK_CONTROL) & 0x8000) != 0)) ||
(k_ctl && k_alt && k_del);
break;
}
}
if (TabKey)
{
k_ctl = 0;
k_alt = 0;
k_del = 0;
ReleaseGfx ();
}
return CallNextHookEx(NULL, nCode, wParam, lParam);
}
#endif
#ifdef ANDROID #ifdef ANDROID
void Android_JNI_SwapWindow() void Android_JNI_SwapWindow()
{ {

View File

@ -527,28 +527,6 @@ void TexCache()
{ {
WriteTrace(TraceRDP, TraceDebug, " |-+ TexCache called"); WriteTrace(TraceRDP, TraceDebug, " |-+ TexCache called");
#ifdef TEXTURE_FILTER /* Hiroshi Morii <koolsmoky@users.sourceforge.net> */ // POSTNAPALM
if (g_settings->ghq_use && g_settings->ghq_hirs_dump) {
/* Force reload hi-res textures. Useful for texture artists */
if (CheckKeyPressed(G64_VK_R, 0x0001)) {
if (ext_ghq_reloadhirestex()) ClearCache();
}
/* Turn on texture dump */
else if (CheckKeyPressed(G64_VK_D, 0x0001)) {
extern void DisplayLoadProgress(const wchar_t *format, ...);
ghq_dmptex_toggle_key = !ghq_dmptex_toggle_key;
if (ghq_dmptex_toggle_key) {
DisplayLoadProgress(L"Texture dump - ON");
ClearCache();
}
else {
DisplayLoadProgress(L"Texture dump - OFF");
}
pjutil::Sleep(1000);
}
}
#endif
if (rdp.tex & 1) if (rdp.tex & 1)
GetTexInfo(0, rdp.cur_tile); GetTexInfo(0, rdp.cur_tile);
if (rdp.tex & 2) if (rdp.tex & 2)

View File

@ -1652,83 +1652,6 @@ static void render_tri(uint16_t linew, int old_interpolate)
grDrawVertexArray(GR_TRIANGLE_FAN, n, rdp.vtx_buffer ? (&vtx_list2) : (&vtx_list1)); grDrawVertexArray(GR_TRIANGLE_FAN, n, rdp.vtx_buffer ? (&vtx_list2) : (&vtx_list1));
} }
} }
if (_debugger.capture) add_tri(rdp.vtxbuf, n, TRI_TRIANGLE);
}
void add_tri(VERTEX *v, int n, int type)
{
//WriteTrace(TraceRDP, TraceDebug, "ENTER (%f, %f, %f), (%f, %f, %f), (%f, %f, %f)", v[0].x, v[0].y, v[0].w,
// v[1].x, v[1].y, v[1].w, v[2].x, v[2].y, v[2].w);
// Debug capture
if (_debugger.capture)
{
rdp.debug_n++;
TRI_INFO *info = new TRI_INFO;
info->nv = n;
info->v = new VERTEX[n];
memcpy(info->v, v, sizeof(VERTEX)*n);
info->cycle_mode = rdp.cycle_mode;
info->cycle1 = rdp.cycle1;
info->cycle2 = rdp.cycle2;
info->uncombined = rdp.uncombined;
info->geom_mode = rdp.geom_mode;
info->othermode_h = rdp.othermode_h;
info->othermode_l = rdp.othermode_l;
info->tri_n = rdp.tri_n;
info->type = type;
for (int i = 0; i < 2; i++)
{
int j = rdp.cur_tile + i;
if (i == 0)
info->t[i].tmu = rdp.t0;
else
info->t[i].tmu = rdp.t1;
info->t[i].cur_cache[0] = rdp.cur_cache_n[rdp.t0];
info->t[i].cur_cache[1] = rdp.cur_cache_n[rdp.t1];
info->t[i].format = rdp.tiles[j].format;
info->t[i].size = rdp.tiles[j].size;
info->t[i].width = rdp.tiles[j].width;
info->t[i].height = rdp.tiles[j].height;
info->t[i].line = rdp.tiles[j].line;
info->t[i].palette = rdp.tiles[j].palette;
info->t[i].clamp_s = rdp.tiles[j].clamp_s;
info->t[i].clamp_t = rdp.tiles[j].clamp_t;
info->t[i].mirror_s = rdp.tiles[j].mirror_s;
info->t[i].mirror_t = rdp.tiles[j].mirror_t;
info->t[i].shift_s = rdp.tiles[j].shift_s;
info->t[i].shift_t = rdp.tiles[j].shift_t;
info->t[i].mask_s = rdp.tiles[j].mask_s;
info->t[i].mask_t = rdp.tiles[j].mask_t;
info->t[i].ul_s = rdp.tiles[j].ul_s;
info->t[i].ul_t = rdp.tiles[j].ul_t;
info->t[i].lr_s = rdp.tiles[j].lr_s;
info->t[i].lr_t = rdp.tiles[j].lr_t;
info->t[i].t_ul_s = rdp.tiles[7].t_ul_s;
info->t[i].t_ul_t = rdp.tiles[7].t_ul_t;
info->t[i].t_lr_s = rdp.tiles[7].t_lr_s;
info->t[i].t_lr_t = rdp.tiles[7].t_lr_t;
info->t[i].scale_s = rdp.tiles[j].s_scale;
info->t[i].scale_t = rdp.tiles[j].t_scale;
}
info->fog_color = rdp.fog_color;
info->fill_color = rdp.fill_color;
info->prim_color = rdp.prim_color;
info->blend_color = rdp.blend_color;
info->env_color = rdp.env_color;
info->prim_lodmin = rdp.prim_lodmin;
info->prim_lodfrac = rdp.prim_lodfrac;
info->pNext = _debugger.tri_list;
_debugger.tri_list = info;
if (_debugger.tri_last == NULL)
_debugger.tri_last = _debugger.tri_list;
}
} }
void update_scissor() void update_scissor()

View File

@ -45,13 +45,11 @@
#define NOT_TMU2 0x02 #define NOT_TMU2 0x02
void util_init(); void util_init();
void render_tri(uint16_t linew = 0);
int cull_tri(VERTEX **v); int cull_tri(VERTEX **v);
void draw_tri(VERTEX **v, uint16_t linew = 0); void draw_tri(VERTEX **v, uint16_t linew = 0);
void do_triangle_stuff(uint16_t linew = 0, int old_interpolate = TRUE); void do_triangle_stuff(uint16_t linew = 0, int old_interpolate = TRUE);
void do_triangle_stuff_2(uint16_t linew = 0); void do_triangle_stuff_2(uint16_t linew = 0);
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();

View File

@ -253,14 +253,6 @@ void RDP::Reset()
rdp.update = UPDATE_SCISSOR | UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE; rdp.update = UPDATE_SCISSOR | UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE;
fog_mode = RDP::fog_enabled; fog_mode = RDP::fog_enabled;
maincimg[0].addr = maincimg[1].addr = last_drawn_ci_addr = 0x7FFFFFFF; maincimg[0].addr = maincimg[1].addr = last_drawn_ci_addr = 0x7FFFFFFF;
hotkey_info.hk_ref = 90;
hotkey_info.hk_motionblur = (g_settings->buff_clear == 0) ? 0 : 90;
hotkey_info.hk_filtering = hotkey_info.hk_motionblur;
CheckKeyPressed(G64_VK_BACK, 1); //BACK
CheckKeyPressed(G64_VK_B, 1);
CheckKeyPressed(G64_VK_V, 1);
} }
RDP::RDP() RDP::RDP()
@ -590,14 +582,6 @@ EXPORT void CALL ProcessDList(void)
update_screen_count = 0; update_screen_count = 0;
ChangeSize(); ChangeSize();
#ifdef ALTTAB_FIX
if (!hhkLowLevelKybd)
{
hhkLowLevelKybd = SetWindowsHookEx(WH_KEYBOARD_LL,
LowLevelKeyboardProc, hInstance, 0);
}
#endif
WriteTrace(TraceGlide64, TraceDebug, "ProcessDList"); WriteTrace(TraceGlide64, TraceDebug, "ProcessDList");
if (reset) if (reset)
@ -1444,21 +1428,6 @@ static void rdp_texrect()
grDrawVertexArrayContiguous(GR_TRIANGLE_STRIP, n_vertices, vptr, sizeof(VERTEX)); grDrawVertexArrayContiguous(GR_TRIANGLE_STRIP, n_vertices, vptr, sizeof(VERTEX));
} }
if (_debugger.capture)
{
VERTEX vl[3];
vl[0] = vstd[0];
vl[1] = vstd[2];
vl[2] = vstd[1];
add_tri(vl, 3, TRI_TEXRECT);
rdp.tri_n++;
vl[0] = vstd[2];
vl[1] = vstd[3];
vl[2] = vstd[1];
add_tri(vl, 3, TRI_TEXRECT);
rdp.tri_n++;
}
else
rdp.tri_n += 2; rdp.tri_n += 2;
delete[] vnew; delete[] vnew;
@ -2441,24 +2410,8 @@ static void rdp_fillrect()
grDrawTriangle(&v[2], &v[3], &v[1]); grDrawTriangle(&v[2], &v[3], &v[1]);
} }
if (_debugger.capture)
{
VERTEX v1[3];
v1[0] = v[0];
v1[1] = v[2];
v1[2] = v[1];
add_tri(v1, 3, TRI_FILLRECT);
rdp.tri_n++;
v1[0] = v[2];
v1[1] = v[3];
add_tri(v1, 3, TRI_FILLRECT);
rdp.tri_n++;
}
else
{
rdp.tri_n += 2; rdp.tri_n += 2;
} }
}
// //
// setfillcolor - sets the filling color // setfillcolor - sets the filling color
@ -3844,23 +3797,6 @@ void lle_triangle(uint32_t w1, uint32_t w2, int shade, int texture, int zbuffer,
ConvertCoordsConvert(vtxbuf, nbVtxs); ConvertCoordsConvert(vtxbuf, nbVtxs);
grCullMode(GR_CULL_DISABLE); grCullMode(GR_CULL_DISABLE);
grDrawVertexArrayContiguous(GR_TRIANGLE_STRIP, nbVtxs - 1, vtxbuf, sizeof(VERTEX)); grDrawVertexArrayContiguous(GR_TRIANGLE_STRIP, nbVtxs - 1, vtxbuf, sizeof(VERTEX));
if (_debugger.capture)
{
VERTEX vl[3];
vl[0] = vtxbuf[0];
vl[1] = vtxbuf[2];
vl[2] = vtxbuf[1];
add_tri(vl, 3, TRI_TRIANGLE);
rdp.tri_n++;
if (nbVtxs > 4)
{
vl[0] = vtxbuf[2];
vl[1] = vtxbuf[3];
vl[2] = vtxbuf[1];
add_tri(vl, 3, TRI_TRIANGLE);
rdp.tri_n++;
}
}
} }
static void rdp_triangle(int shade, int texture, int zbuffer) static void rdp_triangle(int shade, int texture, int zbuffer)

View File

@ -200,13 +200,6 @@ typedef struct
extern const int NumOfFormats; extern const int NumOfFormats;
extern SCREEN_SHOT_FORMAT ScreenShotFormats[]; extern SCREEN_SHOT_FORMAT ScreenShotFormats[];
typedef struct
{
uint8_t hk_ref;
uint8_t hk_motionblur;
uint8_t hk_filtering;
} HOTKEY_INFO;
typedef struct typedef struct
{ {
int num_tmu; int num_tmu;
@ -639,7 +632,6 @@ void ChangeSize();
void GoToFullScreen(); void GoToFullScreen();
extern RDP rdp; extern RDP rdp;
extern HOTKEY_INFO hotkey_info;
extern VOODOO voodoo; extern VOODOO voodoo;
extern GrTexInfo fontTex; extern GrTexInfo fontTex;

View File

@ -547,21 +547,6 @@ void DrawImage(DRAWIMAGE & d)
grDrawVertexArrayContiguous(GR_TRIANGLE_STRIP, 4, v, sizeof(VERTEX)); grDrawVertexArrayContiguous(GR_TRIANGLE_STRIP, 4, v, sizeof(VERTEX));
if (_debugger.capture)
{
VERTEX vl[3];
vl[0] = v[0];
vl[1] = v[2];
vl[2] = v[1];
add_tri(vl, 3, TRI_BACKGROUND);
rdp.tri_n++;
vl[0] = v[2];
vl[1] = v[3];
vl[2] = v[1];
add_tri(vl, 3, TRI_BACKGROUND);
rdp.tri_n++;
}
else
rdp.tri_n += 2; rdp.tri_n += 2;
} }
else else
@ -676,21 +661,6 @@ void DrawHiresImage(DRAWIMAGE & d, int screensize = FALSE)
grDrawTriangle(&v[0], &v[2], &v[1]); grDrawTriangle(&v[0], &v[2], &v[1]);
grDrawTriangle(&v[2], &v[3], &v[1]); grDrawTriangle(&v[2], &v[3], &v[1]);
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE | UPDATE_SCISSOR; rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE | UPDATE_SCISSOR;
if (_debugger.capture)
{
VERTEX vl[3];
vl[0] = v[0];
vl[1] = v[2];
vl[2] = v[1];
add_tri(vl, 3, TRI_BACKGROUND);
rdp.tri_n++;
vl[0] = v[2];
vl[1] = v[3];
vl[2] = v[1];
add_tri(vl, 3, TRI_BACKGROUND);
rdp.tri_n++;
}
else
rdp.tri_n += 2; rdp.tri_n += 2;
rdp.tbuff_tex = tbuff_tex; rdp.tbuff_tex = tbuff_tex;
} }