Vif: Fix up V2-32 and V3-32 Indeterminate Data on MTVU

- MTVU didn't do this correctly as it relied on vif packet size to check alignment, which it doesn't know.
- Packet sent to MTVU was too small for V3-32 to work properly, rounded up to nearest QW
- V2-32 fixed up on interpreter which was just wrong, can't fix V3-32 in it's current setup, but who cares ;)

These could still be wrong, but I can't confirm this until i run larger tests on my PS2
This commit is contained in:
refractionpcsx2 2015-06-05 16:23:39 +01:00
parent b49d65295f
commit 46b0a790d4
5 changed files with 8 additions and 3 deletions

View File

@ -70,6 +70,7 @@ struct vifStruct {
int pass;
int cl;
u8 usn;
bool start_aligned;
u8 StructEnd; // Address of this is used to calculate end of struct
};
@ -93,6 +94,8 @@ struct vifStruct {
bool queued_program;
u32 queued_pc;
};
extern __aligned16 vifStruct vif0, vif1;

View File

@ -231,6 +231,8 @@ _vifT void vifUnpackSetup(const u32 *data) {
vifX.cl = 0;
vifX.tag.cmd = vifX.cmd;
GetVifX.pass = 1;
vifX.start_aligned = !!((vifX.vifpacketsize-1) & 0x1);
}
template void vifUnpackSetup<0>(const u32 *data);

View File

@ -314,7 +314,7 @@ _vifT __fi void dVifUnpack(const u8* data, bool isFill) {
v.block.mode = (u8&)vifRegs.mode;
v.block.cl = vifRegs.cycle.cl;
v.block.wl = vifRegs.cycle.wl;
v.block.aligned = !!(vif.vifpacketsize & 0x1);
v.block.aligned = vif.start_aligned; //MTVU doesn't have a packet size!
// Zero out the mask parameter if it's unused -- games leave random junk
// values here which cause false recblock cache misses.

View File

@ -131,7 +131,7 @@ _vifT int nVifUnpack(const u8* data) {
if (newVifDynaRec) dVifUnpack<idx>(data, isFill);
else _nVifUnpack(idx, data, vifRegs.mode, isFill);
}
else vu1Thread.VifUnpack(vif, vifRegs, (u8*)data, size);
else vu1Thread.VifUnpack(vif, vifRegs, (u8*)data, (size + 4) & ~0x3);
vif.pass = 0;
vif.tag.size = 0;

View File

@ -244,7 +244,7 @@ void VifUnpackSSE_Base::xUPK_V2_8() const {
void VifUnpackSSE_Base::xUPK_V3_32() const {
xMOV128 (destReg, ptr128[srcIndirect]);
if(UnpkLoopIteration == (1-IsAligned))
if(UnpkLoopIteration != IsAligned)
xAND.PS( destReg, ptr128[SSEXYZWMask[0]]);
}