1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 11:47:46 +00:00

Add a dedicated game license profile setting

This replaces the old "Is Steam Account" option, and condensing
it into one that can handle Windows/macOS licenses too.
This commit is contained in:
Joshua Goins 2022-03-16 09:59:27 -04:00
parent d588bfcb6c
commit fb65e7e6e9
5 changed files with 30 additions and 15 deletions

View file

@ -14,6 +14,12 @@ class SquareBoot;
class AssetUpdater;
class Watchdog;
enum class GameLicense {
WindowsStandalone,
WindowsSteam,
macOS
};
struct ProfileSettings {
QUuid uuid;
QString name;
@ -56,7 +62,8 @@ struct ProfileSettings {
bool isSapphire = false;
QString lobbyURL;
bool rememberUsername = false, rememberPassword = false;
bool useSteam = false;
GameLicense license = GameLicense::WindowsStandalone;
};
struct AppSettings {

View file

@ -49,7 +49,7 @@ private:
QComboBox* serverType = nullptr;
QLineEdit* lobbyServerURL = nullptr;
QCheckBox* rememberUsernameBox = nullptr, *rememberPasswordBox = nullptr;
QCheckBox* useSteamBox = nullptr;
QComboBox* gameLicenseBox = nullptr;
// dalamud
QCheckBox* enableDalamudBox = nullptr;

View file

@ -101,7 +101,7 @@ void LauncherCore::launchGame(const ProfileSettings& profile, const LoginAuth au
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
if(profile.useSteam) {
if(profile.license == GameLicense::WindowsSteam) {
gameArgs.push_back({"IsSteam", "1"});
env.insert("IS_FFXIV_LAUNCH_FROM_STEAM", QString::number(1));
}
@ -337,7 +337,7 @@ void LauncherCore::readInitialInformation() {
profile.lobbyURL = settings.value("lobbyURL", defaultSettings.lobbyURL).toString();
profile.rememberUsername = settings.value("rememberUsername", defaultSettings.rememberUsername).toBool();
profile.rememberPassword = settings.value("rememberPassword", defaultSettings.rememberPassword).toBool();
profile.useSteam = settings.value("useSteam", defaultSettings.useSteam).toBool();
profile.license = (GameLicense)settings.value("license", (int)defaultSettings.license).toInt();
profile.useDX9 = settings.value("useDX9", defaultSettings.useDX9).toBool();
profile.useEsync = settings.value("useEsync", defaultSettings.useEsync).toBool();
@ -543,7 +543,7 @@ void LauncherCore::saveSettings() {
settings.setValue("lobbyURL", profile.lobbyURL);
settings.setValue("rememberUsername", profile.rememberUsername);
settings.setValue("rememberPassword", profile.rememberPassword);
settings.setValue("useSteam", profile.useSteam);
settings.setValue("license", (int)profile.license);
settings.setValue("enableDalamud", profile.dalamud.enabled);
settings.setValue("dalamudOptOut", profile.dalamud.optOutOfMbCollection);

View file

@ -177,6 +177,22 @@ SettingsWindow::SettingsWindow(int defaultTab, LauncherWindow& window, LauncherC
loginBoxLayout->addRow("Server Lobby", serverType);
gameLicenseBox = new QComboBox();
gameLicenseBox->insertItem(0, "Windows Standalone");
gameLicenseBox->insertItem(1, "Windows Steam");
gameLicenseBox->insertItem(2, "macOS");
connect(gameLicenseBox,
static_cast<void (QComboBox::*)(int)>(
&QComboBox::currentIndexChanged),
[=](int index) {
getCurrentProfile().license = (GameLicense)index;
this->core.saveSettings();
});
loginBoxLayout->addRow("Game License", gameLicenseBox);
lobbyServerURL = new QLineEdit();
connect(lobbyServerURL, &QLineEdit::editingFinished, [=] {
getCurrentProfile().lobbyURL = lobbyServerURL->text();
@ -202,14 +218,6 @@ SettingsWindow::SettingsWindow(int defaultTab, LauncherWindow& window, LauncherC
});
loginBoxLayout->addRow("Remember Password", rememberPasswordBox);
useSteamBox = new QCheckBox();
connect(useSteamBox, &QCheckBox::stateChanged, [=](int) {
getCurrentProfile().useSteam = useSteamBox->isChecked();
this->core.saveSettings();
});
loginBoxLayout->addRow("Is Steam Account", useSteamBox);
#if defined(Q_OS_MAC) || defined(Q_OS_LINUX)
auto wineBox = new QGroupBox("Wine Options");
auto wineBoxLayout = new QFormLayout();
@ -481,7 +489,7 @@ void SettingsWindow::reloadControls() {
lobbyServerURL->setText(profile.lobbyURL);
rememberUsernameBox->setChecked(profile.rememberUsername);
rememberPasswordBox->setChecked(profile.rememberPassword);
useSteamBox->setChecked(profile.useSteam);
gameLicenseBox->setCurrentIndex((int)profile.license);
// dalamud
enableDalamudBox->setChecked(profile.dalamud.enabled);

View file

@ -36,7 +36,7 @@ void SquareLauncher::getStored(const LoginInformation& info) {
query.addQueryItem("isft", "0");
query.addQueryItem("cssmode", "1");
query.addQueryItem("isnew", "1");
query.addQueryItem("issteam", info.settings->useSteam ? "1" : "0");
query.addQueryItem("issteam", info.settings->license == GameLicense::WindowsSteam ? "1" : "0");
QUrl url("https://ffxiv-login.square-enix.com/oauth/ffxivarr/login/top");
url.setQuery(query);