diff options
-rw-r--r-- | bin/freetrackclient64.dll | bin | 0 -> 16384 bytes | |||
-rw-r--r-- | cmake/opentrack-install.cmake | 1 | ||||
-rw-r--r-- | freetrackclient/freetrackclient.c | 6 | ||||
-rw-r--r-- | options/globals.cpp | 13 | ||||
-rw-r--r-- | proto-wine/ftnoir_protocol_wine.cpp | 37 | ||||
-rw-r--r-- | proto-wine/ftnoir_protocol_wine.h | 18 | ||||
-rw-r--r-- | proto-wine/ftnoir_protocol_wine_dialog.cpp | 30 | ||||
-rw-r--r-- | proto-wine/ftnoir_winecontrols.ui | 292 | ||||
-rw-r--r-- | proto-wine/lang/nl_NL.ts | 36 | ||||
-rw-r--r-- | proto-wine/lang/ru_RU.ts | 36 | ||||
-rw-r--r-- | proto-wine/lang/stub.ts | 36 | ||||
-rw-r--r-- | proto-wine/lang/zh_CN.ts | 36 | ||||
-rw-r--r-- | proto-wine/proton.cpp | 62 |
13 files changed, 443 insertions, 160 deletions
diff --git a/bin/freetrackclient64.dll b/bin/freetrackclient64.dll Binary files differnew file mode 100644 index 00000000..e1074592 --- /dev/null +++ b/bin/freetrackclient64.dll diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake index 1f4eaa09..2b745a82 100644 --- a/cmake/opentrack-install.cmake +++ b/cmake/opentrack-install.cmake @@ -72,6 +72,7 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") endif() otr_install_exec("${opentrack-hier-pfx}" FILES "${CMAKE_SOURCE_DIR}/bin/freetrackclient.dll") +otr_install_exec("${opentrack-hier-pfx}" FILES "${CMAKE_SOURCE_DIR}/bin/freetrackclient64.dll") otr_install_exec("${opentrack-hier-pfx}" FILES "${CMAKE_SOURCE_DIR}/bin/NPClient.dll" "${CMAKE_SOURCE_DIR}/bin/NPClient64.dll" diff --git a/freetrackclient/freetrackclient.c b/freetrackclient/freetrackclient.c index 2049d91e..80169771 100644 --- a/freetrackclient/freetrackclient.c +++ b/freetrackclient/freetrackclient.c @@ -18,10 +18,6 @@ * * created by the FreeTrack developers. * */ -#ifndef _MSC_VER -# warning "expect misnamed symbols" -#endif - #ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wvariadic-macros" #pragma GCC diagnostic ignored "-Wunused-parameter" @@ -32,7 +28,7 @@ #include "fttypes.h" -#if !defined _WIN64 +#if defined _MSC_VER && !defined _WIN64 # define FT_EXPORT(t) t __stdcall #else # define FT_EXPORT(t) __declspec(dllexport) t diff --git a/options/globals.cpp b/options/globals.cpp index 52e198db..099a7208 100644 --- a/options/globals.cpp +++ b/options/globals.cpp @@ -151,11 +151,20 @@ fail: constexpr const char* subdir = "ini"; } else { - const QString dir = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).value(0, QString()); + QString dir = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).value(0, QString()); if (dir.isEmpty()) goto fail; +#if !defined _WIN32 && !defined __APPLE__ + const QString fmt = QStringLiteral("%1/%2"); + if (!QFile::exists(fmt.arg(dir, OPENTRACK_ORG))) + { + dir = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation).value(0, QString()); + if (dir.isEmpty()) + goto fail; + } +#endif (void)QDir(dir).mkpath(OPENTRACK_ORG); - return QStringLiteral("%1/%2").arg(dir, OPENTRACK_ORG); + return fmt.arg(dir, OPENTRACK_ORG); } } diff --git a/proto-wine/ftnoir_protocol_wine.cpp b/proto-wine/ftnoir_protocol_wine.cpp index 2e618ff9..bed1fed3 100644 --- a/proto-wine/ftnoir_protocol_wine.cpp +++ b/proto-wine/ftnoir_protocol_wine.cpp @@ -55,8 +55,43 @@ module_status wine::initialize() { #ifndef OTR_WINE_NO_WRAPPER static const QString library_path(OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH); + + QString wine_path = "wine"; + auto env = QProcessEnvironment::systemEnvironment(); + + if (s.variant_proton) + { + if (s.proton_appid == 0) + return error(tr("Must specify application id for Proton (Steam Play)")); + + QProcessEnvironment make_steam_environ(const QString& proton_version, int appid); + QString proton_path(const QString& proton_version); + + wine_path = proton_path(s.proton_version); + env = make_steam_environ(s.proton_version, s.proton_appid); + } + else + { + QString wineprefix = "~/.wine"; + if (!s.wineprefix->isEmpty()) + wineprefix = s.wineprefix; + if (wineprefix[0] == '~') + wineprefix = qgetenv("HOME") + wineprefix.mid(1); + + if (wineprefix[0] != '/') + error(tr("Wine prefix must be an absolute path (given '%1')").arg(wineprefix)); + + env.insert("WINEPREFIX", wineprefix); + } + + if (s.esync) + env.insert("WINEESYNC", "1"); + if (s.fsync) + env.insert("WINEFSYNC", "1"); + + wrapper.setProcessEnvironment(env); wrapper.setWorkingDirectory(OPENTRACK_BASE_PATH); - wrapper.start("wine", { library_path + "opentrack-wrapper-wine.exe.so" }); + wrapper.start(wine_path, { library_path + "opentrack-wrapper-wine.exe.so" }); #endif if (lck_shm.success()) diff --git a/proto-wine/ftnoir_protocol_wine.h b/proto-wine/ftnoir_protocol_wine.h index ed142f83..8175be03 100644 --- a/proto-wine/ftnoir_protocol_wine.h +++ b/proto-wine/ftnoir_protocol_wine.h @@ -6,12 +6,28 @@ #include "ui_ftnoir_winecontrols.h" +#include "options/options.hpp" +using namespace options; + #include <QString> #include <QProcess> #include <QMutex> #include <QDebug> +struct settings : opts +{ + settings() : opts{"proto-wine"} {} + value<bool> variant_proton{b, "variant-proton", false }, + variant_wine{b, "variant-wine", true }, + fsync{b, "fsync", true}, + esync{b, "esync", true}; + + value<int> proton_appid{b, "proton-appid", 0}; + value<QString> proton_version{b, "proton-version", {} }, + wineprefix{b, "wineprefix", "~/.wine"}; +}; + class wine : TR, public IProtocol { Q_OBJECT @@ -35,6 +51,7 @@ public: private: shm_wrapper lck_shm { WINE_SHM_NAME, WINE_MTX_NAME, sizeof(WineSHM) }; WineSHM* shm = nullptr; + settings s; #ifndef OTR_WINE_NO_WRAPPER QProcess wrapper; @@ -55,6 +72,7 @@ public: private: Ui::UICFTControls ui; + settings s; private slots: void doOK(); diff --git a/proto-wine/ftnoir_protocol_wine_dialog.cpp b/proto-wine/ftnoir_protocol_wine_dialog.cpp index a388df70..f1cb01c2 100644 --- a/proto-wine/ftnoir_protocol_wine_dialog.cpp +++ b/proto-wine/ftnoir_protocol_wine_dialog.cpp @@ -2,18 +2,38 @@ #include <QDebug> #include "api/plugin-api.hpp" +static const char* proton_versions[] = { + "4.11", "4.2", "3.16", "3.7", +}; + FTControls::FTControls() { - ui.setupUi( this ); - connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK())); - connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); + ui.setupUi(this); + + for (const char* version : proton_versions) + ui.proton_version->addItem(version, QVariant{version}); + + tie_setting(s.proton_version, ui.proton_version); + tie_setting(s.variant_wine, ui.variant_wine); + tie_setting(s.variant_proton, ui.variant_proton); + tie_setting(s.esync, ui.esync); + tie_setting(s.fsync, ui.fsync); + tie_setting(s.proton_appid, ui.proton_appid); + tie_setting(s.wineprefix, ui.wineprefix); + + connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &FTControls::doOK); + connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &FTControls::doCancel); } -void FTControls::doOK() { +void FTControls::doOK() +{ + s.b->save(); close(); } -void FTControls::doCancel() { +void FTControls::doCancel() +{ + s.b->reload(); close(); } diff --git a/proto-wine/ftnoir_winecontrols.ui b/proto-wine/ftnoir_winecontrols.ui index 9356c448..a0a1e071 100644 --- a/proto-wine/ftnoir_winecontrols.ui +++ b/proto-wine/ftnoir_winecontrols.ui @@ -9,16 +9,16 @@ <rect> <x>0</x> <y>0</y> - <width>409</width> - <height>110</height> + <width>544</width> + <height>410</height> </rect> </property> <property name="windowTitle"> - <string>FreeTrack settings FaceTrackNoIR</string> + <string>Wine settings</string> </property> <property name="windowIcon"> - <iconset> - <normaloff>images/freetrack.png</normaloff>images/freetrack.png</iconset> + <iconset resource="wine-protocol.qrc"> + <normaloff>:/images/wine.png</normaloff>:/images/wine.png</iconset> </property> <property name="layoutDirection"> <enum>Qt::LeftToRight</enum> @@ -26,141 +26,171 @@ <property name="autoFillBackground"> <bool>false</bool> </property> - <layout class="QVBoxLayout" name="_vertical_layout"> + <layout class="QVBoxLayout" name="verticalLayout"> <item> - <layout class="QHBoxLayout"> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Wine variant</string> </property> - </spacer> + <layout class="QGridLayout" name="gridLayout"> + <item row="2" column="1" alignment="Qt::AlignRight"> + <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> + </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 (system)</string> + </property> + </widget> + </item> + <item row="2" 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="1"> + <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>286</width> + <height>0</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> </item> <item> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>There are no settings necessary for the Wine protocol.</string> - </property> - </widget> - </item> - </layout> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Advanced</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QCheckBox" name="esync"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string><html><head/><body><p>When supported.</p></body></html></string> + </property> + <property name="text"> + <string>ESYNC</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="fsync"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string><html><head/><body><p>When supported.</p></body></html></string> + </property> + <property name="text"> + <string>FSYNC</string> + </property> + </widget> + </item> + <item> + <widget class="QWidget" name="widget" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <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> + </layout> + </widget> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <property name="sizeConstraint"> - <enum>QLayout::SetDefaultConstraint</enum> - </property> - <item> - <widget class="QPushButton" name="btnOK"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>OK</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnCancel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Cancel</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> </item> </layout> </widget> - <resources/> + <resources> + <include location="wine-protocol.qrc"/> + </resources> <connections/> <slots> <slot>startEngineClicked()</slot> diff --git a/proto-wine/lang/nl_NL.ts b/proto-wine/lang/nl_NL.ts index 239e73d1..f71d8ad7 100644 --- a/proto-wine/lang/nl_NL.ts +++ b/proto-wine/lang/nl_NL.ts @@ -4,19 +4,39 @@ <context> <name>UICFTControls</name> <message> - <source>FreeTrack settings FaceTrackNoIR</source> + <source>Wine settings</source> <translation type="unfinished"></translation> </message> <message> - <source>There are no settings necessary for the Wine protocol.</source> + <source>Wine variant</source> <translation type="unfinished"></translation> </message> <message> - <source>OK</source> + <source>Wine (system)</source> <translation type="unfinished"></translation> </message> <message> - <source>Cancel</source> + <source>Advanced</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>ESYNC</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>FSYNC</source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head/><body><p>When supported.</p></body></html></source> + <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> </context> @@ -26,6 +46,14 @@ <source>Can't open shared memory mapping</source> <translation type="unfinished"></translation> </message> + <message> + <source>Must specify application id for Proton (Steam Play)</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Wine prefix must be an absolute path (given '%1')</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 1e80e43f..9937083f 100644 --- a/proto-wine/lang/ru_RU.ts +++ b/proto-wine/lang/ru_RU.ts @@ -4,19 +4,39 @@ <context> <name>UICFTControls</name> <message> - <source>FreeTrack settings FaceTrackNoIR</source> + <source>Wine settings</source> <translation type="unfinished"></translation> </message> <message> - <source>There are no settings necessary for the Wine protocol.</source> + <source>Wine variant</source> <translation type="unfinished"></translation> </message> <message> - <source>OK</source> + <source>Wine (system)</source> <translation type="unfinished"></translation> </message> <message> - <source>Cancel</source> + <source>Advanced</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>ESYNC</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>FSYNC</source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head/><body><p>When supported.</p></body></html></source> + <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> </context> @@ -26,6 +46,14 @@ <source>Can't open shared memory mapping</source> <translation type="unfinished"></translation> </message> + <message> + <source>Must specify application id for Proton (Steam Play)</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Wine prefix must be an absolute path (given '%1')</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 2da10a0b..9b74a44d 100644 --- a/proto-wine/lang/stub.ts +++ b/proto-wine/lang/stub.ts @@ -4,19 +4,39 @@ <context> <name>UICFTControls</name> <message> - <source>FreeTrack settings FaceTrackNoIR</source> + <source>Wine settings</source> <translation type="unfinished"></translation> </message> <message> - <source>There are no settings necessary for the Wine protocol.</source> + <source>Wine variant</source> <translation type="unfinished"></translation> </message> <message> - <source>OK</source> + <source>Wine (system)</source> <translation type="unfinished"></translation> </message> <message> - <source>Cancel</source> + <source>Advanced</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>ESYNC</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>FSYNC</source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head/><body><p>When supported.</p></body></html></source> + <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> </context> @@ -26,6 +46,14 @@ <source>Can't open shared memory mapping</source> <translation type="unfinished"></translation> </message> + <message> + <source>Must specify application id for Proton (Steam Play)</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Wine prefix must be an absolute path (given '%1')</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 2da10a0b..9b74a44d 100644 --- a/proto-wine/lang/zh_CN.ts +++ b/proto-wine/lang/zh_CN.ts @@ -4,19 +4,39 @@ <context> <name>UICFTControls</name> <message> - <source>FreeTrack settings FaceTrackNoIR</source> + <source>Wine settings</source> <translation type="unfinished"></translation> </message> <message> - <source>There are no settings necessary for the Wine protocol.</source> + <source>Wine variant</source> <translation type="unfinished"></translation> </message> <message> - <source>OK</source> + <source>Wine (system)</source> <translation type="unfinished"></translation> </message> <message> - <source>Cancel</source> + <source>Advanced</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>ESYNC</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>FSYNC</source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head/><body><p>When supported.</p></body></html></source> + <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> </context> @@ -26,6 +46,14 @@ <source>Can't open shared memory mapping</source> <translation type="unfinished"></translation> </message> + <message> + <source>Must specify application id for Proton (Steam Play)</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Wine prefix must be an absolute path (given '%1')</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>wine_metadata</name> diff --git a/proto-wine/proton.cpp b/proto-wine/proton.cpp new file mode 100644 index 00000000..15306d26 --- /dev/null +++ b/proto-wine/proton.cpp @@ -0,0 +1,62 @@ +/* Copyright (c) 2019 Stanislaw Halik <sthalik@misaki.pl> + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + */ + +#ifndef OTR_WINE_NO_WRAPPER + +#include <QtGlobal> +#include <QString> +#include <QProcessEnvironment> + +QProcessEnvironment make_steam_environ(const QString& proton_version, int appid) +{ + auto ret = QProcessEnvironment::systemEnvironment(); + QString home = qgetenv("HOME"); + + auto expand = [&](QString x) { + x.replace("HOME", home); + x.replace("PROTON", proton_version); + return x; + }; + + QString path = expand( + ":HOME/.local/share/Steam/steamapps/common/Proton PROTON/dist/bin" + ":HOME/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/bin" + ":HOME/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/bin" + ); + path += ':'; path += qgetenv("PATH"); + ret.insert("PATH", path); + + QString library_path = expand( + ":HOME/.local/share/Steam/steamapps/common/Proton PROTON/dist/lib" + ":HOME/.local/share/Steam/steamapps/common/Proton PROTON/dist/lib64" + ":HOME/.local/share/Steam/ubuntu12_32/steam-runtime/pinned_libs_32" + ":HOME/.local/share/Steam/ubuntu12_32/steam-runtime/pinned_libs_64" + ":HOME/.local/share/Steam/ubuntu12_32/steam-runtime/i386/lib/i386-linux-gnu" + ":HOME/.local/share/Steam/ubuntu12_32/steam-runtime/i386/lib" + ":HOME/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu" + ":HOME/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib" + ":HOME/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/lib/x86_64-linux-gnu" + ":HOME/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/lib" + ":HOME/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu" + ":HOME/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib" + ); + library_path += ':'; library_path += qgetenv("LD_LIBRARY_PATH"); + ret.insert("LD_LIBRARY_PATH", library_path); + ret.insert("WINEPREFIX", expand("HOME/.local/share/Steam/steamapps/compatdata/%1/pfx").arg(appid)); + + return ret; +} + +QString proton_path(const QString& proton_version) +{ + QString wine_path = "HOME/.local/share/Steam/steamapps/common/Proton PROTON/dist/bin/wine"; + wine_path.replace("HOME", qgetenv("HOME")); + wine_path.replace("PROTON", proton_version); + return wine_path; +} + +#endif |