diff options
Diffstat (limited to 'proto-wine/ftnoir_protocol_wine.cpp')
-rw-r--r-- | proto-wine/ftnoir_protocol_wine.cpp | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/proto-wine/ftnoir_protocol_wine.cpp b/proto-wine/ftnoir_protocol_wine.cpp index bed1fed3..af53ff1f 100644 --- a/proto-wine/ftnoir_protocol_wine.cpp +++ b/proto-wine/ftnoir_protocol_wine.cpp @@ -1,12 +1,15 @@ #include "ftnoir_protocol_wine.h" -#include <QString> -#include <string.h> -#include <math.h> #ifndef OTR_WINE_NO_WRAPPER # include "csv/csv.h" #endif #include "compat/library-path.hpp" +#include <cstring> +#include <cmath> + +#include <QString> +#include <QDebug> + wine::wine() = default; wine::~wine() @@ -16,11 +19,14 @@ wine::~wine() if (shm) { shm->stop = true; exit = wrapper.waitForFinished(100); + if (exit) + qDebug() << "proto/wine: wrapper exit code" << wrapper.exitCode(); } if (!exit) { - wrapper.kill(); - wrapper.waitForFinished(-1); + if (wrapper.state() != QProcess::NotRunning) + wrapper.kill(); + wrapper.waitForFinished(1000); } #endif //shm_unlink("/" WINE_SHM_NAME); @@ -64,11 +70,15 @@ module_status wine::initialize() 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); + std::tuple<QProcessEnvironment, QString, bool> make_steam_environ(const QString& proton_path, int appid); + QString proton_path(const QString& proton_path); + + wine_path = proton_path(s.proton_path().toString()); + auto [proton_env, error_string, success] = make_steam_environ(s.proton_path().toString(), s.proton_appid); + env = proton_env; - wine_path = proton_path(s.proton_version); - env = make_steam_environ(s.proton_version, s.proton_appid); + if (!success) + return error(error_string); } else { @@ -79,7 +89,7 @@ module_status wine::initialize() wineprefix = qgetenv("HOME") + wineprefix.mid(1); if (wineprefix[0] != '/') - error(tr("Wine prefix must be an absolute path (given '%1')").arg(wineprefix)); + return error(tr("Wine prefix must be an absolute path (given '%1')").arg(wineprefix)); env.insert("WINEPREFIX", wineprefix); } @@ -89,6 +99,8 @@ module_status wine::initialize() if (s.fsync) env.insert("WINEFSYNC", "1"); + env.insert("OTR_WINE_PROTO", QString::number(s.protocol+1)); + wrapper.setProcessEnvironment(env); wrapper.setWorkingDirectory(OPENTRACK_BASE_PATH); wrapper.start(wine_path, { library_path + "opentrack-wrapper-wine.exe.so" }); |