summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-10-02 21:53:58 +0000
committerGitHub <noreply@github.com>2024-10-02 21:53:58 +0000
commit8445296e453aad19781c955e612435c2da3e91cb (patch)
tree9c2ddc4a2a784d5fae9b87ee000d33ac4919a4a9
parent04bed1c5dd5bf658edff5cf18d9c5aef3f2af1d1 (diff)
parent4dd97af0f139f3ddc8f34a24ee961a1046015d3f (diff)
Merge pull request #1932 from Priton-CE/wine-extended-proton
-rw-r--r--proto-wine/ftnoir_protocol_wine.cpp100
-rw-r--r--proto-wine/ftnoir_protocol_wine.h14
-rw-r--r--proto-wine/ftnoir_protocol_wine_dialog.cpp144
-rw-r--r--proto-wine/ftnoir_winecontrols.ui305
-rw-r--r--proto-wine/lang/de_DE.ts40
-rw-r--r--proto-wine/lang/nl_NL.ts44
-rw-r--r--proto-wine/lang/ru_RU.ts44
-rw-r--r--proto-wine/lang/stub.ts44
-rw-r--r--proto-wine/lang/zh_CN.ts44
-rw-r--r--proto-wine/proton.cpp31
-rw-r--r--proto-wine/proton.h7
11 files changed, 581 insertions, 236 deletions
diff --git a/proto-wine/ftnoir_protocol_wine.cpp b/proto-wine/ftnoir_protocol_wine.cpp
index b70b3f16..bae02b06 100644
--- a/proto-wine/ftnoir_protocol_wine.cpp
+++ b/proto-wine/ftnoir_protocol_wine.cpp
@@ -1,8 +1,8 @@
#include "ftnoir_protocol_wine.h"
+#include <qprocess.h>
#ifndef OTR_WINE_NO_WRAPPER
# include "csv/csv.h"
#endif
-#include "compat/library-path.hpp"
#include <cstring>
#include <cmath>
@@ -10,6 +10,8 @@
#include <QString>
#include <QDebug>
+#include "proton.h"
+
wine::wine() = default;
wine::~wine()
@@ -63,50 +65,91 @@ module_status wine::initialize()
#ifndef OTR_WINE_NO_WRAPPER
static const QString library_path(OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH);
+ /////////////////////////
+ // determine wine path //
+ /////////////////////////
QString wine_path = "wine";
- if (s.wine_select_path().toString() != "WINE") {
- // if we are not supposed to use system wine then:
- if (s.wine_select_path().toString() != "CUSTOM") {
- // if we don't have a custom path then change the wine_path to the path corresponding to the selected version
- wine_path = s.wine_select_path().toString();
- }
- else if (!s.wine_custom_path->isEmpty()) {
- // if we do have a custom path and it is not empty then
- wine_path = s.wine_custom_path;
+
+ if (s.variant_wine) {
+ // NORMAL WINE
+
+ // resolve combo box
+ if (s.wine_select_path().toString() != "WINE") {
+ // if we are not supposed to use system wine then:
+ if (s.wine_select_path().toString() != "CUSTOM") {
+ // if we don't have a custom path then change the wine_path to the path corresponding to the selected version
+ wine_path = s.wine_select_path().toString();
+ }
+ else if (!s.wine_custom_path->isEmpty()) {
+ // if we do have a custom path and it is not empty then
+ wine_path = s.wine_custom_path;
+ }
}
+
+ // parse tilde if present
+ if (wine_path[0] == '~')
+ wine_path = qgetenv("HOME") + wine_path.mid(1);
}
- if (wine_path[0] == '~')
- wine_path = qgetenv("HOME") + wine_path.mid(1);
+ else if (s.variant_proton)
+ {
+ // PROTON
+ wine_path = s.proton_path().toString() + "/bin/wine";
+ }
qDebug() << "proto/wine: wine_path:" << wine_path;
- auto env = QProcessEnvironment::systemEnvironment();
+ /////////////////////////////////////
+ // determine environment variables //
+ /////////////////////////////////////
+ QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
+
+ // if proton is used setup proton environment
if (s.variant_proton)
{
- if (s.proton_appid == 0)
- return error(tr("Must specify application id for Proton (Steam Play)"));
+ auto [proton_env, env_error_string, env_success] = make_steam_environ(s.proton_path().toString());
+ env = proton_env;
- std::tuple<QProcessEnvironment, QString, bool> make_steam_environ(const QString& proton_dist_path, int appid);
- QString proton_path(const QString& proton_dist_path);
+ if (!env_success)
+ return error(env_error_string);
+ }
- QString proton_dist_path = s.proton_path().toString();
+ // determine wineprefix
+ if (s.variant_proton && s.variant_proton_steamplay) {
+ // wine prefix is dependend on steam
- wine_path = proton_path(proton_dist_path);
- auto [proton_env, error_string, success] = make_steam_environ(proton_dist_path, s.proton_appid);
- env = proton_env;
+ if (s.proton_appid == 0)
+ return error(tr("Must specify application id for Proton (Steam Play)"));
+
+ auto [prefix, error_string, success] = make_wineprefix(s.proton_appid);
+ qDebug() << "proto/wine: wineprefix:" << prefix;
+ env.insert("WINEPREFIX", prefix);
if (!success)
return error(error_string);
}
- else
- {
- QString wineprefix = "~/.wine";
- if (!s.wineprefix->isEmpty())
+ else {
+ // wine prefix was supplied via path
+
+ QString wineprefix = "";
+
+ // check if prefix was supplied via wine
+ if (s.variant_wine && !s.wineprefix->isEmpty())
wineprefix = s.wineprefix;
+
+ // check if prefix was supplied via proton
+ if (s.variant_proton_external && !s.protonprefix->isEmpty())
+ wineprefix = s.protonprefix;
+
+ // check if the user specified a prefix anywhere
+ if (wineprefix.isEmpty())
+ return error(tr("Prefix has not been defined!").arg(wineprefix));
+
+ // handle tilde
if (wineprefix[0] == '~')
wineprefix = qgetenv("HOME") + wineprefix.mid(1);
+ // return error if relative path is given
if (wineprefix[0] != '/')
return error(tr("Wine prefix must be an absolute path (given '%1')").arg(wineprefix));
@@ -115,13 +158,20 @@ module_status wine::initialize()
env.insert("WINEPREFIX", wineprefix);
}
+ // ESYNC and FSYNC
if (s.esync)
env.insert("WINEESYNC", "1");
if (s.fsync)
env.insert("WINEFSYNC", "1");
+ // Headtracking Protocol
env.insert("OTR_WINE_PROTO", QString::number(s.protocol+1));
+
+ ////////////////////////////////
+ // launch the wrapper program //
+ ////////////////////////////////
+
wrapper.setProcessEnvironment(env);
wrapper.setWorkingDirectory(OPENTRACK_BASE_PATH);
wrapper.start(wine_path, { library_path + "opentrack-wrapper-wine.exe.so" });
diff --git a/proto-wine/ftnoir_protocol_wine.h b/proto-wine/ftnoir_protocol_wine.h
index f79f65dc..718699ac 100644
--- a/proto-wine/ftnoir_protocol_wine.h
+++ b/proto-wine/ftnoir_protocol_wine.h
@@ -19,8 +19,10 @@ using namespace options;
struct settings : opts
{
settings() : opts{"proto-wine"} {}
- value<bool> variant_proton{b, "variant-proton", false },
- variant_wine{b, "variant-wine", true },
+ value<bool> variant_wine{b, "variant-wine", true },
+ variant_proton{b, "variant-proton", false },
+ variant_proton_steamplay{b, "variant-proton-steamplay", true },
+ variant_proton_external{b, "variant-proton-external", false },
fsync{b, "fsync", true},
esync{b, "esync", true};
@@ -29,6 +31,7 @@ struct settings : opts
value<QVariant> wine_select_path{b, "wine-select-version", {"WINE"}};
value<QString> wine_custom_path{b, "wine-custom-version", ""};
value<QString> wineprefix{b, "wineprefix", "~/.wine/"};
+ value<QString> protonprefix{b, "protonprefix", ""};
value<int> protocol{b, "protocol", 2};
};
@@ -79,10 +82,13 @@ private:
settings s;
private slots:
- void onWinePathComboUpdated(QString selection);
+ void onWinePathComboUpdated();
+ void onRadioButtonsChanged();
void doBrowseWine();
- void doBrowsePrefix();
+ void doBrowseWinePrefix();
+
+ void doBrowseProtonPrefix();
void doOK();
void doCancel();
diff --git a/proto-wine/ftnoir_protocol_wine_dialog.cpp b/proto-wine/ftnoir_protocol_wine_dialog.cpp
index 23f82fda..2b7d08e0 100644
--- a/proto-wine/ftnoir_protocol_wine_dialog.cpp
+++ b/proto-wine/ftnoir_protocol_wine_dialog.cpp
@@ -3,10 +3,13 @@
#include <QFileDialog>
#include <QDir>
#include <QDirIterator>
+#include <qcombobox.h>
#include <qdebug.h>
#include <qdir.h>
+#include <qradiobutton.h>
#include "api/plugin-api.hpp"
+#include "options/tie.hpp"
/*
* 0: path to the directory with wine versions
@@ -18,17 +21,18 @@ static const char* wine_paths[][3] = {
{"/.var/app/net.lutris.Lutris/data/lutris/runners/wine/", "/bin/wine", "Flatpak Lutris"}
};
-static const char* proton_paths[] = {
- "/.steam/steam/steamapps/common",
- "/.steam/root/compatibilitytools.d",
- "/.local/share/Steam/steamapps/common",
+static const char* proton_paths[][2] = {
+ {"/.steam/steam/steamapps/common", "Proton*"},
+ {"/.steam/root/compatibilitytools.d", "*"},
+ {"/.local/share/Steam/steamapps/common", "Proton*"},
+ {"/.local/share/Steam/compatibilitytools.d", "*"},
};
FTControls::FTControls()
{
ui.setupUi(this);
- //populate wine select
+ // populate wine select
ui.wine_path_combo->addItem("System Wine", QVariant{"WINE"});
for (const char** path : wine_paths) {
QDir dir(QDir::homePath() + path[0]);
@@ -44,16 +48,19 @@ FTControls::FTControls()
}
ui.wine_path_combo->addItem("Custom path to Wine executable", QVariant{"CUSTOM"});
- //populate proton select
- for (const char* path : proton_paths) {
- QDir dir(QDir::homePath() + path);
- dir.setFilter(QDir::Dirs);
- dir.setNameFilters({ "Proton*" });
+ // populate proton select
+ for (const char** path : proton_paths) {
+ QDir dir(QDir::homePath() + path[0]);
+ dir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
+ dir.setNameFilters({ path[1] });
QFileInfoList proton_dir_list = dir.entryInfoList();
for (int i = 0; i < proton_dir_list.size(); ++i) {
const QFileInfo &proton_dir = proton_dir_list.at(i);
- qDebug() << proton_dir.canonicalFilePath();
+
+ // check if this Proton Version is already present in any way
+ if (ui.proton_version->findText(proton_dir.fileName()) != -1)
+ continue;
QDirIterator proton_executable_it(proton_dir.canonicalFilePath(), QStringList() << "wine", QDir::Files, QDirIterator::Subdirectories);
@@ -62,38 +69,53 @@ FTControls::FTControls()
QDir proton_dist_dir(proton_executable_path);
proton_dist_dir.cd("../../");
- qDebug() << proton_dist_dir.canonicalPath();
-
ui.proton_version->addItem(proton_dir.fileName(), QVariant{proton_dist_dir.canonicalPath()});
}
}
}
-
- tie_setting(s.proton_path, ui.proton_version);
- tie_setting(s.variant_wine, ui.variant_wine);
- tie_setting(s.variant_proton, ui.variant_proton);
+ // settings - wine
+ tie_setting(s.variant_wine, ui.variant_wine); // radio button
+ tie_setting(s.wine_select_path, ui.wine_path_combo); // combo box (dropdown)
+ tie_setting(s.wine_custom_path, ui.wine_path); // line edit (enabled via dropdown)
+ tie_setting(s.wineprefix, ui.wineprefix); // line edit
+
+ // settings - proton
+ tie_setting(s.variant_proton, ui.variant_proton); // radio button
+ tie_setting(s.proton_path, ui.proton_version); // combo box (dropdown)
+ tie_setting(s.variant_proton_steamplay, ui.subvariant_steamplay); // radio button
+ tie_setting(s.proton_appid, ui.proton_appid); // number select
+ tie_setting(s.variant_proton_external, ui.subvariant_external); // radio button
+ tie_setting(s.protonprefix, ui.protonprefix); // line edit
+
+ // settings - advanced
tie_setting(s.esync, ui.esync);
tie_setting(s.fsync, ui.fsync);
- tie_setting(s.proton_appid, ui.proton_appid);
- tie_setting(s.wine_select_path, ui.wine_path_combo);
- tie_setting(s.wine_custom_path, ui.wine_path);
- tie_setting(s.wineprefix, ui.wineprefix);
tie_setting(s.protocol, ui.protocol_selection);
+ // setup signals and slots for UI
connect(ui.wine_path_combo, &QComboBox::currentTextChanged, this, &FTControls::onWinePathComboUpdated);
connect(ui.browse_wine_path_button, &QPushButton::clicked, this, &FTControls::doBrowseWine);
- connect(ui.browse_wine_prefix_button, &QPushButton::clicked, this, &FTControls::doBrowsePrefix);
+ connect(ui.browse_wine_prefix_button, &QPushButton::clicked, this, &FTControls::doBrowseWinePrefix);
+ connect(ui.browse_proton_prefix_button, &QPushButton::clicked, this, &FTControls::doBrowseProtonPrefix);
connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &FTControls::doOK);
connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &FTControls::doCancel);
+ // setup signals and slots for UI radio buttons
+ connect(ui.variant_wine, &QRadioButton::clicked, this, &FTControls::onRadioButtonsChanged);
+ connect(ui.variant_proton, &QRadioButton::clicked, this, &FTControls::onRadioButtonsChanged);
+ connect(ui.subvariant_steamplay, &QRadioButton::clicked, this, &FTControls::onRadioButtonsChanged);
+ connect(ui.subvariant_external, &QRadioButton::clicked, this, &FTControls::onRadioButtonsChanged);
+
// update state of the combo box and associated ui elements
- onWinePathComboUpdated(ui.wine_path_combo->currentText());
+ onWinePathComboUpdated();
+ // hide the correct items
+ onRadioButtonsChanged();
}
-void FTControls::onWinePathComboUpdated(QString selection) {
+void FTControls::onWinePathComboUpdated() {
// enable the custom text field if required
- if (selection == "Custom path to Wine executable") {
+ if (ui.wine_path_combo->currentData() == "CUSTOM") {
ui.wine_path->setEnabled(true);
ui.browse_wine_path_button->setEnabled(true);
}
@@ -103,6 +125,63 @@ void FTControls::onWinePathComboUpdated(QString selection) {
}
}
+void FTControls::onRadioButtonsChanged() {
+ if (ui.variant_wine->isChecked()) {
+ // wine settings selected
+
+ // enable wine settings
+ ui.wine_path_combo->setEnabled(true);
+ ui.wineprefix->setEnabled(true);
+ ui.browse_wine_prefix_button->setEnabled(true);
+ if (ui.wine_path_combo->currentData() == "CUSTOM") {
+ ui.wine_path->setEnabled(true);
+ ui.browse_wine_path_button->setEnabled(true);
+ }
+
+ // disable proton settings
+ ui.proton_version->setEnabled(false);
+ ui.proton_subgroup->setEnabled(false);
+ }
+ else if (ui.variant_proton->isChecked()) {
+ // proton settings selected
+
+ // disable wine settings
+ ui.wine_path_combo->setEnabled(false);
+ ui.wine_path->setEnabled(false);
+ ui.browse_wine_path_button->setEnabled(false);
+ ui.wineprefix->setEnabled(false);
+ ui.browse_wine_prefix_button->setEnabled(false);
+
+ // enable proton settings
+ ui.proton_version->setEnabled(true);
+ ui.proton_subgroup->setEnabled(true);
+
+ // run proton radio buttons logic
+ if (ui.subvariant_steamplay->isChecked()) {
+ // enable steamplay settings
+ ui.proton_appid->setEnabled(true);
+
+ // disable external settings
+ ui.protonprefix->setEnabled(false);
+ ui.browse_proton_prefix_button->setEnabled(false);
+ }
+ else if (ui.subvariant_external->isChecked()) {
+ // disable steamplay settings
+ ui.proton_appid->setEnabled(false);
+
+ // enable external settinsg
+ ui.protonprefix->setEnabled(true);
+ ui.browse_proton_prefix_button->setEnabled(true);
+ }
+ }
+ else {
+ // for some reason QTs auto exclusive feature is not always correctly working
+ // this is a somewhat hacky solution
+ ui.variant_wine->setChecked(ui.wine_path_combo->isEnabled());
+ ui.variant_proton->setChecked(ui.proton_version->isEnabled());
+ }
+}
+
void FTControls::doBrowseWine() {
QFileDialog d(this);
d.setFileMode(QFileDialog::FileMode::ExistingFile);
@@ -114,7 +193,7 @@ void FTControls::doBrowseWine() {
s.wine_custom_path = d.selectedFiles()[0];
}
}
-void FTControls::doBrowsePrefix() {
+void FTControls::doBrowseWinePrefix() {
QFileDialog d(this);
d.setFileMode(QFileDialog::FileMode::Directory);
d.setOption(QFileDialog::Option::ShowDirsOnly, true);
@@ -127,6 +206,19 @@ void FTControls::doBrowsePrefix() {
}
}
+void FTControls::doBrowseProtonPrefix() {
+ QFileDialog d(this);
+ d.setFileMode(QFileDialog::FileMode::Directory);
+ d.setOption(QFileDialog::Option::ShowDirsOnly, true);
+ d.setWindowTitle(tr("Select Proton Prefix"));
+ if (s.protonprefix->startsWith("/") || s.protonprefix->startsWith("~")) {
+ d.selectFile(s.protonprefix);
+ }
+ if (d.exec()) {
+ s.protonprefix = d.selectedFiles()[0];
+ }
+}
+
void FTControls::doOK()
{
s.b->save();
diff --git a/proto-wine/ftnoir_winecontrols.ui b/proto-wine/ftnoir_winecontrols.ui
index 365922ca..b601d6e5 100644
--- a/proto-wine/ftnoir_winecontrols.ui
+++ b/proto-wine/ftnoir_winecontrols.ui
@@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>951</width>
- <height>424</height>
+ <width>934</width>
+ <height>466</height>
</rect>
</property>
<property name="windowTitle">
@@ -32,86 +32,8 @@
<property name="title">
<string>Wine variant</string>
</property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="10" column="0">
- <widget class="QRadioButton" name="variant_proton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Proton (Steam Play)</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QRadioButton" name="variant_wine">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Wine (select path and prefix)</string>
- </property>
- </widget>
- </item>
- <item row="10" column="1">
- <widget class="QComboBox" name="proton_version">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>120</width>
- <height>0</height>
- </size>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- </widget>
- </item>
- <item row="9" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <item>
- <widget class="QLineEdit" name="wineprefix">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>450</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;prefix&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="placeholderText">
- <string>/path_to_the_prefix/</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="browse_wine_prefix_button">
- <property name="text">
- <string>Browse Prefix</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="8" column="1">
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="wine_path">
@@ -146,6 +68,12 @@
<property name="enabled">
<bool>false</bool>
</property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="text">
<string>Browse Wine Path</string>
</property>
@@ -153,8 +81,175 @@
</item>
</layout>
</item>
+ <item row="2" column="1">
+ <layout class="QVBoxLayout" name="verticalLayout_7">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QLineEdit" name="wineprefix">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>450</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;prefix&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="placeholderText">
+ <string>/path_to_the_prefix/</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="browse_wine_prefix_button">
+ <property name="text">
+ <string>Browse Prefix</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item row="3" column="1">
+ <widget class="QComboBox" name="proton_version">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QRadioButton" name="variant_proton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Proton (select version and mode)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QRadioButton" name="variant_wine">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Wine (select version and prefix)</string>
+ </property>
+ </widget>
+ </item>
<item row="0" column="1">
- <widget class="QComboBox" name="wine_path_combo"/>
+ <widget class="QComboBox" name="wine_path_combo">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" colspan="2">
+ <widget class="QGroupBox" name="proton_subgroup">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="1">
+ <widget class="QSpinBox" name="proton_appid">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximum">
+ <number>2147483647</number>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QRadioButton" name="subvariant_steamplay">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Steam Play is Steams System to run Windows titles on Linux via Proton.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="text">
+ <string>Steam Play (select Steam Application ID)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QRadioButton" name="subvariant_external">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;UMU is a launcher that allows the use of Proton outside of Steam. Some game launchers like Lutris may use this to enable Proton support.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="text">
+ <string>UMU enabled Launchers (select prefix)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_7">
+ <item>
+ <widget class="QLineEdit" name="protonprefix">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>450</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="browse_proton_prefix_button">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>105</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Browse Prefix</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
</item>
</layout>
</widget>
@@ -271,32 +366,6 @@
<property name="bottomMargin">
<number>0</number>
</property>
- <item>
- <widget class="QLabel" name="label">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Steam application id</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="proton_appid">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximum">
- <number>2147483647</number>
- </property>
- </widget>
- </item>
</layout>
</widget>
</item>
@@ -318,6 +387,24 @@
</item>
</layout>
</widget>
+ <tabstops>
+ <tabstop>variant_wine</tabstop>
+ <tabstop>wine_path_combo</tabstop>
+ <tabstop>wine_path</tabstop>
+ <tabstop>browse_wine_path_button</tabstop>
+ <tabstop>wineprefix</tabstop>
+ <tabstop>browse_wine_prefix_button</tabstop>
+ <tabstop>variant_proton</tabstop>
+ <tabstop>proton_version</tabstop>
+ <tabstop>subvariant_steamplay</tabstop>
+ <tabstop>proton_appid</tabstop>
+ <tabstop>subvariant_external</tabstop>
+ <tabstop>protonprefix</tabstop>
+ <tabstop>browse_proton_prefix_button</tabstop>
+ <tabstop>esync</tabstop>
+ <tabstop>fsync</tabstop>
+ <tabstop>protocol_selection</tabstop>
+ </tabstops>
<resources>
<include location="wine-protocol.qrc"/>
</resources>
diff --git a/proto-wine/lang/de_DE.ts b/proto-wine/lang/de_DE.ts
index 9169570f..072c8626 100644
--- a/proto-wine/lang/de_DE.ts
+++ b/proto-wine/lang/de_DE.ts
@@ -11,6 +11,10 @@
<source>Select Wine Prefix</source>
<translation>wine-Prefix auswählen</translation>
</message>
+ <message>
+ <source>Select Proton Prefix</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>UICFTControls</name>
@@ -23,14 +27,6 @@
<translation>Wine-Variante</translation>
</message>
<message>
- <source>Proton (Steam Play)</source>
- <translation>Proton (Steam Play)</translation>
- </message>
- <message>
- <source>Wine (select path and prefix)</source>
- <translation>Wine (Pfad und Prefix auswählen)</translation>
- </message>
- <message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;prefix&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Prefix&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
@@ -83,8 +79,28 @@
<translation>Beides</translation>
</message>
<message>
- <source>Steam application id</source>
- <translation>Steam-Application-ID</translation>
+ <source>Proton (select version and mode)</source>
+ <translation>Proton (wähle Version und Modus)</translation>
+ </message>
+ <message>
+ <source>Steam Play (select Steam Application ID)</source>
+ <translation>Steam Play (wähle Steam Applikation ID)</translation>
+ </message>
+ <message>
+ <source>UMU enabled Launchers (select prefix)</source>
+ <translation>UMU unterstützte Launcher (wähle Prefix)</translation>
+ </message>
+ <message>
+ <source>Wine (select version and prefix)</source>
+ <translation>Wine (wähle Version und Prefix)</translation>
+ </message>
+ <message>
+ <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Steam Play is Steams System to run Windows titles on Linux via Proton.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Steam Play ist Steams System, um Windows Titel auf Linux, via Proton, auszuführen.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
+ </message>
+ <message>
+ <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;UMU is a launcher that allows the use of Proton outside of Steam. Some game launchers like Lutris may use this to enable Proton support.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;UMU ist ein Launcher, der es erlaubt Proton außerhalb von Steam zu nutzen. Manche Spiel Launcher, wie Lutris, können dies für Proton Support nutzen.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
</context>
<context>
@@ -105,6 +121,10 @@
<source>Can&apos;t open shared memory mapping</source>
<translation>Shared-Memory-Mapping kann nicht geöffnet werden</translation>
</message>
+ <message>
+ <source>Prefix has not been defined!</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>wine_metadata</name>
diff --git a/proto-wine/lang/nl_NL.ts b/proto-wine/lang/nl_NL.ts
index 0298092b..bc3ef604 100644
--- a/proto-wine/lang/nl_NL.ts
+++ b/proto-wine/lang/nl_NL.ts
@@ -11,6 +11,10 @@
<source>Select Wine Prefix</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Select Proton Prefix</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>UICFTControls</name>
@@ -39,14 +43,6 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>Steam application id</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Proton (Steam Play)</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<source>Protocol</source>
<translation type="unfinished"></translation>
</message>
@@ -63,10 +59,6 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>Wine (select path and prefix)</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;prefix&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
@@ -86,6 +78,30 @@
<source>Browse Wine Path</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Proton (select version and mode)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Steam Play (select Steam Application ID)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>UMU enabled Launchers (select prefix)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Wine (select version and prefix)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Steam Play is Steams System to run Windows titles on Linux via Proton.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;UMU is a launcher that allows the use of Proton outside of Steam. Some game launchers like Lutris may use this to enable Proton support.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>wine</name>
@@ -105,6 +121,10 @@
<source>Failed to start Wine! Make sure the binary is set correctly.</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Prefix has not been defined!</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>wine_metadata</name>
diff --git a/proto-wine/lang/ru_RU.ts b/proto-wine/lang/ru_RU.ts
index c7e9c52e..a7702454 100644
--- a/proto-wine/lang/ru_RU.ts
+++ b/proto-wine/lang/ru_RU.ts
@@ -11,6 +11,10 @@
<source>Select Wine Prefix</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Select Proton Prefix</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>UICFTControls</name>
@@ -39,14 +43,6 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>Steam application id</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Proton (Steam Play)</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<source>Protocol</source>
<translation type="unfinished"></translation>
</message>
@@ -63,10 +59,6 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>Wine (select path and prefix)</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;prefix&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
@@ -86,6 +78,30 @@
<source>Browse Wine Path</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Proton (select version and mode)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Steam Play (select Steam Application ID)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>UMU enabled Launchers (select prefix)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Wine (select version and prefix)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Steam Play is Steams System to run Windows titles on Linux via Proton.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;UMU is a launcher that allows the use of Proton outside of Steam. Some game launchers like Lutris may use this to enable Proton support.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>wine</name>
@@ -105,6 +121,10 @@
<source>Failed to start Wine! Make sure the binary is set correctly.</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Prefix has not been defined!</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>wine_metadata</name>
diff --git a/proto-wine/lang/stub.ts b/proto-wine/lang/stub.ts
index 3366b44b..2c708749 100644
--- a/proto-wine/lang/stub.ts
+++ b/proto-wine/lang/stub.ts
@@ -11,6 +11,10 @@
<source>Select Wine Prefix</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Select Proton Prefix</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>UICFTControls</name>
@@ -39,14 +43,6 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>Steam application id</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Proton (Steam Play)</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<source>Protocol</source>
<translation type="unfinished"></translation>
</message>
@@ -63,10 +59,6 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>Wine (select path and prefix)</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;prefix&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
@@ -86,6 +78,30 @@
<source>Browse Wine Path</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Proton (select version and mode)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Steam Play (select Steam Application ID)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>UMU enabled Launchers (select prefix)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Wine (select version and prefix)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Steam Play is Steams System to run Windows titles on Linux via Proton.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;UMU is a launcher that allows the use of Proton outside of Steam. Some game launchers like Lutris may use this to enable Proton support.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>wine</name>
@@ -105,6 +121,10 @@
<source>Failed to start Wine! Make sure the binary is set correctly.</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Prefix has not been defined!</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>wine_metadata</name>
diff --git a/proto-wine/lang/zh_CN.ts b/proto-wine/lang/zh_CN.ts
index 0d285c7c..6884f266 100644
--- a/proto-wine/lang/zh_CN.ts
+++ b/proto-wine/lang/zh_CN.ts
@@ -11,6 +11,10 @@
<source>Select Wine Prefix</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Select Proton Prefix</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>UICFTControls</name>
@@ -39,14 +43,6 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>Steam application id</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Proton (Steam Play)</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<source>Protocol</source>
<translation type="unfinished"></translation>
</message>
@@ -63,10 +59,6 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>Wine (select path and prefix)</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;prefix&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
@@ -86,6 +78,30 @@
<source>Browse Wine Path</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Proton (select version and mode)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Steam Play (select Steam Application ID)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>UMU enabled Launchers (select prefix)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Wine (select version and prefix)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Steam Play is Steams System to run Windows titles on Linux via Proton.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;UMU is a launcher that allows the use of Proton outside of Steam. Some game launchers like Lutris may use this to enable Proton support.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>wine</name>
@@ -105,6 +121,10 @@
<source>Failed to start Wine! Make sure the binary is set correctly.</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Prefix has not been defined!</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>wine_metadata</name>
diff --git a/proto-wine/proton.cpp b/proto-wine/proton.cpp
index aa2c3755..998da748 100644
--- a/proto-wine/proton.cpp
+++ b/proto-wine/proton.cpp
@@ -10,9 +10,9 @@
#include <QDebug>
#include <QDir>
#include <QFileInfo>
-#include <QProcessEnvironment>
#include <QtGlobal>
+#include "proton.h"
static const char* steam_paths[] = {
"/.steam/steam/steamapps/compatdata",
@@ -27,13 +27,13 @@ static const char* runtime_paths[] = {
};
-std::tuple<QProcessEnvironment, QString, bool> make_steam_environ(const QString& proton_dist_path, int appid)
+std::tuple<QProcessEnvironment, QString, bool> make_steam_environ(const QString& proton_dist_path)
{
using ret = std::tuple<QProcessEnvironment, QString, bool>;
auto env = QProcessEnvironment::systemEnvironment();
QString error = "";
QString home = qgetenv("HOME");
- QString runtime_path, app_wineprefix;
+ QString runtime_path;
auto expand = [&](QString x) {
x.replace("HOME", home);
@@ -51,14 +51,6 @@ std::tuple<QProcessEnvironment, QString, bool> make_steam_environ(const QString&
if (runtime_path.isEmpty())
error = QString("Couldn't find a Steam runtime.");
- for (const char* path : steam_paths) {
- QDir dir(QDir::homePath() + path + expand("/%1/pfx").arg(appid));
- if (dir.exists())
- app_wineprefix = dir.absolutePath();
- }
- if (app_wineprefix.isEmpty())
- error = QString("Couldn't find a Wineprefix for AppId %1").arg(appid);
-
QString path = expand(
":PROTON_DIST_PATH/bin"
);
@@ -81,14 +73,25 @@ std::tuple<QProcessEnvironment, QString, bool> make_steam_environ(const QString&
);
library_path += ':'; library_path += qgetenv("LD_LIBRARY_PATH");
env.insert("LD_LIBRARY_PATH", library_path);
- env.insert("WINEPREFIX", app_wineprefix);
return ret(env, error, error.isEmpty());
}
-QString proton_path(const QString& proton_dist_path)
+std::tuple<QString, QString, bool> make_wineprefix(int appid)
{
- return proton_dist_path + "/bin/wine";
+ using ret = std::tuple<QString, QString, bool>;
+ QString error = "";
+ QString app_wineprefix;
+ for (const char* path : steam_paths) {
+ QDir dir(QDir::homePath() + path + QString("/%1/pfx").arg(appid));
+ if (dir.exists())
+ app_wineprefix = dir.absolutePath();
+ }
+ if (app_wineprefix.isEmpty())
+ error = QString("Couldn't find a Wineprefix for AppId %1").arg(appid);
+
+ return ret(app_wineprefix, error, error.isEmpty());
}
+
#endif
diff --git a/proto-wine/proton.h b/proto-wine/proton.h
new file mode 100644
index 00000000..51539305
--- /dev/null
+++ b/proto-wine/proton.h
@@ -0,0 +1,7 @@
+#pragma once
+
+#include <qchar.h>
+#include <qprocess.h>
+
+std::tuple<QProcessEnvironment, QString, bool> make_steam_environ(const QString& proton_dist_path);
+std::tuple<QString, QString, bool> make_wineprefix(int appid); \ No newline at end of file