GSnull: Add preliminary register code.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3617 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2010-08-06 22:58:30 +00:00
parent 4528621d5c
commit 02403e4c6d
10 changed files with 643 additions and 47 deletions

View File

@ -41,7 +41,8 @@ endif(CMAKE_BUILD_TYPE STREQUAL Release)
# GSnull sources
set(GSnullSources
GifTransfer.cpp
GS.cpp)
GS.cpp
Registers.cpp)
# GSnull headers
set(GSnullHeaders

View File

@ -49,6 +49,10 @@ GSVars gs;
#endif
void (*GSirq)();
extern void ResetRegs();
extern void SetMultithreaded();
extern void SetFrameSkip(bool skip);
extern void InitPath();
EXPORT_C_(u32) PS2EgetLibType()
{
@ -163,7 +167,11 @@ EXPORT_C_(s32) GSopen(void *pDsp, char *Title, int multithread)
//assert( GSirq != NULL );
err = GSOpenWindow(pDsp, Title);
gs.MultiThreaded = multithread;
ResetRegs();
SetMultithreaded();
InitPath();
SysPrintf("Opening GSnull\n");
return err;
}
@ -175,6 +183,11 @@ EXPORT_C_(s32) GSopen2( void *pDsp, u32 flags )
GSOpenWindow2(pDsp, flags);
gs.MultiThreaded = true;
ResetRegs();
SetMultithreaded();
InitPath();
SysPrintf("Opening GSnull (2)\n");
return 0;
}
@ -265,6 +278,7 @@ EXPORT_C_(void) GSsetGameCRC(int crc, int gameoptions)
// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done
EXPORT_C_(void) GSsetFrameSkip(int frameskip)
{
SetFrameSkip(frameskip != 0);
SysPrintf("Frameskip set to %d.\n", frameskip);
}

View File

@ -37,12 +37,6 @@ typedef struct _keyEvent keyEvent;
#include "GifTransfer.h"
#include "null/GSnull.h"
/*#ifdef _MSC_VER
#define EXPORT_C_(type) extern "C" __declspec(dllexport) type CALLBACK
#else
#define EXPORT_C_(type) extern "C" type
#endif*/
#ifdef _MSC_VER
#define EXPORT_C_(type) extern "C" type CALLBACK
#else
@ -66,6 +60,9 @@ typedef struct
u32 imageTransfer;
int MultiThreaded;
int nPath3Hack;
GIFReg regs;
GIFCTXTReg ctxt_regs[2];
} GSVars;
extern GSVars gs;

View File

@ -224,3 +224,9 @@ EXPORT_C_(void) GSgifTransfer(const u32 *pMem, u32 size)
_GSgifTransfer<3>(const_cast<u32*>(pMem), size);
#endif
}
void InitPath()
{
gs.path[0].mode = gs.path[1].mode = gs.path[2].mode = gs.path[3].mode = 0;
}

View File

@ -124,7 +124,7 @@ extern void _GSgifPacket(pathInfo *path, const u32 *pMem);
extern void _GSgifRegList(pathInfo *path, const u32 *pMem);
template<int index>
extern void _GSgifTransfer(const u32 *pMem, u32 size);
/*extern GIFRegHandler g_GIFPackedRegHandlers[];
extern GIFRegHandler g_GIFPackedRegHandlers[];
extern GIFRegHandler g_GIFRegHandlers[];
extern void InitPath();*/
/*extern void InitPath();*/
#endif // GIFTRANSFER_H_INCLUDED

View File

@ -59,6 +59,7 @@
<Unit filename="Linux.cpp" />
<Unit filename="Linux.h" />
<Unit filename="../ReadMe.txt" />
<Unit filename="../Registers.cpp" />
<Unit filename="../Registers.h" />
<Unit filename="../null/GSnull.cpp" />
<Unit filename="../null/GSnull.h" />

View File

@ -0,0 +1,546 @@
/* GSnull
* Copyright (C) 2004-2009 PCSX2 Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "GS.h"
#include "Registers.h"
GIFRegHandler g_GIFPackedRegHandlers[16];
GIFRegHandler g_GIFRegHandlers[256];
// For now, I'm just rigging this up to store all the register information coming in, without doing
// any of the normal processing.
void __gifCall GIFPackedRegHandlerNull(const u32* data)
{
}
// All these just call their non-packed equivalent.
void __gifCall GIFPackedRegHandlerPRIM(const u32* data) { GIFRegHandlerPRIM(data); }
template <u32 i>
void __gifCall GIFPackedRegHandlerTEX0(const u32* data)
{
GIFRegHandlerTEX0<i>(data);
}
template <u32 i>
void __gifCall GIFPackedRegHandlerCLAMP(const u32* data)
{
GIFRegHandlerCLAMP<i>(data);
}
void __gifCall GIFPackedRegHandlerTEX0_1(const u32* data) { GIFRegHandlerTEX0<0>(data); }
void __gifCall GIFPackedRegHandlerTEX0_2(const u32* data) { GIFRegHandlerTEX0<1>(data); }
void __gifCall GIFPackedRegHandlerCLAMP_1(const u32* data) { GIFRegHandlerCLAMP<0>(data); }
void __gifCall GIFPackedRegHandlerCLAMP_2(const u32* data) { GIFRegHandlerCLAMP<1>(data); }
void __gifCall GIFPackedRegHandlerXYZF3(const u32* data) { GIFRegHandlerXYZF3(data); }
void __gifCall GIFPackedRegHandlerXYZ3(const u32* data) { GIFRegHandlerXYZ3(data); }
void __gifCall GIFPackedRegHandlerRGBA(const u32* data)
{
GIFPackedRGBA* r = (GIFPackedRGBA*)(data);
gs.regs.RGBAQ.R = r->R;
gs.regs.RGBAQ.G = r->G;
gs.regs.RGBAQ.B = r->B;
gs.regs.RGBAQ.A = r->A;
gs.regs.RGBAQ.Q = gs.q;
}
void __gifCall GIFPackedRegHandlerSTQ(const u32* data)
{
GIFPackedSTQ* r = (GIFPackedSTQ*)(data);
gs.regs.ST.S = r->S;
gs.regs.ST.T = r->T;
gs.q = r->Q;
}
void __gifCall GIFPackedRegHandlerUV(const u32* data)
{
GIFPackedUV* r = (GIFPackedUV*)(data);
gs.regs.UV.U = r->U;
gs.regs.UV.V = r->V;
}
void __gifCall KickVertex(bool adc)
{
}
void __gifCall GIFPackedRegHandlerXYZF2(const u32* data)
{
GIFPackedXYZF2* r = (GIFPackedXYZF2*)(data);
gs.regs.XYZ.X = r->X;
gs.regs.XYZ.Y = r->Y;
gs.regs.XYZ.Z = r->Z;
gs.regs.FOG.F = r->F;
}
void __gifCall GIFPackedRegHandlerXYZ2(const u32* data)
{
GIFPackedXYZ2* r = (GIFPackedXYZ2*)(data);
gs.regs.XYZ.X = r->X;
gs.regs.XYZ.Y = r->Y;
gs.regs.XYZ.Z = r->Z;
}
void __gifCall GIFPackedRegHandlerFOG(const u32* data)
{
GIFPackedFOG* r = (GIFPackedFOG*)(data);
gs.regs.FOG.F = r->F;
}
void __gifCall GIFPackedRegHandlerA_D(const u32* data)
{
GIFPackedA_D* r = (GIFPackedA_D*)(data);
g_GIFRegHandlers[r->ADDR](data);
}
void __gifCall GIFPackedRegHandlerNOP(const u32* data)
{
}
void __gifCall GIFRegHandlerNull(const u32* data)
{
}
void __gifCall GIFRegHandlerRGBAQ(const u32* data)
{
GIFRegRGBAQ* r = (GIFRegRGBAQ*)(data);
gs.regs.RGBAQ._u64 = r->_u64;
}
void __gifCall GIFRegHandlerST(const u32* data)
{
GIFRegST* r = (GIFRegST*)(data);
gs.regs.ST._u64 = r->_u64;
}
void __gifCall GIFRegHandlerUV(const u32* data)
{
GIFRegUV* r = (GIFRegUV*)(data);
gs.regs.UV._u64 = r->_u64;
}
void __gifCall GIFRegHandlerXYZF2(const u32* data)
{
GIFRegXYZF* r = (GIFRegXYZF*)(data);
gs.regs.XYZF._u64 = r->_u64;
}
void __gifCall GIFRegHandlerXYZ2(const u32* data)
{
GIFRegXYZ* r = (GIFRegXYZ*)(data);
gs.regs.XYZ._u64 = r->_u64;
}
template <u32 i>
void __gifCall GIFRegHandlerTEX0(const u32* data)
{
GIFRegTEX0* r = (GIFRegTEX0*)(data);
gs.ctxt_regs[i].TEX0._u64 = r->_u64;
}
template <u32 i>
void __gifCall GIFRegHandlerCLAMP(const u32* data)
{
GIFRegCLAMP* r = (GIFRegCLAMP*)(data);
gs.ctxt_regs[i].CLAMP._u64 = r->_u64;
}
void __gifCall GIFRegHandlerFOG(const u32* data)
{
GIFRegFOG* r = (GIFRegFOG*)(data);
gs.regs.FOG.F = r->F;
}
void __gifCall GIFRegHandlerXYZF3(const u32* data)
{
GIFRegXYZF* r = (GIFRegXYZF*)(data);
gs.regs.XYZF._u64 = r->_u64;
}
void __gifCall GIFRegHandlerXYZ3(const u32* data)
{
GIFRegXYZ* r = (GIFRegXYZ*)(data);
gs.regs.XYZ._u64 = r->_u64;
}
void __gifCall GIFRegHandlerNOP(const u32* data)
{
}
template <u32 i>
void __fastcall GIFRegHandlerTEX1(const u32* data)
{
GIFRegTEX1* r = (GIFRegTEX1*)(data);
gs.ctxt_regs[i].TEX1._u64 = r->_u64;
}
template <u32 i>
void __gifCall GIFRegHandlerTEX2(const u32* data)
{
GIFRegTEX2* r = (GIFRegTEX2*)(data);
gs.ctxt_regs[i].TEX2._u64 = r->_u64;
}
template <u32 i>
void __gifCall GIFRegHandlerXYOFFSET(const u32* data)
{
GIFRegXYOFFSET* r = (GIFRegXYOFFSET*)(data);
gs.ctxt_regs[i].XYOFFSET.OFX = r->OFX;
gs.ctxt_regs[i].XYOFFSET.OFY = r->OFY;
}
// Fill out the vertex queue(prim) and the attributes.
void __gifCall GIFRegHandlerPRIM(const u32 *data)
{
GIFRegPRIM* r = (GIFRegPRIM*)(data);
gs.regs.PRIM._u64 = r->_u64;
}
// Fill out an alternate set of attributes.
void __gifCall GIFRegHandlerPRMODE(const u32* data)
{
GIFRegPRMODE* r = (GIFRegPRMODE*)(data);
gs.regs.PRMODE._u64 = r->_u64;
}
// Switch between the primary set of attributes and the secondary.
void __gifCall GIFRegHandlerPRMODECONT(const u32* data)
{
GIFRegPRMODECONT* r = (GIFRegPRMODECONT*)(data);
gs.regs.PRMODECONT._u64 = r->_u64;
}
void __gifCall GIFRegHandlerTEXCLUT(const u32* data)
{
GIFRegTEXCLUT* r = (GIFRegTEXCLUT*)(data);
gs.regs.TEXCLUT._u64 = r->_u64;
}
void __gifCall GIFRegHandlerSCANMSK(const u32* data)
{
GIFRegSCANMSK* r = (GIFRegSCANMSK*)(data);
gs.regs.SCANMSK._u64 = r->_u64;
}
template <u32 i>
void __gifCall GIFRegHandlerMIPTBP1(const u32* data)
{
GIFRegMIPTBP1* r = (GIFRegMIPTBP1*)(data);
gs.ctxt_regs[i].MIPTBP1._u64 = r->_u64;
}
template <u32 i>
void __gifCall GIFRegHandlerMIPTBP2(const u32* data)
{
GIFRegMIPTBP2* r = (GIFRegMIPTBP2*)(data);
gs.ctxt_regs[i].MIPTBP2._u64 = r->_u64;
}
void __gifCall GIFRegHandlerTEXA(const u32* data)
{
GIFRegTEXA* r = (GIFRegTEXA*)(data);
gs.regs.TEXA._u64 = r->_u64;
}
void __gifCall GIFRegHandlerFOGCOL(const u32* data)
{
GIFRegFOGCOL* r = (GIFRegFOGCOL*)(data);
gs.regs.FOGCOL._u64 = r->_u64;
}
void __gifCall GIFRegHandlerTEXFLUSH(const u32* data)
{
GIFRegTEXFLUSH* r = (GIFRegTEXFLUSH*)(data);
gs.regs.TEXFLUSH._u64 = r->_u64;
}
template <u32 i>
void __gifCall GIFRegHandlerSCISSOR(const u32* data)
{
GIFRegSCISSOR* r = (GIFRegSCISSOR*)(data);
gs.ctxt_regs[i].SCISSOR._u64 = r->_u64;
}
template <u32 i>
void __gifCall GIFRegHandlerALPHA(const u32* data)
{
GIFRegALPHA* r = (GIFRegALPHA*)(data);
gs.ctxt_regs[i].ALPHA._u64 = r->_u64;
}
void __gifCall GIFRegHandlerDIMX(const u32* data)
{
GIFRegDIMX* r = (GIFRegDIMX*)(data);
gs.regs.DIMX._u64 = r->_u64;
}
void __gifCall GIFRegHandlerDTHE(const u32* data)
{
GIFRegDTHE* r = (GIFRegDTHE*)(data);
gs.regs.DTHE._u64 = r->_u64;
}
void __gifCall GIFRegHandlerCOLCLAMP(const u32* data)
{
GIFRegCOLCLAMP* r = (GIFRegCOLCLAMP*)(data);
gs.regs.COLCLAMP._u64 = r->_u64;
}
template <u32 i>
void __gifCall GIFRegHandlerTEST(const u32* data)
{
GIFRegTEST* r = (GIFRegTEST*)(data);
gs.ctxt_regs[i].TEST._u64 = r->_u64;
}
void __gifCall GIFRegHandlerPABE(const u32* data)
{
GIFRegPABE* r = (GIFRegPABE*)(data);
gs.regs.PABE._u64 = r->_u64;
}
template <u32 i>
void __gifCall GIFRegHandlerFBA(const u32* data)
{
GIFRegFBA* r = (GIFRegFBA*)(data);
gs.ctxt_regs[i].FBA._u64 = r->_u64;
}
template<u32 i>
void __gifCall GIFRegHandlerFRAME(const u32* data)
{
GIFRegFRAME* r = (GIFRegFRAME*)(data);
gs.ctxt_regs[i].FRAME._u64 = r->_u64;
}
template <u32 i>
void __gifCall GIFRegHandlerZBUF(const u32* data)
{
GIFRegZBUF* r = (GIFRegZBUF*)(data);
gs.ctxt_regs[i].ZBUF._u64 = r->_u64;
}
void __gifCall GIFRegHandlerBITBLTBUF(const u32* data)
{
GIFRegBITBLTBUF* r = (GIFRegBITBLTBUF*)(data);
gs.regs.BITBLTBUF._u64 = r->_u64;
}
void __gifCall GIFRegHandlerTRXPOS(const u32* data)
{
GIFRegTRXPOS* r = (GIFRegTRXPOS*)(data);
gs.regs.TRXPOS._u64 = r->_u64;
}
void __gifCall GIFRegHandlerTRXREG(const u32* data)
{
GIFRegTRXREG* r = (GIFRegTRXREG*)(data);
gs.regs.TRXREG._u64 = r->_u64;
}
void __gifCall GIFRegHandlerTRXDIR(const u32* data)
{
GIFRegTRXDIR* r = (GIFRegTRXDIR*)(data);
gs.regs.TRXDIR._u64 = r->_u64;
}
void __gifCall GIFRegHandlerHWREG(const u32* data)
{
GIFRegHWREG* r = (GIFRegHWREG*)(data);
gs.regs.HWREG._u64 = r->_u64;
}
void __gifCall GIFRegHandlerSIGNAL(const u32* data)
{
GIFRegSIGNAL* r = (GIFRegSIGNAL*)(data);
gs.regs.SIGNAL._u64 = r->_u64;
}
void __gifCall GIFRegHandlerFINISH(const u32* data)
{
GIFRegFINISH* r = (GIFRegFINISH*)(data);
gs.regs.FINISH._u64 = r->_u64;
}
void __gifCall GIFRegHandlerLABEL(const u32* data)
{
GIFRegLABEL* r = (GIFRegLABEL*)(data);
gs.regs.LABEL._u64 = r->_u64;
}
void SetMultithreaded()
{
// Some older versions of PCSX2 didn't properly set the irq callback to NULL
// in multithreaded mode (possibly because ZeroGS itself would assert in such
// cases), and didn't bind them to a dummy callback either. PCSX2 handles all
// IRQs internally when multithreaded anyway -- so let's ignore them here:
if (gs.MultiThreaded)
{
g_GIFRegHandlers[GIF_A_D_REG_SIGNAL] = &GIFRegHandlerNull;
g_GIFRegHandlers[GIF_A_D_REG_FINISH] = &GIFRegHandlerNull;
g_GIFRegHandlers[GIF_A_D_REG_LABEL] = &GIFRegHandlerNull;
}
else
{
g_GIFRegHandlers[GIF_A_D_REG_SIGNAL] = &GIFRegHandlerSIGNAL;
g_GIFRegHandlers[GIF_A_D_REG_FINISH] = &GIFRegHandlerFINISH;
g_GIFRegHandlers[GIF_A_D_REG_LABEL] = &GIFRegHandlerLABEL;
}
}
void ResetRegs()
{
for (int i = 0; i < 16; i++)
{
g_GIFPackedRegHandlers[i] = &GIFPackedRegHandlerNull;
}
g_GIFPackedRegHandlers[GIF_REG_PRIM] = &GIFPackedRegHandlerPRIM;
g_GIFPackedRegHandlers[GIF_REG_RGBA] = &GIFPackedRegHandlerRGBA;
g_GIFPackedRegHandlers[GIF_REG_STQ] = &GIFPackedRegHandlerSTQ;
g_GIFPackedRegHandlers[GIF_REG_UV] = &GIFPackedRegHandlerUV;
g_GIFPackedRegHandlers[GIF_REG_XYZF2] = &GIFPackedRegHandlerXYZF2;
g_GIFPackedRegHandlers[GIF_REG_XYZ2] = &GIFPackedRegHandlerXYZ2;
g_GIFPackedRegHandlers[GIF_REG_TEX0_1] = &GIFPackedRegHandlerTEX0<0>;
g_GIFPackedRegHandlers[GIF_REG_TEX0_2] = &GIFPackedRegHandlerTEX0<1>;
g_GIFPackedRegHandlers[GIF_REG_CLAMP_1] = &GIFPackedRegHandlerCLAMP<0>;
g_GIFPackedRegHandlers[GIF_REG_CLAMP_2] = &GIFPackedRegHandlerCLAMP<1>;
g_GIFPackedRegHandlers[GIF_REG_FOG] = &GIFPackedRegHandlerFOG;
g_GIFPackedRegHandlers[GIF_REG_XYZF3] = &GIFPackedRegHandlerXYZF3;
g_GIFPackedRegHandlers[GIF_REG_XYZ3] = &GIFPackedRegHandlerXYZ3;
g_GIFPackedRegHandlers[GIF_REG_A_D] = &GIFPackedRegHandlerA_D;
g_GIFPackedRegHandlers[GIF_REG_NOP] = &GIFPackedRegHandlerNOP;
for (int i = 0; i < 256; i++)
{
g_GIFRegHandlers[i] = &GIFPackedRegHandlerNull;
}
g_GIFRegHandlers[GIF_A_D_REG_PRIM] = &GIFRegHandlerPRIM;
g_GIFRegHandlers[GIF_A_D_REG_RGBAQ] = &GIFRegHandlerRGBAQ;
g_GIFRegHandlers[GIF_A_D_REG_ST] = &GIFRegHandlerST;
g_GIFRegHandlers[GIF_A_D_REG_UV] = &GIFRegHandlerUV;
g_GIFRegHandlers[GIF_A_D_REG_XYZF2] = &GIFRegHandlerXYZF2;
g_GIFRegHandlers[GIF_A_D_REG_XYZ2] = &GIFRegHandlerXYZ2;
g_GIFRegHandlers[GIF_A_D_REG_TEX0_1] = &GIFRegHandlerTEX0<0>;
g_GIFRegHandlers[GIF_A_D_REG_TEX0_2] = &GIFRegHandlerTEX0<1>;
g_GIFRegHandlers[GIF_A_D_REG_CLAMP_1] = &GIFRegHandlerCLAMP<0>;
g_GIFRegHandlers[GIF_A_D_REG_CLAMP_2] = &GIFRegHandlerCLAMP<1>;
g_GIFRegHandlers[GIF_A_D_REG_FOG] = &GIFRegHandlerFOG;
g_GIFRegHandlers[GIF_A_D_REG_XYZF3] = &GIFRegHandlerXYZF3;
g_GIFRegHandlers[GIF_A_D_REG_XYZ3] = &GIFRegHandlerXYZ3;
g_GIFRegHandlers[GIF_A_D_REG_NOP] = &GIFRegHandlerNOP;
g_GIFRegHandlers[GIF_A_D_REG_TEX1_1] = &GIFRegHandlerTEX1<0>;
g_GIFRegHandlers[GIF_A_D_REG_TEX1_2] = &GIFRegHandlerTEX1<1>;
g_GIFRegHandlers[GIF_A_D_REG_TEX2_1] = &GIFRegHandlerTEX2<0>;
g_GIFRegHandlers[GIF_A_D_REG_TEX2_2] = &GIFRegHandlerTEX2<1>;
g_GIFRegHandlers[GIF_A_D_REG_XYOFFSET_1] = &GIFRegHandlerXYOFFSET<0>;
g_GIFRegHandlers[GIF_A_D_REG_XYOFFSET_2] = &GIFRegHandlerXYOFFSET<1>;
g_GIFRegHandlers[GIF_A_D_REG_PRMODECONT] = &GIFRegHandlerPRMODECONT;
g_GIFRegHandlers[GIF_A_D_REG_PRMODE] = &GIFRegHandlerPRMODE;
g_GIFRegHandlers[GIF_A_D_REG_TEXCLUT] = &GIFRegHandlerTEXCLUT;
g_GIFRegHandlers[GIF_A_D_REG_SCANMSK] = &GIFRegHandlerSCANMSK;
g_GIFRegHandlers[GIF_A_D_REG_MIPTBP1_1] = &GIFRegHandlerMIPTBP1<0>;
g_GIFRegHandlers[GIF_A_D_REG_MIPTBP1_2] = &GIFRegHandlerMIPTBP1<1>;
g_GIFRegHandlers[GIF_A_D_REG_MIPTBP2_1] = &GIFRegHandlerMIPTBP2<0>;
g_GIFRegHandlers[GIF_A_D_REG_MIPTBP2_2] = &GIFRegHandlerMIPTBP2<1>;
g_GIFRegHandlers[GIF_A_D_REG_TEXA] = &GIFRegHandlerTEXA;
g_GIFRegHandlers[GIF_A_D_REG_FOGCOL] = &GIFRegHandlerFOGCOL;
g_GIFRegHandlers[GIF_A_D_REG_TEXFLUSH] = &GIFRegHandlerTEXFLUSH;
g_GIFRegHandlers[GIF_A_D_REG_SCISSOR_1] = &GIFRegHandlerSCISSOR<0>;
g_GIFRegHandlers[GIF_A_D_REG_SCISSOR_2] = &GIFRegHandlerSCISSOR<1>;
g_GIFRegHandlers[GIF_A_D_REG_ALPHA_1] = &GIFRegHandlerALPHA<0>;
g_GIFRegHandlers[GIF_A_D_REG_ALPHA_2] = &GIFRegHandlerALPHA<1>;
g_GIFRegHandlers[GIF_A_D_REG_DIMX] = &GIFRegHandlerDIMX;
g_GIFRegHandlers[GIF_A_D_REG_DTHE] = &GIFRegHandlerDTHE;
g_GIFRegHandlers[GIF_A_D_REG_COLCLAMP] = &GIFRegHandlerCOLCLAMP;
g_GIFRegHandlers[GIF_A_D_REG_TEST_1] = &GIFRegHandlerTEST<0>;
g_GIFRegHandlers[GIF_A_D_REG_TEST_2] = &GIFRegHandlerTEST<1>;
g_GIFRegHandlers[GIF_A_D_REG_PABE] = &GIFRegHandlerPABE;
g_GIFRegHandlers[GIF_A_D_REG_FBA_1] = &GIFRegHandlerFBA<0>;
g_GIFRegHandlers[GIF_A_D_REG_FBA_2] = &GIFRegHandlerFBA<1>;
g_GIFRegHandlers[GIF_A_D_REG_FRAME_1] = &GIFRegHandlerFRAME<0>;
g_GIFRegHandlers[GIF_A_D_REG_FRAME_2] = &GIFRegHandlerFRAME<1>;
g_GIFRegHandlers[GIF_A_D_REG_ZBUF_1] = &GIFRegHandlerZBUF<0>;
g_GIFRegHandlers[GIF_A_D_REG_ZBUF_2] = &GIFRegHandlerZBUF<1>;
g_GIFRegHandlers[GIF_A_D_REG_BITBLTBUF] = &GIFRegHandlerBITBLTBUF;
g_GIFRegHandlers[GIF_A_D_REG_TRXPOS] = &GIFRegHandlerTRXPOS;
g_GIFRegHandlers[GIF_A_D_REG_TRXREG] = &GIFRegHandlerTRXREG;
g_GIFRegHandlers[GIF_A_D_REG_TRXDIR] = &GIFRegHandlerTRXDIR;
g_GIFRegHandlers[GIF_A_D_REG_HWREG] = &GIFRegHandlerHWREG;
SetMultithreaded();
}
void SetFrameSkip(bool skip)
{
if (skip)
{
g_GIFPackedRegHandlers[GIF_REG_PRIM] = &GIFPackedRegHandlerNOP;
g_GIFPackedRegHandlers[GIF_REG_RGBA] = &GIFPackedRegHandlerNOP;
g_GIFPackedRegHandlers[GIF_REG_STQ] = &GIFPackedRegHandlerNOP;
g_GIFPackedRegHandlers[GIF_REG_UV] = &GIFPackedRegHandlerNOP;
g_GIFPackedRegHandlers[GIF_REG_XYZF2] = &GIFPackedRegHandlerNOP;
g_GIFPackedRegHandlers[GIF_REG_XYZ2] = &GIFPackedRegHandlerNOP;
g_GIFPackedRegHandlers[GIF_REG_CLAMP_1] = &GIFPackedRegHandlerNOP;
g_GIFPackedRegHandlers[GIF_REG_CLAMP_2] = &GIFPackedRegHandlerNOP;
g_GIFPackedRegHandlers[GIF_REG_FOG] = &GIFPackedRegHandlerNOP;
g_GIFPackedRegHandlers[GIF_REG_XYZF3] = &GIFPackedRegHandlerNOP;
g_GIFPackedRegHandlers[GIF_REG_XYZ3] = &GIFPackedRegHandlerNOP;
g_GIFRegHandlers[GIF_A_D_REG_PRIM] = &GIFRegHandlerNOP;
g_GIFRegHandlers[GIF_A_D_REG_RGBAQ] = &GIFRegHandlerNOP;
g_GIFRegHandlers[GIF_A_D_REG_ST] = &GIFRegHandlerNOP;
g_GIFRegHandlers[GIF_A_D_REG_UV] = &GIFRegHandlerNOP;
g_GIFRegHandlers[GIF_A_D_REG_XYZF2] = &GIFRegHandlerNOP;
g_GIFRegHandlers[GIF_A_D_REG_XYZ2] = &GIFRegHandlerNOP;
g_GIFRegHandlers[GIF_A_D_REG_XYZF3] = &GIFRegHandlerNOP;
g_GIFRegHandlers[GIF_A_D_REG_XYZ3] = &GIFRegHandlerNOP;
g_GIFRegHandlers[GIF_A_D_REG_PRMODECONT] = &GIFRegHandlerNOP;
g_GIFRegHandlers[GIF_A_D_REG_PRMODE] = &GIFRegHandlerNOP;
}
else
{
g_GIFPackedRegHandlers[GIF_REG_PRIM] = &GIFPackedRegHandlerPRIM;
g_GIFPackedRegHandlers[GIF_REG_RGBA] = &GIFPackedRegHandlerRGBA;
g_GIFPackedRegHandlers[GIF_REG_STQ] = &GIFPackedRegHandlerSTQ;
g_GIFPackedRegHandlers[GIF_REG_UV] = &GIFPackedRegHandlerUV;
g_GIFPackedRegHandlers[GIF_REG_XYZF2] = &GIFPackedRegHandlerXYZF2;
g_GIFPackedRegHandlers[GIF_REG_XYZ2] = &GIFPackedRegHandlerXYZ2;
g_GIFPackedRegHandlers[GIF_REG_CLAMP_1] = &GIFPackedRegHandlerCLAMP<0>;
g_GIFPackedRegHandlers[GIF_REG_CLAMP_2] = &GIFPackedRegHandlerCLAMP<1>;
g_GIFPackedRegHandlers[GIF_REG_FOG] = &GIFPackedRegHandlerFOG;
g_GIFPackedRegHandlers[GIF_REG_XYZF3] = &GIFPackedRegHandlerXYZF3;
g_GIFPackedRegHandlers[GIF_REG_XYZ3] = &GIFPackedRegHandlerXYZ3;
g_GIFRegHandlers[GIF_A_D_REG_PRIM] = &GIFRegHandlerPRIM;
g_GIFRegHandlers[GIF_A_D_REG_RGBAQ] = &GIFRegHandlerRGBAQ;
g_GIFRegHandlers[GIF_A_D_REG_ST] = &GIFRegHandlerST;
g_GIFRegHandlers[GIF_A_D_REG_UV] = &GIFRegHandlerUV;
g_GIFRegHandlers[GIF_A_D_REG_XYZF2] = &GIFRegHandlerXYZF2;
g_GIFRegHandlers[GIF_A_D_REG_XYZ2] = &GIFRegHandlerXYZ2;
g_GIFRegHandlers[GIF_A_D_REG_XYZF3] = &GIFRegHandlerXYZF3;
g_GIFRegHandlers[GIF_A_D_REG_XYZ3] = &GIFRegHandlerXYZ3;
g_GIFRegHandlers[GIF_A_D_REG_PRMODECONT] = &GIFRegHandlerPRMODECONT;
g_GIFRegHandlers[GIF_A_D_REG_PRMODE] = &GIFRegHandlerPRMODE;
}
}

View File

@ -18,11 +18,6 @@
// These enums & structures are copied from GSdx, which got them from sp2dev 0.4.0.
// In fact, after looking at both ZeroGS and GSdx, and seeing how similar this section is on both,
// I'm just going to blatantly copy most of GS.h here and localize.
// And if this is kept close enough to GSdx's code, if should make porting GSdx to Linux a bit easier...
// sp2dev is Copyright (C) 2002 Terratron Technologies Inc. All Rights Reserved.
// http://window.terratron.com/~sosman/ps2linux/
//
@ -30,6 +25,9 @@
// http://www.gabest.org
//
#ifndef __REGISTERS_H__
#define __REGISTERS_H__
#ifdef __cplusplus
extern "C"
{
@ -42,7 +40,6 @@ extern "C"
#endif
#include "emmintrin.h"
//#include "GifTransfer.h"
#pragma pack(push, 1)
@ -128,7 +125,7 @@ enum GIF_A_D_REG
// 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 void __gifCall FnType_GIFRegHandler(const u32* data);
typedef FnType_GIFRegHandler* GIFRegHandler;
extern FnType_GIFRegHandler GIFPackedRegHandlerNull;
@ -143,10 +140,13 @@ 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;
template<u32 i>
extern FnType_GIFRegHandler GIFPackedRegHandlerTEX0;
template<u32 i>
extern FnType_GIFRegHandler GIFPackedRegHandlerCLAMP;
extern FnType_GIFRegHandler GIFPackedRegHandlerXYZF3;
extern FnType_GIFRegHandler GIFPackedRegHandlerXYZ3;
@ -157,47 +157,56 @@ 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;
template<u32 i>
extern FnType_GIFRegHandler GIFRegHandlerTEX0;
template<u32 i>
extern FnType_GIFRegHandler GIFRegHandlerCLAMP;
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;
template <u32 i>
extern FnType_GIFRegHandler GIFRegHandlerTEX1;
template <u32 i>
extern FnType_GIFRegHandler GIFRegHandlerTEX2;
template <u32 i>
extern FnType_GIFRegHandler GIFRegHandlerXYOFFSET;
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;
template <u32 i>
extern FnType_GIFRegHandler GIFRegHandlerMIPTBP1;
template <u32 i>
extern FnType_GIFRegHandler GIFRegHandlerMIPTBP2;
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;
template <u32 i>
extern FnType_GIFRegHandler GIFRegHandlerSCISSOR;
template <u32 i>
extern FnType_GIFRegHandler GIFRegHandlerALPHA;
extern FnType_GIFRegHandler GIFRegHandlerDIMX;
extern FnType_GIFRegHandler GIFRegHandlerDTHE;
extern FnType_GIFRegHandler GIFRegHandlerCOLCLAMP;
extern FnType_GIFRegHandler GIFRegHandlerTEST_1;
extern FnType_GIFRegHandler GIFRegHandlerTEST_2;
template <u32 i>
extern FnType_GIFRegHandler GIFRegHandlerTEST;
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;
template <u32 i>
extern FnType_GIFRegHandler GIFRegHandlerFBA;
template <u32 i>
extern FnType_GIFRegHandler GIFRegHandlerFRAME;
template <u32 i>
extern FnType_GIFRegHandler GIFRegHandlerZBUF;
extern FnType_GIFRegHandler GIFRegHandlerBITBLTBUF;
extern FnType_GIFRegHandler GIFRegHandlerTRXPOS;
extern FnType_GIFRegHandler GIFRegHandlerTRXREG;
@ -205,7 +214,7 @@ extern FnType_GIFRegHandler GIFRegHandlerTRXDIR;
extern FnType_GIFRegHandler GIFRegHandlerHWREG;
extern FnType_GIFRegHandler GIFRegHandlerSIGNAL;
extern FnType_GIFRegHandler GIFRegHandlerFINISH;
extern FnType_GIFRegHandler GIFRegHandlerLABEL;*/
extern FnType_GIFRegHandler GIFRegHandlerLABEL;
enum GS_PRIM
{
@ -1053,6 +1062,22 @@ REG64_SET(GIFReg)
GIFRegZBUF ZBUF;
REG_SET_END
REG64_SET(GIFCTXTReg)
GIFRegTEX0 TEX0;
GIFRegCLAMP CLAMP;
GIFRegTEX1 TEX1;
GIFRegTEX2 TEX2;
GIFRegXYOFFSET XYOFFSET;
GIFRegMIPTBP1 MIPTBP1;
GIFRegMIPTBP2 MIPTBP2;
GIFRegSCISSOR SCISSOR;
GIFRegALPHA ALPHA;
GIFRegTEST TEST;
GIFRegFBA FBA;
GIFRegFRAME FRAME;
GIFRegZBUF ZBUF;
REG_SET_END
// GIFPacked
REG128_(GIFPacked, PRIM)
@ -1212,4 +1237,5 @@ struct GSPrivRegSet
};
#pragma pack(pop)
#endif

View File

@ -74,6 +74,7 @@
<ClCompile Include="Config.cpp" />
<ClCompile Include="..\GifTransfer.cpp" />
<ClCompile Include="..\GS.cpp" />
<ClCompile Include="..\Registers.cpp" />
<ClCompile Include="..\Linux\GSLinux.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>

View File

@ -160,6 +160,10 @@
RelativePath="..\GS.cpp"
>
</File>
<File
RelativePath="..\Registers.cpp"
>
</File>
<File
RelativePath="..\Linux\GSLinux.cpp"
>