From 52eef0c021206da537eff2a33a9d0c7638789865 Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Thu, 13 Jun 2019 15:19:14 +0200 Subject: [PATCH] Disable MMUL as a compat hack to fix Tekken games leg shaking. --- Core/Compatibility.cpp | 1 + Core/Compatibility.h | 1 + Core/MIPS/ARM/ArmCompVFPU.cpp | 3 +++ Core/MIPS/ARM/ArmCompVFPUNEON.cpp | 3 +++ Core/MIPS/ARM64/Arm64CompVFPU.cpp | 3 +++ Core/MIPS/IR/IRCompVFPU.cpp | 3 +++ Core/MIPS/x86/CompVFPU.cpp | 3 +++ assets/compat.ini | 18 ++++++++++++++++++ 8 files changed, 35 insertions(+) diff --git a/Core/Compatibility.cpp b/Core/Compatibility.cpp index b6680d2c80..c069383dc5 100644 --- a/Core/Compatibility.cpp +++ b/Core/Compatibility.cpp @@ -76,6 +76,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) { CheckSetting(iniFile, gameID, "ForceUMDDelay", &flags_.ForceUMDDelay); CheckSetting(iniFile, gameID, "ForceMax60FPS", &flags_.ForceMax60FPS); CheckSetting(iniFile, gameID, "JitInvalidationHack", &flags_.JitInvalidationHack); + CheckSetting(iniFile, gameID, "MMULDisableHack", &flags_.MMULDisableHack); } void Compatibility::CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, bool *flag) { diff --git a/Core/Compatibility.h b/Core/Compatibility.h index ce7ef91819..4c9d8a6260 100644 --- a/Core/Compatibility.h +++ b/Core/Compatibility.h @@ -76,6 +76,7 @@ struct CompatFlags { bool ForceUMDDelay; bool ForceMax60FPS; bool JitInvalidationHack; + bool MMULDisableHack; }; class IniFile; diff --git a/Core/MIPS/ARM/ArmCompVFPU.cpp b/Core/MIPS/ARM/ArmCompVFPU.cpp index 4893820081..61c9686543 100644 --- a/Core/MIPS/ARM/ArmCompVFPU.cpp +++ b/Core/MIPS/ARM/ArmCompVFPU.cpp @@ -29,6 +29,7 @@ #include "Common/CPUDetect.h" #include "Core/Config.h" #include "Core/Reporting.h" +#include "Core/System.h" #include "Core/MIPS/ARM/ArmJit.h" #include "Core/MIPS/ARM/ArmRegCache.h" @@ -1467,6 +1468,8 @@ namespace MIPSComp } void ArmJit::Comp_Vmmul(MIPSOpcode op) { + if (PSP_CoreParameter().compat.flags().MMULDisableHack) + DISABLE; CONDITIONAL_DISABLE(VFPU_MTX_VMMUL); if (js.HasUnknownPrefix()) { DISABLE; diff --git a/Core/MIPS/ARM/ArmCompVFPUNEON.cpp b/Core/MIPS/ARM/ArmCompVFPUNEON.cpp index 43462dbf09..3d1a997ae6 100644 --- a/Core/MIPS/ARM/ArmCompVFPUNEON.cpp +++ b/Core/MIPS/ARM/ArmCompVFPUNEON.cpp @@ -41,6 +41,7 @@ #include "Core/MIPS/MIPSVFPUUtils.h" #include "Core/Config.h" #include "Core/Reporting.h" +#include "Core/System.h" #include "Core/MIPS/ARM/ArmJit.h" #include "Core/MIPS/ARM/ArmRegCache.h" @@ -856,6 +857,8 @@ void ArmJit::CompNEON_Vmmov(MIPSOpcode op) { } void ArmJit::CompNEON_Vmmul(MIPSOpcode op) { + if (PSP_CoreParameter().compat.flags().MMULDisableHack) + DISABLE; CONDITIONAL_DISABLE(VFPU_MTX_VMMUL); MatrixSize msz = GetMtxSize(op); diff --git a/Core/MIPS/ARM64/Arm64CompVFPU.cpp b/Core/MIPS/ARM64/Arm64CompVFPU.cpp index 243890f1ea..9eccb24b7e 100644 --- a/Core/MIPS/ARM64/Arm64CompVFPU.cpp +++ b/Core/MIPS/ARM64/Arm64CompVFPU.cpp @@ -29,6 +29,7 @@ #include "Common/CPUDetect.h" #include "Core/Config.h" #include "Core/Reporting.h" +#include "Core/System.h" #include "Common/Arm64Emitter.h" #include "Core/MIPS/ARM64/Arm64Jit.h" @@ -1214,6 +1215,8 @@ namespace MIPSComp { } void Arm64Jit::Comp_Vmmul(MIPSOpcode op) { + if (PSP_CoreParameter().compat.flags().MMULDisableHack) + DISABLE; CONDITIONAL_DISABLE(VFPU_MTX_VMMUL); if (!js.HasNoPrefix()) { DISABLE; diff --git a/Core/MIPS/IR/IRCompVFPU.cpp b/Core/MIPS/IR/IRCompVFPU.cpp index fe69d4f7e1..96d4bb9c22 100644 --- a/Core/MIPS/IR/IRCompVFPU.cpp +++ b/Core/MIPS/IR/IRCompVFPU.cpp @@ -29,6 +29,7 @@ #include "Core/MIPS/IR/IRFrontend.h" #include "Core/MIPS/IR/IRRegCache.h" #include "Core/Reporting.h" +#include "Core/System.h" // All functions should have CONDITIONAL_DISABLE, so we can narrow things down to a file quickly. @@ -1237,6 +1238,8 @@ namespace MIPSComp { // This may or may not be a win when using the IR interpreter... // Many more instructions to interpret. void IRFrontend::Comp_Vmmul(MIPSOpcode op) { + if (PSP_CoreParameter().compat.flags().MMULDisableHack) + DISABLE; CONDITIONAL_DISABLE(VFPU_MTX_VMMUL); if (!js.HasNoPrefix()) { DISABLE; diff --git a/Core/MIPS/x86/CompVFPU.cpp b/Core/MIPS/x86/CompVFPU.cpp index 0b87ef5ea0..d9e08953ba 100644 --- a/Core/MIPS/x86/CompVFPU.cpp +++ b/Core/MIPS/x86/CompVFPU.cpp @@ -37,6 +37,7 @@ #include "Core/MIPS/MIPSVFPUUtils.h" #include "Core/MIPS/x86/Jit.h" #include "Core/MIPS/x86/RegCache.h" +#include "Core/System.h" // All functions should have CONDITIONAL_DISABLE, so we can narrow things down to a file quickly. // Currently known non working ones should have DISABLE. @@ -2802,6 +2803,8 @@ void Jit::Comp_VScl(MIPSOpcode op) { } void Jit::Comp_Vmmul(MIPSOpcode op) { + if (PSP_CoreParameter().compat.flags().MMULDisableHack) + DISABLE; CONDITIONAL_DISABLE(VFPU_MTX_VMMUL); // TODO: This probably ignores prefixes? diff --git a/assets/compat.ini b/assets/compat.ini index e357178988..29dabaf503 100644 --- a/assets/compat.ini +++ b/assets/compat.ini @@ -332,6 +332,24 @@ ULJS00201 = true # Bijin Tokei Portable not even a game, but needs it to load 2 miniatures, they will be low res, but better than black NPJH00055 = true +[MMULDisableHack] +# Force software MMUL to fix Tekken leg shaking +# Tekken 5 DR +ULJS00048 = true +ULUS10139 = true +UCES00356 = true +ULJS19013 = true +NPJH50137 = true + +# Tekken 6 +ULUS10466 = true +ULES01376 = true +ULJS00224 = true +NPUH10047 = true +ULAS42214 = true +ULJS19054 = true +NPJH50184 = true + [RequireBufferedRendering] # Warn the user that the game will not work and have issue, if buffered rendering is not enabled. # Midnight Club: LA Remix