From 15cb7d664f612fc108cdfc18f3debdb1ac7cfb6f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 25 Apr 2013 15:11:58 +0200 Subject: Unbreak Wine plugin --- ftnoir_protocol_wine/ftnoir_protocol_wine.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'ftnoir_protocol_wine/ftnoir_protocol_wine.cpp') diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp index bc1e862a..2f4e64e7 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp @@ -35,16 +35,13 @@ Now it works direcly in shared memory! */ #include "ftnoir_protocol_wine.h" -#include "facetracknoir/global-settings.h" -#include "fttypes.h" - #include #include #include /* For mode constants */ #include /* For O_* constants */ /** constructor **/ -FTNoIR_Protocol::FTNoIR_Protocol() : lck_shm(WINE_SHM_NAME, WINE_MTX_NAME, sizeof(WineSHM)), shm(NULL) +FTNoIR_Protocol::FTNoIR_Protocol() : lck_shm(WINE_SHM_NAME, WINE_MTX_NAME, sizeof(WineSHM)), shm(NULL), gameid(0) { if (lck_shm.mem != (void*) -1) { shm = (WineSHM*) lck_shm.mem; @@ -68,16 +65,24 @@ void FTNoIR_Protocol::Initialize() wrapper.start("wine", QStringList() << (QCoreApplication::applicationDirPath() + "/ftnoir-wrapper-wine.exe.so")); } -void FTNoIR_Protocol::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) { +void FTNoIR_Protocol::sendHeadposeToGame( double *headpose, double *rawheadpose ) { if (shm) { lck_shm.lock(); - shm->rx = headpose->yaw / 57.295781; - shm->ry = headpose->pitch / 57.295781; - shm->rz = headpose->roll / 57.295781; - shm->tx = headpose->x * 10; - shm->ty = headpose->y * 10; - shm->tz = headpose->z * 10; + for (int i = 0; i < 3; i++) + shm->data[i] = headpose[i] / 57.295781; + for (int i = 3; i < 6; i++) + shm->data[i] = headpose[i] * 10; + if (shm->gameid != gameid) + { + QString id_str = QString::number(gameid); + QString gamename; + /* only EZCA for FSX requires dummy process, and FSX doesn't work on Linux */ + /* memory-hacks DLL can't be loaded into a Linux process, either */ + bool tmp1, tmp2; + CSV::getGameData(id_str, tmp1, tmp2, shm->table, gamename); + gameid = shm->gameid2 = shm->gameid; + } lck_shm.unlock(); } } -- cgit v1.2.3