summaryrefslogtreecommitdiffhomepage
path: root/FaceTrackNoIR
diff options
context:
space:
mode:
Diffstat (limited to 'FaceTrackNoIR')
-rw-r--r--FaceTrackNoIR/FTIRServer.cpp16
-rw-r--r--FaceTrackNoIR/FTIRServer.h3
-rw-r--r--FaceTrackNoIR/SCServer.cpp25
-rw-r--r--FaceTrackNoIR/UIElements/aboutFaceTrackNoIR.bmpbin357334 -> 0 bytes
-rw-r--r--FaceTrackNoIR/UIElements/aboutFaceTrackNoIR.pngbin28784 -> 28783 bytes
5 files changed, 41 insertions, 3 deletions
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 <QThread>
#include <QMutex>
#include <QLibrary>
-#include <QUdpSocket>
+#include <QProcess>
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
--- a/FaceTrackNoIR/UIElements/aboutFaceTrackNoIR.bmp
+++ /dev/null
Binary files differ
diff --git a/FaceTrackNoIR/UIElements/aboutFaceTrackNoIR.png b/FaceTrackNoIR/UIElements/aboutFaceTrackNoIR.png
index 6b0e0d68..97ff1d1f 100644
--- a/FaceTrackNoIR/UIElements/aboutFaceTrackNoIR.png
+++ b/FaceTrackNoIR/UIElements/aboutFaceTrackNoIR.png
Binary files differ