diff options
-rw-r--r-- | proto-wine/ftnoir_protocol_wine.cpp | 10 | ||||
-rw-r--r-- | proto-wine/ftnoir_protocol_wine_dialog.cpp | 25 | ||||
-rw-r--r-- | proto-wine/proton.cpp | 16 |
3 files changed, 35 insertions, 16 deletions
diff --git a/proto-wine/ftnoir_protocol_wine.cpp b/proto-wine/ftnoir_protocol_wine.cpp index c44cfc43..b70b3f16 100644 --- a/proto-wine/ftnoir_protocol_wine.cpp +++ b/proto-wine/ftnoir_protocol_wine.cpp @@ -87,11 +87,13 @@ module_status wine::initialize() if (s.proton_appid == 0) return error(tr("Must specify application id for Proton (Steam Play)")); - std::tuple<QProcessEnvironment, QString, bool> make_steam_environ(const QString& proton_path, int appid); - QString proton_path(const QString& proton_path); + std::tuple<QProcessEnvironment, QString, bool> make_steam_environ(const QString& proton_dist_path, int appid); + QString proton_path(const QString& proton_dist_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); + QString proton_dist_path = s.proton_path().toString(); + + 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 (!success) diff --git a/proto-wine/ftnoir_protocol_wine_dialog.cpp b/proto-wine/ftnoir_protocol_wine_dialog.cpp index 07dc1469..23f82fda 100644 --- a/proto-wine/ftnoir_protocol_wine_dialog.cpp +++ b/proto-wine/ftnoir_protocol_wine_dialog.cpp @@ -2,6 +2,9 @@ #include <QDebug> #include <QFileDialog> #include <QDir> +#include <QDirIterator> +#include <qdebug.h> +#include <qdir.h> #include "api/plugin-api.hpp" @@ -46,13 +49,27 @@ FTControls::FTControls() QDir dir(QDir::homePath() + path); dir.setFilter(QDir::Dirs); dir.setNameFilters({ "Proton*" }); - QFileInfoList list = dir.entryInfoList(); - for (int i = 0; i < list.size(); ++i) { - QFileInfo fileInfo = list.at(i); - ui.proton_version->addItem(fileInfo.fileName(), QVariant{fileInfo.filePath()}); + + 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(); + + QDirIterator proton_executable_it(proton_dir.canonicalFilePath(), QStringList() << "wine", QDir::Files, QDirIterator::Subdirectories); + + if (proton_executable_it.hasNext()) { + QString proton_executable_path = proton_executable_it.next(); + 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); diff --git a/proto-wine/proton.cpp b/proto-wine/proton.cpp index 5ecd1f93..868a4004 100644 --- a/proto-wine/proton.cpp +++ b/proto-wine/proton.cpp @@ -25,7 +25,7 @@ static const char* runtime_paths[] = { }; -std::tuple<QProcessEnvironment, QString, bool> make_steam_environ(const QString& proton_path, int appid) +std::tuple<QProcessEnvironment, QString, bool> make_steam_environ(const QString& proton_dist_path, int appid) { using ret = std::tuple<QProcessEnvironment, QString, bool>; auto env = QProcessEnvironment::systemEnvironment(); @@ -35,7 +35,7 @@ std::tuple<QProcessEnvironment, QString, bool> make_steam_environ(const QString& auto expand = [&](QString x) { x.replace("HOME", home); - x.replace("PROTON_PATH", proton_path); + x.replace("PROTON_DIST_PATH", proton_dist_path); x.replace("RUNTIME_PATH", runtime_path); return x; }; @@ -58,14 +58,14 @@ std::tuple<QProcessEnvironment, QString, bool> make_steam_environ(const QString& error = QString("Couldn't find a Wineprefix for AppId %1").arg(appid); QString path = expand( - ":PROTON_PATH/dist/bin" + ":PROTON_DIST_PATH/bin" ); path += ':'; path += qgetenv("PATH"); env.insert("PATH", path); QString library_path = expand( - ":PROTON_PATH/dist/lib" - ":PROTON_PATH/dist/lib64" + ":PROTON_DIST_PATH/lib" + ":PROTON_DIST_PATH/lib64" ":RUNTIME_PATH/pinned_libs_32" ":RUNTIME_PATH/pinned_libs_64" ":RUNTIME_PATH/i386/lib/i386-linux-gnu" @@ -84,9 +84,9 @@ std::tuple<QProcessEnvironment, QString, bool> make_steam_environ(const QString& return ret(env, error, error.isEmpty()); } -QString proton_path(const QString& proton_path) + +QString proton_path(const QString& proton_dist_path) { - return proton_path + "/dist/bin/wine"; + return proton_dist_path + "/bin/wine"; } - #endif |