diff options
| author | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-03-01 23:39:04 -0800 |
|---|---|---|
| committer | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-03-01 23:39:04 -0800 |
| commit | 16c609dcd45780a1cc97660d6e8a23936f9adfe3 (patch) | |
| tree | 6347c38b626a0ec33e961cb2d6ccb56ba5aebed2 /Source/Core | |
| parent | 5a81916ee9b4197c421937e8d8096cbd22c2820d (diff) | |
BootManager: Avoid Global System Accessor
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/BootManager.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/Core/BootManager.h | 7 | ||||
| -rw-r--r-- | Source/Core/DolphinNoGUI/MainNoGUI.cpp | 3 | ||||
| -rw-r--r-- | Source/Core/DolphinQt/MainWindow.cpp | 2 |
4 files changed, 11 insertions, 5 deletions
diff --git a/Source/Core/Core/BootManager.cpp b/Source/Core/Core/BootManager.cpp index 1c0bc7e04c..1c87994bf9 100644 --- a/Source/Core/Core/BootManager.cpp +++ b/Source/Core/Core/BootManager.cpp @@ -55,12 +55,12 @@ namespace BootManager { // Boot the ISO or file -bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi) +bool BootCore(Core::System& system, std::unique_ptr<BootParameters> boot, + const WindowSystemInfo& wsi) { if (!boot) return false; - auto& system = Core::System::GetInstance(); SConfig& StartUp = SConfig::GetInstance(); if (!StartUp.SetPathsAndGameMetadata(system, *boot)) diff --git a/Source/Core/Core/BootManager.h b/Source/Core/Core/BootManager.h index 10474c5f3f..e8ec568921 100644 --- a/Source/Core/Core/BootManager.h +++ b/Source/Core/Core/BootManager.h @@ -5,12 +5,17 @@ #include <memory> +namespace Core +{ +class System; +} struct BootParameters; struct WindowSystemInfo; namespace BootManager { -bool BootCore(std::unique_ptr<BootParameters> parameters, const WindowSystemInfo& wsi); +bool BootCore(Core::System& system, std::unique_ptr<BootParameters> parameters, + const WindowSystemInfo& wsi); // Synchronise Dolphin's configuration with the SYSCONF (which may have changed during emulation), // and restore settings that were overriden by per-game INIs or for some other reason. diff --git a/Source/Core/DolphinNoGUI/MainNoGUI.cpp b/Source/Core/DolphinNoGUI/MainNoGUI.cpp index ff69e6bf7a..9db8ef8a47 100644 --- a/Source/Core/DolphinNoGUI/MainNoGUI.cpp +++ b/Source/Core/DolphinNoGUI/MainNoGUI.cpp @@ -24,6 +24,7 @@ #include "Core/Core.h" #include "Core/DolphinAnalytics.h" #include "Core/Host.h" +#include "Core/System.h" #include "UICommon/CommandLineParse.h" #ifdef USE_DISCORD_PRESENCE @@ -304,7 +305,7 @@ int main(int argc, char* argv[]) DolphinAnalytics::Instance().ReportDolphinStart("nogui"); - if (!BootManager::BootCore(std::move(boot), wsi)) + if (!BootManager::BootCore(Core::System::GetInstance(), std::move(boot), wsi)) { fprintf(stderr, "Could not boot the specified file\n"); return 1; diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index ff028f5d37..54b75c05c1 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -1126,7 +1126,7 @@ void MainWindow::StartGame(std::unique_ptr<BootParameters>&& parameters) ShowRenderWidget(); // Boot up, show an error if it fails to load the game. - if (!BootManager::BootCore(std::move(parameters), + if (!BootManager::BootCore(Core::System::GetInstance(), std::move(parameters), ::GetWindowSystemInfo(m_render_widget->windowHandle()))) { ModalMessageBox::critical(this, tr("Error"), tr("Failed to init core"), QMessageBox::Ok); |
