From ef953221a067001cd7f5ff67362143ebd50c4167 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 23 Dec 2023 11:11:02 -0500 Subject: [PATCH] Set Windows version in wine prefix to Windows 7 --- launcher/include/gamerunner.h | 4 +++- launcher/src/gamerunner.cpp | 22 +++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/launcher/include/gamerunner.h b/launcher/include/gamerunner.h index cc38edb..79da8dc 100644 --- a/launcher/include/gamerunner.h +++ b/launcher/include/gamerunner.h @@ -36,7 +36,9 @@ private: /// \param key The path to the registry key, such as HKEY_CURRENT_USER\\Software\\Wine /// \param value The registry key name, like "HideWineExports" /// \param data What to set the value as, like "1" or "0" - void addRegistryKey(const Profile &settings, QString key, QString value, QString data); + void addRegistryKey(const Profile &settings, const QString &key, const QString &value, const QString &data); + + void setWindowsVersion(const Profile &settings, const QString &version); LauncherCore &m_launcher; }; \ No newline at end of file diff --git a/launcher/src/gamerunner.cpp b/launcher/src/gamerunner.cpp index e460ab7..b359622 100644 --- a/launcher/src/gamerunner.cpp +++ b/launcher/src/gamerunner.cpp @@ -175,6 +175,8 @@ void GameRunner::launchExecutable(const Profile &profile, QProcess *process, con const int value = profile.account()->license() == Account::GameLicense::macOS ? 0 : 1; addRegistryKey(profile, QStringLiteral("HKEY_CURRENT_USER\\Software\\Wine"), QStringLiteral("HideWineExports"), QString::number(value)); + setWindowsVersion(profile, QStringLiteral("win7")); + // copy DXVK const QDir dataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); const QDir compatibilityToolDir = dataDir.absoluteFilePath(QStringLiteral("tool")); @@ -257,23 +259,25 @@ void GameRunner::launchExecutable(const Profile &profile, QProcess *process, con process->setProcessEnvironment(env); + qInfo() << executable << arguments; + process->start(executable, arguments); } -void GameRunner::addRegistryKey(const Profile &settings, QString key, QString value, QString data) +void GameRunner::addRegistryKey(const Profile &settings, const QString &key, const QString &value, const QString &data) { auto process = new QProcess(this); process->setProcessEnvironment(QProcessEnvironment::systemEnvironment()); launchExecutable(settings, process, - {QStringLiteral("reg"), - QStringLiteral("add"), - std::move(key), - QStringLiteral("/v"), - std::move(value), - QStringLiteral("/d"), - std::move(data), - QStringLiteral("/f")}, + {QStringLiteral("reg"), QStringLiteral("add"), key, QStringLiteral("/v"), value, QStringLiteral("/d"), data, QStringLiteral("/f")}, false, false); +} + +void GameRunner::setWindowsVersion(const Profile &settings, const QString &version) +{ + auto process = new QProcess(this); + process->setProcessEnvironment(QProcessEnvironment::systemEnvironment()); + launchExecutable(settings, process, {QStringLiteral("winecfg"), QStringLiteral("/v"), version}, false, false); } \ No newline at end of file