mVU, VU interpreter: fix arc the lad, freakstyle (VU1 register mapping / memory wrapping)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3697 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
sudonim1 2010-08-27 21:25:21 +00:00
parent 72ca36954b
commit fcc6f30489
2 changed files with 8 additions and 7 deletions

View File

@ -1579,7 +1579,7 @@ static __fi void _vuMR32(VURegs * VU) {
__fi u32* GET_VU_MEM(VURegs* VU, u32 addr) // non-static, also used by sVU for now.
{
if( VU == &vuRegs[1] ) return (u32*)(vuRegs[1].Mem+(addr&0x3fff));
if( addr >= 0x4000 ) return (u32*)(vuRegs[0].Mem+(addr&0x43f0)); // get VF and VI regs (they're mapped to 0x4xx0 in VU0 mem!)
if( addr & 0x4000 ) return (u32*)(vuRegs[1].VF+(addr&0x3f0)); // get VF and VI regs (they're mapped to 0x4xx0 in VU0 mem!)
return (u32*)(vuRegs[0].Mem+(addr&0x0fff)); // for addr 0x0000 to 0x4000 just wrap around
}

View File

@ -224,8 +224,11 @@ __fi void mVUaddrFix(mV, const x32& gprReg)
xSHL(gprReg, 4);
}
else {
xCMP(gprReg, 0x400);
xForwardJL8 jmpA; // if addr >= 0x4000, reads VU1's VF regs and VI regs
xTEST(gprReg, 0x400);
xForwardJNZ8 jmpA; // if addr & 0x4000, reads VU1's VF regs and VI regs
xAND(gprReg, 0xff); // if !(addr & 0x4000), wrap around
xForwardJump8 jmpB;
jmpA.SetTarget();
if (IsDevBuild && !isCOP2) { // Lets see which games do this!
xPUSH(gprT1); // Note: Kernel does it via COP2 to initialize VU1!
xPUSH(gprT2); // So we don't spam console, we'll only check micro-mode...
@ -236,10 +239,8 @@ __fi void mVUaddrFix(mV, const x32& gprReg)
xPOP(gprT2);
xPOP(gprT1);
}
xAND(gprReg, 0x43f); // ToDo: theres a potential problem if VU0 overrides VU1's VF0/VI0 regs!
xForwardJump8 jmpB;
jmpA.SetTarget();
xAND(gprReg, 0xff); // if addr < 0x4000, wrap around
xAND(gprReg, 0x3f); // ToDo: theres a potential problem if VU0 overrides VU1's VF0/VI0 regs!
xADD(gprReg, (u128*)VU1.VF - (u128*)VU0.Mem);
jmpB.SetTarget();
xSHL(gprReg, 4); // multiply by 16 (shift left by 4)
}