1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-21 20:27:45 +00:00

Allow launching the game to the title screen for debugging purposes

This is hidden under developer settings because it's not supposed to be
a user facing feature.
This commit is contained in:
Joshua Goins 2024-06-27 16:38:45 -04:00
parent 498391bbb9
commit 146f083163
3 changed files with 34 additions and 9 deletions

View file

@ -87,6 +87,10 @@ public:
/// 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();

View file

@ -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);
@ -354,17 +361,17 @@ QCoro::Task<> LauncherCore::beginLogin(LoginInformation &info)
info.profile->account()->updateConfig();
}
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()) {
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);
}
}
// If we expect an auth ticket, don't continue if missing
if (!info.profile->isBenchmark() && auth == std::nullopt) {
co_return;

View file

@ -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