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

View File

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