From 80cc2f0cb7eb2758493dfc70daf891ea4326bd13 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Wed, 16 Mar 2022 21:03:24 +1000 Subject: [PATCH] Qt: Log machine caps on startup --- pcsx2-qt/EmuThread.cpp | 4 ++-- pcsx2-qt/QtHost.cpp | 3 +++ pcsx2/VMManager.cpp | 16 ++++++++++------ pcsx2/VMManager.h | 15 +++++++++------ 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/pcsx2-qt/EmuThread.cpp b/pcsx2-qt/EmuThread.cpp index 49dd652a22..80d4f22d92 100644 --- a/pcsx2-qt/EmuThread.cpp +++ b/pcsx2-qt/EmuThread.cpp @@ -236,7 +236,7 @@ void EmuThread::run() m_event_loop = new QEventLoop(); m_started_semaphore.release(); - if (!VMManager::InitializeMemory()) + if (!VMManager::Internal::InitializeMemory()) pxFailRel("Failed to allocate memory map"); // we need input sources ready for binding @@ -258,7 +258,7 @@ void EmuThread::run() stopBackgroundControllerPollTimer(); destroyBackgroundControllerPollTimer(); InputManager::CloseSources(); - VMManager::ReleaseMemory(); + VMManager::Internal::ReleaseMemory(); PerformanceMetrics::SetCPUThreadTimer(Common::ThreadCPUTimer()); moveToThread(m_ui_thread); deleteLater(); diff --git a/pcsx2-qt/QtHost.cpp b/pcsx2-qt/QtHost.cpp index 6c4557d078..39966a8460 100644 --- a/pcsx2-qt/QtHost.cpp +++ b/pcsx2-qt/QtHost.cpp @@ -82,6 +82,9 @@ bool QtHost::Initialize() return false; } + if (!VMManager::Internal::InitializeGlobals()) + return false; + HookSignals(); return true; } diff --git a/pcsx2/VMManager.cpp b/pcsx2/VMManager.cpp index e53a68a399..aa708012c7 100644 --- a/pcsx2/VMManager.cpp +++ b/pcsx2/VMManager.cpp @@ -173,16 +173,20 @@ std::string VMManager::GetGameName() return s_game_name; } -bool VMManager::InitializeMemory() +bool VMManager::Internal::InitializeGlobals() { - pxAssert(!s_vm_memory && !s_cpu_provider_pack); - -#ifdef _M_X86 x86caps.Identify(); x86caps.CountCores(); x86caps.SIMD_EstablishMXCSRmask(); x86caps.CalculateMHz(); -#endif + SysLogMachineCaps(); + + return true; +} + +bool VMManager::Internal::InitializeMemory() +{ + pxAssert(!s_vm_memory && !s_cpu_provider_pack); s_vm_memory = std::make_unique(); s_cpu_provider_pack = std::make_unique(); @@ -191,7 +195,7 @@ bool VMManager::InitializeMemory() return true; } -void VMManager::ReleaseMemory() +void VMManager::Internal::ReleaseMemory() { std::vector().swap(s_widescreen_cheats_data); s_widescreen_cheats_loaded = false; diff --git a/pcsx2/VMManager.h b/pcsx2/VMManager.h index fcee0167f9..36c0c7e3c9 100644 --- a/pcsx2/VMManager.h +++ b/pcsx2/VMManager.h @@ -72,12 +72,6 @@ namespace VMManager /// Returns the name of the disc/executable currently running. std::string GetGameName(); - /// Reserves memory for the virtual machines. - bool InitializeMemory(); - - /// Completely releases all memory for the virtual machine. - void ReleaseMemory(); - /// Initializes all system components. bool Initialize(const VMBootParameters& boot_params); @@ -149,6 +143,15 @@ namespace VMManager /// Internal callbacks, implemented in the emu core. namespace Internal { + /// Performs early global initialization. + bool InitializeGlobals(); + + /// Reserves memory for the virtual machines. + bool InitializeMemory(); + + /// Completely releases all memory for the virtual machine. + void ReleaseMemory(); + const std::string& GetElfOverride(); bool IsExecutionInterrupted(); void GameStartingOnCPUThread();