From cfc4c9b3ec55a0e3deca56cc59f489e7fcb43b34 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Fri, 6 Aug 2010 09:30:36 +0000 Subject: [PATCH] GSnull: Work on the GifTransfer functions, to bring them up to date, and straighten them out. Now enabled by default. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3610 96395faa-99c1-11dd-bbfe-3dabce05a288 --- common/build/Utilities/Utilities.cbp | 1 + plugins/GSnull/GS.cpp | 19 +- plugins/GSnull/GS.h | 16 +- plugins/GSnull/GifTransfer.cpp | 295 +++++++++++------------- plugins/GSnull/GifTransfer.h | 216 ++++++++--------- plugins/GSnull/Registers.h | 168 +++++++++++++- plugins/zzogl-pg/opengl/GifTransfer.cpp | 2 +- 7 files changed, 415 insertions(+), 302 deletions(-) diff --git a/common/build/Utilities/Utilities.cbp b/common/build/Utilities/Utilities.cbp index ed36cd0093..5ae5b5bb76 100644 --- a/common/build/Utilities/Utilities.cbp +++ b/common/build/Utilities/Utilities.cbp @@ -164,6 +164,7 @@ + diff --git a/plugins/GSnull/GS.cpp b/plugins/GSnull/GS.cpp index 35bcf47dee..1749b2d473 100644 --- a/plugins/GSnull/GS.cpp +++ b/plugins/GSnull/GS.cpp @@ -25,6 +25,7 @@ using namespace std; #include "GS.h" +#include "GifTransfer.h" #include "null/GSnull.h" const unsigned char version = PS2E_GS_VERSION; @@ -40,6 +41,7 @@ bool GSShift = false, GSAlt = false; string s_strIniPath="inis"; std::string s_strLogPath("logs/"); const char* s_iniFilename = "GSnull.ini"; +GSVars gs; // Because I haven't bothered to get GSOpen2 working in Windows yet in GSNull. #ifdef __LINUX__ @@ -208,24 +210,11 @@ EXPORT_C_(void) GSvsync(int field) GSProcessMessages(); } -EXPORT_C_(void) GSgifTransfer1(u32 *pMem, u32 addr) -{ - _GSgifTransfer1(pMem, addr); -} - -EXPORT_C_(void) GSgifTransfer2(u32 *pMem, u32 size) -{ - _GSgifTransfer2(pMem, size); -} - -EXPORT_C_(void) GSgifTransfer3(u32 *pMem, u32 size) -{ - _GSgifTransfer3(pMem, size); -} - // returns the last tag processed (64 bits) EXPORT_C_(void) GSgetLastTag(u64* ptag) { + *(u32*)ptag = gs.nPath3Hack; + gs.nPath3Hack = 0; } EXPORT_C_(void) GSgifSoftReset(u32 mask) diff --git a/plugins/GSnull/GS.h b/plugins/GSnull/GS.h index 42816bc4de..542acb0b65 100644 --- a/plugins/GSnull/GS.h +++ b/plugins/GSnull/GS.h @@ -34,7 +34,7 @@ typedef struct _keyEvent keyEvent; #include "PS2Edefs.h" #include "PS2Eext.h" -#include "Registers.h" +#include "GifTransfer.h" #include "null/GSnull.h" /*#ifdef _MSC_VER @@ -54,8 +54,22 @@ typedef struct _keyEvent keyEvent; typedef struct { int Log; + bool path3; } Config; +typedef struct +{ + u32 CSRw; + pathInfo path[4]; + bool Path3transfer; + float q; + u32 imageTransfer; + int MultiThreaded; + int nPath3Hack; +} GSVars; + +extern GSVars gs; + extern Config conf; extern FILE *gsLog; extern u32 GSKeyEvent; diff --git a/plugins/GSnull/GifTransfer.cpp b/plugins/GSnull/GifTransfer.cpp index 0b0dd47fa5..9f9160283e 100644 --- a/plugins/GSnull/GifTransfer.cpp +++ b/plugins/GSnull/GifTransfer.cpp @@ -24,235 +24,208 @@ using namespace std; -u32 CSRw; -GIFPath m_path[3]; -bool Path3transfer; +extern GSVars gs; PCSX2_ALIGNED16( u8 g_RealGSMem[0x2000] ); -#define GSCSRr *((u64*)(g_RealGSMem+0x1000)) -#define GSIMR *((u32*)(g_RealGSMem+0x1010)) -#define GSSIGLBLID ((GSRegSIGBLID*)(g_RealGSMem+0x1080)) -static void RegHandlerSIGNAL(const u32* data) + +template void _GSgifTransfer(const u32 *pMem, u32 size) { - GSSIGLBLID->SIGID = (GSSIGLBLID->SIGID&~data[1])|(data[0]&data[1]); +// FUNCLOG - if ((CSRw & 0x1)) GSCSRr |= 1; // signal + pathInfo *path = &gs.path[index]; - if (!(GSIMR & 0x100) ) GSirq(); -} +#ifdef _WIN32 + assert(g_hCurrentThread == GetCurrentThread()); +#endif -static void RegHandlerFINISH(const u32* data) -{ - if ((CSRw & 0x2)) GSCSRr |= 2; // finish +#ifdef _DEBUG + gifTransferLog(index, pMem, size); +#endif - if (!(GSIMR & 0x200) ) GSirq(); - -} - -static void RegHandlerLABEL(const u32* data) -{ - GSSIGLBLID->LBLID = (GSSIGLBLID->LBLID&~data[1])|(data[0]&data[1]); -} - -typedef void (*GIFRegHandler)(const u32* data); -static GIFRegHandler s_GSHandlers[3] = -{ - RegHandlerSIGNAL, RegHandlerFINISH, RegHandlerLABEL -}; - -__forceinline void GIFPath::PrepRegs() -{ - if( tag.nreg == 0 ) + while (size > 0) { - u32 tempreg = tag.regs[0]; - for(u32 i=0; i<16; ++i, tempreg >>= 4) + //LOG(_T("Transfer(%08x, %d) START\n"), pMem, size); + if (path->nloop == 0) { - if( i == 8 ) tempreg = tag.regs[1]; - assert( (tempreg&0xf) < 0x64 ); - regs[i] = tempreg & 0xf; - } - } - else - { - u32 tempreg = tag.regs[0]; - for(u32 i=0; i>= 4) - { - assert( (tempreg&0xf) < 0x64 ); - regs[i] = tempreg & 0xf; - } - } -} + path->setTag(pMem); + pMem += 4; + size--; -void GIFPath::SetTag(const void* mem) -{ - tag = *((GIFTAG*)mem); - curreg = 0; + if ((conf.path3) && (index == 2) && path->eop) gs.nPath3Hack = 1; - PrepRegs(); -} - -u32 GIFPath::GetReg() -{ - return regs[curreg]; -} - -bool GIFPath::StepReg() -{ - if ((++curreg & 0xf) == tag.nreg) { - curreg = 0; - if (--tag.nloop == 0) { - return false; - } - } - return true; -} - -__forceinline u32 _gifTransfer( GIF_PATH pathidx, const u8* pMem, u32 size ) -{ - GIFPath& path = m_path[pathidx]; - - while(size > 0) - { - if(path.tag.nloop == 0) - { - path.SetTag( pMem ); - - pMem += sizeof(GIFTAG); - --size; - - if(pathidx == 2 && path.tag.eop) + // eeuser 7.2.2. GIFtag: "... when NLOOP is 0, the GIF does not output anything, and + // values other than the EOP field are disregarded." + if (path->nloop > 0) { - Path3transfer = FALSE; - } + gs.q = 1.0f; - if( pathidx == 0 ) - { - // hack: if too much data for VU1, just ignore. - - // The GIF is evil : if nreg is 0, it's really 16. Otherwise it's the value in nreg. - const int numregs = ((path.tag.nreg-1)&15)+1; - - if((path.tag.nloop * numregs) > (size * ((path.tag.flg == 1) ? 2 : 1))) + if (path->tag.PRE && (path->tag.FLG == GIF_FLG_PACKED)) { - path.tag.nloop = 0; - return ++size; + u32 tagprim = path->tag.PRIM; + //GIFRegHandlerPRIM((u32*)&tagprim); } } } else { - // NOTE: size > 0 => do {} while(size > 0); should be faster than while(size > 0) {} - - switch(path.tag.flg) + switch (path->mode) { - case GIF_FLG_PACKED: - - do + case GIF_FLG_PACKED: { - if( path.GetReg() == 0xe ) + // Needs to be looked at. + + // first try a shortcut for a very common case + + if (path->adonly && size >= path->nloop) { - const int handler = pMem[8]; - if(handler >= 0x60 && handler < 0x63) - s_GSHandlers[handler&0x3]((const u32*)pMem); + size -= path->nloop; + + do + { + //GIFPackedRegHandlerA_D(pMem); + + pMem += 4; //sizeof(GIFPackedReg)/4; + } + while(--path->nloop > 0); + break; } - size--; - pMem += 16; // 128 bits! //sizeof(GIFPackedReg); + do + { + u32 reg = path->GetReg(); + //g_GIFPackedRegHandlers[reg](pMem); + + pMem += 4; //sizeof(GIFPackedReg)/4; + size--; + } + while (path->StepReg() && (size > 0)); + + break; } - while(path.StepReg() && size > 0); - break; - - case GIF_FLG_REGLIST: - - size *= 2; - - do + case GIF_FLG_REGLIST: { - const int handler = path.GetReg(); - if(handler >= 0x60 && handler < 0x63) - s_GSHandlers[handler&0x3]((const u32*)pMem); + // Needs to be looked at. + //ZZLog::GS_Log("%8.8x%8.8x %d L", ((u32*)&gs.regs)[1], *(u32*)&gs.regs, path->tag.nreg/4); - size--; - pMem += 8; //sizeof(GIFReg); -- 64 bits! + size *= 2; + + do + { + //g_GIFRegHandlers[path->GetReg()](pMem); + + pMem += 2; + size--; + } + while (path->StepReg() && (size > 0)); + + if (size & 1) pMem += 2; + size /= 2; + break; } - while(path.StepReg() && size > 0); - if(size & 1) pMem += 8; //sizeof(GIFReg); + case GIF_FLG_IMAGE: // FROM_VFRAM + case GIF_FLG_IMAGE2: // Used in the DirectX version, so we'll use it here too. + { + int len = min(size, path->nloop); + //GS_LOG("GIF_FLG_IMAGE(%d)=%d", gs.imageTransfer, len); - size /= 2; + switch (gs.imageTransfer) + { + case 0: + //TransferHostLocal(pMem, len * 4); + break; - break; + case 1: + // This can't happen; downloads can not be started or performed as part of + // a GIFtag operation. They're an entirely separate process that can only be + // done through the ReverseFIFO transfer (aka ReadFIFO). --air + assert(0); + break; - case GIF_FLG_IMAGE2: // hmmm - assert(0); - path.tag.nloop = 0; + case 2: + // //TransferLocalLocal(); + break; - break; + case 3: + //assert(0); + break; - case GIF_FLG_IMAGE: - { - int len = (int)min(size, path.tag.nloop); + default: + //assert(0); + break; + } - pMem += len * 16; - path.tag.nloop -= len; - size -= len; - } - break; + pMem += len * 4; - default: __assume(false); + path->nloop -= len; + size -= len; + break; + } + + default: // GIF_IMAGE + GS_LOG("*** WARNING **** Unexpected GIFTag flag."); + assert(0); + path->nloop = 0; + break; } } - if(pathidx == 0) + if (index == 0) { - if(path.tag.eop && path.tag.nloop == 0) + if (path->tag.EOP && path->nloop == 0) { break; } } } - if(pathidx == 0) + // This is the case when not all data was readed from one try: VU1 has too much data. + // So we should redo reading from the start. + if (index == 0) { - if(size == 0 && path.tag.nloop > 0) + if (size == 0 && path->nloop > 0) { - path.tag.nloop = 0; - SysPrintf( "path1 hack! \n" ); - - // This means that the giftag data got screwly somewhere - // along the way (often means curreg was in a bad state or something) + if (gs.MultiThreaded) + { + path->nloop = 0; + } + else + { + _GSgifTransfer<0>(pMem - 0x4000, 0x4000 / 16); + } } } - - return size; } -// This currently segfaults in the beginning of KH1 if defined. -//#define DO_GIF_TRANSFERS +#define DO_GIF_TRANSFERS -void _GSgifTransfer1(u32 *pMem, u32 addr) +EXPORT_C_(void) GSgifTransfer1(u32 *pMem, u32 addr) { #ifdef DO_GIF_TRANSFERS - /* This needs looking at, since I quickly grabbed it from ZeroGS. */ - addr &= 0x3fff; - _gifTransfer( GIF_PATH_1, ((u8*)pMem+(u8)addr), (0x4000-addr)/16); + _GSgifTransfer<0>((u32*)((u8*)pMem + addr), (0x4000 - addr) / 16); #endif } -void _GSgifTransfer2(u32 *pMem, u32 size) +EXPORT_C_(void) GSgifTransfer2(u32 *pMem, u32 size) { #ifdef DO_GIF_TRANSFERS - _gifTransfer( GIF_PATH_2, (u8*)pMem, size); + _GSgifTransfer<1>(const_cast(pMem), size); #endif } -void _GSgifTransfer3(u32 *pMem, u32 size) +EXPORT_C_(void) GSgifTransfer3(u32 *pMem, u32 size) { #ifdef DO_GIF_TRANSFERS - _gifTransfer( GIF_PATH_3, (u8*)pMem, size); + _GSgifTransfer<2>(const_cast(pMem), size); #endif } +EXPORT_C_(void) GSgifTransfer(const u32 *pMem, u32 size) +{ +#ifdef DO_GIF_TRANSFERS + _GSgifTransfer<3>(const_cast(pMem), size); +#endif +} diff --git a/plugins/GSnull/GifTransfer.h b/plugins/GSnull/GifTransfer.h index 609b567b23..db064f4740 100644 --- a/plugins/GSnull/GifTransfer.h +++ b/plugins/GSnull/GifTransfer.h @@ -13,144 +13,118 @@ * If not, see . */ - #ifndef __GIF_TRANSFER_H__ - #define __GIF_TRANSFER_H__ +#ifndef __GIF_TRANSFER_H__ +#define __GIF_TRANSFER_H__ #include #include - - struct GSRegSIGBLID -{ - u32 SIGID; - u32 LBLID; -}; +#include "Registers.h" enum GIF_FLG { - GIF_FLG_PACKED = 0, - GIF_FLG_REGLIST = 1, - GIF_FLG_IMAGE = 2, - GIF_FLG_IMAGE2 = 3 + GIF_FLG_PACKED = 0, + GIF_FLG_REGLIST = 1, + GIF_FLG_IMAGE = 2, + GIF_FLG_IMAGE2 = 3 }; -enum GIF_PATH +// +// GIFTag +union GIFTag { - GIF_PATH_1 = 0, - GIF_PATH_2, - GIF_PATH_3, + u64 ai64[2]; + u32 ai32[4]; + + struct + { + u32 NLOOP : 15; + u32 EOP : 1; + u32 _PAD1 : 16; + u32 _PAD2 : 14; + u32 PRE : 1; + u32 PRIM : 11; + u32 FLG : 2; // enum GIF_FLG + u32 NREG : 4; + u64 REGS : 64; + }; + + void set(const u32 *data) + { + for (int i = 0; i <= 3; i++) + { + ai32[i] = data[i]; + } + } + + GIFTag(u32 *data) + { + set(data); + } + + GIFTag(){ ai64[0] = 0; ai64[1] = 0; } }; -enum GIF_REG +// EE part. Data transfer packet description + +typedef struct { - GIF_REG_PRIM = 0x00, - GIF_REG_RGBA = 0x01, - GIF_REG_STQ = 0x02, - GIF_REG_UV = 0x03, - GIF_REG_XYZF2 = 0x04, - GIF_REG_XYZ2 = 0x05, - GIF_REG_TEX0_1 = 0x06, - GIF_REG_TEX0_2 = 0x07, - GIF_REG_CLAMP_1 = 0x08, - GIF_REG_CLAMP_2 = 0x09, - GIF_REG_FOG = 0x0a, - GIF_REG_XYZF3 = 0x0c, - GIF_REG_XYZ3 = 0x0d, - GIF_REG_A_D = 0x0e, - GIF_REG_NOP = 0x0f, -}; + u32 mode; + int reg; + u64 regs; + u32 nloop; + int eop; + int nreg; + u32 adonly; + GIFTag tag; -enum GIF_A_D_REG -{ - GIF_A_D_REG_PRIM = 0x00, - GIF_A_D_REG_RGBAQ = 0x01, - GIF_A_D_REG_ST = 0x02, - GIF_A_D_REG_UV = 0x03, - GIF_A_D_REG_XYZF2 = 0x04, - GIF_A_D_REG_XYZ2 = 0x05, - GIF_A_D_REG_TEX0_1 = 0x06, - GIF_A_D_REG_TEX0_2 = 0x07, - GIF_A_D_REG_CLAMP_1 = 0x08, - GIF_A_D_REG_CLAMP_2 = 0x09, - GIF_A_D_REG_FOG = 0x0a, - GIF_A_D_REG_XYZF3 = 0x0c, - GIF_A_D_REG_XYZ3 = 0x0d, - GIF_A_D_REG_NOP = 0x0f, - GIF_A_D_REG_TEX1_1 = 0x14, - GIF_A_D_REG_TEX1_2 = 0x15, - GIF_A_D_REG_TEX2_1 = 0x16, - GIF_A_D_REG_TEX2_2 = 0x17, - GIF_A_D_REG_XYOFFSET_1 = 0x18, - GIF_A_D_REG_XYOFFSET_2 = 0x19, - GIF_A_D_REG_PRMODECONT = 0x1a, - GIF_A_D_REG_PRMODE = 0x1b, - GIF_A_D_REG_TEXCLUT = 0x1c, - GIF_A_D_REG_SCANMSK = 0x22, - GIF_A_D_REG_MIPTBP1_1 = 0x34, - GIF_A_D_REG_MIPTBP1_2 = 0x35, - GIF_A_D_REG_MIPTBP2_1 = 0x36, - GIF_A_D_REG_MIPTBP2_2 = 0x37, - GIF_A_D_REG_TEXA = 0x3b, - GIF_A_D_REG_FOGCOL = 0x3d, - GIF_A_D_REG_TEXFLUSH = 0x3f, - GIF_A_D_REG_SCISSOR_1 = 0x40, - GIF_A_D_REG_SCISSOR_2 = 0x41, - GIF_A_D_REG_ALPHA_1 = 0x42, - GIF_A_D_REG_ALPHA_2 = 0x43, - GIF_A_D_REG_DIMX = 0x44, - GIF_A_D_REG_DTHE = 0x45, - GIF_A_D_REG_COLCLAMP = 0x46, - GIF_A_D_REG_TEST_1 = 0x47, - GIF_A_D_REG_TEST_2 = 0x48, - GIF_A_D_REG_PABE = 0x49, - GIF_A_D_REG_FBA_1 = 0x4a, - GIF_A_D_REG_FBA_2 = 0x4b, - GIF_A_D_REG_FRAME_1 = 0x4c, - GIF_A_D_REG_FRAME_2 = 0x4d, - GIF_A_D_REG_ZBUF_1 = 0x4e, - GIF_A_D_REG_ZBUF_2 = 0x4f, - GIF_A_D_REG_BITBLTBUF = 0x50, - GIF_A_D_REG_TRXPOS = 0x51, - GIF_A_D_REG_TRXREG = 0x52, - GIF_A_D_REG_TRXDIR = 0x53, - GIF_A_D_REG_HWREG = 0x54, - GIF_A_D_REG_SIGNAL = 0x60, - GIF_A_D_REG_FINISH = 0x61, - GIF_A_D_REG_LABEL = 0x62, -}; + void setTag(const u32 *data) + { + tag.set(data); -struct GIFTAG -{ - u32 nloop : 15; - u32 eop : 1; - u32 dummy0 : 16; - u32 dummy1 : 14; - u32 pre : 1; - u32 prim : 11; - u32 flg : 2; - u32 nreg : 4; - u32 regs[2]; + nloop = tag.NLOOP; + eop = tag.EOP; + mode = tag.FLG; + //adonly = false; - GIFTAG() {} -}; + // Hmm.... + nreg = tag.NREG << 2; + if (nreg == 0) nreg = 64; + regs = tag.REGS; + reg = 0; + //if ((nreg == 4) && (regs == GIF_REG_A_D)) adonly = true; -struct GIFPath -{ - GIFTAG tag; - u32 curreg; - u32 _pad[3]; - u8 regs[16]; + // ZZLog::GS_Log("GIFtag: %8.8lx_%8.8lx_%8.8lx_%8.8lx: EOP=%d, NLOOP=%x, FLG=%x, NREG=%d, PRE=%d", + // data[3], data[2], data[1], data[0], + // path->eop, path->nloop, mode, path->nreg, tag.PRE); + } - __forceinline void PrepRegs(); - void SetTag(const void* mem); - u32 GetReg(); - bool StepReg(); -}; + u32 GetReg() + { + return (regs >> reg) & 0xf; + } -extern GIFPath m_path[3]; -extern bool Path3transfer; + bool StepReg() + { + reg += 4; -extern void _GSgifTransfer1(u32 *pMem, u32 addr); -extern void _GSgifTransfer2(u32 *pMem, u32 size); -extern void _GSgifTransfer3(u32 *pMem, u32 size); + if (reg == nreg) + { + reg = 0; + nloop--; -#endif + if (nloop == 0) return false; + } + + return true; + } + +} pathInfo; + +extern void _GSgifPacket(pathInfo *path, const u32 *pMem); +extern void _GSgifRegList(pathInfo *path, const u32 *pMem); +template +extern void _GSgifTransfer(const u32 *pMem, u32 size); +/*extern GIFRegHandler g_GIFPackedRegHandlers[]; +extern GIFRegHandler g_GIFRegHandlers[]; +extern void InitPath();*/ +#endif // GIFTRANSFER_H_INCLUDED diff --git a/plugins/GSnull/Registers.h b/plugins/GSnull/Registers.h index 55eb5580ce..60d13e089a 100644 --- a/plugins/GSnull/Registers.h +++ b/plugins/GSnull/Registers.h @@ -42,10 +42,171 @@ extern "C" #endif #include "emmintrin.h" -#include "GifTransfer.h" +//#include "GifTransfer.h" #pragma pack(push, 1) + +enum GIF_REG +{ + GIF_REG_PRIM = 0x00, + GIF_REG_RGBA = 0x01, + GIF_REG_STQ = 0x02, + GIF_REG_UV = 0x03, + GIF_REG_XYZF2 = 0x04, + GIF_REG_XYZ2 = 0x05, + GIF_REG_TEX0_1 = 0x06, + GIF_REG_TEX0_2 = 0x07, + GIF_REG_CLAMP_1 = 0x08, + GIF_REG_CLAMP_2 = 0x09, + GIF_REG_FOG = 0x0a, + GIF_REG_XYZF3 = 0x0c, + GIF_REG_XYZ3 = 0x0d, + GIF_REG_A_D = 0x0e, + GIF_REG_NOP = 0x0f, +}; + +enum GIF_A_D_REG +{ + GIF_A_D_REG_PRIM = 0x00, + GIF_A_D_REG_RGBAQ = 0x01, + GIF_A_D_REG_ST = 0x02, + GIF_A_D_REG_UV = 0x03, + GIF_A_D_REG_XYZF2 = 0x04, + GIF_A_D_REG_XYZ2 = 0x05, + GIF_A_D_REG_TEX0_1 = 0x06, + GIF_A_D_REG_TEX0_2 = 0x07, + GIF_A_D_REG_CLAMP_1 = 0x08, + GIF_A_D_REG_CLAMP_2 = 0x09, + GIF_A_D_REG_FOG = 0x0a, + GIF_A_D_REG_XYZF3 = 0x0c, + GIF_A_D_REG_XYZ3 = 0x0d, + GIF_A_D_REG_NOP = 0x0f, + GIF_A_D_REG_TEX1_1 = 0x14, + GIF_A_D_REG_TEX1_2 = 0x15, + GIF_A_D_REG_TEX2_1 = 0x16, + GIF_A_D_REG_TEX2_2 = 0x17, + GIF_A_D_REG_XYOFFSET_1 = 0x18, + GIF_A_D_REG_XYOFFSET_2 = 0x19, + GIF_A_D_REG_PRMODECONT = 0x1a, + GIF_A_D_REG_PRMODE = 0x1b, + GIF_A_D_REG_TEXCLUT = 0x1c, + GIF_A_D_REG_SCANMSK = 0x22, + GIF_A_D_REG_MIPTBP1_1 = 0x34, + GIF_A_D_REG_MIPTBP1_2 = 0x35, + GIF_A_D_REG_MIPTBP2_1 = 0x36, + GIF_A_D_REG_MIPTBP2_2 = 0x37, + GIF_A_D_REG_TEXA = 0x3b, + GIF_A_D_REG_FOGCOL = 0x3d, + GIF_A_D_REG_TEXFLUSH = 0x3f, + GIF_A_D_REG_SCISSOR_1 = 0x40, + GIF_A_D_REG_SCISSOR_2 = 0x41, + GIF_A_D_REG_ALPHA_1 = 0x42, + GIF_A_D_REG_ALPHA_2 = 0x43, + GIF_A_D_REG_DIMX = 0x44, + GIF_A_D_REG_DTHE = 0x45, + GIF_A_D_REG_COLCLAMP = 0x46, + GIF_A_D_REG_TEST_1 = 0x47, + GIF_A_D_REG_TEST_2 = 0x48, + GIF_A_D_REG_PABE = 0x49, + GIF_A_D_REG_FBA_1 = 0x4a, + GIF_A_D_REG_FBA_2 = 0x4b, + GIF_A_D_REG_FRAME_1 = 0x4c, + GIF_A_D_REG_FRAME_2 = 0x4d, + GIF_A_D_REG_ZBUF_1 = 0x4e, + GIF_A_D_REG_ZBUF_2 = 0x4f, + GIF_A_D_REG_BITBLTBUF = 0x50, + GIF_A_D_REG_TRXPOS = 0x51, + GIF_A_D_REG_TRXREG = 0x52, + GIF_A_D_REG_TRXDIR = 0x53, + GIF_A_D_REG_HWREG = 0x54, + GIF_A_D_REG_SIGNAL = 0x60, + GIF_A_D_REG_FINISH = 0x61, + GIF_A_D_REG_LABEL = 0x62, +}; + +// In case we want to change to/from __fastcall for GIF register handlers: +#define __gifCall __fastcall + +/*typedef void __gifCall FnType_GIFRegHandler(const u32* data); +typedef FnType_GIFRegHandler* GIFRegHandler; + +extern FnType_GIFRegHandler GIFPackedRegHandlerNull; +extern FnType_GIFRegHandler GIFPackedRegHandlerRGBA; +extern FnType_GIFRegHandler GIFPackedRegHandlerSTQ; +extern FnType_GIFRegHandler GIFPackedRegHandlerUV; +extern FnType_GIFRegHandler GIFPackedRegHandlerXYZF2; +extern FnType_GIFRegHandler GIFPackedRegHandlerXYZ2; +extern FnType_GIFRegHandler GIFPackedRegHandlerFOG; +extern FnType_GIFRegHandler GIFPackedRegHandlerA_D; +extern FnType_GIFRegHandler GIFPackedRegHandlerNOP; + +// These are unimplemented, and fall back on the non-packed versions. +extern FnType_GIFRegHandler GIFPackedRegHandlerPRIM; +extern FnType_GIFRegHandler GIFPackedRegHandlerTEX0_1; +extern FnType_GIFRegHandler GIFPackedRegHandlerTEX0_2; +extern FnType_GIFRegHandler GIFPackedRegHandlerCLAMP_1; +extern FnType_GIFRegHandler GIFPackedRegHandlerCLAMP_2; +extern FnType_GIFRegHandler GIFPackedRegHandlerXYZF3; +extern FnType_GIFRegHandler GIFPackedRegHandlerXYZ3; + +extern FnType_GIFRegHandler GIFRegHandlerNull; +extern FnType_GIFRegHandler GIFRegHandlerPRIM; +extern FnType_GIFRegHandler GIFRegHandlerRGBAQ; +extern FnType_GIFRegHandler GIFRegHandlerST; +extern FnType_GIFRegHandler GIFRegHandlerUV; +extern FnType_GIFRegHandler GIFRegHandlerXYZF2; +extern FnType_GIFRegHandler GIFRegHandlerXYZ2; +extern FnType_GIFRegHandler GIFRegHandlerTEX0_1; +extern FnType_GIFRegHandler GIFRegHandlerTEX0_2; +extern FnType_GIFRegHandler GIFRegHandlerCLAMP_1; +extern FnType_GIFRegHandler GIFRegHandlerCLAMP_2; +extern FnType_GIFRegHandler GIFRegHandlerFOG; +extern FnType_GIFRegHandler GIFRegHandlerXYZF3; +extern FnType_GIFRegHandler GIFRegHandlerXYZ3; +extern FnType_GIFRegHandler GIFRegHandlerNOP; +extern FnType_GIFRegHandler GIFRegHandlerTEX1_1; +extern FnType_GIFRegHandler GIFRegHandlerTEX1_2; +extern FnType_GIFRegHandler GIFRegHandlerTEX2_1; +extern FnType_GIFRegHandler GIFRegHandlerTEX2_2; +extern FnType_GIFRegHandler GIFRegHandlerXYOFFSET_1; +extern FnType_GIFRegHandler GIFRegHandlerXYOFFSET_2; +extern FnType_GIFRegHandler GIFRegHandlerPRMODECONT; +extern FnType_GIFRegHandler GIFRegHandlerPRMODE; +extern FnType_GIFRegHandler GIFRegHandlerTEXCLUT; +extern FnType_GIFRegHandler GIFRegHandlerSCANMSK; +extern FnType_GIFRegHandler GIFRegHandlerMIPTBP1_1; +extern FnType_GIFRegHandler GIFRegHandlerMIPTBP1_2; +extern FnType_GIFRegHandler GIFRegHandlerMIPTBP2_1; +extern FnType_GIFRegHandler GIFRegHandlerMIPTBP2_2; +extern FnType_GIFRegHandler GIFRegHandlerTEXA; +extern FnType_GIFRegHandler GIFRegHandlerFOGCOL; +extern FnType_GIFRegHandler GIFRegHandlerTEXFLUSH; +extern FnType_GIFRegHandler GIFRegHandlerSCISSOR_1; +extern FnType_GIFRegHandler GIFRegHandlerSCISSOR_2; +extern FnType_GIFRegHandler GIFRegHandlerALPHA_1; +extern FnType_GIFRegHandler GIFRegHandlerALPHA_2; +extern FnType_GIFRegHandler GIFRegHandlerDIMX; +extern FnType_GIFRegHandler GIFRegHandlerDTHE; +extern FnType_GIFRegHandler GIFRegHandlerCOLCLAMP; +extern FnType_GIFRegHandler GIFRegHandlerTEST_1; +extern FnType_GIFRegHandler GIFRegHandlerTEST_2; +extern FnType_GIFRegHandler GIFRegHandlerPABE; +extern FnType_GIFRegHandler GIFRegHandlerFBA_1; +extern FnType_GIFRegHandler GIFRegHandlerFBA_2; +extern FnType_GIFRegHandler GIFRegHandlerFRAME_1; +extern FnType_GIFRegHandler GIFRegHandlerFRAME_2; +extern FnType_GIFRegHandler GIFRegHandlerZBUF_1; +extern FnType_GIFRegHandler GIFRegHandlerZBUF_2; +extern FnType_GIFRegHandler GIFRegHandlerBITBLTBUF; +extern FnType_GIFRegHandler GIFRegHandlerTRXPOS; +extern FnType_GIFRegHandler GIFRegHandlerTRXREG; +extern FnType_GIFRegHandler GIFRegHandlerTRXDIR; +extern FnType_GIFRegHandler GIFRegHandlerHWREG; +extern FnType_GIFRegHandler GIFRegHandlerSIGNAL; +extern FnType_GIFRegHandler GIFRegHandlerFINISH; +extern FnType_GIFRegHandler GIFRegHandlerLABEL;*/ + enum GS_PRIM { GS_POINTLIST = 0, @@ -420,7 +581,7 @@ REG_SET_END // // GIFTag -REG128(GIFTag) +/*REG128(GIFTag) u32 NLOOP:15; u32 EOP:1; u32 _PAD1:16; @@ -430,7 +591,7 @@ REG128(GIFTag) u32 FLG:2; // enum GIF_FLG u32 NREG:4; u64 REGS:64; -REG_END +REG_END*/ // GIFReg @@ -1051,3 +1212,4 @@ struct GSPrivRegSet }; #pragma pack(pop) + diff --git a/plugins/zzogl-pg/opengl/GifTransfer.cpp b/plugins/zzogl-pg/opengl/GifTransfer.cpp index dff38b219a..af684b88e0 100644 --- a/plugins/zzogl-pg/opengl/GifTransfer.cpp +++ b/plugins/zzogl-pg/opengl/GifTransfer.cpp @@ -45,7 +45,7 @@ __forceinline void gifTransferLog(int index, const u32 *pMem, u32 size) { #ifdef DEBUG_TRANSFER - if (conf.log /*& 0x20*/) + if (conf.log) { static int nSaveIndex = 0; ZZLog::Debug_Log("%d: p:%d %x", nSaveIndex++, index + 1, size);