[Glide64] Fix up a lot of the logging code
This commit is contained in:
parent
6bdd5dd330
commit
d70f9a6733
|
@ -114,14 +114,12 @@ void calc_linear(VERTEX *v)
|
|||
v->ov = (acosf(y) / 3.141592654f) * (rdp.tiles[rdp.cur_tile].org_t_scale >> 6);
|
||||
}
|
||||
v->uv_scaled = 1;
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP ("calc linear u: %f, v: %f\n", v->ou, v->ov);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "calc linear u: %f, v: %f", v->ou, v->ov);
|
||||
}
|
||||
|
||||
void calc_sphere(VERTEX *v)
|
||||
{
|
||||
// LRDP("calc_sphere\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "calc_sphere");
|
||||
DECLAREALIGN16VAR(vec[3]);
|
||||
int s_scale, t_scale;
|
||||
if (g_settings->hacks&hack_Chopper)
|
||||
|
@ -151,9 +149,7 @@ void calc_sphere(VERTEX *v)
|
|||
v->ou = (x * 0.5f + 0.5f) * s_scale;
|
||||
v->ov = (y * 0.5f + 0.5f) * t_scale;
|
||||
v->uv_scaled = 1;
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP ("calc sphere u: %f, v: %f\n", v->ou, v->ov);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "calc sphere u: %f, v: %f", v->ou, v->ov);
|
||||
}
|
||||
|
||||
float DotProductC(register float *v1, register float *v2)
|
||||
|
@ -195,8 +191,12 @@ void MulMatricesC(float m1[4][4], float m2[4][4], float r[4][4])
|
|||
register unsigned int i, j;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
row[i][j] = m2[i][j];
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
// auto-vectorizable algorithm
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -424,7 +424,7 @@ void ConfigNotebook::set_properties()
|
|||
lblResolution->SetToolTip(tooltip);
|
||||
cmbResolution->SetToolTip(tooltip);
|
||||
cmbResolution->SetSelection(g_settings->res_data);
|
||||
cbxVSync->SetToolTip("Vertical sync\nThis option will enable the vertical sync, which will prevent tearing.\nNote: this option will ONLY have effect if vsync is set to \"Software Controlled\".\n");
|
||||
cbxVSync->SetToolTip("Vertical sync\nThis option will enable the vertical sync, which will prevent tearing.\nNote: this option will ONLY have effect if vsync is set to \"Software Controlled\".");
|
||||
cbxVSync->SetValue(g_settings->vsync > 0);
|
||||
tooltip = "Select a format, in which screen shots will be saved";
|
||||
lblScreenShotFormat->SetToolTip(tooltip);
|
||||
|
@ -1174,7 +1174,7 @@ void AboutDialog::do_layout()
|
|||
|
||||
wxStaticText* label_1 = new wxStaticText(this, wxID_ANY, "authors:");
|
||||
sizer_1->Add(label_1, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, 5);
|
||||
wxStaticText* label_2 = new wxStaticText(this, wxID_ANY, "Dave2001. Original author and former main developer.\nHe founded Glide64 project on Dec. 29th, 2001.\nLeft the project at fall of 2002.\n");
|
||||
wxStaticText* label_2 = new wxStaticText(this, wxID_ANY, "Dave2001. Original author and former main developer.\nHe founded Glide64 project on Dec. 29th, 2001.\nLeft the project at fall of 2002.");
|
||||
label_2->Enable(false);
|
||||
sizer_2->Add(label_2, 0, 0, 0);
|
||||
sizer_1->Add(sizer_2, 1, wxEXPAND, 0);
|
||||
|
@ -1214,7 +1214,7 @@ void AboutDialog::do_layout()
|
|||
wxStaticText* label_13 = new wxStaticText(this, wxID_ANY, "olivieryuyu");
|
||||
sizer_12->Add(label_13, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||
sizer_1->Add(sizer_12, 1, wxEXPAND, 0);
|
||||
wxStaticText* label_14 = new wxStaticText(this, wxID_ANY, "special thanks to:\n Orkin, Rice, Daniel Borca, Legend.\nThanks to EmuXHaven for hosting my site:\nhttp://glide64.emuxhaven.net\n", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
|
||||
wxStaticText* label_14 = new wxStaticText(this, wxID_ANY, "special thanks to:\n Orkin, Rice, Daniel Borca, Legend.\nThanks to EmuXHaven for hosting my site:\nhttp://glide64.emuxhaven.net", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
|
||||
sizer_1->Add(label_14, 0, wxALIGN_CENTER_HORIZONTAL, 0);
|
||||
sizer_1->Add(button_ok, 0, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND | wxALIGN_CENTER_HORIZONTAL, 10);
|
||||
SetSizer(sizer_1);
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "Gfx_1.3.h"
|
||||
#include "FBtoScreen.h"
|
||||
#include "TexCache.h"
|
||||
#include <Glide64/trace.h>
|
||||
|
||||
static int SetupFBtoScreenCombiner(uint32_t texture_size, uint32_t opaque)
|
||||
{
|
||||
|
@ -148,7 +149,7 @@ static void DrawRE2Video(FB_TO_SCREEN_INFO & fb_info, float scale)
|
|||
|
||||
static void DrawRE2Video256(FB_TO_SCREEN_INFO & fb_info)
|
||||
{
|
||||
FRDP("DrawRE2Video256. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "DrawRE2Video256. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
|
||||
uint32_t * src = (uint32_t*)(gfx.RDRAM + fb_info.addr);
|
||||
GrTexInfo t_info;
|
||||
t_info.smallLodLog2 = GR_LOD_LOG2_256;
|
||||
|
@ -195,7 +196,7 @@ static void DrawFrameBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
|
|||
DrawRE2Video256(fb_info);
|
||||
return;
|
||||
}
|
||||
FRDP("DrawFrameBufferToScreen256. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "DrawFrameBufferToScreen256. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
|
||||
uint32_t width = fb_info.lr_x - fb_info.ul_x + 1;
|
||||
uint32_t height = fb_info.lr_y - fb_info.ul_y + 1;
|
||||
GrTexInfo t_info;
|
||||
|
@ -313,7 +314,7 @@ bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
|
|||
DrawFrameBufferToScreen256(fb_info);
|
||||
return true;
|
||||
}
|
||||
FRDP("DrawFrameBufferToScreen. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "DrawFrameBufferToScreen. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx", 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;
|
||||
uint8_t * image = gfx.RDRAM + fb_info.addr;
|
||||
uint32_t texwidth;
|
||||
|
@ -429,7 +430,7 @@ bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
|
|||
|
||||
static void DrawDepthBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
|
||||
{
|
||||
FRDP("DrawDepthBufferToScreen256. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "DrawDepthBufferToScreen256. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
|
||||
uint32_t width = fb_info.lr_x - fb_info.ul_x + 1;
|
||||
uint32_t height = fb_info.lr_y - fb_info.ul_y + 1;
|
||||
GrTexInfo t_info;
|
||||
|
@ -501,7 +502,7 @@ static void DrawDepthBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
|
|||
|
||||
static void DrawHiresDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
|
||||
{
|
||||
FRDP("DrawHiresDepthBufferToScreen. 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);
|
||||
WriteTrace(TraceRDP, TraceDebug, "DrawHiresDepthBufferToScreen. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx", 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;
|
||||
float scale = 0.25f;
|
||||
GrLOD_t LOD = GR_LOD_LOG2_1024;
|
||||
|
@ -582,7 +583,7 @@ void DrawDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
|
|||
DrawHiresDepthBufferToScreen(fb_info);
|
||||
return;
|
||||
}
|
||||
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);
|
||||
WriteTrace(TraceRDP, TraceDebug, "DrawDepthBufferToScreen. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx", 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;
|
||||
uint8_t * image = gfx.RDRAM + fb_info.addr;
|
||||
uint32_t texwidth;
|
||||
|
|
|
@ -106,11 +106,9 @@ extern "C" {
|
|||
|
||||
//#define ALTTAB_FIX
|
||||
|
||||
//#define EXTREME_LOGGING // lots of logging
|
||||
// note that some of these things are inserted/removed
|
||||
// from within the code & may not be changed by this define.
|
||||
|
||||
//#define TLUT_LOGGING // log every entry of the TLUT?
|
||||
// ********************************
|
||||
|
||||
#define FPS // fps counter able? (not enabled necessarily)
|
||||
|
@ -127,9 +125,7 @@ extern "C" {
|
|||
// the command is logged before continuing (in case of
|
||||
// crash or exception, the log will not be cut short)
|
||||
#ifndef _ENDUSER_RELEASE_
|
||||
#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.
|
||||
//#define RDP_ERROR_LOG
|
||||
|
||||
#endif
|
||||
|
||||
#define FPS_FRAMES 10 // Number of frames in which to make an FPS count
|
||||
|
@ -151,15 +147,7 @@ extern "C" {
|
|||
//#define SIMULATE_BANSHEE
|
||||
//********
|
||||
|
||||
#ifdef EXT_LOGGING
|
||||
extern std::ofstream extlog;
|
||||
#define EXT(x) extlog.open("ext.txt",std::ios::app); extlog << x; extlog.close();
|
||||
#else
|
||||
#define EXT(x)
|
||||
#endif
|
||||
|
||||
#ifndef _ENDUSER_RELEASE_
|
||||
#define UNIMP_LOG // Keep enabled, option in dialog
|
||||
#define BRIGHT_RED // Keep enabled, option in dialog
|
||||
#endif
|
||||
|
||||
|
@ -189,78 +177,6 @@ extern "C" {
|
|||
extern int64 perf_next;
|
||||
#endif
|
||||
|
||||
#ifdef RDP_LOGGING
|
||||
extern int log_open;
|
||||
extern std::ofstream rdp_log;
|
||||
#define OPEN_RDP_LOG() EXT("OPEN_RDP_LOG ()\n"); if (g_settings->logging && !log_open) { rdp_log.open ("rdp.txt"); log_open=TRUE; }
|
||||
#define CLOSE_RDP_LOG() EXT("CLOSE_RDP_LOG ()\n"); if (g_settings->logging && log_open) { rdp_log.close (); log_open=FALSE; }
|
||||
|
||||
#ifdef LOGNOTKEY
|
||||
#define LRDP(x) EXT("RDP (...)\n"); if (g_settings->logging && log_open) { if (!CheckKeyPressed(LOGKEY,0x8000)) { rdp_log << x; rdp_log.flush(); } }
|
||||
#else
|
||||
#define LRDP(x) EXT("RDP (...)\n"); if (g_settings->logging && log_open) { rdp_log << x; rdp_log.flush(); }
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define OPEN_RDP_LOG()
|
||||
#define CLOSE_RDP_LOG()
|
||||
#define LRDP(x)
|
||||
#endif
|
||||
|
||||
#ifdef RDP_ERROR_LOG
|
||||
extern int elog_open;
|
||||
extern std::ofstream rdp_err;
|
||||
#define OPEN_RDP_E_LOG() EXT("OPEN_RDP_E_LOG ()\n"); if (g_settings->elogging && !elog_open) { rdp_err.open ("rdp_e.txt"); elog_open=TRUE; }
|
||||
#define CLOSE_RDP_E_LOG() EXT("CLOSE_RDP_LOG ()\n"); if (g_settings->elogging && elog_open) { rdp_err.close (); elog_open=FALSE; }
|
||||
#define RDP_E(x) if (g_settings->elogging) { FRDP_E (x); }
|
||||
#else
|
||||
#define OPEN_RDP_E_LOG()
|
||||
#define CLOSE_RDP_E_LOG()
|
||||
#define RDP_E(x)
|
||||
#endif
|
||||
|
||||
#ifdef RDP_LOGGING
|
||||
__inline void FRDP(const char *fmt, ...)
|
||||
{
|
||||
if (!g_settings->logging || !log_open) return;
|
||||
|
||||
#ifdef LOGNOTKEY
|
||||
if (CheckKeyPressed(LOGKEY, 0x8000)) return;
|
||||
#endif
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vsprintf(out_buf, fmt, ap);
|
||||
LRDP(out_buf);
|
||||
va_end(ap);
|
||||
}
|
||||
#else
|
||||
__inline void FRDP(const char * /*fmt*/, ...) {}
|
||||
#endif
|
||||
|
||||
#ifdef RDP_ERROR_LOG
|
||||
__inline void FRDP_E(const char *fmt, ...)
|
||||
{
|
||||
if (!g_settings->elogging || !elog_open) return;
|
||||
|
||||
#ifdef LOGNOTKEY
|
||||
if (CheckKeyPressed(LOGKEY, 0x8000)) return;
|
||||
#endif
|
||||
|
||||
sprintf(out_buf, "%08lx: (%08lx, %08lx) ", rdp.pc[rdp.pc_i] - 8, rdp.cmd0, rdp.cmd1);
|
||||
rdp_err << out_buf;
|
||||
|
||||
va_list ap2;
|
||||
va_start(ap2, fmt);
|
||||
vsprintf(out_buf, fmt, ap2);
|
||||
rdp_err << out_buf;
|
||||
rdp_err.flush();
|
||||
va_end(ap2);
|
||||
}
|
||||
#else
|
||||
__inline void FRDP_E(const char * /*fmt*/, ...) {}
|
||||
#endif
|
||||
|
||||
extern int GfxInitDone;
|
||||
extern int romopen;
|
||||
extern int to_fullscreen;
|
||||
|
|
|
@ -61,20 +61,6 @@
|
|||
int ghq_dmptex_toggle_key = 0;
|
||||
#endif
|
||||
|
||||
#ifdef EXT_LOGGING
|
||||
std::ofstream extlog;
|
||||
#endif
|
||||
|
||||
#ifdef RDP_LOGGING
|
||||
int log_open = FALSE;
|
||||
std::ofstream rdp_log;
|
||||
#endif
|
||||
|
||||
#ifdef RDP_ERROR_LOG
|
||||
int elog_open = FALSE;
|
||||
std::ofstream rdp_err;
|
||||
#endif
|
||||
|
||||
GFX_INFO gfx;
|
||||
|
||||
int to_fullscreen = FALSE;
|
||||
|
@ -213,8 +199,8 @@ void _ChangeSize()
|
|||
rdp.vi_height = (vend - vstart) * fscale_y * 1.0126582f;
|
||||
float aspect = (g_settings->adjust_aspect && (fscale_y > fscale_x) && (rdp.vi_width > rdp.vi_height)) ? fscale_x / fscale_y : 1.0f;
|
||||
|
||||
WriteTrace(TraceResolution, TraceDebug, "hstart: %d, hend: %d, vstart: %d, vend: %d\n", hstart, hend, vstart, vend);
|
||||
WriteTrace(TraceResolution, TraceDebug, "size: %d x %d\n", (int)rdp.vi_width, (int)rdp.vi_height);
|
||||
WriteTrace(TraceResolution, TraceDebug, "hstart: %d, hend: %d, vstart: %d, vend: %d", hstart, hend, vstart, vend);
|
||||
WriteTrace(TraceResolution, TraceDebug, "size: %d x %d", (int)rdp.vi_width, (int)rdp.vi_height);
|
||||
|
||||
rdp.scale_x = (float)g_settings->res_x / rdp.vi_width;
|
||||
if (region > 0 && g_settings->pal230)
|
||||
|
@ -383,7 +369,7 @@ void ReadSettings()
|
|||
void ReadSpecialSettings(const char * name)
|
||||
{
|
||||
// char buf [256];
|
||||
// sprintf(buf, "ReadSpecialSettings. Name: %s\n", name);
|
||||
// sprintf(buf, "ReadSpecialSettings. Name: %s", name);
|
||||
// LOG(buf);
|
||||
g_settings->hacks = 0;
|
||||
|
||||
|
@ -718,8 +704,8 @@ void guLoadTextures()
|
|||
if (cur&b) *tex8 = 0xFF;
|
||||
else *tex8 = 0x00;
|
||||
tex8++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
grTexDownloadMipMap(GR_TMU0,
|
||||
voodoo.tex_min_addr[GR_TMU0] + offset_font,
|
||||
|
@ -794,8 +780,6 @@ int InitGfx()
|
|||
ReleaseGfx();
|
||||
}
|
||||
|
||||
OPEN_RDP_LOG(); // doesn't matter if opens again; it will check for it
|
||||
OPEN_RDP_E_LOG();
|
||||
WriteTrace(TraceGlide64, TraceDebug, "-");
|
||||
|
||||
debugging = FALSE;
|
||||
|
@ -1002,7 +986,7 @@ int InitGfx()
|
|||
fog_t[0] = 0;
|
||||
// for (int f = 0; f < 64; f++)
|
||||
// {
|
||||
// FRDP("fog[%d]=%d->%f\n", f, fog_t[f], guFogTableIndexToW(f));
|
||||
// WriteTrace(TraceRDP, TraceDebug, "fog[%d]=%d->%f", f, fog_t[f], guFogTableIndexToW(f));
|
||||
// }
|
||||
grFogTable(fog_t);
|
||||
grVertexLayout(GR_PARAM_FOG_EXT, offsetof(VERTEX, f), GR_PARAM_ENABLE);
|
||||
|
@ -1387,7 +1371,7 @@ void CALL CloseDLL(void)
|
|||
voodoo.gamma_table_g = 0;
|
||||
delete[] voodoo.gamma_table_b;
|
||||
voodoo.gamma_table_b = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
Function: DllTest
|
||||
|
@ -1643,12 +1627,12 @@ void CALL RomClosed(void)
|
|||
{
|
||||
WriteTrace(TraceGlide64, TraceDebug, "-");
|
||||
|
||||
CLOSE_RDP_LOG();
|
||||
CLOSE_RDP_E_LOG();
|
||||
rdp.window_changed = TRUE;
|
||||
romopen = FALSE;
|
||||
if (evoodoo)
|
||||
{
|
||||
ReleaseGfx();
|
||||
}
|
||||
}
|
||||
|
||||
static void CheckDRAMSize()
|
||||
|
@ -1667,7 +1651,7 @@ static void CheckDRAMSize()
|
|||
else
|
||||
BMASK = WMASK;
|
||||
#ifdef LOGGING
|
||||
sprintf(out_buf, "Detected RDRAM size: %08lx\n", BMASK);
|
||||
sprintf(out_buf, "Detected RDRAM size: %08lx", BMASK);
|
||||
LOG(out_buf);
|
||||
#endif
|
||||
}
|
||||
|
@ -1733,9 +1717,6 @@ void CALL RomOpen(void)
|
|||
|
||||
CheckDRAMSize();
|
||||
|
||||
OPEN_RDP_LOG();
|
||||
OPEN_RDP_E_LOG();
|
||||
|
||||
// ** EVOODOO EXTENSIONS **
|
||||
if (!GfxInitDone)
|
||||
{
|
||||
|
@ -1787,7 +1768,7 @@ void drawViRegBG()
|
|||
fb_info.height = (uint32_t)rdp.vi_height;
|
||||
if (fb_info.height == 0)
|
||||
{
|
||||
LRDP("Image height = 0 - skipping\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Image height = 0 - skipping");
|
||||
return;
|
||||
}
|
||||
fb_info.ul_x = 0;
|
||||
|
@ -1832,7 +1813,7 @@ output: none
|
|||
uint32_t update_screen_count = 0;
|
||||
void CALL UpdateScreen(void)
|
||||
{
|
||||
WriteTrace(TraceGlide64, TraceDebug, "Origin: %08x, Old origin: %08x, width: %d\n", *gfx.VI_ORIGIN_REG, rdp.vi_org_reg, *gfx.VI_WIDTH_REG);
|
||||
WriteTrace(TraceGlide64, TraceDebug, "Origin: %08x, Old origin: %08x, width: %d", *gfx.VI_ORIGIN_REG, rdp.vi_org_reg, *gfx.VI_WIDTH_REG);
|
||||
|
||||
uint32_t width = (*gfx.VI_WIDTH_REG) << 1;
|
||||
if (*gfx.VI_ORIGIN_REG > width)
|
||||
|
@ -1862,7 +1843,7 @@ void CALL UpdateScreen(void)
|
|||
uint32_t limit = (g_settings->hacks&hack_Lego) ? 15 : 30;
|
||||
if ((g_settings->frame_buffer&fb_cpu_write_hack) && (update_screen_count > limit) && (rdp.last_bg == 0))
|
||||
{
|
||||
LRDP("DirectCPUWrite hack!\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "DirectCPUWrite hack!");
|
||||
update_screen_count = 0;
|
||||
no_dlist = true;
|
||||
ClearCache();
|
||||
|
@ -1876,9 +1857,9 @@ void CALL UpdateScreen(void)
|
|||
if (*gfx.VI_ORIGIN_REG > width)
|
||||
{
|
||||
ChangeSize();
|
||||
LRDP("ChangeSize done\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "ChangeSize done");
|
||||
DrawFrameBuffer();
|
||||
LRDP("DrawFrameBuffer done\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "DrawFrameBuffer done");
|
||||
rdp.updatescreen = 1;
|
||||
newSwapBuffers();
|
||||
}
|
||||
|
@ -1936,7 +1917,7 @@ void newSwapBuffers()
|
|||
|
||||
rdp.updatescreen = 0;
|
||||
|
||||
LRDP("swapped\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "swapped");
|
||||
|
||||
rdp.update |= UPDATE_SCISSOR | UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE;
|
||||
grClipWindow(0, 0, g_settings->scr_res_x, g_settings->scr_res_y);
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "Gfx_1.3.h"
|
||||
#include "TexBuffer.h"
|
||||
#include "CRC.h"
|
||||
#include <Glide64/trace.h>
|
||||
|
||||
static TBUFF_COLOR_IMAGE * AllocateTextureBuffer(COLOR_IMAGE & cimage)
|
||||
{
|
||||
|
@ -153,7 +154,7 @@ static TBUFF_COLOR_IMAGE * AllocateTextureBuffer(COLOR_IMAGE & cimage)
|
|||
texbuf.crc = 0;
|
||||
texbuf.t_mem = 0;
|
||||
|
||||
FRDP("\nAllocateTextureBuffer. width: %d, height: %d, scr_width: %f, scr_height: %f, vi_width: %f, vi_height:%f, scale_x: %f, scale_y: %f, lr_u: %f, lr_v: %f, u_scale: %f, v_scale: %f\n", texbuf.width, texbuf.height, texbuf.scr_width, texbuf.scr_height, rdp.vi_width, rdp.vi_height, rdp.scale_x, rdp.scale_y, texbuf.lr_u, texbuf.lr_v, texbuf.u_scale, texbuf.v_scale);
|
||||
WriteTrace(TraceRDP, TraceDebug, "\nAllocateTextureBuffer. width: %d, height: %d, scr_width: %f, scr_height: %f, vi_width: %f, vi_height:%f, scale_x: %f, scale_y: %f, lr_u: %f, lr_v: %f, u_scale: %f, v_scale: %f", texbuf.width, texbuf.height, texbuf.scr_width, texbuf.scr_height, rdp.vi_width, rdp.vi_height, rdp.scale_x, rdp.scale_y, texbuf.lr_u, texbuf.lr_v, texbuf.u_scale, texbuf.v_scale);
|
||||
|
||||
uint32_t required = grTexCalcMemRequired(texbuf.info.smallLodLog2, texbuf.info.largeLodLog2,
|
||||
texbuf.info.aspectRatioLog2, texbuf.info.format);
|
||||
|
@ -210,7 +211,7 @@ static TBUFF_COLOR_IMAGE * AllocateTextureBuffer(COLOR_IMAGE & cimage)
|
|||
|
||||
int OpenTextureBuffer(COLOR_IMAGE & cimage)
|
||||
{
|
||||
FRDP("OpenTextureBuffer. cur_tex_buf: %d, addr: %08lx, width: %d, height: %d", rdp.cur_tex_buf, cimage.addr, cimage.width, cimage.height);
|
||||
WriteTrace(TraceRDP, TraceDebug, "OpenTextureBuffer. cur_tex_buf: %d, addr: %08lx, width: %d, height: %d", rdp.cur_tex_buf, cimage.addr, cimage.width, cimage.height);
|
||||
|
||||
int found = FALSE, search = TRUE;
|
||||
TBUFF_COLOR_IMAGE *texbuf = 0;
|
||||
|
@ -229,7 +230,7 @@ int OpenTextureBuffer(COLOR_IMAGE & cimage)
|
|||
if (g_settings->hacks&hack_PMario) //motion blur effects in Paper Mario
|
||||
{
|
||||
rdp.cur_tex_buf = rdp.acc_tex_buf;
|
||||
FRDP("\nread_whole_frame. last allocated bank: %d\n", rdp.acc_tex_buf);
|
||||
WriteTrace(TraceRDP, TraceDebug, "\nread_whole_frame. last allocated bank: %d", rdp.acc_tex_buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -301,22 +302,22 @@ int OpenTextureBuffer(COLOR_IMAGE & cimage)
|
|||
}
|
||||
else
|
||||
{
|
||||
LRDP(" not searched");
|
||||
WriteTrace(TraceRDP, TraceDebug, " not searched");
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
LRDP(" not found");
|
||||
WriteTrace(TraceRDP, TraceDebug, " not found");
|
||||
texbuf = AllocateTextureBuffer(cimage);
|
||||
}
|
||||
else
|
||||
{
|
||||
LRDP(" found");
|
||||
WriteTrace(TraceRDP, TraceDebug, " found");
|
||||
}
|
||||
|
||||
if (!texbuf)
|
||||
{
|
||||
LRDP(" KO\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " KO");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -335,7 +336,7 @@ int OpenTextureBuffer(COLOR_IMAGE & cimage)
|
|||
}
|
||||
//*/
|
||||
// memset(gfx.RDRAM+cimage.addr, 0, cimage.width*cimage.height*cimage.size);
|
||||
FRDP(" texaddr: %08lx, tex_width: %d, tex_height: %d, cur_tex_buf: %d, texformat: %d, motionblur: %d\n", rdp.cur_image->tex_addr, rdp.cur_image->tex_width, rdp.cur_image->tex_height, rdp.cur_tex_buf, rdp.cur_image->info.format, rdp.motionblur);
|
||||
WriteTrace(TraceRDP, TraceDebug, " texaddr: %08lx, tex_width: %d, tex_height: %d, cur_tex_buf: %d, texformat: %d, motionblur: %d", rdp.cur_image->tex_addr, rdp.cur_image->tex_width, rdp.cur_image->tex_height, rdp.cur_tex_buf, rdp.cur_image->info.format, rdp.motionblur);
|
||||
if (!rdp.offset_x_bak)
|
||||
{
|
||||
rdp.offset_x_bak = rdp.offset_x;
|
||||
|
@ -421,7 +422,7 @@ int CloseTextureBuffer(int draw)
|
|||
{
|
||||
if (!rdp.cur_image)
|
||||
{
|
||||
LRDP("CloseTextureBuffer KO\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "CloseTextureBuffer KO");
|
||||
return FALSE;
|
||||
}
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
|
@ -431,7 +432,7 @@ int CloseTextureBuffer(int draw)
|
|||
rdp.update |= UPDATE_VIEWPORT | UPDATE_SCISSOR;
|
||||
if (!draw)
|
||||
{
|
||||
LRDP("CloseTextureBuffer no draw, OK\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "CloseTextureBuffer no draw, OK");
|
||||
rdp.cur_image = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -445,7 +446,7 @@ int CloseTextureBuffer(int draw)
|
|||
float lr_y = rdp.tbuff_tex->scr_height + rdp.offset_y;
|
||||
float lr_u = rdp.tbuff_tex->lr_u;
|
||||
float lr_v = rdp.tbuff_tex->lr_v;
|
||||
FRDP("lr_x: %f, lr_y: %f, lr_u: %f, lr_v: %f\n", lr_x, lr_y, lr_u, lr_v);
|
||||
WriteTrace(TraceRDP, TraceDebug, "lr_x: %f, lr_y: %f, lr_u: %f, lr_v: %f", lr_x, lr_y, lr_u, lr_v);
|
||||
|
||||
// Make the vertices
|
||||
VERTEX v[4] = {
|
||||
|
@ -464,14 +465,14 @@ int CloseTextureBuffer(int draw)
|
|||
{
|
||||
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
|
||||
}
|
||||
LRDP("CloseTextureBuffer draw, OK\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "CloseTextureBuffer draw, OK");
|
||||
rdp.tbuff_tex = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to)
|
||||
{
|
||||
FRDP("CopyTextureBuffer from %08x to %08x\n", fb_from.addr, fb_to.addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "CopyTextureBuffer from %08x to %08x", fb_from.addr, fb_to.addr);
|
||||
if (rdp.cur_image)
|
||||
{
|
||||
rdp.cur_image->crc = 0;
|
||||
|
@ -481,12 +482,12 @@ int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to)
|
|||
}
|
||||
else if (!FindTextureBuffer(fb_from.addr, (uint16_t)fb_from.width))
|
||||
{
|
||||
LRDP("Can't find 'from' buffer.\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Can't find 'from' buffer.");
|
||||
return FALSE;
|
||||
}
|
||||
if (!OpenTextureBuffer(fb_to))
|
||||
{
|
||||
LRDP("Can't open new buffer.\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Can't open new buffer.");
|
||||
return CloseTextureBuffer(TRUE);
|
||||
}
|
||||
rdp.tbuff_tex->crc = 0;
|
||||
|
@ -500,7 +501,7 @@ int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to)
|
|||
float zero = 0.0f;
|
||||
float lr_u = rdp.tbuff_tex->lr_u;
|
||||
float lr_v = rdp.tbuff_tex->lr_v;
|
||||
FRDP("lr_x: %f, lr_y: %f\n", lr_x, lr_y);
|
||||
WriteTrace(TraceRDP, TraceDebug, "lr_x: %f, lr_y: %f", lr_x, lr_y);
|
||||
|
||||
// Make the vertices
|
||||
VERTEX v[4] = {
|
||||
|
@ -527,7 +528,7 @@ int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to)
|
|||
rdp.update |= UPDATE_VIEWPORT | UPDATE_SCISSOR;
|
||||
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
|
||||
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
|
||||
LRDP("CopyTextureBuffer draw, OK\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "CopyTextureBuffer draw, OK");
|
||||
rdp.tbuff_tex = 0;
|
||||
rdp.cur_image = 0;
|
||||
return TRUE;
|
||||
|
@ -535,7 +536,7 @@ int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to)
|
|||
|
||||
int CopyDepthBuffer()
|
||||
{
|
||||
LRDP("CopyDepthBuffer. ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "CopyDepthBuffer. ");
|
||||
float bound = 1024.0f;
|
||||
GrLOD_t LOD = GR_LOD_LOG2_1024;
|
||||
if (g_settings->scr_res_x > 1024)
|
||||
|
@ -556,7 +557,7 @@ int CopyDepthBuffer()
|
|||
float zero = 0.0f;
|
||||
float lr_u = 255.5f;
|
||||
float lr_v = 255.5f;
|
||||
FRDP("lr_x: %f, lr_y: %f\n", lr_x, lr_y);
|
||||
WriteTrace(TraceRDP, TraceDebug, "lr_x: %f, lr_y: %f", lr_x, lr_y);
|
||||
|
||||
// Make the vertices
|
||||
VERTEX v[4] = {
|
||||
|
@ -581,7 +582,7 @@ int CopyDepthBuffer()
|
|||
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE;
|
||||
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
|
||||
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
|
||||
LRDP("CopyDepthBuffer draw, OK\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "CopyDepthBuffer draw, OK");
|
||||
rdp.tbuff_tex = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -590,7 +591,7 @@ int SwapTextureBuffer()
|
|||
{
|
||||
if (!rdp.tbuff_tex)
|
||||
return FALSE;
|
||||
LRDP("SwapTextureBuffer.");
|
||||
WriteTrace(TraceRDP, TraceDebug, "SwapTextureBuffer.");
|
||||
COLOR_IMAGE ci;
|
||||
ci.addr = rdp.tbuff_tex->addr;
|
||||
ci.format = rdp.tbuff_tex->format;
|
||||
|
@ -602,7 +603,7 @@ int SwapTextureBuffer()
|
|||
TBUFF_COLOR_IMAGE * texbuf = AllocateTextureBuffer(ci);
|
||||
if (!texbuf)
|
||||
{
|
||||
LRDP("Failed!\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Failed!");
|
||||
return FALSE;
|
||||
}
|
||||
TexBufSetupCombiner();
|
||||
|
@ -657,7 +658,7 @@ int SwapTextureBuffer()
|
|||
{
|
||||
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
|
||||
}
|
||||
LRDP("SwapTextureBuffer draw, OK\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "SwapTextureBuffer draw, OK");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -683,7 +684,7 @@ int FindTextureBuffer(uint32_t addr, uint16_t width)
|
|||
{
|
||||
if (rdp.skip_drawing)
|
||||
return FALSE;
|
||||
FRDP("FindTextureBuffer. addr: %08lx, width: %d, scale_x: %f\n", addr, width, rdp.scale_x);
|
||||
WriteTrace(TraceRDP, TraceDebug, "FindTextureBuffer. addr: %08lx, width: %d, scale_x: %f", addr, width, rdp.scale_x);
|
||||
int found = FALSE;
|
||||
uint32_t shift = 0;
|
||||
for (int i = 0; i < voodoo.num_tmu && !found; i++)
|
||||
|
@ -709,7 +710,7 @@ int FindTextureBuffer(uint32_t addr, uint16_t width)
|
|||
if (!rdp.cur_image)
|
||||
rdp.cur_tex_buf = index;
|
||||
found = TRUE;
|
||||
// FRDP("FindTextureBuffer, found in TMU%d buffer: %d\n", rdp.tbuff_tex->tmu, j);
|
||||
// WriteTrace(TraceRDP, TraceDebug, "FindTextureBuffer, found in TMU%d buffer: %d", rdp.tbuff_tex->tmu, j);
|
||||
}
|
||||
else //new texture is loaded into this place, texture buffer is not valid anymore
|
||||
{
|
||||
|
@ -735,11 +736,11 @@ int FindTextureBuffer(uint32_t addr, uint16_t width)
|
|||
rdp.tbuff_tex->v_shift = 0;
|
||||
rdp.tbuff_tex->u_shift = 0;
|
||||
}
|
||||
FRDP("FindTextureBuffer, found, u_shift: %d, v_shift: %d, format: %s\n", rdp.tbuff_tex->u_shift, rdp.tbuff_tex->v_shift, str_format[rdp.tbuff_tex->format]);
|
||||
//FRDP("Buffer, addr=%08lx, end_addr=%08lx, width: %d, height: %d\n", rdp.tbuff_tex->addr, rdp.tbuff_tex->end_addr, rdp.tbuff_tex->width, rdp.tbuff_tex->height);
|
||||
WriteTrace(TraceRDP, TraceDebug, "FindTextureBuffer, found, u_shift: %d, v_shift: %d, format: %s", rdp.tbuff_tex->u_shift, rdp.tbuff_tex->v_shift, str_format[rdp.tbuff_tex->format]);
|
||||
//WriteTrace(TraceRDP, TraceDebug, "Buffer, addr=%08lx, end_addr=%08lx, width: %d, height: %d", rdp.tbuff_tex->addr, rdp.tbuff_tex->end_addr, rdp.tbuff_tex->width, rdp.tbuff_tex->height);
|
||||
return TRUE;
|
||||
}
|
||||
rdp.tbuff_tex = 0;
|
||||
LRDP("FindTextureBuffer, not found\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "FindTextureBuffer, not found");
|
||||
return FALSE;
|
||||
}
|
|
@ -42,6 +42,7 @@
|
|||
#include "Combine.h"
|
||||
#include "Util.h"
|
||||
#include <Common/Util.h>
|
||||
#include <Glide64/trace.h>
|
||||
|
||||
void LoadTex(int id, int tmu);
|
||||
|
||||
|
@ -173,7 +174,7 @@ uint32_t textureCRC(uint8_t *addr, int width, int height, int line)
|
|||
|
||||
void GetTexInfo(int id, int tile)
|
||||
{
|
||||
FRDP(" | |-+ GetTexInfo (id: %d, tile: %d)\n", id, tile);
|
||||
WriteTrace(TraceRDP, TraceDebug, " | |-+ GetTexInfo (id: %d, tile: %d)", id, tile);
|
||||
|
||||
// this is the NEW cache searching, searches only textures with similar crc's
|
||||
int t;
|
||||
|
@ -305,15 +306,15 @@ void GetTexInfo(int id, int tile)
|
|||
info->splits = 1;
|
||||
}
|
||||
|
||||
LRDP(" | | |-+ Texture approved:\n");
|
||||
FRDP(" | | | |- tmem: %08lx\n", rdp.tiles[tile].t_mem);
|
||||
FRDP(" | | | |- load width: %d\n", width);
|
||||
FRDP(" | | | |- load height: %d\n", height);
|
||||
FRDP(" | | | |- actual width: %d\n", rdp.tiles[tile].width);
|
||||
FRDP(" | | | |- actual height: %d\n", rdp.tiles[tile].height);
|
||||
FRDP(" | | | |- size: %d\n", rdp.tiles[tile].size);
|
||||
FRDP(" | | | +- format: %d\n", rdp.tiles[tile].format);
|
||||
LRDP(" | | |- Calculating CRC... ");
|
||||
WriteTrace(TraceRDP, TraceDebug, " | | |-+ Texture approved:");
|
||||
WriteTrace(TraceRDP, TraceDebug, " | | | |- tmem: %08lx", rdp.tiles[tile].t_mem);
|
||||
WriteTrace(TraceRDP, TraceDebug, " | | | |- load width: %d", width);
|
||||
WriteTrace(TraceRDP, TraceDebug, " | | | |- load height: %d", height);
|
||||
WriteTrace(TraceRDP, TraceDebug, " | | | |- actual width: %d", rdp.tiles[tile].width);
|
||||
WriteTrace(TraceRDP, TraceDebug, " | | | |- actual height: %d", rdp.tiles[tile].height);
|
||||
WriteTrace(TraceRDP, TraceDebug, " | | | |- size: %d", rdp.tiles[tile].size);
|
||||
WriteTrace(TraceRDP, TraceDebug, " | | | +- format: %d", rdp.tiles[tile].format);
|
||||
WriteTrace(TraceRDP, TraceDebug, " | | |- Calculating CRC... ");
|
||||
|
||||
// ** CRC CHECK
|
||||
|
||||
|
@ -332,7 +333,7 @@ void GetTexInfo(int id, int tile)
|
|||
// Texture too big for tmem & needs to wrap? (trees in mm)
|
||||
if (rdp.tiles[tile].t_mem + minval(height, tile_height) * (rdp.tiles[tile].line << 3) > 4096)
|
||||
{
|
||||
LRDP("TEXTURE WRAPS TMEM!!! ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "TEXTURE WRAPS TMEM!!! ");
|
||||
|
||||
// calculate the y value that intersects at 4096 bytes
|
||||
int y = (4096 - rdp.tiles[tile].t_mem) / (rdp.tiles[tile].line << 3);
|
||||
|
@ -346,7 +347,7 @@ void GetTexInfo(int id, int tile)
|
|||
rdp.tiles[tile].mask_t = shift;
|
||||
|
||||
// restart the function
|
||||
LRDP("restarting...\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "restarting...");
|
||||
GetTexInfo(id, tile);
|
||||
return;
|
||||
}
|
||||
|
@ -411,7 +412,7 @@ void GetTexInfo(int id, int tile)
|
|||
crc += rdp.pal_256_crc;
|
||||
}
|
||||
|
||||
FRDP("Done. CRC is: %08lx.\n", crc);
|
||||
WriteTrace(TraceRDP, TraceDebug, "Done. CRC is: %08lx.", crc);
|
||||
|
||||
uint32_t flags = (rdp.tiles[tile].clamp_s << 23) | (rdp.tiles[tile].mirror_s << 22) |
|
||||
(rdp.tiles[tile].mask_s << 18) | (rdp.tiles[tile].clamp_t << 17) |
|
||||
|
@ -431,7 +432,7 @@ void GetTexInfo(int id, int tile)
|
|||
info->flags = flags;
|
||||
|
||||
// Search the texture cache for this texture
|
||||
LRDP(" | | |-+ Checking cache...\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " | | |-+ Checking cache...");
|
||||
|
||||
CACHE_LUT *cache;
|
||||
|
||||
|
@ -477,7 +478,7 @@ void GetTexInfo(int id, int tile)
|
|||
(cache->mod_color2&mod_mask) == (modcolor2&mod_mask) &&
|
||||
abs((int)(cache->mod_factor - modfactor)) < 8))
|
||||
{
|
||||
FRDP(" | | | |- Texture found in cache (tmu=%d).\n", node->tmu);
|
||||
WriteTrace(TraceRDP, TraceDebug, " | | | |- Texture found in cache (tmu=%d).", node->tmu);
|
||||
tex_found[id][node->tmu] = node->number;
|
||||
if (voodoo.tex_UMA)
|
||||
{
|
||||
|
@ -490,7 +491,7 @@ void GetTexInfo(int id, int tile)
|
|||
node = node->pNext;
|
||||
}
|
||||
|
||||
LRDP(" | | | +- Done.\n | | +- GetTexInfo end\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " | | | +- Done.\n | | +- GetTexInfo end");
|
||||
}
|
||||
|
||||
//****************************************************************
|
||||
|
@ -515,7 +516,7 @@ int ChooseBestTmu(int tmu1, int tmu2)
|
|||
// SelectTBuffTex - select texture from texture buffer
|
||||
static void SelectTBuffTex(TBUFF_COLOR_IMAGE * pTBuffTex)
|
||||
{
|
||||
FRDP("SelectTBuffTex: tex: %d, tmu: %d, tile: %d\n", rdp.tex, pTBuffTex->tmu, pTBuffTex->tile);
|
||||
WriteTrace(TraceRDP, TraceDebug, "SelectTBuffTex: tex: %d, tmu: %d, tile: %d", rdp.tex, pTBuffTex->tmu, pTBuffTex->tile);
|
||||
grTexSource(pTBuffTex->tile, pTBuffTex->tex_addr, GR_MIPMAPLEVELMASK_BOTH, &(pTBuffTex->info));
|
||||
}
|
||||
|
||||
|
@ -524,7 +525,7 @@ static void SelectTBuffTex(TBUFF_COLOR_IMAGE * pTBuffTex)
|
|||
int SwapTextureBuffer();
|
||||
void TexCache()
|
||||
{
|
||||
LRDP(" |-+ TexCache called\n");
|
||||
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) {
|
||||
|
@ -537,11 +538,11 @@ void TexCache()
|
|||
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\n");
|
||||
DisplayLoadProgress(L"Texture dump - ON");
|
||||
ClearCache();
|
||||
}
|
||||
else {
|
||||
DisplayLoadProgress(L"Texture dump - OFF\n");
|
||||
DisplayLoadProgress(L"Texture dump - OFF");
|
||||
}
|
||||
pjutil::Sleep(1000);
|
||||
}
|
||||
|
@ -604,9 +605,9 @@ void TexCache()
|
|||
tmu_1_mode = TMUMODE_NONE;
|
||||
}
|
||||
|
||||
FRDP(" | |-+ Modes set:\n | | |- tmu_0 = %d\n | | |- tmu_1 = %d\n",
|
||||
WriteTrace(TraceRDP, TraceDebug, " | |-+ Modes set:\n | | |- tmu_0 = %d\n | | |- tmu_1 = %d",
|
||||
tmu_0, tmu_1);
|
||||
FRDP(" | | |- tmu_0_mode = %d\n | | |- tmu_1_mode = %d\n",
|
||||
WriteTrace(TraceRDP, TraceDebug, " | | |- tmu_0_mode = %d\n | | |- tmu_1_mode = %d",
|
||||
tmu_0_mode, tmu_1_mode);
|
||||
|
||||
if (tmu_0_mode == TMUMODE_PASSTHRU) {
|
||||
|
@ -733,7 +734,7 @@ void TexCache()
|
|||
// Now actually combine
|
||||
if (cmb.cmb_ext_use)
|
||||
{
|
||||
LRDP(" | | | |- combiner extension\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " | | | |- combiner extension");
|
||||
if (!(cmb.cmb_ext_use & COMBINE_EXT_COLOR))
|
||||
ColorCombinerToExtension();
|
||||
if (!(cmb.cmb_ext_use & COMBINE_EXT_ALPHA))
|
||||
|
@ -762,7 +763,7 @@ void TexCache()
|
|||
{
|
||||
if (cmb.tex_cmb_ext_use)
|
||||
{
|
||||
LRDP(" | | | |- combiner extension tmu1\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " | | | |- combiner extension tmu1");
|
||||
if (!(cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_COLOR))
|
||||
TexColorCombinerToExtension(GR_TMU1);
|
||||
if (!(cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_ALPHA))
|
||||
|
@ -790,7 +791,7 @@ void TexCache()
|
|||
{
|
||||
if (cmb.tex_cmb_ext_use)
|
||||
{
|
||||
LRDP(" | | | |- combiner extension tmu0\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " | | | |- combiner extension tmu0");
|
||||
if (!(cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_COLOR))
|
||||
TexColorCombinerToExtension(GR_TMU0);
|
||||
if (!(cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_ALPHA))
|
||||
|
@ -820,7 +821,7 @@ void TexCache()
|
|||
{
|
||||
if (aTBuff[0] && aTBuff[0]->cache)
|
||||
{
|
||||
LRDP(" | |- Hires tex T0 found in cache.\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " | |- Hires tex T0 found in cache.");
|
||||
if (GfxInitDone)
|
||||
{
|
||||
rdp.cur_cache[0] = aTBuff[0]->cache;
|
||||
|
@ -830,7 +831,7 @@ void TexCache()
|
|||
}
|
||||
else if (tex_found[0][tmu_0] != -1)
|
||||
{
|
||||
LRDP(" | |- T0 found in cache.\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " | |- T0 found in cache.");
|
||||
if (GfxInitDone)
|
||||
{
|
||||
CACHE_LUT *cache = voodoo.tex_UMA ? &rdp.cache[0][tex_found[0][0]] : &rdp.cache[tmu_0][tex_found[0][tmu_0]];
|
||||
|
@ -851,7 +852,7 @@ void TexCache()
|
|||
{
|
||||
if (aTBuff[1] && aTBuff[1]->cache)
|
||||
{
|
||||
LRDP(" | |- Hires tex T1 found in cache.\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " | |- Hires tex T1 found in cache.");
|
||||
if (GfxInitDone)
|
||||
{
|
||||
rdp.cur_cache[1] = aTBuff[1]->cache;
|
||||
|
@ -861,7 +862,7 @@ void TexCache()
|
|||
}
|
||||
else if (tex_found[1][tmu_1] != -1)
|
||||
{
|
||||
LRDP(" | |- T1 found in cache.\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " | |- T1 found in cache.");
|
||||
if (GfxInitDone)
|
||||
{
|
||||
CACHE_LUT *cache = voodoo.tex_UMA ? &rdp.cache[0][tex_found[1][0]] : &rdp.cache[tmu_1][tex_found[1][tmu_1]];
|
||||
|
@ -958,7 +959,7 @@ void TexCache()
|
|||
}
|
||||
}
|
||||
|
||||
LRDP(" | +- TexCache End\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " | +- TexCache End");
|
||||
}
|
||||
|
||||
#ifdef TEXTURE_FILTER
|
||||
|
@ -1002,7 +1003,7 @@ inline uint32_t ReverseDXT(uint32_t val, uint32_t /*lrs*/, uint32_t width, uint3
|
|||
|
||||
void LoadTex(int id, int tmu)
|
||||
{
|
||||
FRDP(" | |-+ LoadTex (id: %d, tmu: %d)\n", id, tmu);
|
||||
WriteTrace(TraceRDP, TraceDebug, " | |-+ LoadTex (id: %d, tmu: %d)", id, tmu);
|
||||
|
||||
int td = rdp.cur_tile + id;
|
||||
int lod, aspect;
|
||||
|
@ -1014,7 +1015,7 @@ void LoadTex(int id, int tmu)
|
|||
// Clear the cache if it's full
|
||||
if (rdp.n_cached[tmu] >= MAX_CACHE)
|
||||
{
|
||||
LRDP("Cache count reached, clearing...\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Cache count reached, clearing...");
|
||||
ClearCache();
|
||||
if (id == 1 && rdp.tex == 3)
|
||||
LoadTex(0, rdp.t0);
|
||||
|
@ -1263,7 +1264,7 @@ void LoadTex(int id, int tmu)
|
|||
if (rdp.aTBuffTex[t] && rdp.aTBuffTex[t]->tile == id) //texture buffer will be used instead of frame buffer texture
|
||||
{
|
||||
rdp.aTBuffTex[t]->cache = cache;
|
||||
FRDP("tbuff_tex selected: %d, tile=%d\n", t, id);
|
||||
WriteTrace(TraceRDP, TraceDebug, "tbuff_tex selected: %d, tile=%d", t, id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1345,7 +1346,7 @@ void LoadTex(int id, int tmu)
|
|||
g64_crc = CRC32(g64_crc, &cache->mod_factor, 4);
|
||||
|
||||
cache->ricecrc = ext_ghq_checksum(addr, tile_width, tile_height, (unsigned short)(rdp.tiles[td].format << 8 | rdp.tiles[td].size), bpl, paladdr);
|
||||
FRDP("CI RICE CRC. format: %d, size: %d, CRC: %08lx, PalCRC: %08lx\n", rdp.tiles[td].format, rdp.tiles[td].size, (uint32_t)(cache->ricecrc & 0xFFFFFFFF), (uint32_t)(cache->ricecrc >> 32));
|
||||
WriteTrace(TraceRDP, TraceDebug, "CI RICE CRC. format: %d, size: %d, CRC: %08lx, PalCRC: %08lx", rdp.tiles[td].format, rdp.tiles[td].size, (uint32_t)(cache->ricecrc & 0xFFFFFFFF), (uint32_t)(cache->ricecrc >> 32));
|
||||
if (ext_ghq_hirestex((uint64)g64_crc, cache->ricecrc, palette, &ghqTexInfo))
|
||||
{
|
||||
cache->is_hires_tex = ghqTexInfo.is_hires_tex;
|
||||
|
@ -1797,7 +1798,7 @@ void LoadTex(int id, int tmu)
|
|||
// Check for end of memory (too many textures to fit, clear cache)
|
||||
if (voodoo.tmem_ptr[tmu] + texture_size >= voodoo.tex_max_addr[tmu])
|
||||
{
|
||||
LRDP("Cache size reached, clearing...\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Cache size reached, clearing...");
|
||||
ClearCache();
|
||||
|
||||
if (id == 1 && rdp.tex == 3)
|
||||
|
@ -1820,5 +1821,5 @@ void LoadTex(int id, int tmu)
|
|||
t_info);
|
||||
}
|
||||
|
||||
LRDP(" | | +- LoadTex end\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " | | +- LoadTex end");
|
||||
}
|
|
@ -47,6 +47,7 @@
|
|||
#include "Debugger.h"
|
||||
#include "TexCache.h"
|
||||
#include "DepthBufferRender.h"
|
||||
#include <Glide64/trace.h>
|
||||
|
||||
#define Vj rdp.vtxbuf2[j]
|
||||
#define Vi rdp.vtxbuf2[i]
|
||||
|
@ -77,7 +78,7 @@ int cull_tri(VERTEX **v) // type changed to VERTEX** [Dave2001]
|
|||
|
||||
if (v[0]->scr_off & v[1]->scr_off & v[2]->scr_off)
|
||||
{
|
||||
LRDP(" clipped\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " clipped");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -120,13 +121,13 @@ int cull_tri(VERTEX **v) // type changed to VERTEX** [Dave2001]
|
|||
|
||||
if ((iarea & 0x7FFFFFFF) == 0)
|
||||
{
|
||||
LRDP(" zero area triangles\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " zero area triangles");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ((rdp.flags & CULLMASK) && ((int)(iarea ^ mode)) >= 0)
|
||||
{
|
||||
LRDP(" culled\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " culled");
|
||||
return TRUE;
|
||||
}
|
||||
#else
|
||||
|
@ -143,7 +144,7 @@ int cull_tri(VERTEX **v) // type changed to VERTEX** [Dave2001]
|
|||
// if ((x1*y2 - y1*x2) < 0.0f) //counter-clockwise, positive
|
||||
if ((y1*x2-x1*y2) < 0.0f) //counter-clockwise, positive
|
||||
{
|
||||
LRDP (" culled!\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " culled!");
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
@ -151,7 +152,7 @@ int cull_tri(VERTEX **v) // type changed to VERTEX** [Dave2001]
|
|||
// if ((x1*y2 - y1*x2) >= 0.0f) //clockwise, negative
|
||||
if ((y1*x2-x1*y2) >= 0.0f) //clockwise, negative
|
||||
{
|
||||
LRDP (" culled!\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " culled!");
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
@ -327,9 +328,7 @@ void draw_tri(VERTEX **vtx, uint16_t linew)
|
|||
|
||||
if (v->uv_calculated != rdp.tex_ctr)
|
||||
{
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP(" * CALCULATING VERTEX U/V: %d\n", v->number);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, " * CALCULATING VERTEX U/V: %d", v->number);
|
||||
v->uv_calculated = rdp.tex_ctr;
|
||||
|
||||
if (!(rdp.geom_mode & 0x00020000))
|
||||
|
@ -343,15 +342,11 @@ void draw_tri(VERTEX **vtx, uint16_t linew)
|
|||
v->b = vtx[flag]->b;
|
||||
v->g = vtx[flag]->g;
|
||||
v->r = vtx[flag]->r;
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP(" * Flat shaded, flag%d - r: %d, g: %d, b: %d, a: %d\n", flag, v->r, v->g, v->b, v->a);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, " * Flat shaded, flag%d - r: %d, g: %d, b: %d, a: %d", flag, v->r, v->g, v->b, v->a);
|
||||
}
|
||||
else // prim color
|
||||
{
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP(" * Prim shaded %08lx\n", rdp.prim_color);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, " * Prim shaded %08lx", rdp.prim_color);
|
||||
v->a = (uint8_t)(rdp.prim_color & 0xFF);
|
||||
v->b = (uint8_t)((rdp.prim_color >> 8) & 0xFF);
|
||||
v->g = (uint8_t)((rdp.prim_color >> 16) & 0xFF);
|
||||
|
@ -407,9 +402,7 @@ void draw_tri(VERTEX **vtx, uint16_t linew)
|
|||
v->v0 -= rdp.tiles[rdp.cur_tile].f_ul_t; //required for megaman (boss special attack)
|
||||
v->u0 *= rdp.aTBuffTex[0]->u_scale;
|
||||
v->v0 *= rdp.aTBuffTex[0]->v_scale;
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP("tbuff_tex t0: (%f, %f)->(%f, %f)\n", v->ou, v->ov, v->u0, v->v0);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "tbuff_tex t0: (%f, %f)->(%f, %f)", v->ou, v->ov, v->u0, v->v0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -450,9 +443,7 @@ void draw_tri(VERTEX **vtx, uint16_t linew)
|
|||
v->u1 -= rdp.tiles[rdp.cur_tile].f_ul_s;
|
||||
v->u1 *= rdp.aTBuffTex[1]->u_scale;
|
||||
v->v1 *= rdp.aTBuffTex[1]->v_scale;
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP("tbuff_tex t1: (%f, %f)->(%f, %f)\n", v->ou, v->ov, v->u1, v->v1);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "tbuff_tex t1: (%f, %f)->(%f, %f)", v->ou, v->ov, v->u1, v->v1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -465,11 +456,9 @@ void draw_tri(VERTEX **vtx, uint16_t linew)
|
|||
v->u1_w = v->u1 / v->w;
|
||||
v->v1_w = v->v1 / v->w;
|
||||
}
|
||||
// FRDP(" * CALCULATING VERTEX U/V: %d u0: %f, v0: %f, u1: %f, v1: %f\n", v->number, v->u0, v->v0, v->u1, v->v1);
|
||||
// WriteTrace(TraceRDP, TraceDebug, " * CALCULATING VERTEX U/V: %d u0: %f, v0: %f, u1: %f, v1: %f", v->number, v->u0, v->v0, v->u1, v->v1);
|
||||
}
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP("draw_tri. v[%d] ou=%f, ov = %f\n", i, v->ou, v->ov);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "draw_tri. v[%d] ou=%f, ov = %f", i, v->ou, v->ov);
|
||||
if (v->shade_mod != cmb.shade_mod_hash)
|
||||
apply_shade_mods(v);
|
||||
} //for
|
||||
|
@ -765,9 +754,7 @@ void do_triangle_stuff(uint16_t linew, int old_interpolate) // what else?? do th
|
|||
{
|
||||
if (rdp.vtxbuf[i].not_zclipped)// && rdp.zsrc != 1)
|
||||
{
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP (" * NOT ZCLIPPPED: %d\n", rdp.vtxbuf[i].number);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, " * NOT ZCLIPPPED: %d", rdp.vtxbuf[i].number);
|
||||
rdp.vtxbuf[i].x = rdp.vtxbuf[i].sx;
|
||||
rdp.vtxbuf[i].y = rdp.vtxbuf[i].sy;
|
||||
rdp.vtxbuf[i].z = rdp.vtxbuf[i].sz;
|
||||
|
@ -779,9 +766,7 @@ void do_triangle_stuff(uint16_t linew, int old_interpolate) // what else?? do th
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP (" * ZCLIPPED: %d\n", rdp.vtxbuf[i].number);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, " * ZCLIPPED: %d", rdp.vtxbuf[i].number);
|
||||
rdp.vtxbuf[i].q = 1.0f / rdp.vtxbuf[i].w;
|
||||
rdp.vtxbuf[i].x = rdp.view_trans[0] + rdp.vtxbuf[i].x * rdp.vtxbuf[i].q * rdp.view_scale[0] + rdp.offset_x;
|
||||
rdp.vtxbuf[i].y = rdp.view_trans[1] + rdp.vtxbuf[i].y * rdp.vtxbuf[i].q * rdp.view_scale[1] + rdp.offset_y;
|
||||
|
@ -1028,7 +1013,7 @@ static void CalculateLOD(VERTEX *v, int n)
|
|||
grTexDetailControl(GR_TMU0, cmb.dc0_lodbias, cmb.dc0_detailscale, detailmax);
|
||||
if (voodoo.num_tmu == 2)
|
||||
grTexDetailControl(GR_TMU1, cmb.dc1_lodbias, cmb.dc1_detailscale, detailmax);
|
||||
FRDP("CalculateLOD factor: %f, tile: %d, lod_fraction: %f\n", (float)lodFactor, lod_tile, lod_fraction);
|
||||
WriteTrace(TraceRDP, TraceDebug, "CalculateLOD factor: %f, tile: %d, lod_fraction: %f", (float)lodFactor, lod_tile, lod_fraction);
|
||||
}
|
||||
|
||||
float ScaleZ(float z)
|
||||
|
@ -1075,21 +1060,6 @@ static void DepthBuffer(VERTEX * vtx, int n)
|
|||
vtx[i].z = ScaleZ(vtx[i].z);
|
||||
}
|
||||
|
||||
/*
|
||||
std::ofstream loga;
|
||||
#define LOGG(x) loga.open("glide_log.txt",std::ios::app); loga << x; loga.flush(); loga.close();
|
||||
__inline void FRDP2(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vsprintf(out_buf, fmt, ap);
|
||||
LOGG(out_buf);
|
||||
va_end(ap);
|
||||
}
|
||||
//*/
|
||||
//#define LOGG(x)
|
||||
//#define FRDP2(x)
|
||||
|
||||
void clip_tri(int interpolate_colors)
|
||||
{
|
||||
int i, j, index, n = rdp.n_global;
|
||||
|
@ -1493,7 +1463,7 @@ static void render_tri(uint16_t linew, int old_interpolate)
|
|||
int n = rdp.n_global;
|
||||
if (n < 3)
|
||||
{
|
||||
FRDP(" * render_tri: n < 3\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " * render_tri: n < 3");
|
||||
return;
|
||||
}
|
||||
int i, j;
|
||||
|
@ -1511,7 +1481,7 @@ static void render_tri(uint16_t linew, int old_interpolate)
|
|||
}
|
||||
if (!to_render) //all z < 0
|
||||
{
|
||||
FRDP(" * render_tri: all z < 0\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " * render_tri: all z < 0");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1566,22 +1536,6 @@ static void render_tri(uint16_t linew, int old_interpolate)
|
|||
InterpolateColors2(*v1, *v2, rdp.vtxbuf[i], percent);
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (rdp.clip)
|
||||
{
|
||||
LOGG("Colors before clipping:\n");
|
||||
unsigned int k;
|
||||
for(k=0; k<3; k++)
|
||||
{
|
||||
FRDP2("V%d: r=%d, g=%d, b=%d, a=%d, f=%d\n", k, org_vtx[k]->r, org_vtx[k]->g, org_vtx[k]->b, org_vtx[k]->a, (short)org_vtx[k]->f);
|
||||
}
|
||||
FRDP("Got %d vertex after clipping\n", n);
|
||||
for(k=0; k<n; k++)
|
||||
{
|
||||
FRDP("V%d: r=%d, g=%d, b=%d, a=%d, f=%d\n", k, rdp.vtxbuf[k].r, rdp.vtxbuf[k].g, rdp.vtxbuf[k].b, rdp.vtxbuf[k].a, (short)rdp.vtxbuf[k].f);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
ConvertCoordsConvert(rdp.vtxbuf, n);
|
||||
if (rdp.fog_mode == RDP::fog_enabled)
|
||||
|
@ -1618,7 +1572,7 @@ static void render_tri(uint16_t linew, int old_interpolate)
|
|||
{
|
||||
for (int k = 0; k < 3; k++)
|
||||
{
|
||||
FRDP("v%d %f->%f, width: %d. height: %d, tex_width: %d, tex_height: %d, lr_u: %f, lr_v: %f\n", k, vv0[k], pv[k]->v1, rdp.tbuff_tex->width, rdp.tbuff_tex->height, rdp.tbuff_tex->tex_width, rdp.tbuff_tex->tex_height, rdp.tbuff_tex->lr_u, rdp.tbuff_tex->lr_v);
|
||||
WriteTrace(TraceRDP, TraceDebug, "v%d %f->%f, width: %d. height: %d, tex_width: %d, tex_height: %d, lr_u: %f, lr_v: %f", k, vv0[k], pv[k]->v1, rdp.tbuff_tex->width, rdp.tbuff_tex->height, rdp.tbuff_tex->tex_width, rdp.tbuff_tex->tex_height, rdp.tbuff_tex->lr_u, rdp.tbuff_tex->lr_v);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@ -1636,7 +1590,7 @@ static void render_tri(uint16_t linew, int old_interpolate)
|
|||
{
|
||||
// VERTEX ** pv = rdp.vtx_buffer?(vtx_list2):(vtx_list1);
|
||||
// for (int k = 0; k < n; k ++)
|
||||
// FRDP ("DRAW[%d]: v.x = %f, v.y = %f, v.z = %f, v.u = %f, v.v = %f\n", k, pv[k]->x, pv[k]->y, pv[k]->z, pv[k]->coord[rdp.t0<<1], pv[k]->coord[(rdp.t0<<1)+1]);
|
||||
// WriteTrace(TraceRDP, TraceDebug, "DRAW[%d]: v.x = %f, v.y = %f, v.z = %f, v.u = %f, v.v = %f", k, pv[k]->x, pv[k]->y, pv[k]->z, pv[k]->coord[rdp.t0<<1], pv[k]->coord[(rdp.t0<<1)+1]);
|
||||
// pv[k]->y = g_settings->res_y - pv[k]->y;
|
||||
|
||||
if (linew > 0)
|
||||
|
@ -1704,7 +1658,7 @@ static void render_tri(uint16_t linew, int old_interpolate)
|
|||
|
||||
void add_tri(VERTEX *v, int n, int type)
|
||||
{
|
||||
//FRDP ("ENTER (%f, %f, %f), (%f, %f, %f), (%f, %f, %f)\n", v[0].x, v[0].y, v[0].w,
|
||||
//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
|
||||
|
@ -1792,7 +1746,7 @@ void update_scissor()
|
|||
//Values are inclusive for minimum x and y values and exclusive for maximum x and y values.
|
||||
// grClipWindow (rdp.scissor.ul_x?rdp.scissor.ul_x+1:0, rdp.scissor.ul_y?rdp.scissor.ul_y+1:0, rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
grClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
FRDP(" |- scissor - (%d, %d) -> (%d, %d)\n", rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
WriteTrace(TraceRDP, TraceDebug, " |- scissor - (%d, %d) -> (%d, %d)", rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1814,12 +1768,12 @@ typedef struct
|
|||
|
||||
void update()
|
||||
{
|
||||
LRDP("-+ update called\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "-+ update called");
|
||||
// Check for rendermode changes
|
||||
// Z buffer
|
||||
if (rdp.render_mode_changed & 0x00000C30)
|
||||
{
|
||||
FRDP(" |- render_mode_changed zbuf - decal: %s, update: %s, compare: %s\n",
|
||||
WriteTrace(TraceRDP, TraceDebug, " |- render_mode_changed zbuf - decal: %s, update: %s, compare: %s",
|
||||
str_yn[(rdp.othermode_l & 0x00000400) ? 1 : 0],
|
||||
str_yn[(rdp.othermode_l & 0x00000020) ? 1 : 0],
|
||||
str_yn[(rdp.othermode_l & 0x00000010) ? 1 : 0]);
|
||||
|
@ -1843,7 +1797,7 @@ void update()
|
|||
// Alpha compare
|
||||
if (rdp.render_mode_changed & 0x00001000)
|
||||
{
|
||||
FRDP(" |- render_mode_changed alpha compare - on: %s\n",
|
||||
WriteTrace(TraceRDP, TraceDebug, " |- render_mode_changed alpha compare - on: %s",
|
||||
str_yn[(rdp.othermode_l & 0x00001000) ? 1 : 0]);
|
||||
rdp.render_mode_changed &= ~0x00001000;
|
||||
rdp.update |= UPDATE_ALPHA_COMPARE;
|
||||
|
@ -1856,7 +1810,7 @@ void update()
|
|||
|
||||
if (rdp.render_mode_changed & 0x00002000) // alpha cvg sel
|
||||
{
|
||||
FRDP(" |- render_mode_changed alpha cvg sel - on: %s\n",
|
||||
WriteTrace(TraceRDP, TraceDebug, " |- render_mode_changed alpha cvg sel - on: %s",
|
||||
str_yn[(rdp.othermode_l & 0x00002000) ? 1 : 0]);
|
||||
rdp.render_mode_changed &= ~0x00002000;
|
||||
rdp.update |= UPDATE_COMBINE;
|
||||
|
@ -1866,7 +1820,7 @@ void update()
|
|||
// Force blend
|
||||
if (rdp.render_mode_changed & 0xFFFF0000)
|
||||
{
|
||||
FRDP(" |- render_mode_changed force_blend - %08lx\n", rdp.othermode_l & 0xFFFF0000);
|
||||
WriteTrace(TraceRDP, TraceDebug, " |- render_mode_changed force_blend - %08lx", rdp.othermode_l & 0xFFFF0000);
|
||||
rdp.render_mode_changed &= 0x0000FFFF;
|
||||
|
||||
rdp.fbl_a0 = (uint8_t)((rdp.othermode_l >> 30) & 0x3);
|
||||
|
@ -1892,7 +1846,7 @@ void update()
|
|||
rdp.aTBuffTex[0] = aTBuff[0];
|
||||
rdp.aTBuffTex[1] = aTBuff[1];
|
||||
|
||||
LRDP(" |-+ update_combine\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " |-+ update_combine");
|
||||
Combine();
|
||||
}
|
||||
|
||||
|
@ -1969,7 +1923,7 @@ void update()
|
|||
uint8_t reference = (uint8_t)(rdp.blend_color & 0xFF);
|
||||
grAlphaTestFunction(reference ? GR_CMP_GEQUAL : GR_CMP_GREATER);
|
||||
grAlphaTestReferenceValue(reference);
|
||||
FRDP(" |- alpha compare: blend: %02lx\n", reference);
|
||||
WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: blend: %02lx", reference);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1979,7 +1933,7 @@ void update()
|
|||
{
|
||||
grAlphaTestFunction(GR_CMP_GEQUAL);
|
||||
grAlphaTestReferenceValue(0x20);//0xA0);
|
||||
LRDP(" |- alpha compare: 0x20\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: 0x20");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1987,19 +1941,19 @@ void update()
|
|||
if (rdp.acmp == 3)
|
||||
{
|
||||
grAlphaTestReferenceValue((uint8_t)(rdp.blend_color & 0xFF));
|
||||
FRDP(" |- alpha compare: blend: %02lx\n", rdp.blend_color & 0xFF);
|
||||
WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: blend: %02lx", rdp.blend_color & 0xFF);
|
||||
}
|
||||
else
|
||||
{
|
||||
grAlphaTestReferenceValue(0x00);
|
||||
LRDP(" |- alpha compare: 0x00\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: 0x00");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
grAlphaTestFunction(GR_CMP_ALWAYS);
|
||||
LRDP(" |- alpha compare: none\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: none");
|
||||
}
|
||||
}
|
||||
if (rdp.acmp == 3 && rdp.cycle_mode < 2)
|
||||
|
@ -2007,7 +1961,7 @@ void update()
|
|||
if (grStippleModeExt != 0)
|
||||
{
|
||||
if (g_settings->old_style_adither || rdp.alpha_dither_mode != 3) {
|
||||
LRDP(" |- alpha compare: dither\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: dither");
|
||||
grStippleModeExt(g_settings->stipple_mode);
|
||||
}
|
||||
else
|
||||
|
@ -2018,7 +1972,7 @@ void update()
|
|||
{
|
||||
if (grStippleModeExt)
|
||||
{
|
||||
//LRDP (" |- alpha compare: dither disabled\n");
|
||||
//WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: dither disabled");
|
||||
grStippleModeExt(GR_STIPPLE_DISABLE);
|
||||
}
|
||||
}
|
||||
|
@ -2028,7 +1982,7 @@ void update()
|
|||
{
|
||||
rdp.update ^= UPDATE_CULL_MODE;
|
||||
uint32_t mode = (rdp.flags & CULLMASK) >> CULLSHIFT;
|
||||
FRDP(" |- cull_mode - mode: %s\n", str_cull[mode]);
|
||||
WriteTrace(TraceRDP, TraceDebug, " |- cull_mode - mode: %s", str_cull[mode]);
|
||||
switch (mode)
|
||||
{
|
||||
case 0: // cull none
|
||||
|
@ -2060,11 +2014,11 @@ void update()
|
|||
grFogColorValue(rdp.fog_color);
|
||||
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
|
||||
rdp.fog_mode = RDP::fog_enabled;
|
||||
LRDP("fog enabled \n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "fog enabled ");
|
||||
}
|
||||
else
|
||||
{
|
||||
LRDP("fog disabled in blender\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "fog disabled in blender");
|
||||
rdp.fog_mode = RDP::fog_disabled;
|
||||
grFogMode(GR_FOG_DISABLE);
|
||||
}
|
||||
|
@ -2074,18 +2028,18 @@ void update()
|
|||
grFogColorValue(rdp.fog_color);
|
||||
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
|
||||
rdp.fog_mode = RDP::fog_blend;
|
||||
LRDP("fog blend \n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "fog blend ");
|
||||
}
|
||||
else if (blender == 0x04d1)
|
||||
{
|
||||
grFogColorValue(rdp.fog_color);
|
||||
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
|
||||
rdp.fog_mode = RDP::fog_blend_inverse;
|
||||
LRDP("fog blend \n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "fog blend ");
|
||||
}
|
||||
else
|
||||
{
|
||||
LRDP("fog disabled\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "fog disabled");
|
||||
rdp.fog_mode = RDP::fog_disabled;
|
||||
grFogMode(GR_FOG_DISABLE);
|
||||
}
|
||||
|
@ -2102,7 +2056,7 @@ void update()
|
|||
rdp.clip_max_x = minval((rdp.view_trans[0] + scale_x + rdp.offset_x) * rdp.clip_ratio, g_settings->res_x);
|
||||
rdp.clip_max_y = minval((rdp.view_trans[1] + scale_y + rdp.offset_y) * rdp.clip_ratio, g_settings->res_y);
|
||||
|
||||
FRDP(" |- viewport - (%d, %d, %d, %d)\n", (uint32_t)rdp.clip_min_x, (uint32_t)rdp.clip_min_y, (uint32_t)rdp.clip_max_x, (uint32_t)rdp.clip_max_y);
|
||||
WriteTrace(TraceRDP, TraceDebug, " |- viewport - (%d, %d, %d, %d)", (uint32_t)rdp.clip_min_x, (uint32_t)rdp.clip_min_y, (uint32_t)rdp.clip_max_x, (uint32_t)rdp.clip_max_y);
|
||||
if (!rdp.scissor_set)
|
||||
{
|
||||
rdp.scissor.ul_x = (uint32_t)rdp.clip_min_x;
|
||||
|
@ -2118,7 +2072,7 @@ void update()
|
|||
update_scissor();
|
||||
}
|
||||
|
||||
LRDP(" + update end\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " + update end");
|
||||
}
|
||||
|
||||
void set_message_combiner()
|
||||
|
@ -2166,4 +2120,4 @@ void set_message_combiner()
|
|||
GR_MIPMAPLEVELMASK_BOTH,
|
||||
&fontTex);
|
||||
grFogMode(GR_FOG_DISABLE);
|
||||
}
|
||||
}
|
|
@ -314,7 +314,7 @@ void microcheck()
|
|||
uc_crc += ((uint32_t*)microcode)[i];
|
||||
}
|
||||
|
||||
FRDP_E("crc: %08lx\n", uc_crc);
|
||||
WriteTrace(TraceRDP, TraceWarning, "crc: %08lx", uc_crc);
|
||||
|
||||
#ifdef LOG_UCODE
|
||||
std::ofstream ucf;
|
||||
|
@ -328,7 +328,7 @@ void microcheck()
|
|||
ucf.close();
|
||||
#endif
|
||||
|
||||
FRDP("ucode = %08lx\n", uc_crc);
|
||||
WriteTrace(TraceRDP, TraceDebug, "ucode = %08lx", uc_crc);
|
||||
|
||||
RegisterSetting(Set_ucodeLookup, Data_DWORD_RDB_Setting, stdstr_f("%08lx", uc_crc).c_str(), "ucode", (unsigned int)-2, NULL);
|
||||
int uc = GetSetting(Set_ucodeLookup);
|
||||
|
@ -362,7 +362,7 @@ void microcheck()
|
|||
{
|
||||
old_ucode = g_settings->ucode;
|
||||
g_settings->ucode = uc;
|
||||
FRDP("microcheck: old ucode: %d, new ucode: %d\n", old_ucode, uc);
|
||||
WriteTrace(TraceRDP, TraceDebug, "microcheck: old ucode: %d, new ucode: %d", old_ucode, uc);
|
||||
if (uc_crc == 0x8d5735b2 || uc_crc == 0xb1821ed3 || uc_crc == 0x1118b3e0) //F3DLP.Rej ucode. perspective texture correction is not implemented
|
||||
{
|
||||
rdp.Persp_en = 1;
|
||||
|
@ -421,7 +421,7 @@ static void copyWhiteToRDRAM()
|
|||
|
||||
static void CopyFrameBuffer(GrBuffer_t buffer = GR_BUFFER_BACKBUFFER)
|
||||
{
|
||||
FRDP("CopyFrameBuffer: %08lx... ", rdp.cimg);
|
||||
WriteTrace(TraceRDP, TraceDebug, "CopyFrameBuffer: %08lx... ", rdp.cimg);
|
||||
|
||||
// don't bother to write the stuff in asm... the slow part is the read from video card,
|
||||
// not the copy.
|
||||
|
@ -439,7 +439,7 @@ static void CopyFrameBuffer(GrBuffer_t buffer = GR_BUFFER_BACKBUFFER)
|
|||
if (g_settings->hacks&hack_PPL)
|
||||
height -= rdp.ci_upper_bound;
|
||||
}
|
||||
FRDP("width: %d, height: %d... ", width, height);
|
||||
WriteTrace(TraceRDP, TraceDebug, "width: %d, height: %d... ", width, height);
|
||||
|
||||
if (rdp.scale_x < 1.1f)
|
||||
{
|
||||
|
@ -476,11 +476,11 @@ static void CopyFrameBuffer(GrBuffer_t buffer = GR_BUFFER_BACKBUFFER)
|
|||
ptr_dst32[x + y * width] = RGBA16TO32(c);
|
||||
}
|
||||
}
|
||||
LRDP("ReadRegion. Framebuffer copy complete.\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "ReadRegion. Framebuffer copy complete.");
|
||||
}
|
||||
else
|
||||
{
|
||||
LRDP("Framebuffer copy failed.\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Framebuffer copy failed.");
|
||||
}
|
||||
delete[] ptr_src;
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ static void CopyFrameBuffer(GrBuffer_t buffer = GR_BUFFER_BACKBUFFER)
|
|||
float scale_x = (g_settings->scr_res_x - rdp.offset_x*2.0f) / maxval(width, rdp.vi_width);
|
||||
float scale_y = (g_settings->scr_res_y - rdp.offset_y*2.0f) / maxval(height, rdp.vi_height);
|
||||
|
||||
FRDP("width: %d, height: %d, ul_y: %d, lr_y: %d, scale_x: %f, scale_y: %f, ci_width: %d, ci_height: %d\n", width, height, rdp.ci_upper_bound, rdp.ci_lower_bound, scale_x, scale_y, rdp.ci_width, rdp.ci_height);
|
||||
WriteTrace(TraceRDP, TraceDebug, "width: %d, height: %d, ul_y: %d, lr_y: %d, scale_x: %f, scale_y: %f, ci_width: %d, ci_height: %d", width, height, rdp.ci_upper_bound, rdp.ci_lower_bound, scale_x, scale_y, rdp.ci_width, rdp.ci_height);
|
||||
GrLfbInfo_t info;
|
||||
info.size = sizeof(GrLfbInfo_t);
|
||||
|
||||
|
@ -537,11 +537,11 @@ static void CopyFrameBuffer(GrBuffer_t buffer = GR_BUFFER_BACKBUFFER)
|
|||
|
||||
// Unlock the backbuffer
|
||||
grLfbUnlock(GR_LFB_READ_ONLY, buffer);
|
||||
LRDP("LfbLock. Framebuffer copy complete.\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "LfbLock. Framebuffer copy complete.");
|
||||
}
|
||||
else
|
||||
{
|
||||
LRDP("Framebuffer copy failed.\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Framebuffer copy failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -627,24 +627,6 @@ EXPORT void CALL ProcessDList(void)
|
|||
if (to_fullscreen)
|
||||
GoToFullScreen();
|
||||
|
||||
// Clear out the RDP log
|
||||
#ifdef RDP_LOGGING
|
||||
if (g_settings->logging && g_settings->log_clear)
|
||||
{
|
||||
CLOSE_RDP_LOG();
|
||||
OPEN_RDP_LOG();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef UNIMP_LOG
|
||||
if (g_settings->log_unk && g_settings->unk_clear)
|
||||
{
|
||||
std::ofstream unimp;
|
||||
unimp.open("unimp.txt");
|
||||
unimp.close();
|
||||
}
|
||||
#endif
|
||||
|
||||
//* Set states *//
|
||||
if (g_settings->swapmode > 0)
|
||||
SwapOK = TRUE;
|
||||
|
@ -694,8 +676,7 @@ EXPORT void CALL ProcessDList(void)
|
|||
// Get the start of the display list and the length of it
|
||||
uint32_t dlist_start = *(uint32_t*)(gfx.DMEM + 0xFF0);
|
||||
uint32_t dlist_length = *(uint32_t*)(gfx.DMEM + 0xFF4);
|
||||
FRDP("--- NEW DLIST --- crc: %08lx, ucode: %d, fbuf: %08lx, fbuf_width: %d, dlist start: %08lx, dlist_length: %d, x_scale: %f, y_scale: %f\n", uc_crc, g_settings->ucode, *gfx.VI_ORIGIN_REG, *gfx.VI_WIDTH_REG, dlist_start, dlist_length, (*gfx.VI_X_SCALE_REG & 0xFFF) / 1024.0f, (*gfx.VI_Y_SCALE_REG & 0xFFF) / 1024.0f);
|
||||
FRDP_E("--- NEW DLIST --- crc: %08lx, ucode: %d, fbuf: %08lx\n", uc_crc, g_settings->ucode, *gfx.VI_ORIGIN_REG);
|
||||
WriteTrace(TraceRDP, TraceDebug, "--- NEW DLIST --- crc: %08lx, ucode: %d, fbuf: %08lx, fbuf_width: %d, dlist start: %08lx, dlist_length: %d, x_scale: %f, y_scale: %f", uc_crc, g_settings->ucode, *gfx.VI_ORIGIN_REG, *gfx.VI_WIDTH_REG, dlist_start, dlist_length, (*gfx.VI_X_SCALE_REG & 0xFFF) / 1024.0f, (*gfx.VI_Y_SCALE_REG & 0xFFF) / 1024.0f);
|
||||
|
||||
// Do nothing if dlist is empty
|
||||
if (dlist_start == 0)
|
||||
|
@ -706,7 +687,7 @@ EXPORT void CALL ProcessDList(void)
|
|||
if ((g_settings->hacks&hack_Tonic) && dlist_length < 16)
|
||||
{
|
||||
rdp_fullsync();
|
||||
FRDP_E("DLIST is too short!\n");
|
||||
WriteTrace(TraceRDP, TraceWarning, "DLIST is too short!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -739,9 +720,9 @@ EXPORT void CALL ProcessDList(void)
|
|||
|
||||
// Output the address before the command
|
||||
#ifdef LOG_COMMANDS
|
||||
FRDP("%08lx (c0:%08lx, c1:%08lx): ", a, rdp.cmd0, rdp.cmd1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "%08lx (c0:%08lx, c1:%08lx): ", a, rdp.cmd0, rdp.cmd1);
|
||||
#else
|
||||
FRDP("%08lx: ", a);
|
||||
WriteTrace(TraceRDP, TraceDebug, "%08lx: ", a);
|
||||
#endif
|
||||
|
||||
// Go to the next instruction
|
||||
|
@ -761,14 +742,14 @@ EXPORT void CALL ProcessDList(void)
|
|||
{
|
||||
rdp.dl_count = -1;
|
||||
|
||||
LRDP("End of DL\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "End of DL");
|
||||
rdp.pc_i--;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PERFORMANCE
|
||||
perf_next = wxDateTime::UNow();
|
||||
sprintf(out_buf, "perf %08lx: %016I64d\n", a - 8, (perf_next - perf_cur).Format(_T("%l")).mb_str());
|
||||
sprintf(out_buf, "perf %08lx: %016I64d", a - 8, (perf_next - perf_cur).Format(_T("%l")).mb_str());
|
||||
rdp_log << out_buf;
|
||||
#endif
|
||||
} while (!rdp.halt);
|
||||
|
@ -819,14 +800,13 @@ EXPORT void CALL ProcessDList(void)
|
|||
newSwapBuffers();
|
||||
CI_SET = FALSE;
|
||||
}
|
||||
LRDP("ProcessDList end\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "ProcessDList end");
|
||||
}
|
||||
|
||||
// undef - undefined instruction, always ignore
|
||||
static void undef()
|
||||
{
|
||||
FRDP_E("** undefined ** (%08lx)\n", rdp.cmd0);
|
||||
FRDP("** undefined ** (%08lx) - IGNORED\n", rdp.cmd0);
|
||||
WriteTrace(TraceRDP, TraceWarning, "** undefined ** (%08lx) - IGNORED", rdp.cmd0);
|
||||
#ifdef _ENDUSER_RELEASE_
|
||||
*gfx.MI_INTR_REG |= 0x20;
|
||||
gfx.CheckInterrupts();
|
||||
|
@ -837,13 +817,13 @@ static void undef()
|
|||
// spnoop - no operation, always ignore
|
||||
static void spnoop()
|
||||
{
|
||||
LRDP("spnoop\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "spnoop");
|
||||
}
|
||||
|
||||
// noop - no operation, always ignore
|
||||
static void rdp_noop()
|
||||
{
|
||||
LRDP("noop\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "noop");
|
||||
}
|
||||
|
||||
static void ys_memrect()
|
||||
|
@ -860,12 +840,11 @@ static void ys_memrect()
|
|||
uint32_t off_x = ((rdp.cmd2 & 0xFFFF0000) >> 16) >> 5;
|
||||
uint32_t off_y = (rdp.cmd2 & 0x0000FFFF) >> 5;
|
||||
|
||||
FRDP("memrect (%d, %d, %d, %d), ci_width: %d", ul_x, ul_y, lr_x, lr_y, rdp.ci_width);
|
||||
WriteTrace(TraceRDP, TraceDebug, "memrect (%d, %d, %d, %d), ci_width: %d", ul_x, ul_y, lr_x, lr_y, rdp.ci_width);
|
||||
if (off_x > 0)
|
||||
FRDP(" off_x: %d", off_x);
|
||||
WriteTrace(TraceRDP, TraceDebug, " off_x: %d", off_x);
|
||||
if (off_y > 0)
|
||||
FRDP(" off_y: %d", off_y);
|
||||
LRDP("\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, " off_y: %d", off_y);
|
||||
|
||||
uint32_t y, width = lr_x - ul_x;
|
||||
uint32_t tex_width = rdp.tiles[tile].line << 3;
|
||||
|
@ -894,7 +873,7 @@ static void pm_palette_mod()
|
|||
{
|
||||
dst[i ^ 1] = (rdp.pal_8[i] & 1) ? prim16 : env16;
|
||||
}
|
||||
LRDP("Texrect palette modification\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Texrect palette modification");
|
||||
}
|
||||
|
||||
static void pd_zcopy()
|
||||
|
@ -911,7 +890,7 @@ static void pd_zcopy()
|
|||
c = ptr_src[x];
|
||||
c = ((c << 8) & 0xFF00) | (c >> 8);
|
||||
ptr_dst[(ul_x + x) ^ 1] = c;
|
||||
// FRDP("dst[%d]=%04lx \n", (x + ul_x)^1, c);
|
||||
// WriteTrace(TraceRDP, TraceDebug, "dst[%d]=%04lx ", (x + ul_x)^1, c);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -972,15 +951,15 @@ static void rdp_texrect()
|
|||
}
|
||||
else
|
||||
{
|
||||
LRDP("Texrect skipped\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Texrect skipped");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ((g_settings->ucode == ucode_CBFD) && rdp.cur_image && rdp.cur_image->format)
|
||||
{
|
||||
//FRDP("Wrong Texrect. texaddr: %08lx, cimg: %08lx, cimg_end: %08lx\n", rdp.timg.addr, rdp.maincimg[1].addr, rdp.maincimg[1].addr+rdp.ci_width*rdp.ci_height*rdp.ci_size);
|
||||
LRDP("Shadow texrect is skipped.\n");
|
||||
//WriteTrace(TraceRDP, TraceDebug, "Wrong Texrect. texaddr: %08lx, cimg: %08lx, cimg_end: %08lx", rdp.timg.addr, rdp.maincimg[1].addr, rdp.maincimg[1].addr+rdp.ci_width*rdp.ci_height*rdp.ci_size);
|
||||
WriteTrace(TraceRDP, TraceDebug, "Shadow texrect is skipped.");
|
||||
rdp.tri_n += 2;
|
||||
return;
|
||||
}
|
||||
|
@ -988,7 +967,7 @@ static void rdp_texrect()
|
|||
if ((g_settings->ucode == ucode_PerfectDark) && rdp.ci_count > 0 && (rdp.frame_buffers[rdp.ci_count - 1].status == ci_zcopy))
|
||||
{
|
||||
pd_zcopy();
|
||||
LRDP("Depth buffer copied.\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Depth buffer copied.");
|
||||
rdp.tri_n += 2;
|
||||
return;
|
||||
}
|
||||
|
@ -1003,7 +982,7 @@ static void rdp_texrect()
|
|||
return;
|
||||
}
|
||||
|
||||
// FRDP ("rdp.cycle1 %08lx, rdp.cycle2 %08lx\n", rdp.cycle1, rdp.cycle2);
|
||||
// WriteTrace(TraceRDP, TraceDebug, "rdp.cycle1 %08lx, rdp.cycle2 %08lx", rdp.cycle1, rdp.cycle2);
|
||||
|
||||
float ul_x, ul_y, lr_x, lr_y;
|
||||
if (rdp.cycle_mode == 2)
|
||||
|
@ -1023,7 +1002,7 @@ static void rdp_texrect()
|
|||
|
||||
if (ul_x >= lr_x)
|
||||
{
|
||||
FRDP("Wrong Texrect: ul_x: %f, lr_x: %f\n", ul_x, lr_x);
|
||||
WriteTrace(TraceRDP, TraceDebug, "Wrong Texrect: ul_x: %f, lr_x: %f", ul_x, lr_x);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1046,7 +1025,7 @@ static void rdp_texrect()
|
|||
//*
|
||||
if (rdp.tbuff_tex && (g_settings->frame_buffer & fb_optimize_texrect))
|
||||
{
|
||||
LRDP("Attempt to optimize texrect\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Attempt to optimize texrect");
|
||||
if (!rdp.tbuff_tex->drawn)
|
||||
{
|
||||
DRAWIMAGE d;
|
||||
|
@ -1059,7 +1038,7 @@ static void rdp_texrect()
|
|||
d.imageH = (uint16_t)rdp.tbuff_tex->height;
|
||||
d.frameY = (uint16_t)ul_y;
|
||||
d.frameH = (uint16_t)(rdp.tbuff_tex->height);
|
||||
FRDP("texrect. ul_x: %d, ul_y: %d, lr_x: %d, lr_y: %d, width: %d, height: %d\n", ul_x, ul_y, lr_x, lr_y, rdp.tbuff_tex->width, rdp.tbuff_tex->height);
|
||||
WriteTrace(TraceRDP, TraceDebug, "texrect. ul_x: %d, ul_y: %d, lr_x: %d, lr_y: %d, width: %d, height: %d", ul_x, ul_y, lr_x, lr_y, rdp.tbuff_tex->width, rdp.tbuff_tex->height);
|
||||
d.scaleX = 1.0f;
|
||||
d.scaleY = 1.0f;
|
||||
DrawHiresImage(d, rdp.tbuff_tex->width == rdp.ci_width);
|
||||
|
@ -1076,7 +1055,7 @@ static void rdp_texrect()
|
|||
//hack for Zelda MM. it removes black texrects which cover all geometry in "Link meets Zelda" cut scene
|
||||
if ((g_settings->hacks&hack_Zelda) && rdp.timg.addr >= rdp.cimg && rdp.timg.addr < rdp.ci_end)
|
||||
{
|
||||
FRDP("Wrong Texrect. texaddr: %08lx, cimg: %08lx, cimg_end: %08lx\n", rdp.cur_cache[0]->addr, rdp.cimg, rdp.cimg + rdp.ci_width*rdp.ci_height * 2);
|
||||
WriteTrace(TraceRDP, TraceDebug, "Wrong Texrect. texaddr: %08lx, cimg: %08lx, cimg_end: %08lx", rdp.cur_cache[0]->addr, rdp.cimg, rdp.cimg + rdp.ci_width*rdp.ci_height * 2);
|
||||
rdp.tri_n += 2;
|
||||
return;
|
||||
}
|
||||
|
@ -1095,8 +1074,8 @@ static void rdp_texrect()
|
|||
if (fb_emulation_enabled)
|
||||
if (rdp.ci_count > 0 && rdp.frame_buffers[rdp.ci_count - 1].status == ci_copy_self)
|
||||
{
|
||||
//FRDP("Wrong Texrect. texaddr: %08lx, cimg: %08lx, cimg_end: %08lx\n", rdp.timg.addr, rdp.maincimg[1], rdp.maincimg[1]+rdp.ci_width*rdp.ci_height*rdp.ci_size);
|
||||
LRDP("Wrong Texrect.\n");
|
||||
//WriteTrace(TraceRDP, TraceDebug, "Wrong Texrect. texaddr: %08lx, cimg: %08lx, cimg_end: %08lx", rdp.timg.addr, rdp.maincimg[1], rdp.maincimg[1]+rdp.ci_width*rdp.ci_height*rdp.ci_size);
|
||||
WriteTrace(TraceRDP, TraceDebug, "Wrong Texrect.");
|
||||
rdp.tri_n += 2;
|
||||
return;
|
||||
}
|
||||
|
@ -1145,9 +1124,9 @@ static void rdp_texrect()
|
|||
float s_ul_y = ul_y * rdp.scale_y + rdp.offset_y;
|
||||
float s_lr_y = lr_y * rdp.scale_y + rdp.offset_y;
|
||||
|
||||
FRDP("texrect (%.2f, %.2f, %.2f, %.2f), tile: %d, #%d, #%d\n", ul_x, ul_y, lr_x, lr_y, tile, rdp.tri_n, rdp.tri_n + 1);
|
||||
FRDP("(%f, %f) -> (%f, %f), s: (%d, %d) -> (%d, %d)\n", s_ul_x, s_ul_y, s_lr_x, s_lr_y, rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
FRDP("\toff_x: %f, off_y: %f, dsdx: %f, dtdy: %f\n", off_x_i / 32.0f, off_y_i / 32.0f, dsdx, dtdy);
|
||||
WriteTrace(TraceRDP, TraceDebug, "texrect (%.2f, %.2f, %.2f, %.2f), tile: %d, #%d, #%d", ul_x, ul_y, lr_x, lr_y, tile, rdp.tri_n, rdp.tri_n + 1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "(%f, %f) -> (%f, %f), s: (%d, %d) -> (%d, %d)", s_ul_x, s_ul_y, s_lr_x, s_lr_y, rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
WriteTrace(TraceRDP, TraceDebug, "\toff_x: %f, off_y: %f, dsdx: %f, dtdy: %f", off_x_i / 32.0f, off_y_i / 32.0f, dsdx, dtdy);
|
||||
|
||||
float off_size_x;
|
||||
float off_size_y;
|
||||
|
@ -1255,7 +1234,7 @@ static void rdp_texrect()
|
|||
texUV[i].ul_v *= rdp.aTBuffTex[i]->v_scale;
|
||||
texUV[i].lr_u *= rdp.aTBuffTex[i]->u_scale;
|
||||
texUV[i].lr_v *= rdp.aTBuffTex[i]->v_scale;
|
||||
FRDP("tbuff_tex[%d] ul_u: %f, ul_v: %f, lr_u: %f, lr_v: %f\n",
|
||||
WriteTrace(TraceRDP, TraceDebug, "tbuff_tex[%d] ul_u: %f, ul_v: %f, lr_u: %f, lr_v: %f",
|
||||
i, texUV[i].ul_u, texUV[i].ul_v, texUV[i].lr_u, texUV[i].lr_v);
|
||||
}
|
||||
else //common case
|
||||
|
@ -1285,12 +1264,12 @@ static void rdp_texrect()
|
|||
|
||||
// ****
|
||||
|
||||
FRDP(" scissor: (%d, %d) -> (%d, %d)\n", rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
WriteTrace(TraceRDP, TraceDebug, " scissor: (%d, %d) -> (%d, %d)", rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
|
||||
CCLIP2(s_ul_x, s_lr_x, texUV[0].ul_u, texUV[0].lr_u, texUV[1].ul_u, texUV[1].lr_u, (float)rdp.scissor.ul_x, (float)rdp.scissor.lr_x);
|
||||
CCLIP2(s_ul_y, s_lr_y, texUV[0].ul_v, texUV[0].lr_v, texUV[1].ul_v, texUV[1].lr_v, (float)rdp.scissor.ul_y, (float)rdp.scissor.lr_y);
|
||||
|
||||
FRDP(" draw at: (%f, %f) -> (%f, %f)\n", s_ul_x, s_ul_y, s_lr_x, s_lr_y);
|
||||
WriteTrace(TraceRDP, TraceDebug, " draw at: (%f, %f) -> (%f, %f)", s_ul_x, s_ul_y, s_lr_x, s_lr_y);
|
||||
|
||||
VERTEX vstd[4] = {
|
||||
{ s_ul_x, s_ul_y, Z, 1.0f, texUV[0].ul_u, texUV[0].ul_v, texUV[1].ul_u, texUV[1].ul_v, { 0, 0, 0, 0 }, 255 },
|
||||
|
@ -1316,7 +1295,7 @@ static void rdp_texrect()
|
|||
|
||||
VERTEX *vnew = 0;
|
||||
// for (int j =0; j < 4; j++)
|
||||
// FRDP("v[%d] u0: %f, v0: %f, u1: %f, v1: %f\n", j, vstd[j].u0, vstd[j].v0, vstd[j].u1, vstd[j].v1);
|
||||
// WriteTrace(TraceRDP, TraceDebug, "v[%d] u0: %f, v0: %f, u1: %f, v1: %f", j, vstd[j].u0, vstd[j].v0, vstd[j].u1, vstd[j].v1);
|
||||
|
||||
if (!rdp.aTBuffTex[0] && rdp.cur_cache[0]->splits != 1)
|
||||
{
|
||||
|
@ -1341,7 +1320,7 @@ static void rdp_texrect()
|
|||
int start_u_256, end_u_256;
|
||||
start_u_256 = (int)min_u >> 8;
|
||||
end_u_256 = (int)max_u >> 8;
|
||||
//FRDP(" min_u: %f, max_u: %f start: %d, end: %d\n", min_u, max_u, start_u_256, end_u_256);
|
||||
//WriteTrace(TraceRDP, TraceDebug, " min_u: %f, max_u: %f start: %d, end: %d", min_u, max_u, start_u_256, end_u_256);
|
||||
|
||||
int splitheight = rdp.cur_cache[0]->splitheight;
|
||||
|
||||
|
@ -1481,17 +1460,17 @@ static void rdp_texrect()
|
|||
|
||||
static void rdp_loadsync()
|
||||
{
|
||||
LRDP("loadsync - ignored\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "loadsync - ignored");
|
||||
}
|
||||
|
||||
static void rdp_pipesync()
|
||||
{
|
||||
LRDP("pipesync - ignored\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "pipesync - ignored");
|
||||
}
|
||||
|
||||
static void rdp_tilesync()
|
||||
{
|
||||
LRDP("tilesync - ignored\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "tilesync - ignored");
|
||||
}
|
||||
|
||||
static void rdp_fullsync()
|
||||
|
@ -1499,7 +1478,7 @@ static void rdp_fullsync()
|
|||
// Set an interrupt to allow the game to continue
|
||||
*gfx.MI_INTR_REG |= 0x20;
|
||||
gfx.CheckInterrupts();
|
||||
LRDP("fullsync\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "fullsync");
|
||||
}
|
||||
|
||||
static void rdp_setkeygb()
|
||||
|
@ -1510,7 +1489,7 @@ static void rdp_setkeygb()
|
|||
uint32_t cG = (rdp.cmd1 >> 24) & 0xFF;
|
||||
rdp.SCALE = (rdp.SCALE & 0xFF0000FF) | (sG << 16) | (sB << 8);
|
||||
rdp.CENTER = (rdp.CENTER & 0xFF0000FF) | (cG << 16) | (cB << 8);
|
||||
FRDP("setkeygb. cG=%02lx, sG=%02lx, cB=%02lx, sB=%02lx\n", cG, sG, cB, sB);
|
||||
WriteTrace(TraceRDP, TraceDebug, "setkeygb. cG=%02lx, sG=%02lx, cB=%02lx, sB=%02lx", cG, sG, cB, sB);
|
||||
}
|
||||
|
||||
static void rdp_setkeyr()
|
||||
|
@ -1519,7 +1498,7 @@ static void rdp_setkeyr()
|
|||
uint32_t cR = (rdp.cmd1 >> 8) & 0xFF;
|
||||
rdp.SCALE = (rdp.SCALE & 0x00FFFFFF) | (sR << 24);
|
||||
rdp.CENTER = (rdp.CENTER & 0x00FFFFFF) | (cR << 24);
|
||||
FRDP("setkeyr. cR=%02lx, sR=%02lx\n", cR, sR);
|
||||
WriteTrace(TraceRDP, TraceDebug, "setkeyr. cR=%02lx, sR=%02lx", cR, sR);
|
||||
}
|
||||
|
||||
static void rdp_setconvert()
|
||||
|
@ -1533,8 +1512,7 @@ static void rdp_setconvert()
|
|||
*/
|
||||
rdp.K4 = (uint8_t)(rdp.cmd1 >> 9) & 0x1FF;
|
||||
rdp.K5 = (uint8_t)(rdp.cmd1 & 0x1FF);
|
||||
// RDP_E("setconvert - IGNORED\n");
|
||||
FRDP("setconvert. K4=%02lx K5=%02lx\n", rdp.K4, rdp.K5);
|
||||
WriteTrace(TraceRDP, TraceDebug, "setconvert. K4=%02lx K5=%02lx", rdp.K4, rdp.K5);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1553,7 +1531,7 @@ static void rdp_setscissor()
|
|||
rdp.ci_lower_bound = rdp.scissor_o.lr_y;
|
||||
rdp.scissor_set = TRUE;
|
||||
|
||||
FRDP("setscissor: (%d,%d) -> (%d,%d)\n", rdp.scissor_o.ul_x, rdp.scissor_o.ul_y,
|
||||
WriteTrace(TraceRDP, TraceDebug, "setscissor: (%d,%d) -> (%d,%d)", rdp.scissor_o.ul_x, rdp.scissor_o.ul_y,
|
||||
rdp.scissor_o.lr_x, rdp.scissor_o.lr_y);
|
||||
|
||||
rdp.update |= UPDATE_SCISSOR;
|
||||
|
@ -1573,7 +1551,7 @@ static void rdp_setprimdepth()
|
|||
rdp.prim_depth = (uint16_t)((rdp.cmd1 >> 16) & 0x7FFF);
|
||||
rdp.prim_dz = (uint16_t)(rdp.cmd1 & 0x7FFF);
|
||||
|
||||
FRDP("setprimdepth: %d\n", rdp.prim_depth);
|
||||
WriteTrace(TraceRDP, TraceDebug, "setprimdepth: %d", rdp.prim_depth);
|
||||
}
|
||||
|
||||
static void rdp_setothermode()
|
||||
|
@ -1589,7 +1567,7 @@ static void rdp_setothermode()
|
|||
gfx_instruction[g_settings->ucode][cmd] (); \
|
||||
}
|
||||
|
||||
LRDP("rdp_setothermode\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp_setothermode");
|
||||
|
||||
if ((g_settings->ucode == ucode_F3DEX2) || (g_settings->ucode == ucode_CBFD))
|
||||
{
|
||||
|
@ -1607,7 +1585,7 @@ static void rdp_setothermode()
|
|||
|
||||
void load_palette(uint32_t addr, uint16_t start, uint16_t count)
|
||||
{
|
||||
LRDP("Loading palette... ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Loading palette... ");
|
||||
uint16_t *dpal = rdp.pal_8 + start;
|
||||
uint16_t end = start + count;
|
||||
#ifdef TEXTURE_FILTER
|
||||
|
@ -1619,13 +1597,13 @@ void load_palette(uint32_t addr, uint16_t start, uint16_t count)
|
|||
*(dpal++) = *(uint16_t *)(gfx.RDRAM + (addr ^ 2));
|
||||
addr += 2;
|
||||
|
||||
#ifdef TLUT_LOGGING
|
||||
FRDP("%d: %08lx\n", i, *(uint16_t *)(gfx.RDRAM + (addr ^ 2)));
|
||||
#endif
|
||||
WriteTrace(TraceTLUT, TraceDebug, "%d: %08lx", i, *(uint16_t *)(gfx.RDRAM + (addr ^ 2)));
|
||||
}
|
||||
#ifdef TEXTURE_FILTER
|
||||
if (g_settings->ghq_hirs)
|
||||
{
|
||||
memcpy((uint8_t*)(rdp.pal_8_rice + start), spal, count << 1);
|
||||
}
|
||||
#endif
|
||||
start >>= 4;
|
||||
end = start + (count >> 4);
|
||||
|
@ -1636,7 +1614,7 @@ void load_palette(uint32_t addr, uint16_t start, uint16_t count)
|
|||
rdp.pal_8_crc[p] = CRC32(0xFFFFFFFF, &rdp.pal_8[(p << 4)], 32);
|
||||
}
|
||||
rdp.pal_256_crc = CRC32(0xFFFFFFFF, rdp.pal_8_crc, 64);
|
||||
LRDP("Done.\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Done.");
|
||||
}
|
||||
|
||||
static void rdp_loadtlut()
|
||||
|
@ -1651,7 +1629,7 @@ static void rdp_loadtlut()
|
|||
|
||||
if (start + count > 256) count = 256 - start;
|
||||
|
||||
FRDP("loadtlut: tile: %d, start: %d, count: %d, from: %08lx\n", tile, start, count,
|
||||
WriteTrace(TraceRDP, TraceDebug, "loadtlut: tile: %d, start: %d, count: %d, from: %08lx", tile, start, count,
|
||||
rdp.timg.addr);
|
||||
|
||||
load_palette(rdp.timg.addr, start, count);
|
||||
|
@ -1730,22 +1708,22 @@ static void rdp_settilesize()
|
|||
|
||||
rdp.first = 1;
|
||||
|
||||
FRDP("settilesize: tile: %d, ul_s: %d, ul_t: %d, lr_s: %d, lr_t: %d, f_ul_s: %f, f_ul_t: %f\n",
|
||||
WriteTrace(TraceRDP, TraceDebug, "settilesize: tile: %d, ul_s: %d, ul_t: %d, lr_s: %d, lr_t: %d, f_ul_s: %f, f_ul_t: %f",
|
||||
tile, ul_s, ul_t, lr_s, lr_t, rdp.tiles[tile].f_ul_s, rdp.tiles[tile].f_ul_t);
|
||||
}
|
||||
|
||||
void setTBufTex(uint16_t t_mem, uint32_t cnt)
|
||||
{
|
||||
FRDP("setTBufTex t_mem=%d, cnt=%d\n", t_mem, cnt);
|
||||
WriteTrace(TraceRDP, TraceDebug, "setTBufTex t_mem=%d, cnt=%d", t_mem, cnt);
|
||||
TBUFF_COLOR_IMAGE * pTbufTex = rdp.tbuff_tex;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
LRDP("Before: ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Before: ");
|
||||
if (rdp.aTBuffTex[i]) {
|
||||
FRDP("rdp.aTBuffTex[%d]: tmu=%d t_mem=%d tile=%d\n", i, rdp.aTBuffTex[i]->tmu, rdp.aTBuffTex[i]->t_mem, rdp.aTBuffTex[i]->tile);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.aTBuffTex[%d]: tmu=%d t_mem=%d tile=%d", i, rdp.aTBuffTex[i]->tmu, rdp.aTBuffTex[i]->t_mem, rdp.aTBuffTex[i]->tile);
|
||||
}
|
||||
else {
|
||||
FRDP("rdp.aTBuffTex[%d]=0\n", i);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.aTBuffTex[%d]=0", i);
|
||||
}
|
||||
if ((rdp.aTBuffTex[i] == 0 && rdp.aTBuffTex[i ^ 1] != pTbufTex) || (rdp.aTBuffTex[i] && rdp.aTBuffTex[i]->t_mem >= t_mem && rdp.aTBuffTex[i]->t_mem < t_mem + cnt))
|
||||
{
|
||||
|
@ -1754,12 +1732,12 @@ void setTBufTex(uint16_t t_mem, uint32_t cnt)
|
|||
rdp.aTBuffTex[i] = pTbufTex;
|
||||
rdp.aTBuffTex[i]->t_mem = t_mem;
|
||||
pTbufTex = 0;
|
||||
FRDP("rdp.aTBuffTex[%d] tmu=%d t_mem=%d\n", i, rdp.aTBuffTex[i]->tmu, rdp.aTBuffTex[i]->t_mem);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.aTBuffTex[%d] tmu=%d t_mem=%d", i, rdp.aTBuffTex[i]->tmu, rdp.aTBuffTex[i]->t_mem);
|
||||
}
|
||||
else
|
||||
{
|
||||
rdp.aTBuffTex[i] = 0;
|
||||
FRDP("rdp.aTBuffTex[%d]=0\n", i);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.aTBuffTex[%d]=0", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1890,7 +1868,7 @@ static void rdp_loadblock()
|
|||
{
|
||||
if (rdp.skip_drawing)
|
||||
{
|
||||
LRDP("loadblock skipped\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "loadblock skipped");
|
||||
return;
|
||||
}
|
||||
uint32_t tile = (uint32_t)((rdp.cmd1 >> 24) & 0x07);
|
||||
|
@ -1970,7 +1948,7 @@ static void rdp_loadblock()
|
|||
|
||||
rdp.update |= UPDATE_TEXTURE;
|
||||
|
||||
FRDP("loadblock: tile: %d, ul_s: %d, ul_t: %d, lr_s: %d, dxt: %08lx -> %08lx\n",
|
||||
WriteTrace(TraceRDP, TraceDebug, "loadblock: tile: %d, ul_s: %d, ul_t: %d, lr_s: %d, dxt: %08lx -> %08lx",
|
||||
tile, ul_s, ul_t, lr_s,
|
||||
dxt, _dxt);
|
||||
|
||||
|
@ -2107,7 +2085,7 @@ static void rdp_loadtile()
|
|||
{
|
||||
if (rdp.skip_drawing)
|
||||
{
|
||||
LRDP("loadtile skipped\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "loadtile skipped");
|
||||
return;
|
||||
}
|
||||
rdp.timg.set_by = 1; // load tile
|
||||
|
@ -2138,7 +2116,7 @@ static void rdp_loadtile()
|
|||
|
||||
if (rdp.tbuff_tex)// && (rdp.tiles[tile].format == 0))
|
||||
{
|
||||
FRDP("loadtile: tbuff_tex ul_s: %d, ul_t:%d\n", ul_s, ul_t);
|
||||
WriteTrace(TraceRDP, TraceDebug, "loadtile: tbuff_tex ul_s: %d, ul_t:%d", ul_s, ul_t);
|
||||
rdp.tbuff_tex->tile_uls = ul_s;
|
||||
rdp.tbuff_tex->tile_ult = ul_t;
|
||||
}
|
||||
|
@ -2194,7 +2172,7 @@ static void rdp_loadtile()
|
|||
unsigned char *end = ((unsigned char *)rdp.tmem) + 4096 - (wid_64 << 3);
|
||||
loadTile((uint32_t *)gfx.RDRAM, (uint32_t *)dst, wid_64, height, line_n, offs, (uint32_t *)end);
|
||||
}
|
||||
FRDP("loadtile: tile: %d, ul_s: %d, ul_t: %d, lr_s: %d, lr_t: %d\n", tile,
|
||||
WriteTrace(TraceRDP, TraceDebug, "loadtile: tile: %d, ul_s: %d, ul_t: %d, lr_s: %d, lr_t: %d", tile,
|
||||
ul_s, ul_t, lr_s, lr_t);
|
||||
|
||||
if (fb_hwfbe_enabled)
|
||||
|
@ -2226,9 +2204,9 @@ static void rdp_settile()
|
|||
|
||||
rdp.update |= UPDATE_TEXTURE;
|
||||
|
||||
FRDP("settile: tile: %d, format: %s, size: %s, line: %d, "
|
||||
WriteTrace(TraceRDP, TraceDebug, "settile: tile: %d, format: %s, size: %s, line: %d, "
|
||||
"t_mem: %08lx, palette: %d, clamp_t/mirror_t: %s, mask_t: %d, "
|
||||
"shift_t: %d, clamp_s/mirror_s: %s, mask_s: %d, shift_s: %d\n",
|
||||
"shift_t: %d, clamp_s/mirror_s: %s, mask_s: %d, shift_s: %d",
|
||||
rdp.last_tile, str_format[tile->format], str_size[tile->size], tile->line,
|
||||
tile->t_mem, tile->palette, str_cm[(tile->clamp_t << 1) | tile->mirror_t], tile->mask_t,
|
||||
tile->shift_t, str_cm[(tile->clamp_s << 1) | tile->mirror_s], tile->mask_s, tile->shift_s);
|
||||
|
@ -2245,7 +2223,7 @@ static void rdp_settile()
|
|||
{
|
||||
rdp.aTBuffTex[i]->tile = rdp.last_tile;
|
||||
rdp.aTBuffTex[i]->info.format = tile->format == 0 ? GR_TEXFMT_RGB_565 : GR_TEXFMT_ALPHA_INTENSITY_88;
|
||||
FRDP("rdp.aTBuffTex[%d] tile=%d, format=%s\n", i, rdp.last_tile, tile->format == 0 ? "RGB565" : "Alpha88");
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.aTBuffTex[%d] tile=%d, format=%s", i, rdp.last_tile, tile->format == 0 ? "RGB565" : "Alpha88");
|
||||
}
|
||||
else
|
||||
rdp.aTBuffTex[i] = 0;
|
||||
|
@ -2270,13 +2248,13 @@ static void rdp_fillrect()
|
|||
uint32_t lr_y = ((rdp.cmd0 & 0x00000FFF) >> 2) + 1;
|
||||
if ((ul_x > lr_x) || (ul_y > lr_y))
|
||||
{
|
||||
LRDP("Fillrect. Wrong coordinates. Skipped\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Fillrect. Wrong coordinates. Skipped");
|
||||
return;
|
||||
}
|
||||
int pd_multiplayer = (g_settings->ucode == ucode_PerfectDark) && (rdp.cycle_mode == 3) && (rdp.fill_color == 0xFFFCFFFC);
|
||||
if ((rdp.cimg == rdp.zimg) || (fb_emulation_enabled && rdp.ci_count > 0 && rdp.frame_buffers[rdp.ci_count - 1].status == ci_zimg) || pd_multiplayer)
|
||||
{
|
||||
LRDP("Fillrect - cleared the depth buffer\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Fillrect - cleared the depth buffer");
|
||||
if (!(g_settings->hacks&hack_Hyperbike) || rdp.ci_width > 64) //do not clear main depth buffer for aux depth buffers
|
||||
{
|
||||
update_scissor();
|
||||
|
@ -2311,7 +2289,7 @@ static void rdp_fillrect()
|
|||
|
||||
if (rdp.skip_drawing)
|
||||
{
|
||||
LRDP("Fillrect skipped\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Fillrect skipped");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2329,7 +2307,7 @@ static void rdp_fillrect()
|
|||
grBufferClear(color, 0, 0xFFFF);
|
||||
grDepthMask(FXTRUE);
|
||||
rdp.update |= UPDATE_ZBUF_ENABLED;
|
||||
LRDP("Fillrect - cleared the texture buffer\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Fillrect - cleared the texture buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2340,10 +2318,10 @@ static void rdp_fillrect()
|
|||
{
|
||||
lr_x--; lr_y--;
|
||||
}
|
||||
FRDP("fillrect (%d,%d) -> (%d,%d), cycle mode: %d, #%d, #%d\n", ul_x, ul_y, lr_x, lr_y, rdp.cycle_mode,
|
||||
WriteTrace(TraceRDP, TraceDebug, "fillrect (%d,%d) -> (%d,%d), cycle mode: %d, #%d, #%d", ul_x, ul_y, lr_x, lr_y, rdp.cycle_mode,
|
||||
rdp.tri_n, rdp.tri_n + 1);
|
||||
|
||||
FRDP("scissor (%d,%d) -> (%d,%d)\n", rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x,
|
||||
WriteTrace(TraceRDP, TraceDebug, "scissor (%d,%d) -> (%d,%d)", rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x,
|
||||
rdp.scissor.lr_y);
|
||||
|
||||
// KILL the floating point error with 0.01f
|
||||
|
@ -2357,7 +2335,7 @@ static void rdp_fillrect()
|
|||
if ((uint32_t)s_ul_x > g_settings->res_x) s_ul_x = g_settings->res_x;
|
||||
if ((uint32_t)s_ul_y > g_settings->res_y) s_ul_y = g_settings->res_y;
|
||||
|
||||
FRDP(" - %d, %d, %d, %d\n", s_ul_x, s_ul_y, s_lr_x, s_lr_y);
|
||||
WriteTrace(TraceRDP, TraceDebug, " - %d, %d, %d, %d", s_ul_x, s_ul_y, s_lr_x, s_lr_y);
|
||||
|
||||
grFogMode(GR_FOG_DISABLE);
|
||||
|
||||
|
@ -2485,7 +2463,7 @@ static void rdp_setfillcolor()
|
|||
rdp.fill_color = rdp.cmd1;
|
||||
rdp.update |= UPDATE_ALPHA_COMPARE | UPDATE_COMBINE;
|
||||
|
||||
FRDP("setfillcolor: %08lx\n", rdp.cmd1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "setfillcolor: %08lx", rdp.cmd1);
|
||||
}
|
||||
|
||||
static void rdp_setfogcolor()
|
||||
|
@ -2493,7 +2471,7 @@ static void rdp_setfogcolor()
|
|||
rdp.fog_color = rdp.cmd1;
|
||||
rdp.update |= UPDATE_COMBINE | UPDATE_FOG_ENABLED;
|
||||
|
||||
FRDP("setfogcolor - %08lx\n", rdp.cmd1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "setfogcolor - %08lx", rdp.cmd1);
|
||||
}
|
||||
|
||||
static void rdp_setblendcolor()
|
||||
|
@ -2501,7 +2479,7 @@ static void rdp_setblendcolor()
|
|||
rdp.blend_color = rdp.cmd1;
|
||||
rdp.update |= UPDATE_COMBINE;
|
||||
|
||||
FRDP("setblendcolor: %08lx\n", rdp.cmd1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "setblendcolor: %08lx", rdp.cmd1);
|
||||
}
|
||||
|
||||
static void rdp_setprimcolor()
|
||||
|
@ -2511,7 +2489,7 @@ static void rdp_setprimcolor()
|
|||
rdp.prim_lodfrac = maxval(rdp.cmd0 & 0xFF, rdp.prim_lodmin);
|
||||
rdp.update |= UPDATE_COMBINE;
|
||||
|
||||
FRDP("setprimcolor: %08lx, lodmin: %d, lodfrac: %d\n", rdp.cmd1, rdp.prim_lodmin,
|
||||
WriteTrace(TraceRDP, TraceDebug, "setprimcolor: %08lx, lodmin: %d, lodfrac: %d", rdp.cmd1, rdp.prim_lodmin,
|
||||
rdp.prim_lodfrac);
|
||||
}
|
||||
|
||||
|
@ -2520,7 +2498,7 @@ static void rdp_setenvcolor()
|
|||
rdp.env_color = rdp.cmd1;
|
||||
rdp.update |= UPDATE_COMBINE;
|
||||
|
||||
FRDP("setenvcolor: %08lx\n", rdp.cmd1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "setenvcolor: %08lx", rdp.cmd1);
|
||||
}
|
||||
|
||||
static void rdp_setcombine()
|
||||
|
@ -2550,7 +2528,7 @@ static void rdp_setcombine()
|
|||
|
||||
rdp.update |= UPDATE_COMBINE;
|
||||
|
||||
FRDP("setcombine\na0=%s b0=%s c0=%s d0=%s\nAa0=%s Ab0=%s Ac0=%s Ad0=%s\na1=%s b1=%s c1=%s d1=%s\nAa1=%s Ab1=%s Ac1=%s Ad1=%s\n",
|
||||
WriteTrace(TraceRDP, TraceDebug, "setcombine\na0=%s b0=%s c0=%s d0=%s\nAa0=%s Ab0=%s Ac0=%s Ad0=%s\na1=%s b1=%s c1=%s d1=%s\nAa1=%s Ab1=%s Ac1=%s Ad1=%s",
|
||||
Mode0[rdp.c_a0], Mode1[rdp.c_b0], Mode2[rdp.c_c0], Mode3[rdp.c_d0],
|
||||
Alpha0[rdp.c_Aa0], Alpha1[rdp.c_Ab0], Alpha2[rdp.c_Ac0], Alpha3[rdp.c_Ad0],
|
||||
Mode0[rdp.c_a1], Mode1[rdp.c_b1], Mode2[rdp.c_c1], Mode3[rdp.c_d1],
|
||||
|
@ -2603,7 +2581,7 @@ static void rdp_settextureimage()
|
|||
if (fb_hwfbe_enabled) //search this texture among drawn texture buffers
|
||||
FindTextureBuffer(rdp.timg.addr, rdp.timg.width);
|
||||
|
||||
FRDP("settextureimage: format: %s, size: %s, width: %d, addr: %08lx\n",
|
||||
WriteTrace(TraceRDP, TraceDebug, "settextureimage: format: %s, size: %s, width: %d, addr: %08lx",
|
||||
format[rdp.timg.format], size[rdp.timg.size],
|
||||
rdp.timg.width, rdp.timg.addr);
|
||||
}
|
||||
|
@ -2612,13 +2590,13 @@ static void rdp_setdepthimage()
|
|||
{
|
||||
rdp.zimg = segoffset(rdp.cmd1) & BMASK;
|
||||
rdp.zi_width = rdp.ci_width;
|
||||
FRDP("setdepthimage - %08lx\n", rdp.zimg);
|
||||
WriteTrace(TraceRDP, TraceDebug, "setdepthimage - %08lx", rdp.zimg);
|
||||
}
|
||||
|
||||
int SwapOK = TRUE;
|
||||
static void RestoreScale()
|
||||
{
|
||||
FRDP("Return to original scale: x = %f, y = %f\n", rdp.scale_x_bak, rdp.scale_y_bak);
|
||||
WriteTrace(TraceRDP, TraceDebug, "Return to original scale: x = %f, y = %f", rdp.scale_x_bak, rdp.scale_y_bak);
|
||||
rdp.scale_x = rdp.scale_x_bak;
|
||||
rdp.scale_y = rdp.scale_y_bak;
|
||||
// update_scissor();
|
||||
|
@ -2818,7 +2796,7 @@ static void rdp_setcolorimage()
|
|||
grTextureAuxBufferExt(rdp.texbufs[0].tmu, rdp.texbufs[0].begin, LOD, LOD,
|
||||
GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
|
||||
grAuxBufferExt(GR_BUFFER_TEXTUREAUXBUFFER_EXT);
|
||||
LRDP("rdp_setcolorimage - set texture depth buffer to TMU0\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp_setcolorimage - set texture depth buffer to TMU0");
|
||||
}
|
||||
}
|
||||
rdp.skip_drawing = TRUE;
|
||||
|
@ -2913,7 +2891,7 @@ static void rdp_setcolorimage()
|
|||
}
|
||||
if (to_org_res)
|
||||
{
|
||||
LRDP("return to original scale\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "return to original scale");
|
||||
rdp.scale_x = rdp.scale_x_bak;
|
||||
rdp.scale_y = rdp.scale_y_bak;
|
||||
if (fb_hwfbe_enabled && !rdp.read_whole_frame)
|
||||
|
@ -2944,8 +2922,8 @@ static void rdp_setcolorimage()
|
|||
uint32_t format = (rdp.cmd0 >> 21) & 0x7;
|
||||
rdp.ci_size = (rdp.cmd0 >> 19) & 0x3;
|
||||
rdp.ci_end = rdp.cimg + ((rdp.ci_width*rdp.ci_height) << (rdp.ci_size - 1));
|
||||
FRDP("setcolorimage - %08lx, width: %d, height: %d, format: %d, size: %d\n", rdp.cmd1, rdp.ci_width, rdp.ci_height, format, rdp.ci_size);
|
||||
FRDP("cimg: %08lx, ocimg: %08lx, SwapOK: %d\n", rdp.cimg, rdp.ocimg, SwapOK);
|
||||
WriteTrace(TraceRDP, TraceDebug, "setcolorimage - %08lx, width: %d, height: %d, format: %d, size: %d", rdp.cmd1, rdp.ci_width, rdp.ci_height, format, rdp.ci_size);
|
||||
WriteTrace(TraceRDP, TraceDebug, "cimg: %08lx, ocimg: %08lx, SwapOK: %d", rdp.cimg, rdp.ocimg, SwapOK);
|
||||
|
||||
if (format != 0) //can't draw into non RGBA buffer
|
||||
{
|
||||
|
@ -2987,7 +2965,7 @@ static void rdp_setcolorimage()
|
|||
if (rdp.copy_ci_index && (rdp.frame_buffers[rdp.ci_count - 1].status != ci_zimg))
|
||||
{
|
||||
int idx = (rdp.frame_buffers[rdp.ci_count].status == ci_aux_copy) ? rdp.main_ci_index : rdp.copy_ci_index;
|
||||
FRDP("attempt open tex buffer. status: %s, addr: %08lx\n", CIStatus[rdp.frame_buffers[idx].status], rdp.frame_buffers[idx].addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "attempt open tex buffer. status: %s, addr: %08lx", CIStatus[rdp.frame_buffers[idx].status], rdp.frame_buffers[idx].addr);
|
||||
OpenTextureBuffer(rdp.frame_buffers[idx]);
|
||||
if (rdp.frame_buffers[rdp.copy_ci_index].status == ci_main) //tidal wave
|
||||
rdp.copy_ci_index = 0;
|
||||
|
@ -3007,28 +2985,27 @@ static void rsp_reserved0()
|
|||
{
|
||||
ucode5_texshiftaddr = segoffset(rdp.cmd1);
|
||||
ucode5_texshiftcount = 0;
|
||||
FRDP("uc5_texshift. addr: %08lx\n", ucode5_texshiftaddr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc5_texshift. addr: %08lx", ucode5_texshiftaddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
RDP_E("reserved0 - IGNORED\n");
|
||||
LRDP("reserved0 - IGNORED\n");
|
||||
WriteTrace(TraceRDP, TraceWarning, "reserved0 - IGNORED");
|
||||
}
|
||||
}
|
||||
|
||||
static void rsp_reserved1()
|
||||
{
|
||||
LRDP("reserved1 - ignored\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "reserved1 - ignored");
|
||||
}
|
||||
|
||||
static void rsp_reserved2()
|
||||
{
|
||||
LRDP("reserved2\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "reserved2");
|
||||
}
|
||||
|
||||
static void rsp_reserved3()
|
||||
{
|
||||
LRDP("reserved3 - ignored\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "reserved3 - ignored");
|
||||
}
|
||||
|
||||
void SetWireframeCol()
|
||||
|
@ -3130,7 +3107,7 @@ EXPORT void CALL FBRead(uint32_t addr)
|
|||
}
|
||||
cpu_fb_read_called = TRUE;
|
||||
uint32_t a = segoffset(addr);
|
||||
FRDP("FBRead. addr: %08lx\n", a);
|
||||
WriteTrace(TraceRDP, TraceDebug, "FBRead. addr: %08lx", a);
|
||||
if (!rdp.fb_drawn && (a >= rdp.cimg) && (a < rdp.ci_end))
|
||||
{
|
||||
fbreads_back++;
|
||||
|
@ -3201,7 +3178,7 @@ EXPORT void CALL FBWrite(uint32_t addr, uint32_t /*size*/)
|
|||
}
|
||||
cpu_fb_write_called = TRUE;
|
||||
uint32_t a = segoffset(addr);
|
||||
FRDP("FBWrite. addr: %08lx\n", a);
|
||||
WriteTrace(TraceRDP, TraceDebug, "FBWrite. addr: %08lx", a);
|
||||
if (a < rdp.cimg || a > rdp.ci_end)
|
||||
return;
|
||||
cpu_fb_write = TRUE;
|
||||
|
@ -3250,7 +3227,7 @@ EXPORT void CALL FBGetFrameBufferInfo(void *p)
|
|||
memset(pinfo, 0, sizeof(FrameBufferInfo) * 6);
|
||||
if (!(g_settings->frame_buffer&fb_get_info))
|
||||
return;
|
||||
LRDP("FBGetFrameBufferInfo ()\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "FBGetFrameBufferInfo ()");
|
||||
//*
|
||||
if (fb_emulation_enabled)
|
||||
{
|
||||
|
@ -3291,7 +3268,7 @@ EXPORT void CALL FBGetFrameBufferInfo(void *p)
|
|||
|
||||
void DetectFrameBufferUsage()
|
||||
{
|
||||
LRDP("DetectFrameBufferUsage\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "DetectFrameBufferUsage");
|
||||
|
||||
uint32_t dlist_start = *(uint32_t*)(gfx.DMEM + 0xFF0);
|
||||
uint32_t a;
|
||||
|
@ -3346,7 +3323,7 @@ void DetectFrameBufferUsage()
|
|||
{
|
||||
rdp.dl_count = -1;
|
||||
|
||||
LRDP("End of DL\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "End of DL");
|
||||
rdp.pc_i--;
|
||||
}
|
||||
}
|
||||
|
@ -3383,7 +3360,7 @@ void DetectFrameBufferUsage()
|
|||
rdp.frame_buffers[i].status = ci_aux;
|
||||
else if (rdp.frame_buffers[i].addr == rdp.frame_buffers[rdp.ci_count - 1].addr)
|
||||
rdp.frame_buffers[i].status = ci_main;
|
||||
// FRDP("rdp.frame_buffers[%d].status = %d\n", i, rdp.frame_buffers[i].status);
|
||||
// WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = %d", i, rdp.frame_buffers[i].status);
|
||||
}
|
||||
rdp.main_ci_index = rdp.ci_count - 1;
|
||||
}
|
||||
|
@ -3404,10 +3381,10 @@ void DetectFrameBufferUsage()
|
|||
rdp.frame_buffers[i].status = ci_main;
|
||||
}
|
||||
|
||||
LRDP("detect fb final results: \n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "detect fb final results: ");
|
||||
for (i = 0; i < rdp.ci_count; i++)
|
||||
{
|
||||
FRDP("rdp.frame_buffers[%d].status = %s, addr: %08lx, height: %d\n", i, CIStatus[rdp.frame_buffers[i].status], rdp.frame_buffers[i].addr, rdp.frame_buffers[i].height);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = %s, addr: %08lx, height: %d", i, CIStatus[rdp.frame_buffers[i].status], rdp.frame_buffers[i].addr, rdp.frame_buffers[i].height);
|
||||
}
|
||||
|
||||
rdp.cimg = ci;
|
||||
|
@ -3486,7 +3463,7 @@ void DetectFrameBufferUsage()
|
|||
}
|
||||
if (tidal)
|
||||
{
|
||||
//LRDP("Tidal wave!\n");
|
||||
//WriteTrace(TraceRDP, TraceDebug, "Tidal wave!");
|
||||
rdp.copy_ci_index = rdp.main_ci_index;
|
||||
}
|
||||
}
|
||||
|
@ -3496,7 +3473,7 @@ void DetectFrameBufferUsage()
|
|||
rdp.maincimg[0] = rdp.frame_buffers[rdp.main_ci_index];
|
||||
// rdp.scale_x = rdp.scale_x_bak;
|
||||
// rdp.scale_y = rdp.scale_y_bak;
|
||||
LRDP("DetectFrameBufferUsage End\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "DetectFrameBufferUsage End");
|
||||
}
|
||||
|
||||
/*******************************************
|
||||
|
@ -3888,49 +3865,49 @@ static void rdp_triangle(int shade, int texture, int zbuffer)
|
|||
static void rdp_trifill()
|
||||
{
|
||||
rdp_triangle(0, 0, 0);
|
||||
LRDP("trifill\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "trifill");
|
||||
}
|
||||
|
||||
static void rdp_trishade()
|
||||
{
|
||||
rdp_triangle(1, 0, 0);
|
||||
LRDP("trishade\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "trishade");
|
||||
}
|
||||
|
||||
static void rdp_tritxtr()
|
||||
{
|
||||
rdp_triangle(0, 1, 0);
|
||||
LRDP("tritxtr\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "tritxtr");
|
||||
}
|
||||
|
||||
static void rdp_trishadetxtr()
|
||||
{
|
||||
rdp_triangle(1, 1, 0);
|
||||
LRDP("trishadetxtr\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "trishadetxtr");
|
||||
}
|
||||
|
||||
static void rdp_trifillz()
|
||||
{
|
||||
rdp_triangle(0, 0, 1);
|
||||
LRDP("trifillz\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "trifillz");
|
||||
}
|
||||
|
||||
static void rdp_trishadez()
|
||||
{
|
||||
rdp_triangle(1, 0, 1);
|
||||
LRDP("trishadez\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "trishadez");
|
||||
}
|
||||
|
||||
static void rdp_tritxtrz()
|
||||
{
|
||||
rdp_triangle(0, 1, 1);
|
||||
LRDP("tritxtrz\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "tritxtrz");
|
||||
}
|
||||
|
||||
static void rdp_trishadetxtrz()
|
||||
{
|
||||
rdp_triangle(1, 1, 1);
|
||||
LRDP("trishadetxtrz\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "trishadetxtrz");
|
||||
}
|
||||
|
||||
static rdp_instr rdp_command_table[64] =
|
||||
|
@ -4046,7 +4023,7 @@ static void rdphalf_1()
|
|||
uint32_t cmd = rdp.cmd1 >> 24;
|
||||
if (cmd >= 0xc8 && cmd <= 0xcf) //triangle command
|
||||
{
|
||||
LRDP("rdphalf_1 - lle triangle\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdphalf_1 - lle triangle");
|
||||
rdp_cmd_ptr = 0;
|
||||
rdp_cmd_cur = 0;
|
||||
uint32_t a;
|
||||
|
@ -4062,7 +4039,7 @@ static void rdphalf_1()
|
|||
{
|
||||
rdp.dl_count = -1;
|
||||
|
||||
LRDP("End of DL\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "End of DL");
|
||||
rdp.pc_i--;
|
||||
}
|
||||
}
|
||||
|
@ -4092,20 +4069,18 @@ static void rdphalf_1()
|
|||
}
|
||||
else
|
||||
{
|
||||
LRDP("rdphalf_1 - IGNORED\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdphalf_1 - IGNORED");
|
||||
}
|
||||
}
|
||||
|
||||
static void rdphalf_2()
|
||||
{
|
||||
RDP_E("rdphalf_2 - IGNORED\n");
|
||||
LRDP("rdphalf_2 - IGNORED\n");
|
||||
WriteTrace(TraceRDP, TraceWarning, "rdphalf_2 - IGNORED");
|
||||
}
|
||||
|
||||
static void rdphalf_cont()
|
||||
{
|
||||
RDP_E("rdphalf_cont - IGNORED\n");
|
||||
LRDP("rdphalf_cont - IGNORED\n");
|
||||
WriteTrace(TraceRDP, TraceWarning, "rdphalf_cont - IGNORED");
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
@ -4136,7 +4111,7 @@ void CALL ProcessRDPList(void)
|
|||
rdp_cmd_data[rdp_cmd_ptr++] = READ_RDP_DATA(dp_current + i);
|
||||
if (rdp_cmd_ptr >= 0x1000)
|
||||
{
|
||||
FRDP("rdp_process_list: rdp_cmd_ptr overflow %x %x --> %x\n", length, dp_current, dp_end);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp_process_list: rdp_cmd_ptr overflow %x %x --> %x", length, dp_current, dp_end);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,8 @@ void SetupTrace(void)
|
|||
TraceSetModuleName(TraceInterface, "Interface");
|
||||
TraceSetModuleName(TraceResolution, "Resolution");
|
||||
TraceSetModuleName(TraceGlitch, "Glitch");
|
||||
TraceSetModuleName(TraceRDP, "RDP");
|
||||
TraceSetModuleName(TraceTLUT, "TLUT");
|
||||
|
||||
char log_dir[260];
|
||||
memset(log_dir, 0, sizeof(log_dir));
|
||||
|
|
|
@ -10,6 +10,8 @@ enum TraceModuleGlide64
|
|||
TraceInterface,
|
||||
TraceResolution,
|
||||
TraceGlitch,
|
||||
TraceRDP,
|
||||
TraceTLUT,
|
||||
MaxTraceModuleGlide64,
|
||||
};
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ static void t3dProcessRDP(uint32_t a)
|
|||
static void t3dLoadGlobState(uint32_t pgstate)
|
||||
{
|
||||
t3dGlobState *gstate = (t3dGlobState*)&gfx.RDRAM[segoffset(pgstate)];
|
||||
FRDP("Global state. pad0: %04lx, perspNorm: %04lx, flag: %08lx\n", gstate->pad0, gstate->perspNorm, gstate->flag);
|
||||
WriteTrace(TraceRDP, TraceDebug, "Global state. pad0: %04lx, perspNorm: %04lx, flag: %08lx", gstate->pad0, gstate->perspNorm, gstate->flag);
|
||||
rdp.cmd0 = gstate->othermode0;
|
||||
rdp.cmd1 = gstate->othermode1;
|
||||
rdp_setothermode();
|
||||
|
@ -111,7 +111,7 @@ static void t3dLoadGlobState(uint32_t pgstate)
|
|||
for (int s = 0; s < 16; s++)
|
||||
{
|
||||
rdp.segment[s] = gstate->segBases[s];
|
||||
FRDP("segment: %08lx -> seg%d\n", rdp.segment[s], s);
|
||||
WriteTrace(TraceRDP, TraceDebug, "segment: %08lx -> seg%d", rdp.segment[s], s);
|
||||
}
|
||||
|
||||
short scale_x = gstate->vsacle0 / 4;
|
||||
|
@ -127,7 +127,7 @@ static void t3dLoadGlobState(uint32_t pgstate)
|
|||
rdp.view_trans[1] = trans_y * rdp.scale_y;
|
||||
rdp.view_trans[2] = 32.0f * trans_z;
|
||||
rdp.update |= UPDATE_VIEWPORT;
|
||||
FRDP("viewport scale(%d, %d, %d), trans(%d, %d, %d)\n", scale_x, scale_y, scale_z,
|
||||
WriteTrace(TraceRDP, TraceDebug, "viewport scale(%d, %d, %d), trans(%d, %d, %d)", scale_x, scale_y, scale_z,
|
||||
trans_x, trans_y, trans_z);
|
||||
|
||||
t3dProcessRDP(segoffset(gstate->rdpCmds) >> 2);
|
||||
|
@ -177,27 +177,23 @@ static void t3d_vertex(uint32_t addr, uint32_t v0, uint32_t n)
|
|||
if (v->y < -v->w) v->scr_off |= 4;
|
||||
if (v->y > v->w) v->scr_off |= 8;
|
||||
if (v->w < 0.1f) v->scr_off |= 16;
|
||||
#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);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "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", 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);
|
||||
}
|
||||
}
|
||||
|
||||
static void t3dLoadObject(uint32_t pstate, uint32_t pvtx, uint32_t ptri)
|
||||
{
|
||||
LRDP("Loading Turbo3D object\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Loading Turbo3D object");
|
||||
t3dState *ostate = (t3dState*)&gfx.RDRAM[segoffset(pstate)];
|
||||
rdp.cur_tile = (ostate->textureState) & 7;
|
||||
FRDP("tile: %d\n", rdp.cur_tile);
|
||||
WriteTrace(TraceRDP, TraceDebug, "tile: %d", rdp.cur_tile);
|
||||
if (rdp.tiles[rdp.cur_tile].s_scale < 0.001f)
|
||||
rdp.tiles[rdp.cur_tile].s_scale = 0.015625;
|
||||
if (rdp.tiles[rdp.cur_tile].t_scale < 0.001f)
|
||||
rdp.tiles[rdp.cur_tile].t_scale = 0.015625;
|
||||
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP("renderState: %08lx, textureState: %08lx, othermode0: %08lx, othermode1: %08lx, rdpCmds: %08lx, triCount : %d, v0: %d, vn: %d\n", ostate->renderState, ostate->textureState,
|
||||
WriteTrace(TraceRDP, TraceVerbose, "renderState: %08lx, textureState: %08lx, othermode0: %08lx, othermode1: %08lx, rdpCmds: %08lx, triCount : %d, v0: %d, vn: %d", ostate->renderState, ostate->textureState,
|
||||
ostate->othermode0, ostate->othermode1, ostate->rdpCmds, ostate->triCount, ostate->vtxV0, ostate->vtxCount);
|
||||
#endif
|
||||
|
||||
rdp.cmd0 = ostate->othermode0;
|
||||
rdp.cmd1 = ostate->othermode1;
|
||||
|
@ -210,12 +206,10 @@ static void t3dLoadObject(uint32_t pstate, uint32_t pvtx, uint32_t ptri)
|
|||
{
|
||||
uint32_t addr = segoffset(pstate + sizeof(t3dState)) & BMASK;
|
||||
load_matrix(rdp.combined, addr);
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[0][0], rdp.combined[0][1], rdp.combined[0][2], rdp.combined[0][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[1][0], rdp.combined[1][1], rdp.combined[1][2], rdp.combined[1][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[2][0], rdp.combined[2][1], rdp.combined[2][2], rdp.combined[2][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[3][0], rdp.combined[3][1], rdp.combined[3][2], rdp.combined[3][3]);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.combined[0][0], rdp.combined[0][1], rdp.combined[0][2], rdp.combined[0][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.combined[1][0], rdp.combined[1][1], rdp.combined[1][2], rdp.combined[1][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.combined[2][0], rdp.combined[2][1], rdp.combined[2][2], rdp.combined[2][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.combined[3][0], rdp.combined[3][1], rdp.combined[3][2], rdp.combined[3][3]);
|
||||
}
|
||||
|
||||
rdp.geom_mode &= ~0x00020000;
|
||||
|
@ -233,7 +227,7 @@ static void t3dLoadObject(uint32_t pstate, uint32_t pvtx, uint32_t ptri)
|
|||
{
|
||||
t3dTriN * tri = (t3dTriN*)&gfx.RDRAM[a];
|
||||
a += 4;
|
||||
FRDP("tri #%d - %d, %d, %d\n", t, tri->v0, tri->v1, tri->v2);
|
||||
WriteTrace(TraceRDP, TraceDebug, "tri #%d - %d, %d, %d", t, tri->v0, tri->v1, tri->v2);
|
||||
VERTEX *v[3] = { &rdp.vtx[tri->v0], &rdp.vtx[tri->v1], &rdp.vtx[tri->v2] };
|
||||
if (cull_tri(v))
|
||||
rdp.tri_n++;
|
||||
|
@ -248,7 +242,7 @@ static void t3dLoadObject(uint32_t pstate, uint32_t pvtx, uint32_t ptri)
|
|||
|
||||
static void Turbo3D()
|
||||
{
|
||||
LRDP("Start Turbo3D microcode\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Start Turbo3D microcode");
|
||||
g_settings->ucode = ucode_Fast3D;
|
||||
uint32_t a = 0, pgstate = 0, pstate = 0, pvtx = 0, ptri = 0;
|
||||
do {
|
||||
|
@ -257,7 +251,7 @@ static void Turbo3D()
|
|||
pstate = ((uint32_t*)gfx.RDRAM)[(a >> 2) + 1];
|
||||
pvtx = ((uint32_t*)gfx.RDRAM)[(a >> 2) + 2];
|
||||
ptri = ((uint32_t*)gfx.RDRAM)[(a >> 2) + 3];
|
||||
FRDP("GlobalState: %08lx, Object: %08lx, Vertices: %08lx, Triangles: %08lx\n", pgstate, pstate, pvtx, ptri);
|
||||
WriteTrace(TraceRDP, TraceDebug, "GlobalState: %08lx, Object: %08lx, Vertices: %08lx, Triangles: %08lx", pgstate, pstate, pvtx, ptri);
|
||||
if (!pstate)
|
||||
{
|
||||
rdp.halt = 1;
|
||||
|
|
|
@ -80,7 +80,7 @@ static void rsp_vertex(int v0, int n)
|
|||
}
|
||||
}
|
||||
|
||||
FRDP("rsp:vertex v0:%d, n:%d, from: %08lx\n", v0, n, addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rsp:vertex v0:%d, n:%d, from: %08lx", v0, n, addr);
|
||||
|
||||
for (i = 0; i < (n << 4); i += 16)
|
||||
{
|
||||
|
@ -140,9 +140,7 @@ static void rsp_vertex(int v0, int n)
|
|||
v->g = ((uint8_t*)gfx.RDRAM)[(addr + i + 13) ^ 3];
|
||||
v->b = ((uint8_t*)gfx.RDRAM)[(addr + i + 14) ^ 3];
|
||||
}
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP ("v%d - x: %f, y: %f, z: %f, w: %f, u: %f, v: %f, f: %f, z_w: %f, r=%d, g=%d, b=%d, a=%d\n", i>>4, v->x, v->y, v->z, v->w, v->ou*rdp.tiles[rdp.cur_tile].s_scale, v->ov*rdp.tiles[rdp.cur_tile].t_scale, v->f, v->z_w, v->r, v->g, v->b, v->a);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "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", 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,8 +214,7 @@ void modelview_push()
|
|||
{
|
||||
if (rdp.model_i == rdp.model_stack_size)
|
||||
{
|
||||
RDP_E("** Model matrix stack overflow ** too many pushes\n");
|
||||
LRDP("** Model matrix stack overflow ** too many pushes\n");
|
||||
WriteTrace(TraceRDP, TraceWarning, "** Model matrix stack overflow ** too many pushes");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -233,8 +230,7 @@ void modelview_pop(int num = 1)
|
|||
}
|
||||
else
|
||||
{
|
||||
RDP_E("** Model matrix stack error ** too many pops\n");
|
||||
LRDP("** Model matrix stack error ** too many pops\n");
|
||||
WriteTrace(TraceRDP, TraceWarning, "** Model matrix stack error ** too many pops");
|
||||
return;
|
||||
}
|
||||
memcpy(rdp.model, rdp.model_stack[rdp.model_i], 64);
|
||||
|
@ -270,7 +266,7 @@ void projection_mul(float m[4][4])
|
|||
|
||||
void load_matrix(float m[4][4], uint32_t addr)
|
||||
{
|
||||
FRDP("matrix - addr: %08lx\n", addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "matrix - addr: %08lx", addr);
|
||||
int x, y; // matrix index
|
||||
addr >>= 1;
|
||||
uint16_t * src = (uint16_t*)gfx.RDRAM;
|
||||
|
@ -289,7 +285,7 @@ void load_matrix(float m[4][4], uint32_t addr)
|
|||
//
|
||||
static void uc0_matrix()
|
||||
{
|
||||
LRDP("uc0:matrix ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc0:matrix ");
|
||||
|
||||
// Use segment offset to get the address
|
||||
uint32_t addr = segoffset(rdp.cmd1) & 0x00FFFFFF;
|
||||
|
@ -301,57 +297,54 @@ static void uc0_matrix()
|
|||
switch (command)
|
||||
{
|
||||
case 0: // modelview mul nopush
|
||||
LRDP("modelview mul\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "modelview mul");
|
||||
modelview_mul(m);
|
||||
break;
|
||||
|
||||
case 1: // projection mul nopush
|
||||
case 5: // projection mul push, can't push projection
|
||||
LRDP("projection mul\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "projection mul");
|
||||
projection_mul(m);
|
||||
break;
|
||||
|
||||
case 2: // modelview load nopush
|
||||
LRDP("modelview load\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "modelview load");
|
||||
modelview_load(m);
|
||||
break;
|
||||
|
||||
case 3: // projection load nopush
|
||||
case 7: // projection load push, can't push projection
|
||||
LRDP("projection load\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "projection load");
|
||||
projection_load(m);
|
||||
|
||||
break;
|
||||
|
||||
case 4: // modelview mul push
|
||||
LRDP("modelview mul push\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "modelview mul push");
|
||||
modelview_mul_push(m);
|
||||
break;
|
||||
|
||||
case 6: // modelview load push
|
||||
LRDP("modelview load push\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "modelview load push");
|
||||
modelview_load_push(m);
|
||||
break;
|
||||
|
||||
default:
|
||||
FRDP_E("Unknown matrix command, %02lx", command);
|
||||
FRDP("Unknown matrix command, %02lx", command);
|
||||
WriteTrace(TraceRDP, TraceWarning, "Unknown matrix command, %02lx", command);
|
||||
}
|
||||
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP("{%f,%f,%f,%f}\n", m[0][0], m[0][1], m[0][2], m[0][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", m[1][0], m[1][1], m[1][2], m[1][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", m[2][0], m[2][1], m[2][2], m[2][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", m[3][0], m[3][1], m[3][2], m[3][3]);
|
||||
FRDP ("\nmodel\n{%f,%f,%f,%f}\n", rdp.model[0][0], rdp.model[0][1], rdp.model[0][2], rdp.model[0][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.model[1][0], rdp.model[1][1], rdp.model[1][2], rdp.model[1][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.model[2][0], rdp.model[2][1], rdp.model[2][2], rdp.model[2][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.model[3][0], rdp.model[3][1], rdp.model[3][2], rdp.model[3][3]);
|
||||
FRDP ("\nproj\n{%f,%f,%f,%f}\n", rdp.proj[0][0], rdp.proj[0][1], rdp.proj[0][2], rdp.proj[0][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.proj[1][0], rdp.proj[1][1], rdp.proj[1][2], rdp.proj[1][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.proj[2][0], rdp.proj[2][1], rdp.proj[2][2], rdp.proj[2][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.proj[3][0], rdp.proj[3][1], rdp.proj[3][2], rdp.proj[3][3]);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", m[0][0], m[0][1], m[0][2], m[0][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", m[1][0], m[1][1], m[1][2], m[1][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", m[2][0], m[2][1], m[2][2], m[2][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", m[3][0], m[3][1], m[3][2], m[3][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "\nmodel\n{%f,%f,%f,%f}", rdp.model[0][0], rdp.model[0][1], rdp.model[0][2], rdp.model[0][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.model[1][0], rdp.model[1][1], rdp.model[1][2], rdp.model[1][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.model[2][0], rdp.model[2][1], rdp.model[2][2], rdp.model[2][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.model[3][0], rdp.model[3][1], rdp.model[3][2], rdp.model[3][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "\nproj\n{%f,%f,%f,%f}", rdp.proj[0][0], rdp.proj[0][1], rdp.proj[0][2], rdp.proj[0][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.proj[1][0], rdp.proj[1][1], rdp.proj[1][2], rdp.proj[1][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.proj[2][0], rdp.proj[2][1], rdp.proj[2][2], rdp.proj[2][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.proj[3][0], rdp.proj[3][1], rdp.proj[3][2], rdp.proj[3][3]);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -359,7 +352,7 @@ static void uc0_matrix()
|
|||
//
|
||||
static void uc0_movemem()
|
||||
{
|
||||
LRDP("uc0:movemem ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc0:movemem ");
|
||||
|
||||
uint32_t i, a;
|
||||
|
||||
|
@ -392,7 +385,7 @@ static void uc0_movemem()
|
|||
|
||||
rdp.update |= UPDATE_VIEWPORT;
|
||||
|
||||
FRDP("viewport scale(%d, %d, %d), trans(%d, %d, %d), from:%08lx\n", scale_x, scale_y, scale_z,
|
||||
WriteTrace(TraceRDP, TraceDebug, "viewport scale(%d, %d, %d), trans(%d, %d, %d), from:%08lx", scale_x, scale_y, scale_z,
|
||||
trans_x, trans_y, trans_z, rdp.cmd1);
|
||||
}
|
||||
break;
|
||||
|
@ -410,7 +403,7 @@ static void uc0_movemem()
|
|||
rdp.use_lookat = FALSE;
|
||||
else
|
||||
rdp.use_lookat = TRUE;
|
||||
FRDP("lookat_y (%f, %f, %f)\n", rdp.lookat[1][0], rdp.lookat[1][1], rdp.lookat[1][2]);
|
||||
WriteTrace(TraceRDP, TraceDebug, "lookat_y (%f, %f, %f)", rdp.lookat[1][0], rdp.lookat[1][1], rdp.lookat[1][2]);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -420,7 +413,7 @@ static void uc0_movemem()
|
|||
rdp.lookat[0][1] = (float)(((char*)gfx.RDRAM)[(a + 9) ^ 3]) / 127.0f;
|
||||
rdp.lookat[0][2] = (float)(((char*)gfx.RDRAM)[(a + 10) ^ 3]) / 127.0f;
|
||||
rdp.use_lookat = TRUE;
|
||||
FRDP("lookat_x (%f, %f, %f)\n", rdp.lookat[1][0], rdp.lookat[1][1], rdp.lookat[1][2]);
|
||||
WriteTrace(TraceRDP, TraceDebug, "lookat_x (%f, %f, %f)", rdp.lookat[1][0], rdp.lookat[1][1], rdp.lookat[1][2]);
|
||||
break;
|
||||
|
||||
case 0x86:
|
||||
|
@ -449,7 +442,7 @@ static void uc0_movemem()
|
|||
|
||||
//rdp.update |= UPDATE_LIGHTS;
|
||||
|
||||
FRDP("light: n: %d, r: %.3f, g: %.3f, b: %.3f, x: %.3f, y: %.3f, z: %.3f\n",
|
||||
WriteTrace(TraceRDP, TraceDebug, "light: n: %d, r: %.3f, g: %.3f, b: %.3f, x: %.3f, y: %.3f, z: %.3f",
|
||||
i, rdp.light[i].r, rdp.light[i].g, rdp.light[i].b,
|
||||
rdp.light_vector[i][0], rdp.light_vector[i][1], rdp.light_vector[i][2]);
|
||||
break;
|
||||
|
@ -465,36 +458,31 @@ static void uc0_movemem()
|
|||
addr = rdp.pc[rdp.pc_i] & BMASK;
|
||||
rdp.pc[rdp.pc_i] = (addr + 24) & BMASK; //skip next 3 command, b/c they all are part of gSPForceMatrix
|
||||
|
||||
#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[1][0], rdp.combined[1][1], rdp.combined[1][2], rdp.combined[1][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[2][0], rdp.combined[2][1], rdp.combined[2][2], rdp.combined[2][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[3][0], rdp.combined[3][1], rdp.combined[3][2], rdp.combined[3][3]);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.combined[0][0], rdp.combined[0][1], rdp.combined[0][2], rdp.combined[0][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.combined[1][0], rdp.combined[1][1], rdp.combined[1][2], rdp.combined[1][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.combined[2][0], rdp.combined[2][1], rdp.combined[2][2], rdp.combined[2][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.combined[3][0], rdp.combined[3][1], rdp.combined[3][2], rdp.combined[3][3]);
|
||||
}
|
||||
break;
|
||||
|
||||
//next 3 command should never appear since they will be skipped in previous command
|
||||
case 0x98:
|
||||
RDP_E("uc0:movemem matrix 0 - ERROR!\n");
|
||||
LRDP("matrix 0 - IGNORED\n");
|
||||
WriteTrace(TraceRDP, TraceWarning, "matrix 0 - IGNORED");
|
||||
break;
|
||||
|
||||
case 0x9A:
|
||||
RDP_E("uc0:movemem matrix 1 - ERROR!\n");
|
||||
LRDP("matrix 1 - IGNORED\n");
|
||||
WriteTrace(TraceRDP, TraceWarning, "matrix 1 - IGNORED");
|
||||
break;
|
||||
|
||||
case 0x9C:
|
||||
RDP_E("uc0:movemem matrix 2 - ERROR!\n");
|
||||
LRDP("matrix 2 - IGNORED\n");
|
||||
WriteTrace(TraceRDP, TraceWarning, "matrix 2 - IGNORED");
|
||||
break;
|
||||
|
||||
default:
|
||||
FRDP_E("uc0:movemem unknown (index: 0x%08lx)\n", (rdp.cmd0 >> 16) & 0xFF);
|
||||
FRDP("unknown (index: 0x%08lx)\n", (rdp.cmd0 >> 16) & 0xFF);
|
||||
}
|
||||
WriteTrace(TraceRDP, TraceWarning, "uc0:movemem unknown (index: 0x%08lx)", (rdp.cmd0 >> 16) & 0xFF);
|
||||
WriteTrace(TraceRDP, TraceDebug, "unknown (index: 0x%08lx)", (rdp.cmd0 >> 16) & 0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// uc0:displaylist - makes a call to another section of code
|
||||
|
@ -504,19 +492,19 @@ static void uc0_displaylist()
|
|||
uint32_t addr = segoffset(rdp.cmd1) & 0x00FFFFFF;
|
||||
|
||||
// This fixes partially Gauntlet: Legends
|
||||
if (addr == rdp.pc[rdp.pc_i] - 8) { LRDP("display list not executed!\n"); return; }
|
||||
if (addr == rdp.pc[rdp.pc_i] - 8) { WriteTrace(TraceRDP, TraceDebug, "display list not executed!"); return; }
|
||||
|
||||
uint32_t push = (rdp.cmd0 >> 16) & 0xFF; // push the old location?
|
||||
|
||||
FRDP("uc0:displaylist: %08lx, push:%s", addr, push ? "no" : "yes");
|
||||
FRDP(" (seg %d, offset %08lx)\n", (rdp.cmd1 >> 24) & 0x0F, rdp.cmd1 & 0x00FFFFFF);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc0:displaylist: %08lx, push:%s", addr, push ? "no" : "yes");
|
||||
WriteTrace(TraceRDP, TraceDebug, " (seg %d, offset %08lx)", (rdp.cmd1 >> 24) & 0x0F, rdp.cmd1 & 0x00FFFFFF);
|
||||
|
||||
switch (push)
|
||||
{
|
||||
case 0: // push
|
||||
if (rdp.pc_i >= 9) {
|
||||
RDP_E("** DL stack overflow **");
|
||||
LRDP("** DL stack overflow **\n");
|
||||
if (rdp.pc_i >= 9)
|
||||
{
|
||||
WriteTrace(TraceRDP, TraceWarning, "** DL stack overflow **");
|
||||
return;
|
||||
}
|
||||
rdp.pc_i++; // go to the next PC in the stack
|
||||
|
@ -528,8 +516,7 @@ static void uc0_displaylist()
|
|||
break;
|
||||
|
||||
default:
|
||||
RDP_E("Unknown displaylist operation\n");
|
||||
LRDP("Unknown displaylist operation\n");
|
||||
WriteTrace(TraceRDP, TraceWarning, "Unknown displaylist operation");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -538,7 +525,7 @@ static void uc0_displaylist()
|
|||
//
|
||||
static void uc0_tri1()
|
||||
{
|
||||
FRDP("uc0:tri1 #%d - %d, %d, %d\n", rdp.tri_n,
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc0:tri1 #%d - %d, %d, %d", rdp.tri_n,
|
||||
((rdp.cmd1 >> 16) & 0xFF) / 10,
|
||||
((rdp.cmd1 >> 8) & 0xFF) / 10,
|
||||
(rdp.cmd1 & 0xFF) / 10);
|
||||
|
@ -568,11 +555,11 @@ static void uc0_tri1()
|
|||
//
|
||||
static void uc0_enddl()
|
||||
{
|
||||
LRDP("uc0:enddl\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc0:enddl");
|
||||
|
||||
if (rdp.pc_i == 0)
|
||||
{
|
||||
LRDP("RDP end\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "RDP end");
|
||||
|
||||
// Halt execution here
|
||||
rdp.halt = 1;
|
||||
|
@ -588,7 +575,7 @@ static void uc0_culldl()
|
|||
uint32_t cond = 0;
|
||||
VERTEX *v;
|
||||
|
||||
FRDP("uc0:culldl start: %d, end: %d\n", vStart, vEnd);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc0:culldl start: %d, end: %d", vStart, vEnd);
|
||||
|
||||
if (vEnd < vStart) return;
|
||||
for (uint16_t i = vStart; i <= vEnd; i++)
|
||||
|
@ -610,13 +597,13 @@ static void uc0_culldl()
|
|||
return;
|
||||
}
|
||||
|
||||
LRDP(" - "); // specify that the enddl is not a real command
|
||||
WriteTrace(TraceRDP, TraceDebug, " - "); // specify that the enddl is not a real command
|
||||
uc0_enddl();
|
||||
}
|
||||
|
||||
static void uc0_popmatrix()
|
||||
{
|
||||
LRDP("uc0:popmatrix\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc0:popmatrix");
|
||||
|
||||
uint32_t param = rdp.cmd1;
|
||||
|
||||
|
@ -630,8 +617,7 @@ static void uc0_popmatrix()
|
|||
break;
|
||||
|
||||
default:
|
||||
FRDP_E("Unknown uc0:popmatrix command: 0x%08lx\n", param);
|
||||
FRDP("Unknown uc0:popmatrix command: 0x%08lx\n", param);
|
||||
WriteTrace(TraceRDP, TraceWarning, "Unknown uc0:popmatrix command: 0x%08lx", param);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -654,7 +640,7 @@ static void uc0_modifyvtx(uint8_t where, uint16_t vtx, uint32_t val)
|
|||
v->a = (uint8_t)(val & 0xFF);
|
||||
v->shade_mod = 0;
|
||||
|
||||
FRDP("RGBA: %d, %d, %d, %d\n", v->r, v->g, v->b, v->a);
|
||||
WriteTrace(TraceRDP, TraceDebug, "RGBA: %d, %d, %d, %d", v->r, v->g, v->b, v->a);
|
||||
break;
|
||||
|
||||
case 0x14: // ST
|
||||
|
@ -665,7 +651,7 @@ static void uc0_modifyvtx(uint8_t where, uint16_t vtx, uint32_t val)
|
|||
v->uv_calculated = 0xFFFFFFFF;
|
||||
v->uv_scaled = 1;
|
||||
}
|
||||
FRDP("u/v: (%04lx, %04lx), (%f, %f)\n", (short)(val >> 16), (short)(val & 0xFFFF),
|
||||
WriteTrace(TraceRDP, TraceDebug, "u/v: (%04lx, %04lx), (%f, %f)", (short)(val >> 16), (short)(val & 0xFFFF),
|
||||
v->ou, v->ov);
|
||||
break;
|
||||
|
||||
|
@ -691,7 +677,7 @@ static void uc0_modifyvtx(uint8_t where, uint16_t vtx, uint32_t val)
|
|||
if (scr_y > rdp.vi_height) v->scr_off |= 8;
|
||||
if (v->w < 0.1f) v->scr_off |= 16;
|
||||
|
||||
FRDP("x/y: (%f, %f)\n", scr_x, scr_y);
|
||||
WriteTrace(TraceRDP, TraceDebug, "x/y: (%f, %f)", scr_x, scr_y);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -700,12 +686,12 @@ static void uc0_modifyvtx(uint8_t where, uint16_t vtx, uint32_t val)
|
|||
float scr_z = (float)((short)(val >> 16));
|
||||
v->z_w = (scr_z - rdp.view_trans[2]) / rdp.view_scale[2];
|
||||
v->z = v->z_w * v->w;
|
||||
FRDP("z: %f\n", scr_z);
|
||||
WriteTrace(TraceRDP, TraceDebug, "z: %f", scr_z);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
LRDP("UNKNOWN\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "UNKNOWN");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -715,14 +701,13 @@ static void uc0_modifyvtx(uint8_t where, uint16_t vtx, uint32_t val)
|
|||
//
|
||||
static void uc0_moveword()
|
||||
{
|
||||
LRDP("uc0:moveword ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc0:moveword ");
|
||||
|
||||
// Find which command this is (lowest byte of cmd0)
|
||||
switch (rdp.cmd0 & 0xFF)
|
||||
{
|
||||
case 0x00:
|
||||
RDP_E("uc0:moveword matrix - IGNORED\n");
|
||||
LRDP("matrix - IGNORED\n");
|
||||
WriteTrace(TraceRDP, TraceWarning, "matrix - IGNORED");
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
|
@ -730,7 +715,7 @@ static void uc0_moveword()
|
|||
if (rdp.num_lights > 8) rdp.num_lights = 0;
|
||||
|
||||
rdp.update |= UPDATE_LIGHTS;
|
||||
FRDP("numlights: %d\n", rdp.num_lights);
|
||||
WriteTrace(TraceRDP, TraceDebug, "numlights: %d", rdp.num_lights);
|
||||
break;
|
||||
|
||||
case 0x04:
|
||||
|
@ -739,11 +724,11 @@ static void uc0_moveword()
|
|||
rdp.clip_ratio = sqrt((float)rdp.cmd1);
|
||||
rdp.update |= UPDATE_VIEWPORT;
|
||||
}
|
||||
FRDP("clip %08lx, %08lx\n", rdp.cmd0, rdp.cmd1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "clip %08lx, %08lx", rdp.cmd0, rdp.cmd1);
|
||||
break;
|
||||
|
||||
case 0x06: // segment
|
||||
FRDP("segment: %08lx -> seg%d\n", rdp.cmd1, (rdp.cmd0 >> 10) & 0x0F);
|
||||
WriteTrace(TraceRDP, TraceDebug, "segment: %08lx -> seg%d", rdp.cmd1, (rdp.cmd0 >> 10) & 0x0F);
|
||||
if ((rdp.cmd1&BMASK) < BMASK)
|
||||
rdp.segment[(rdp.cmd0 >> 10) & 0x0F] = rdp.cmd1;
|
||||
break;
|
||||
|
@ -752,14 +737,14 @@ static void uc0_moveword()
|
|||
{
|
||||
rdp.fog_multiplier = (short)(rdp.cmd1 >> 16);
|
||||
rdp.fog_offset = (short)(rdp.cmd1 & 0x0000FFFF);
|
||||
FRDP("fog: multiplier: %f, offset: %f\n", rdp.fog_multiplier, rdp.fog_offset);
|
||||
WriteTrace(TraceRDP, TraceDebug, "fog: multiplier: %f, offset: %f", rdp.fog_multiplier, rdp.fog_offset);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x0a: // moveword LIGHTCOL
|
||||
{
|
||||
int n = (rdp.cmd0 & 0xE000) >> 13;
|
||||
FRDP("lightcol light:%d, %08lx\n", n, rdp.cmd1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "lightcol light:%d, %08lx", n, rdp.cmd1);
|
||||
|
||||
rdp.light[n].r = (float)((rdp.cmd1 >> 24) & 0xFF) / 255.0f;
|
||||
rdp.light[n].g = (float)((rdp.cmd1 >> 16) & 0xFF) / 255.0f;
|
||||
|
@ -774,17 +759,16 @@ static void uc0_moveword()
|
|||
uint16_t vtx = val / 40;
|
||||
uint8_t where = val % 40;
|
||||
uc0_modifyvtx(where, vtx, rdp.cmd1);
|
||||
FRDP("uc0:modifyvtx: vtx: %d, where: 0x%02lx, val: %08lx - ", vtx, where, rdp.cmd1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc0:modifyvtx: vtx: %d, where: 0x%02lx, val: %08lx - ", vtx, where, rdp.cmd1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x0e:
|
||||
LRDP("perspnorm - IGNORED\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "perspnorm - IGNORED");
|
||||
break;
|
||||
|
||||
default:
|
||||
FRDP_E("uc0:moveword unknown (index: 0x%08lx)\n", rdp.cmd0 & 0xFF);
|
||||
FRDP("unknown (index: 0x%08lx)\n", rdp.cmd0 & 0xFF);
|
||||
WriteTrace(TraceRDP, TraceWarning, "uc0:moveword unknown (index: 0x%08lx)", rdp.cmd0 & 0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -812,19 +796,19 @@ static void uc0_texture()
|
|||
|
||||
rdp.update |= UPDATE_TEXTURE;
|
||||
|
||||
FRDP("uc0:texture: tile: %d, mipmap_lvl: %d, on: %d, s_scale: %f, t_scale: %f\n",
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc0:texture: tile: %d, mipmap_lvl: %d, on: %d, s_scale: %f, t_scale: %f",
|
||||
tile, rdp.mipmap_level, on, tmp_tile->s_scale, tmp_tile->t_scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
LRDP("uc0:texture skipped b/c of off\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc0:texture skipped b/c of off");
|
||||
rdp.tiles[tile].on = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void uc0_setothermode_h()
|
||||
{
|
||||
LRDP("uc0:setothermode_h: ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc0:setothermode_h: ");
|
||||
|
||||
int shift, len;
|
||||
if ((g_settings->ucode == ucode_F3DEX2) || (g_settings->ucode == ucode_CBFD))
|
||||
|
@ -851,58 +835,58 @@ static void uc0_setothermode_h()
|
|||
if (mask & 0x00000030) // alpha dither mode
|
||||
{
|
||||
rdp.alpha_dither_mode = (rdp.othermode_h >> 4) & 0x3;
|
||||
FRDP("alpha dither mode: %s\n", str_dither[rdp.alpha_dither_mode]);
|
||||
WriteTrace(TraceRDP, TraceDebug, "alpha dither mode: %s", str_dither[rdp.alpha_dither_mode]);
|
||||
}
|
||||
|
||||
if (mask & 0x000000C0) // rgb dither mode
|
||||
{
|
||||
uint32_t dither_mode = (rdp.othermode_h >> 6) & 0x3;
|
||||
FRDP("rgb dither mode: %s\n", str_dither[dither_mode]);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rgb dither mode: %s", str_dither[dither_mode]);
|
||||
}
|
||||
|
||||
if (mask & 0x00003000) // filter mode
|
||||
{
|
||||
rdp.filter_mode = (int)((rdp.othermode_h & 0x00003000) >> 12);
|
||||
rdp.update |= UPDATE_TEXTURE;
|
||||
FRDP("filter mode: %s\n", str_filter[rdp.filter_mode]);
|
||||
WriteTrace(TraceRDP, TraceDebug, "filter mode: %s", str_filter[rdp.filter_mode]);
|
||||
}
|
||||
|
||||
if (mask & 0x0000C000) // tlut mode
|
||||
{
|
||||
rdp.tlut_mode = (uint8_t)((rdp.othermode_h & 0x0000C000) >> 14);
|
||||
FRDP("tlut mode: %s\n", str_tlut[rdp.tlut_mode]);
|
||||
WriteTrace(TraceRDP, TraceDebug, "tlut mode: %s", str_tlut[rdp.tlut_mode]);
|
||||
}
|
||||
|
||||
if (mask & 0x00300000) // cycle type
|
||||
{
|
||||
rdp.cycle_mode = (uint8_t)((rdp.othermode_h & 0x00300000) >> 20);
|
||||
rdp.update |= UPDATE_ZBUF_ENABLED;
|
||||
FRDP("cycletype: %d\n", rdp.cycle_mode);
|
||||
WriteTrace(TraceRDP, TraceDebug, "cycletype: %d", rdp.cycle_mode);
|
||||
}
|
||||
|
||||
if (mask & 0x00010000) // LOD enable
|
||||
{
|
||||
rdp.LOD_en = (rdp.othermode_h & 0x00010000) ? TRUE : FALSE;
|
||||
FRDP("LOD_en: %d\n", rdp.LOD_en);
|
||||
WriteTrace(TraceRDP, TraceDebug, "LOD_en: %d", rdp.LOD_en);
|
||||
}
|
||||
|
||||
if (mask & 0x00080000) // Persp enable
|
||||
{
|
||||
if (rdp.persp_supported)
|
||||
rdp.Persp_en = (rdp.othermode_h & 0x00080000) ? TRUE : FALSE;
|
||||
FRDP("Persp_en: %d\n", rdp.Persp_en);
|
||||
WriteTrace(TraceRDP, TraceDebug, "Persp_en: %d", rdp.Persp_en);
|
||||
}
|
||||
|
||||
uint32_t unk = mask & 0x0FFC60F0F;
|
||||
if (unk) // unknown portions, LARGE
|
||||
{
|
||||
FRDP("UNKNOWN PORTIONS: shift: %d, len: %d, unknowns: %08lx\n", shift, len, unk);
|
||||
WriteTrace(TraceRDP, TraceDebug, "UNKNOWN PORTIONS: shift: %d, len: %d, unknowns: %08lx", shift, len, unk);
|
||||
}
|
||||
}
|
||||
|
||||
static void uc0_setothermode_l()
|
||||
{
|
||||
LRDP("uc0:setothermode_l ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc0:setothermode_l ");
|
||||
|
||||
int shift, len;
|
||||
if ((g_settings->ucode == ucode_F3DEX2) || (g_settings->ucode == ucode_CBFD))
|
||||
|
@ -930,15 +914,15 @@ static void uc0_setothermode_l()
|
|||
if (mask & 0x00000003) // alpha compare
|
||||
{
|
||||
rdp.acmp = rdp.othermode_l & 0x00000003;
|
||||
FRDP("alpha compare %s\n", ACmp[rdp.acmp]);
|
||||
WriteTrace(TraceRDP, TraceDebug, "alpha compare %s", ACmp[rdp.acmp]);
|
||||
rdp.update |= UPDATE_ALPHA_COMPARE;
|
||||
}
|
||||
|
||||
if (mask & 0x00000004) // z-src selection
|
||||
{
|
||||
rdp.zsrc = (rdp.othermode_l & 0x00000004) >> 2;
|
||||
FRDP("z-src sel: %s\n", str_zs[rdp.zsrc]);
|
||||
FRDP("z-src sel: %08lx\n", rdp.zsrc);
|
||||
WriteTrace(TraceRDP, TraceDebug, "z-src sel: %s", str_zs[rdp.zsrc]);
|
||||
WriteTrace(TraceRDP, TraceDebug, "z-src sel: %08lx", rdp.zsrc);
|
||||
rdp.update |= UPDATE_ZBUF_ENABLED;
|
||||
}
|
||||
|
||||
|
@ -949,7 +933,7 @@ static void uc0_setothermode_l()
|
|||
rdp.rm = rdp.othermode_l;
|
||||
if (g_settings->flame_corona && (rdp.rm == 0x00504341)) //hack for flame's corona
|
||||
rdp.othermode_l |= /*0x00000020 |*/ 0x00000010;
|
||||
FRDP("rendermode: %08lx\n", rdp.othermode_l); // just output whole othermode_l
|
||||
WriteTrace(TraceRDP, TraceDebug, "rendermode: %08lx", rdp.othermode_l); // just output whole othermode_l
|
||||
}
|
||||
|
||||
// there is not one setothermode_l that's not handled :)
|
||||
|
@ -958,7 +942,7 @@ static void uc0_setothermode_l()
|
|||
static void uc0_setgeometrymode()
|
||||
{
|
||||
rdp.geom_mode |= rdp.cmd1;
|
||||
FRDP("uc0:setgeometrymode %08lx; result: %08lx\n", rdp.cmd1, rdp.geom_mode);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc0:setgeometrymode %08lx; result: %08lx", rdp.cmd1, rdp.geom_mode);
|
||||
|
||||
if (rdp.cmd1 & 0x00000001) // Z-Buffer enable
|
||||
{
|
||||
|
@ -998,7 +982,7 @@ static void uc0_setgeometrymode()
|
|||
|
||||
static void uc0_cleargeometrymode()
|
||||
{
|
||||
FRDP("uc0:cleargeometrymode %08lx\n", rdp.cmd1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc0:cleargeometrymode %08lx", rdp.cmd1);
|
||||
|
||||
rdp.geom_mode &= (~rdp.cmd1);
|
||||
|
||||
|
@ -1057,7 +1041,7 @@ static void uc0_line3d()
|
|||
rdp.flags |= cull_mode << CULLSHIFT;
|
||||
rdp.update |= UPDATE_CULL_MODE;
|
||||
|
||||
FRDP("uc0:line3d v0:%d, v1:%d, width:%d\n", v0, v1, width);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc0:line3d v0:%d, v1:%d, width:%d", v0, v1, width);
|
||||
}
|
||||
|
||||
static void uc0_tri4()
|
||||
|
@ -1065,8 +1049,8 @@ static void uc0_tri4()
|
|||
// c0: 0000 0123, c1: 456789ab
|
||||
// becomes: 405 617 829 a3b
|
||||
|
||||
LRDP("uc0:tri4");
|
||||
FRDP(" #%d, #%d, #%d, #%d - %d, %d, %d - %d, %d, %d - %d, %d, %d - %d, %d, %d\n", rdp.tri_n, rdp.tri_n + 1, rdp.tri_n + 2, rdp.tri_n + 3,
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc0:tri4");
|
||||
WriteTrace(TraceRDP, TraceDebug, " #%d, #%d, #%d, #%d - %d, %d, %d - %d, %d, %d - %d, %d, %d - %d, %d, %d", rdp.tri_n, rdp.tri_n + 1, rdp.tri_n + 2, rdp.tri_n + 3,
|
||||
(rdp.cmd1 >> 28) & 0xF,
|
||||
(rdp.cmd0 >> 12) & 0xF,
|
||||
(rdp.cmd1 >> 24) & 0xF,
|
||||
|
|
|
@ -56,10 +56,10 @@ static void uc1_tri1()
|
|||
{
|
||||
if (rdp.skip_drawing)
|
||||
{
|
||||
LRDP("uc1:tri1. skipped\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc1:tri1. skipped");
|
||||
return;
|
||||
}
|
||||
FRDP("uc1:tri1 #%d - %d, %d, %d - %08lx - %08lx\n", rdp.tri_n,
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc1:tri1 #%d - %d, %d, %d - %08lx - %08lx", rdp.tri_n,
|
||||
((rdp.cmd1 >> 17) & 0x7F),
|
||||
((rdp.cmd1 >> 9) & 0x7F),
|
||||
((rdp.cmd1 >> 1) & 0x7F), rdp.cmd0, rdp.cmd1);
|
||||
|
@ -77,12 +77,12 @@ static void uc1_tri2()
|
|||
{
|
||||
if (rdp.skip_drawing)
|
||||
{
|
||||
LRDP("uc1:tri2. skipped\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc1:tri2. skipped");
|
||||
return;
|
||||
}
|
||||
LRDP("uc1:tri2");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc1:tri2");
|
||||
|
||||
FRDP(" #%d, #%d - %d, %d, %d - %d, %d, %d\n", rdp.tri_n, rdp.tri_n + 1,
|
||||
WriteTrace(TraceRDP, TraceDebug, " #%d, #%d - %d, %d, %d - %d, %d, %d", rdp.tri_n, rdp.tri_n + 1,
|
||||
((rdp.cmd0 >> 17) & 0x7F),
|
||||
((rdp.cmd0 >> 9) & 0x7F),
|
||||
((rdp.cmd0 >> 1) & 0x7F),
|
||||
|
@ -108,7 +108,7 @@ static void uc1_line3d()
|
|||
{
|
||||
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,
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc1:line3d width: %d #%d, #%d - %d, %d", width, rdp.tri_n, rdp.tri_n + 1,
|
||||
(rdp.cmd1 >> 17) & 0x7F,
|
||||
(rdp.cmd1 >> 9) & 0x7F);
|
||||
|
||||
|
@ -127,7 +127,7 @@ static void uc1_line3d()
|
|||
}
|
||||
else
|
||||
{
|
||||
FRDP("uc1:quad3d #%d, #%d\n", rdp.tri_n, rdp.tri_n + 1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc1:quad3d #%d, #%d", rdp.tri_n, rdp.tri_n + 1);
|
||||
|
||||
VERTEX *v[6] = {
|
||||
&rdp.vtx[(rdp.cmd1 >> 25) & 0x7F],
|
||||
|
@ -146,7 +146,7 @@ uint32_t branch_dl = 0;
|
|||
|
||||
static void uc1_rdphalf_1()
|
||||
{
|
||||
LRDP("uc1:rdphalf_1\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc1:rdphalf_1");
|
||||
branch_dl = rdp.cmd1;
|
||||
rdphalf_1();
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ static void uc1_rdphalf_1()
|
|||
static void uc1_branch_z()
|
||||
{
|
||||
uint32_t addr = segoffset(branch_dl);
|
||||
FRDP("uc1:branch_less_z, addr: %08lx\n", addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc1:branch_less_z, addr: %08lx", addr);
|
||||
uint32_t vtx = (rdp.cmd0 & 0xFFF) >> 1;
|
||||
if (fabs(rdp.vtx[vtx].z) <= (rdp.cmd1/*&0xFFFF*/))
|
||||
{
|
||||
|
|
|
@ -51,9 +51,7 @@ static void calc_point_light(VERTEX *v, float * vpos)
|
|||
lvec[2] -= vpos[2];
|
||||
float light_len2 = lvec[0] * lvec[0] + lvec[1] * lvec[1] + lvec[2] * lvec[2];
|
||||
float light_len = sqrtf(light_len2);
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP ("calc_point_light: len: %f, len2: %f\n", light_len, light_len2);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "calc_point_light: len: %f, len2: %f", light_len, light_len2);
|
||||
float at = rdp.light[l].ca + light_len / 65535.0f*rdp.light[l].la + light_len2 / 65535.0f*rdp.light[l].qa;
|
||||
if (at > 0.0f)
|
||||
light_intensity = 1 / at;//DotProduct (lvec, nvec) / (light_len * normal_len * at);
|
||||
|
@ -116,12 +114,11 @@ static void uc2_vertex()
|
|||
rdp.vn = n = (rdp.cmd0 >> 12) & 0xFF;
|
||||
rdp.v0 = v0 = ((rdp.cmd0 >> 1) & 0x7F) - n;
|
||||
|
||||
FRDP("uc2:vertex n: %d, v0: %d, from: %08lx\n", n, v0, addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc2:vertex n: %d, v0: %d, from: %08lx", n, v0, addr);
|
||||
|
||||
if (v0 < 0)
|
||||
{
|
||||
RDP_E("** ERROR: uc2:vertex v0 < 0\n");
|
||||
LRDP("** ERROR: uc2:vertex v0 < 0\n");
|
||||
WriteTrace(TraceRDP, TraceWarning, "** ERROR: uc2:vertex v0 < 0");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -172,7 +169,7 @@ static void uc2_vertex()
|
|||
v->vec[0] = ((char*)gfx.RDRAM)[(addr + i + 12) ^ 3];
|
||||
v->vec[1] = ((char*)gfx.RDRAM)[(addr + i + 13) ^ 3];
|
||||
v->vec[2] = ((char*)gfx.RDRAM)[(addr + i + 14) ^ 3];
|
||||
// FRDP("Calc light. x: %f, y: %f z: %f\n", v->vec[0], v->vec[1], v->vec[2]);
|
||||
// WriteTrace(TraceRDP, TraceDebug, "Calc light. x: %f, y: %f z: %f", v->vec[0], v->vec[1], v->vec[2]);
|
||||
// if (!(rdp.geom_mode & 0x800000))
|
||||
{
|
||||
if (rdp.geom_mode & 0x40000)
|
||||
|
@ -180,16 +177,12 @@ static void uc2_vertex()
|
|||
if (rdp.geom_mode & 0x80000)
|
||||
{
|
||||
calc_linear(v);
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP ("calc linear: v%d - u: %f, v: %f\n", i>>4, v->ou, v->ov);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "calc linear: v%d - u: %f, v: %f", i >> 4, v->ou, v->ov);
|
||||
}
|
||||
else
|
||||
{
|
||||
calc_sphere(v);
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP ("calc sphere: v%d - u: %f, v: %f\n", i>>4, v->ou, v->ov);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "calc sphere: v%d - u: %f, v: %f", i >> 4, v->ou, v->ov);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -210,9 +203,7 @@ static void uc2_vertex()
|
|||
v->g = ((uint8_t*)gfx.RDRAM)[(addr + i + 13) ^ 3];
|
||||
v->b = ((uint8_t*)gfx.RDRAM)[(addr + i + 14) ^ 3];
|
||||
}
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP ("v%d - x: %f, y: %f, z: %f, w: %f, u: %f, v: %f, f: %f, z_w: %f, r=%d, g=%d, b=%d, a=%d\n", i>>4, v->x, v->y, v->z, v->w, v->ou*rdp.tiles[rdp.cur_tile].s_scale, v->ov*rdp.tiles[rdp.cur_tile].t_scale, v->f, v->z_w, v->r, v->g, v->b, v->a);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "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", 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);
|
||||
}
|
||||
rdp.geom_mode = geom_mode;
|
||||
}
|
||||
|
@ -222,7 +213,7 @@ static void uc2_modifyvtx()
|
|||
uint8_t where = (uint8_t)((rdp.cmd0 >> 16) & 0xFF);
|
||||
uint16_t vtx = (uint16_t)((rdp.cmd0 >> 1) & 0xFFFF);
|
||||
|
||||
FRDP("uc2:modifyvtx: vtx: %d, where: 0x%02lx, val: %08lx - ", vtx, where, rdp.cmd1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc2:modifyvtx: vtx: %d, where: 0x%02lx, val: %08lx - ", vtx, where, rdp.cmd1);
|
||||
uc0_modifyvtx(where, vtx, rdp.cmd1);
|
||||
}
|
||||
|
||||
|
@ -231,7 +222,7 @@ static void uc2_culldl()
|
|||
uint16_t vStart = (uint16_t)(rdp.cmd0 & 0xFFFF) >> 1;
|
||||
uint16_t vEnd = (uint16_t)(rdp.cmd1 & 0xFFFF) >> 1;
|
||||
uint32_t cond = 0;
|
||||
FRDP("uc2:culldl start: %d, end: %d\n", vStart, vEnd);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc2:culldl start: %d, end: %d", vStart, vEnd);
|
||||
|
||||
if (vEnd < vStart) return;
|
||||
for (uint16_t i = vStart; i <= vEnd; i++)
|
||||
|
@ -254,16 +245,14 @@ static void uc2_culldl()
|
|||
return;
|
||||
//*/
|
||||
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP (" v[%d] = (%02f, %02f, %02f, 0x%02lx)\n", i, rdp.vtx[i].x, rdp.vtx[i].y, rdp.vtx[i].w, rdp.vtx[i].scr_off);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, " v[%d] = (%02f, %02f, %02f, 0x%02lx)", i, rdp.vtx[i].x, rdp.vtx[i].y, rdp.vtx[i].w, rdp.vtx[i].scr_off);
|
||||
|
||||
cond |= (~rdp.vtx[i].scr_off) & 0x1F;
|
||||
if (cond == 0x1F)
|
||||
return;
|
||||
}
|
||||
|
||||
LRDP(" - "); // specify that the enddl is not a real command
|
||||
WriteTrace(TraceRDP, TraceDebug, " - "); // specify that the enddl is not a real command
|
||||
uc0_enddl();
|
||||
}
|
||||
|
||||
|
@ -278,11 +267,11 @@ static void uc2_tri1()
|
|||
}
|
||||
if (rdp.skip_drawing)
|
||||
{
|
||||
LRDP("uc2:tri1. skipped\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc2:tri1. skipped");
|
||||
return;
|
||||
}
|
||||
|
||||
FRDP("uc2:tri1 #%d - %d, %d, %d\n", rdp.tri_n,
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc2:tri1 #%d - %d, %d, %d", rdp.tri_n,
|
||||
((rdp.cmd0 >> 17) & 0x7F),
|
||||
((rdp.cmd0 >> 9) & 0x7F),
|
||||
((rdp.cmd0 >> 1) & 0x7F));
|
||||
|
@ -318,13 +307,13 @@ static void uc2_quad()
|
|||
|
||||
if (rdp.skip_drawing)
|
||||
{
|
||||
LRDP("uc2_quad. skipped\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc2_quad. skipped");
|
||||
return;
|
||||
}
|
||||
|
||||
LRDP("uc2:quad");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc2:quad");
|
||||
|
||||
FRDP(" #%d, #%d - %d, %d, %d - %d, %d, %d\n", rdp.tri_n, rdp.tri_n + 1,
|
||||
WriteTrace(TraceRDP, TraceDebug, " #%d, #%d - %d, %d, %d - %d, %d, %d", rdp.tri_n, rdp.tri_n + 1,
|
||||
((rdp.cmd0 >> 17) & 0x7F),
|
||||
((rdp.cmd0 >> 9) & 0x7F),
|
||||
((rdp.cmd0 >> 1) & 0x7F),
|
||||
|
@ -352,7 +341,7 @@ static void uc2_line3d()
|
|||
uc6_ldtx_rect_r();
|
||||
else
|
||||
{
|
||||
FRDP("uc2:line3d #%d, #%d - %d, %d\n", rdp.tri_n, rdp.tri_n + 1,
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc2:line3d #%d, #%d - %d, %d", rdp.tri_n, rdp.tri_n + 1,
|
||||
(rdp.cmd0 >> 17) & 0x7F,
|
||||
(rdp.cmd0 >> 9) & 0x7F);
|
||||
|
||||
|
@ -374,22 +363,22 @@ static void uc2_line3d()
|
|||
|
||||
static void uc2_special3()
|
||||
{
|
||||
LRDP("uc2:special3\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc2:special3");
|
||||
}
|
||||
|
||||
static void uc2_special2()
|
||||
{
|
||||
LRDP("uc2:special2\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc2:special2");
|
||||
}
|
||||
|
||||
static void uc2_dma_io()
|
||||
{
|
||||
LRDP("uc2:dma_io\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc2:dma_io");
|
||||
}
|
||||
|
||||
static void uc2_pop_matrix()
|
||||
{
|
||||
FRDP("uc2:pop_matrix %08lx, %08lx\n", rdp.cmd0, rdp.cmd1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc2:pop_matrix %08lx, %08lx", rdp.cmd0, rdp.cmd1);
|
||||
|
||||
// Just pop the modelview matrix
|
||||
modelview_pop(rdp.cmd1 >> 6);
|
||||
|
@ -405,12 +394,12 @@ static void uc2_geom_mode()
|
|||
((rdp.cmd1 & 0x00000600) << 3) |
|
||||
((rdp.cmd1 & 0x00200000) >> 12);
|
||||
|
||||
FRDP("uc2:geom_mode c:%08lx, s:%08lx ", clr_mode, set_mode);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc2:geom_mode c:%08lx, s:%08lx ", clr_mode, set_mode);
|
||||
|
||||
rdp.geom_mode &= clr_mode;
|
||||
rdp.geom_mode |= set_mode;
|
||||
|
||||
FRDP("result:%08lx\n", rdp.geom_mode);
|
||||
WriteTrace(TraceRDP, TraceDebug, "result:%08lx", rdp.geom_mode);
|
||||
|
||||
if (rdp.geom_mode & 0x00000001) // Z-Buffer enable
|
||||
{
|
||||
|
@ -490,7 +479,7 @@ static void uc2_matrix()
|
|||
uc6_obj_rectangle_r();
|
||||
return;
|
||||
}
|
||||
LRDP("uc2:matrix\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc2:matrix");
|
||||
|
||||
DECLAREALIGN16VAR(m[4][4]);
|
||||
load_matrix(m, segoffset(rdp.cmd1));
|
||||
|
@ -499,56 +488,53 @@ static void uc2_matrix()
|
|||
switch (command)
|
||||
{
|
||||
case 0: // modelview mul nopush
|
||||
LRDP("modelview mul\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "modelview mul");
|
||||
modelview_mul(m);
|
||||
break;
|
||||
|
||||
case 1: // modelview mul push
|
||||
LRDP("modelview mul push\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "modelview mul push");
|
||||
modelview_mul_push(m);
|
||||
break;
|
||||
|
||||
case 2: // modelview load nopush
|
||||
LRDP("modelview load\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "modelview load");
|
||||
modelview_load(m);
|
||||
break;
|
||||
|
||||
case 3: // modelview load push
|
||||
LRDP("modelview load push\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "modelview load push");
|
||||
modelview_load_push(m);
|
||||
break;
|
||||
|
||||
case 4: // projection mul nopush
|
||||
case 5: // projection mul push, can't push projection
|
||||
LRDP("projection mul\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "projection mul");
|
||||
projection_mul(m);
|
||||
break;
|
||||
|
||||
case 6: // projection load nopush
|
||||
case 7: // projection load push, can't push projection
|
||||
LRDP("projection load\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "projection load");
|
||||
projection_load(m);
|
||||
break;
|
||||
|
||||
default:
|
||||
FRDP_E("Unknown matrix command, %02lx", command);
|
||||
FRDP("Unknown matrix command, %02lx", command);
|
||||
WriteTrace(TraceRDP, TraceWarning, "Unknown matrix command, %02lx", command);
|
||||
}
|
||||
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP ("{%f,%f,%f,%f}\n", m[0][0], m[0][1], m[0][2], m[0][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", m[1][0], m[1][1], m[1][2], m[1][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", m[2][0], m[2][1], m[2][2], m[2][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", m[3][0], m[3][1], m[3][2], m[3][3]);
|
||||
FRDP ("\nmodel\n{%f,%f,%f,%f}\n", rdp.model[0][0], rdp.model[0][1], rdp.model[0][2], rdp.model[0][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.model[1][0], rdp.model[1][1], rdp.model[1][2], rdp.model[1][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.model[2][0], rdp.model[2][1], rdp.model[2][2], rdp.model[2][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.model[3][0], rdp.model[3][1], rdp.model[3][2], rdp.model[3][3]);
|
||||
FRDP ("\nproj\n{%f,%f,%f,%f}\n", rdp.proj[0][0], rdp.proj[0][1], rdp.proj[0][2], rdp.proj[0][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.proj[1][0], rdp.proj[1][1], rdp.proj[1][2], rdp.proj[1][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.proj[2][0], rdp.proj[2][1], rdp.proj[2][2], rdp.proj[2][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.proj[3][0], rdp.proj[3][1], rdp.proj[3][2], rdp.proj[3][3]);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", m[0][0], m[0][1], m[0][2], m[0][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", m[1][0], m[1][1], m[1][2], m[1][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", m[2][0], m[2][1], m[2][2], m[2][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", m[3][0], m[3][1], m[3][2], m[3][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "\nmodel\n{%f,%f,%f,%f}", rdp.model[0][0], rdp.model[0][1], rdp.model[0][2], rdp.model[0][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.model[1][0], rdp.model[1][1], rdp.model[1][2], rdp.model[1][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.model[2][0], rdp.model[2][1], rdp.model[2][2], rdp.model[2][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.model[3][0], rdp.model[3][1], rdp.model[3][2], rdp.model[3][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "\nproj\n{%f,%f,%f,%f}", rdp.proj[0][0], rdp.proj[0][1], rdp.proj[0][2], rdp.proj[0][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.proj[1][0], rdp.proj[1][1], rdp.proj[1][2], rdp.proj[1][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.proj[2][0], rdp.proj[2][1], rdp.proj[2][2], rdp.proj[2][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.proj[3][0], rdp.proj[3][1], rdp.proj[3][2], rdp.proj[3][3]);
|
||||
}
|
||||
|
||||
static void uc2_moveword()
|
||||
|
@ -557,7 +543,7 @@ static void uc2_moveword()
|
|||
uint16_t offset = (uint16_t)(rdp.cmd0 & 0xFFFF);
|
||||
uint32_t data = rdp.cmd1;
|
||||
|
||||
FRDP("uc2:moveword ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc2:moveword ");
|
||||
|
||||
switch (index)
|
||||
{
|
||||
|
@ -597,14 +583,14 @@ static void uc2_moveword()
|
|||
rdp.combined[index_y][index_x + 1] = (short)(rdp.cmd1 & 0xFFFF);
|
||||
}
|
||||
|
||||
LRDP("matrix\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "matrix");
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
rdp.num_lights = data / 24;
|
||||
rdp.update |= UPDATE_LIGHTS;
|
||||
FRDP("numlights: %d\n", rdp.num_lights);
|
||||
WriteTrace(TraceRDP, TraceDebug, "numlights: %d", rdp.num_lights);
|
||||
break;
|
||||
|
||||
case 0x04:
|
||||
|
@ -613,12 +599,12 @@ static void uc2_moveword()
|
|||
rdp.clip_ratio = sqrt((float)rdp.cmd1);
|
||||
rdp.update |= UPDATE_VIEWPORT;
|
||||
}
|
||||
FRDP("mw_clip %08lx, %08lx\n", rdp.cmd0, rdp.cmd1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "mw_clip %08lx, %08lx", rdp.cmd0, rdp.cmd1);
|
||||
break;
|
||||
|
||||
case 0x06: // moveword SEGMENT
|
||||
{
|
||||
FRDP("SEGMENT %08lx -> seg%d\n", data, offset >> 2);
|
||||
WriteTrace(TraceRDP, TraceDebug, "SEGMENT %08lx -> seg%d", data, offset >> 2);
|
||||
if ((data&BMASK) < BMASK)
|
||||
rdp.segment[(offset >> 2) & 0xF] = data;
|
||||
}
|
||||
|
@ -628,7 +614,7 @@ static void uc2_moveword()
|
|||
{
|
||||
rdp.fog_multiplier = (short)(rdp.cmd1 >> 16);
|
||||
rdp.fog_offset = (short)(rdp.cmd1 & 0x0000FFFF);
|
||||
FRDP("fog: multiplier: %f, offset: %f\n", rdp.fog_multiplier, rdp.fog_offset);
|
||||
WriteTrace(TraceRDP, TraceDebug, "fog: multiplier: %f, offset: %f", rdp.fog_multiplier, rdp.fog_offset);
|
||||
|
||||
//offset must be 0 for move_fog, but it can be non zero in Nushi Zuri 64 - Shiokaze ni Notte
|
||||
//low-level display list has setothermode commands in this place, so this is obviously not move_fog.
|
||||
|
@ -640,7 +626,7 @@ static void uc2_moveword()
|
|||
case 0x0a: // moveword LIGHTCOL
|
||||
{
|
||||
int n = offset / 24;
|
||||
FRDP("lightcol light:%d, %08lx\n", n, data);
|
||||
WriteTrace(TraceRDP, TraceDebug, "lightcol light:%d, %08lx", n, data);
|
||||
|
||||
rdp.light[n].r = (float)((data >> 24) & 0xFF) / 255.0f;
|
||||
rdp.light[n].g = (float)((data >> 16) & 0xFF) / 255.0f;
|
||||
|
@ -650,17 +636,15 @@ static void uc2_moveword()
|
|||
break;
|
||||
|
||||
case 0x0c:
|
||||
RDP_E("uc2:moveword forcemtx - IGNORED\n");
|
||||
LRDP("forcemtx - IGNORED\n");
|
||||
WriteTrace(TraceRDP, TraceWarning, "uc2:moveword forcemtx - IGNORED");
|
||||
break;
|
||||
|
||||
case 0x0e:
|
||||
LRDP("perspnorm - IGNORED\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "perspnorm - IGNORED");
|
||||
break;
|
||||
|
||||
default:
|
||||
FRDP_E("uc2:moveword unknown (index: 0x%08lx, offset 0x%08lx)\n", index, offset);
|
||||
FRDP("unknown (index: 0x%08lx, offset 0x%08lx)\n", index, offset);
|
||||
WriteTrace(TraceRDP, TraceWarning, "uc2:moveword unknown (index: 0x%08lx, offset 0x%08lx)", index, offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -672,7 +656,7 @@ static void uc2_movemem()
|
|||
uint32_t addr = segoffset(rdp.cmd1);
|
||||
int ofs = (rdp.cmd0 >> 5) & 0x7F8;
|
||||
|
||||
FRDP("uc2:movemem ofs:%d ", ofs);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc2:movemem ofs:%d ", ofs);
|
||||
|
||||
switch (idx)
|
||||
{
|
||||
|
@ -699,7 +683,7 @@ static void uc2_movemem()
|
|||
|
||||
rdp.update |= UPDATE_VIEWPORT;
|
||||
|
||||
FRDP("viewport scale(%d, %d, %d), trans(%d, %d, %d), from:%08lx\n", scale_x, scale_y, scale_z,
|
||||
WriteTrace(TraceRDP, TraceDebug, "viewport scale(%d, %d, %d), trans(%d, %d, %d), from:%08lx", scale_x, scale_y, scale_z,
|
||||
trans_x, trans_y, trans_z, a);
|
||||
}
|
||||
break;
|
||||
|
@ -722,7 +706,7 @@ static void uc2_movemem()
|
|||
if (!dir_x && !dir_y)
|
||||
rdp.use_lookat = FALSE;
|
||||
}
|
||||
FRDP("lookat_%d (%f, %f, %f)\n", n, rdp.lookat[n][0], rdp.lookat[n][1], rdp.lookat[n][2]);
|
||||
WriteTrace(TraceRDP, TraceDebug, "lookat_%d (%f, %f, %f)", n, rdp.lookat[n][0], rdp.lookat[n][1], rdp.lookat[n][2]);
|
||||
return;
|
||||
}
|
||||
n -= 2;
|
||||
|
@ -751,11 +735,9 @@ static void uc2_movemem()
|
|||
rdp.light[n].ca = (float)(gfx.RDRAM[(addr + 3) ^ 3]) / 16.0f;
|
||||
rdp.light[n].la = (float)(gfx.RDRAM[(addr + 7) ^ 3]);
|
||||
rdp.light[n].qa = (float)(gfx.RDRAM[(addr + 14) ^ 3]) / 8.0f;
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP ("light: n: %d, pos: x: %f, y: %f, z: %f, ca: %f, la:%f, qa: %f\n",
|
||||
WriteTrace(TraceRDP, TraceVerbose, "light: n: %d, pos: x: %f, y: %f, z: %f, ca: %f, la:%f, qa: %f",
|
||||
n, rdp.light[n].x, rdp.light[n].y, rdp.light[n].z, rdp.light[n].ca, rdp.light[n].la, rdp.light[n].qa);
|
||||
#endif
|
||||
FRDP("light: n: %d, r: %.3f, g: %.3f, b: %.3f. dir: x: %.3f, y: %.3f, z: %.3f\n",
|
||||
WriteTrace(TraceRDP, TraceDebug, "light: n: %d, r: %.3f, g: %.3f, b: %.3f. dir: x: %.3f, y: %.3f, z: %.3f",
|
||||
n, rdp.light[n].r, rdp.light[n].g, rdp.light[n].b,
|
||||
rdp.light[n].dir_x, rdp.light[n].dir_y, rdp.light[n].dir_z);
|
||||
}
|
||||
|
@ -767,42 +749,40 @@ static void uc2_movemem()
|
|||
rdp.update &= ~UPDATE_MULT_MAT;
|
||||
load_matrix(rdp.combined, segoffset(rdp.cmd1));
|
||||
|
||||
#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[1][0], rdp.combined[1][1], rdp.combined[1][2], rdp.combined[1][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[2][0], rdp.combined[2][1], rdp.combined[2][2], rdp.combined[2][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.combined[3][0], rdp.combined[3][1], rdp.combined[3][2], rdp.combined[3][3]);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.combined[0][0], rdp.combined[0][1], rdp.combined[0][2], rdp.combined[0][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.combined[1][0], rdp.combined[1][1], rdp.combined[1][2], rdp.combined[1][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.combined[2][0], rdp.combined[2][1], rdp.combined[2][2], rdp.combined[2][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.combined[3][0], rdp.combined[3][1], rdp.combined[3][2], rdp.combined[3][3]);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
FRDP("uc2:matrix unknown (%d)\n", idx);
|
||||
FRDP("** UNKNOWN %d\n", idx);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc2:matrix unknown (%d)", idx);
|
||||
WriteTrace(TraceRDP, TraceDebug, "** UNKNOWN %d", idx);
|
||||
}
|
||||
}
|
||||
|
||||
static void uc2_load_ucode()
|
||||
{
|
||||
LRDP("uc2:load_ucode\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc2:load_ucode");
|
||||
}
|
||||
|
||||
static void uc2_rdphalf_2()
|
||||
{
|
||||
LRDP("uc2:rdphalf_2\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc2:rdphalf_2");
|
||||
}
|
||||
|
||||
static void uc2_dlist_cnt()
|
||||
{
|
||||
uint32_t addr = segoffset(rdp.cmd1) & BMASK;
|
||||
int count = rdp.cmd0 & 0x000000FF;
|
||||
FRDP("dl_count - addr: %08lx, count: %d\n", addr, count);
|
||||
WriteTrace(TraceRDP, TraceDebug, "dl_count - addr: %08lx, count: %d", addr, count);
|
||||
if (addr == 0)
|
||||
return;
|
||||
|
||||
if (rdp.pc_i >= 9) {
|
||||
RDP_E("** DL stack overflow **\n");
|
||||
LRDP("** DL stack overflow **\n");
|
||||
if (rdp.pc_i >= 9)
|
||||
{
|
||||
WriteTrace(TraceRDP, TraceWarning, "** DL stack overflow **");
|
||||
return;
|
||||
}
|
||||
rdp.pc_i++; // go to the next PC in the stack
|
||||
|
|
|
@ -61,7 +61,7 @@ static void uc3_vertex()
|
|||
|
||||
static void uc3_tri1()
|
||||
{
|
||||
FRDP("uc3:tri1 #%d - %d, %d, %d - %08lx - %08lx\n", rdp.tri_n,
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc3:tri1 #%d - %d, %d, %d - %08lx - %08lx", rdp.tri_n,
|
||||
((rdp.cmd1 >> 16) & 0xFF) / 5,
|
||||
((rdp.cmd1 >> 8) & 0xFF) / 5,
|
||||
((rdp.cmd1) & 0xFF) / 5, rdp.cmd0, rdp.cmd1);
|
||||
|
@ -77,7 +77,7 @@ static void uc3_tri1()
|
|||
|
||||
static void uc3_tri2()
|
||||
{
|
||||
FRDP("uc3:tri2 #%d, #%d - %d, %d, %d - %d, %d, %d\n", rdp.tri_n, rdp.tri_n + 1,
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc3:tri2 #%d, #%d - %d, %d, %d - %d, %d, %d", rdp.tri_n, rdp.tri_n + 1,
|
||||
((rdp.cmd0 >> 16) & 0xFF) / 5,
|
||||
((rdp.cmd0 >> 8) & 0xFF) / 5,
|
||||
((rdp.cmd0) & 0xFF) / 5,
|
||||
|
@ -99,7 +99,7 @@ static void uc3_tri2()
|
|||
|
||||
static void uc3_quad3d()
|
||||
{
|
||||
FRDP("uc3:quad3d #%d, #%d\n", rdp.tri_n, rdp.tri_n + 1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc3:quad3d #%d, #%d", rdp.tri_n, rdp.tri_n + 1);
|
||||
|
||||
VERTEX *v[6] = {
|
||||
&rdp.vtx[((rdp.cmd1 >> 24) & 0xFF) / 5],
|
||||
|
|
|
@ -53,7 +53,7 @@ static void uc4_tri1()
|
|||
int v1 = ((rdp.cmd1 >> 16) & 0xFF) / 5;
|
||||
int v2 = ((rdp.cmd1 >> 8) & 0xFF) / 5;
|
||||
int v3 = (rdp.cmd1 & 0xFF) / 5;
|
||||
FRDP("uc4:tri1 #%d - %d, %d, %d\n", rdp.tri_n,
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc4:tri1 #%d - %d, %d, %d", rdp.tri_n,
|
||||
v1, v2, v3);
|
||||
|
||||
VERTEX *v[3] = {
|
||||
|
@ -67,7 +67,7 @@ static void uc4_tri1()
|
|||
|
||||
static void uc4_quad3d()
|
||||
{
|
||||
FRDP("uc4:quad3d #%d, #%d\n", rdp.tri_n, rdp.tri_n + 1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc4:quad3d #%d, #%d", rdp.tri_n, rdp.tri_n + 1);
|
||||
|
||||
VERTEX *v[6] = {
|
||||
&rdp.vtx[((rdp.cmd1 >> 24) & 0xFF) / 5],
|
||||
|
|
|
@ -48,7 +48,7 @@ static void uc5_dma_offsets()
|
|||
dma_offset_mtx = rdp.cmd0 & 0x00FFFFFF;
|
||||
dma_offset_vtx = rdp.cmd1 & 0x00FFFFFF;
|
||||
vtx_last = 0;
|
||||
FRDP("uc5:dma_offsets - mtx: %08lx, vtx: %08lx\n", dma_offset_mtx, dma_offset_vtx);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc5:dma_offsets - mtx: %08lx, vtx: %08lx", dma_offset_mtx, dma_offset_vtx);
|
||||
}
|
||||
|
||||
static void uc5_matrix()
|
||||
|
@ -71,7 +71,7 @@ static void uc5_matrix()
|
|||
|
||||
cur_mtx = n;
|
||||
|
||||
FRDP("uc5:matrix - #%d, addr: %08lx\n", n, addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc5:matrix - #%d, addr: %08lx", n, addr);
|
||||
|
||||
if (multiply)
|
||||
{
|
||||
|
@ -87,21 +87,19 @@ static void uc5_matrix()
|
|||
}
|
||||
rdp.update |= UPDATE_MULT_MAT;
|
||||
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.dkrproj[n][0][0], rdp.dkrproj[n][0][1], rdp.dkrproj[n][0][2], rdp.dkrproj[n][0][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.dkrproj[n][1][0], rdp.dkrproj[n][1][1], rdp.dkrproj[n][1][2], rdp.dkrproj[n][1][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.dkrproj[n][2][0], rdp.dkrproj[n][2][1], rdp.dkrproj[n][2][2], rdp.dkrproj[n][2][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.dkrproj[n][3][0], rdp.dkrproj[n][3][1], rdp.dkrproj[n][3][2], rdp.dkrproj[n][3][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.dkrproj[n][0][0], rdp.dkrproj[n][0][1], rdp.dkrproj[n][0][2], rdp.dkrproj[n][0][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.dkrproj[n][1][0], rdp.dkrproj[n][1][1], rdp.dkrproj[n][1][2], rdp.dkrproj[n][1][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.dkrproj[n][2][0], rdp.dkrproj[n][2][1], rdp.dkrproj[n][2][2], rdp.dkrproj[n][2][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.dkrproj[n][3][0], rdp.dkrproj[n][3][1], rdp.dkrproj[n][3][2], rdp.dkrproj[n][3][3]);
|
||||
|
||||
for (int i=0; i<3; i++)
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
FRDP ("proj %d\n", i);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.dkrproj[i][0][0], rdp.dkrproj[i][0][1], rdp.dkrproj[i][0][2], rdp.dkrproj[i][0][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.dkrproj[i][1][0], rdp.dkrproj[i][1][1], rdp.dkrproj[i][1][2], rdp.dkrproj[i][1][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.dkrproj[i][2][0], rdp.dkrproj[i][2][1], rdp.dkrproj[i][2][2], rdp.dkrproj[i][2][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.dkrproj[i][3][0], rdp.dkrproj[i][3][1], rdp.dkrproj[i][3][2], rdp.dkrproj[i][3][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "proj %d", i);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.dkrproj[i][0][0], rdp.dkrproj[i][0][1], rdp.dkrproj[i][0][2], rdp.dkrproj[i][0][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.dkrproj[i][1][0], rdp.dkrproj[i][1][1], rdp.dkrproj[i][1][2], rdp.dkrproj[i][1][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.dkrproj[i][2][0], rdp.dkrproj[i][2][1], rdp.dkrproj[i][2][2], rdp.dkrproj[i][2][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.dkrproj[i][3][0], rdp.dkrproj[i][3][1], rdp.dkrproj[i][3][2], rdp.dkrproj[i][3][3]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void uc5_vertex()
|
||||
|
@ -128,7 +126,7 @@ static void uc5_vertex()
|
|||
vtx_last = 0;
|
||||
|
||||
int first = ((rdp.cmd0 >> 9) & 0x1F) + vtx_last;
|
||||
FRDP("uc5:vertex - addr: %08lx, first: %d, count: %d, matrix: %08lx\n", addr, first, n, cur_mtx);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc5:vertex - addr: %08lx, first: %d, count: %d, matrix: %08lx", addr, first, n, cur_mtx);
|
||||
|
||||
int prj = cur_mtx;
|
||||
|
||||
|
@ -179,9 +177,7 @@ static void uc5_vertex()
|
|||
v->a = ((uint8_t*)gfx.RDRAM)[(addr + start + 9) ^ 3];
|
||||
CalculateFog(v);
|
||||
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP ("v%d - x: %f, y: %f, z: %f, w: %f, z_w: %f, r=%d, g=%d, b=%d, a=%d\n", i, v->x, v->y, v->z, v->w, v->z_w, v->r, v->g, v->b, v->a);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "v%d - x: %f, y: %f, z: %f, w: %f, z_w: %f, r=%d, g=%d, b=%d, a=%d", i, v->x, v->y, v->z, v->w, v->z_w, v->r, v->g, v->b, v->a);
|
||||
}
|
||||
|
||||
vtx_last += n;
|
||||
|
@ -202,7 +198,7 @@ static void uc5_tridma()
|
|||
uint32_t addr = segoffset(rdp.cmd1) & BMASK;
|
||||
int num = (rdp.cmd0 & 0xFFF0) >> 4;
|
||||
//int num = ((rdp.cmd0 & 0x00F00000) >> 20) + 1; // same thing!
|
||||
FRDP("uc5:tridma #%d - addr: %08lx, count: %d\n", rdp.tri_n, addr, num);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc5:tridma #%d - addr: %08lx, count: %d", rdp.tri_n, addr, num);
|
||||
|
||||
int start, v0, v1, v2, flags;
|
||||
for (int i = 0; i < num; i++)
|
||||
|
@ -212,7 +208,7 @@ static void uc5_tridma()
|
|||
v1 = gfx.RDRAM[addr + start + 1];
|
||||
v2 = gfx.RDRAM[addr + start + 2];
|
||||
|
||||
FRDP("tri #%d - %d, %d, %d\n", rdp.tri_n, v0, v1, v2);
|
||||
WriteTrace(TraceRDP, TraceDebug, "tri #%d - %d, %d, %d", rdp.tri_n, v0, v1, v2);
|
||||
|
||||
VERTEX *v[3] = {
|
||||
&rdp.vtx[v0],
|
||||
|
@ -266,11 +262,11 @@ static void uc5_dl_in_mem()
|
|||
{
|
||||
uint32_t addr = segoffset(rdp.cmd1) & BMASK;
|
||||
int count = (rdp.cmd0 & 0x00FF0000) >> 16;
|
||||
FRDP("uc5:dl_in_mem - addr: %08lx, count: %d\n", addr, count);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc5:dl_in_mem - addr: %08lx, count: %d", addr, count);
|
||||
|
||||
if (rdp.pc_i >= 9) {
|
||||
RDP_E("** DL stack overflow **\n");
|
||||
LRDP("** DL stack overflow **\n");
|
||||
if (rdp.pc_i >= 9)
|
||||
{
|
||||
WriteTrace(TraceRDP, TraceWarning, "** DL stack overflow **");
|
||||
return;
|
||||
}
|
||||
rdp.pc_i++; // go to the next PC in the stack
|
||||
|
@ -280,14 +276,14 @@ static void uc5_dl_in_mem()
|
|||
|
||||
static void uc5_moveword()
|
||||
{
|
||||
LRDP("uc5:moveword ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc5:moveword ");
|
||||
|
||||
// Find which command this is (lowest byte of cmd0)
|
||||
switch (rdp.cmd0 & 0xFF)
|
||||
{
|
||||
case 0x02: // moveword matrix 2 billboard
|
||||
billboarding = (rdp.cmd1 & 1);
|
||||
FRDP("matrix billboard - %s\n", str_offon[billboarding]);
|
||||
WriteTrace(TraceRDP, TraceDebug, "matrix billboard - %s", str_offon[billboarding]);
|
||||
break;
|
||||
|
||||
case 0x04: // clip (verified same)
|
||||
|
@ -296,11 +292,11 @@ static void uc5_moveword()
|
|||
rdp.clip_ratio = sqrt((float)rdp.cmd1);
|
||||
rdp.update |= UPDATE_VIEWPORT;
|
||||
}
|
||||
FRDP("clip %08lx, %08lx\n", rdp.cmd0, rdp.cmd1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "clip %08lx, %08lx", rdp.cmd0, rdp.cmd1);
|
||||
break;
|
||||
|
||||
case 0x06: // segment (verified same)
|
||||
FRDP("segment: %08lx -> seg%d\n", rdp.cmd1, (rdp.cmd0 >> 10) & 0x0F);
|
||||
WriteTrace(TraceRDP, TraceDebug, "segment: %08lx -> seg%d", rdp.cmd1, (rdp.cmd0 >> 10) & 0x0F);
|
||||
rdp.segment[(rdp.cmd0 >> 10) & 0x0F] = rdp.cmd1;
|
||||
break;
|
||||
|
||||
|
@ -308,24 +304,24 @@ static void uc5_moveword()
|
|||
{
|
||||
rdp.fog_multiplier = (short)(rdp.cmd1 >> 16);
|
||||
rdp.fog_offset = (short)(rdp.cmd1 & 0x0000FFFF);
|
||||
FRDP("fog: multiplier: %f, offset: %f\n", rdp.fog_multiplier, rdp.fog_offset);
|
||||
WriteTrace(TraceRDP, TraceDebug, "fog: multiplier: %f, offset: %f", rdp.fog_multiplier, rdp.fog_offset);
|
||||
// rdp.update |= UPDATE_FOG_ENABLED;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x0a: // moveword matrix select
|
||||
cur_mtx = (rdp.cmd1 >> 6) & 3;
|
||||
FRDP("matrix select - mtx: %d\n", cur_mtx);
|
||||
WriteTrace(TraceRDP, TraceDebug, "matrix select - mtx: %d", cur_mtx);
|
||||
break;
|
||||
|
||||
default:
|
||||
FRDP("(unknown) %02lx - IGNORED\n", rdp.cmd0 & 0xFF);
|
||||
WriteTrace(TraceRDP, TraceDebug, "(unknown) %02lx - IGNORED", rdp.cmd0 & 0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
static void uc5_setgeometrymode()
|
||||
{
|
||||
FRDP("uc0:setgeometrymode %08lx\n", rdp.cmd1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc0:setgeometrymode %08lx", rdp.cmd1);
|
||||
|
||||
rdp.geom_mode |= rdp.cmd1;
|
||||
|
||||
|
@ -351,7 +347,7 @@ static void uc5_setgeometrymode()
|
|||
|
||||
static void uc5_cleargeometrymode()
|
||||
{
|
||||
FRDP("uc0:cleargeometrymode %08lx\n", rdp.cmd1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc0:cleargeometrymode %08lx", rdp.cmd1);
|
||||
|
||||
rdp.geom_mode &= (~rdp.cmd1);
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ static float set_sprite_combine_mode()
|
|||
{
|
||||
Z = rdp.prim_depth;
|
||||
}
|
||||
FRDP("prim_depth = %d, prim_dz = %d\n", rdp.prim_depth, rdp.prim_dz);
|
||||
WriteTrace(TraceRDP, TraceDebug, "prim_depth = %d, prim_dz = %d", rdp.prim_depth, rdp.prim_dz);
|
||||
Z = ScaleZ(Z);
|
||||
|
||||
if (rdp.othermode_l & 0x00000400)
|
||||
|
@ -78,7 +78,7 @@ static float set_sprite_combine_mode()
|
|||
}
|
||||
else
|
||||
{
|
||||
LRDP("z compare not used, using 0\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "z compare not used, using 0");
|
||||
}
|
||||
|
||||
grCullMode(GR_CULL_DISABLE);
|
||||
|
@ -250,7 +250,7 @@ void DrawDepthImage(const DRAWIMAGE & d)
|
|||
return;
|
||||
if (d.imageH > d.imageW)
|
||||
return;
|
||||
LRDP("Depth image write\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Depth image write");
|
||||
if (fb_hwfbe_enabled)
|
||||
{
|
||||
DrawHiresDepthImage(d);
|
||||
|
@ -338,7 +338,7 @@ void DrawImage(DRAWIMAGE & d)
|
|||
line = 16;
|
||||
break;
|
||||
default:
|
||||
FRDP("DrawImage. unknown image size: %d\n", d.imageSiz);
|
||||
WriteTrace(TraceRDP, TraceDebug, "DrawImage. unknown image size: %d", d.imageSiz);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -567,7 +567,7 @@ void DrawImage(DRAWIMAGE & d)
|
|||
else
|
||||
{
|
||||
rdp.tri_n += 2;
|
||||
LRDP("Clipped!\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Clipped!");
|
||||
}
|
||||
|
||||
// increment whatever caused this split
|
||||
|
@ -606,7 +606,7 @@ void DrawHiresImage(DRAWIMAGE & d, int screensize = FALSE)
|
|||
rdp.tbuff_tex = &(rdp.texbufs[rdp.cur_tex_buf ^ 1].images[0]);
|
||||
else if (rdp.tbuff_tex == 0)
|
||||
return;
|
||||
FRDP("DrawHiresImage. fb format=%d\n", rdp.tbuff_tex->info.format);
|
||||
WriteTrace(TraceRDP, TraceDebug, "DrawHiresImage. fb format=%d", rdp.tbuff_tex->info.format);
|
||||
|
||||
setTBufTex(rdp.tbuff_tex->t_mem, rdp.tbuff_tex->width << rdp.tbuff_tex->size >> 1);
|
||||
|
||||
|
@ -737,11 +737,11 @@ static void uc6_read_background_data(DRAWIMAGE & d, bool bReadScale)
|
|||
int imageYorig = ((int *)gfx.RDRAM)[(addr + 16) >> 1] >> 5;
|
||||
rdp.last_bg = d.imagePtr;
|
||||
|
||||
FRDP("imagePtr: %08lx\n", d.imagePtr);
|
||||
FRDP("frameX: %f, frameW: %d, frameY: %f, frameH: %d\n", d.frameX, d.frameW, d.frameY, d.frameH);
|
||||
FRDP("imageX: %d, imageW: %d, imageY: %d, imageH: %d\n", d.imageX, d.imageW, d.imageY, d.imageH);
|
||||
FRDP("imageYorig: %d, scaleX: %f, scaleY: %f\n", imageYorig, d.scaleX, d.scaleY);
|
||||
FRDP("imageFmt: %d, imageSiz: %d, imagePal: %d, imageFlip: %d\n", d.imageFmt, d.imageSiz, d.imagePal, d.flipX);
|
||||
WriteTrace(TraceRDP, TraceDebug, "imagePtr: %08lx", d.imagePtr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "frameX: %f, frameW: %d, frameY: %f, frameH: %d", d.frameX, d.frameW, d.frameY, d.frameH);
|
||||
WriteTrace(TraceRDP, TraceDebug, "imageX: %d, imageW: %d, imageY: %d, imageH: %d", d.imageX, d.imageW, d.imageY, d.imageH);
|
||||
WriteTrace(TraceRDP, TraceDebug, "imageYorig: %d, scaleX: %f, scaleY: %f", imageYorig, d.scaleX, d.scaleY);
|
||||
WriteTrace(TraceRDP, TraceDebug, "imageFmt: %d, imageSiz: %d, imagePal: %d, imageFlip: %d", d.imageFmt, d.imageSiz, d.imagePal, d.flipX);
|
||||
}
|
||||
|
||||
static void uc6_bg(bool bg_1cyc)
|
||||
|
@ -750,10 +750,10 @@ static void uc6_bg(bool bg_1cyc)
|
|||
const char *strFuncName = bg_1cyc ? strFuncNames[0] : strFuncNames[1];
|
||||
if (rdp.skip_drawing)
|
||||
{
|
||||
FRDP("%s skipped\n", strFuncName);
|
||||
WriteTrace(TraceRDP, TraceDebug, "%s skipped", strFuncName);
|
||||
return;
|
||||
}
|
||||
FRDP("%s #%d, #%d\n", strFuncName, rdp.tri_n, rdp.tri_n + 1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "%s #%d, #%d", strFuncName, rdp.tri_n, rdp.tri_n + 1);
|
||||
|
||||
DRAWIMAGE d;
|
||||
uc6_read_background_data(d, bg_1cyc);
|
||||
|
@ -770,7 +770,7 @@ static void uc6_bg(bool bg_1cyc)
|
|||
DrawImage(d);
|
||||
else
|
||||
{
|
||||
FRDP("%s skipped\n", strFuncName);
|
||||
WriteTrace(TraceRDP, TraceDebug, "%s skipped", strFuncName);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1008,10 +1008,10 @@ static void uc6_read_object_data(DRAWOBJECT & d)
|
|||
if (d.imageH < 0)
|
||||
d.imageH = (short)rdp.scissor_o.lr_y - (short)d.objY - d.imageH;
|
||||
|
||||
FRDP("#%d, #%d\n"
|
||||
"objX: %f, scaleW: %f, imageW: %d\n"
|
||||
"objY: %f, scaleH: %f, imageH: %d\n"
|
||||
"size: %d, format: %d\n", rdp.tri_n, rdp.tri_n + 1,
|
||||
WriteTrace(TraceRDP, TraceDebug, "#%d, #%d"
|
||||
"objX: %f, scaleW: %f, imageW: %d"
|
||||
"objY: %f, scaleH: %f, imageH: %d"
|
||||
"size: %d, format: %d", rdp.tri_n, rdp.tri_n + 1,
|
||||
d.objX, d.scaleW, d.imageW, d.objY, d.scaleH, d.imageH, d.imageSiz, d.imageFmt);
|
||||
}
|
||||
|
||||
|
@ -1042,18 +1042,18 @@ static void uc6_init_tile(const DRAWOBJECT & d)
|
|||
|
||||
static void uc6_obj_rectangle()
|
||||
{
|
||||
LRDP("uc6:obj_rectangle ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc6:obj_rectangle ");
|
||||
DRAWOBJECT d;
|
||||
uc6_read_object_data(d);
|
||||
|
||||
if (d.imageAdrs > 4096)
|
||||
{
|
||||
FRDP("tmem: %08lx is out of bounds! return\n", d.imageAdrs);
|
||||
WriteTrace(TraceRDP, TraceDebug, "tmem: %08lx is out of bounds! return", d.imageAdrs);
|
||||
return;
|
||||
}
|
||||
if (!rdp.s2dex_tex_loaded)
|
||||
{
|
||||
LRDP("Texture was not loaded! return\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Texture was not loaded! return");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1111,7 +1111,7 @@ static void uc6_obj_rectangle()
|
|||
|
||||
static void uc6_obj_sprite()
|
||||
{
|
||||
LRDP("uc6:obj_sprite ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc6:obj_sprite ");
|
||||
DRAWOBJECT d;
|
||||
uc6_read_object_data(d);
|
||||
uc6_init_tile(d);
|
||||
|
@ -1150,7 +1150,7 @@ static void uc6_obj_sprite()
|
|||
ul_v = 0.5f;
|
||||
|
||||
// Make the vertices
|
||||
// FRDP("scale_x: %f, scale_y: %f\n", rdp.cur_cache[0]->scale_x, rdp.cur_cache[0]->scale_y);
|
||||
// WriteTrace(TraceRDP, TraceDebug, "scale_x: %f, scale_y: %f", rdp.cur_cache[0]->scale_x, rdp.cur_cache[0]->scale_y);
|
||||
|
||||
VERTEX v[4] = {
|
||||
{ ul_x, ul_y, Z, 1, ul_u, ul_v },
|
||||
|
@ -1172,7 +1172,7 @@ static void uc6_obj_sprite()
|
|||
|
||||
static void uc6_obj_movemem()
|
||||
{
|
||||
LRDP("uc6:obj_movemem\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc6:obj_movemem");
|
||||
|
||||
int index = rdp.cmd0 & 0xFFFF;
|
||||
uint32_t addr = segoffset(rdp.cmd1) >> 1;
|
||||
|
@ -1187,7 +1187,7 @@ static void uc6_obj_movemem()
|
|||
mat_2d.BaseScaleX = ((uint16_t*)gfx.RDRAM)[(addr + 10) ^ 1] / 1024.0f;
|
||||
mat_2d.BaseScaleY = ((uint16_t*)gfx.RDRAM)[(addr + 11) ^ 1] / 1024.0f;
|
||||
|
||||
FRDP("mat_2d\nA: %f, B: %f, c: %f, D: %f\nX: %f, Y: %f\nBaseScaleX: %f, BaseScaleY: %f\n",
|
||||
WriteTrace(TraceRDP, TraceDebug, "mat_2d\nA: %f, B: %f, c: %f, D: %f\nX: %f, Y: %f\nBaseScaleX: %f, BaseScaleY: %f",
|
||||
mat_2d.A, mat_2d.B, mat_2d.C, mat_2d.D, mat_2d.X, mat_2d.Y, mat_2d.BaseScaleX, mat_2d.BaseScaleY);
|
||||
}
|
||||
else if (index == 2) { // movemem submatrix
|
||||
|
@ -1196,21 +1196,19 @@ static void uc6_obj_movemem()
|
|||
mat_2d.BaseScaleX = ((uint16_t*)gfx.RDRAM)[(addr + 2) ^ 1] / 1024.0f;
|
||||
mat_2d.BaseScaleY = ((uint16_t*)gfx.RDRAM)[(addr + 3) ^ 1] / 1024.0f;
|
||||
|
||||
FRDP("submatrix\nX: %f, Y: %f\nBaseScaleX: %f, BaseScaleY: %f\n",
|
||||
WriteTrace(TraceRDP, TraceDebug, "submatrix\nX: %f, Y: %f\nBaseScaleX: %f, BaseScaleY: %f",
|
||||
mat_2d.X, mat_2d.Y, mat_2d.BaseScaleX, mat_2d.BaseScaleY);
|
||||
}
|
||||
}
|
||||
|
||||
static void uc6_select_dl()
|
||||
{
|
||||
LRDP("uc6:select_dl\n");
|
||||
RDP_E("uc6:select_dl\n");
|
||||
WriteTrace(TraceRDP, TraceWarning, "uc6:select_dl");
|
||||
}
|
||||
|
||||
static void uc6_obj_rendermode()
|
||||
{
|
||||
LRDP("uc6:obj_rendermode\n");
|
||||
RDP_E("uc6:obj_rendermode\n");
|
||||
WriteTrace(TraceRDP, TraceWarning, "uc6:obj_rendermode");
|
||||
}
|
||||
|
||||
static uint16_t uc6_yuv_to_rgba(uint8_t y, uint8_t u, uint8_t v)
|
||||
|
@ -1237,7 +1235,7 @@ static uint16_t uc6_yuv_to_rgba(uint8_t y, uint8_t u, uint8_t v)
|
|||
|
||||
static void uc6_DrawYUVImageToFrameBuffer(uint16_t ul_x, uint16_t ul_y, uint16_t lr_x, uint16_t lr_y)
|
||||
{
|
||||
FRDP("uc6:DrawYUVImageToFrameBuffer ul_x%d, ul_y%d, lr_x%d, lr_y%d\n", ul_x, ul_y, lr_x, lr_y);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc6:DrawYUVImageToFrameBuffer ul_x%d, ul_y%d, lr_x%d, lr_y%d", ul_x, ul_y, lr_x, lr_y);
|
||||
uint32_t ci_width = rdp.ci_width;
|
||||
uint32_t ci_height = rdp.ci_lower_bound;
|
||||
if (ul_x >= ci_width)
|
||||
|
@ -1274,7 +1272,7 @@ static void uc6_DrawYUVImageToFrameBuffer(uint16_t ul_x, uint16_t ul_y, uint16_t
|
|||
|
||||
static void uc6_obj_rectangle_r()
|
||||
{
|
||||
LRDP("uc6:obj_rectangle_r ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc6:obj_rectangle_r ");
|
||||
DRAWOBJECT d;
|
||||
uc6_read_object_data(d);
|
||||
|
||||
|
@ -1345,7 +1343,7 @@ static void uc6_obj_rectangle_r()
|
|||
|
||||
static void uc6_obj_loadtxtr()
|
||||
{
|
||||
LRDP("uc6:obj_loadtxtr ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc6:obj_loadtxtr ");
|
||||
rdp.s2dex_tex_loaded = TRUE;
|
||||
rdp.update |= UPDATE_TEXTURE;
|
||||
|
||||
|
@ -1357,7 +1355,7 @@ static void uc6_obj_loadtxtr()
|
|||
uint16_t phead = ((uint16_t *)gfx.RDRAM)[(addr + 4) ^ 1] - 256; // 4
|
||||
uint16_t pnum = ((uint16_t *)gfx.RDRAM)[(addr + 5) ^ 1] + 1; // 5
|
||||
|
||||
FRDP("palette addr: %08lx, start: %d, num: %d\n", image, phead, pnum);
|
||||
WriteTrace(TraceRDP, TraceDebug, "palette addr: %08lx, start: %d, num: %d", image, phead, pnum);
|
||||
load_palette(image, phead, pnum);
|
||||
}
|
||||
else if (type == 0x00001033) { // TxtrBlock
|
||||
|
@ -1366,7 +1364,7 @@ static void uc6_obj_loadtxtr()
|
|||
uint16_t tsize = ((uint16_t *)gfx.RDRAM)[(addr + 5) ^ 1]; // 5
|
||||
uint16_t tline = ((uint16_t *)gfx.RDRAM)[(addr + 6) ^ 1]; // 6
|
||||
|
||||
FRDP("addr: %08lx, tmem: %08lx, size: %d\n", image, tmem, tsize);
|
||||
WriteTrace(TraceRDP, TraceDebug, "addr: %08lx, tmem: %08lx, size: %d", image, tmem, tsize);
|
||||
rdp.timg.addr = image;
|
||||
rdp.timg.width = 1;
|
||||
rdp.timg.size = 1;
|
||||
|
@ -1384,7 +1382,7 @@ static void uc6_obj_loadtxtr()
|
|||
uint16_t twidth = ((uint16_t *)gfx.RDRAM)[(addr + 5) ^ 1]; // 5
|
||||
uint16_t theight = ((uint16_t *)gfx.RDRAM)[(addr + 6) ^ 1]; // 6
|
||||
|
||||
FRDP("tile addr: %08lx, tmem: %08lx, twidth: %d, theight: %d\n", image, tmem, twidth, theight);
|
||||
WriteTrace(TraceRDP, TraceDebug, "tile addr: %08lx, tmem: %08lx, twidth: %d, theight: %d", image, tmem, twidth, theight);
|
||||
|
||||
int line = (twidth + 1) >> 2;
|
||||
|
||||
|
@ -1403,14 +1401,13 @@ static void uc6_obj_loadtxtr()
|
|||
}
|
||||
else
|
||||
{
|
||||
FRDP("UNKNOWN (0x%08lx)\n", type);
|
||||
FRDP_E("uc6:obj_loadtxtr UNKNOWN (0x%08lx)\n", type);
|
||||
WriteTrace(TraceRDP, TraceWarning, "uc6:obj_loadtxtr UNKNOWN (0x%08lx)", type);
|
||||
}
|
||||
}
|
||||
|
||||
static void uc6_obj_ldtx_sprite()
|
||||
{
|
||||
LRDP("uc6:obj_ldtx_sprite\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc6:obj_ldtx_sprite");
|
||||
|
||||
uint32_t addr = rdp.cmd1;
|
||||
uc6_obj_loadtxtr();
|
||||
|
@ -1420,7 +1417,7 @@ static void uc6_obj_ldtx_sprite()
|
|||
|
||||
static void uc6_obj_ldtx_rect()
|
||||
{
|
||||
LRDP("uc6:obj_ldtx_rect\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc6:obj_ldtx_rect");
|
||||
|
||||
uint32_t addr = rdp.cmd1;
|
||||
uc6_obj_loadtxtr();
|
||||
|
@ -1430,7 +1427,7 @@ static void uc6_obj_ldtx_rect()
|
|||
|
||||
static void uc6_ldtx_rect_r()
|
||||
{
|
||||
LRDP("uc6:ldtx_rect_r\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc6:ldtx_rect_r");
|
||||
|
||||
uint32_t addr = rdp.cmd1;
|
||||
uc6_obj_loadtxtr();
|
||||
|
@ -1440,8 +1437,7 @@ static void uc6_ldtx_rect_r()
|
|||
|
||||
static void uc6_loaducode()
|
||||
{
|
||||
LRDP("uc6:load_ucode\n");
|
||||
RDP_E("uc6:load_ucode\n");
|
||||
WriteTrace(TraceRDP, TraceWarning, "uc6:load_ucode");
|
||||
|
||||
// copy the microcode data
|
||||
uint32_t addr = segoffset(rdp.cmd1);
|
||||
|
@ -1458,7 +1454,7 @@ void uc6_sprite2d()
|
|||
if ((cmd0 >> 24) != 0xBE)
|
||||
return;
|
||||
|
||||
FRDP("uc6:uc6_sprite2d #%d, #%d\n", rdp.tri_n, rdp.tri_n + 1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc6:uc6_sprite2d #%d, #%d", rdp.tri_n, rdp.tri_n + 1);
|
||||
uint32_t addr = segoffset(rdp.cmd1) >> 1;
|
||||
DRAWIMAGE d;
|
||||
|
||||
|
@ -1531,11 +1527,11 @@ void uc6_sprite2d()
|
|||
stride *= scaleY;
|
||||
d.scaleY = 1.0f;
|
||||
}
|
||||
FRDP("imagePtr: %08lx\n", d.imagePtr);
|
||||
FRDP("frameX: %f, frameW: %d, frameY: %f, frameH: %d\n", d.frameX, d.frameW, d.frameY, d.frameH);
|
||||
FRDP("imageX: %d, imageW: %d, imageY: %d, imageH: %d\n", d.imageX, d.imageW, d.imageY, d.imageH);
|
||||
FRDP("imageFmt: %d, imageSiz: %d, imagePal: %d, imageStride: %d\n", d.imageFmt, d.imageSiz, d.imagePal, stride);
|
||||
FRDP("scaleX: %f, scaleY: %f\n", d.scaleX, d.scaleY);
|
||||
WriteTrace(TraceRDP, TraceDebug, "imagePtr: %08lx", d.imagePtr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "frameX: %f, frameW: %d, frameY: %f, frameH: %d", d.frameX, d.frameW, d.frameY, d.frameH);
|
||||
WriteTrace(TraceRDP, TraceDebug, "imageX: %d, imageW: %d, imageY: %d, imageH: %d", d.imageX, d.imageW, d.imageY, d.imageH);
|
||||
WriteTrace(TraceRDP, TraceDebug, "imageFmt: %d, imageSiz: %d, imagePal: %d, imageStride: %d", d.imageFmt, d.imageSiz, d.imagePal, stride);
|
||||
WriteTrace(TraceRDP, TraceDebug, "scaleX: %f, scaleY: %f", d.scaleX, d.scaleY);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -47,7 +47,7 @@ uint32_t pd_col_addr = 0;
|
|||
|
||||
static void uc7_colorbase()
|
||||
{
|
||||
LRDP("uc7_colorbase\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc7_colorbase");
|
||||
pd_col_addr = segoffset(rdp.cmd1);
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ static void uc7_vertex()
|
|||
rdp.v0 = v0 = (rdp.cmd0 & 0x0F0000) >> 16;
|
||||
rdp.vn = n = ((rdp.cmd0 & 0xF00000) >> 20) + 1;
|
||||
|
||||
FRDP("uc7:vertex n: %d, v0: %d, from: %08lx\n", n, v0, addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc7:vertex n: %d, v0: %d, from: %08lx", n, v0, addr);
|
||||
|
||||
vtx_uc7 *vertex = (vtx_uc7 *)&gfx.RDRAM[addr];
|
||||
|
||||
|
@ -106,9 +106,7 @@ static void uc7_vertex()
|
|||
v->ov = (float)vertex->t;
|
||||
v->uv_scaled = 0;
|
||||
|
||||
#ifdef EXTREME_LOGGING
|
||||
// FRDP ("before: v%d - x: %f, y: %f, z: %f, flags: %04lx, ou: %f, ov: %f\n", i>>4, x, y, z, v->flags, v->ou, v->ov);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "before: v%d - x: %f, y: %f, z: %f, flags: %04lx, ou: %f, ov: %f", i >> 4, x, y, z, v->flags, v->ou, v->ov);
|
||||
|
||||
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];
|
||||
|
@ -145,31 +143,25 @@ static void uc7_vertex()
|
|||
if (rdp.geom_mode & 0x80000)
|
||||
{
|
||||
calc_linear(v);
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP("calc linear: v%d - u: %f, v: %f\n", i >> 4, v->ou, v->ov);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "calc linear: v%d - u: %f, v: %f", i >> 4, v->ou, v->ov);
|
||||
}
|
||||
else if (rdp.geom_mode & 0x40000)
|
||||
{
|
||||
calc_sphere(v);
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP("calc sphere: v%d - u: %f, v: %f\n", i >> 4, v->ou, v->ov);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "calc sphere: v%d - u: %f, v: %f", i >> 4, v->ou, v->ov);
|
||||
}
|
||||
|
||||
NormalizeVector(v->vec);
|
||||
|
||||
calc_light(v);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
v->r = color[3];
|
||||
v->g = color[2];
|
||||
v->b = color[1];
|
||||
}
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP("v%d - x: %f, y: %f, z: %f, w: %f, u: %f, v: %f\n", i >> 4, v->x, v->y, v->z, v->w, v->ou, v->ov);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "v%d - x: %f, y: %f, z: %f, w: %f, u: %f, v: %f", i >> 4, v->x, v->y, v->z, v->w, v->ou, v->ov);
|
||||
vertex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,12 +59,11 @@ static void uc8_vertex()
|
|||
rdp.vn = n = (rdp.cmd0 >> 12) & 0xFF;
|
||||
rdp.v0 = v0 = ((rdp.cmd0 >> 1) & 0x7F) - n;
|
||||
|
||||
FRDP("uc8:vertex n: %d, v0: %d, from: %08lx\n", n, v0, addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc8:vertex n: %d, v0: %d, from: %08lx", n, v0, addr);
|
||||
|
||||
if (v0 < 0)
|
||||
{
|
||||
RDP_E("** ERROR: uc2:vertex v0 < 0\n");
|
||||
LRDP("** ERROR: uc2:vertex v0 < 0\n");
|
||||
WriteTrace(TraceRDP, TraceWarning, "** ERROR: uc2:vertex v0 < 0");
|
||||
return;
|
||||
}
|
||||
//*
|
||||
|
@ -78,9 +77,7 @@ static void uc8_vertex()
|
|||
{
|
||||
InverseTransformVector(&rdp.light[l].dir_x, rdp.light_vector[l], rdp.model);
|
||||
NormalizeVector(rdp.light_vector[l]);
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP("light_vector[%d] x: %f, y: %f, z: %f\n", l, rdp.light_vector[l][0], rdp.light_vector[l][1], rdp.light_vector[l][2]);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "light_vector[%d] x: %f, y: %f, z: %f", l, rdp.light_vector[l][0], rdp.light_vector[l][1], rdp.light_vector[l][2]);
|
||||
}
|
||||
}
|
||||
//*/
|
||||
|
@ -96,17 +93,13 @@ static void uc8_vertex()
|
|||
v->uv_scaled = 0;
|
||||
v->a = ((uint8_t*)gfx.RDRAM)[(addr + i + 15) ^ 3];
|
||||
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP ("before v%d - x: %f, y: %f, z: %f\n", i>>4, x, y, z);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "before v%d - x: %f, y: %f, z: %f", i >> 4, x, y, z);
|
||||
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->z = x*rdp.combined[0][2] + y*rdp.combined[1][2] + z*rdp.combined[2][2] + rdp.combined[3][2];
|
||||
v->w = x*rdp.combined[0][3] + y*rdp.combined[1][3] + z*rdp.combined[2][3] + rdp.combined[3][3];
|
||||
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP ("v%d - x: %f, y: %f, z: %f, w: %f, u: %f, v: %f, flags: %d\n", i>>4, v->x, v->y, v->z, v->w, v->ou, v->ov, v->flags);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "v%d - x: %f, y: %f, z: %f, w: %f, u: %f, v: %f, flags: %d", i >> 4, v->x, v->y, v->z, v->w, v->ou, v->ov, v->flags);
|
||||
|
||||
if (fabs(v->w) < 0.001) v->w = 0.001f;
|
||||
v->oow = 1.0f / v->w;
|
||||
|
@ -128,9 +121,7 @@ static void uc8_vertex()
|
|||
v->r = ((uint8_t*)gfx.RDRAM)[(addr + i + 12) ^ 3];
|
||||
v->g = ((uint8_t*)gfx.RDRAM)[(addr + i + 13) ^ 3];
|
||||
v->b = ((uint8_t*)gfx.RDRAM)[(addr + i + 14) ^ 3];
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP ("r: %02lx, g: %02lx, b: %02lx, a: %02lx\n", v->r, v->g, v->b, v->a);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "r: %02lx, g: %02lx, b: %02lx, a: %02lx", v->r, v->g, v->b, v->a);
|
||||
|
||||
if ((rdp.geom_mode & 0x00020000))
|
||||
{
|
||||
|
@ -142,21 +133,16 @@ static void uc8_vertex()
|
|||
if (rdp.geom_mode & 0x80000)
|
||||
{
|
||||
calc_linear(v);
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP ("calc linear: v%d - u: %f, v: %f\n", i>>4, v->ou, v->ov);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "calc linear: v%d - u: %f, v: %f", i >> 4, v->ou, v->ov);
|
||||
}
|
||||
else if (rdp.geom_mode & 0x40000)
|
||||
{
|
||||
calc_sphere(v);
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP ("calc sphere: v%d - u: %f, v: %f\n", i>>4, v->ou, v->ov);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "calc sphere: v%d - u: %f, v: %f", i >> 4, v->ou, v->ov);
|
||||
}
|
||||
// FRDP("calc light. r: 0x%02lx, g: 0x%02lx, b: 0x%02lx, nx: %.3f, ny: %.3f, nz: %.3f\n", v->r, v->g, v->b, v->vec[0], v->vec[1], v->vec[2]);
|
||||
FRDP("v[%d] calc light. r: 0x%02lx, g: 0x%02lx, b: 0x%02lx\n", i >> 4, v->r, v->g, v->b);
|
||||
WriteTrace(TraceRDP, TraceDebug, "v[%d] calc light. r: 0x%02lx, g: 0x%02lx, b: 0x%02lx", i >> 4, v->r, v->g, v->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]);
|
||||
WriteTrace(TraceRDP, TraceDebug, "ambient light. r: %f, g: %f, b: %f", color[0], color[1], color[2]);
|
||||
float light_intensity = 0.0f;
|
||||
uint32_t l;
|
||||
if (rdp.geom_mode & 0x00400000)
|
||||
|
@ -167,7 +153,7 @@ static void uc8_vertex()
|
|||
if (!rdp.light[l].nonblack)
|
||||
continue;
|
||||
light_intensity = DotProduct(rdp.light_vector[l], v->vec);
|
||||
FRDP("light %d, intensity : %f\n", l, light_intensity);
|
||||
WriteTrace(TraceRDP, TraceDebug, "light %d, intensity : %f", l, light_intensity);
|
||||
if (light_intensity < 0.0f)
|
||||
continue;
|
||||
//*
|
||||
|
@ -181,23 +167,23 @@ static void uc8_vertex()
|
|||
float p_i = rdp.light[l].ca / len;
|
||||
if (p_i > 1.0f) p_i = 1.0f;
|
||||
light_intensity *= p_i;
|
||||
FRDP("light %d, len: %f, p_intensity : %f\n", l, len, p_i);
|
||||
WriteTrace(TraceRDP, TraceDebug, "light %d, len: %f, p_intensity : %f", l, len, p_i);
|
||||
}
|
||||
//*/
|
||||
color[0] += rdp.light[l].r * light_intensity;
|
||||
color[1] += rdp.light[l].g * light_intensity;
|
||||
color[2] += rdp.light[l].b * light_intensity;
|
||||
FRDP("light %d r: %f, g: %f, b: %f\n", l, color[0], color[1], color[2]);
|
||||
WriteTrace(TraceRDP, TraceDebug, "light %d r: %f, g: %f, b: %f", l, color[0], color[1], color[2]);
|
||||
}
|
||||
light_intensity = DotProduct(rdp.light_vector[l], v->vec);
|
||||
FRDP("light %d, intensity : %f\n", l, light_intensity);
|
||||
WriteTrace(TraceRDP, TraceDebug, "light %d, intensity : %f", l, light_intensity);
|
||||
if (light_intensity > 0.0f)
|
||||
{
|
||||
color[0] += rdp.light[l].r * light_intensity;
|
||||
color[1] += rdp.light[l].g * light_intensity;
|
||||
color[2] += rdp.light[l].b * light_intensity;
|
||||
}
|
||||
FRDP("light %d r: %f, g: %f, b: %f\n", l, color[0], color[1], color[2]);
|
||||
WriteTrace(TraceRDP, TraceDebug, "light %d r: %f, g: %f, b: %f", l, color[0], color[1], color[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -212,11 +198,11 @@ static void uc8_vertex()
|
|||
float len = (vx*vx + vy*vy + vz*vz + vw*vw) / 65536.0f;
|
||||
light_intensity = rdp.light[l].ca / len;
|
||||
if (light_intensity > 1.0f) light_intensity = 1.0f;
|
||||
FRDP("light %d, p_intensity : %f\n", l, light_intensity);
|
||||
WriteTrace(TraceRDP, TraceDebug, "light %d, p_intensity : %f", l, light_intensity);
|
||||
color[0] += rdp.light[l].r * light_intensity;
|
||||
color[1] += rdp.light[l].g * light_intensity;
|
||||
color[2] += rdp.light[l].b * light_intensity;
|
||||
//FRDP("light %d r: %f, g: %f, b: %f\n", l, color[0], color[1], color[2]);
|
||||
//WriteTrace(TraceRDP, TraceDebug, "light %d r: %f, g: %f, b: %f", l, color[0], color[1], color[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,9 +212,7 @@ static void uc8_vertex()
|
|||
v->r = (uint8_t)(((float)v->r)*color[0]);
|
||||
v->g = (uint8_t)(((float)v->g)*color[1]);
|
||||
v->b = (uint8_t)(((float)v->b)*color[2]);
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP("color after light: r: 0x%02lx, g: 0x%02lx, b: 0x%02lx\n", v->r, v->g, v->b);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "color after light: r: 0x%02lx, g: 0x%02lx, b: 0x%02lx", v->r, v->g, v->b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -239,7 +223,7 @@ static void uc8_moveword()
|
|||
uint16_t offset = (uint16_t)(rdp.cmd0 & 0xFFFF);
|
||||
uint32_t data = rdp.cmd1;
|
||||
|
||||
FRDP("uc8:moveword ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc8:moveword ");
|
||||
|
||||
switch (index)
|
||||
{
|
||||
|
@ -249,7 +233,7 @@ static void uc8_moveword()
|
|||
case 0x02:
|
||||
rdp.num_lights = (data / 48);
|
||||
rdp.update |= UPDATE_LIGHTS;
|
||||
FRDP("numlights: %d\n", rdp.num_lights);
|
||||
WriteTrace(TraceRDP, TraceDebug, "numlights: %d", rdp.num_lights);
|
||||
break;
|
||||
|
||||
case 0x04:
|
||||
|
@ -258,12 +242,12 @@ static void uc8_moveword()
|
|||
rdp.clip_ratio = sqrt((float)rdp.cmd1);
|
||||
rdp.update |= UPDATE_VIEWPORT;
|
||||
}
|
||||
FRDP("mw_clip %08lx, %08lx\n", rdp.cmd0, rdp.cmd1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "mw_clip %08lx, %08lx", rdp.cmd0, rdp.cmd1);
|
||||
break;
|
||||
|
||||
case 0x06: // moveword SEGMENT
|
||||
{
|
||||
FRDP("SEGMENT %08lx -> seg%d\n", data, offset >> 2);
|
||||
WriteTrace(TraceRDP, TraceDebug, "SEGMENT %08lx -> seg%d", data, offset >> 2);
|
||||
rdp.segment[(offset >> 2) & 0xF] = data;
|
||||
}
|
||||
break;
|
||||
|
@ -272,24 +256,24 @@ static void uc8_moveword()
|
|||
{
|
||||
rdp.fog_multiplier = (short)(rdp.cmd1 >> 16);
|
||||
rdp.fog_offset = (short)(rdp.cmd1 & 0x0000FFFF);
|
||||
FRDP("fog: multiplier: %f, offset: %f\n", rdp.fog_multiplier, rdp.fog_offset);
|
||||
WriteTrace(TraceRDP, TraceDebug, "fog: multiplier: %f, offset: %f", rdp.fog_multiplier, rdp.fog_offset);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x0c:
|
||||
RDP_E("uc8:moveword forcemtx - IGNORED\n");
|
||||
LRDP("forcemtx - IGNORED\n");
|
||||
|
||||
WriteTrace(TraceRDP, TraceWarning, "uc8:moveword forcemtx - IGNORED");
|
||||
break;
|
||||
|
||||
case 0x0e:
|
||||
LRDP("perspnorm - IGNORED\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "perspnorm - IGNORED");
|
||||
break;
|
||||
|
||||
case 0x10: // moveword coord mod
|
||||
{
|
||||
uint8_t n = offset >> 2;
|
||||
|
||||
FRDP("coord mod:%d, %08lx\n", n, data);
|
||||
WriteTrace(TraceRDP, TraceDebug, "coord mod:%d, %08lx", n, data);
|
||||
if (rdp.cmd0 & 8)
|
||||
return;
|
||||
uint32_t idx = (rdp.cmd0 >> 1) & 3;
|
||||
|
@ -310,22 +294,19 @@ static void uc8_moveword()
|
|||
{
|
||||
uc8_coord_mod[8 + idx] = (short)(rdp.cmd1 >> 16);
|
||||
uc8_coord_mod[9 + idx] = (short)(rdp.cmd1 & 0xffff);
|
||||
#ifdef EXTREME_LOGGING
|
||||
if (idx)
|
||||
{
|
||||
for (int k = 8; k < 16; k++)
|
||||
{
|
||||
FRDP("coord_mod[%d]=%f\n", k, uc8_coord_mod[k]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "coord_mod[%d]=%f", k, uc8_coord_mod[k]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
FRDP_E("uc8:moveword unknown (index: 0x%08lx, offset 0x%08lx)\n", index, offset);
|
||||
FRDP("unknown (index: 0x%08lx, offset 0x%08lx)\n", index, offset);
|
||||
WriteTrace(TraceRDP, TraceWarning, "uc8:moveword unknown (index: 0x%08lx, offset 0x%08lx)", index, offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,7 +316,7 @@ static void uc8_movemem()
|
|||
uint32_t addr = segoffset(rdp.cmd1);
|
||||
int ofs = (rdp.cmd0 >> 5) & 0x3FFF;
|
||||
|
||||
FRDP("uc8:movemem ofs:%d ", ofs);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc8:movemem ofs:%d ", ofs);
|
||||
|
||||
switch (idx)
|
||||
{
|
||||
|
@ -357,7 +338,7 @@ static void uc8_movemem()
|
|||
|
||||
rdp.update |= UPDATE_VIEWPORT;
|
||||
|
||||
FRDP("viewport scale(%d, %d), trans(%d, %d), from:%08lx\n", scale_x, scale_y,
|
||||
WriteTrace(TraceRDP, TraceDebug, "viewport scale(%d, %d), trans(%d, %d), from:%08lx", scale_x, scale_y,
|
||||
trans_x, trans_y, a);
|
||||
}
|
||||
break;
|
||||
|
@ -379,7 +360,7 @@ static void uc8_movemem()
|
|||
if (!dir_x && !dir_y)
|
||||
rdp.use_lookat = FALSE;
|
||||
}
|
||||
FRDP("lookat_%d (%f, %f, %f)\n", n, rdp.lookat[n][0], rdp.lookat[n][1], rdp.lookat[n][2]);
|
||||
WriteTrace(TraceRDP, TraceDebug, "lookat_%d (%f, %f, %f)", n, rdp.lookat[n][0], rdp.lookat[n][1], rdp.lookat[n][2]);
|
||||
return;
|
||||
}
|
||||
n -= 2;
|
||||
|
@ -405,57 +386,51 @@ static void uc8_movemem()
|
|||
rdp.light[n].nonzero = gfx.RDRAM[(addr + 12) ^ 3];
|
||||
rdp.light[n].ca = (float)rdp.light[n].nonzero / 16.0f;
|
||||
//rdp.light[n].la = rdp.light[n].ca * 1.0f;
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP("light: n: %d, pos: x: %f, y: %f, z: %f, w: %f, ca: %f\n",
|
||||
WriteTrace(TraceRDP, TraceVerbose, "light: n: %d, pos: x: %f, y: %f, z: %f, w: %f, ca: %f",
|
||||
n, rdp.light[n].x, rdp.light[n].y, rdp.light[n].z, rdp.light[n].w, rdp.light[n].ca);
|
||||
#endif
|
||||
FRDP("light: n: %d, r: %f, g: %f, b: %f. dir: x: %.3f, y: %.3f, z: %.3f\n",
|
||||
WriteTrace(TraceRDP, TraceDebug, "light: n: %d, r: %f, g: %f, b: %f. dir: x: %.3f, y: %.3f, z: %.3f",
|
||||
n, rdp.light[n].r, rdp.light[n].g, rdp.light[n].b,
|
||||
rdp.light[n].dir_x, rdp.light[n].dir_y, rdp.light[n].dir_z);
|
||||
#ifdef EXTREME_LOGGING
|
||||
for (int t = 0; t < 24; t++)
|
||||
{
|
||||
FRDP ("light[%d] = 0x%04lx \n", t, ((uint16_t*)gfx.RDRAM)[(a+t)^1]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "light[%d] = 0x%04lx ", t, ((uint16_t*)gfx.RDRAM)[(a + t) ^ 1]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
case 14: //Normales
|
||||
{
|
||||
uc8_normale_addr = segoffset(rdp.cmd1);
|
||||
FRDP("Normale - addr: %08lx\n", uc8_normale_addr);
|
||||
#ifdef EXTREME_LOGGING
|
||||
WriteTrace(TraceRDP, TraceVerbose, "Normale - addr: %08lx", uc8_normale_addr);
|
||||
int i;
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
char x = ((char*)gfx.RDRAM)[uc8_normale_addr + ((i<<1) + 0)^3];
|
||||
char y = ((char*)gfx.RDRAM)[uc8_normale_addr + ((i<<1) + 1)^3];
|
||||
FRDP("#%d x = %d, y = %d\n", i, x, y);
|
||||
char x = ((char*)gfx.RDRAM)[uc8_normale_addr + ((i << 1) + 0) ^ 3];
|
||||
char y = ((char*)gfx.RDRAM)[uc8_normale_addr + ((i << 1) + 1) ^ 3];
|
||||
WriteTrace(TraceRDP, TraceVerbose, "#%d x = %d, y = %d", i, x, y);
|
||||
}
|
||||
uint32_t a = uc8_normale_addr >> 1;
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
FRDP ("n[%d] = 0x%04lx \n", i, ((uint16_t*)gfx.RDRAM)[(a+i)^1]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "n[%d] = 0x%04lx ", i, ((uint16_t*)gfx.RDRAM)[(a + i) ^ 1]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
FRDP("uc8:movemem unknown (%d)\n", idx);
|
||||
}
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc8:movemem unknown (%d)", idx);
|
||||
}
|
||||
}
|
||||
|
||||
static void uc8_tri4() //by Gugaman Apr 19 2002
|
||||
{
|
||||
if (rdp.skip_drawing)
|
||||
{
|
||||
LRDP("uc8:tri4. skipped\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc8:tri4. skipped");
|
||||
return;
|
||||
}
|
||||
|
||||
FRDP("uc8:tri4 (#%d - #%d), %d-%d-%d, %d-%d-%d, %d-%d-%d, %d-%d-%d\n",
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc8:tri4 (#%d - #%d), %d-%d-%d, %d-%d-%d, %d-%d-%d, %d-%d-%d",
|
||||
rdp.tri_n,
|
||||
rdp.tri_n + 3,
|
||||
((rdp.cmd0 >> 23) & 0x1F),
|
||||
|
|
|
@ -126,7 +126,7 @@ static void uc9_draw_object(uint8_t * addr, uint32_t type)
|
|||
vsize = 16;
|
||||
break;
|
||||
default:
|
||||
FRDP_E("Unknown geometric primitive type %u.\n", type);
|
||||
WriteTrace(TraceRDP, TraceWarning, "Unknown geometric primitive type %u.", type);
|
||||
textured = vnum = vsize = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -153,12 +153,12 @@ static void uc9_draw_object(uint8_t * addr, uint32_t type)
|
|||
v.ov = ((short*)addr)[5 ^ 1];
|
||||
v.w = Calc_invw(((int*)addr)[3]) / 31.0f;
|
||||
v.oow = 1.0f / v.w;
|
||||
FRDP("v%d - sx: %f, sy: %f ou: %f, ov: %f, w: %f, r=%d, g=%d, b=%d, a=%d\n", i, v.sx / rdp.scale_x, v.sy / rdp.scale_y, v.ou*rdp.tiles[rdp.cur_tile].s_scale, v.ov*rdp.tiles[rdp.cur_tile].t_scale, v.w, v.r, v.g, v.b, v.a);
|
||||
WriteTrace(TraceRDP, TraceDebug, "v%d - sx: %f, sy: %f ou: %f, ov: %f, w: %f, r=%d, g=%d, b=%d, a=%d", i, v.sx / rdp.scale_x, v.sy / rdp.scale_y, v.ou*rdp.tiles[rdp.cur_tile].s_scale, v.ov*rdp.tiles[rdp.cur_tile].t_scale, v.w, v.r, v.g, v.b, v.a);
|
||||
}
|
||||
else
|
||||
{
|
||||
v.oow = v.w = 1.0f;
|
||||
FRDP("v%d - sx: %f, sy: %f r=%d, g=%d, b=%d, a=%d\n", i, v.sx / rdp.scale_x, v.sy / rdp.scale_y, v.r, v.g, v.b, v.a);
|
||||
WriteTrace(TraceRDP, TraceDebug, "v%d - sx: %f, sy: %f r=%d, g=%d, b=%d, a=%d", i, v.sx / rdp.scale_x, v.sy / rdp.scale_y, v.r, v.g, v.b, v.a);
|
||||
}
|
||||
addr += vsize;
|
||||
}
|
||||
|
@ -171,13 +171,13 @@ static void uc9_draw_object(uint8_t * addr, uint32_t type)
|
|||
};
|
||||
if (vnum == 3)
|
||||
{
|
||||
FRDP("uc9:Tri #%d, #%d\n", rdp.tri_n, rdp.tri_n + 1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc9:Tri #%d, #%d", rdp.tri_n, rdp.tri_n + 1);
|
||||
draw_tri(pV, 0);
|
||||
rdp.tri_n++;
|
||||
}
|
||||
else
|
||||
{
|
||||
FRDP("uc9:Quad #%d, #%d\n", rdp.tri_n, rdp.tri_n + 1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc9:Quad #%d, #%d", rdp.tri_n, rdp.tri_n + 1);
|
||||
draw_tri(pV, 0);
|
||||
draw_tri(pV + 1, 0);
|
||||
rdp.tri_n += 2;
|
||||
|
@ -237,7 +237,7 @@ static uint32_t uc9_load_object(uint32_t zHeader, uint32_t * rdpcmds)
|
|||
|
||||
static void uc9_object()
|
||||
{
|
||||
LRDP("uc9:object\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc9:object");
|
||||
uint32_t rdpcmds[3] = { 0, 0, 0 };
|
||||
uint32_t cmd1 = rdp.cmd1;
|
||||
uint32_t zHeader = segoffset(rdp.cmd0);
|
||||
|
@ -250,7 +250,7 @@ static void uc9_object()
|
|||
|
||||
static void uc9_mix()
|
||||
{
|
||||
LRDP("uc9:mix IGNORED\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc9:mix IGNORED");
|
||||
}
|
||||
|
||||
static void uc9_fmlight()
|
||||
|
@ -258,7 +258,7 @@ static void uc9_fmlight()
|
|||
int mid = rdp.cmd0 & 0xFF;
|
||||
rdp.num_lights = 1 + ((rdp.cmd1 >> 12) & 0xFF);
|
||||
uint32_t a = -1024 + (rdp.cmd1 & 0xFFF);
|
||||
FRDP("uc9:fmlight matrix: %d, num: %d, dmem: %04lx\n", mid, rdp.num_lights, a);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc9:fmlight matrix: %d, num: %d, dmem: %04lx", mid, rdp.num_lights, a);
|
||||
|
||||
M44 *m = NULL;
|
||||
switch (mid) {
|
||||
|
@ -273,7 +273,7 @@ static void uc9_fmlight()
|
|||
break;
|
||||
default:
|
||||
m = NULL; /* allowing segfaults to debug in case of PJGlide64 bugs */
|
||||
FRDP_E("Invalid FM light matrix ID %u.\n", mid);
|
||||
WriteTrace(TraceRDP, TraceWarning, "Invalid FM light matrix ID %u.", mid);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ static void uc9_fmlight()
|
|||
rdp.light[rdp.num_lights].g = (float)(((uint8_t*)gfx.DMEM)[(a + 1) ^ 3]) / 255.0f;
|
||||
rdp.light[rdp.num_lights].b = (float)(((uint8_t*)gfx.DMEM)[(a + 2) ^ 3]) / 255.0f;
|
||||
rdp.light[rdp.num_lights].a = 1.0f;
|
||||
FRDP("ambient light: r: %.3f, g: %.3f, b: %.3f\n", rdp.light[rdp.num_lights].r, rdp.light[rdp.num_lights].g, rdp.light[rdp.num_lights].b);
|
||||
WriteTrace(TraceRDP, TraceDebug, "ambient light: r: %.3f, g: %.3f, b: %.3f", rdp.light[rdp.num_lights].r, rdp.light[rdp.num_lights].g, rdp.light[rdp.num_lights].b);
|
||||
a += 8;
|
||||
uint32_t i;
|
||||
for (i = 0; i < rdp.num_lights; i++)
|
||||
|
@ -293,13 +293,13 @@ static void uc9_fmlight()
|
|||
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_z = (float)(((char*)gfx.DMEM)[(a + 10) ^ 3]) / 127.0f;
|
||||
FRDP("light: n: %d, r: %.3f, g: %.3f, b: %.3f, x: %.3f, y: %.3f, z: %.3f\n",
|
||||
WriteTrace(TraceRDP, TraceDebug, "light: n: %d, r: %.3f, g: %.3f, b: %.3f, x: %.3f, y: %.3f, z: %.3f",
|
||||
i, rdp.light[i].r, rdp.light[i].g, rdp.light[i].b,
|
||||
rdp.light[i].dir_x, rdp.light[i].dir_y, rdp.light[i].dir_z);
|
||||
// TransformVector(&rdp.light[i].dir_x, rdp.light_vector[i], *m);
|
||||
InverseTransformVector(&rdp.light[i].dir_x, rdp.light_vector[i], *m);
|
||||
NormalizeVector(rdp.light_vector[i]);
|
||||
FRDP("light vector: n: %d, x: %.3f, y: %.3f, z: %.3f\n",
|
||||
WriteTrace(TraceRDP, TraceDebug, "light vector: n: %d, x: %.3f, y: %.3f, z: %.3f",
|
||||
i, rdp.light_vector[i][0], rdp.light_vector[i][1], rdp.light_vector[i][2]);
|
||||
a += 24;
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ static void uc9_light()
|
|||
uint32_t tdest = -1024 + (rdp.cmd1 & 0xFFF);
|
||||
int use_material = (csrs != 0x0ff0);
|
||||
tdest >>= 1;
|
||||
FRDP("uc9:light n: %d, colsrs: %04lx, normales: %04lx, coldst: %04lx, texdst: %04lx\n", num, csrs, nsrs, cdest, tdest);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc9:light n: %d, colsrs: %04lx, normales: %04lx, coldst: %04lx, texdst: %04lx", num, csrs, nsrs, cdest, tdest);
|
||||
VERTEX v;
|
||||
for (uint32_t i = 0; i < num; i++)
|
||||
{
|
||||
|
@ -360,22 +360,22 @@ static void uc9_light()
|
|||
|
||||
static void uc9_mtxtrnsp()
|
||||
{
|
||||
LRDP("uc9:mtxtrnsp - ignored\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc9:mtxtrnsp - ignored");
|
||||
/*
|
||||
LRDP("uc9:mtxtrnsp ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc9:mtxtrnsp ");
|
||||
M44 *s;
|
||||
switch (rdp.cmd1&0xF) {
|
||||
case 4:
|
||||
s = (M44*)rdp.model;
|
||||
LRDP("Model\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Model");
|
||||
break;
|
||||
case 6:
|
||||
s = (M44*)rdp.proj;
|
||||
LRDP("Proj\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Proj");
|
||||
break;
|
||||
case 8:
|
||||
s = (M44*)rdp.combined;
|
||||
LRDP("Comb\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Comb");
|
||||
break;
|
||||
}
|
||||
float m = *s[1][0];
|
||||
|
@ -392,7 +392,7 @@ static void uc9_mtxtrnsp()
|
|||
|
||||
static void uc9_mtxcat()
|
||||
{
|
||||
LRDP("uc9:mtxcat ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc9:mtxcat ");
|
||||
M44 *s = NULL;
|
||||
M44 *t = NULL;
|
||||
uint32_t S = rdp.cmd0 & 0xF;
|
||||
|
@ -401,36 +401,36 @@ static void uc9_mtxcat()
|
|||
switch (S) {
|
||||
case 4:
|
||||
s = (M44*)rdp.model;
|
||||
LRDP("Model * ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Model * ");
|
||||
break;
|
||||
case 6:
|
||||
s = (M44*)rdp.proj;
|
||||
LRDP("Proj * ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Proj * ");
|
||||
break;
|
||||
case 8:
|
||||
s = (M44*)rdp.combined;
|
||||
LRDP("Comb * ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Comb * ");
|
||||
break;
|
||||
default:
|
||||
FRDP_E("Invalid mutex S-coordinate: %u\n", S);
|
||||
WriteTrace(TraceRDP, TraceWarning, "Invalid mutex S-coordinate: %u", S);
|
||||
s = NULL; /* intentional segfault to alert for bugs in PJGlide64 (cxd4) */
|
||||
break;
|
||||
}
|
||||
switch (T) {
|
||||
case 4:
|
||||
t = (M44*)rdp.model;
|
||||
LRDP("Model -> ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Model -> ");
|
||||
break;
|
||||
case 6:
|
||||
t = (M44*)rdp.proj;
|
||||
LRDP("Proj -> ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Proj -> ");
|
||||
break;
|
||||
case 8:
|
||||
LRDP("Comb -> ");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Comb -> ");
|
||||
t = (M44*)rdp.combined;
|
||||
break;
|
||||
default:
|
||||
FRDP_E("Invalid mutex T-coordinate: %u\n", T);
|
||||
WriteTrace(TraceRDP, TraceWarning, "Invalid mutex T-coordinate: %u", T);
|
||||
t = NULL; /* intentional segfault to alert for bugs in PJGlide64 (cxd4) */
|
||||
break;
|
||||
}
|
||||
|
@ -440,31 +440,29 @@ static void uc9_mtxcat()
|
|||
switch (D) {
|
||||
case 4:
|
||||
memcpy(rdp.model, m, 64);;
|
||||
LRDP("Model\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Model");
|
||||
break;
|
||||
case 6:
|
||||
memcpy(rdp.proj, m, 64);;
|
||||
LRDP("Proj\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Proj");
|
||||
break;
|
||||
case 8:
|
||||
memcpy(rdp.combined, m, 64);;
|
||||
LRDP("Comb\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Comb");
|
||||
break;
|
||||
}
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP ("\nmodel\n{%f,%f,%f,%f}\n", rdp.model[0][0], rdp.model[0][1], rdp.model[0][2], rdp.model[0][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.model[1][0], rdp.model[1][1], rdp.model[1][2], rdp.model[1][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.model[2][0], rdp.model[2][1], rdp.model[2][2], rdp.model[2][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.model[3][0], rdp.model[3][1], rdp.model[3][2], rdp.model[3][3]);
|
||||
FRDP ("\nproj\n{%f,%f,%f,%f}\n", rdp.proj[0][0], rdp.proj[0][1], rdp.proj[0][2], rdp.proj[0][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.proj[1][0], rdp.proj[1][1], rdp.proj[1][2], rdp.proj[1][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.proj[2][0], rdp.proj[2][1], rdp.proj[2][2], rdp.proj[2][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.proj[3][0], rdp.proj[3][1], rdp.proj[3][2], rdp.proj[3][3]);
|
||||
FRDP ("\ncombined\n{%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[1][0], rdp.combined[1][1], rdp.combined[1][2], rdp.combined[1][3]);
|
||||
FRDP("{%f,%f,%f,%f}\n", rdp.combined[2][0], rdp.combined[2][1], rdp.combined[2][2], rdp.combined[2][3]);
|
||||
FRDP("{%f,%f,%f,%f}\n", rdp.combined[3][0], rdp.combined[3][1], rdp.combined[3][2], rdp.combined[3][3]);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "\nmodel\n{%f,%f,%f,%f}", rdp.model[0][0], rdp.model[0][1], rdp.model[0][2], rdp.model[0][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.model[1][0], rdp.model[1][1], rdp.model[1][2], rdp.model[1][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.model[2][0], rdp.model[2][1], rdp.model[2][2], rdp.model[2][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.model[3][0], rdp.model[3][1], rdp.model[3][2], rdp.model[3][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "\nproj\n{%f,%f,%f,%f}", rdp.proj[0][0], rdp.proj[0][1], rdp.proj[0][2], rdp.proj[0][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.proj[1][0], rdp.proj[1][1], rdp.proj[1][2], rdp.proj[1][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.proj[2][0], rdp.proj[2][1], rdp.proj[2][2], rdp.proj[2][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.proj[3][0], rdp.proj[3][1], rdp.proj[3][2], rdp.proj[3][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "\ncombined\n{%f,%f,%f,%f}", rdp.combined[0][0], rdp.combined[0][1], rdp.combined[0][2], rdp.combined[0][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.combined[1][0], rdp.combined[1][1], rdp.combined[1][2], rdp.combined[1][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.combined[2][0], rdp.combined[2][1], rdp.combined[2][2], rdp.combined[2][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.combined[3][0], rdp.combined[3][1], rdp.combined[3][2], rdp.combined[3][3]);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
@ -484,7 +482,7 @@ static void uc9_mult_mpmtx()
|
|||
int num = 1 + ((rdp.cmd1 >> 24) & 0xFF);
|
||||
int src = -1024 + ((rdp.cmd1 >> 12) & 0xFFF);
|
||||
int dst = -1024 + (rdp.cmd1 & 0xFFF);
|
||||
FRDP("uc9:mult_mpmtx from: %04lx to: %04lx n: %d\n", src, dst, num);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc9:mult_mpmtx from: %04lx to: %04lx n: %d", src, dst, num);
|
||||
short * saddr = (short*)(gfx.DMEM + src);
|
||||
zSortVDest * daddr = (zSortVDest*)(gfx.DMEM + dst);
|
||||
int idx = 0;
|
||||
|
@ -528,38 +526,38 @@ static void uc9_mult_mpmtx()
|
|||
|
||||
daddr[i] = v;
|
||||
//memcpy(gfx.DMEM+dst+sizeof(zSortVDest)*i, &v, sizeof(zSortVDest));
|
||||
// FRDP("v%d x: %d, y: %d, z: %d -> sx: %d, sy: %d, w: %d, xi: %d, yi: %d, wi: %d, fog: %d\n", i, sx, sy, sz, v.sx, v.sy, v.invw, v.xi, v.yi, v.wi, v.fog);
|
||||
FRDP("v%d x: %d, y: %d, z: %d -> sx: %04lx, sy: %04lx, invw: %08lx - %f, xi: %04lx, yi: %04lx, wi: %04lx, fog: %04lx\n", i, sx, sy, sz, v.sx, v.sy, v.invw, w, v.xi, v.yi, v.wi, v.fog);
|
||||
// WriteTrace(TraceRDP, TraceDebug, "v%d x: %d, y: %d, z: %d -> sx: %d, sy: %d, w: %d, xi: %d, yi: %d, wi: %d, fog: %d", i, sx, sy, sz, v.sx, v.sy, v.invw, v.xi, v.yi, v.wi, v.fog);
|
||||
WriteTrace(TraceRDP, TraceDebug, "v%d x: %d, y: %d, z: %d -> sx: %04lx, sy: %04lx, invw: %08lx - %f, xi: %04lx, yi: %04lx, wi: %04lx, fog: %04lx", i, sx, sy, sz, v.sx, v.sy, v.invw, w, v.xi, v.yi, v.wi, v.fog);
|
||||
}
|
||||
}
|
||||
|
||||
static void uc9_link_subdl()
|
||||
{
|
||||
LRDP("uc9:link_subdl IGNORED\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc9:link_subdl IGNORED");
|
||||
}
|
||||
|
||||
static void uc9_set_subdl()
|
||||
{
|
||||
LRDP("uc9:set_subdl IGNORED\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc9:set_subdl IGNORED");
|
||||
}
|
||||
|
||||
static void uc9_wait_signal()
|
||||
{
|
||||
LRDP("uc9:wait_signal IGNORED\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc9:wait_signal IGNORED");
|
||||
}
|
||||
|
||||
static void uc9_send_signal()
|
||||
{
|
||||
LRDP("uc9:send_signal IGNORED\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc9:send_signal IGNORED");
|
||||
}
|
||||
|
||||
void uc9_movemem()
|
||||
{
|
||||
LRDP("uc9:movemem\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc9:movemem");
|
||||
int idx = rdp.cmd0 & 0x0E;
|
||||
int ofs = ((rdp.cmd0 >> 6) & 0x1ff) << 3;
|
||||
int len = (1 + ((rdp.cmd0 >> 15) & 0x1ff)) << 3;
|
||||
FRDP("uc9:movemem ofs: %d, len: %d. ", ofs, len);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc9:movemem ofs: %d, len: %d. ", ofs, len);
|
||||
int flag = rdp.cmd0 & 0x01;
|
||||
uint32_t addr = segoffset(rdp.cmd1);
|
||||
switch (idx)
|
||||
|
@ -568,13 +566,13 @@ void uc9_movemem()
|
|||
if (flag == 0)
|
||||
{
|
||||
int dmem_addr = (idx << 3) + ofs;
|
||||
FRDP("Load to DMEM. %08lx -> %08lx\n", addr, dmem_addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "Load to DMEM. %08lx -> %08lx", addr, dmem_addr);
|
||||
memcpy(gfx.DMEM + dmem_addr, gfx.RDRAM + addr, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
int dmem_addr = (idx << 3) + ofs;
|
||||
FRDP("Load from DMEM. %08lx -> %08lx\n", dmem_addr, addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "Load from DMEM. %08lx -> %08lx", dmem_addr, addr);
|
||||
memcpy(gfx.RDRAM + addr, gfx.DMEM + dmem_addr, len);
|
||||
}
|
||||
break;
|
||||
|
@ -588,38 +586,36 @@ void uc9_movemem()
|
|||
switch (idx)
|
||||
{
|
||||
case 4: // model matrix
|
||||
LRDP("Modelview load\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Modelview load");
|
||||
modelview_load(m);
|
||||
break;
|
||||
case 6: // projection matrix
|
||||
LRDP("Projection load\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Projection load");
|
||||
projection_load(m);
|
||||
break;
|
||||
case 8: // projection matrix
|
||||
LRDP("Combined load\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Combined load");
|
||||
rdp.update &= ~UPDATE_MULT_MAT;
|
||||
memcpy(rdp.combined, m, 64);;
|
||||
break;
|
||||
}
|
||||
#ifdef EXTREME_LOGGING
|
||||
FRDP ("{%f,%f,%f,%f}\n", m[0][0], m[0][1], m[0][2], m[0][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", m[1][0], m[1][1], m[1][2], m[1][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", m[2][0], m[2][1], m[2][2], m[2][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", m[3][0], m[3][1], m[3][2], m[3][3]);
|
||||
FRDP ("\nmodel\n{%f,%f,%f,%f}\n", rdp.model[0][0], rdp.model[0][1], rdp.model[0][2], rdp.model[0][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.model[1][0], rdp.model[1][1], rdp.model[1][2], rdp.model[1][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.model[2][0], rdp.model[2][1], rdp.model[2][2], rdp.model[2][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.model[3][0], rdp.model[3][1], rdp.model[3][2], rdp.model[3][3]);
|
||||
FRDP ("\nproj\n{%f,%f,%f,%f}\n", rdp.proj[0][0], rdp.proj[0][1], rdp.proj[0][2], rdp.proj[0][3]);
|
||||
FRDP ("{%f,%f,%f,%f}\n", rdp.proj[1][0], rdp.proj[1][1], rdp.proj[1][2], rdp.proj[1][3]);
|
||||
FRDP("{%f,%f,%f,%f}\n", rdp.proj[2][0], rdp.proj[2][1], rdp.proj[2][2], rdp.proj[2][3]);
|
||||
FRDP("{%f,%f,%f,%f}\n", rdp.proj[3][0], rdp.proj[3][1], rdp.proj[3][2], rdp.proj[3][3]);
|
||||
#endif
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", m[0][0], m[0][1], m[0][2], m[0][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", m[1][0], m[1][1], m[1][2], m[1][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", m[2][0], m[2][1], m[2][2], m[2][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", m[3][0], m[3][1], m[3][2], m[3][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "\nmodel\n{%f,%f,%f,%f}", rdp.model[0][0], rdp.model[0][1], rdp.model[0][2], rdp.model[0][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.model[1][0], rdp.model[1][1], rdp.model[1][2], rdp.model[1][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.model[2][0], rdp.model[2][1], rdp.model[2][2], rdp.model[2][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.model[3][0], rdp.model[3][1], rdp.model[3][2], rdp.model[3][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "\nproj\n{%f,%f,%f,%f}", rdp.proj[0][0], rdp.proj[0][1], rdp.proj[0][2], rdp.proj[0][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.proj[1][0], rdp.proj[1][1], rdp.proj[1][2], rdp.proj[1][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.proj[2][0], rdp.proj[2][1], rdp.proj[2][2], rdp.proj[2][3]);
|
||||
WriteTrace(TraceRDP, TraceVerbose, "{%f,%f,%f,%f}", rdp.proj[3][0], rdp.proj[3][1], rdp.proj[3][2], rdp.proj[3][3]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 10:
|
||||
LRDP("Othermode - IGNORED\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "Othermode - IGNORED");
|
||||
break;
|
||||
|
||||
case 12: // VIEWPORT
|
||||
|
@ -659,14 +655,14 @@ void uc9_movemem()
|
|||
|
||||
rdp.geom_mode |= 0x0200;
|
||||
|
||||
FRDP("viewport scale(%d, %d, %d), trans(%d, %d, %d), from:%08lx\n", scale_x, scale_y, scale_z,
|
||||
WriteTrace(TraceRDP, TraceDebug, "viewport scale(%d, %d, %d), trans(%d, %d, %d), from:%08lx", scale_x, scale_y, scale_z,
|
||||
trans_x, trans_y, trans_z, a);
|
||||
FRDP("fog: multiplier: %f, offset: %f\n", rdp.fog_multiplier, rdp.fog_offset);
|
||||
WriteTrace(TraceRDP, TraceDebug, "fog: multiplier: %f, offset: %f", rdp.fog_multiplier, rdp.fog_offset);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
FRDP("** UNKNOWN %d\n", idx);
|
||||
WriteTrace(TraceRDP, TraceDebug, "** UNKNOWN %d", idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
void uc9_rpdcmd()
|
||||
{
|
||||
uint32_t a = segoffset(rdp.cmd1) >> 2;
|
||||
FRDP("uc9:rdpcmd addr: %08lx\n", a);
|
||||
WriteTrace(TraceRDP, TraceDebug, "uc9:rdpcmd addr: %08lx", a);
|
||||
if (a)
|
||||
{
|
||||
rdp.LLE = 1;
|
||||
|
|
|
@ -69,7 +69,7 @@ static void fb_bg_copy()
|
|||
uint8_t imageFmt = ((uint8_t *)gfx.RDRAM)[(((addr + 11) << 1) + 0) ^ 3];
|
||||
uint8_t imageSiz = ((uint8_t *)gfx.RDRAM)[(((addr + 11) << 1) + 1) ^ 3];
|
||||
uint32_t imagePtr = segoffset(((uint32_t*)gfx.RDRAM)[(addr + 8) >> 1]);
|
||||
FRDP("fb_bg_copy. fmt: %d, size: %d, imagePtr %08lx, main_ci: %08lx, cur_ci: %08lx \n", imageFmt, imageSiz, imagePtr, rdp.main_ci, rdp.frame_buffers[rdp.ci_count - 1].addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "fb_bg_copy. fmt: %d, size: %d, imagePtr %08lx, main_ci: %08lx, cur_ci: %08lx ", imageFmt, imageSiz, imagePtr, rdp.main_ci, rdp.frame_buffers[rdp.ci_count - 1].addr);
|
||||
|
||||
if (status == ci_main)
|
||||
{
|
||||
|
@ -82,7 +82,7 @@ static void fb_bg_copy()
|
|||
{
|
||||
rdp.copy_ci_index = rdp.ci_count - 1;
|
||||
rdp.frame_buffers[rdp.copy_ci_index].status = ci_copy;
|
||||
FRDP("rdp.frame_buffers[%d].status = ci_copy\n", rdp.copy_ci_index);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = ci_copy", rdp.copy_ci_index);
|
||||
|
||||
if (rdp.frame_buffers[rdp.copy_ci_index].addr != rdp.main_ci_bg)
|
||||
{
|
||||
|
@ -91,11 +91,11 @@ static void fb_bg_copy()
|
|||
}
|
||||
else
|
||||
{
|
||||
LRDP("motion blur!\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "motion blur!");
|
||||
rdp.motionblur = TRUE;
|
||||
}
|
||||
|
||||
FRDP("Detect FB usage. texture addr is inside framebuffer: %08lx - %08lx \n", imagePtr, rdp.main_ci);
|
||||
WriteTrace(TraceRDP, TraceDebug, "Detect FB usage. texture addr is inside framebuffer: %08lx - %08lx ", imagePtr, rdp.main_ci);
|
||||
}
|
||||
else if (imagePtr == rdp.zimg)
|
||||
{
|
||||
|
@ -105,7 +105,7 @@ static void fb_bg_copy()
|
|||
rdp.tmpzimg = rdp.frame_buffers[rdp.ci_count - 1].addr;
|
||||
if (!rdp.copy_zi_index)
|
||||
rdp.copy_zi_index = rdp.ci_count - 1;
|
||||
FRDP("rdp.frame_buffers[%d].status = ci_zcopy\n", rdp.copy_ci_index);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = ci_zcopy", rdp.copy_ci_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ static void fb_setscissor()
|
|||
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;
|
||||
}
|
||||
FRDP("fb_setscissor. lr_x = %d, lr_y = %d, fb_width = %d, fb_height = %d\n", rdp.scissor_o.lr_x, rdp.scissor_o.lr_y, cur_fb.width, cur_fb.height);
|
||||
WriteTrace(TraceRDP, TraceDebug, "fb_setscissor. lr_x = %d, lr_y = %d, fb_width = %d, fb_height = %d", rdp.scissor_o.lr_x, rdp.scissor_o.lr_y, cur_fb.width, cur_fb.height);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ static void fb_rect()
|
|||
uint32_t lr_y = minval(rdp.scissor_o.lr_y, (rdp.cmd0 & 0xFFF) >> 2);
|
||||
if (rdp.frame_buffers[rdp.ci_count - 1].height < lr_y)
|
||||
{
|
||||
FRDP("fb_rect. ul_x: %d, lr_x: %d, fb_height: %d -> %d\n", ul_x, lr_x, rdp.frame_buffers[rdp.ci_count - 1].height, lr_y);
|
||||
WriteTrace(TraceRDP, TraceDebug, "fb_rect. ul_x: %d, lr_x: %d, fb_height: %d -> %d", ul_x, lr_x, rdp.frame_buffers[rdp.ci_count - 1].height, lr_y);
|
||||
rdp.frame_buffers[rdp.ci_count - 1].height = lr_y;
|
||||
}
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ static void fb_settextureimage()
|
|||
uint32_t addr = segoffset(rdp.cmd1);
|
||||
if (tex_format == 0)
|
||||
{
|
||||
FRDP("fb_settextureimage. fmt: %d, size: %d, imagePtr %08lx, main_ci: %08lx, cur_ci: %08lx \n", ((rdp.cmd0 >> 21) & 0x07), ((rdp.cmd0 >> 19) & 0x03), addr, rdp.main_ci, rdp.frame_buffers[rdp.ci_count - 1].addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "fb_settextureimage. fmt: %d, size: %d, imagePtr %08lx, main_ci: %08lx, cur_ci: %08lx ", ((rdp.cmd0 >> 21) & 0x07), ((rdp.cmd0 >> 19) & 0x03), addr, rdp.main_ci, rdp.frame_buffers[rdp.ci_count - 1].addr);
|
||||
if (cur_fb.status == ci_main)
|
||||
{
|
||||
rdp.main_ci_last_tex_addr = addr;
|
||||
|
@ -201,7 +201,7 @@ static void fb_settextureimage()
|
|||
cur_fb.status = ci_copy_self;
|
||||
rdp.scale_x = rdp.scale_x_bak;
|
||||
rdp.scale_y = rdp.scale_y_bak;
|
||||
FRDP("rdp.frame_buffers[%d].status = ci_copy_self\n", rdp.ci_count - 1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = ci_copy_self", rdp.ci_count - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -209,11 +209,11 @@ static void fb_settextureimage()
|
|||
{
|
||||
rdp.copy_ci_index = rdp.ci_count - 1;
|
||||
cur_fb.status = ci_copy;
|
||||
FRDP("rdp.frame_buffers[%d].status = ci_copy\n", rdp.copy_ci_index);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = ci_copy", rdp.copy_ci_index);
|
||||
if ((rdp.main_ci_last_tex_addr >= cur_fb.addr) &&
|
||||
(rdp.main_ci_last_tex_addr < (cur_fb.addr + cur_fb.width*cur_fb.height*cur_fb.size)))
|
||||
{
|
||||
LRDP("motion blur!\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "motion blur!");
|
||||
rdp.motionblur = TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -226,17 +226,17 @@ static void fb_settextureimage()
|
|||
{
|
||||
rdp.copy_ci_index = rdp.ci_count - 1;
|
||||
cur_fb.status = ci_aux_copy;
|
||||
FRDP("rdp.frame_buffers[%d].status = ci_aux_copy\n", rdp.copy_ci_index);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = ci_aux_copy", rdp.copy_ci_index);
|
||||
rdp.scale_x = 1.0f;
|
||||
rdp.scale_y = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
cur_fb.status = ci_aux;
|
||||
FRDP("rdp.frame_buffers[%d].status = ci_aux\n", rdp.copy_ci_index);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = ci_aux", rdp.copy_ci_index);
|
||||
}
|
||||
}
|
||||
FRDP("Detect FB usage. texture addr is inside framebuffer: %08lx - %08lx \n", addr, rdp.main_ci);
|
||||
WriteTrace(TraceRDP, TraceDebug, "Detect FB usage. texture addr is inside framebuffer: %08lx - %08lx ", addr, rdp.main_ci);
|
||||
}
|
||||
///*
|
||||
else if ((cur_fb.status != ci_main) && (addr >= rdp.zimg && addr < rdp.zimg_end))
|
||||
|
@ -244,7 +244,7 @@ static void fb_settextureimage()
|
|||
cur_fb.status = ci_zcopy;
|
||||
if (!rdp.copy_zi_index)
|
||||
rdp.copy_zi_index = rdp.ci_count - 1;
|
||||
FRDP("fb_settextureimage. rdp.frame_buffers[%d].status = ci_zcopy\n", rdp.ci_count - 1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "fb_settextureimage. rdp.frame_buffers[%d].status = ci_zcopy", rdp.ci_count - 1);
|
||||
}
|
||||
//*/
|
||||
else if ((rdp.maincimg[0].width > 64) && (addr >= rdp.maincimg[0].addr) && (addr < (rdp.maincimg[0].addr + rdp.maincimg[0].width*rdp.maincimg[0].height * 2)))
|
||||
|
@ -252,20 +252,20 @@ static void fb_settextureimage()
|
|||
if (cur_fb.status != ci_main)
|
||||
{
|
||||
cur_fb.status = ci_old_copy;
|
||||
FRDP("rdp.frame_buffers[%d].status = ci_old_copy 1, addr:%08lx\n", rdp.ci_count - 1, rdp.last_drawn_ci_addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = ci_old_copy 1, addr:%08lx", rdp.ci_count - 1, rdp.last_drawn_ci_addr);
|
||||
}
|
||||
rdp.read_previous_ci = TRUE;
|
||||
LRDP("read_previous_ci = TRUE\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "read_previous_ci = TRUE");
|
||||
}
|
||||
else if ((addr >= rdp.last_drawn_ci_addr) && (addr < (rdp.last_drawn_ci_addr + rdp.maincimg[0].width*rdp.maincimg[0].height * 2)))
|
||||
{
|
||||
if (cur_fb.status != ci_main)
|
||||
{
|
||||
cur_fb.status = ci_old_copy;
|
||||
FRDP("rdp.frame_buffers[%d].status = ci_old_copy 2, addr:%08lx\n", rdp.ci_count - 1, rdp.last_drawn_ci_addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = ci_old_copy 2, addr:%08lx", rdp.ci_count - 1, rdp.last_drawn_ci_addr);
|
||||
}
|
||||
rdp.read_previous_ci = TRUE;
|
||||
LRDP("read_previous_ci = TRUE\n");
|
||||
WriteTrace(TraceRDP, TraceDebug, "read_previous_ci = TRUE");
|
||||
}
|
||||
}
|
||||
else if (fb_hwfbe_enabled && (cur_fb.status == ci_main))
|
||||
|
@ -275,14 +275,14 @@ static void fb_settextureimage()
|
|||
rdp.copy_ci_index = rdp.ci_count - 1;
|
||||
rdp.black_ci_index = rdp.ci_count - 1;
|
||||
cur_fb.status = ci_copy_self;
|
||||
FRDP("rdp.frame_buffers[%d].status = ci_copy_self\n", rdp.ci_count - 1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = ci_copy_self", rdp.ci_count - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cur_fb.status == ci_unknown)
|
||||
{
|
||||
cur_fb.status = ci_aux;
|
||||
FRDP("fb_settextureimage. rdp.frame_buffers[%d].status = ci_aux\n", rdp.ci_count - 1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "fb_settextureimage. rdp.frame_buffers[%d].status = ci_aux", rdp.ci_count - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,7 @@ static void fb_loadtxtr()
|
|||
if (rdp.frame_buffers[rdp.ci_count - 1].status == ci_unknown)
|
||||
{
|
||||
rdp.frame_buffers[rdp.ci_count - 1].status = ci_aux;
|
||||
FRDP("rdp.frame_buffers[%d].status = ci_aux\n", rdp.ci_count - 1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = ci_aux", rdp.ci_count - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -299,17 +299,17 @@ static void fb_setdepthimage()
|
|||
{
|
||||
rdp.zimg = segoffset(rdp.cmd1) & BMASK;
|
||||
rdp.zimg_end = rdp.zimg + rdp.ci_width*rdp.ci_height * 2;
|
||||
FRDP("fb_setdepthimage. addr %08lx - %08lx\n", rdp.zimg, rdp.zimg_end);
|
||||
WriteTrace(TraceRDP, TraceDebug, "fb_setdepthimage. addr %08lx - %08lx", rdp.zimg, rdp.zimg_end);
|
||||
if (rdp.zimg == rdp.main_ci) //strange, but can happen
|
||||
{
|
||||
rdp.frame_buffers[rdp.main_ci_index].status = ci_unknown;
|
||||
if (rdp.main_ci_index < rdp.ci_count)
|
||||
{
|
||||
rdp.frame_buffers[rdp.main_ci_index].status = ci_zimg;
|
||||
FRDP("rdp.frame_buffers[%d].status = ci_zimg\n", rdp.main_ci_index);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = ci_zimg", rdp.main_ci_index);
|
||||
rdp.main_ci_index++;
|
||||
rdp.frame_buffers[rdp.main_ci_index].status = ci_main;
|
||||
FRDP("rdp.frame_buffers[%d].status = ci_main\n", rdp.main_ci_index);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = ci_main", rdp.main_ci_index);
|
||||
rdp.main_ci = rdp.frame_buffers[rdp.main_ci_index].addr;
|
||||
rdp.main_ci_end = rdp.main_ci + (rdp.frame_buffers[rdp.main_ci_index].width * rdp.frame_buffers[rdp.main_ci_index].height * rdp.frame_buffers[rdp.main_ci_index].size);
|
||||
for (int i = rdp.main_ci_index + 1; i < rdp.ci_count; i++)
|
||||
|
@ -318,7 +318,7 @@ static void fb_setdepthimage()
|
|||
if (fb.addr == rdp.main_ci)
|
||||
{
|
||||
fb.status = ci_main;
|
||||
FRDP("rdp.frame_buffers[%d].status = ci_main\n", i);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = ci_main", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ static void fb_setdepthimage()
|
|||
if ((fb.addr == rdp.zimg) && (fb.status == ci_aux || fb.status == ci_useless))
|
||||
{
|
||||
fb.status = ci_zimg;
|
||||
FRDP("rdp.frame_buffers[%d].status = ci_zimg\n", i);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = ci_zimg", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -361,19 +361,19 @@ static void fb_setcolorimage()
|
|||
if (rdp.frame_buffers[0].addr == rdp.cimg)
|
||||
rdp.frame_buffers[0].height = rdp.scissor_o.lr_y;
|
||||
*/
|
||||
FRDP("fb_setcolorimage. width: %d, height: %d, fmt: %d, size: %d, addr %08lx\n", cur_fb.width, cur_fb.height, cur_fb.format, cur_fb.size, cur_fb.addr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "fb_setcolorimage. width: %d, height: %d, fmt: %d, size: %d, addr %08lx", cur_fb.width, cur_fb.height, cur_fb.format, cur_fb.size, cur_fb.addr);
|
||||
if (rdp.cimg == rdp.zimg)
|
||||
{
|
||||
cur_fb.status = ci_zimg;
|
||||
rdp.zimg_end = rdp.zimg + cur_fb.width*rdp.scissor_o.lr_y * 2;
|
||||
FRDP("rdp.frame_buffers[%d].status = ci_zimg\n", rdp.ci_count);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = ci_zimg", rdp.ci_count);
|
||||
}
|
||||
else if (rdp.cimg == rdp.tmpzimg)
|
||||
{
|
||||
cur_fb.status = ci_zcopy;
|
||||
if (!rdp.copy_zi_index)
|
||||
rdp.copy_zi_index = rdp.ci_count - 1;
|
||||
FRDP("rdp.frame_buffers[%d].status = ci_zcopy\n", rdp.ci_count);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = ci_zcopy", rdp.ci_count);
|
||||
}
|
||||
else if (rdp.main_ci != 0)
|
||||
{
|
||||
|
@ -383,7 +383,7 @@ static void fb_setcolorimage()
|
|||
rdp.main_ci_index = rdp.ci_count;
|
||||
rdp.main_ci_end = rdp.cimg + ((cur_fb.width * cur_fb.height) << cur_fb.size >> 1);
|
||||
cur_fb.status = ci_main;
|
||||
FRDP("rdp.frame_buffers[%d].status = ci_main\n", rdp.ci_count);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = ci_main", rdp.ci_count);
|
||||
}
|
||||
else // status is not known yet
|
||||
{
|
||||
|
@ -398,7 +398,7 @@ static void fb_setcolorimage()
|
|||
rdp.main_ci_end = rdp.cimg + ((cur_fb.width * cur_fb.height) << cur_fb.size >> 1);
|
||||
rdp.main_ci_index = rdp.ci_count;
|
||||
cur_fb.status = ci_main;
|
||||
FRDP("rdp.frame_buffers[%d].status = ci_main\n", rdp.ci_count);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = ci_main", rdp.ci_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -411,7 +411,7 @@ static void fb_setcolorimage()
|
|||
{
|
||||
rdp.frame_buffers[rdp.ci_count - 1].status = ci_aux;
|
||||
rdp.frame_buffers[rdp.ci_count - 1].changed = 0;
|
||||
FRDP("rdp.frame_buffers[%d].status = ci_aux\n", rdp.ci_count - 1);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = ci_aux", rdp.ci_count - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -427,7 +427,7 @@ static void fb_setcolorimage()
|
|||
}
|
||||
}
|
||||
//*/
|
||||
FRDP("rdp.frame_buffers[%d].status = %s\n", rdp.ci_count - 1, CIStatus[rdp.frame_buffers[rdp.ci_count - 1].status]);
|
||||
WriteTrace(TraceRDP, TraceDebug, "rdp.frame_buffers[%d].status = %s", rdp.ci_count - 1, CIStatus[rdp.frame_buffers[rdp.ci_count - 1].status]);
|
||||
}
|
||||
}
|
||||
if (cur_fb.status == ci_main)
|
||||
|
|
Loading…
Reference in New Issue