summaryrefslogtreecommitdiffhomepage
path: root/FTNoIR_Protocol_FT
diff options
context:
space:
mode:
Diffstat (limited to 'FTNoIR_Protocol_FT')
-rw-r--r--FTNoIR_Protocol_FT/FTNoIR_FTcontrols.ui173
-rw-r--r--FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.cpp38
-rw-r--r--FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.h3
-rw-r--r--FTNoIR_Protocol_FT/FTTypes.h9
-rw-r--r--FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp37
5 files changed, 233 insertions, 27 deletions
diff --git a/FTNoIR_Protocol_FT/FTNoIR_FTcontrols.ui b/FTNoIR_Protocol_FT/FTNoIR_FTcontrols.ui
index 980b2943..fc5abbcf 100644
--- a/FTNoIR_Protocol_FT/FTNoIR_FTcontrols.ui
+++ b/FTNoIR_Protocol_FT/FTNoIR_FTcontrols.ui
@@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
- <width>588</width>
- <height>263</height>
+ <width>645</width>
+ <height>416</height>
</rect>
</property>
+ <property name="minimumSize">
+ <size>
+ <width>645</width>
+ <height>0</height>
+ </size>
+ </property>
<property name="windowTitle">
<string>FreeTrack 2.0 settings FaceTrackNoIR</string>
</property>
@@ -40,8 +46,8 @@
<widget class="QCheckBox" name="chkTIRViews">
<property name="geometry">
<rect>
- <x>70</x>
- <y>20</y>
+ <x>80</x>
+ <y>30</y>
<width>88</width>
<height>17</height>
</rect>
@@ -56,27 +62,27 @@
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
- <x>180</x>
+ <x>189</x>
<y>10</y>
- <width>301</width>
+ <width>421</width>
<height>16</height>
</rect>
</property>
<property name="text">
- <string>TIRViews is only required for some older games (like CFS3).</string>
+ <string>TIRViews is only required for some older games (like CFS3). For it to work, TIRViews.dll</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
- <x>180</x>
+ <x>189</x>
<y>30</y>
<width>421</width>
<height>16</height>
</rect>
</property>
<property name="text">
- <string>For it to work, TIRViews.dll must be placed in the FaceTrackNoIR program folder.</string>
+ <string>must be placed in the FaceTrackNoIR program folder. If the checkbox is disabled, the</string>
</property>
<property name="wordWrap">
<bool>true</bool>
@@ -85,14 +91,14 @@
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
- <x>180</x>
+ <x>189</x>
<y>50</y>
- <width>251</width>
+ <width>411</width>
<height>16</height>
</rect>
</property>
<property name="text">
- <string>If the checkbox is disabled, the DLL was not found.</string>
+ <string>the DLL was not found. You can get it from NaturalPoint.</string>
</property>
</widget>
</widget>
@@ -111,8 +117,8 @@
<widget class="QCheckBox" name="chkStartDummy">
<property name="geometry">
<rect>
- <x>13</x>
- <y>20</y>
+ <x>20</x>
+ <y>30</y>
<width>145</width>
<height>17</height>
</rect>
@@ -127,7 +133,7 @@
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
- <x>180</x>
+ <x>189</x>
<y>10</y>
<width>351</width>
<height>16</height>
@@ -140,7 +146,7 @@
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
- <x>180</x>
+ <x>189</x>
<y>30</y>
<width>261</width>
<height>16</height>
@@ -156,7 +162,7 @@
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
- <x>180</x>
+ <x>189</x>
<y>50</y>
<width>231</width>
<height>16</height>
@@ -169,6 +175,139 @@
</widget>
</item>
<item>
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>70</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Select interface</string>
+ </property>
+ <widget class="QLabel" name="label_8">
+ <property name="geometry">
+ <rect>
+ <x>189</x>
+ <y>10</y>
+ <width>351</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Some games support both FreeTrack and TrackIR and may get confused,</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_2">
+ <property name="geometry">
+ <rect>
+ <x>189</x>
+ <y>30</y>
+ <width>261</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>when both interfaces are visible.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_9">
+ <property name="geometry">
+ <rect>
+ <x>189</x>
+ <y>50</y>
+ <width>381</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Try to disable one interface, if you experience problems.</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" name="cbxSelectInterface">
+ <property name="geometry">
+ <rect>
+ <x>6</x>
+ <y>30</y>
+ <width>168</width>
+ <height>22</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_4">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>70</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Repair NPClient location</string>
+ </property>
+ <widget class="QLabel" name="label_10">
+ <property name="geometry">
+ <rect>
+ <x>188</x>
+ <y>10</y>
+ <width>381</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Users who use other software with an NPClient DLL (like TrackIR, FreeTrack or </string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_11">
+ <property name="geometry">
+ <rect>
+ <x>184</x>
+ <y>30</y>
+ <width>411</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string> GlovePIE) may need to repair the location of the DLL, after running FaceTrackNoIR.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_12">
+ <property name="geometry">
+ <rect>
+ <x>187</x>
+ <y>50</y>
+ <width>391</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Use this button to locate the desired NPClient DLL.</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="bntLocateNPClient">
+ <property name="geometry">
+ <rect>
+ <x>4</x>
+ <y>30</y>
+ <width>171</width>
+ <height>23</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Locate DLL</string>
+ </property>
+ </widget>
+ </widget>
+ </item>
+ <item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
diff --git a/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.cpp b/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.cpp
index 0491b9fa..f33f92c5 100644
--- a/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.cpp
+++ b/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.cpp
@@ -26,6 +26,8 @@
********************************************************************************/
/*
Modifications (last one on top):
+ 20130209 - WVR: Some games support both interfaces and cause trouble. Added ComboBox to fix this (hide one interface
+ by clearing the appropriate Registry-setting).
20130203 - WVR: Added Tirviews and dummy checkboxes to the Settings dialog. This is necessary for CFS3 etc.
20130125 - WVR: Upgraded to FT2.0: now the FreeTrack protocol supports all TIR-enabled games.
20110401 - WVR: Moved protocol to a DLL, convenient for installation etc.
@@ -45,8 +47,13 @@ FTNoIR_Protocol::FTNoIR_Protocol()
comhandle = 0;
useTIRViews = false;
useDummyExe = false;
+ intUsedInterface = 0;
+ //
+ // Load the INI-settings.
+ //
loadSettings();
+
ProgramName = "";
intGameID = 0;
@@ -93,12 +100,6 @@ FTNoIR_Protocol::~FTNoIR_Protocol()
FTDestroyMapping();
}
-///** helper to Auto-destruct **/
-//void FTNoIR_Protocol::Release()
-//{
-// delete this;
-//}
-
void FTNoIR_Protocol::Initialize()
{
return;
@@ -174,6 +175,10 @@ void FTNoIR_Protocol::loadSettings() {
QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
+ iniFile.beginGroup ( "FT" );
+ intUsedInterface = iniFile.value ( "UsedInterface", 0 ).toInt();
+ iniFile.endGroup ();
+
//
// Use the settings-section from the deprecated fake-TIR protocol, as they are most likely to be found there.
//
@@ -321,8 +326,25 @@ bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle )
// Write the path in the registry (for FreeTrack and FreeTrack20), for the game(s).
//
aLocation = QCoreApplication::applicationDirPath() + "/";
- settings.setValue( "Path" , aLocation );
- settingsTIR.setValue( "Path" , aLocation );
+
+ qDebug() << "checkServerInstallationOK says: used interface = " << intUsedInterface;
+ switch (intUsedInterface) {
+ case 0: // Use both interfaces
+ settings.setValue( "Path" , aLocation );
+ settingsTIR.setValue( "Path" , aLocation );
+ break;
+ case 1: // Use FreeTrack, disable TrackIR
+ settings.setValue( "Path" , aLocation );
+ settingsTIR.setValue( "Path" , "" );
+ break;
+ case 2: // Use TrackIR, disable FreeTrack
+ settings.setValue( "Path" , "" );
+ settingsTIR.setValue( "Path" , aLocation );
+ break;
+ default:
+ // should never be reached
+ break;
+ }
//
// TIRViews must be started first, or the NPClient DLL will never be loaded.
diff --git a/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.h b/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.h
index 00f124f6..c82c3e79 100644
--- a/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.h
+++ b/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.h
@@ -76,6 +76,7 @@ private:
QLibrary FTIRViewsLib;
QProcess *dummyTrackIR;
int intGameID;
+ int intUsedInterface; // Determine which interface to use (or to hide from the game)
bool useTIRViews; // Needs to be in the Settings dialog
bool useDummyExe;
@@ -114,9 +115,11 @@ private:
FTNoIR_Protocol *theProtocol;
private slots:
+ void selectDLL();
void doOK();
void doCancel();
void settingChanged() { settingsDirty = true; };
+ void settingChanged(int) { settingsDirty = true; };
};
//*******************************************************************************************************
diff --git a/FTNoIR_Protocol_FT/FTTypes.h b/FTNoIR_Protocol_FT/FTTypes.h
index ece410ff..1f389711 100644
--- a/FTNoIR_Protocol_FT/FTTypes.h
+++ b/FTNoIR_Protocol_FT/FTTypes.h
@@ -92,6 +92,13 @@ struct FTMemMap {
};
typedef FTMemMap * PFTMemMap;
-extern bool (*FTGetData) (PFreetrackData data);
+//extern bool (*FTGetData) (PFreetrackData data);
+// DLL function signatures
+// These match those given in FTTypes.pas
+// WINAPI is macro for __stdcall defined somewhere in the depths of windows.h
+typedef bool (WINAPI *importGetData)(TFreeTrackData * data);
+typedef char *(WINAPI *importGetDllVersion)(void);
+typedef void (WINAPI *importReportID)(int name);
+typedef char *(WINAPI *importProvider)(void);
#endif//INCLUDED_FTTYPES_H
diff --git a/FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp b/FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp
index 678b3a5f..9f6fdcb1 100644
--- a/FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp
+++ b/FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp
@@ -32,6 +32,7 @@
*/
#include "ftnoir_protocol_ft.h"
#include <QDebug>
+#include <QFileDialog>
//*******************************************************************************************************
// FaceTrackNoIR Client Settings-dialog.
@@ -52,6 +53,12 @@ QWidget()
connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
connect(ui.chkTIRViews, SIGNAL(stateChanged(int)), this, SLOT(chkTIRViewsChanged()));
connect(ui.chkStartDummy, SIGNAL(stateChanged(int)), this, SLOT(settingChanged()));
+ connect(ui.cbxSelectInterface, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged( int )));
+ connect(ui.bntLocateNPClient, SIGNAL(clicked()), this, SLOT(selectDLL()));
+
+ ui.cbxSelectInterface->addItem("Enable both");
+ ui.cbxSelectInterface->addItem("Use FreeTrack, hide TrackIR");
+ ui.cbxSelectInterface->addItem("Use TrackIR, hide FreeTrack");
aFileName = QCoreApplication::applicationDirPath() + "/TIRViews.dll";
if ( !QFile::exists( aFileName ) ) {
@@ -147,7 +154,7 @@ void FTControls::loadSettings() {
qDebug() << "loadSettings says: iniFile = " << currentFile;
iniFile.beginGroup ( "FT" );
-// ui.chkTIRViews->setChecked (iniFile.value ( "useTIRViews", 0 ).toBool());
+ ui.cbxSelectInterface->setCurrentIndex( iniFile.value ( "UsedInterface", 0 ).toInt() );
iniFile.endGroup ();
iniFile.beginGroup ( "FTIR" );
@@ -168,6 +175,7 @@ void FTControls::save() {
QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
iniFile.beginGroup ( "FT" );
+ iniFile.setValue ( "UsedInterface", ui.cbxSelectInterface->currentIndex());
iniFile.endGroup ();
iniFile.beginGroup ( "FTIR" );
@@ -178,6 +186,33 @@ void FTControls::save() {
settingsDirty = false;
}
+//
+// Select a NPClient.dll file, to repair the Location in the Registry.
+// Several program distribute their own version of this file.
+//
+void FTControls::selectDLL() {
+ QFileDialog::Options options;
+ QFileDialog::FileMode mode;
+
+ options |= QFileDialog::DontUseNativeDialog;
+ mode = QFileDialog::ExistingFile;
+ QString selectedFilter;
+ QString fileName = QFileDialog::getOpenFileName( this, tr("Select the desired NPClient DLL"), QCoreApplication::applicationDirPath() + "/NPClient.dll", tr("Dll file (*.dll);;All Files (*)"));
+
+ //
+ // Write the location of the file in the required Registry-key.
+ //
+ if (! fileName.isEmpty() ) {
+ if (fileName.endsWith("NPClient.dll", Qt::CaseInsensitive) ) {
+ QSettings settingsTIR("NaturalPoint", "NATURALPOINT\\NPClient Location"); // Registry settings (in HK_USER)
+ QString aLocation = fileName.left(fileName.length() - 12); // Location of Client DLL
+
+ settingsTIR.setValue( "Path" , aLocation );
+ }
+ }
+}
+
+
////////////////////////////////////////////////////////////////////////////////
// Factory function that creates instances if the Protocol-settings dialog object.