summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--FaceTrackNoIR.suobin269312 -> 279040 bytes
-rw-r--r--FaceTrackNoIR/FGServer.h26
-rw-r--r--FaceTrackNoIR/FTIRServer.cpp23
-rw-r--r--FaceTrackNoIR/FTIRServer.h37
-rw-r--r--FaceTrackNoIR/FTServer.cpp11
-rw-r--r--FaceTrackNoIR/FTServer.h39
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.ui31
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.vcproj61
-rw-r--r--FaceTrackNoIR/PPJoyServer.h17
-rw-r--r--FaceTrackNoIR/SCServer.cpp16
-rw-r--r--FaceTrackNoIR/SCServer.h34
-rw-r--r--FaceTrackNoIR/tracker.cpp213
-rw-r--r--FaceTrackNoIR/tracker.h14
-rw-r--r--List of compatible games.xlsbin22528 -> 22016 bytes
-rw-r--r--bin/FaceTrackNoIR.exebin712704 -> 716800 bytes
-rw-r--r--bin/Settings/ArmA.ini10
-rw-r--r--bin/Settings/FlightGear.ini20
-rw-r--r--bin/Settings/GlovePIE.ini25
-rw-r--r--bin/Settings/SimConnect.ini18
19 files changed, 231 insertions, 364 deletions
diff --git a/FaceTrackNoIR.suo b/FaceTrackNoIR.suo
index 0a316a5f..1afe4d6a 100644
--- a/FaceTrackNoIR.suo
+++ b/FaceTrackNoIR.suo
Binary files differ
diff --git a/FaceTrackNoIR/FGServer.h b/FaceTrackNoIR/FGServer.h
index c4d8d516..8b61f920 100644
--- a/FaceTrackNoIR/FGServer.h
+++ b/FaceTrackNoIR/FGServer.h
@@ -29,6 +29,7 @@
#ifndef INCLUDED_FGSERVER_H
#define INCLUDED_FGSERVER_H
+#include "FTNoIR_cxx_protocolserver.h"
#include "FGTypes.h"
#include <QString>
#include <QMessageBox>
@@ -42,12 +43,13 @@
#include <QUdpSocket>
using namespace std;
+using namespace v4friend::ftnoir;
#include "ui_FTNoIR_FGcontrols.h"
class Tracker; // pre-define parent-class to avoid circular includes
-class FGServer : public QThread {
+class FGServer : public ProtocolServerBase {
Q_OBJECT
public:
@@ -65,10 +67,6 @@ private slots:
void readPendingDatagrams();
private:
- // Handles to neatly terminate thread...
- HANDLE m_StopThread;
- HANDLE m_WaitThread;
-
Tracker *headTracker; // For upstream messages...
TFlightGearData TestData;
QUdpSocket *inSocket; // Receive from FligthGear
@@ -77,25 +75,7 @@ private:
QHostAddress destIP; // Destination IP-address
int destPort; // Destination port-number
- /** member variables for saving the head pose **/
- float virtPosX;
- float virtPosY;
- float virtPosZ;
-
- float virtRotX;
- float virtRotY;
- float virtRotZ;
-
void loadSettings();
-
-public:
- void setVirtRotX(float rot) { virtRotX = rot; }
- void setVirtRotY(float rot) { virtRotY = rot; }
- void setVirtRotZ(float rot) { virtRotZ = rot; }
- void setVirtPosX(float pos) { virtPosX = pos / 100.0f; }
- void setVirtPosY(float pos) { virtPosY = pos / 100.0f; }
- void setVirtPosZ(float pos) { virtPosZ = pos / 100.0f; }
-
};
// Widget that has controls for FG server-settings.
diff --git a/FaceTrackNoIR/FTIRServer.cpp b/FaceTrackNoIR/FTIRServer.cpp
index 5c4369b3..5ecd9622 100644
--- a/FaceTrackNoIR/FTIRServer.cpp
+++ b/FaceTrackNoIR/FTIRServer.cpp
@@ -25,15 +25,6 @@
*/
#include "FTIRServer.h"
-
-float FTIRServer::virtPosX = 0.0f;
-float FTIRServer::virtPosY = 0.0f;
-float FTIRServer::virtPosZ = 0.0f;
-
-float FTIRServer::virtRotX = 0.0f;
-float FTIRServer::virtRotY = 0.0f;
-float FTIRServer::virtRotZ = 0.0f;
-
/** constructor **/
FTIRServer::FTIRServer() {
@@ -67,6 +58,7 @@ FTIRServer::~FTIRServer() {
//
// Kill the dummy TrackIR process.
//
+ qDebug() << "FTIRServer::~FTIRServer() about to kill TrackIR.exe process";
if (dummyTrackIR) {
dummyTrackIR->kill();
}
@@ -156,14 +148,12 @@ void FTIRServer::run() {
}
//
-// Create a memory-mapping to the Freetrack data.
+// Create a memory-mapping to the TrackIR data.
// It contains the tracking data, a handle to the main-window and the program-name of the Game!
//
//
-bool FTIRServer::FTIRCreateMapping(HANDLE handle)
+bool FTIRServer::FTIRCreateMapping( HANDLE handle )
{
- bool result;
-
qDebug() << "FTIRCreateMapping says: Starting Function";
//
@@ -202,8 +192,7 @@ bool FTIRServer::FTIRCreateMapping(HANDLE handle)
return false;
}
- result = false;
-return result;
+ return true;
}
//
@@ -224,7 +213,7 @@ void FTIRServer::FTIRDestroyMapping()
// Check if the Client DLL exists and load it (to test it), if so.
// Returns 'true' if all seems OK.
//
-bool FTIRServer::FTIRCheckClientDLL()
+bool FTIRServer::checkServerInstallationOK( HANDLE handle )
{
QSettings settings("NaturalPoint", "NATURALPOINT\\NPClient Location"); // Registry settings (in HK_USER)
QString aLocation; // Location of Client DLL
@@ -293,7 +282,7 @@ bool FTIRServer::FTIRCheckClientDLL()
} catch(...) {
settings.~QSettings();
}
- return true;
+ return FTIRCreateMapping( handle );
}
//
diff --git a/FaceTrackNoIR/FTIRServer.h b/FaceTrackNoIR/FTIRServer.h
index 2ffc1653..98273bc5 100644
--- a/FaceTrackNoIR/FTIRServer.h
+++ b/FaceTrackNoIR/FTIRServer.h
@@ -23,6 +23,7 @@
#ifndef INCLUDED_FTIRSERVER_H
#define INCLUDED_FTIRSERVER_H
+#include "FTNoIR_cxx_protocolserver.h"
#include "FTIRTypes.h"
#include <QString>
#include <QMessageBox>
@@ -42,8 +43,9 @@ typedef void (WINAPI *importTIRViewsStop)(void);
#include "ui_FTNoIR_FTIRcontrols.h"
using namespace std;
+using namespace v4friend::ftnoir;
-class FTIRServer : public QThread {
+class FTIRServer : public ProtocolServerBase {
Q_OBJECT
public:
@@ -52,18 +54,14 @@ public:
FTIRServer();
~FTIRServer();
- bool FTIRCreateMapping(HANDLE handle);
- void FTIRDestroyMapping();
- bool FTIRCheckClientDLL();
-
// protected member methods
protected:
void run();
+ bool checkServerInstallationOK( HANDLE handle );
private:
- // Handles to neatly terminate thread...
- HANDLE m_StopThread;
- HANDLE m_WaitThread;
+ bool FTIRCreateMapping(HANDLE handle);
+ void FTIRDestroyMapping();
HANDLE hFTIRMemMap;
FTIRMemMap *pMemData;
@@ -80,24 +78,13 @@ private:
void loadSettings();
public:
+ void setVirtRotX(float rot) { virtRotX = scale2AnalogLimits (rot, -180.0f, 180.0f); }
+ void setVirtRotY(float rot) { virtRotY = scale2AnalogLimits (rot, -180.0f, 180.0f); }
+ void setVirtRotZ(float rot) { virtRotZ = scale2AnalogLimits (rot, -180.0f, 180.0f); }
- // Settings for calculating the Virtual Pose
- static float virtPosX;
- static float virtPosY;
- static float virtPosZ;
-
- static float virtRotX;
- static float virtRotY;
- static float virtRotZ;
-
- static void setVirtRotX(float rot) { virtRotX = scale2AnalogLimits (rot, -180.0f, 180.0f); }
- static void setVirtRotY(float rot) { virtRotY = scale2AnalogLimits (rot, -180.0f, 180.0f); }
- static void setVirtRotZ(float rot) { virtRotZ = scale2AnalogLimits (rot, -180.0f, 180.0f); }
-
- static void setVirtPosX(float pos) { virtPosX = scale2AnalogLimits (pos * 10.0f, -500.0f, 500.0f); }
- static void setVirtPosY(float pos) { virtPosY = scale2AnalogLimits (pos * 10.0f, -500.0f, 500.0f); }
- static void setVirtPosZ(float pos) { virtPosZ = scale2AnalogLimits (pos * 10.0f, -500.0f, 500.0f); }
-
+ void setVirtPosX(float pos) { virtPosX = scale2AnalogLimits (pos * 10.0f, -500.0f, 500.0f); }
+ void setVirtPosY(float pos) { virtPosY = scale2AnalogLimits (pos * 10.0f, -500.0f, 500.0f); }
+ void setVirtPosZ(float pos) { virtPosZ = scale2AnalogLimits (pos * 10.0f, -500.0f, 500.0f); }
};
// Widget that has controls for FTIR server-settings.
diff --git a/FaceTrackNoIR/FTServer.cpp b/FaceTrackNoIR/FTServer.cpp
index 2bd3d5f5..27808343 100644
--- a/FaceTrackNoIR/FTServer.cpp
+++ b/FaceTrackNoIR/FTServer.cpp
@@ -154,8 +154,6 @@ void FTServer::run() {
//
bool FTServer::FTCreateMapping(HANDLE handle)
{
- bool result;
-
qDebug() << "FTCreateMapping says: Starting Function";
//
@@ -194,8 +192,7 @@ bool FTServer::FTCreateMapping(HANDLE handle)
return false;
}
- result = false;
-return result;
+ return true;
}
//
@@ -215,7 +212,7 @@ void FTServer::FTDestroyMapping()
//
// Get the program-name from the client (Game!).
//
-QString FTServer::FTGetProgramName() {
+QString FTServer::GetProgramName() {
QString *str;
str = new QString(pMemData->ProgramName);
@@ -227,7 +224,7 @@ QString *str;
// Check if the Client DLL exists and load it (to test it), if so.
// Returns 'true' if all seems OK.
//
-bool FTServer::FTCheckClientDLL()
+bool FTServer::checkServerInstallationOK( HANDLE handle )
{
QSettings settings("Freetrack", "FreetrackClient"); // Registry settings (in HK_USER)
QString aLocation; // Location of Client DLL
@@ -281,7 +278,7 @@ bool FTServer::FTCheckClientDLL()
} catch(...) {
settings.~QSettings();
}
- return true;
+ return FTCreateMapping( handle );
}
//END
diff --git a/FaceTrackNoIR/FTServer.h b/FaceTrackNoIR/FTServer.h
index 72642785..1d7907ed 100644
--- a/FaceTrackNoIR/FTServer.h
+++ b/FaceTrackNoIR/FTServer.h
@@ -29,7 +29,7 @@
#ifndef INCLUDED_FTSERVER_H
#define INCLUDED_FTSERVER_H
-//#include "Windows.h"
+#include "FTNoIR_cxx_protocolserver.h"
#include "FTTypes.h"
#include <QString>
#include <QMessageBox>
@@ -47,8 +47,9 @@ typedef bool (WINAPI *importGetData)(TFreeTrackData * data);
typedef HANDLE (WINAPI *importGetMapHandle)(void);
using namespace std;
+using namespace v4friend::ftnoir;
-class FTServer : public QThread {
+class FTServer : public ProtocolServerBase {
Q_OBJECT
public:
@@ -57,55 +58,35 @@ public:
FTServer();
~FTServer();
- bool FTCreateMapping(HANDLE handle);
- void FTDestroyMapping();
- bool FTCheckClientDLL();
- QString FTGetProgramName();
+ QString GetProgramName();
// protected member methods
protected:
void run();
+ bool checkServerInstallationOK( HANDLE handle );
private:
- // Handles to neatly terminate thread...
- HANDLE m_StopThread;
- HANDLE m_WaitThread;
+ bool FTCreateMapping(HANDLE handle);
+ void FTDestroyMapping();
HANDLE hFTMemMap;
FTMemMap *pMemData;
HANDLE hFTMutex;
/** member varables for saving the head pose **/
- float headPosX;
- float headPosY;
- float headPosZ;
-
- float headRotX;
- float headRotY;
- float headRotZ;
bool confid;
- // Settings for calculating the Virtual Pose
- float virtPosX;
- float virtPosY;
- float virtPosZ;
-
- float virtRotX;
- float virtRotY;
- float virtRotZ;
-
// Private properties
QString ProgramName;
QLibrary FTClientLib;
public:
- void setHeadPosX(float x) { headPosX = x * 10; }
- void setHeadPosY(float y) { headPosY = y * 10; }
- void setHeadPosZ(float z) { headPosZ = z * 10; }
-
void setHeadRotX(float x) { headRotX = getRadsFromDegrees(x); }
void setHeadRotY(float y) { headRotY = getRadsFromDegrees(y); }
void setHeadRotZ(float z) { headRotZ = getRadsFromDegrees(z); }
+ void setHeadPosX(float x) { headPosX = x * 10; }
+ void setHeadPosY(float y) { headPosY = y * 10; }
+ void setHeadPosZ(float z) { headPosZ = z * 10; }
void setVirtRotX(float rot) { virtRotX = getRadsFromDegrees(rot); }
void setVirtRotY(float rot) { virtRotY = getRadsFromDegrees(rot); }
diff --git a/FaceTrackNoIR/FaceTrackNoIR.ui b/FaceTrackNoIR/FaceTrackNoIR.ui
index d723c0df..d24308bd 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.ui
+++ b/FaceTrackNoIR/FaceTrackNoIR.ui
@@ -172,19 +172,6 @@ QGroupBox {
</spacer>
</item>
<item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>186</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
<widget class="QFrame" name="logoInstitute">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -1021,8 +1008,11 @@ color:#000;</string>
</item>
<item>
<widget class="QPushButton" name="btnDonate">
+ <property name="toolTip">
+ <string>Please help us: make gaming fun...</string>
+ </property>
<property name="text">
- <string>Click here to Donate!</string>
+ <string>Click here to Support FaceTrackNoIR!</string>
</property>
<property name="icon">
<iconset resource="FaceTrackNoIR.qrc">
@@ -1036,6 +1026,19 @@ color:#000;</string>
</property>
</widget>
</item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>186</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</item>
<item row="4" column="1">
diff --git a/FaceTrackNoIR/FaceTrackNoIR.vcproj b/FaceTrackNoIR/FaceTrackNoIR.vcproj
index 625cda64..f5c6e94e 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.vcproj
+++ b/FaceTrackNoIR/FaceTrackNoIR.vcproj
@@ -378,6 +378,32 @@
>
</File>
<File
+ RelativePath=".\FTNoIR_cxx_protocolserver.h"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Moc&apos;ing $(InputFileName)..."
+ CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; &quot;$(InputPath)&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot; -DQT_CORE_LIB -DQT_DLL -DQT_GUI_LIB -DQT_LARGEFILE_SUPPORT -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_THREAD_SUPPORT -DUNICODE -DWIN32 -I&quot;$(QTDIR)\include\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;$(QTDIR)\include\QtNetwork\.&quot; -I&quot;$(QTDIR)\include\QtOpenGL\.&quot; -I&quot;$(QTDIR)\include\QtTest\.&quot; -I&quot;$(QTDIR)\include\QtWebKit\.&quot; -I&quot;$(SM_API_CPP_WRAPPERS)\include\.&quot; -I&quot;$(SM_API_PATH)\include\.&quot; -I&quot;$(SM_API_QTDIR)\include\.&quot; -I&quot;$(SM_API_WIDGETS)\include\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;.\GeneratedFiles\.&quot;&#x0D;&#x0A;"
+ AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
+ Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Moc&apos;ing $(InputFileName)..."
+ CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; &quot;$(InputPath)&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot; -DQT_CORE_LIB -DQT_DLL -DQT_GUI_LIB -DQT_LARGEFILE_SUPPORT -DQT_OPENGL_LIB -DQT_THREAD_SUPPORT -DUNICODE -DWIN32 -I&quot;$(QTDIR)\include\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;$(QTDIR)\include\QtNetwork\.&quot; -I&quot;$(QTDIR)\include\QtOpenGL\.&quot; -I&quot;$(QTDIR)\include\QtTest\.&quot; -I&quot;$(QTDIR)\include\QtWebKit\.&quot; -I&quot;.\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;.\GeneratedFiles\.&quot;&#x0D;&#x0A;"
+ AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
+ Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath=".\FTServer.h"
>
<FileConfiguration
@@ -852,6 +878,18 @@
</FileConfiguration>
</File>
<File
+ RelativePath=".\GeneratedFiles\Release\moc_FTNoIR_cxx_protocolserver.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath=".\GeneratedFiles\Release\moc_FTServer.cpp"
>
<FileConfiguration
@@ -977,6 +1015,29 @@
</FileConfiguration>
</File>
<File
+ RelativePath=".\GeneratedFiles\Debug\moc_FTNoIR_cxx_protocolserver.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\$(InputName)1.obj"
+ XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\$(InputName)1.obj"
+ XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath=".\GeneratedFiles\Debug\moc_FTServer.cpp"
>
<FileConfiguration
diff --git a/FaceTrackNoIR/PPJoyServer.h b/FaceTrackNoIR/PPJoyServer.h
index 165a82f5..31e7f97a 100644
--- a/FaceTrackNoIR/PPJoyServer.h
+++ b/FaceTrackNoIR/PPJoyServer.h
@@ -28,6 +28,7 @@
#ifndef INCLUDED_PPJOYSERVER_H
#define INCLUDED_PPJOYSERVER_H
+#include "FTNoIR_cxx_protocolserver.h"
#include "PPJIoctl.h"
#include <QString>
#include <QMessageBox>
@@ -42,6 +43,7 @@
#include "ui_FTNoIR_ppjoycontrols.h"
using namespace std;
+using namespace v4friend::ftnoir;
class Tracker; // pre-define parent-class to avoid circular includes
@@ -59,7 +61,7 @@ typedef struct
} JOYSTICK_STATE;
#pragma pack(pop)
-class PPJoyServer : public QThread {
+class PPJoyServer : public ProtocolServerBase {
Q_OBJECT
public:
@@ -76,10 +78,6 @@ private slots:
// void readPendingDatagrams();
private:
- // Handles to neatly terminate thread...
- HANDLE m_StopThread;
- HANDLE m_WaitThread;
-
Tracker *headTracker; // For upstream messages...
HANDLE h;
@@ -93,15 +91,6 @@ private:
// static long analogDefault,PPJoyCorrection;
long centerPos[3],centerRot[3];
- /** member variables for saving the head pose **/
- float virtPosX;
- float virtPosY;
- float virtPosZ;
-
- float virtRotX;
- float virtRotY;
- float virtRotZ;
-
void checkAnalogLimits();
long scale2AnalogLimits( float x, float min_x, float max_x );
void loadSettings();
diff --git a/FaceTrackNoIR/SCServer.cpp b/FaceTrackNoIR/SCServer.cpp
index fbbd92a3..c948b8a6 100644
--- a/FaceTrackNoIR/SCServer.cpp
+++ b/FaceTrackNoIR/SCServer.cpp
@@ -25,13 +25,13 @@
#include "SCServer.h"
-float SCServer::virtPosX = 0.0f;
-float SCServer::virtPosY = 0.0f;
-float SCServer::virtPosZ = 0.0f;
-
-float SCServer::virtRotX = 0.0f;
-float SCServer::virtRotY = 0.0f;
-float SCServer::virtRotZ = 0.0f;
+//float SCServer::virtPosX = 0.0f;
+//float SCServer::virtPosY = 0.0f;
+//float SCServer::virtPosZ = 0.0f;
+//
+//float SCServer::virtRotX = 0.0f;
+//float SCServer::virtRotY = 0.0f;
+//float SCServer::virtRotZ = 0.0f;
/** constructor **/
SCServer::SCServer() {
@@ -158,7 +158,7 @@ float prevPosX, prevPosY, prevPosZ, prevRotX, prevRotY, prevRotZ;
// Check if the Client DLL exists and load it (to test it), if so.
// Returns 'true' if all seems OK.
//
-bool SCServer::SCCheckClientDLL()
+bool SCServer::checkServerInstallationOK( HANDLE handle )
{
QString aFileName; // File Path and Name
diff --git a/FaceTrackNoIR/SCServer.h b/FaceTrackNoIR/SCServer.h
index e694463d..6df22b21 100644
--- a/FaceTrackNoIR/SCServer.h
+++ b/FaceTrackNoIR/SCServer.h
@@ -28,6 +28,7 @@
// This is necessary to run FaceTrackNoIR on a PC without FSX
//
#define SIMCONNECT_H_NOMANIFEST
+#include "FTNoIR_cxx_protocolserver.h"
#include "Windows.h"
#include <stdlib.h>
#include "SimConnect.h"
@@ -46,10 +47,11 @@ typedef HRESULT (WINAPI *importSimConnect_Close)(HANDLE hSimConnect);
typedef HRESULT (WINAPI *importSimConnect_CameraSetRelative6DOF)(HANDLE hSimConnect, float fDeltaX, float fDeltaY, float fDeltaZ, float fPitchDeg, float fBankDeg, float fHeadingDeg);
using namespace std;
+using namespace v4friend::ftnoir;
static const char* SC_CLIENT_FILENAME = "SimConnect.dll";
-class SCServer : public QThread {
+class SCServer : public ProtocolServerBase {
Q_OBJECT
public:
@@ -58,40 +60,24 @@ public:
SCServer();
~SCServer();
- bool SCCheckClientDLL();
-
// protected member methods
protected:
void run();
+ bool checkServerInstallationOK( HANDLE handle );
private:
- // Handles to neatly terminate thread...
- HANDLE m_StopThread;
- HANDLE m_WaitThread;
-
// Private properties
QString ProgramName;
QLibrary SCClientLib;
public:
+ void setVirtRotX(float rot) { virtRotX = -1.0f * rot; } // degrees
+ void setVirtRotY(float rot) { virtRotY = -1.0f * rot; }
+ void setVirtRotZ(float rot) { virtRotZ = rot; }
- // Settings for calculating the Virtual Pose
- static float virtPosX;
- static float virtPosY;
- static float virtPosZ;
-
- static float virtRotX;
- static float virtRotY;
- static float virtRotZ;
-
- static void setVirtRotX(float rot) { virtRotX = -1.0f * rot; } // degrees
- static void setVirtRotY(float rot) { virtRotY = -1.0f * rot; }
- static void setVirtRotZ(float rot) { virtRotZ = rot; }
-
- static void setVirtPosX(float pos) { virtPosX = pos/100.f; } // cm to meters
- static void setVirtPosY(float pos) { virtPosY = pos/100.f; }
- static void setVirtPosZ(float pos) { virtPosZ = -1.0f * pos/100.f; }
-
+ void setVirtPosX(float pos) { virtPosX = pos/100.f; } // cm to meters
+ void setVirtPosY(float pos) { virtPosY = pos/100.f; }
+ void setVirtPosZ(float pos) { virtPosZ = -1.0f * pos/100.f; }
};
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp
index 91cdaea2..8439526b 100644
--- a/FaceTrackNoIR/tracker.cpp
+++ b/FaceTrackNoIR/tracker.cpp
@@ -23,6 +23,8 @@
*********************************************************************************/
/*
Modifications (last one on top):
+ 20101217 - WVR: Created Base Class for the protocol-servers. This drastically simplifies
+ the code needed here.
20101024 - WVR: Added shortkey to disable/enable one or more axis during tracking.
20101021 - WVR: Added FSUIPC server for FS2004.
20101011 - WVR: Added SimConnect server.
@@ -101,38 +103,32 @@ Tracker::Tracker( int clientID ) {
//
// Initialize all server-handles. Only start the server, that was selected in the GUI.
//
- server_FT = 0;
- server_FG = 0;
- server_PPJoy = 0;
- server_FTIR = 0;
- server_SC = 0;
- server_FSUIPC = 0;
switch (selectedClient) {
case FREE_TRACK:
- server_FT = new FTServer; // Create Free-track protocol-server
+ server_FG = QSharedPointer<FTServer>(new FTServer ( )); // Create Free-track protocol-server
break;
case FLIGHTGEAR:
- server_FG = new FGServer ( this ); // Create FlightGear protocol-server
+ server_FG = QSharedPointer<FGServer>(new FGServer ( this )); // Create FlightGear protocol-server
break;
case FTNOIR:
break;
case PPJOY:
- server_PPJoy = new PPJoyServer ( this ); // Create PPJoy protocol-server
+ server_FG = QSharedPointer<PPJoyServer>(new PPJoyServer ( this )); // Create PPJoy protocol-server
break;
case TRACKIR:
- server_FTIR = new FTIRServer; // Create Fake-TIR protocol-server
+ server_FG = QSharedPointer<FTIRServer>(new FTIRServer ( )); // Create Fake-TIR protocol-server
break;
case SIMCONNECT:
- server_SC = new SCServer; // Create SimConnect protocol-server
+ server_FG = QSharedPointer<SCServer>(new SCServer ( )); // Create SimConnect protocol-server
break;
case FSUIPC:
- server_FSUIPC = new FSUIPCServer; // Create FSUIPC protocol-server
+ server_FG = QSharedPointer<FSUIPCServer>(new FSUIPCServer ( )); // Create FSUIPC protocol-server
break;
default:
@@ -147,25 +143,9 @@ Tracker::Tracker( int clientID ) {
Tracker::~Tracker() {
// Stop the started server(s)
- if (server_FT) {
- server_FT->deleteLater();
- }
if (server_FG) {
server_FG->deleteLater();
}
- if (server_PPJoy) {
- server_PPJoy->deleteLater();
- }
- if (server_FTIR) {
- server_FTIR->deleteLater();
- }
- if (server_SC) {
- server_SC->deleteLater();
- }
-
- if (server_FSUIPC) {
- server_FSUIPC->deleteLater();
- }
// Trigger thread to stop
::SetEvent(m_StopThread);
@@ -207,68 +187,22 @@ void Tracker::setup(QWidget *head, FaceTrackNoIR *parent) {
headRotYLine = headPoseWidget->findChild<QLineEdit *>("headRotYLine");
headRotZLine = headPoseWidget->findChild<QLineEdit *>("headRotZLine");
-
//
- // Check if the Freetrack Client DLL is available
- // and create the necessary mapping to shared memory.
+ // Check if the Protocol-server files were installed OK.
+ // Some servers also create a memory-mapping, for Inter Process Communication.
// The handle of the MainWindow is sent to 'The Game', so it can send a message back.
//
- if (server_FT) {
- DLL_Ok = server_FT->FTCheckClientDLL();
- DLL_Ok = server_FT->FTCreateMapping( mainApp->winId() );
-
- server_FT->start(); // Start the thread
- }
-
- // FlightGear
if (server_FG) {
- server_FG->start(); // Start the thread
- }
-
- // PPJoy virtual joystick
- if (server_PPJoy) {
- server_PPJoy->start(); // Start the thread
- }
-
- //
- // Check if the NP Client DLL is available
- // and create the necessary mapping to shared memory.
- // The handle of the MainWindow is sent to 'The Game', so it can send a message back.
- //
- if (server_FTIR) {
- DLL_Ok = server_FTIR->FTIRCheckClientDLL();
- DLL_Ok = server_FTIR->FTIRCreateMapping( mainApp->winId() );
-
- server_FTIR->start(); // Start the thread
- }
- //
- // Check if the SimConnect DLL is available, load it if so.
- //
- if (server_SC) {
- DLL_Ok = server_SC->SCCheckClientDLL();
+ DLL_Ok = server_FG->checkServerInstallationOK( mainApp->winId() );
if (DLL_Ok) {
- server_SC->start(); // Start the thread
+ server_FG->start(); // Start the thread
}
else {
- QMessageBox::information(mainApp, "FaceTrackNoIR error", "SimConnect is not (correctly) installed!");
+ QMessageBox::information(mainApp, "FaceTrackNoIR error", "Protocol is not (correctly) installed!");
}
- }
- //
- // Check if the FSUIPC DLL is available, load it if so.
- //
- if (server_FSUIPC) {
- DLL_Ok = server_FSUIPC->CheckClientDLL();
-
- if (DLL_Ok) {
- server_FSUIPC->start(); // Start the thread
- }
- else {
- QMessageBox::information(mainApp, "FaceTrackNoIR error", "FSUIPC is not (correctly) installed!\nIt should be placed in the Modules folder of FS!");
- }
}
-
}
/** QThread run method @override **/
@@ -554,23 +488,14 @@ void Tracker::run() {
// Send the Virtual Pose to selected Protocol-Server
//
// Free-track
- if (server_FT) {
- server_FT->setVirtRotX ( rotX ); // degrees
- server_FT->setVirtRotY ( rotY );
- server_FT->setVirtRotZ ( rotZ );
-
- server_FT->setVirtPosX ( posX ); // centimeters
- server_FT->setVirtPosY ( posY );
- server_FT->setVirtPosZ ( posZ );
-
- server_FT->setHeadRotX( rotX ); // degrees
- server_FT->setHeadRotY( rotY );
- server_FT->setHeadRotZ( rotZ );
-
- server_FT->setHeadPosX( posX ); // centimeters
- server_FT->setHeadPosY( posY );
- server_FT->setHeadPosZ( posZ );
-
+ if (selectedClient == FREE_TRACK) {
+ server_FG->setHeadRotX( rotX ); // degrees
+ server_FG->setHeadRotY( rotY );
+ server_FG->setHeadRotZ( rotZ );
+
+ server_FG->setHeadPosX( posX ); // centimeters
+ server_FG->setHeadPosY( posY );
+ server_FG->setHeadPosZ( posZ );
}
// FlightGear
@@ -582,65 +507,11 @@ void Tracker::run() {
server_FG->setVirtPosY ( posY );
server_FG->setVirtPosZ ( posZ );
}
-
- // PPJoy virtual joystick
- if (server_PPJoy) {
- server_PPJoy->setVirtRotX ( rotX ); // degrees
- server_PPJoy->setVirtRotY ( rotY );
- server_PPJoy->setVirtRotZ ( rotZ );
-
- server_PPJoy->setVirtPosX ( posX ); // centimeters
- server_PPJoy->setVirtPosY ( posY );
- server_PPJoy->setVirtPosZ ( posZ );
- }
-
- // Fake-trackIR
- if (server_FTIR) {
- server_FTIR->setVirtRotX ( rotX ); // degrees
- server_FTIR->setVirtRotY ( rotY );
- server_FTIR->setVirtRotZ ( rotZ );
-
- server_FTIR->setVirtPosX ( posX ); // centimeters
- server_FTIR->setVirtPosY ( posY );
- server_FTIR->setVirtPosZ ( posZ );
- }
-
- // SimConnect
- if (server_SC) {
- server_SC->setVirtRotX ( rotX ); // degrees
- server_SC->setVirtRotY ( rotY );
- server_SC->setVirtRotZ ( rotZ );
-
- server_SC->setVirtPosX ( posX ); // centimeters
- server_SC->setVirtPosY ( posY );
- server_SC->setVirtPosZ ( posZ );
- }
-
- // FSUIPC
- if (server_FSUIPC) {
- server_FSUIPC->setVirtRotX ( rotX ); // degrees
- server_FSUIPC->setVirtRotY ( rotY );
- server_FSUIPC->setVirtRotZ ( rotZ );
-
- server_FSUIPC->setVirtPosX ( posX ); // centimeters
- server_FSUIPC->setVirtPosY ( posY );
- server_FSUIPC->setVirtPosZ ( posZ );
- }
-
}
else {
//
// Go to initial position
//
- if (server_FT) {
- server_FT->setVirtRotX ( 0.0f );
- server_FT->setVirtRotY ( 0.0f );
- server_FT->setVirtRotZ ( 0.0f );
- server_FT->setVirtPosX ( 0.0f );
- server_FT->setVirtPosY ( 0.0f );
- server_FT->setVirtPosZ ( 0.0f );
- }
-
if (server_FG) {
server_FG->setVirtRotX ( 0.0f );
server_FG->setVirtRotY ( 0.0f );
@@ -649,42 +520,6 @@ void Tracker::run() {
server_FG->setVirtPosY ( 0.0f );
server_FG->setVirtPosZ ( 0.0f );
}
-
- if (server_PPJoy) {
- server_PPJoy->setVirtRotX ( 0.0f );
- server_PPJoy->setVirtRotY ( 0.0f );
- server_PPJoy->setVirtRotZ ( 0.0f );
- server_PPJoy->setVirtPosX ( 0.0f );
- server_PPJoy->setVirtPosY ( 0.0f );
- server_PPJoy->setVirtPosZ ( 0.0f );
- }
-
- if (server_FTIR) {
- server_FTIR->setVirtRotX ( 0.0f );
- server_FTIR->setVirtRotY ( 0.0f );
- server_FTIR->setVirtRotZ ( 0.0f );
- server_FTIR->setVirtPosX ( 0.0f );
- server_FTIR->setVirtPosY ( 0.0f );
- server_FTIR->setVirtPosZ ( 0.0f );
- }
-
- if (server_SC) {
- server_SC->setVirtRotX ( 0.0f );
- server_SC->setVirtRotY ( 0.0f );
- server_SC->setVirtRotZ ( 0.0f );
- server_SC->setVirtPosX ( 0.0f );
- server_SC->setVirtPosY ( 0.0f );
- server_SC->setVirtPosZ ( 0.0f );
- }
-
- if (server_FSUIPC) {
- server_FSUIPC->setVirtRotX ( 0.0f );
- server_FSUIPC->setVirtRotY ( 0.0f );
- server_FSUIPC->setVirtRotZ ( 0.0f );
- server_FSUIPC->setVirtPosX ( 0.0f );
- server_FSUIPC->setVirtPosY ( 0.0f );
- server_FSUIPC->setVirtPosZ ( 0.0f );
- }
}
//for lower cpu load
@@ -739,7 +574,7 @@ void Tracker::receiveHeadPose(void *,smEngineHeadPoseData head_pose, smCameraVid
}
// for lower cpu load
- msleep(15);
+ msleep(10);
yieldCurrentThread();
}
@@ -749,9 +584,7 @@ void Tracker::receiveHeadPose(void *,smEngineHeadPoseData head_pose, smCameraVid
QString Tracker::getGameProgramName() {
QString str;
- if ( server_FT ) {
- str = server_FT->FTGetProgramName();
- }
+ str = server_FG->GetProgramName();
return str;
}
diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h
index 277c11ca..1434cfb4 100644
--- a/FaceTrackNoIR/tracker.h
+++ b/FaceTrackNoIR/tracker.h
@@ -42,6 +42,7 @@
#include "FTIRServer.h" // FakeTIR-server
#include "SCServer.h" // SimConnect-server (for MS Flight Simulator X)
#include "FSUIPCServer.h" // FSUIPC-server (for MS Flight Simulator 2004)
+#include "FTNoIR_cxx_protocolserver.h"
// include the DirectX Library files
#pragma comment (lib, "dinput8.lib")
@@ -118,7 +119,6 @@ private:
/** face api variables **/
APIScope *faceapi_scope;
QSharedPointer<EngineBase> _engine;
- QSharedPointer<HeadTracker> _headtracker;
smEngineHandle _engine_handle;
/** static callback method for the head pose tracking **/
@@ -162,12 +162,12 @@ private:
QWidget *headPoseWidget;
FaceTrackNoIR *mainApp;
- FTServer *server_FT; // Freetrack Server
- FGServer *server_FG; // FlightGear Server
- PPJoyServer *server_PPJoy; // PPJoy Server
- FTIRServer *server_FTIR; // Fake TIR Server
- SCServer *server_SC; // SimConnect Server
- FSUIPCServer *server_FSUIPC; // FSUIPC Server
+// FTServer *server_FT; // Freetrack Server
+ QSharedPointer<ProtocolServerBase> server_FG; // FlightGear Server
+// PPJoyServer *server_PPJoy; // PPJoy Server
+// FTIRServer *server_FTIR; // Fake TIR Server
+// SCServer *server_SC; // SimConnect Server
+// FSUIPCServer *server_FSUIPC; // FSUIPC Server
protected:
// qthread override run method
diff --git a/List of compatible games.xls b/List of compatible games.xls
index c34a6191..2f2a8d5c 100644
--- a/List of compatible games.xls
+++ b/List of compatible games.xls
Binary files differ
diff --git a/bin/FaceTrackNoIR.exe b/bin/FaceTrackNoIR.exe
index 4be7d84f..4b846746 100644
--- a/bin/FaceTrackNoIR.exe
+++ b/bin/FaceTrackNoIR.exe
Binary files differ
diff --git a/bin/Settings/ArmA.ini b/bin/Settings/ArmA.ini
index b8913b5c..acea8fbe 100644
--- a/bin/Settings/ArmA.ini
+++ b/bin/Settings/ArmA.ini
@@ -59,3 +59,13 @@ Keycode_StartStop=211
Shift_StartStop=false
Ctrl_StartStop=false
Alt_StartStop=false
+Keycode_Inhibit=0
+Shift_Inhibit=false
+Ctrl_Inhibit=false
+Alt_Inhibit=false
+Inhibit_Pitch=false
+Inhibit_Yaw=false
+Inhibit_Roll=false
+Inhibit_X=false
+Inhibit_Y=false
+Inhibit_Z=false
diff --git a/bin/Settings/FlightGear.ini b/bin/Settings/FlightGear.ini
index d2c43c86..f5da570d 100644
--- a/bin/Settings/FlightGear.ini
+++ b/bin/Settings/FlightGear.ini
@@ -1,5 +1,5 @@
[Tracking]
-Smooth=10
+Smooth=3
NeutralZone=5
sensYaw=300
sensPitch=300
@@ -33,6 +33,16 @@ Keycode_StartStop=60
Shift_StartStop=false
Ctrl_StartStop=false
Alt_StartStop=false
+Keycode_Inhibit=0
+Shift_Inhibit=false
+Ctrl_Inhibit=false
+Alt_Inhibit=false
+Inhibit_Pitch=false
+Inhibit_Yaw=false
+Inhibit_Roll=false
+Inhibit_X=false
+Inhibit_Y=false
+Inhibit_Z=false
[Curves]
Yaw_point1=@Variant(\0\0\0\x1a\0\0\0\0\0\0\0\0@\x14\0\0\0\0\0\0)
@@ -59,3 +69,11 @@ Z_point1=@Variant(\0\0\0\x1a\0\0\0\0\0\0\0\0@\x14\0\0\0\0\0\0)
Z_point2=@Variant(\0\0\0\x1a@?\0\0\0\0\0\0@1\0\0\0\0\0\0)
Z_point3=@Variant(\0\0\0\x1a@O\x80\0\0\0\0\0@@\x80\0\0\0\0\0)
Z_point4=@Variant(\0\0\0\x1a@W\xc0\0\0\0\0\0@I\0\0\0\0\0\0)
+
+[FG]
+LocalPCOnly=true
+IP-1=127
+IP-2=0
+IP-3=0
+IP-4=1
+PortNumber=5550
diff --git a/bin/Settings/GlovePIE.ini b/bin/Settings/GlovePIE.ini
index d6949d39..39c0d818 100644
--- a/bin/Settings/GlovePIE.ini
+++ b/bin/Settings/GlovePIE.ini
@@ -1,5 +1,5 @@
[Tracking]
-Smooth=15
+Smooth=3
NeutralZone=5
sensYaw=200
sensPitch=200
@@ -23,3 +23,26 @@ redZ=75
[GameProtocol]
Selection=3
+
+[PPJoy]
+Selection=1
+
+[KB_Shortcuts]
+Keycode_Center=199
+Shift_Center=false
+Ctrl_Center=false
+Alt_Center=false
+Keycode_StartStop=207
+Shift_StartStop=false
+Ctrl_StartStop=false
+Alt_StartStop=false
+Keycode_Inhibit=0
+Shift_Inhibit=false
+Ctrl_Inhibit=false
+Alt_Inhibit=false
+Inhibit_Pitch=false
+Inhibit_Yaw=false
+Inhibit_Roll=false
+Inhibit_X=false
+Inhibit_Y=false
+Inhibit_Z=false
diff --git a/bin/Settings/SimConnect.ini b/bin/Settings/SimConnect.ini
index 0e4210fa..cc450d82 100644
--- a/bin/Settings/SimConnect.ini
+++ b/bin/Settings/SimConnect.ini
@@ -18,14 +18,24 @@ redZ=70
Selection=5
[KB_Shortcuts]
-Keycode_Center=59
+Keycode_Center=199
Shift_Center=false
Ctrl_Center=false
-Alt_Center=true
-Keycode_StartStop=60
+Alt_Center=false
+Keycode_StartStop=207
Shift_StartStop=false
Ctrl_StartStop=false
-Alt_StartStop=true
+Alt_StartStop=false
+Keycode_Inhibit=0
+Shift_Inhibit=false
+Ctrl_Inhibit=false
+Alt_Inhibit=false
+Inhibit_Pitch=false
+Inhibit_Yaw=false
+Inhibit_Roll=false
+Inhibit_X=false
+Inhibit_Y=false
+Inhibit_Z=false
[Curves]
Yaw_point1=@Variant(\0\0\0\x1a\0\0\0\0\0\0\0\0@\0\0\0\0\0\0\0)