mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
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.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user