mVU Macro: Some changes for a more correct interlocking behavior again VU0 micro programs.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1708 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
cottonvibes 2009-08-29 20:11:38 +00:00
parent 2c1397e559
commit fd480496c4
2 changed files with 26 additions and 28 deletions

View File

@ -66,35 +66,31 @@ void COP2_Unknown()
}
//****************************************************************************
void _vu0WaitMicro() {
int startcycle;
__forceinline void _vu0run(bool breakOnMbit) {
if ((VU0.VI[REG_VPU_STAT].UL & 0x1) == 0) {
return;
}
if (!(VU0.VI[REG_VPU_STAT].UL & 1)) return;
startcycle = VU0.cycle;
int startcycle = VU0.cycle;
VU0.flags &= ~VUFLAG_MFLAGSET;
VU0.flags|= VUFLAG_BREAKONMFLAG;
VU0.flags&= ~VUFLAG_MFLAGSET;
if (!CHECK_MICROVU0) {
do {
CpuVU0.ExecuteBlock();
// knockout kings 2002 loops here
if( VU0.cycle-startcycle > 0x1000 ) {
Console::Notice("VU0 perma-stall, breaking execution..."); // (email zero if gfx are bad)
break;
}
} while ((VU0.VI[REG_VPU_STAT].UL & 0x1) && (VU0.flags & VUFLAG_MFLAGSET) == 0);
}
else CpuVU0.ExecuteBlock(); // Note: Need to test Knockout Kings 2002 with mVU!
do {
// knockout kings 2002 loops here with sVU
if (breakOnMbit && (VU0.cycle-startcycle > 0x1000)) {
Console::Notice("VU0 perma-stall, breaking execution...");
break; // mVU will never get here (it handles mBit internally)
}
CpuVU0.ExecuteBlock();
} while ((VU0.VI[REG_VPU_STAT].UL & 1) // E-bit Termination
&& (!breakOnMbit || !(VU0.flags & VUFLAG_MFLAGSET))); // M-bit Break
//NEW
cpuRegs.cycle += (VU0.cycle-startcycle)*2;
VU0.flags&= ~VUFLAG_BREAKONMFLAG;
}
void _vu0WaitMicro() { _vu0run(1); } // Runs VU0 Micro Until E-bit or M-Bit End
void _vu0FinishMicro() { _vu0run(0); } // Runs VU0 Micro Until E-Bit End
namespace R5900 {
namespace Interpreter{
namespace OpcodeImpl

View File

@ -23,6 +23,7 @@
#include "R5900OpcodeTables.h"
extern void _vu0WaitMicro();
extern void _vu0FinishMicro();
//------------------------------------------------------------------
// Macro VU - Helper Macros / Functions
@ -237,10 +238,11 @@ void recBC2TL() { _setupBranchTest(JZ32, true); }
// Macro VU - COP2 Transfer Instructions
//------------------------------------------------------------------
void COP2_Interlock(bool cond) {
if (cond) {
void COP2_Interlock(bool mBitSync) {
if (cpuRegs.code & 1) {
iFlushCall(FLUSH_NOCONST);
CALLFunc((uptr)_vu0WaitMicro);
if (mBitSync) CALLFunc((uptr)_vu0WaitMicro);
else CALLFunc((uptr)_vu0FinishMicro);
}
}
@ -255,7 +257,7 @@ void TEST_FBRST_RESET(uptr resetFunct, int vuIndex) {
static void recCFC2() {
printCOP2("CFC2");
COP2_Interlock(cpuRegs.code & 1);
COP2_Interlock(0);
if (!_Rt_) return;
iFlushCall(FLUSH_EVERYTHING);
@ -275,7 +277,7 @@ static void recCFC2() {
static void recCTC2() {
printCOP2("CTC2");
COP2_Interlock(cpuRegs.code & 1);
COP2_Interlock(1);
if (!_Rd_) return;
iFlushCall(FLUSH_EVERYTHING);
@ -318,7 +320,7 @@ static void recCTC2() {
static void recQMFC2() {
printCOP2("QMFC2");
COP2_Interlock(cpuRegs.code & 1);
COP2_Interlock(0);
if (!_Rt_) return;
iFlushCall(FLUSH_EVERYTHING);
@ -332,7 +334,7 @@ static void recQMFC2() {
static void recQMTC2() {
printCOP2("QMTC2");
COP2_Interlock(cpuRegs.code & 1);
COP2_Interlock(1);
if (!_Rd_) return;
iFlushCall(FLUSH_EVERYTHING);