From 8b29b442caa25825cadcf087373e187dea775f00 Mon Sep 17 00:00:00 2001 From: Simone <91993281+SimoneN64@users.noreply.github.com> Date: Mon, 13 Mar 2023 10:49:12 +0100 Subject: [PATCH] Fix branch likely setting branch flag unconditionally (instead, should only be set if the condition is true) --- .gitignore | 3 ++- src/backend/core/interpreter/instructions.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 144b1da5..525a2b56 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,5 @@ log.txt .vs/ CMakeSettings.json out/ -settings.json \ No newline at end of file +settings.json +.vscode/ \ No newline at end of file diff --git a/src/backend/core/interpreter/instructions.cpp b/src/backend/core/interpreter/instructions.cpp index 6c902b73..f936f803 100644 --- a/src/backend/core/interpreter/instructions.cpp +++ b/src/backend/core/interpreter/instructions.cpp @@ -159,8 +159,8 @@ void Interpreter::branch(bool cond, s64 address) { } void Interpreter::branch_likely(bool cond, s64 address) { - regs.delaySlot = true; if (cond) { + regs.delaySlot = true; regs.nextPC = address; } else { regs.SetPC64(regs.nextPC);