From 96ca347bdcc833fe0aa175175850580149f4f784 Mon Sep 17 00:00:00 2001 From: hrydgard Date: Wed, 13 Aug 2008 22:28:36 +0000 Subject: [PATCH] Fix sign extension bug from hardware reads. Mainly seems to affect homebrew apps. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@193 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/Boot/Boot_DOL.cpp | 4 ++-- .../Core/Core/Src/PowerPC/Jit64/Jit_Branch.cpp | 17 ++++++++++++----- Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.cpp | 3 +++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Source/Core/Core/Src/Boot/Boot_DOL.cpp b/Source/Core/Core/Src/Boot/Boot_DOL.cpp index 0c53dc3297..2982a7348f 100644 --- a/Source/Core/Core/Src/Boot/Boot_DOL.cpp +++ b/Source/Core/Core/Src/Boot/Boot_DOL.cpp @@ -33,7 +33,7 @@ CDolLoader::CDolLoader(const char* _szFilename) : m_bInit(false) p[i] = Common::swap32(p[i]); // load all text (code) sections - for(int i=0; i> 4) & 1); - const bool only_condition_check = ((inst.BO >> 2) & 1); - if (only_condition_check && only_counter_check) - PanicAlert("Bizarre bcx encountered. Likely bad or corrupt code."); + const bool only_counter_check = (inst.BO & 16) ? true : false; + const bool only_condition_check = (inst.BO & 4) ? true : false; + //if (only_condition_check && only_counter_check) + // PanicAlert("Bizarre bcx encountered. Likely bad or corrupt code."); bool doFullTest = (inst.BO & 16) == 0 && (inst.BO & 4) == 0; bool ctrDecremented = false; diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.cpp index 21987b6a55..7c152c6bd9 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.cpp @@ -74,6 +74,9 @@ void SafeLoadRegToEAX(X64Reg reg, int accessSize, s32 offset, bool signExtend) case 16: ABI_CallFunctionR(ProtectFunction((void *)&Memory::Read_U16, 1), reg); break; case 8: ABI_CallFunctionR(ProtectFunction((void *)&Memory::Read_U8, 1), reg); break; } + if (signExtend && accessSize < 32) { + MOVSX(32, accessSize, EAX, R(EAX)); + } SetJumpTarget(arg2); }