microVU: Add gamefix for Crash Tag Team Racing. Fixes constant recompilation problems.

This commit is contained in:
hibye8313 2019-04-30 16:19:46 -04:00 committed by refractionpcsx2
parent b270c1bb67
commit 56a976e277
5 changed files with 44 additions and 23 deletions

View File

@ -59,6 +59,7 @@ enum GamefixId
Fix_FMVinSoftware, Fix_FMVinSoftware,
Fix_GoemonTlbMiss, Fix_GoemonTlbMiss,
Fix_ScarfaceIbit, Fix_ScarfaceIbit,
Fix_CrashTagTeamIbit,
GamefixId_COUNT GamefixId_COUNT
}; };
@ -343,25 +344,26 @@ struct Pcsx2Config
// NOTE: The GUI's GameFixes panel is dependent on the order of bits in this structure. // NOTE: The GUI's GameFixes panel is dependent on the order of bits in this structure.
struct GamefixOptions struct GamefixOptions
{ {
BITFIELD32() BITFIELD32()
bool bool
VuAddSubHack :1, // Tri-ace games, they use an encryption algorithm that requires VU ADDI opcode to be bit-accurate. VuAddSubHack : 1, // Tri-ace games, they use an encryption algorithm that requires VU ADDI opcode to be bit-accurate.
VuClipFlagHack :1, // Persona games, maybe others. It's to do with the VU clip flag (again). VuClipFlagHack : 1, // Persona games, maybe others. It's to do with the VU clip flag (again).
FpuCompareHack :1, // Digimon Rumble Arena 2, fixes spinning/hanging on intro-menu. FpuCompareHack : 1, // Digimon Rumble Arena 2, fixes spinning/hanging on intro-menu.
FpuMulHack :1, // Tales of Destiny hangs. FpuMulHack : 1, // Tales of Destiny hangs.
FpuNegDivHack :1, // Gundam games messed up camera-view. FpuNegDivHack : 1, // Gundam games messed up camera-view.
XgKickHack :1, // Erementar Gerad, adds more delay to VU XGkick instructions. Corrects the color of some graphics, but breaks Tri-ace games and others. XgKickHack : 1, // Erementar Gerad, adds more delay to VU XGkick instructions. Corrects the color of some graphics, but breaks Tri-ace games and others.
IPUWaitHack :1, // FFX FMV, makes GIF flush before doing IPU work. Fixes bad graphics overlay. IPUWaitHack : 1, // FFX FMV, makes GIF flush before doing IPU work. Fixes bad graphics overlay.
EETimingHack :1, // General purpose timing hack. EETimingHack : 1, // General purpose timing hack.
SkipMPEGHack :1, // Skips MPEG videos (Katamari and other games need this) SkipMPEGHack : 1, // Skips MPEG videos (Katamari and other games need this)
OPHFlagHack :1, // Bleach Blade Battlers OPHFlagHack : 1, // Bleach Blade Battlers
DMABusyHack :1, // Denies writes to the DMAC when it's busy. This is correct behaviour but bad timing can cause problems. DMABusyHack : 1, // Denies writes to the DMAC when it's busy. This is correct behaviour but bad timing can cause problems.
VIFFIFOHack :1, // Pretends to fill the non-existant VIF FIFO Buffer. VIFFIFOHack : 1, // Pretends to fill the non-existant VIF FIFO Buffer.
VIF1StallHack :1, // Like above, processes FIFO data before the stall is allowed (to make sure data goes over). VIF1StallHack : 1, // Like above, processes FIFO data before the stall is allowed (to make sure data goes over).
GIFFIFOHack :1, // Enabled the GIF FIFO (more correct but slower) GIFFIFOHack : 1, // Enabled the GIF FIFO (more correct but slower)
FMVinSoftwareHack:1, // Toggle in and out of software rendering when an FMV runs. FMVinSoftwareHack : 1, // Toggle in and out of software rendering when an FMV runs.
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
ScarfaceIbit :1; // Scarface I bit hack. Needed to stop constant VU recompilation ScarfaceIbit : 1, // Scarface I bit hack. Needed to stop constant VU recompilation
CrashTagTeamRacingIbit : 1; // Crash Tag Team Racing I bit hack. Needed to stop constant VU recompilation
BITFIELD_END BITFIELD_END
GamefixOptions(); GamefixOptions();

View File

@ -267,7 +267,8 @@ const wxChar *const tbl_GamefixNames[] =
L"GIFFIFO", L"GIFFIFO",
L"FMVinSoftware", L"FMVinSoftware",
L"GoemonTlb", L"GoemonTlb",
L"ScarfaceIbit" L"ScarfaceIbit",
L"CrashTagTeamRacingIbit"
}; };
const __fi wxChar* EnumToString( GamefixId id ) const __fi wxChar* EnumToString( GamefixId id )
@ -331,6 +332,7 @@ void Pcsx2Config::GamefixOptions::Set( GamefixId id, bool enabled )
case Fix_FMVinSoftware: FMVinSoftwareHack = enabled; break; case Fix_FMVinSoftware: FMVinSoftwareHack = enabled; break;
case Fix_GoemonTlbMiss: GoemonTlbHack = enabled; break; case Fix_GoemonTlbMiss: GoemonTlbHack = enabled; break;
case Fix_ScarfaceIbit: ScarfaceIbit = enabled; break; case Fix_ScarfaceIbit: ScarfaceIbit = enabled; break;
case Fix_CrashTagTeamIbit: CrashTagTeamRacingIbit = enabled; break;
jNO_DEFAULT; jNO_DEFAULT;
} }
} }
@ -357,6 +359,7 @@ bool Pcsx2Config::GamefixOptions::Get( GamefixId id ) const
case Fix_FMVinSoftware: return FMVinSoftwareHack; case Fix_FMVinSoftware: return FMVinSoftwareHack;
case Fix_GoemonTlbMiss: return GoemonTlbHack; case Fix_GoemonTlbMiss: return GoemonTlbHack;
case Fix_ScarfaceIbit: return ScarfaceIbit; case Fix_ScarfaceIbit: return ScarfaceIbit;
case Fix_CrashTagTeamIbit: return CrashTagTeamRacingIbit;
jNO_DEFAULT; jNO_DEFAULT;
} }
return false; // unreachable, but we still need to suppress warnings >_< return false; // unreachable, but we still need to suppress warnings >_<
@ -383,6 +386,7 @@ void Pcsx2Config::GamefixOptions::LoadSave( IniInterface& ini )
IniBitBool( FMVinSoftwareHack ); IniBitBool( FMVinSoftwareHack );
IniBitBool( GoemonTlbHack ); IniBitBool( GoemonTlbHack );
IniBitBool( ScarfaceIbit ); IniBitBool( ScarfaceIbit );
IniBitBool( CrashTagTeamRacingIbit );
} }

View File

@ -107,6 +107,10 @@ Panels::GameFixesPanel::GameFixesPanel( wxWindow* parent )
{ {
_("VU I bit Hack avoid constant recompilation (Scarface The World Is Yours)"), _("VU I bit Hack avoid constant recompilation (Scarface The World Is Yours)"),
wxEmptyString wxEmptyString
},
{
_("VU I bit Hack avoid constant recompilation (Crash Tag Team Racing)"),
wxEmptyString
} }
}; };

View File

@ -264,13 +264,24 @@ _mVUt __fi void* mVUsearchProg(u32 startPC, uptr pState) {
for ( ; it != list->end(); ++it) { for ( ; it != list->end(); ++it) {
bool b = mVUcmpProg(mVU, *it[0], 0); bool b = mVUcmpProg(mVU, *it[0], 0);
if (EmuConfig.Gamefixes.ScarfaceIbit) { if (EmuConfig.Gamefixes.ScarfaceIbit) {
if (isVU1 && ((((u32*)mVU.regs().Micro)[startPC / 4 + 1]) == 0x80200118) && ((((u32*)mVU.regs().Micro)[startPC / 4 + 3]) == 0x81000062)) { if (isVU1 && ((((u32*)mVU.regs().Micro)[startPC / 4 + 1]) == 0x80200118) &&
((((u32*)mVU.regs().Micro)[startPC / 4 + 3]) == 0x81000062)) {
b = true; b = true;
mVU.prog.cleared = 0; mVU.prog.cleared = 0;
mVU.prog.cur = it[0]; mVU.prog.cur = it[0];
mVU.prog.isSame = 1; mVU.prog.isSame = 1;
} }
} } else if (EmuConfig.Gamefixes.CrashTagTeamRacingIbit) {
// Crash tag team tends to make changes to the I register settings in the addresses 0x2bd0 - 0x3ff8
// so detect when the code is only changed in this region and don't recompile. Use the same Scarface hack
// to access the new I regsiter settings (Look at doIbit() in microVU_Compile.inl
if (isVU1 && (memcmp_mmx((u8 *)(it[0]->data), (u8 *)(mVU.regs().Micro), 0x2bd0) == 0)) {
b = true;
mVU.prog.cleared = 0;
mVU.prog.cur = it[0];
mVU.prog.isSame = 1;
}
}
if (b) { if (b) {
quick.block = it[0]->block[startPC/8]; quick.block = it[0]->block[startPC/8];
quick.prog = it[0]; quick.prog = it[0];

View File

@ -108,7 +108,7 @@ void doIbit(mV) {
if (mVUup.iBit) { if (mVUup.iBit) {
incPC(-1); incPC(-1);
mVU.regAlloc->clearRegVF(33); mVU.regAlloc->clearRegVF(33);
if (EmuConfig.Gamefixes.ScarfaceIbit) { if (EmuConfig.Gamefixes.ScarfaceIbit || EmuConfig.Gamefixes.CrashTagTeamRacingIbit) {
xMOV(gprT1, ptr32[&curI]); xMOV(gprT1, ptr32[&curI]);
xMOV(ptr32[&mVU.getVI(REG_I)], gprT1); xMOV(ptr32[&mVU.getVI(REG_I)], gprT1);
} }