Skip to content

Commit

Permalink
DolphinQt: Initialize and shutdown the Steam helper app as needed
Browse files Browse the repository at this point in the history
  • Loading branch information
OatmealDome committed May 21, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 313d9d0 commit f951505
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Source/Core/DolphinQt/Main.cpp
Original file line number Diff line number Diff line change
@@ -38,9 +38,15 @@
#include "DolphinQt/Translation.h"
#include "DolphinQt/Updater.h"

#include "SteamHelperCommon/InitResult.h"

#include "UICommon/CommandLineParse.h"
#include "UICommon/UICommon.h"

#ifdef STEAM
#include "UICommon/Steam/Steam.h"
#endif

static bool QtMsgAlertHandler(const char* caption, const char* text, bool yes_no,
Common::MsgType style)
{
@@ -183,6 +189,20 @@ int main(int argc, char* argv[])
// Hook up translations
Translation::Initialize();

#ifdef STEAM
Steam::InitResult steam_init_result = Steam::Init();
if (steam_init_result == Steam::InitResult::Failure)
{
PanicAlertFmtT("Failed to initialize Steam helper");
return 0;
}
else if (steam_init_result == Steam::InitResult::RestartingFromSteam)
{
// We're not being launched by Steam. Exit immediately, as Steam will relaunch Dolphin for us.
return 0;
}
#endif

// Whenever the event loop is about to go to sleep, dispatch the jobs
// queued in the Core first.
QObject::connect(QAbstractEventDispatcher::instance(), &QAbstractEventDispatcher::aboutToBlock,
@@ -297,6 +317,9 @@ int main(int argc, char* argv[])
}

Core::Shutdown();
#ifdef STEAM
Steam::Shutdown();
#endif
UICommon::Shutdown();
Host::GetInstance()->deleteLater();

0 comments on commit f951505

Please sign in to comment.