summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinNoGUI/MainNoGUI.cpp
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2022-07-19 00:50:32 +0200
committerGitHub <noreply@github.com>2022-07-19 00:50:32 +0200
commitfa30ba18f5c9dbf06f7df0c1e9bd04065a2c439f (patch)
tree6a0367fa30d1bbb7ee08224298f95c04e92c0cc9 /Source/Core/DolphinNoGUI/MainNoGUI.cpp
parentdd67d5fbc4aeffe78daa7b1697ebf39bdd7ccd3e (diff)
parentdabad822193f23bd01c13c4d0798f0a507e910eb (diff)
Merge pull request #10783 from JosJuice/frontend-controller-init
Require frontend to initialize controllers
Diffstat (limited to 'Source/Core/DolphinNoGUI/MainNoGUI.cpp')
-rw-r--r--Source/Core/DolphinNoGUI/MainNoGUI.cpp19
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;
}