summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--proto-wine/CMakeLists.txt2
-rw-r--r--proto-wine/ftnoir_protocol_wine.cpp10
-rw-r--r--proto-wine/opentrack-wrapper-wine-windows.cxx9
3 files changed, 17 insertions, 4 deletions
diff --git a/proto-wine/CMakeLists.txt b/proto-wine/CMakeLists.txt
index 71443b82..1ed8fac6 100644
--- a/proto-wine/CMakeLists.txt
+++ b/proto-wine/CMakeLists.txt
@@ -14,7 +14,7 @@ if(NOT WIN32)
OUTPUT opentrack-wrapper-wine.exe.so
DEPENDS ${wine-deps}
COMMAND ${SDK_WINE_PREFIX}/bin/wineg++ -g -DNOMINMAX -O2 -m32 -std=c++11 -o
- opentrack-wrapper-wine.exe -I "${CMAKE_SOURCE_DIR}"
+ opentrack-wrapper-wine.exe -I "${CMAKE_SOURCE_DIR}" -I "${CMAKE_BINARY_DIR}"
${wine-deps}
${my-rt})
add_custom_target(wine-wrapper ALL DEPENDS opentrack-wrapper-wine.exe.so)
diff --git a/proto-wine/ftnoir_protocol_wine.cpp b/proto-wine/ftnoir_protocol_wine.cpp
index 99ad30a2..d99164c6 100644
--- a/proto-wine/ftnoir_protocol_wine.cpp
+++ b/proto-wine/ftnoir_protocol_wine.cpp
@@ -1,4 +1,8 @@
#include "ftnoir_protocol_wine.h"
+#include "opentrack/library-path.hpp"
+#include <QString>
+#include <QStringList>
+#include <QCoreApplication>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h> /* For mode constants */
@@ -11,7 +15,8 @@ FTNoIR_Protocol::FTNoIR_Protocol() : lck_shm(WINE_SHM_NAME, WINE_MTX_NAME, sizeo
shm = (WineSHM*) lck_shm.ptr();
memset(shm, 0, sizeof(*shm));
}
- wrapper.start("wine", QStringList() << (QCoreApplication::applicationDirPath() + "/opentrack-wrapper-wine.exe.so"));
+ static const QString library_path(opentrack_library_path);
+ wrapper.start("wine", QStringList() << (QCoreApplication::applicationDirPath() + library_path + "opentrack-wrapper-wine.exe.so"));
}
FTNoIR_Protocol::~FTNoIR_Protocol()
@@ -29,7 +34,8 @@ FTNoIR_Protocol::~FTNoIR_Protocol()
//shm_unlink("/" WINE_SHM_NAME);
}
-void FTNoIR_Protocol::pose( const double *headpose ) {
+void FTNoIR_Protocol::pose( const double *headpose )
+{
if (shm)
{
lck_shm.lock();
diff --git a/proto-wine/opentrack-wrapper-wine-windows.cxx b/proto-wine/opentrack-wrapper-wine-windows.cxx
index 19ee8ffd..6604c626 100644
--- a/proto-wine/opentrack-wrapper-wine-windows.cxx
+++ b/proto-wine/opentrack-wrapper-wine-windows.cxx
@@ -6,10 +6,15 @@
#include "opentrack-compat/shm.h"
#include "opentrack-compat/shm.cpp"
#include "wine-shm.h"
+#include "opentrack-library-path.h"
+#include <cstring>
+
+using std::strcat;
static void write_path(const char* key, const char* subkey)
{
char dir[8192];
+ dir[sizeof(dir)-1] = '\0';
if (GetCurrentDirectoryA(8192, dir) < 8190)
{
@@ -27,7 +32,9 @@ static void write_path(const char* key, const char* subkey)
for (int i = 0; dir[i]; i++)
if (dir[i] == '\\')
dir[i] = '/';
- strcat(dir, "/");
+ // there's always a leading and trailing slash
+ strcat(dir, OPENTRACK_LIBRARY_PATH);
+ //strcat(dir, "/");
(void) RegSetValueExA(hkpath, subkey, 0, REG_SZ, (BYTE*) dir, strlen(dir) + 1);
RegCloseKey(hkpath);
}