diff options
Diffstat (limited to 'proto-wine')
-rw-r--r-- | proto-wine/CMakeLists.txt | 10 | ||||
-rw-r--r-- | proto-wine/ftnoir_protocol_wine.cpp | 129 | ||||
-rw-r--r-- | proto-wine/ftnoir_protocol_wine.h | 27 | ||||
-rw-r--r-- | proto-wine/ftnoir_protocol_wine_dialog.cpp | 213 | ||||
-rw-r--r-- | proto-wine/ftnoir_winecontrols.ui | 275 | ||||
-rw-r--r-- | proto-wine/lang/de_DE.ts | 140 | ||||
-rw-r--r-- | proto-wine/lang/nl_NL.ts | 83 | ||||
-rw-r--r-- | proto-wine/lang/ru_RU.ts | 83 | ||||
-rw-r--r-- | proto-wine/lang/stub.ts | 83 | ||||
-rw-r--r-- | proto-wine/lang/zh_CN.ts | 85 | ||||
-rw-r--r-- | proto-wine/opentrack-wrapper-wine-main.cxx | 3 | ||||
-rw-r--r-- | proto-wine/opentrack-wrapper-wine-windows.cxx | 35 | ||||
-rw-r--r-- | proto-wine/proton.cpp | 99 | ||||
-rw-r--r-- | proto-wine/proton.h | 7 | ||||
-rw-r--r-- | proto-wine/wine-shm.h | 7 |
15 files changed, 1143 insertions, 136 deletions
diff --git a/proto-wine/CMakeLists.txt b/proto-wine/CMakeLists.txt index b0f18bb2..ff4932cc 100644 --- a/proto-wine/CMakeLists.txt +++ b/proto-wine/CMakeLists.txt @@ -16,18 +16,22 @@ if(NOT WIN32) set(my-rt) endif() file(GLOB wine-deps "${CMAKE_CURRENT_SOURCE_DIR}/*.cxx") - #install(FILES ${wine-deps} DESTINATION "${opentrack-doc-src-pfx}/proto-wine") + #install(FILES ${wine-deps} DESTINATION "${opentrack-src}/proto-wine") + set(winegxx-multilib "-m32") + if (NOT OPENTRACK_WINE_ARCH STREQUAL "") + set(winegxx-multilib "${OPENTRACK_WINE_ARCH}") + endif() add_custom_command( OUTPUT opentrack-wrapper-wine.exe.so DEPENDS ${wine-deps} - COMMAND wineg++ -mconsole -g -DNOMINMAX -O2 -m32 -std=c++17 -fPIC -o + COMMAND wineg++ -mconsole -g -DNOMINMAX -O2 ${winegxx-multilib} -std=c++17 -fPIC -o opentrack-wrapper-wine.exe -I "${CMAKE_SOURCE_DIR}" -I "${CMAKE_BINARY_DIR}" ${wine-deps} -Wall -Wextra -Wpedantic ${my-rt}) add_custom_target(wine-wrapper DEPENDS opentrack-wrapper-wine.exe.so) add_dependencies(opentrack-proto-wine wine-wrapper) add_dependencies(wine-wrapper opentrack-compat) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/opentrack-wrapper-wine.exe.so" DESTINATION ${opentrack-hier-pfx}) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/opentrack-wrapper-wine.exe.so" DESTINATION ${opentrack-libexec}) endif() endif() endif() diff --git a/proto-wine/ftnoir_protocol_wine.cpp b/proto-wine/ftnoir_protocol_wine.cpp index bed1fed3..bae02b06 100644 --- a/proto-wine/ftnoir_protocol_wine.cpp +++ b/proto-wine/ftnoir_protocol_wine.cpp @@ -1,11 +1,16 @@ #include "ftnoir_protocol_wine.h" -#include <QString> -#include <string.h> -#include <math.h> +#include <qprocess.h> #ifndef OTR_WINE_NO_WRAPPER # include "csv/csv.h" #endif -#include "compat/library-path.hpp" + +#include <cstring> +#include <cmath> + +#include <QString> +#include <QDebug> + +#include "proton.h" wine::wine() = default; @@ -16,11 +21,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); @@ -38,6 +46,7 @@ void wine::pose(const double *headpose, const double*) #ifndef OTR_WINE_NO_WRAPPER if (shm->gameid != gameid) { + //qDebug() << "proto/wine: looking up gameData"; QString gamename; QMutexLocker foo(&game_name_mutex); /* only EZCA for FSX requires dummy process, and FSX doesn't work on Linux */ @@ -56,48 +65,136 @@ 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"; - auto env = QProcessEnvironment::systemEnvironment(); + 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); + } + else if (s.variant_proton) + { + // PROTON + + wine_path = s.proton_path().toString() + "/bin/wine"; + } + qDebug() << "proto/wine: wine_path:" << wine_path; + + + ///////////////////////////////////// + // determine environment variables // + ///////////////////////////////////// + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + + // if proton is used setup proton environment if (s.variant_proton) { + auto [proton_env, env_error_string, env_success] = make_steam_environ(s.proton_path().toString()); + env = proton_env; + + if (!env_success) + return error(env_error_string); + } + + // determine wineprefix + if (s.variant_proton && s.variant_proton_steamplay) { + // wine prefix is dependend on steam + 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); + auto [prefix, error_string, success] = make_wineprefix(s.proton_appid); + qDebug() << "proto/wine: wineprefix:" << prefix; + env.insert("WINEPREFIX", prefix); - wine_path = proton_path(s.proton_version); - env = make_steam_environ(s.proton_version, s.proton_appid); + 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] != '/') - 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)); + + qDebug() << "proto/wine: wineprefix:" << wineprefix; 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" }); + wrapper.waitForStarted(); + if (wrapper.state() == QProcess::ProcessState::NotRunning) { + return error(tr("Failed to start Wine! Make sure the binary is set correctly.")); + } #endif if (lck_shm.success()) { shm = (WineSHM*) lck_shm.ptr(); memset(shm, 0, sizeof(*shm)); + + qDebug() << "proto/wine: shm success"; + + // display "waiting for game message" (overwritten once a game is detected) +#ifndef OTR_WINE_NO_WRAPPER + connected_game = "waiting for game..."; +#endif + } + else { + qDebug() << "proto/wine: shm no success"; } if (lck_shm.success()) diff --git a/proto-wine/ftnoir_protocol_wine.h b/proto-wine/ftnoir_protocol_wine.h index 8175be03..718699ac 100644 --- a/proto-wine/ftnoir_protocol_wine.h +++ b/proto-wine/ftnoir_protocol_wine.h @@ -9,23 +9,30 @@ #include "options/options.hpp" using namespace options; -#include <QString> -#include <QProcess> #include <QMutex> +#include <QProcess> +#include <QString> +#include <QVariant> #include <QDebug> 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}; value<int> proton_appid{b, "proton-appid", 0}; - value<QString> proton_version{b, "proton-version", {} }, - wineprefix{b, "wineprefix", "~/.wine"}; + value<QVariant> proton_path{b, "proton-version", {} }; + 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}; }; class wine : TR, public IProtocol @@ -75,6 +82,14 @@ private: settings s; private slots: + void onWinePathComboUpdated(); + void onRadioButtonsChanged(); + + void doBrowseWine(); + 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 f1cb01c2..2b7d08e0 100644 --- a/proto-wine/ftnoir_protocol_wine_dialog.cpp +++ b/proto-wine/ftnoir_protocol_wine_dialog.cpp @@ -1,28 +1,222 @@ #include "ftnoir_protocol_wine.h" #include <QDebug> +#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 + * 1: path from a wine version to the exectuable + * 2: name of the application using the wine versions + */ +static const char* wine_paths[][3] = { + {"/.local/share/lutris/runners/wine/", "/bin/wine", "Lutris"}, + {"/.var/app/net.lutris.Lutris/data/lutris/runners/wine/", "/bin/wine", "Flatpak Lutris"} +}; -static const char* proton_versions[] = { - "4.11", "4.2", "3.16", "3.7", +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); - for (const char* version : proton_versions) - ui.proton_version->addItem(version, QVariant{version}); + // populate wine select + ui.wine_path_combo->addItem("System Wine", QVariant{"WINE"}); + for (const char** path : wine_paths) { + QDir dir(QDir::homePath() + path[0]); + dir.setFilter(QDir::Dirs); + QFileInfoList list = dir.entryInfoList(); + for (int i = 0; i < list.size(); ++i) { + QFileInfo fileInfo = list.at(i); + if (fileInfo.fileName() == "." || fileInfo.fileName() == "..") continue; + + QString name = fileInfo.fileName() + " (" + path[2] + ")"; + ui.wine_path_combo->addItem(name, QVariant{fileInfo.filePath() + path[1]}); + } + } + 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[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); + + // 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); - tie_setting(s.proton_version, ui.proton_version); - tie_setting(s.variant_wine, ui.variant_wine); - tie_setting(s.variant_proton, ui.variant_proton); + if (proton_executable_it.hasNext()) { + QString proton_executable_path = proton_executable_it.next(); + QDir proton_dist_dir(proton_executable_path); + proton_dist_dir.cd("../../"); + + ui.proton_version->addItem(proton_dir.fileName(), QVariant{proton_dist_dir.canonicalPath()}); + } + } + } + + // 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.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::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(); + // hide the correct items + onRadioButtonsChanged(); +} + +void FTControls::onWinePathComboUpdated() { + // enable the custom text field if required + if (ui.wine_path_combo->currentData() == "CUSTOM") { + ui.wine_path->setEnabled(true); + ui.browse_wine_path_button->setEnabled(true); + } + else { + ui.wine_path->setEnabled(false); + ui.browse_wine_path_button->setEnabled(false); + } +} + +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); + d.setWindowTitle(tr("Select path to Wine Binary")); + if (s.wine_custom_path->startsWith("~/.local/share/lutris/runners")) { + d.selectFile(s.wine_custom_path); + } + if (d.exec()) { + s.wine_custom_path = d.selectedFiles()[0]; + } +} +void FTControls::doBrowseWinePrefix() { + QFileDialog d(this); + d.setFileMode(QFileDialog::FileMode::Directory); + d.setOption(QFileDialog::Option::ShowDirsOnly, true); + d.setWindowTitle(tr("Select Wine Prefix")); + if (s.wineprefix->startsWith("/") || s.wineprefix->startsWith("~")) { + d.selectFile(s.wineprefix); + } + if (d.exec()) { + s.wineprefix = d.selectedFiles()[0]; + } +} + +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() @@ -36,4 +230,3 @@ void FTControls::doCancel() s.b->reload(); close(); } - diff --git a/proto-wine/ftnoir_winecontrols.ui b/proto-wine/ftnoir_winecontrols.ui index a0a1e071..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>544</width> - <height>410</height> + <width>934</width> + <height>466</height> </rect> </property> <property name="windowTitle"> @@ -32,8 +32,93 @@ <property name="title"> <string>Wine variant</string> </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="2" column="1" alignment="Qt::AlignRight"> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="1" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLineEdit" name="wine_path"> + <property name="enabled"> + <bool>false</bool> + </property> + <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><html><head/><body><p>wine/runner exectuable path</p></body></html></string> + </property> + <property name="inputMask"> + <string/> + </property> + <property name="placeholderText"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="browse_wine_path_button"> + <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> + </widget> + </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><html><head/><body><p>prefix</p></body></html></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"> @@ -47,10 +132,13 @@ <height>0</height> </size> </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> </widget> </item> - <item row="0" column="0"> - <widget class="QRadioButton" name="variant_wine"> + <item row="3" column="0"> + <widget class="QRadioButton" name="variant_proton"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -58,12 +146,12 @@ </sizepolicy> </property> <property name="text"> - <string>Wine (system)</string> + <string>Proton (select version and mode)</string> </property> </widget> </item> - <item row="2" column="0"> - <widget class="QRadioButton" name="variant_proton"> + <item row="0" column="0"> + <widget class="QRadioButton" name="variant_wine"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -71,24 +159,96 @@ </sizepolicy> </property> <property name="text"> - <string>Proton (Steam Play)</string> + <string>Wine (select version and prefix)</string> </property> </widget> </item> <item row="0" column="1"> - <widget class="QLineEdit" name="wineprefix"> + <widget class="QComboBox" name="wine_path_combo"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>286</width> - <height>0</height> - </size> - </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><html><head/><body><p>Steam Play is Steams System to run Windows titles on Linux via Proton.</p></body></html></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><html><head/><body><p>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.</p></body></html></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> @@ -100,6 +260,9 @@ <string>Advanced</string> </property> <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> <item> <widget class="QCheckBox" name="esync"> <property name="sizePolicy"> @@ -133,43 +296,79 @@ </widget> </item> <item> - <widget class="QWidget" name="widget" native="true"> + <widget class="QWidget" name="widget_2" native="true"> <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <layout class="QHBoxLayout" name="horizontalLayout"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="topMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> <item> - <widget class="QLabel" name="label"> + <widget class="QLabel" name="label_2"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="text"> - <string>Steam application id</string> + <string>Protocol</string> </property> </widget> </item> <item> - <widget class="QSpinBox" name="proton_appid"> + <widget class="QComboBox" name="protocol_selection"> <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="maximum"> - <number>2147483647</number> - </property> + <item> + <property name="text"> + <string>Freetrack</string> + </property> + </item> + <item> + <property name="text"> + <string>NPClient</string> + </property> + </item> + <item> + <property name="text"> + <string>Both</string> + </property> + </item> </widget> </item> </layout> </widget> </item> + <item> + <widget class="QWidget" name="widget" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="topMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + </layout> + </widget> + </item> </layout> </widget> </item> @@ -188,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 new file mode 100644 index 00000000..072c8626 --- /dev/null +++ b/proto-wine/lang/de_DE.ts @@ -0,0 +1,140 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="de_DE"> +<context> + <name>FTControls</name> + <message> + <source>Select path to Wine Binary</source> + <translation>Pfad des wine-Programms auswählen</translation> + </message> + <message> + <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> + <message> + <source>Wine settings</source> + <translation>Wine-Einstellungen</translation> + </message> + <message> + <source>Wine variant</source> + <translation>Wine-Variante</translation> + </message> + <message> + <source><html><head/><body><p>prefix</p></body></html></source> + <translation><html><head/><body><p>Prefix</p></body></html></translation> + </message> + <message> + <source>/path_to_the_prefix/</source> + <translation>/pfad_zum_prefix/</translation> + </message> + <message> + <source>Browse Prefix</source> + <translation>Prefix suchen</translation> + </message> + <message> + <source><html><head/><body><p>wine/runner exectuable path</p></body></html></source> + <translation><html><head/><body><p>Pfad zum ausführbaren wine/runner</p></body></html></translation> + </message> + <message> + <source>Browse Wine Path</source> + <translation>Wine-Pfad suchen</translation> + </message> + <message> + <source>Advanced</source> + <translation>Erweitert</translation> + </message> + <message> + <source><html><head/><body><p>When supported.</p></body></html></source> + <translation><html><head/><body><p>Falls unterstützt.</p></body></html></translation> + </message> + <message> + <source>ESYNC</source> + <translation>ESYNC</translation> + </message> + <message> + <source>FSYNC</source> + <translation>FSYNC</translation> + </message> + <message> + <source>Protocol</source> + <translation>Protokoll</translation> + </message> + <message> + <source>Freetrack</source> + <translation>Freetrack</translation> + </message> + <message> + <source>NPClient</source> + <translation>NPClient</translation> + </message> + <message> + <source>Both</source> + <translation>Beides</translation> + </message> + <message> + <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><html><head/><body><p>Steam Play is Steams System to run Windows titles on Linux via Proton.</p></body></html></source> + <translation><html><head/><body><p>Steam Play ist Steams System, um Windows Titel auf Linux, via Proton, auszuführen.</p></body></html></translation> + </message> + <message> + <source><html><head/><body><p>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.</p></body></html></source> + <translation><html><head/><body><p>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.</p></body></html></translation> + </message> +</context> +<context> + <name>wine</name> + <message> + <source>Must specify application id for Proton (Steam Play)</source> + <translation>Die Application-ID für Proton (Steam Play) muss angegeben werden</translation> + </message> + <message> + <source>Wine prefix must be an absolute path (given '%1')</source> + <translation>Wine-Prefix muss ein absoluter Pfad sein ('%1' angegeben)</translation> + </message> + <message> + <source>Failed to start Wine! Make sure the binary is set correctly.</source> + <translation>Starten von Wine fehlgeschlagen! Stelle sicher, dass der Programmpfad richtig gesetzt ist.</translation> + </message> + <message> + <source>Can'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> + <message> + <source>Wine -- Windows layer for Unix</source> + <translation>Wine -- Windows-Schicht für Unix</translation> + </message> + <message> + <source>X-Plane</source> + <translation>X-Plane</translation> + </message> +</context> +</TS> diff --git a/proto-wine/lang/nl_NL.ts b/proto-wine/lang/nl_NL.ts index f71d8ad7..bc3ef604 100644 --- a/proto-wine/lang/nl_NL.ts +++ b/proto-wine/lang/nl_NL.ts @@ -2,17 +2,28 @@ <!DOCTYPE TS> <TS version="2.1" language="nl_NL"> <context> - <name>UICFTControls</name> + <name>FTControls</name> <message> - <source>Wine settings</source> + <source>Select path to Wine Binary</source> <translation type="unfinished"></translation> </message> <message> - <source>Wine variant</source> + <source>Select Wine Prefix</source> <translation type="unfinished"></translation> </message> <message> - <source>Wine (system)</source> + <source>Select Proton Prefix</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>UICFTControls</name> + <message> + <source>Wine settings</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Wine variant</source> <translation type="unfinished"></translation> </message> <message> @@ -32,11 +43,63 @@ <translation type="unfinished"></translation> </message> <message> - <source>Steam application id</source> + <source>Protocol</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Freetrack</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>NPClient</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Both</source> <translation type="unfinished"></translation> </message> <message> - <source>Proton (Steam Play)</source> + <source><html><head/><body><p>prefix</p></body></html></source> + <translation type="unfinished"></translation> + </message> + <message> + <source>/path_to_the_prefix/</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Browse Prefix</source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head/><body><p>wine/runner exectuable path</p></body></html></source> + <translation type="unfinished"></translation> + </message> + <message> + <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><html><head/><body><p>Steam Play is Steams System to run Windows titles on Linux via Proton.</p></body></html></source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head/><body><p>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.</p></body></html></source> <translation type="unfinished"></translation> </message> </context> @@ -54,6 +117,14 @@ <source>Wine prefix must be an absolute path (given '%1')</source> <translation type="unfinished"></translation> </message> + <message> + <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 9937083f..a7702454 100644 --- a/proto-wine/lang/ru_RU.ts +++ b/proto-wine/lang/ru_RU.ts @@ -2,17 +2,28 @@ <!DOCTYPE TS> <TS version="2.1" language="ru_RU"> <context> - <name>UICFTControls</name> + <name>FTControls</name> <message> - <source>Wine settings</source> + <source>Select path to Wine Binary</source> <translation type="unfinished"></translation> </message> <message> - <source>Wine variant</source> + <source>Select Wine Prefix</source> <translation type="unfinished"></translation> </message> <message> - <source>Wine (system)</source> + <source>Select Proton Prefix</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>UICFTControls</name> + <message> + <source>Wine settings</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Wine variant</source> <translation type="unfinished"></translation> </message> <message> @@ -32,11 +43,63 @@ <translation type="unfinished"></translation> </message> <message> - <source>Steam application id</source> + <source>Protocol</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Freetrack</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>NPClient</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Both</source> <translation type="unfinished"></translation> </message> <message> - <source>Proton (Steam Play)</source> + <source><html><head/><body><p>prefix</p></body></html></source> + <translation type="unfinished"></translation> + </message> + <message> + <source>/path_to_the_prefix/</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Browse Prefix</source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head/><body><p>wine/runner exectuable path</p></body></html></source> + <translation type="unfinished"></translation> + </message> + <message> + <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><html><head/><body><p>Steam Play is Steams System to run Windows titles on Linux via Proton.</p></body></html></source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head/><body><p>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.</p></body></html></source> <translation type="unfinished"></translation> </message> </context> @@ -54,6 +117,14 @@ <source>Wine prefix must be an absolute path (given '%1')</source> <translation type="unfinished"></translation> </message> + <message> + <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 9b74a44d..2c708749 100644 --- a/proto-wine/lang/stub.ts +++ b/proto-wine/lang/stub.ts @@ -2,17 +2,28 @@ <!DOCTYPE TS> <TS version="2.1"> <context> - <name>UICFTControls</name> + <name>FTControls</name> <message> - <source>Wine settings</source> + <source>Select path to Wine Binary</source> <translation type="unfinished"></translation> </message> <message> - <source>Wine variant</source> + <source>Select Wine Prefix</source> <translation type="unfinished"></translation> </message> <message> - <source>Wine (system)</source> + <source>Select Proton Prefix</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>UICFTControls</name> + <message> + <source>Wine settings</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Wine variant</source> <translation type="unfinished"></translation> </message> <message> @@ -32,11 +43,63 @@ <translation type="unfinished"></translation> </message> <message> - <source>Steam application id</source> + <source>Protocol</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Freetrack</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>NPClient</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Both</source> <translation type="unfinished"></translation> </message> <message> - <source>Proton (Steam Play)</source> + <source><html><head/><body><p>prefix</p></body></html></source> + <translation type="unfinished"></translation> + </message> + <message> + <source>/path_to_the_prefix/</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Browse Prefix</source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head/><body><p>wine/runner exectuable path</p></body></html></source> + <translation type="unfinished"></translation> + </message> + <message> + <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><html><head/><body><p>Steam Play is Steams System to run Windows titles on Linux via Proton.</p></body></html></source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head/><body><p>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.</p></body></html></source> <translation type="unfinished"></translation> </message> </context> @@ -54,6 +117,14 @@ <source>Wine prefix must be an absolute path (given '%1')</source> <translation type="unfinished"></translation> </message> + <message> + <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 9b74a44d..6884f266 100644 --- a/proto-wine/lang/zh_CN.ts +++ b/proto-wine/lang/zh_CN.ts @@ -1,18 +1,29 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.1"> +<TS version="2.1" language="zh_CN"> <context> - <name>UICFTControls</name> + <name>FTControls</name> <message> - <source>Wine settings</source> + <source>Select path to Wine Binary</source> <translation type="unfinished"></translation> </message> <message> - <source>Wine variant</source> + <source>Select Wine Prefix</source> <translation type="unfinished"></translation> </message> <message> - <source>Wine (system)</source> + <source>Select Proton Prefix</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>UICFTControls</name> + <message> + <source>Wine settings</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Wine variant</source> <translation type="unfinished"></translation> </message> <message> @@ -32,11 +43,63 @@ <translation type="unfinished"></translation> </message> <message> - <source>Steam application id</source> + <source>Protocol</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Freetrack</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>NPClient</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Both</source> <translation type="unfinished"></translation> </message> <message> - <source>Proton (Steam Play)</source> + <source><html><head/><body><p>prefix</p></body></html></source> + <translation type="unfinished"></translation> + </message> + <message> + <source>/path_to_the_prefix/</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Browse Prefix</source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head/><body><p>wine/runner exectuable path</p></body></html></source> + <translation type="unfinished"></translation> + </message> + <message> + <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><html><head/><body><p>Steam Play is Steams System to run Windows titles on Linux via Proton.</p></body></html></source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head/><body><p>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.</p></body></html></source> <translation type="unfinished"></translation> </message> </context> @@ -54,6 +117,14 @@ <source>Wine prefix must be an absolute path (given '%1')</source> <translation type="unfinished"></translation> </message> + <message> + <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/opentrack-wrapper-wine-main.cxx b/proto-wine/opentrack-wrapper-wine-main.cxx index 3df3abc7..9248a212 100644 --- a/proto-wine/opentrack-wrapper-wine-main.cxx +++ b/proto-wine/opentrack-wrapper-wine-main.cxx @@ -5,7 +5,6 @@ #include <cstdio> #include "freetrackclient/fttypes.h" -#include "wine-shm.h" #include "compat/export.hpp" enum Axis { @@ -14,6 +13,7 @@ enum Axis { #define __WINE_OLE2_H #include "compat/shm.h" +#include "wine-shm.h" void create_registry_key(void); @@ -42,7 +42,6 @@ private: void* mem; void *hMutex, *hMapFile; }; -#include <windows.h> int main(void) { diff --git a/proto-wine/opentrack-wrapper-wine-windows.cxx b/proto-wine/opentrack-wrapper-wine-windows.cxx index 88ced502..c1d552e1 100644 --- a/proto-wine/opentrack-wrapper-wine-windows.cxx +++ b/proto-wine/opentrack-wrapper-wine-windows.cxx @@ -4,18 +4,22 @@ #define shm_wrapper ShmWine #define __WINE_OLE2_H +// OSX sdk 10.8 build error otherwise +#undef _LIBCPP_MSVCRT + #include "compat/shm.h" #include "compat/shm.cpp" #include "wine-shm.h" #include "compat/library-path.hpp" +#include <cstdlib> #include <cstring> +#include <sysexits.h> using std::strcat; -static void write_path(const char* key, const char* subkey) +static void write_path(const char* key, const char* subkey, bool path) { - char dir[8192]; - dir[sizeof(dir)-1] = '\0'; + char dir[8192] {}; if (GetCurrentDirectoryA(8192, dir) < 8190) { @@ -36,13 +40,32 @@ static void write_path(const char* key, const char* subkey) // there's always a leading and trailing slash strcat(dir, OPENTRACK_LIBRARY_PATH); //strcat(dir, "/"); + if (!path) + dir[0] = '\0'; (void) RegSetValueExA(hkpath, subkey, 0, REG_SZ, (BYTE*) dir, strlen(dir) + 1); RegCloseKey(hkpath); } } } -void create_registry_key(void) { - write_path("Software\\NaturalPoint\\NATURALPOINT\\NPClient Location", "Path"); - write_path("Software\\Freetrack\\FreeTrackClient", "Path"); +void create_registry_key(void) +{ + bool use_freetrack, use_npclient; + const char* env = getenv("OTR_WINE_PROTO"); + char* endptr; + if (!env) env = ""; + int selection = strtol(env, &endptr, 10); + if (*endptr) + selection = 0; + + switch (selection) + { + default: std::exit(EX_USAGE); + case 1: use_freetrack = true, use_npclient = false; break; + case 2: use_freetrack = false, use_npclient = true; break; + case 3: use_freetrack = true, use_npclient = true; break; + } + + write_path("Software\\NaturalPoint\\NATURALPOINT\\NPClient Location", "Path", use_npclient); + write_path("Software\\Freetrack\\FreeTrackClient", "Path", use_freetrack); } diff --git a/proto-wine/proton.cpp b/proto-wine/proton.cpp index 15306d26..998da748 100644 --- a/proto-wine/proton.cpp +++ b/proto-wine/proton.cpp @@ -7,56 +7,91 @@ #ifndef OTR_WINE_NO_WRAPPER +#include <QDebug> +#include <QDir> +#include <QFileInfo> #include <QtGlobal> -#include <QString> -#include <QProcessEnvironment> -QProcessEnvironment make_steam_environ(const QString& proton_version, int appid) +#include "proton.h" + +static const char* steam_paths[] = { + "/.steam/steam/steamapps/compatdata", + "/.local/share/Steam/steamapps/compatdata", + "/.steam/debian-installation/steamapps/compatdata", +}; + +static const char* runtime_paths[] = { + "/.local/share/Steam/ubuntu12_32/steam-runtime", + "/.steam/ubuntu12_32/steam-runtime", + "/.steam/debian-installation/ubuntu12_32/steam-runtime", +}; + + +std::tuple<QProcessEnvironment, QString, bool> make_steam_environ(const QString& proton_dist_path) { - auto ret = QProcessEnvironment::systemEnvironment(); + using ret = std::tuple<QProcessEnvironment, QString, bool>; + auto env = QProcessEnvironment::systemEnvironment(); + QString error = ""; QString home = qgetenv("HOME"); + QString runtime_path; auto expand = [&](QString x) { - x.replace("HOME", home); - x.replace("PROTON", proton_version); - return x; - }; + x.replace("HOME", home); + x.replace("PROTON_DIST_PATH", proton_dist_path); + x.replace("RUNTIME_PATH", runtime_path); + return x; + }; + + for (const char* path : runtime_paths) { + QDir dir(QDir::homePath() + path); + if (dir.exists()) + runtime_path = dir.absolutePath(); + } + + if (runtime_path.isEmpty()) + error = QString("Couldn't find a Steam runtime."); 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" + ":PROTON_DIST_PATH/bin" ); path += ':'; path += qgetenv("PATH"); - ret.insert("PATH", path); + env.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" + ":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" + ":RUNTIME_PATH/i386/lib" + ":RUNTIME_PATH/i386/usr/lib/i386-linux-gnu" + ":RUNTIME_PATH/i386/usr/lib" + ":RUNTIME_PATH/amd64/lib/x86_64-linux-gnu" + ":RUNTIME_PATH/amd64/lib" + ":RUNTIME_PATH/amd64/usr/lib/x86_64-linux-gnu" + ":RUNTIME_PATH/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)); + env.insert("LD_LIBRARY_PATH", library_path); - return ret; + return ret(env, error, error.isEmpty()); } -QString proton_path(const QString& proton_version) + +std::tuple<QString, QString, bool> make_wineprefix(int appid) { - 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; + 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 diff --git a/proto-wine/wine-shm.h b/proto-wine/wine-shm.h index 536f647f..62e8bbec 100644 --- a/proto-wine/wine-shm.h +++ b/proto-wine/wine-shm.h @@ -8,17 +8,10 @@ # pragma clang diagnostic ignored "-Wreserved-id-macro" #endif -// OSX sdk 10.8 build error otherwise -#undef _LIBCPP_MSVCRT - #ifdef __clang__ # pragma clang diagnostic pop #endif -#include <memory> - -template<typename t> using ptr = std::shared_ptr<t>; - struct WineSHM { double data[6]; int gameid, gameid2; |