mirror of https://github.com/PCSX2/pcsx2.git
newVif: Cleaned up some code and added some Cleanup code. :D
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2448 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
fbb95f85e4
commit
33bc8652e2
|
@ -1187,6 +1187,11 @@ void vif1Reset()
|
||||||
|
|
||||||
vif1.done = true;
|
vif1.done = true;
|
||||||
cpuRegs.interrupt &= ~((1 << 1) | (1 << 10)); //Stop all vif1 DMA's
|
cpuRegs.interrupt &= ~((1 << 1) | (1 << 10)); //Stop all vif1 DMA's
|
||||||
|
|
||||||
|
#if newVif1
|
||||||
|
extern void resetNewVif(int idx);
|
||||||
|
resetNewVif(1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveStateBase::vif1Freeze()
|
void SaveStateBase::vif1Freeze()
|
||||||
|
|
|
@ -25,32 +25,18 @@
|
||||||
static __aligned16 nVifBlock _vBlock = {0};
|
static __aligned16 nVifBlock _vBlock = {0};
|
||||||
static __pagealigned u8 nVifMemCmp[__pagesize];
|
static __pagealigned u8 nVifMemCmp[__pagesize];
|
||||||
|
|
||||||
static void emitCustomCompare() {
|
|
||||||
HostSys::MemProtectStatic(nVifMemCmp, Protect_ReadWrite, false);
|
|
||||||
memset8<0xcc>(nVifMemCmp);
|
|
||||||
xSetPtr(nVifMemCmp);
|
|
||||||
|
|
||||||
xMOVAPS (xmm0, ptr32[ecx]);
|
|
||||||
xPCMP.EQD(xmm0, ptr32[edx]);
|
|
||||||
xMOVMSKPS(eax, xmm0);
|
|
||||||
xAND (eax, 0x7); // ignore top 4 bytes (recBlock pointer)
|
|
||||||
|
|
||||||
xRET();
|
|
||||||
HostSys::MemProtectStatic(nVifMemCmp, Protect_ReadOnly, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dVifInit(int idx) {
|
void dVifInit(int idx) {
|
||||||
nVif[idx].idx = idx;
|
nVif[idx].numBlocks = 0;
|
||||||
nVif[idx].VU = idx ? &VU1 : &VU0;
|
|
||||||
nVif[idx].vif = idx ? &vif1 : &vif0;
|
|
||||||
nVif[idx].vifRegs = idx ? vif1Regs : vif0Regs;
|
|
||||||
nVif[idx].vuMemEnd = idx ? ((u8*)(VU1.Mem + 0x4000)) : ((u8*)(VU0.Mem + 0x1000));
|
|
||||||
nVif[idx].vuMemLimit= idx ? 0x3ff0 : 0xff0;
|
|
||||||
nVif[idx].vifCache = new BlockBuffer(_1mb*4); // 4mb Rec Cache
|
nVif[idx].vifCache = new BlockBuffer(_1mb*4); // 4mb Rec Cache
|
||||||
nVif[idx].vifBlocks = new HashBucket<_tParams>();
|
nVif[idx].vifBlocks = new HashBucket<_tParams>();
|
||||||
nVif[idx].recPtr = nVif[idx].vifCache->getBlock();
|
nVif[idx].recPtr = nVif[idx].vifCache->getBlock();
|
||||||
nVif[idx].recEnd = &nVif[idx].recPtr[nVif[idx].vifCache->getSize()-(_1mb/4)]; // .25mb Safe Zone
|
nVif[idx].recEnd = &nVif[idx].recPtr[nVif[idx].vifCache->getSize()-(_1mb/4)]; // .25mb Safe Zone
|
||||||
//emitCustomCompare();
|
}
|
||||||
|
|
||||||
|
void dVifClose(int idx) {
|
||||||
|
nVif[idx].numBlocks = 0;
|
||||||
|
safe_delete(nVif[idx].vifCache);
|
||||||
|
safe_delete(nVif[idx].vifBlocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loads Row/Col Data from vifRegs instead of g_vifmask
|
// Loads Row/Col Data from vifRegs instead of g_vifmask
|
||||||
|
@ -287,8 +273,7 @@ _f void dVifUnpack(int idx, u8 *data, u32 size, bool isFill) {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
static int recBlockNum = 0;
|
DevCon.WriteLn("nVif: Recompiled Block! [%d]", nVif[idx].numBlocks++);
|
||||||
DevCon.WriteLn("nVif: Recompiled Block! [%d]", recBlockNum++);
|
|
||||||
//DevCon.WriteLn(L"[num=% 3d][upkType=0x%02x][scl=%d][cl=%d][wl=%d][mode=%d][m=%d][mask=%s]",
|
//DevCon.WriteLn(L"[num=% 3d][upkType=0x%02x][scl=%d][cl=%d][wl=%d][mode=%d][m=%d][mask=%s]",
|
||||||
// _vBlock.num, _vBlock.upkType, _vBlock.scl, _vBlock.cl, _vBlock.wl, _vBlock.mode,
|
// _vBlock.num, _vBlock.upkType, _vBlock.scl, _vBlock.cl, _vBlock.wl, _vBlock.mode,
|
||||||
// doMask >> 4, doMask ? wxsFormat( L"0x%08x", _vBlock.mask ).c_str() : L"ignored"
|
// doMask >> 4, doMask ? wxsFormat( L"0x%08x", _vBlock.mask ).c_str() : L"ignored"
|
||||||
|
|
|
@ -34,6 +34,7 @@ extern void mVUmergeRegs(int dest, int src, int xyzw, bool modXYZW = 0);
|
||||||
extern void _nVifUnpack (int idx, u8 *data, u32 size, bool isFill);
|
extern void _nVifUnpack (int idx, u8 *data, u32 size, bool isFill);
|
||||||
extern void dVifUnpack (int idx, u8 *data, u32 size, bool isFill);
|
extern void dVifUnpack (int idx, u8 *data, u32 size, bool isFill);
|
||||||
extern void dVifInit (int idx);
|
extern void dVifInit (int idx);
|
||||||
|
extern void dVifClose (int idx);
|
||||||
extern void VifUnpackSSE_Init();
|
extern void VifUnpackSSE_Init();
|
||||||
|
|
||||||
#define VUFT VIFUnpackFuncTable
|
#define VUFT VIFUnpackFuncTable
|
||||||
|
@ -92,6 +93,7 @@ struct nVifStruct {
|
||||||
u8* recEnd; // End of Rec Cache
|
u8* recEnd; // End of Rec Cache
|
||||||
BlockBuffer* vifCache; // Block Buffer
|
BlockBuffer* vifCache; // Block Buffer
|
||||||
HashBucket<_tParams>* vifBlocks; // Vif Blocks
|
HashBucket<_tParams>* vifBlocks; // Vif Blocks
|
||||||
|
int numBlocks; // # of Blocks Recompiled
|
||||||
};
|
};
|
||||||
|
|
||||||
extern __aligned16 nVifStruct nVif[2];
|
extern __aligned16 nVifStruct nVif[2];
|
||||||
|
|
|
@ -89,9 +89,12 @@ void initNewVif(int idx) {
|
||||||
nVif[idx].partTransfer = 0;
|
nVif[idx].partTransfer = 0;
|
||||||
|
|
||||||
VifUnpackSSE_Init();
|
VifUnpackSSE_Init();
|
||||||
if (newVifDynaRec) dVifInit(idx);
|
if (newVifDynaRec) dVifInit(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void closeNewVif(int idx) { if (newVifDynaRec) dVifClose(idx); }
|
||||||
|
void resetNewVif(int idx) { closeNewVif(idx); initNewVif(idx); }
|
||||||
|
|
||||||
static _f u8* setVUptr(int vuidx, const u8* vuMemBase, int offset) {
|
static _f u8* setVUptr(int vuidx, const u8* vuMemBase, int offset) {
|
||||||
return (u8*)(vuMemBase + ( offset & (vuidx ? 0x3ff0 : 0xff0) ));
|
return (u8*)(vuMemBase + ( offset & (vuidx ? 0x3ff0 : 0xff0) ));
|
||||||
}
|
}
|
||||||
|
@ -103,7 +106,6 @@ static _f void incVUptr(int vuidx, u8* &ptr, const u8* vuMemBase, int amount) {
|
||||||
int diff = ptr - (vuMemBase + (vuidx ? 0x4000 : 0x1000));
|
int diff = ptr - (vuMemBase + (vuidx ? 0x4000 : 0x1000));
|
||||||
if (diff >= 0) {
|
if (diff >= 0) {
|
||||||
ptr = (u8*)(vuMemBase + diff);
|
ptr = (u8*)(vuMemBase + diff);
|
||||||
DevCon.WriteLn("wrap!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +115,6 @@ static _f void incVUptrBy16(int vuidx, u8* &ptr, const u8* vuMemBase) {
|
||||||
vif->tag.addr += 16;
|
vif->tag.addr += 16;
|
||||||
if( ptr == (vuMemBase + (vuidx ? 0x4000 : 0x1000)) ) {
|
if( ptr == (vuMemBase + (vuidx ? 0x4000 : 0x1000)) ) {
|
||||||
ptr -= (vuidx ? 0x4000 : 0x1000);
|
ptr -= (vuidx ? 0x4000 : 0x1000);
|
||||||
DevCon.WriteLn("wrap!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue