summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp
diff options
context:
space:
mode:
authorDonovan Baarda <abo@minkirri.apana.org.au>2014-06-12 14:53:43 +1000
committerDonovan Baarda <abo@minkirri.apana.org.au>2014-06-12 14:53:43 +1000
commit0669a40347ffa233bc6042b0f65d244509a61394 (patch)
tree36a4577bdaa1ed28ca1ad222a54777012dd2dda8 /ftnoir_protocol_wine/ftnoir_protocol_wine.cpp
parent72540e0a96a3120a5d02271e714aba29e136ab78 (diff)
parent7454496476ba17ea622781d280606161581c9544 (diff)
Merge branch 'master' of https://github.com/opentrack/opentrack into dev/ewma2
Resolved conflicts manually in files: ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp ftnoir_filter_ewma2/ftnoir_filter_ewma2.h
Diffstat (limited to 'ftnoir_protocol_wine/ftnoir_protocol_wine.cpp')
-rw-r--r--ftnoir_protocol_wine/ftnoir_protocol_wine.cpp53
1 files changed, 11 insertions, 42 deletions
diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp
index bb877cc6..58ffe974 100644
--- a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp
+++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp
@@ -1,39 +1,3 @@
-/********************************************************************************
-* FaceTrackNoIR This program is a private project of the some enthusiastic *
-* gamers from Holland, who don't like to pay much for *
-* head-tracking. *
-* *
-* Copyright (C) 2010 Wim Vriend (Developing) *
-* Ron Hendriks (Researching and Testing) *
-* *
-* Homepage *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU General Public License as published by the *
-* Free Software Foundation; either version 3 of the License, or (at your *
-* option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but *
-* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
-* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
-* more details. *
-* *
-* You should have received a copy of the GNU General Public License along *
-* with this program; if not, see <http://www.gnu.org/licenses/>. *
-* *
-* FTServer FTServer is the Class, that communicates headpose-data *
-* to games, using the FreeTrackClient.dll. *
-********************************************************************************/
-/*
- Modifications (last one on top):
- 20110401 - WVR: Moved protocol to a DLL, convenient for installation etc.
- 20101224 - WVR: Base class is no longer inheriting QThread. sendHeadposeToGame
- is called from run() of Tracker.cpp
- 20100601 - WVR: Added Mutex-bit in run(). Thought it wasn't so important (still do...).
- 20100523 - WVR: Implemented the Freetrack-protocol just like Freetrack does. Earlier
- FaceTrackNoIR only worked with an adapted DLL, with a putdata function.
- Now it works direcly in shared memory!
-*/
#include "ftnoir_protocol_wine.h"
#include <string.h>
#include <sys/mman.h>
@@ -43,7 +7,7 @@
/** constructor **/
FTNoIR_Protocol::FTNoIR_Protocol() : lck_shm(WINE_SHM_NAME, WINE_MTX_NAME, sizeof(WineSHM)), shm(NULL), gameid(0)
{
- if (lck_shm.mem != (void*) -1) {
+ if (lck_shm.success()) {
shm = (WineSHM*) lck_shm.mem;
memset(shm, 0, sizeof(*shm));
}
@@ -55,13 +19,18 @@ FTNoIR_Protocol::~FTNoIR_Protocol()
{
if (shm) {
shm->stop = true;
- wrapper.waitForFinished(2000);
+ wrapper.waitForFinished(100);
}
- wrapper.kill();
- shm_unlink("/" WINE_SHM_NAME);
+ wrapper.terminate();
+ if (!wrapper.waitForFinished(100))
+ {
+ wrapper.kill();
+ wrapper.waitForFinished(42);
+ }
+ //shm_unlink("/" WINE_SHM_NAME);
}
-void FTNoIR_Protocol::sendHeadposeToGame( double *headpose, double *rawheadpose ) {
+void FTNoIR_Protocol::sendHeadposeToGame( const double *headpose ) {
if (shm)
{
lck_shm.lock();
@@ -89,7 +58,7 @@ void FTNoIR_Protocol::sendHeadposeToGame( double *headpose, double *rawheadpose
//
bool FTNoIR_Protocol::checkServerInstallationOK()
{
- return lck_shm.mem != (void*)-1;
+ return lck_shm.success();
}
////////////////////////////////////////////////////////////////////////////////