[Glide64] Code Cleanup of Glide64/rdp.cpp

This commit is contained in:
zilmar 2016-01-20 21:00:58 +11:00
parent ce870d82e5
commit 6bf2738632
1 changed files with 3265 additions and 3283 deletions

View File

@ -48,7 +48,6 @@
#include "FBtoScreen.h"
#include "CRC.h"
const int NumOfFormats = 3;
SCREEN_SHOT_FORMAT ScreenShotFormats[NumOfFormats] = { { wxT("BMP"), wxT("bmp"), wxBITMAP_TYPE_BMP }, { wxT("PNG"), wxT("png"), wxBITMAP_TYPE_PNG }, { wxT("JPEG"), wxT("jpeg"), wxBITMAP_TYPE_JPEG } };
@ -608,15 +607,21 @@ public:
// lock the mutex in the ctor
SoftLocker(wxMutex* mutex)
: _isOk(false), _mutex(mutex)
{ _isOk = ( _mutex->TryLock() == wxMUTEX_NO_ERROR ); }
{
_isOk = (_mutex->TryLock() == wxMUTEX_NO_ERROR);
}
// returns true if mutex was successfully locked in ctor
bool IsOk() const
{ return _isOk; }
{
return _isOk;
}
// unlock the mutex in dtor
~SoftLocker()
{ if ( IsOk() ) _mutex->Unlock(); }
{
if (IsOk()) _mutex->Unlock();
}
private:
bool _isOk;
@ -810,7 +815,6 @@ EXPORT void CALL ProcessDList(void)
{
// MAIN PROCESSING LOOP
do {
// Get the address of the next command
a = rdp.pc[rdp.pc_i] & BMASK;
@ -853,12 +857,10 @@ EXPORT void CALL ProcessDList(void)
sprintf(out_buf, "perf %08lx: %016I64d\n", a - 8, (perf_next - perf_cur).Format(_T("%l")).mb_str());
rdp_log << out_buf;
#endif
} while (!rdp.halt);
}
#ifdef CATCH_EXCEPTIONS
} catch (...) {
if (fullscreen)
{
ReleaseGfx ();
@ -1110,7 +1112,8 @@ static void rdp_texrect()
{
lr_x += 1.0f;
lr_y += 1.0f;
} else if (lr_y - ul_y < 1.0f)
}
else if (lr_y - ul_y < 1.0f)
lr_y = ceil(lr_y);
if (settings.increase_texrect_edge)
@ -1396,7 +1399,6 @@ static void rdp_texrect()
// 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);
if (!rdp.aTBuffTex[0] && rdp.cur_cache[0]->splits != 1)
{
// ** LARGE TEXTURE HANDLING **
@ -1829,7 +1831,8 @@ void setTBufTex(uint16_t t_mem, uint32_t cnt)
LRDP("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);
} else {
}
else {
FRDP("rdp.aTBuffTex[%d]=0\n", 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))
@ -1885,16 +1888,14 @@ static inline void loadBlock(uint32_t *src, uint32_t *dst, uint32_t off, int dxt
{
v10 = __ROL__(v10, 8);
--v8;
}
while ( v8 );
} while (v8);
do
{
v10 = __ROL__(v10, 8);
*(uint8_t *)v5 = v10;
v5 = (uint32_t *)((char *)v5 + 1);
--v9;
}
while ( v9 );
} while (v9);
v12 = *v11;
v7 = v11 + 1;
*v5 = bswap32(v12);
@ -1910,8 +1911,7 @@ LABEL_23:
v7 += 2;
v5 += 2;
--v6;
}
while ( v6 );
} while (v6);
}
v13 = off & 3;
if (off & 3)
@ -1923,8 +1923,7 @@ LABEL_23:
*(uint8_t *)v5 = v14;
v5 = (uint32_t *)((char *)v5 + 1);
--v13;
}
while ( v13 );
} while (v13);
}
}
v15 = cnt;
@ -2067,7 +2066,6 @@ static void rdp_loadblock()
setTBufTex(rdp.tiles[tile].t_mem, cnt);
}
static inline void loadTile(uint32_t *src, uint32_t *dst, int width, int height, int line, int off, uint32_t *end)
{
uint32_t *v7;
@ -2128,16 +2126,14 @@ static inline void loadTile(uint32_t *src, uint32_t *dst, int width, int height,
{
v16 = __ROL__(v16, 8);
--v14;
}
while ( v14 );
} while (v14);
do
{
v16 = __ROL__(v16, 8);
*(uint8_t *)v7 = v16;
v7 = (uint32_t *)((char *)v7 + 1);
--v15;
}
while ( v15 );
} while (v15);
v18 = *v17;
v13 = v17 + 1;
*v7 = bswap32(v18);
@ -2153,8 +2149,7 @@ LABEL_20:
v13 += 2;
v7 += 2;
--v8;
}
while ( v8 );
} while (v8);
}
v19 = v23 & 3;
if (v23 & 3)
@ -2166,8 +2161,7 @@ LABEL_20:
*(uint8_t *)v7 = v20;
v7 = (uint32_t *)((char *)v7 + 1);
--v19;
}
while ( v19 );
} while (v19);
}
}
v9 = v27;
@ -2186,16 +2180,14 @@ LABEL_20:
v7[1] = v22;
v7 += 2;
--v8;
}
while ( v8 );
} while (v8);
}
v21 = v29;
v8 = v30;
}
v10 = line + v26;
v12 = v21 - 1;
}
while ( v12 );
} while (v12);
}
void LoadTile32b(uint32_t tile, uint32_t ul_s, uint32_t ul_t, uint32_t width, uint32_t height);
@ -2751,7 +2743,6 @@ static void rdp_setcolorimage()
{
case ci_main:
{
if (rdp.ci_count == 0)
{
if ((rdp.ci_status == ci_aux)) //for PPL
@ -2998,7 +2989,6 @@ static void rdp_setcolorimage()
/*
else //just clear buffer
{
grColorMask(FXTRUE, FXTRUE);
grBufferClear (0, 0, 0xFFFF);
}
@ -3027,7 +3017,6 @@ static void rdp_setcolorimage()
}
if (fb_hwfbe_enabled && !rdp.read_whole_frame && (prev_fb.status >= ci_aux) && (rdp.ci_count > rdp.copy_ci_index))
CloseTextureBuffer();
}
rdp.ci_status = cur_fb.status;
rdp.ci_count++;
@ -3295,7 +3284,6 @@ EXPORT void CALL FBWList(FrameBufferModifyEntry* /*plist*/, uint32_t)
#endif
}
/******************************************************************
Function: FrameBufferWrite
Purpose: This function is called to notify the dll that the
@ -3331,7 +3319,6 @@ EXPORT void CALL FBWrite(uint32_t addr, uint32_t /*size*/)
d_lr_y = max(d_lr_y, shift_r / rdp.ci_width);
}
/************************************************************************
Function: FBGetFrameBufferInfo
Purpose: This function is called by the emulator core to retrieve frame
@ -3441,7 +3428,6 @@ void DetectFrameBufferUsage ()
// MAIN PROCESSING LOOP
do {
// Get the address of the next command
a = rdp.pc[rdp.pc_i] & BMASK;
@ -3469,7 +3455,6 @@ void DetectFrameBufferUsage ()
rdp.pc_i--;
}
}
} while (!rdp.halt);
SwapOK = TRUE;
if (rdp.ci_count > NUMTEXBUF) //overflow
@ -4056,7 +4041,6 @@ static void rdp_trishadetxtrz()
LRDP("trishadetxtrz\n");
}
static rdp_instr rdp_command_table[64] =
{
/* 0x00 */
@ -4200,7 +4184,6 @@ static void rdphalf_1()
// Go to the next instruction
rdp.pc[rdp.pc_i] = (a + 8) & BMASK;
} while ((rdp.cmd0 >> 24) != 0xb3);
rdp_cmd_data[rdp_cmd_ptr++] = rdp.cmd1;
cmd = (rdp_cmd_data[rdp_cmd_cur] >> 24) & 0x3f;
@ -4307,4 +4290,3 @@ void CALL ProcessRDPList(void)
//}
}