Skip to content

Commit

Permalink
Hacky compat workaround for Resistance's ad-hoc mode
Browse files Browse the repository at this point in the history
Slicing the slow memcpy calls messes up some timing so it crashes. Too
hard to fix for 1.17.1, so we do this :(
  • Loading branch information
hrydgard committed Feb 3, 2024
1 parent bdfa4c1 commit 2cd7b5c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions Core/Compatibility.cpp
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions Core/Compatibility.h
Expand Up @@ -107,6 +107,7 @@ struct CompatFlags {
bool AllowDelayedReadbacks;
bool TacticsOgreEliminateDebugReadback;
bool FramebufferAllowLargeVerticalOffset;
bool DisableMemcpySlicing;
};

struct VRCompat {
Expand Down
4 changes: 2 additions & 2 deletions Core/HLE/ReplaceTables.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions assets/compat.ini
Expand Up @@ -969,6 +969,7 @@ ULES00869 = true
# Resistance Retribution
UCES01184 = true
UCUS98668 = true
UCJP00174 = true

# Spider-Man 3
ULES00938 = true
Expand Down Expand Up @@ -1737,3 +1738,8 @@ ULJM05753 = true
NPJH50348 = true
ULJM06009 = true
UCKS45164 = true

[DisableMemcpySlicing]
UCES01184 = true
UCUS98668 = true
UCJP00174 = true

0 comments on commit 2cd7b5c

Please sign in to comment.