From f1b18d8ae368fe5929b79ce2ce0f9bb4dd49086e Mon Sep 17 00:00:00 2001 From: Lioncache Date: Mon, 18 Dec 2023 19:05:37 -0500 Subject: [PATCH] Core/IOS/ES: Remove global system accessor in InitializeEmulationState() We can pass the core timing instance into the function. --- Source/Core/Core/IOS/ES/ES.cpp | 4 +--- Source/Core/Core/IOS/ES/ES.h | 6 +++++- Source/Core/Core/IOS/IOS.cpp | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/IOS/ES/ES.cpp b/Source/Core/Core/IOS/ES/ES.cpp index 128d28787f..a5d1bd6dc5 100644 --- a/Source/Core/Core/IOS/ES/ES.cpp +++ b/Source/Core/Core/IOS/ES/ES.cpp @@ -125,10 +125,8 @@ ESDevice::ESDevice(EmulationKernel& ios, ESCore& core, const std::string& device ESDevice::~ESDevice() = default; -void ESDevice::InitializeEmulationState() +void ESDevice::InitializeEmulationState(CoreTiming::CoreTimingManager& core_timing) { - auto& system = Core::System::GetInstance(); - auto& core_timing = system.GetCoreTiming(); s_finish_init_event = core_timing.RegisterEvent("IOS-ESFinishInit", [](Core::System& system_, u64, s64) { GetIOS()->GetESDevice()->FinishInit(); diff --git a/Source/Core/Core/IOS/ES/ES.h b/Source/Core/Core/IOS/ES/ES.h index ba5f68607a..4b9adbf576 100644 --- a/Source/Core/Core/IOS/ES/ES.h +++ b/Source/Core/Core/IOS/ES/ES.h @@ -17,6 +17,10 @@ class PointerWrap; +namespace CoreTiming +{ +class CoreTimingManager; +} namespace DiscIO { enum class Platform; @@ -232,7 +236,7 @@ public: ESDevice& operator=(ESDevice&& other) = delete; ~ESDevice(); - static void InitializeEmulationState(); + static void InitializeEmulationState(CoreTiming::CoreTimingManager& core_timing); static void FinalizeEmulationState(); ReturnCode DIVerify(const ES::TMDReader& tmd, const ES::TicketReader& ticket); diff --git a/Source/Core/Core/IOS/IOS.cpp b/Source/Core/Core/IOS/IOS.cpp index a0b7e665ae..9e73644a22 100644 --- a/Source/Core/Core/IOS/IOS.cpp +++ b/Source/Core/Core/IOS/IOS.cpp @@ -959,7 +959,7 @@ void Init(Core::System& system) s_ios->HandleIPCEvent(userdata); }); - ESDevice::InitializeEmulationState(); + ESDevice::InitializeEmulationState(core_timing); s_event_finish_ppc_bootstrap = core_timing.RegisterEvent("IOSFinishPPCBootstrap", FinishPPCBootstrap);