From 4c04337f46470180312812634beb0e39a04bcf9f Mon Sep 17 00:00:00 2001 From: Wim Vriend Date: Fri, 26 Nov 2010 19:55:00 +0000 Subject: Changed update-sequence for FSX and FS2004. No data is written, if the headpose-data has not changed. This way, it is possible to use the HAT-switch, if tracking is OFF. The FTIRServer now also starts the dummy TrackIR.exe process, which is required by some clients, like EZCA. git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@29 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb --- FaceTrackNoIR/FTIRServer.cpp | 16 +++++++++++++++ FaceTrackNoIR/FTIRServer.h | 3 ++- FaceTrackNoIR/SCServer.cpp | 25 ++++++++++++++++++++++-- FaceTrackNoIR/UIElements/aboutFaceTrackNoIR.bmp | Bin 357334 -> 0 bytes FaceTrackNoIR/UIElements/aboutFaceTrackNoIR.png | Bin 28784 -> 28783 bytes 5 files changed, 41 insertions(+), 3 deletions(-) delete mode 100644 FaceTrackNoIR/UIElements/aboutFaceTrackNoIR.bmp (limited to 'FaceTrackNoIR') diff --git a/FaceTrackNoIR/FTIRServer.cpp b/FaceTrackNoIR/FTIRServer.cpp index 1de4ee87..5c4369b3 100644 --- a/FaceTrackNoIR/FTIRServer.cpp +++ b/FaceTrackNoIR/FTIRServer.cpp @@ -64,6 +64,13 @@ FTIRServer::~FTIRServer() { FTIRClientLib.unload(); FTIRViewsLib.unload(); + // + // Kill the dummy TrackIR process. + // + if (dummyTrackIR) { + dummyTrackIR->kill(); + } + //terminates the QThread and waits for finishing the QThread terminate(); wait(); @@ -274,6 +281,15 @@ bool FTIRServer::FTIRCheckClientDLL() FTIRViewsLib.load(); } + // + // Start TrackIR.exe, also to support some older games and EZCA + // Some TrackIR clients check if a process called TrackIR.exe is running. + // This should do the trick + // + QString program = "TrackIR.exe"; + dummyTrackIR = new QProcess(this); + dummyTrackIR->start(program); + } catch(...) { settings.~QSettings(); } diff --git a/FaceTrackNoIR/FTIRServer.h b/FaceTrackNoIR/FTIRServer.h index 8585b30f..2ffc1653 100644 --- a/FaceTrackNoIR/FTIRServer.h +++ b/FaceTrackNoIR/FTIRServer.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include typedef void (WINAPI *importSetPosition)(float x, float y, float z, float xRot, float yRot, float zRot); typedef void (WINAPI *importTIRViewsStart)(void); @@ -74,6 +74,7 @@ private: QLibrary FTIRClientLib; QLibrary FTIRViewsLib; bool useTIRViews; + QProcess *dummyTrackIR; static float scale2AnalogLimits( float x, float min_x, float max_x ); void loadSettings(); diff --git a/FaceTrackNoIR/SCServer.cpp b/FaceTrackNoIR/SCServer.cpp index 30b0b2e9..fbbd92a3 100644 --- a/FaceTrackNoIR/SCServer.cpp +++ b/FaceTrackNoIR/SCServer.cpp @@ -76,6 +76,8 @@ importSimConnect_Open simconnect_open; // SimConnect function(s) in DLL importSimConnect_Close simconnect_close; importSimConnect_CameraSetRelative6DOF simconnect_set6DOF; +float prevPosX, prevPosY, prevPosZ, prevRotX, prevRotY, prevRotZ; + // // Get the SimConnect_Open function from the DLL and use it! // @@ -97,6 +99,13 @@ importSimConnect_CameraSetRelative6DOF simconnect_set6DOF; qDebug() << "SCServer::run() says: SimConnect functions resolved in DLL!"; + prevPosX = 0.0f; + prevPosY = 0.0f; + prevPosZ = 0.0f; + prevRotX = 0.0f; + prevRotY = 0.0f; + prevRotZ = 0.0f; + forever { // Check event for stop thread @@ -122,10 +131,22 @@ importSimConnect_CameraSetRelative6DOF simconnect_set6DOF; // // Write the 6DOF-data to FSX // - if (S_OK == simconnect_set6DOF(hSimConnect, virtPosX, virtPosY, virtPosZ, virtRotX, virtRotZ, virtRotY)) { -// qDebug() << "SCServer::run() says: SimConnect data written!"; + // Only do this when the data has changed. This way, the HAT-switch can be used when tracking is OFF. + // + if ((prevPosX != virtPosX) || (prevPosY != virtPosY) || (prevPosZ != virtPosZ) || + (prevRotX != virtRotX) || (prevRotY != virtRotY) || (prevRotZ != virtRotZ)) { + if (S_OK == simconnect_set6DOF(hSimConnect, virtPosX, virtPosY, virtPosZ, virtRotX, virtRotZ, virtRotY)) { +// qDebug() << "SCServer::run() says: SimConnect data written!"; + } } + prevPosX = virtPosX; + prevPosY = virtPosY; + prevPosZ = virtPosZ; + prevRotX = virtRotX; + prevRotY = virtRotY; + prevRotZ = virtRotZ; + // just for lower cpu load msleep(15); yieldCurrentThread(); diff --git a/FaceTrackNoIR/UIElements/aboutFaceTrackNoIR.bmp b/FaceTrackNoIR/UIElements/aboutFaceTrackNoIR.bmp deleted file mode 100644 index 53af1ef9..00000000 Binary files a/FaceTrackNoIR/UIElements/aboutFaceTrackNoIR.bmp and /dev/null differ diff --git a/FaceTrackNoIR/UIElements/aboutFaceTrackNoIR.png b/FaceTrackNoIR/UIElements/aboutFaceTrackNoIR.png index 6b0e0d68..97ff1d1f 100644 Binary files a/FaceTrackNoIR/UIElements/aboutFaceTrackNoIR.png and b/FaceTrackNoIR/UIElements/aboutFaceTrackNoIR.png differ -- cgit v1.2.3