Skip to content

Commit

Permalink
Allow launching the game to the title screen for debugging purposes
Browse files Browse the repository at this point in the history
This is hidden under developer settings because it's not supposed to be
a user facing feature.
  • Loading branch information
redstrate committed Jun 27, 2024
1 parent 498391b commit 146f083
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
4 changes: 4 additions & 0 deletions launcher/include/launchercore.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ class LauncherCore : public QObject
/// check the result to see whether they need to "reset" or show a failed state or not. \note The login process is asynchronous.
Q_INVOKABLE bool autoLogin(Profile *profile);

/// Launches the game without patching, or logging in.
/// Meant to test if we can get to the title screen and is intended to fail to do anything else.
Q_INVOKABLE void immediatelyLaunch(Profile *profile);

Q_INVOKABLE GameInstaller *createInstaller(Profile *profile);
Q_INVOKABLE GameInstaller *createInstallerFromExisting(Profile *profile, const QString &filePath);
Q_INVOKABLE CompatibilityToolInstaller *createCompatInstaller();
Expand Down
25 changes: 16 additions & 9 deletions launcher/src/launchercore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ bool LauncherCore::autoLogin(Profile *profile)
return true;
}

void LauncherCore::immediatelyLaunch(Profile *profile)
{
Q_ASSERT(profile != nullptr);

m_runner->beginGameExecutable(*profile, std::nullopt);
}

GameInstaller *LauncherCore::createInstaller(Profile *profile)
{
Q_ASSERT(profile != nullptr);
Expand Down Expand Up @@ -354,17 +361,17 @@ QCoro::Task<> LauncherCore::beginLogin(LoginInformation &info)
info.profile->account()->updateConfig();
}

auto assetUpdater = new AssetUpdater(*info.profile, *this, this);
if (co_await assetUpdater->update()) {
std::optional<LoginAuth> auth;
if (!info.profile->isBenchmark()) {
if (info.profile->account()->isSapphire()) {
auth = co_await m_sapphireLogin->login(info.profile->account()->lobbyUrl(), info);
} else {
auth = co_await m_squareEnixLogin->login(&info);
}
std::optional<LoginAuth> auth;
if (!info.profile->isBenchmark()) {
if (info.profile->account()->isSapphire()) {
auth = co_await m_sapphireLogin->login(info.profile->account()->lobbyUrl(), info);
} else {
auth = co_await m_squareEnixLogin->login(&info);
}
}

auto assetUpdater = new AssetUpdater(*info.profile, *this, this);
if (co_await assetUpdater->update()) {
// If we expect an auth ticket, don't continue if missing
if (!info.profile->isBenchmark() && auth == std::nullopt) {
co_return;
Expand Down
14 changes: 14 additions & 0 deletions launcher/ui/Settings/DeveloperSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ FormCard.FormCardPage {
FormCard.FormCard {
Layout.fillWidth: true

FormCard.FormButtonDelegate {
id: launchGameDelegate

text: i18n("Launch Game Now")
description: i18n("This is meant for testing if we can get to the title screen and will fail at doing anything else.")

onClicked: LauncherCore.immediatelyLaunch(LauncherCore.currentProfile)
}

FormCard.FormDelegateSeparator {
above: launchGameDelegate
below: encryptArgDelegate
}

FormCard.FormCheckDelegate {
id: encryptArgDelegate

Expand Down

0 comments on commit 146f083

Please sign in to comment.