~redstrate/public-inbox

astra: Adding new checkbox for only doing authentication and not booting v1 NEEDS REVISION

Hey, I don't know how useful this is going to be for you or if you even
want to merge it in but I figured I'd raise a request anyway. I've been
playing around with wine settings and figured that just using Lutris on
linux is the most hassle-free way to start the game. By outputting just
the authentication args and with a simple bash script, I'm able to start
the game with lutris seamlessly when running a Sapphire server, which is
kind of nice.

Let me know what you think and no worries if you think this is a bit too
'dev-ish' for this type of project.

Toofy (1):
  Adding a new checkbox that will output the authentication arguments
    and not boot the game. This allows manual execution of FFXIV process
    if desired

 launcher/core/include/launchercore.h      |  1 +
 launcher/core/src/launchercore.cpp        | 10 +++++++++-
 launcher/desktop/include/settingswindow.h |  1 +
 launcher/desktop/src/settingswindow.cpp   | 10 ++++++++++
 4 files changed, 21 insertions(+), 1 deletion(-)

-- 
2.34.5
I actually like this idea (because I happen to do this all the time), but I'm 
not sure if using a checkbox to do this is the right way. I think it would be 
better to add it to the menubar or some other kind of button (and then it 
could apply to any profile), and have it either use a message box or
point to some kind of file the user can open later. It's pretty odd to have a 
GUI checkbox that only outputs to stdout.
test (sorry!!)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~redstrate/public-inbox/patches/38351/mbox | git am -3
Learn more about email & git

[PATCH astra 1/1] Adding a new checkbox that will output the authentication arguments and not boot the game. This allows manual execution of FFXIV process if desired Export this patch

From: Toofy <mostafa.alsari@gmail.com>

---
 launcher/core/include/launchercore.h      |  1 +
 launcher/core/src/launchercore.cpp        | 10 +++++++++-
 launcher/desktop/include/settingswindow.h |  1 +
 launcher/desktop/src/settingswindow.cpp   | 10 ++++++++++
 4 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/launcher/core/include/launchercore.h b/launcher/core/include/launchercore.h
index 5d78f6a..c68ea69 100755
--- a/launcher/core/include/launchercore.h
+++ b/launcher/core/include/launchercore.h
@@ -95,6 +95,7 @@ public:
    bool rememberOTPSecret = false;
    bool useOneTimePassword = false;
    bool autoLogin = false;
    bool exitOnAuthentication = false;

    GameLicense license = GameLicense::WindowsStandalone;
    bool isFreeTrial = false;
diff --git a/launcher/core/src/launchercore.cpp b/launcher/core/src/launchercore.cpp
index ff37152..7b0988b 100755
--- a/launcher/core/src/launchercore.cpp
+++ b/launcher/core/src/launchercore.cpp
@@ -16,6 +16,7 @@

#ifdef ENABLE_GAMEMODE
#include <gamemode_client.h>
    #include <iostream>
#endif

#include "assetupdater.h"
@@ -169,7 +170,12 @@ QString LauncherCore::getGameArgs(const ProfileSettings& profile, const LoginAut
        argJoined += argFormat.arg(arg.key, arg.value);
    }

    return profile.encryptArguments ? encryptGameArg(argJoined) : argJoined;
    QString args = profile.encryptArguments ? encryptGameArg(argJoined) : argJoined;
    if(profile.exitOnAuthentication) {
        std::cout << args.toStdString() << std::endl;
        exit(0);
    }
    return args;
}

void LauncherCore::launchExecutable(
@@ -376,6 +382,7 @@ void LauncherCore::readInitialInformation() {
        profile->license = (GameLicense)settings.value("license", (int)defaultSettings.license).toInt();
        profile->isFreeTrial = settings.value("isFreeTrial", defaultSettings.isFreeTrial).toBool();
        profile->autoLogin = settings.value("autoLogin", defaultSettings.autoLogin).toBool();
        profile->exitOnAuthentication = settings.value("exitOnAuthentication", defaultSettings.exitOnAuthentication).toBool();

        profile->useDX9 = settings.value("useDX9", defaultSettings.useDX9).toBool();

@@ -596,6 +603,7 @@ void LauncherCore::saveSettings() {
        settings.setValue("license", (int)profile->license);
        settings.setValue("isFreeTrial", profile->isFreeTrial);
        settings.setValue("autoLogin", profile->autoLogin);
        settings.setValue("exitOnAuthentication", profile->exitOnAuthentication);

        settings.setValue("enableDalamud", profile->dalamud.enabled);
        settings.setValue("dalamudOptOut", profile->dalamud.optOutOfMbCollection);
diff --git a/launcher/desktop/include/settingswindow.h b/launcher/desktop/include/settingswindow.h
index d0b9d50..08c8f87 100644
--- a/launcher/desktop/include/settingswindow.h
+++ b/launcher/desktop/include/settingswindow.h
@@ -66,6 +66,7 @@ private:
    QCheckBox* encryptArgumentsBox = nullptr;
    QComboBox* serverType = nullptr;
    QLineEdit* lobbyServerURL = nullptr;
    QCheckBox *exitOnAuthenticationBox = nullptr;
    QCheckBox *rememberUsernameBox = nullptr, *rememberPasswordBox = nullptr, *rememberOTPSecretBox = nullptr;
    QPushButton* otpSecretButton = nullptr;
    QComboBox* gameLicenseBox = nullptr;
diff --git a/launcher/desktop/src/settingswindow.cpp b/launcher/desktop/src/settingswindow.cpp
index b2addba..b6118f9 100644
--- a/launcher/desktop/src/settingswindow.cpp
+++ b/launcher/desktop/src/settingswindow.cpp
@@ -275,6 +275,7 @@ void SettingsWindow::reloadControls() {
        useOneTimePassword->setToolTip("");
    }
    autoLoginBox->setChecked(profile.autoLogin);
    exitOnAuthenticationBox->setChecked(profile.exitOnAuthentication);

    gameLicenseBox->setCurrentIndex((int)profile.license);
    gameLicenseBox->setEnabled(!profile.isSapphire);
@@ -472,6 +473,15 @@ void SettingsWindow::setupLoginTab(QFormLayout& layout) {
        this->window.reloadControls();
    });
    layout.addRow("Auto-Login", autoLoginBox);

    exitOnAuthenticationBox = new QCheckBox();
    connect(exitOnAuthenticationBox, &QCheckBox::stateChanged, [=](int) {
        getCurrentProfile().exitOnAuthentication = exitOnAuthenticationBox->isChecked();

        this->core.saveSettings();
    });
    exitOnAuthenticationBox->setToolTip("If this is enabled, the launcher will authenticate to the server but will NOT boot the game. This is only useful if you want the arguments in the console output and want to handle process execution yourself");
    layout.addRow("Exit on authentication (WARNING: game will NOT start)", exitOnAuthenticationBox);
}

void SettingsWindow::setupWineTab(QFormLayout& layout) {
-- 
2.34.5
I actually like this idea (because I happen to do this all the time), but I'm 
not sure if using a checkbox to do this is the right way. I think it would be 
better to add it to the menubar or some other kind of button (and then it 
could apply to any profile), and have it either use a message box or
point to some kind of file the user can open later. It's pretty odd to have a 
GUI checkbox that only outputs to stdout.