From a5c6f25ee3e4627169114e291b3d0ca4c10dc548 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 5 Sep 2022 10:41:18 +0930 Subject: [PATCH] Core: CX86RecompilerOps::BaseOffsetAddress should not unprotect unless it actually protected --- .../N64System/Recompiler/x86/x86RecompilerOps.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp index 0240658505..baa89f056b 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp @@ -9526,10 +9526,14 @@ CX86Ops::x86Reg CX86RecompilerOps::BaseOffsetAddress(bool UseBaseRegister) { if (m_Opcode.offset != 0) { + bool UnProtect = m_RegWorkingSet.GetX86Protected(GetIndexFromX86Reg(GetMipsRegMapLo(m_Opcode.base))); ProtectGPR(m_Opcode.base); AddressReg = Map_TempReg(CX86Ops::x86_Any, -1, false); m_Assembler.LeaSourceAndOffset(AddressReg, GetMipsRegMapLo(m_Opcode.base), (int16_t)m_Opcode.offset); - UnProtectGPR(m_Opcode.base); + if (!UnProtect) + { + UnProtectGPR(m_Opcode.base); + } } else if (UseBaseRegister) {