summaryrefslogtreecommitdiffhomepage
path: root/proto-wine
diff options
context:
space:
mode:
Diffstat (limited to 'proto-wine')
-rw-r--r--proto-wine/ftnoir_protocol_wine.cpp4
-rw-r--r--proto-wine/ftnoir_protocol_wine.h1
-rw-r--r--proto-wine/ftnoir_protocol_wine_dialog.cpp1
-rw-r--r--proto-wine/ftnoir_winecontrols.ui113
-rw-r--r--proto-wine/lang/nl_NL.ts16
-rw-r--r--proto-wine/lang/ru_RU.ts16
-rw-r--r--proto-wine/lang/stub.ts16
-rw-r--r--proto-wine/lang/zh_CN.ts16
-rw-r--r--proto-wine/opentrack-wrapper-wine-windows.cxx30
9 files changed, 183 insertions, 30 deletions
diff --git a/proto-wine/ftnoir_protocol_wine.cpp b/proto-wine/ftnoir_protocol_wine.cpp
index 5d46f18a..5955b507 100644
--- a/proto-wine/ftnoir_protocol_wine.cpp
+++ b/proto-wine/ftnoir_protocol_wine.cpp
@@ -19,6 +19,8 @@ wine::~wine()
if (shm) {
shm->stop = true;
exit = wrapper.waitForFinished(100);
+ if (exit)
+ qDebug() << "proto/wine: wrapper exit code" << wrapper.exitCode();
}
if (!exit)
{
@@ -92,6 +94,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" });
diff --git a/proto-wine/ftnoir_protocol_wine.h b/proto-wine/ftnoir_protocol_wine.h
index 8175be03..0e48e5b5 100644
--- a/proto-wine/ftnoir_protocol_wine.h
+++ b/proto-wine/ftnoir_protocol_wine.h
@@ -26,6 +26,7 @@ struct settings : opts
value<int> proton_appid{b, "proton-appid", 0};
value<QString> proton_version{b, "proton-version", {} },
wineprefix{b, "wineprefix", "~/.wine"};
+ value<int> protocol{b, "protocol", 2};
};
class wine : TR, public IProtocol
diff --git a/proto-wine/ftnoir_protocol_wine_dialog.cpp b/proto-wine/ftnoir_protocol_wine_dialog.cpp
index f1cb01c2..a0e7b488 100644
--- a/proto-wine/ftnoir_protocol_wine_dialog.cpp
+++ b/proto-wine/ftnoir_protocol_wine_dialog.cpp
@@ -20,6 +20,7 @@ FTControls::FTControls()
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);
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 a0a1e071..e9541447 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>528</width>
+ <height>424</height>
</rect>
</property>
<property name="windowTitle">
@@ -33,6 +33,19 @@
<string>Wine variant</string>
</property>
<layout class="QGridLayout" name="gridLayout">
+ <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="1" alignment="Qt::AlignRight">
<widget class="QComboBox" name="proton_version">
<property name="sizePolicy">
@@ -49,16 +62,19 @@
</property>
</widget>
</item>
- <item row="0" column="0">
- <widget class="QRadioButton" name="variant_wine">
+ <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="text">
- <string>Wine (system)</string>
+ <property name="minimumSize">
+ <size>
+ <width>286</width>
+ <height>0</height>
+ </size>
</property>
</widget>
</item>
@@ -75,22 +91,6 @@
</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>
@@ -100,6 +100,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,18 +136,80 @@
</widget>
</item>
<item>
+ <widget class="QWidget" name="widget_2" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <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_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Protocol</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="protocol_selection">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </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="Preferred">
+ <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>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
diff --git a/proto-wine/lang/nl_NL.ts b/proto-wine/lang/nl_NL.ts
index f71d8ad7..e2183cc8 100644
--- a/proto-wine/lang/nl_NL.ts
+++ b/proto-wine/lang/nl_NL.ts
@@ -39,6 +39,22 @@
<source>Proton (Steam Play)</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <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>
</context>
<context>
<name>wine</name>
diff --git a/proto-wine/lang/ru_RU.ts b/proto-wine/lang/ru_RU.ts
index 9937083f..f3b44bd2 100644
--- a/proto-wine/lang/ru_RU.ts
+++ b/proto-wine/lang/ru_RU.ts
@@ -39,6 +39,22 @@
<source>Proton (Steam Play)</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <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>
</context>
<context>
<name>wine</name>
diff --git a/proto-wine/lang/stub.ts b/proto-wine/lang/stub.ts
index 9b74a44d..dd4f946f 100644
--- a/proto-wine/lang/stub.ts
+++ b/proto-wine/lang/stub.ts
@@ -39,6 +39,22 @@
<source>Proton (Steam Play)</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <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>
</context>
<context>
<name>wine</name>
diff --git a/proto-wine/lang/zh_CN.ts b/proto-wine/lang/zh_CN.ts
index 9b74a44d..dd4f946f 100644
--- a/proto-wine/lang/zh_CN.ts
+++ b/proto-wine/lang/zh_CN.ts
@@ -39,6 +39,22 @@
<source>Proton (Steam Play)</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <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>
</context>
<context>
<name>wine</name>
diff --git a/proto-wine/opentrack-wrapper-wine-windows.cxx b/proto-wine/opentrack-wrapper-wine-windows.cxx
index 08e9882a..fb59eb43 100644
--- a/proto-wine/opentrack-wrapper-wine-windows.cxx
+++ b/proto-wine/opentrack-wrapper-wine-windows.cxx
@@ -14,10 +14,9 @@
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)
{
@@ -38,13 +37,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);
}