From dde2f3ade65079a7f65bb693616173da34ee59b5 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 12 Apr 2014 15:48:30 -0700 Subject: [PATCH] Re-replace functions after loading a savestate. Might need to clear before saving too... anyway, this makes testing a bit easier for certain areas. Also, correctly decrease downcount on x86. --- Core/HLE/sceKernelModule.cpp | 4 ++++ Core/MIPS/MIPSAnalyst.cpp | 2 -- Core/MIPS/MIPSAnalyst.h | 2 +- Core/MIPS/x86/Jit.cpp | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 8b91fde287..1fbe61f58b 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -440,6 +440,10 @@ void __KernelModuleDoState(PointerWrap &p) if (s >= 2) { p.Do(loadedModules); } + + if (g_Config.bFuncHashMap) { + MIPSAnalyst::ReplaceFunctions(); + } } void __KernelModuleShutdown() diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index fc65f70c94..b26c82a0a7 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -375,8 +375,6 @@ skip: return furthestJumpbackAddr; } - void ReplaceFunctions(); - void ScanForFunctions(u32 startAddr, u32 endAddr, bool insertSymbols) { AnalyzedFunction currentFunction = {startAddr}; diff --git a/Core/MIPS/MIPSAnalyst.h b/Core/MIPS/MIPSAnalyst.h index 9de80cdb51..ab908f213d 100644 --- a/Core/MIPS/MIPSAnalyst.h +++ b/Core/MIPS/MIPSAnalyst.h @@ -111,7 +111,7 @@ namespace MIPSAnalyst void StoreHashMap(std::string filename = ""); const char *LookupHash(u64 hash, int funcSize); - void ReplaceFunctions(const ReplacementTableEntry *e, int numEntries); + void ReplaceFunctions(); void UpdateHashMap(); void ApplyHashMap(); diff --git a/Core/MIPS/x86/Jit.cpp b/Core/MIPS/x86/Jit.cpp index 662b0a1f8c..a70d0ce359 100644 --- a/Core/MIPS/x86/Jit.cpp +++ b/Core/MIPS/x86/Jit.cpp @@ -491,8 +491,8 @@ void Jit::Comp_ReplacementFunc(MIPSOpcode op) // we can emit. MOV(32, R(ECX), M(¤tMIPS->r[MIPS_REG_RA])); - SUB(32, M(¤tMIPS->downcount - 1), R(EAX)); - js.downcountAmount = 1; // we just subtracted most of it + SUB(32, M(¤tMIPS->downcount), R(EAX)); + js.downcountAmount = 0; // we just subtracted most of it WriteExitDestInReg(ECX); js.compiling = false;