summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-07-31 18:24:13 +0200
committerGitHub <noreply@github.com>2018-07-31 18:24:13 +0200
commit3575c076cb12db611c5d252bd647a236b789f53f (patch)
treeaa2d9a1086132095a9f50749920288dcb1e279ad /src/video_core
parentMerge pull request #875 from lioncash/fgm (diff)
parentMacroInterpreter: Avoid left shifting negative values. (diff)
downloadyuzu-3575c076cb12db611c5d252bd647a236b789f53f.tar
yuzu-3575c076cb12db611c5d252bd647a236b789f53f.tar.gz
yuzu-3575c076cb12db611c5d252bd647a236b789f53f.tar.bz2
yuzu-3575c076cb12db611c5d252bd647a236b789f53f.tar.lz
yuzu-3575c076cb12db611c5d252bd647a236b789f53f.tar.xz
yuzu-3575c076cb12db611c5d252bd647a236b789f53f.tar.zst
yuzu-3575c076cb12db611c5d252bd647a236b789f53f.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/macro_interpreter.cpp4
-rw-r--r--src/video_core/macro_interpreter.h4
2 files changed, 6 insertions, 2 deletions
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<u32>& 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);
}
diff --git a/src/video_core/macro_interpreter.h b/src/video_core/macro_interpreter.h
index a71e359d8..7d836b816 100644
--- a/src/video_core/macro_interpreter.h
+++ b/src/video_core/macro_interpreter.h
@@ -91,6 +91,10 @@ private:
u32 GetBitfieldMask() const {
return (1 << bf_size) - 1;
}
+
+ s32 GetBranchTarget() const {
+ return static_cast<s32>(immediate * sizeof(u32));
+ }
};
union MethodAddress {