From 89a13b75f70815f5018c1168b3f5b80ff49d0005 Mon Sep 17 00:00:00 2001 From: Elad <18193363+elad335@users.noreply.github.com> Date: Sun, 23 Nov 2025 18:14:39 +0200 Subject: [PATCH] SPU Analyzer: Fix jumptable append --- rpcs3/Emu/Cell/SPUCommonRecompiler.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/Cell/SPUCommonRecompiler.cpp b/rpcs3/Emu/Cell/SPUCommonRecompiler.cpp index 2989f64a56..9a192989e0 100644 --- a/rpcs3/Emu/Cell/SPUCommonRecompiler.cpp +++ b/rpcs3/Emu/Cell/SPUCommonRecompiler.cpp @@ -3122,7 +3122,7 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s u64 dabs = 0; u64 drel = 0; - for (u32 i = start; i < limit; i += 4) + for (u32 i = start, abs_fail = 0, rel_fail = 0; i < limit; i += 4) { const u32 target = ls[i / 4]; @@ -3135,13 +3135,27 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point, s if (target >= lsa && target < SPU_LS_SIZE) { // Possible jump table entry (absolute) - jt_abs.push_back(target); + if (!abs_fail) + { + jt_abs.push_back(target); + } + } + else + { + abs_fail++; } if (target + start >= lsa && target + start < SPU_LS_SIZE) { // Possible jump table entry (relative) - jt_rel.push_back(target + start); + if (!rel_fail) + { + jt_rel.push_back(target + start); + } + } + else + { + rel_fail++; } if (std::max(jt_abs.size(), jt_rel.size()) * 4 + start <= i)