diff options
| author | JosJuice <josjuice@gmail.com> | 2022-06-25 17:31:31 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2022-07-17 14:03:04 +0200 |
| commit | dabad822193f23bd01c13c4d0798f0a507e910eb (patch) | |
| tree | e1952b7e93625fa3450b2fca075159c49a43487b /Source/Core/DolphinNoGUI/MainNoGUI.cpp | |
| parent | 2f3c0cdbc594cdcb76644e1e77aa185a1e50a244 (diff) | |
Require frontend to initialize controllers
We currently have two different code paths for initializing controllers:
Either the frontend (DolphinQt) can do it, or if the frontend doesn't do
it, the core will do it automatically when booting. Having these two
paths has caused problems in the past due to only one frontend being
tested (see de7ef47548). I would like to get rid of the latter path to
avoid further problems like this.
Diffstat (limited to 'Source/Core/DolphinNoGUI/MainNoGUI.cpp')
| -rw-r--r-- | Source/Core/DolphinNoGUI/MainNoGUI.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Source/Core/DolphinNoGUI/MainNoGUI.cpp b/Source/Core/DolphinNoGUI/MainNoGUI.cpp index cec4788f1c..03ea30ec17 100644 --- a/Source/Core/DolphinNoGUI/MainNoGUI.cpp +++ b/Source/Core/DolphinNoGUI/MainNoGUI.cpp @@ -17,6 +17,7 @@ #include <Windows.h> #endif +#include "Common/ScopeGuard.h" #include "Common/StringUtil.h" #include "Core/Boot/Boot.h" #include "Core/BootManager.h" @@ -226,10 +227,6 @@ int main(int argc, char* argv[]) if (options.is_set("user")) user_directory = static_cast<const char*>(options.get("user")); - UICommon::SetUserDirectory(user_directory); - UICommon::Init(); - GCAdapter::Init(); - s_platform = GetPlatform(options); if (!s_platform || !s_platform->Init()) { @@ -237,6 +234,17 @@ int main(int argc, char* argv[]) return 1; } + const WindowSystemInfo wsi = s_platform->GetWindowSystemInfo(); + + UICommon::SetUserDirectory(user_directory); + UICommon::Init(); + UICommon::InitControllers(wsi); + + Common::ScopeGuard ui_common_guard([] { + UICommon::ShutdownControllers(); + UICommon::Shutdown(); + }); + if (save_state_path && !game_specified) { fprintf(stderr, "A save state cannot be loaded without specifying a game to launch.\n"); @@ -263,7 +271,7 @@ int main(int argc, char* argv[]) DolphinAnalytics::Instance().ReportDolphinStart("nogui"); - if (!BootManager::BootCore(std::move(boot), s_platform->GetWindowSystemInfo())) + if (!BootManager::BootCore(std::move(boot), wsi)) { fprintf(stderr, "Could not boot the specified file\n"); return 1; @@ -278,7 +286,6 @@ int main(int argc, char* argv[]) Core::Shutdown(); s_platform.reset(); - UICommon::Shutdown(); return 0; } |
