From 8191273a3de6df8531805fbfb1a9b6e5a18076a2 Mon Sep 17 00:00:00 2001 From: Subv Date: Mon, 30 Jul 2018 20:09:49 -0500 Subject: MacroInterpreter: Avoid left shifting negative values. The branch target is signed, so multiply by 4 instead of left shifting by 2 --- src/video_core/macro_interpreter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/video_core/macro_interpreter.cpp') diff --git a/src/video_core/macro_interpreter.cpp b/src/video_core/macro_interpreter.cpp index 44ece01c1..377bd66ab 100644 --- a/src/video_core/macro_interpreter.cpp +++ b/src/video_core/macro_interpreter.cpp @@ -102,11 +102,11 @@ bool MacroInterpreter::Step(const std::vector& code, bool is_delay_slot) { if (taken) { // Ignore the delay slot if the branch has the annul bit. if (opcode.branch_annul) { - pc = base_address + (opcode.immediate << 2); + pc = base_address + opcode.GetBranchTarget(); return true; } - delayed_pc = base_address + (opcode.immediate << 2); + delayed_pc = base_address + opcode.GetBranchTarget(); // Execute one more instruction due to the delay slot. return Step(code, true); } -- cgit v1.2.3