mirror of https://github.com/PCSX2/pcsx2.git
VU: Adjust sync timing for VU Kickstart
Fixes Crash Twinsanity
This commit is contained in:
parent
c2dad218e5
commit
b919de9dd1
|
@ -71,7 +71,7 @@ __fi void _vu0run(bool breakOnMbit, bool addCycles) {
|
|||
do { // Run VU until it finishes or M-Bit
|
||||
CpuVU0->Execute(runCycles);
|
||||
} while ((VU0.VI[REG_VPU_STAT].UL & 1) // E-bit Termination
|
||||
&& (!breakOnMbit || !(VU0.flags & VUFLAG_MFLAGSET) || VU0.cycle < cpuRegs.cycle)); // M-bit Break
|
||||
&& (!breakOnMbit || !(VU0.flags & VUFLAG_MFLAGSET))); // M-bit Break
|
||||
|
||||
// Add cycles if called from EE's COP2
|
||||
if (addCycles)
|
||||
|
|
|
@ -34,18 +34,48 @@ void BaseVUmicroCPU::ExecuteBlock(bool startUp)
|
|||
if (!(stat & test))
|
||||
return;
|
||||
|
||||
if (startUp && s)
|
||||
{ // Start Executing a microprogram
|
||||
if (startUp && s) // Start Executing a microprogram (When kickstarted)
|
||||
{
|
||||
Execute(s); // Kick start VU
|
||||
|
||||
// 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;
|
||||
else
|
||||
VU0.cycle = cpuRegs.cycle;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Continue Executing
|
||||
else // Continue Executing
|
||||
{
|
||||
u32 cycle = m_Idx ? VU1.cycle : VU0.cycle;
|
||||
s32 delta = (s32)(u32)(cpuRegs.cycle - cycle);
|
||||
s32 nextblockcycles = m_Idx ? VU1.nextBlockCycles : VU0.nextBlockCycles;
|
||||
|
||||
if (delta >= nextblockcycles) // Enough time has passed
|
||||
Execute(delta); // Execute the time since the last call
|
||||
if (EmuConfig.Gamefixes.VUKickstartHack)
|
||||
{
|
||||
if (delta > 0) // When kickstarting we just need 1 cycle for run ahead
|
||||
Execute(delta);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (delta >= nextblockcycles) // When running behind, make sure we have enough cycles passed for the block to run
|
||||
Execute(delta);
|
||||
}
|
||||
|
||||
if (stat & test)
|
||||
{
|
||||
// Queue up next required time to run a block
|
||||
nextblockcycles = m_Idx ? VU1.nextBlockCycles : VU0.nextBlockCycles;
|
||||
cycle = m_Idx ? VU1.cycle : VU0.cycle;
|
||||
nextblockcycles = EmuConfig.Gamefixes.VUKickstartHack ? (cycle - cpuRegs.cycle) : nextblockcycles;
|
||||
|
||||
if(nextblockcycles)
|
||||
cpuSetNextEventDelta(nextblockcycles);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -405,7 +405,6 @@ static void recCTC2()
|
|||
|
||||
if (!(cpuRegs.code & 1))
|
||||
{
|
||||
;
|
||||
xTEST(ptr32[&VU0.VI[REG_VPU_STAT].UL], 0x1);
|
||||
xForwardJZ32 skipvuidle;
|
||||
xMOV(eax, ptr32[&cpuRegs.cycle]);
|
||||
|
|
Loading…
Reference in New Issue