From a5a2ec4f7a855ad35bde6362796a0a07fd419cf7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 27 Oct 2019 07:25:43 +0100 Subject: proto/wine: add support for proton --- proto-wine/ftnoir_protocol_wine.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'proto-wine/ftnoir_protocol_wine.cpp') diff --git a/proto-wine/ftnoir_protocol_wine.cpp b/proto-wine/ftnoir_protocol_wine.cpp index 2e618ff9..ce6f6229 100644 --- a/proto-wine/ftnoir_protocol_wine.cpp +++ b/proto-wine/ftnoir_protocol_wine.cpp @@ -51,12 +51,24 @@ void wine::pose(const double *headpose, const double*) } } +QProcessEnvironment make_steam_environ(const QString& proton_version); +QString proton_path(const QString& proton_version); + 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) + { + env = make_steam_environ(s.proton_version); + wine_path = proton_path(s.proton_version); + } + 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()) -- cgit v1.2.3 From 8601e6f1ee395a89867f404b36bc93077baff8ff Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 27 Oct 2019 08:08:29 +0100 Subject: proto/wine: move function prototypes --- proto-wine/ftnoir_protocol_wine.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'proto-wine/ftnoir_protocol_wine.cpp') diff --git a/proto-wine/ftnoir_protocol_wine.cpp b/proto-wine/ftnoir_protocol_wine.cpp index ce6f6229..a2a49940 100644 --- a/proto-wine/ftnoir_protocol_wine.cpp +++ b/proto-wine/ftnoir_protocol_wine.cpp @@ -51,9 +51,6 @@ void wine::pose(const double *headpose, const double*) } } -QProcessEnvironment make_steam_environ(const QString& proton_version); -QString proton_path(const QString& proton_version); - module_status wine::initialize() { #ifndef OTR_WINE_NO_WRAPPER @@ -63,8 +60,11 @@ module_status wine::initialize() auto env = QProcessEnvironment::systemEnvironment(); if (s.variant_proton) { - env = make_steam_environ(s.proton_version); - wine_path = proton_path(s.proton_version); + QProcessEnvironment make_steam_environ(const QString& proton_version); + QString proton_path(const QString& proton_version); + + env = make_steam_environ(s.proton_version); + wine_path = proton_path(s.proton_version); } wrapper.setWorkingDirectory(OPENTRACK_BASE_PATH); -- cgit v1.2.3 From 2f07cc9958f31e405db7498989e90755234c7c47 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 27 Oct 2019 14:30:47 +0100 Subject: proto/wine: actually set environ --- proto-wine/ftnoir_protocol_wine.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'proto-wine/ftnoir_protocol_wine.cpp') diff --git a/proto-wine/ftnoir_protocol_wine.cpp b/proto-wine/ftnoir_protocol_wine.cpp index a2a49940..719da51f 100644 --- a/proto-wine/ftnoir_protocol_wine.cpp +++ b/proto-wine/ftnoir_protocol_wine.cpp @@ -57,14 +57,13 @@ module_status wine::initialize() static const QString library_path(OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH); QString wine_path = "wine"; - auto env = QProcessEnvironment::systemEnvironment(); if (s.variant_proton) { QProcessEnvironment make_steam_environ(const QString& proton_version); QString proton_path(const QString& proton_version); - env = make_steam_environ(s.proton_version); wine_path = proton_path(s.proton_version); + wrapper.setProcessEnvironment(make_steam_environ(s.proton_version)); } wrapper.setWorkingDirectory(OPENTRACK_BASE_PATH); -- cgit v1.2.3 From 69c9a4136d2decc10f97ad49189070d8e4708110 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 28 Oct 2019 07:45:16 +0100 Subject: proto/wine: implement more proton knobs Reported by: @jp7677 Issue: #996 --- proto-wine/ftnoir_protocol_wine.cpp | 15 ++++++-- proto-wine/ftnoir_protocol_wine.h | 5 ++- proto-wine/ftnoir_protocol_wine_dialog.cpp | 3 ++ proto-wine/ftnoir_winecontrols.ui | 55 ++++++++++++++++++++++++++++-- proto-wine/proton.cpp | 12 +++---- 5 files changed, 77 insertions(+), 13 deletions(-) (limited to 'proto-wine/ftnoir_protocol_wine.cpp') diff --git a/proto-wine/ftnoir_protocol_wine.cpp b/proto-wine/ftnoir_protocol_wine.cpp index 719da51f..ae7c6c31 100644 --- a/proto-wine/ftnoir_protocol_wine.cpp +++ b/proto-wine/ftnoir_protocol_wine.cpp @@ -57,15 +57,26 @@ module_status wine::initialize() static const QString library_path(OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH); QString wine_path = "wine"; + auto env = QProcessEnvironment::systemEnvironment(); + if (s.variant_proton) { - QProcessEnvironment make_steam_environ(const QString& proton_version); + 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); - wrapper.setProcessEnvironment(make_steam_environ(s.proton_version)); + env = make_steam_environ(s.proton_version, s.proton_appid); } + 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_path, { library_path + "opentrack-wrapper-wine.exe.so" }); #endif diff --git a/proto-wine/ftnoir_protocol_wine.h b/proto-wine/ftnoir_protocol_wine.h index 3c64df68..9266e455 100644 --- a/proto-wine/ftnoir_protocol_wine.h +++ b/proto-wine/ftnoir_protocol_wine.h @@ -19,7 +19,10 @@ struct settings : opts { settings() : opts{"proto-wine"} {} value variant_proton{b, "variant-proton", false }, - variant_wine{b, "variant-wine", true }; + variant_wine{b, "variant-wine", true }, + fsync{b, "fsync", true}, + esync{b, "esync", true}; + value proton_appid{b, "proton-appid", 0}; value proton_version{b, "proton-version", {} }; }; diff --git a/proto-wine/ftnoir_protocol_wine_dialog.cpp b/proto-wine/ftnoir_protocol_wine_dialog.cpp index bf431c66..b63268d0 100644 --- a/proto-wine/ftnoir_protocol_wine_dialog.cpp +++ b/proto-wine/ftnoir_protocol_wine_dialog.cpp @@ -16,6 +16,9 @@ FTControls::FTControls() 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); connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &FTControls::doOK); connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &FTControls::doCancel); diff --git a/proto-wine/ftnoir_winecontrols.ui b/proto-wine/ftnoir_winecontrols.ui index 79fca47d..19180f19 100644 --- a/proto-wine/ftnoir_winecontrols.ui +++ b/proto-wine/ftnoir_winecontrols.ui @@ -9,8 +9,8 @@ 0 0 - 332 - 204 + 471 + 400 @@ -55,7 +55,7 @@ - Proton (Steam) + Proton (Steam Play) @@ -78,6 +78,55 @@ + + + + Advanced + + + + + + <html><head/><body><p>When supported.</p></body></html> + + + ESYNC + + + + + + + <html><head/><body><p>When supported.</p></body></html> + + + FSYNC + + + + + + + + + + Application id (Proton only) + + + + + + + 2147483647 + + + + + + + + + diff --git a/proto-wine/proton.cpp b/proto-wine/proton.cpp index 9cc4af30..15306d26 100644 --- a/proto-wine/proton.cpp +++ b/proto-wine/proton.cpp @@ -11,7 +11,7 @@ #include #include -QProcessEnvironment make_steam_environ(const QString& proton_version) +QProcessEnvironment make_steam_environ(const QString& proton_version, int appid) { auto ret = QProcessEnvironment::systemEnvironment(); QString home = qgetenv("HOME"); @@ -23,9 +23,9 @@ QProcessEnvironment make_steam_environ(const QString& proton_version) }; 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" + ":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); @@ -46,9 +46,7 @@ QProcessEnvironment make_steam_environ(const QString& proton_version) ); 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/805550/pfx")); - ret.insert("WINEESYNC", "1"); + ret.insert("WINEPREFIX", expand("HOME/.local/share/Steam/steamapps/compatdata/%1/pfx").arg(appid)); return ret; } -- cgit v1.2.3 From ec00863aff826bc63f221136caf54da8b9285201 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 29 Oct 2019 04:32:59 +0100 Subject: proto/wine: add support for setting WINEPREFIX --- proto-wine/ftnoir_protocol_wine.cpp | 13 ++++++ proto-wine/ftnoir_protocol_wine.h | 6 ++- proto-wine/ftnoir_protocol_wine_dialog.cpp | 1 + proto-wine/ftnoir_winecontrols.ui | 72 +++++++++++++++++++++++++----- proto-wine/lang/nl_NL.ts | 10 +++-- proto-wine/lang/ru_RU.ts | 10 +++-- proto-wine/lang/stub.ts | 10 +++-- proto-wine/lang/zh_CN.ts | 10 +++-- 8 files changed, 108 insertions(+), 24 deletions(-) (limited to 'proto-wine/ftnoir_protocol_wine.cpp') diff --git a/proto-wine/ftnoir_protocol_wine.cpp b/proto-wine/ftnoir_protocol_wine.cpp index ae7c6c31..bed1fed3 100644 --- a/proto-wine/ftnoir_protocol_wine.cpp +++ b/proto-wine/ftnoir_protocol_wine.cpp @@ -70,6 +70,19 @@ module_status wine::initialize() 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"); diff --git a/proto-wine/ftnoir_protocol_wine.h b/proto-wine/ftnoir_protocol_wine.h index 9266e455..8175be03 100644 --- a/proto-wine/ftnoir_protocol_wine.h +++ b/proto-wine/ftnoir_protocol_wine.h @@ -22,8 +22,10 @@ struct settings : opts variant_wine{b, "variant-wine", true }, fsync{b, "fsync", true}, esync{b, "esync", true}; - value proton_appid{b, "proton-appid", 0}; - value proton_version{b, "proton-version", {} }; + + value proton_appid{b, "proton-appid", 0}; + value proton_version{b, "proton-version", {} }, + wineprefix{b, "wineprefix", "~/.wine"}; }; class wine : TR, public IProtocol diff --git a/proto-wine/ftnoir_protocol_wine_dialog.cpp b/proto-wine/ftnoir_protocol_wine_dialog.cpp index b63268d0..f1cb01c2 100644 --- a/proto-wine/ftnoir_protocol_wine_dialog.cpp +++ b/proto-wine/ftnoir_protocol_wine_dialog.cpp @@ -19,6 +19,7 @@ FTControls::FTControls() 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); diff --git a/proto-wine/ftnoir_winecontrols.ui b/proto-wine/ftnoir_winecontrols.ui index 12aebd57..a0a1e071 100644 --- a/proto-wine/ftnoir_winecontrols.ui +++ b/proto-wine/ftnoir_winecontrols.ui @@ -9,8 +9,8 @@ 0 0 - 492 - 400 + 544 + 410 @@ -33,10 +33,26 @@ Wine variant + + + + + 0 + 0 + + + + + 120 + 0 + + + + - + 0 0 @@ -46,10 +62,10 @@ - + - + 0 0 @@ -59,17 +75,17 @@ - - + + - + 0 0 - 120 + 286 0 @@ -86,6 +102,12 @@ + + + 0 + 0 + + <html><head/><body><p>When supported.</p></body></html> @@ -96,6 +118,12 @@ + + + 0 + 0 + + <html><head/><body><p>When supported.</p></body></html> @@ -106,16 +134,34 @@ + + + 0 + 0 + + + + + 0 + 0 + + - Steam application id (Proton) + Steam application id + + + 0 + 0 + + 2147483647 @@ -129,6 +175,12 @@ + + + 0 + 0 + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok diff --git a/proto-wine/lang/nl_NL.ts b/proto-wine/lang/nl_NL.ts index e2d594a3..f71d8ad7 100644 --- a/proto-wine/lang/nl_NL.ts +++ b/proto-wine/lang/nl_NL.ts @@ -28,15 +28,15 @@ - Proton (Steam Play) + <html><head/><body><p>When supported.</p></body></html> - <html><head/><body><p>When supported.</p></body></html> + Steam application id - Steam application id (Proton) + Proton (Steam Play) @@ -50,6 +50,10 @@ Must specify application id for Proton (Steam Play) + + Wine prefix must be an absolute path (given '%1') + + wine_metadata diff --git a/proto-wine/lang/ru_RU.ts b/proto-wine/lang/ru_RU.ts index afd33eea..9937083f 100644 --- a/proto-wine/lang/ru_RU.ts +++ b/proto-wine/lang/ru_RU.ts @@ -28,15 +28,15 @@ - Proton (Steam Play) + <html><head/><body><p>When supported.</p></body></html> - <html><head/><body><p>When supported.</p></body></html> + Steam application id - Steam application id (Proton) + Proton (Steam Play) @@ -50,6 +50,10 @@ Must specify application id for Proton (Steam Play) + + Wine prefix must be an absolute path (given '%1') + + wine_metadata diff --git a/proto-wine/lang/stub.ts b/proto-wine/lang/stub.ts index b0ced919..9b74a44d 100644 --- a/proto-wine/lang/stub.ts +++ b/proto-wine/lang/stub.ts @@ -28,15 +28,15 @@ - Proton (Steam Play) + <html><head/><body><p>When supported.</p></body></html> - <html><head/><body><p>When supported.</p></body></html> + Steam application id - Steam application id (Proton) + Proton (Steam Play) @@ -50,6 +50,10 @@ Must specify application id for Proton (Steam Play) + + Wine prefix must be an absolute path (given '%1') + + wine_metadata diff --git a/proto-wine/lang/zh_CN.ts b/proto-wine/lang/zh_CN.ts index b0ced919..9b74a44d 100644 --- a/proto-wine/lang/zh_CN.ts +++ b/proto-wine/lang/zh_CN.ts @@ -28,15 +28,15 @@ - Proton (Steam Play) + <html><head/><body><p>When supported.</p></body></html> - <html><head/><body><p>When supported.</p></body></html> + Steam application id - Steam application id (Proton) + Proton (Steam Play) @@ -50,6 +50,10 @@ Must specify application id for Proton (Steam Play) + + Wine prefix must be an absolute path (given '%1') + + wine_metadata -- cgit v1.2.3