From 10ae0da04199f5af2c91f240c3e2c2b17ecd7208 Mon Sep 17 00:00:00 2001 From: zilmar Date: Fri, 25 Nov 2016 17:34:01 +1100 Subject: [PATCH] [Android] Fix bug in CArmOps::ThumbCompressConst and add another case --- .../Project64-core/N64System/Recompiler/Arm/ArmOps.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.cpp b/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.cpp index 1c5699a26..4842e9eeb 100644 --- a/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.cpp @@ -1386,12 +1386,20 @@ uint16_t CArmOps::ThumbCompressConst (uint32_t value) return (uint16_t)((value & 0xFF)); } + //'00000000 nnnnnnnn 00000000 nnnnnnnn' + if (((value >> 24) & 0xFF) == 0 && + ((value >> 16) & 0xFF) == (value & 0xFF) && + ((value >> 8) & 0xFF) == 0) + { + return (uint16_t)(0x100 | (value & 0xFF)); + } + //'nnnnnnnn 00000000 nnnnnnnn 00000000' if (((value >> 24) & 0xFF) == ((value >> 8) & 0xFF) && ((value >> 16) & 0xFF) == 0 && (value & 0xFF) == 0) { - return (uint16_t)(0x200 | (value & 0xFF)); + return (uint16_t)(0x200 | ((value >> 8) & 0xFF)); } //'nnnnnnnn nnnnnnnn nnnnnnnn nnnnnnnn'