mirror of https://github.com/PCSX2/pcsx2.git
VU: Improve VU0/Mbit sync with VU Interpreter. Improve Kickstart.
This commit is contained in:
parent
2e2d6ba35d
commit
e19b0bce57
|
@ -65,7 +65,7 @@ __fi void _vu0run(bool breakOnMbit, bool addCycles) {
|
|||
return;
|
||||
}
|
||||
|
||||
u32 startcycle = VU0.cycle;
|
||||
u32 startcycle = cpuRegs.cycle;
|
||||
u32 runCycles = 0x7fffffff;
|
||||
|
||||
do { // Run VU until it finishes or M-Bit
|
||||
|
@ -77,7 +77,6 @@ __fi void _vu0run(bool breakOnMbit, bool addCycles) {
|
|||
if (addCycles)
|
||||
{
|
||||
cpuRegs.cycle += (VU0.cycle - startcycle);
|
||||
VU0.cycle = cpuRegs.cycle;
|
||||
CpuVU1->ExecuteBlock(0); // Catch up VU1 as it's likely fallen behind
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,9 +154,7 @@ static void _vu0Exec(VURegs* VU)
|
|||
}
|
||||
}
|
||||
_vuAddUpperStalls(VU, &uregs);
|
||||
|
||||
if (!(ptr[1] & 0x80000000))
|
||||
_vuAddLowerStalls(VU, &lregs);
|
||||
_vuAddLowerStalls(VU, &lregs);
|
||||
|
||||
if (VU->branch > 0) {
|
||||
if (VU->branch-- == 1) {
|
||||
|
@ -222,7 +220,8 @@ void InterpVU0::Execute(u32 cycles)
|
|||
|
||||
VU0.VI[REG_TPC].UL <<= 3;
|
||||
VU0.flags &= ~VUFLAG_MFLAGSET;
|
||||
for (int i = (int)cycles; i > 0; i--) {
|
||||
u32 startcycles = VU0.cycle;
|
||||
while((VU0.cycle - startcycles) < cycles) {
|
||||
if (!(VU0.VI[REG_VPU_STAT].UL & 0x1) || (VU0.flags & VUFLAG_MFLAGSET)) {
|
||||
if (VU0.branch || VU0.ebit) {
|
||||
vu0Exec(&VU0); // run branch delay slot?
|
||||
|
|
|
@ -297,7 +297,8 @@ void InterpVU1::Execute(u32 cycles)
|
|||
fesetround(g_sseVUMXCSR.RoundingControl << 8);
|
||||
|
||||
VU1.VI[REG_TPC].UL <<= 3;
|
||||
for (int i = (int)cycles; i > 0; i--)
|
||||
u32 startcycles = VU1.cycle;
|
||||
while ((VU1.cycle - startcycles) < cycles)
|
||||
{
|
||||
if (!(VU0.VI[REG_VPU_STAT].UL & 0x100))
|
||||
{
|
||||
|
|
|
@ -87,12 +87,12 @@ void BaseVUmicroCPU::ExecuteBlock(bool startUp)
|
|||
// I don't like doing this, but Crash Twinsanity seems to be upset without it
|
||||
if (stat & test)
|
||||
{
|
||||
cpuSetNextEventDelta(s);
|
||||
|
||||
if (m_Idx)
|
||||
VU1.cycle = cpuRegs.cycle;
|
||||
cpuRegs.cycle = VU1.cycle;
|
||||
else
|
||||
VU0.cycle = cpuRegs.cycle;
|
||||
cpuRegs.cycle = VU0.cycle;
|
||||
|
||||
cpuSetNextEventDelta(s);
|
||||
}
|
||||
}
|
||||
else // Continue Executing
|
||||
|
|
|
@ -106,8 +106,8 @@ static __ri bool _vuFMACflush(VURegs * VU) {
|
|||
{
|
||||
if ((VU->cycle - VU->fmac[currentpipe].sCycle) < lastmac)
|
||||
{
|
||||
VUM_LOG("flushing FMAC pipe[%d] (macflag=%x status=%x) Cur Cycle %d Expected cycle %d", currentpipe, VU->fmac[currentpipe].macflag, (VU->VI[REG_STATUS_FLAG].UL & 0xF30) | (VU->fmac[currentpipe].statusflag & 0x3CF), VU->cycle, VU->fmac[currentpipe].sCycle + VU->fmac[currentpipe].Cycle);
|
||||
// FMAC only affectx Z/S/I/O
|
||||
VUM_LOG("flushing FMAC pipe[%d] (macflag=%x status=%x) Cur Cycle %d Expected cycle %d", currentpipe, VU->fmac[currentpipe].macflag, (VU->VI[REG_STATUS_FLAG].UL & 0xF30) | (VU->fmac[currentpipe].statusflag & 0x3CF), VU->cycle, VU->fmac[currentpipe].sCycle + VU->fmac[currentpipe].Cycle);
|
||||
// FMAC only affectx Z/S/I/O
|
||||
VU->VI[REG_STATUS_FLAG].UL = (VU->VI[REG_STATUS_FLAG].UL & 0xFF0) | ((VU->fmac[currentpipe].statusflag & 0xF) | ((VU->fmac[currentpipe].statusflag & 0xF) << 6));
|
||||
VU->VI[REG_MAC_FLAG].UL = VU->fmac[currentpipe].macflag;
|
||||
lastmac = (VU->cycle - VU->fmac[currentpipe].sCycle);
|
||||
|
@ -263,7 +263,7 @@ void _vuFlushAll(VURegs* VU)
|
|||
|
||||
__fi void _vuTestPipes(VURegs * VU) {
|
||||
bool flushed;
|
||||
u32 startcycle = VU->cycle;
|
||||
|
||||
do {
|
||||
flushed = false;
|
||||
flushed |= _vuFMACflush(VU);
|
||||
|
|
Loading…
Reference in New Issue