From 904ed4b78560d12bc26c4459d3d200cbae899979 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Thu, 2 Apr 2026 11:06:28 +0200 Subject: [PATCH 1/2] Jit64: Use dcbz slow path with accurate dcache Jit64::dcbz's fast path bypasses the dcache, so we shouldn't use it if accurate dcache is turned on. This fixes the graphical corruption that would occur in Mario Kart Wii's menu FMVs with accurate dcache. JitArm64 never had this problem, because it implements dcbz in a different way. It calls EmitBackpatchRoutine, which already has a check for accurate dcache. --- Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp index b4a3b4ef43..eae7eee207 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp @@ -448,7 +448,8 @@ void Jit64::dcbz(UGeckoInstruction inst) end_dcbz_hack = J_CC(CC_L); } - bool emit_fast_path = (m_ppc_state.feature_flags & FEATURE_FLAG_MSR_DR) && m_jit.jo.fastmem_arena; + bool emit_fast_path = (m_ppc_state.feature_flags & FEATURE_FLAG_MSR_DR) && + m_jit.jo.fastmem_arena && !m_accurate_cpu_cache_enabled; if (emit_fast_path) { From f7b9c1f03438dee2e64b8e965b333295fbe666ea Mon Sep 17 00:00:00 2001 From: JosJuice Date: Thu, 2 Apr 2026 11:13:52 +0200 Subject: [PATCH 2/2] Jit: Move dcbx ENABLE_IF INSTRUCTION_START is supposed to be before anything else in the function. The difference only matters if INSTRUCTION_START gets redefined, though. --- Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp | 3 +-- Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp index eae7eee207..51fd336760 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp @@ -234,10 +234,9 @@ void Jit64::lXXx(UGeckoInstruction inst) void Jit64::dcbx(UGeckoInstruction inst) { - FALLBACK_IF(m_accurate_cpu_cache_enabled); - INSTRUCTION_START JITDISABLE(bJITLoadStoreOff); + FALLBACK_IF(m_accurate_cpu_cache_enabled); // Check if the next instructions match a known looping pattern: // - dcbx rX diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp index bcab1ede76..8c80151e91 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp @@ -757,10 +757,9 @@ void JitArm64::stmw(UGeckoInstruction inst) void JitArm64::dcbx(UGeckoInstruction inst) { - FALLBACK_IF(m_accurate_cpu_cache_enabled); - INSTRUCTION_START JITDISABLE(bJITLoadStoreOff); + FALLBACK_IF(m_accurate_cpu_cache_enabled); u32 a = inst.RA, b = inst.RB;