From b36e2ce6bec6d92647663661dbcc54b9f5504154 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 26 Sep 2024 20:55:13 +1000 Subject: [PATCH] CPU/CodeCache: Don't create a branch block with no delay slot Can't compile that. --- src/core/cpu_code_cache.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/cpu_code_cache.cpp b/src/core/cpu_code_cache.cpp index 142c23b54..f16781070 100644 --- a/src/core/cpu_code_cache.cpp +++ b/src/core/cpu_code_cache.cpp @@ -934,6 +934,11 @@ bool CPU::CodeCache::ReadBlockInstructions(u32 start_pc, BlockInstructionList* i { // Away to the int you go! ERROR_LOG("Instruction read failed at PC=0x{:08X}, truncating block.", pc); + + // If the last instruction was a branch, we need the delay slot in the block to compile it. + if (is_branch_delay_slot) + instructions->pop_back(); + break; }