summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_protocol_fsuipc
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-04-02 18:41:01 +0200
committerStanislaw Halik <sthalik@misaki.pl>2013-04-02 18:41:01 +0200
commit8303597a865400a363ae574ccde819302495f498 (patch)
treec83b383b3ec818f610cc6137f2b72ee7b4173b09 /ftnoir_protocol_fsuipc
parent8adf6b1650af6027f28db12ca2b4de92a3fac11d (diff)
Just put everything new in. Conflict resolution will be later
Diffstat (limited to 'ftnoir_protocol_fsuipc')
-rw-r--r--ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui2
-rw-r--r--ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp38
-rw-r--r--ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h11
-rw-r--r--ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp7
-rw-r--r--ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp5
-rw-r--r--ftnoir_protocol_fsuipc/images/fs9.icobin0 -> 29926 bytes
6 files changed, 30 insertions, 33 deletions
diff --git a/ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui b/ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui
index b6120378..d02297f3 100644
--- a/ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui
+++ b/ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui
@@ -15,7 +15,7 @@
</property>
<property name="windowIcon">
<iconset>
- <normaloff>images/FaceTrackNoIR.ico</normaloff>images/FaceTrackNoIR.ico</iconset>
+ <normaloff>images/FaceTrackNoIR.png</normaloff>images/FaceTrackNoIR.png</iconset>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp
index 5a4663a1..c750ae26 100644
--- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp
+++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp
@@ -3,7 +3,7 @@
* gamers from Holland, who don't like to pay much for *
* head-tracking. *
* *
-* Copyright (C) 2010-2013 Wim Vriend (Developing) *
+* Copyright (C) 2010-2011 Wim Vriend (Developing) *
* Ron Hendriks (Researching and Testing) *
* *
* Homepage *
@@ -31,6 +31,7 @@
is called from run() of Tracker.cpp
*/
#include "ftnoir_protocol_fsuipc.h"
+#include "facetracknoir/global-settings.h"
/** constructor **/
FTNoIR_Protocol::FTNoIR_Protocol()
@@ -38,9 +39,6 @@ FTNoIR_Protocol::FTNoIR_Protocol()
loadSettings();
ProgramName = "Microsoft FS2004";
- blnConnectionActive = false;
- hMainWindow = NULL;
-
prevPosX = 0.0f;
prevPosY = 0.0f;
prevPosZ = 0.0f;
@@ -121,8 +119,6 @@ float virtRotX;
float virtRotY;
float virtRotZ;
-PDWORD_PTR MsgResult = 0;
-
// qDebug() << "FSUIPCServer::run() says: started!";
virtRotX = -1.0f * headpose->pitch; // degrees
@@ -178,14 +174,6 @@ PDWORD_PTR MsgResult = 0;
if (result == FSUIPC_ERR_SENDMSG) {
FSUIPC_Close(); //timeout (1 second) so assume FS closed
}
-
- if (!blnConnectionActive) {
- blnConnectionActive = true;
- if (hMainWindow != NULL) {
- SendMessageTimeout( (HWND) hMainWindow, RegisterWindowMessageA(FT_PROGRAMID), 0, 0, 0, 2000, MsgResult);
- }
- }
-
}
}
@@ -200,11 +188,21 @@ PDWORD_PTR MsgResult = 0;
//
// Returns 'true' if all seems OK.
//
-bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle )
+bool FTNoIR_Protocol::checkServerInstallationOK()
{
qDebug() << "checkServerInstallationOK says: Starting Function";
- hMainWindow = handle;
+ //
+ // Load the DLL.
+ //
+ FSUIPCLib.setFileName( LocationOfDLL );
+ if (FSUIPCLib.load() != true) {
+ qDebug() << "checkServerInstallationOK says: Error loading FSUIPC DLL";
+ return false;
+ }
+ else {
+ qDebug() << "checkServerInstallationOK says: FSUIPC DLL loaded.";
+ }
return true;
}
@@ -214,7 +212,7 @@ bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle )
//
void FTNoIR_Protocol::getNameFromGame( char *dest )
{
- sprintf_s(dest, 99, "Microsoft FS2002/2004");
+ sprintf_s(dest, 99, "FS2002/2004");
return;
}
@@ -225,9 +223,9 @@ void FTNoIR_Protocol::getNameFromGame( char *dest )
// GetProtocol - Undecorated name, which can be easily used with GetProcAddress
// Win32 API function.
// _GetProtocol@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetProtocol=_GetProtocol@0")
+//#pragma comment(linker, "/export:GetProtocol=_GetProtocol@0")
-FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
+extern "C" FTNOIR_PROTOCOL_BASE_EXPORT void* CALLING_CONVENTION GetConstructor(void)
{
- return new FTNoIR_Protocol;
+ return (FTNoIR_Protocol*) new FTNoIR_Protocol;
}
diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h
index 8503f6e7..84d5d180 100644
--- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h
+++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h
@@ -31,6 +31,7 @@
#include "Windows.h"
#include <stdlib.h>
#include "FSUIPC_User.h"
+#include "facetracknoir/global-settings.h"
#include "..\ftnoir_protocol_base\ftnoir_protocol_base.h"
#include "ui_FTNoIR_FSUIPCcontrols.h"
@@ -43,7 +44,6 @@
#include <QFileDialog>
static const char* FSUIPC_FILENAME = "C:\\Program Files\\Microsoft Games\\Flight Simulator 9\\Modules\\FSUIPC.dll";
-static const char* FT_PROGRAMID = "FT_ProgramID"; // For message to FaceTrackNoIR main-window.
//
// Define the structures necessary for the FSUIPC_Write calls
@@ -65,7 +65,7 @@ public:
void Release();
void Initialize();
- bool checkServerInstallationOK( HANDLE handle );
+ bool checkServerInstallationOK();
void sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose );
void getNameFromGame( char *dest ); // Take care dest can handle up to 100 chars...
@@ -76,9 +76,6 @@ private:
QString LocationOfDLL;
float prevPosX, prevPosY, prevPosZ, prevRotX, prevRotY, prevRotZ;
- bool blnConnectionActive;
- HANDLE hMainWindow; // Save the handle to FaceTrackNoIR main-window
-
static int scale2AnalogLimits( float x, float min_x, float max_x );
void loadSettings();
};
@@ -121,7 +118,7 @@ private slots:
//*******************************************************************************************************
// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol
//*******************************************************************************************************
-class FTNoIR_ProtocolDll : public IProtocolDll
+class FTNoIR_ProtocolDll : public Metadata
{
public:
FTNoIR_ProtocolDll();
@@ -131,7 +128,7 @@ public:
void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FSUIPC"); };
void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Microsoft FS2004 protocol"); };
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/FS9.ico"); };
+ void getIcon(QIcon *icon) { *icon = QIcon(":/images/FS9.png"); };
};
diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp
index 08c13c08..eca04985 100644
--- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp
+++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp
@@ -31,6 +31,7 @@
The functions to get the name(s) and icon were removed from the two other classes.
*/
#include "ftnoir_protocol_fsuipc.h"
+#include "facetracknoir/global-settings.h"
//*******************************************************************************************************
// FaceTrackNoIR Client Settings-dialog.
@@ -189,9 +190,9 @@ void FSUIPCControls::getLocationOfDLL()
// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
// Win32 API function.
// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
+//#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
+extern "C" FTNOIR_PROTOCOL_BASE_EXPORT void* CALLING_CONVENTION GetDialog(void)
{
- return new FSUIPCControls;
+ return (IProtocolDialog*) new FSUIPCControls;
}
diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp
index d61c2d83..72d99fb9 100644
--- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp
+++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp
@@ -32,6 +32,7 @@
*/
#include "ftnoir_protocol_fsuipc.h"
#include <QDebug>
+#include "facetracknoir/global-settings.h"
FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() {
}
@@ -48,9 +49,9 @@ FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll()
// GetProtocolDll - Undecorated name, which can be easily used with GetProcAddress
// Win32 API function.
// _GetProtocolDll@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetProtocolDll=_GetProtocolDll@0")
+//#pragma comment(linker, "/export:GetProtocolDll=_GetProtocolDll@0")
-FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDllPtr __stdcall GetProtocolDll()
+extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata(void)
{
return new FTNoIR_ProtocolDll;
}
diff --git a/ftnoir_protocol_fsuipc/images/fs9.ico b/ftnoir_protocol_fsuipc/images/fs9.ico
new file mode 100644
index 00000000..9afd1953
--- /dev/null
+++ b/ftnoir_protocol_fsuipc/images/fs9.ico
Binary files differ