From 481fb8214f64548d6d858fdaee009755638e1ac1 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Wed, 20 Sep 2023 16:28:59 -0400 Subject: [PATCH] Make Dalamud inject method/delay settings work, remove opt out setting The automatic marketboard setting seems to have disappeared recently. --- launcher/include/profile.h | 18 +++++++--- launcher/profileconfig.kcfg | 15 +++++++-- launcher/src/launchercore.cpp | 3 +- launcher/src/profile.cpp | 42 ++++++++++++++++-------- launcher/ui/Settings/ProfileSettings.qml | 18 +++------- 5 files changed, 59 insertions(+), 37 deletions(-) diff --git a/launcher/include/profile.h b/launcher/include/profile.h index 9fdd75e..46d72c0 100644 --- a/launcher/include/profile.h +++ b/launcher/include/profile.h @@ -33,7 +33,8 @@ class Profile : public QObject Q_PROPERTY(int gamescopeHeight READ gamescopeHeight WRITE setGamescopeHeight NOTIFY gamescopeHeightChanged) Q_PROPERTY(int gamescopeRefreshRate READ gamescopeRefreshRate WRITE setGamescopeRefreshRate NOTIFY gamescopeRefreshRateChanged) Q_PROPERTY(bool dalamudEnabled READ dalamudEnabled WRITE setDalamudEnabled NOTIFY dalamudEnabledChanged) - Q_PROPERTY(bool dalamudOptOut READ dalamudOptOut WRITE setDalamudOptOut NOTIFY dalamudOptOutChanged) + Q_PROPERTY(DalamudInjectMethod dalamudInjectMethod READ dalamudInjectMethod WRITE setDalamudInjectMethod NOTIFY dalamudInjectMethodChanged) + Q_PROPERTY(int dalamudInjectDelay READ dalamudInjectDelay WRITE setDalamudInjectDelay NOTIFY dalamudInjectDelayChanged) Q_PROPERTY(DalamudChannel dalamudChannel READ dalamudChannel WRITE setDalamudChannel NOTIFY dalamudChannelChanged) Q_PROPERTY(bool argumentsEncrypted READ argumentsEncrypted WRITE setArgumentsEncrypted NOTIFY encryptedArgumentsChanged) Q_PROPERTY(bool isGameInstalled READ isGameInstalled NOTIFY gameInstallChanged) @@ -57,6 +58,9 @@ public: enum class DalamudChannel { Stable, Staging, Net5 }; Q_ENUM(DalamudChannel) + enum class DalamudInjectMethod { Entrypoint, DLLInject }; + Q_ENUM(DalamudInjectMethod) + [[nodiscard]] QString uuid() const; [[nodiscard]] QString name() const; @@ -107,12 +111,15 @@ public: [[nodiscard]] bool dalamudEnabled() const; void setDalamudEnabled(bool value); - [[nodiscard]] bool dalamudOptOut() const; - void setDalamudOptOut(bool value); - [[nodiscard]] DalamudChannel dalamudChannel() const; void setDalamudChannel(DalamudChannel channel); + [[nodiscard]] DalamudInjectMethod dalamudInjectMethod() const; + void setDalamudInjectMethod(DalamudInjectMethod value); + + [[nodiscard]] int dalamudInjectDelay() const; + void setDalamudInjectDelay(int value); + [[nodiscard]] bool argumentsEncrypted() const; void setArgumentsEncrypted(bool value); @@ -170,8 +177,9 @@ Q_SIGNALS: void gamescopeHeightChanged(); void gamescopeRefreshRateChanged(); void dalamudEnabledChanged(); - void dalamudOptOutChanged(); void dalamudChannelChanged(); + void dalamudInjectMethodChanged(); + void dalamudInjectDelayChanged(); void encryptedArgumentsChanged(); void accountChanged(); void wineChanged(); diff --git a/launcher/profileconfig.kcfg b/launcher/profileconfig.kcfg index 1c11659..32355d5 100644 --- a/launcher/profileconfig.kcfg +++ b/launcher/profileconfig.kcfg @@ -69,9 +69,6 @@ SPDX-License-Identifier: CC0-1.0 false - - false - @@ -83,6 +80,18 @@ SPDX-License-Identifier: CC0-1.0 Stable + + + + + + + + Entrypoint + + + 0 + true diff --git a/launcher/src/launchercore.cpp b/launcher/src/launchercore.cpp index 49353d9..d4894f1 100755 --- a/launcher/src/launchercore.cpp +++ b/launcher/src/launchercore.cpp @@ -177,12 +177,13 @@ void LauncherCore::beginDalamudGame(const QString &gameExecutablePath, Profile & {Utility::toWindowsPath(dalamudInjector), QStringLiteral("launch"), QStringLiteral("-m"), - QStringLiteral("inject"), + profile.dalamudInjectMethod() == Profile::DalamudInjectMethod::Entrypoint ? QStringLiteral("entrypoint") : QStringLiteral("inject"), QStringLiteral("--game=") + Utility::toWindowsPath(gameExecutablePath), QStringLiteral("--dalamud-configuration-path=") + Utility::toWindowsPath(dalamudConfigPath), QStringLiteral("--dalamud-plugin-directory=") + Utility::toWindowsPath(dalamudPluginDir), QStringLiteral("--dalamud-asset-directory=") + Utility::toWindowsPath(dalamudAssetDir), QStringLiteral("--dalamud-client-language=") + QString::number(profile.account()->language()), + QStringLiteral("--dalamud-delay-initialize=") + QString::number(profile.dalamudInjectDelay()), QStringLiteral("--logpath=") + Utility::toWindowsPath(logDir), QStringLiteral("--"), args}, diff --git a/launcher/src/profile.cpp b/launcher/src/profile.cpp index c6c2ab3..b18b5b2 100644 --- a/launcher/src/profile.cpp +++ b/launcher/src/profile.cpp @@ -351,20 +351,6 @@ void Profile::setDalamudEnabled(const bool value) } } -bool Profile::dalamudOptOut() const -{ - return m_config->dalamudOptOut(); -} - -void Profile::setDalamudOptOut(const bool value) -{ - if (m_config->dalamudOptOut() != value) { - m_config->setDalamudOptOut(value); - m_config->save(); - Q_EMIT dalamudOptOutChanged(); - } -} - Profile::DalamudChannel Profile::dalamudChannel() const { return static_cast(m_config->dalamudChannel()); @@ -379,6 +365,34 @@ void Profile::setDalamudChannel(const DalamudChannel value) } } +Profile::DalamudInjectMethod Profile::dalamudInjectMethod() const +{ + return static_cast(m_config->dalamudInjectMethod()); +} + +void Profile::setDalamudInjectMethod(const Profile::DalamudInjectMethod value) +{ + if (static_cast(m_config->dalamudInjectMethod()) != value) { + m_config->setDalamudInjectMethod(static_cast(value)); + m_config->save(); + Q_EMIT dalamudInjectMethodChanged(); + } +} + +int Profile::dalamudInjectDelay() const +{ + return m_config->dalamudInjectDelay(); +} + +void Profile::setDalamudInjectDelay(const int value) +{ + if (m_config->dalamudInjectDelay() != value) { + m_config->setDalamudInjectDelay(static_cast(value)); + m_config->save(); + Q_EMIT dalamudInjectDelayChanged(); + } +} + bool Profile::argumentsEncrypted() const { return m_config->encryptArguments(); diff --git a/launcher/ui/Settings/ProfileSettings.qml b/launcher/ui/Settings/ProfileSettings.qml index bc1fb03..570c2ff 100644 --- a/launcher/ui/Settings/ProfileSettings.qml +++ b/launcher/ui/Settings/ProfileSettings.qml @@ -286,6 +286,8 @@ FormCard.FormCardPage { text: i18n("Injection Method") description: "It shouldn't be nessecary to change this setting, unless you're running into issues injecting Dalamud." model: ["Entrypoint", "DLL Injection"] + currentIndex: page.profile.dalamudInjectMethod + onCurrentIndexChanged: page.profile.dalamudInjectMethod = currentIndex enabled: page.profile.dalamudEnabled } @@ -298,25 +300,13 @@ FormCard.FormCardPage { id: dalamudDelayDelegate label: i18n("Injection Delay") + value: page.profile.dalamudInjectDelay + onValueChanged: page.profile.dalamudInjectDelay = value enabled: page.profile.dalamudEnabled } FormCard.FormDelegateSeparator { above: dalamudDelayDelegate - below: dalamudOptOutDelegate - } - - FormCard.FormCheckDelegate { - id: dalamudOptOutDelegate - - text: i18n("Opt Out of Automatic Marketboard Collection") - checked: page.profile.dalamudOptOut - onCheckedChanged: page.profile.dalamudOptOut = checked - enabled: page.profile.dalamudEnabled - } - - FormCard.FormDelegateSeparator { - above: dalamudOptOutDelegate } FormCard.FormTextDelegate {