Bugfix for Tri-ace games and possibly others (bug introduced in r3762, caused by missing 'vifRegs.num is actually 256' checks)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3765 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-09-14 00:39:40 +00:00
parent 4671428593
commit 752034c519
4 changed files with 13 additions and 25 deletions

View File

@ -51,11 +51,6 @@ _vifT extern void dVifUnpack (const u8* data, bool isFill);
#define xmmRow xmm6 #define xmmRow xmm6
#define xmmTemp xmm7 #define xmmTemp xmm7
#ifdef _MSC_VER
# pragma pack(1)
# pragma warning(disable:4996) // 'function': was declared deprecated
#endif
// nVifBlock - Ordered for Hashing; the 'num' field and the lower 6 bits of upkType are // nVifBlock - Ordered for Hashing; the 'num' field and the lower 6 bits of upkType are
// used as the hash bucket selector. // used as the hash bucket selector.
// //
@ -63,17 +58,12 @@ struct __aligned16 nVifBlock {
u8 num; // [00] Num Field u8 num; // [00] Num Field
u8 upkType; // [01] Unpack Type [usn*1:mask*1:upk*4] u8 upkType; // [01] Unpack Type [usn*1:mask*1:upk*4]
u8 mode; // [02] Mode Field u8 mode; // [02] Mode Field
u8 cl; // [04] CL Field u8 cl; // [03] CL Field
u8 wl; // [05] WL Field u32 mask; // [04] Mask Field
u8 scl; // [03] Start Cycle u8 wl; // [08] WL Field
u32 mask; // [06] Mask Field u8 padding[3];// [09] through [11]
u8 padding[2];// [10] through [11]
uptr startPtr; // [12] Start Ptr of RecGen Code uptr startPtr; // [12] Start Ptr of RecGen Code
} __packed; // 16 bytes }; // 16 bytes
#ifdef _MSC_VER
# pragma pack()
#endif
#define _hSize 0x4000 // [usn*1:mask*1:upk*4:num*8] hash... #define _hSize 0x4000 // [usn*1:mask*1:upk*4:num*8] hash...
#define _cmpS (sizeof(nVifBlock) - (4)) #define _cmpS (sizeof(nVifBlock) - (4))

View File

@ -138,14 +138,14 @@ static void ShiftDisplacementWindow( xAddressVoid& addr, const xRegister32& modR
if(addImm) xADD(modReg, addImm); if(addImm) xADD(modReg, addImm);
} }
void VifUnpackSSE_Dynarec::CompileRoutine(vifStruct& vif) { void VifUnpackSSE_Dynarec::CompileRoutine() {
const int upkNum = vB.upkType & 0xf; const int upkNum = vB.upkType & 0xf;
const u8& vift = nVifT[upkNum]; const u8& vift = nVifT[upkNum];
const int cycleSize = isFill ? vB.cl : vB.wl; const int cycleSize = isFill ? vB.cl : vB.wl;
const int blockSize = isFill ? vB.wl : vB.cl; const int blockSize = isFill ? vB.wl : vB.cl;
const int skipSize = blockSize - cycleSize; const int skipSize = blockSize - cycleSize;
uint vNum = vB.num; uint vNum = vB.num ? vB.num : 256;
doMode = (upkNum == 0xf) ? 0 : doMode; // V4_5 has no mode feature. doMode = (upkNum == 0xf) ? 0 : doMode; // V4_5 has no mode feature.
pxAssume(vCL == 0); pxAssume(vCL == 0);
@ -256,13 +256,12 @@ _vifT __fi void dVifUnpack(const u8* data, bool isFill) {
vifStruct& vif = GetVifX; vifStruct& vif = GetVifX;
VIFregisters& vifRegs = vifXRegs; VIFregisters& vifRegs = vifXRegs;
const u8 upkType = vif.cmd & 0x1f | ((!!vif.usn) << 5); const u8 upkType = (vif.cmd & 0x1f) | (vif.usn << 5);
const int doMask = vif.cmd & 0x10; const int doMask = (vif.cmd & 0x10);
_vBlock.upkType = upkType; _vBlock.upkType = upkType;
_vBlock.num = (u8&)vifRegs.num; _vBlock.num = (u8&)vifRegs.num;
_vBlock.mode = (u8&)vifRegs.mode; _vBlock.mode = (u8&)vifRegs.mode;
//_vBlock.scl = vif.cl; // scl is always zero now (effectively padding)
_vBlock.cl = vifRegs.cycle.cl; _vBlock.cl = vifRegs.cycle.cl;
_vBlock.wl = vifRegs.cycle.wl; _vBlock.wl = vifRegs.cycle.wl;
@ -281,7 +280,7 @@ _vifT __fi void dVifUnpack(const u8* data, bool isFill) {
xSetPtr(v.recPtr); xSetPtr(v.recPtr);
_vBlock.startPtr = (uptr)xGetAlignedCallTarget(); _vBlock.startPtr = (uptr)xGetAlignedCallTarget();
v.vifBlocks->add(_vBlock); v.vifBlocks->add(_vBlock);
VifUnpackSSE_Dynarec( v, _vBlock ).CompileRoutine(vif); VifUnpackSSE_Dynarec( v, _vBlock ).CompileRoutine();
nVif[idx].recPtr = xGetPtr(); nVif[idx].recPtr = xGetPtr();
// [TODO] : Ideally we should test recompile buffer limits prior to each instruction, // [TODO] : Ideally we should test recompile buffer limits prior to each instruction,
@ -290,7 +289,6 @@ _vifT __fi void dVifUnpack(const u8* data, bool isFill) {
// Run the block we just compiled. Various conditions may force us to still use // Run the block we just compiled. Various conditions may force us to still use
// the interpreter unpacker though, so a recursive call is the safest way here... // the interpreter unpacker though, so a recursive call is the safest way here...
//dVifUnpack<idx,isFill>(data);
dVifExecuteUnpack<idx>(data, isFill); dVifExecuteUnpack<idx>(data, isFill);
} }

View File

@ -106,10 +106,10 @@ _vifT int nVifUnpack(const u8* data) {
v.bSize += size; v.bSize += size;
data = v.buffer; data = v.buffer;
vifRegs.num = (vifXRegs.code >> 16) & 0xff; // grab NUM form the original VIFcode input.
}
vif.cl = 0; vif.cl = 0;
vifRegs.num = (vifXRegs.code >> 16) & 0xff; // grab NUM form the original VIFcode input.
if (!vifRegs.num) vifRegs.num = 256;
}
if (newVifDynaRec) dVifUnpack<idx>(data, isFill); if (newVifDynaRec) dVifUnpack<idx>(data, isFill);
else _nVifUnpack(idx, data, vifRegs.mode, isFill); else _nVifUnpack(idx, data, vifRegs.mode, isFill);

View File

@ -126,7 +126,7 @@ public:
virtual bool IsUnmaskedOp() const{ return !doMode && !doMask; } virtual bool IsUnmaskedOp() const{ return !doMode && !doMask; }
void CompileRoutine(vifStruct& vif); void CompileRoutine();
protected: protected:
virtual void doMaskWrite(const xRegisterSSE& regX) const; virtual void doMaskWrite(const xRegisterSSE& regX) const;