mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-20 11:47:46 +00:00
Automatically set HideWineExports depending on game license
Square Enix detects your platform as "macOS" when it detects Wine DLL exports (only on the 64-bit launcher apparently), so if you have a Windows license selected Astra will automatically add the relevant registry key for you now. If you still want to take advantage of your macOS license, you'll still be able to play by selecting "macOS" as your license in your settings.
This commit is contained in:
parent
e5ebac764a
commit
a2f73779be
3 changed files with 28 additions and 7 deletions
|
@ -137,13 +137,15 @@ public:
|
|||
/*
|
||||
* This just wraps it in wine if needed.
|
||||
*/
|
||||
void launchExecutable(const ProfileSettings& settings, QProcess* process, QStringList args, bool isGame);
|
||||
void launchExecutable(const ProfileSettings& settings, QProcess* process, QStringList args, bool isGame, bool needsRegistrySetup);
|
||||
|
||||
/*
|
||||
* Launches an external tool. Gamescope for example is intentionally excluded.
|
||||
*/
|
||||
void launchExternalTool(const ProfileSettings& settings, QStringList args);
|
||||
|
||||
void addRegistryKey(const ProfileSettings& settings, QString key, QString value, QString data);
|
||||
|
||||
void buildRequest(const ProfileSettings& settings, QNetworkRequest& request);
|
||||
void setSSL(QNetworkRequest& request);
|
||||
QString readVersion(QString path);
|
||||
|
|
|
@ -170,7 +170,7 @@ void LauncherCore::launchGame(const ProfileSettings& profile, const LoginAuth au
|
|||
|
||||
auto list = dalamudProcess->processEnvironment().toStringList();
|
||||
|
||||
launchExecutable(profile, dalamudProcess, {dataDir + "/Dalamud/" + "Dalamud.Injector.exe", QString::number(exitCode), argsEncoded}, false);
|
||||
launchExecutable(profile, dalamudProcess, {dataDir + "/Dalamud/" + "Dalamud.Injector.exe", QString::number(exitCode), argsEncoded}, false, true);
|
||||
|
||||
connection->close();
|
||||
socket->close();
|
||||
|
@ -189,13 +189,13 @@ void LauncherCore::launchGame(const ProfileSettings& profile, const LoginAuth au
|
|||
void LauncherCore::launchExecutable(const ProfileSettings& profile, const QStringList args) {
|
||||
auto process = new QProcess(this);
|
||||
process->setProcessEnvironment(QProcessEnvironment::systemEnvironment());
|
||||
launchExecutable(profile, process, args, true);
|
||||
launchExecutable(profile, process, args, true, true);
|
||||
}
|
||||
|
||||
void LauncherCore::launchExternalTool(const ProfileSettings& profile, const QStringList args) {
|
||||
auto process = new QProcess(this);
|
||||
process->setProcessEnvironment(QProcessEnvironment::systemEnvironment());
|
||||
launchExecutable(profile, process, args, false);
|
||||
launchExecutable(profile, process, args, false, true);
|
||||
}
|
||||
|
||||
void LauncherCore::launchGameExecutable(const ProfileSettings& profile, QProcess* process, const QStringList args) {
|
||||
|
@ -203,13 +203,25 @@ void LauncherCore::launchGameExecutable(const ProfileSettings& profile, QProcess
|
|||
|
||||
arguments.append(args);
|
||||
|
||||
launchExecutable(profile, process, arguments, true);
|
||||
launchExecutable(profile, process, arguments, true, true);
|
||||
}
|
||||
|
||||
void LauncherCore::launchExecutable(const ProfileSettings& profile, QProcess* process, const QStringList args, bool isGame) {
|
||||
void LauncherCore::launchExecutable(const ProfileSettings& profile, QProcess* process, const QStringList args, bool isGame, bool needsRegistrySetup) {
|
||||
QList<QString> arguments;
|
||||
auto env = process->processEnvironment();
|
||||
|
||||
if(needsRegistrySetup) {
|
||||
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
||||
if(profile.license == GameLicense::macOS) {
|
||||
addRegistryKey(profile, "HKEY_CURRENT_USER\\Software\\Wine", "HideWineExports", "0");
|
||||
} else {
|
||||
addRegistryKey(profile, "HKEY_CURRENT_USER\\Software\\Wine", "HideWineExports", "1");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
process->setProcessChannelMode(QProcess::ForwardedChannels);
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
if (isGame) {
|
||||
if (profile.useGamescope) {
|
||||
|
@ -674,3 +686,10 @@ QString LauncherCore::getDefaultGamePath() {
|
|||
return QDir::homePath() + "/.wine/drive_c/Program Files (x86)/SquareEnix/FINAL FANTASY XIV - A Realm Reborn";
|
||||
#endif
|
||||
}
|
||||
|
||||
void LauncherCore::addRegistryKey(const ProfileSettings& settings,
|
||||
QString key, QString value, QString data) {
|
||||
auto process = new QProcess(this);
|
||||
process->setProcessEnvironment(QProcessEnvironment::systemEnvironment());
|
||||
launchExecutable(settings, process, {"reg", "add", key, "/v", value, "/d", data, "/f" }, false, false);
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo
|
|||
wineCfg->setMenuRole(QAction::MenuRole::NoRole);
|
||||
wineCfg->setIcon(QIcon::fromTheme("configure"));
|
||||
connect(wineCfg, &QAction::triggered, [=] {
|
||||
this->core.launchExternalTool(currentProfile(), {"winecfg.exe"});
|
||||
this->core.launchExternalTool(currentProfile(), {"regedit.exe"});
|
||||
});
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue