GameDB: Rename VU0Kickstart -> VUKickstart

Clean up a couple of bits in microVU
This commit is contained in:
refractionpcsx2 2021-07-15 13:58:34 +01:00
parent c31d6b9ca3
commit 56372cc46d
7 changed files with 202 additions and 224 deletions

View File

@ -32,7 +32,7 @@ allowed_game_fixes = [
"VIF1StallHack", "VIF1StallHack",
"GIFFIFOHack", "GIFFIFOHack",
"GoemonTlbHack", "GoemonTlbHack",
"VU0KickstartHack", "VUKickstartHack",
"IbitHack", "IbitHack",
"RatchetDynaHack", "RatchetDynaHack",
] ]

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,7 @@ enum GamefixId
Fix_GIFFIFO, Fix_GIFFIFO,
Fix_GoemonTlbMiss, Fix_GoemonTlbMiss,
Fix_Ibit, Fix_Ibit,
Fix_VU0Kickstart, Fix_VUKickstart,
Fix_RatchetDyna, Fix_RatchetDyna,
GamefixId_COUNT GamefixId_COUNT
@ -349,7 +349,7 @@ struct Pcsx2Config
GIFFIFOHack : 1, // Enabled the GIF FIFO (more correct but slower) GIFFIFOHack : 1, // Enabled the GIF FIFO (more correct but slower)
GoemonTlbHack : 1, // Gomeon tlb miss hack. The game need to access unmapped virtual address. Instead to handle it as exception, tlb are preloaded at startup GoemonTlbHack : 1, // Gomeon tlb miss hack. The game need to access unmapped virtual address. Instead to handle it as exception, tlb are preloaded at startup
IbitHack : 1, // I bit hack. Needed to stop constant VU recompilation in some games IbitHack : 1, // I bit hack. Needed to stop constant VU recompilation in some games
VU0KickstartHack : 1, // Gives new VU programs a slight head start and runs VU's ahead of EE to avoid VU register reading/writing issues VUKickstartHack : 1, // Gives new VU programs a slight head start and runs VU's ahead of EE to avoid VU register reading/writing issues
RatchetDynaHack : 1; // Dynamically patch bad COP2 timing in EE program as it cannot be patched traditionally RatchetDynaHack : 1; // Dynamically patch bad COP2 timing in EE program as it cannot be patched traditionally
BITFIELD_END BITFIELD_END

View File

@ -285,7 +285,7 @@ const wxChar *const tbl_GamefixNames[] =
L"GIFFIFO", L"GIFFIFO",
L"GoemonTlb", L"GoemonTlb",
L"Ibit", L"Ibit",
L"VU0Kickstart", L"VUKickstart",
L"RatchetDyna" L"RatchetDyna"
}; };
@ -346,7 +346,7 @@ void Pcsx2Config::GamefixOptions::Set( GamefixId id, bool enabled )
case Fix_GIFFIFO: GIFFIFOHack = enabled; break; case Fix_GIFFIFO: GIFFIFOHack = enabled; break;
case Fix_GoemonTlbMiss: GoemonTlbHack = enabled; break; case Fix_GoemonTlbMiss: GoemonTlbHack = enabled; break;
case Fix_Ibit: IbitHack = enabled; break; case Fix_Ibit: IbitHack = enabled; break;
case Fix_VU0Kickstart: VU0KickstartHack = enabled; break; case Fix_VUKickstart: VUKickstartHack = enabled; break;
case Fix_RatchetDyna: RatchetDynaHack = enabled; break; case Fix_RatchetDyna: RatchetDynaHack = enabled; break;
jNO_DEFAULT; jNO_DEFAULT;
} }
@ -370,7 +370,7 @@ bool Pcsx2Config::GamefixOptions::Get( GamefixId id ) const
case Fix_GIFFIFO: return GIFFIFOHack; case Fix_GIFFIFO: return GIFFIFOHack;
case Fix_GoemonTlbMiss: return GoemonTlbHack; case Fix_GoemonTlbMiss: return GoemonTlbHack;
case Fix_Ibit: return IbitHack; case Fix_Ibit: return IbitHack;
case Fix_VU0Kickstart: return VU0KickstartHack; case Fix_VUKickstart: return VUKickstartHack;
case Fix_RatchetDyna: return RatchetDynaHack; case Fix_RatchetDyna: return RatchetDynaHack;
jNO_DEFAULT; jNO_DEFAULT;
} }
@ -394,7 +394,7 @@ void Pcsx2Config::GamefixOptions::LoadSave( IniInterface& ini )
IniBitBool( GIFFIFOHack ); IniBitBool( GIFFIFOHack );
IniBitBool( GoemonTlbHack ); IniBitBool( GoemonTlbHack );
IniBitBool( IbitHack ); IniBitBool( IbitHack );
IniBitBool( VU0KickstartHack ); IniBitBool( VUKickstartHack );
IniBitBool( RatchetDynaHack ); IniBitBool( RatchetDynaHack );
} }

View File

@ -22,7 +22,7 @@
void BaseVUmicroCPU::ExecuteBlock(bool startUp) { void BaseVUmicroCPU::ExecuteBlock(bool startUp) {
const u32& stat = VU0.VI[REG_VPU_STAT].UL; const u32& stat = VU0.VI[REG_VPU_STAT].UL;
const int test = m_Idx ? 0x100 : 1; const int test = m_Idx ? 0x100 : 1;
const int s = EmuConfig.Gamefixes.VU0KickstartHack ? 16 : 0; // Kick Start Cycles (Jak needs at least 4 due to writing values after they're read const int s = EmuConfig.Gamefixes.VUKickstartHack ? 16 : 0; // Kick Start Cycles (Jak needs at least 4 due to writing values after they're read
if (m_Idx && THREAD_VU1) if (m_Idx && THREAD_VU1)
{ {

View File

@ -15,7 +15,6 @@
#pragma once #pragma once
extern bool doEarlyExit (microVU& mVU);
extern void mVUincCycles(microVU& mVU, int x); extern void mVUincCycles(microVU& mVU, int x);
extern void* mVUcompile (microVU& mVU, u32 startPC, uptr pState); extern void* mVUcompile (microVU& mVU, u32 startPC, uptr pState);
extern void* mVUcompileSingleInstruction(microVU& mVU, u32 startPC, uptr pState, microFlagCycles& mFC); extern void* mVUcompileSingleInstruction(microVU& mVU, u32 startPC, uptr pState, microFlagCycles& mFC);
@ -56,10 +55,8 @@ void mVUDTendProgram(mV, microFlagCycles* mFC, int isEbit) {
if (mVUinfo.doXGKICK && xPC >= mVUinfo.XGKICKPC) { if (mVUinfo.doXGKICK && xPC >= mVUinfo.XGKICKPC) {
mVU_XGKICK_DELAY(mVU); mVU_XGKICK_DELAY(mVU);
} }
if (doEarlyExit(mVU)) { if (!isVU1) xFastCall((void*)mVU0clearlpStateJIT);
if (!isVU1) xFastCall((void*)mVU0clearlpStateJIT); else xFastCall((void*)mVU1clearlpStateJIT);
else xFastCall((void*)mVU1clearlpStateJIT);
}
} }
// Save P/Q Regs // Save P/Q Regs
@ -154,12 +151,10 @@ void mVUendProgram(mV, microFlagCycles* mFC, int isEbit) {
if (mVUinfo.doXGKICK) { if (mVUinfo.doXGKICK) {
mVU_XGKICK_DELAY(mVU); mVU_XGKICK_DELAY(mVU);
} }
if (doEarlyExit(mVU)) { if (!isVU1)
if (!isVU1) xFastCall((void*)mVU0clearlpStateJIT);
xFastCall((void*)mVU0clearlpStateJIT); else
else xFastCall((void*)mVU1clearlpStateJIT);
xFastCall((void*)mVU1clearlpStateJIT);
}
} }
// Save P/Q Regs // Save P/Q Regs

View File

@ -358,11 +358,6 @@ void mVUdebugPrintBlocks(microVU& mVU, bool isEndPC) {
} }
} }
// vu0 is allowed to exit early, so are dev builds (for inf loops)
__fi bool doEarlyExit(microVU& mVU) {
return true;// IsDevBuild || !isVU1;
}
// Saves Pipeline State for resuming from early exits // Saves Pipeline State for resuming from early exits
__fi void mVUsavePipelineState(microVU& mVU) { __fi void mVUsavePipelineState(microVU& mVU) {
u32* lpS = (u32*)&mVU.prog.lpState; u32* lpS = (u32*)&mVU.prog.lpState;
@ -374,33 +369,21 @@ __fi void mVUsavePipelineState(microVU& mVU) {
// Test cycles to see if we need to exit-early... // Test cycles to see if we need to exit-early...
void mVUtestCycles(microVU& mVU, microFlagCycles& mFC) { void mVUtestCycles(microVU& mVU, microFlagCycles& mFC) {
iPC = mVUstartPC; iPC = mVUstartPC;
if (doEarlyExit(mVU)) {
xMOV(eax, ptr32[&mVU.cycles]); xMOV(eax, ptr32[&mVU.cycles]);
if (!EmuConfig.Gamefixes.VU0KickstartHack) if (!EmuConfig.Gamefixes.VUKickstartHack)
xSUB(eax, mVUcycles); // Running behind, make sure we have time to run the block xSUB(eax, mVUcycles); // Running behind, make sure we have time to run the block
else else
xSUB(eax, 1); // Running ahead, make sure cycles left are above 0 xSUB(eax, 1); // Running ahead, make sure cycles left are above 0
xCMP(eax, 0);
xForwardJGE32 skip; xCMP(eax, 0);
mVUsavePipelineState(mVU); xForwardJGE32 skip;
if (isVU0) {
// TEST32ItoM((uptr)&mVU.regs().flags, VUFLAG_MFLAGSET); mVUsavePipelineState(mVU);
// xFowardJZ32 vu0jmp; mVUendProgram(mVU, &mFC, 0);
// mVUbackupRegs(mVU, true);
// xFastCall(mVUwarning0, mVU.prog.cur->idx, xPC); // VU0 is allowed early exit for COP2 Interlock Simulation skip.SetTarget();
// mVUrestoreRegs(mVU, true);
mVUendProgram(mVU, &mFC, 0);
// vu0jmp.SetTarget();
}
else {
/*mVUbackupRegs(mVU, true);
xFastCall(mVUwarning1, mVU.prog.cur->idx, xPC);
mVUrestoreRegs(mVU, true);
mVUsavePipelineState(mVU);*/
mVUendProgram(mVU, &mFC, 0);
}
skip.SetTarget();
}
xSUB(ptr32[&mVU.cycles], mVUcycles); xSUB(ptr32[&mVU.cycles], mVUcycles);
} }
@ -438,7 +421,7 @@ __fi void mVUinitFirstPass(microVU& mVU, uptr pState, u8* thisPtr) {
if ((uptr)&mVUregs != pState) { // Loads up Pipeline State Info if ((uptr)&mVUregs != pState) { // Loads up Pipeline State Info
memcpy((u8*)&mVUregs, (u8*)pState, sizeof(microRegInfo)); memcpy((u8*)&mVUregs, (u8*)pState, sizeof(microRegInfo));
} }
if (doEarlyExit(mVU) && ((uptr)&mVU.prog.lpState != pState)) { if (((uptr)&mVU.prog.lpState != pState)) {
memcpy((u8*)&mVU.prog.lpState, (u8*)pState, sizeof(microRegInfo)); memcpy((u8*)&mVU.prog.lpState, (u8*)pState, sizeof(microRegInfo));
} }
mVUblock.x86ptrStart = thisPtr; mVUblock.x86ptrStart = thisPtr;