From 2cd7b5ccebe25d03ea625ea446002a0ba2586fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 4 Feb 2024 00:43:48 +0100 Subject: [PATCH] Hacky compat workaround for Resistance's ad-hoc mode Slicing the slow memcpy calls messes up some timing so it crashes. Too hard to fix for 1.17.1, so we do this :( --- Core/Compatibility.cpp | 1 + Core/Compatibility.h | 1 + Core/HLE/ReplaceTables.cpp | 4 ++-- assets/compat.ini | 6 ++++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Core/Compatibility.cpp b/Core/Compatibility.cpp index fcee5e3900..6494760a24 100644 --- a/Core/Compatibility.cpp +++ b/Core/Compatibility.cpp @@ -137,6 +137,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) { CheckSetting(iniFile, gameID, "AllowDelayedReadbacks", &flags_.AllowDelayedReadbacks); CheckSetting(iniFile, gameID, "TacticsOgreEliminateDebugReadback", &flags_.TacticsOgreEliminateDebugReadback); CheckSetting(iniFile, gameID, "FramebufferAllowLargeVerticalOffset", &flags_.FramebufferAllowLargeVerticalOffset); + CheckSetting(iniFile, gameID, "DisableMemcpySlicing", &flags_.DisableMemcpySlicing); } void Compatibility::CheckVRSettings(IniFile &iniFile, const std::string &gameID) { diff --git a/Core/Compatibility.h b/Core/Compatibility.h index 0eb318b1bb..1739112d36 100644 --- a/Core/Compatibility.h +++ b/Core/Compatibility.h @@ -107,6 +107,7 @@ struct CompatFlags { bool AllowDelayedReadbacks; bool TacticsOgreEliminateDebugReadback; bool FramebufferAllowLargeVerticalOffset; + bool DisableMemcpySlicing; }; struct VRCompat { diff --git a/Core/HLE/ReplaceTables.cpp b/Core/HLE/ReplaceTables.cpp index ac9054cd35..1d25417750 100644 --- a/Core/HLE/ReplaceTables.cpp +++ b/Core/HLE/ReplaceTables.cpp @@ -198,7 +198,7 @@ static int Replace_memcpy_jak() { skip = gpu->PerformMemoryCopy(destPtr, srcPtr, bytes); } } - if (!skip && bytes > SLICE_SIZE && bytes != 512 * 272 * 4) { + if (!skip && bytes > SLICE_SIZE && bytes != 512 * 272 * 4 && !PSP_CoreParameter().compat.flags().DisableMemcpySlicing) { // This is a very slow func. To avoid thread blocking, do a slice at a time. // Avoiding exactly 512 * 272 * 4 to detect videos, though. bytes = SLICE_SIZE; @@ -390,7 +390,7 @@ static int Replace_memset_jak() { if (Memory::IsVRAMAddress(destPtr) && (skipGPUReplacements & (int)GPUReplacementSkip::MEMSET) == 0) { skip = gpu->PerformMemorySet(destPtr, value, bytes); } - if (!skip && bytes > SLICE_SIZE) { + if (!skip && bytes > SLICE_SIZE && !PSP_CoreParameter().compat.flags().DisableMemcpySlicing) { // This is a very slow func. To avoid thread blocking, do a slice at a time. bytes = SLICE_SIZE; sliced = true; diff --git a/assets/compat.ini b/assets/compat.ini index b53428e6de..aa1bc494d1 100644 --- a/assets/compat.ini +++ b/assets/compat.ini @@ -969,6 +969,7 @@ ULES00869 = true # Resistance Retribution UCES01184 = true UCUS98668 = true +UCJP00174 = true # Spider-Man 3 ULES00938 = true @@ -1737,3 +1738,8 @@ ULJM05753 = true NPJH50348 = true ULJM06009 = true UCKS45164 = true + +[DisableMemcpySlicing] +UCES01184 = true +UCUS98668 = true +UCJP00174 = true