From 1ceaa8c52a0f3763c015c34260518a0c35ced702 Mon Sep 17 00:00:00 2001 From: Lioncache Date: Mon, 18 Dec 2023 16:34:10 -0500 Subject: [PATCH] Core/GeckoCode: Remove global system accessor We can use the CPUThreadGuard instance to retrieve the system instance instead. --- Source/Core/Core/GeckoCode.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/GeckoCode.cpp b/Source/Core/Core/GeckoCode.cpp index 3baf683314..48e3423d15 100644 --- a/Source/Core/Core/GeckoCode.cpp +++ b/Source/Core/Core/GeckoCode.cpp @@ -17,6 +17,7 @@ #include "Core/Config/MainSettings.h" #include "Core/ConfigManager.h" +#include "Core/Core.h" #include "Core/PowerPC/MMU.h" #include "Core/PowerPC/PowerPC.h" #include "Core/System.h" @@ -206,10 +207,8 @@ static Installation InstallCodeHandlerLocked(const Core::CPUThreadGuard& guard) // Turn on codes PowerPC::MMU::HostWrite_U8(guard, 1, INSTALLER_BASE_ADDRESS + 7); - auto& system = Core::System::GetInstance(); - auto& ppc_state = system.GetPPCState(); - // Invalidate the icache and any asm codes + auto& ppc_state = guard.GetSystem().GetPPCState(); for (unsigned int j = 0; j < (INSTALLER_END_ADDRESS - INSTALLER_BASE_ADDRESS); j += 32) { ppc_state.iCache.Invalidate(INSTALLER_BASE_ADDRESS + j); @@ -258,8 +257,7 @@ void RunCodeHandler(const Core::CPUThreadGuard& guard) } } - auto& system = Core::System::GetInstance(); - auto& ppc_state = system.GetPPCState(); + auto& ppc_state = guard.GetSystem().GetPPCState(); // We always do this to avoid problems with the stack since we're branching in random locations. // Even with function call return hooks (PC == LR), hand coded assembler won't necessarily