From 7ac537bf73e7233eec09fe7b93ba4c843d389e7e Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Tue, 22 Jun 2021 14:48:00 +1000 Subject: [PATCH] CPU/Recompiler: Flush load delay when lwl/lwr is first instruction Fixes corrupted textures in Zen Nihon Joshi Pro Wrestling - Joou Densetsu - Yume no Taikousen. --- src/core/cpu_recompiler_code_generator.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/cpu_recompiler_code_generator.cpp b/src/core/cpu_recompiler_code_generator.cpp index 233939474..f467da3ea 100644 --- a/src/core/cpu_recompiler_code_generator.cpp +++ b/src/core/cpu_recompiler_code_generator.cpp @@ -1605,6 +1605,16 @@ bool CodeGenerator::Compile_LoadLeftRight(const CodeBlockInstruction& cbi) } else { + // if this is the first instruction in the block, we need to stall until the load finishes + // we don't actually care if it's our target reg or not, if it's not, it won't affect anything + if (m_load_delay_dirty) + { + Log_DevPrintf("Flushing interpreter load delay for lwl/lwr instruction at 0x%08X", cbi.pc); + EmitFlushInterpreterLoadDelay(); + m_register_cache.InvalidateGuestRegister(cbi.instruction.r.rt); + m_load_delay_dirty = false; + } + value = m_register_cache.ReadGuestRegister(cbi.instruction.i.rt, true, true); }