summaryrefslogtreecommitdiffhomepage
path: root/FaceTrackNoIR/FTIRServer.cpp
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2010-12-30 18:13:00 +0000
committerWim Vriend <facetracknoir@gmail.com>2010-12-30 18:13:00 +0000
commit26a42de2b739b8bf2cf9f1e1c849a681c1fcdc89 (patch)
treea44dfec3a52af472c14fe9009dfe9cbff507a097 /FaceTrackNoIR/FTIRServer.cpp
parent016d79347d429c291ea65eb95663e200e1e601f2 (diff)
Spent the day removing some bad-bugs in the fake TrackIR protocol and the SCServer protocol. Seems to work now?!
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@34 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FaceTrackNoIR/FTIRServer.cpp')
-rw-r--r--FaceTrackNoIR/FTIRServer.cpp83
1 files changed, 78 insertions, 5 deletions
diff --git a/FaceTrackNoIR/FTIRServer.cpp b/FaceTrackNoIR/FTIRServer.cpp
index 54570fcd..7268d1dc 100644
--- a/FaceTrackNoIR/FTIRServer.cpp
+++ b/FaceTrackNoIR/FTIRServer.cpp
@@ -32,24 +32,80 @@
FTIRServer::FTIRServer() {
loadSettings();
ProgramName = "";
+ dummyTrackIR = 0;
+ viewsStart = 0;
+ viewsStop = 0;
}
/** destructor **/
FTIRServer::~FTIRServer() {
//
+ // Destroy the File-mapping
+ //
+ FTIRDestroyMapping();
+
+ //
// Free the DLL's
//
FTIRClientLib.unload();
- FTIRViewsLib.unload();
+ if (viewsStop != NULL) {
+ viewsStop();
+ FTIRViewsLib.unload();
+ }
//
// Kill the dummy TrackIR process.
//
qDebug() << "FTIRServer::~FTIRServer() about to kill TrackIR.exe process";
- if (dummyTrackIR) {
- dummyTrackIR->kill();
+ try {
+ if (dummyTrackIR) {
+ dummyTrackIR->kill();
+ }
+ }
+ catch (...)
+ {
+ qDebug() << "~FTIRServer says: some error occurred";
}
+
+}
+
+/** destructor **/
+void FTIRServer::stopServer() {
+
+ ////
+ //// Destroy the File-mapping
+ ////
+ //FTIRDestroyMapping();
+
+ ////
+ //// Free the DLL's
+ ////
+ //try {
+ // FTIRClientLib.unload();
+ // if (useTIRViews && FTIRViewsLib.isLoaded()) {
+ // FTIRViewsLib.unload();
+ // }
+ //}
+ //catch (...)
+ //{
+ // qDebug() << "~FTIRServer says: some error occurred";
+ //}
+
+ ////
+ //// Kill the dummy TrackIR process.
+ ////
+ //qDebug() << "FTIRServer::~FTIRServer() about to kill TrackIR.exe process";
+ //try {
+ // if (dummyTrackIR) {
+ // dummyTrackIR->kill();
+ // }
+ //}
+ //catch (...)
+ // {
+ // qDebug() << "~FTIRServer says: some error occurred";
+ //}
+
}
//
@@ -124,9 +180,26 @@ void FTIRServer::FTIRDestroyMapping()
UnmapViewOfFile ( pMemData );
}
- CloseHandle( hFTIRMutex );
- CloseHandle( hFTIRMemMap );
+ if (hFTIRMutex != 0) {
+ CloseHandle( hFTIRMutex );
+ }
+ hFTIRMutex = 0;
+
+ if (hFTIRMemMap != 0) {
+ CloseHandle( hFTIRMemMap );
+ }
hFTIRMemMap = 0;
+
+}
+
+//
+// Get the program-name from the client (Game!).
+//
+QString FTIRServer::GetProgramName() {
+QString *str;
+
+ str = new QString("Test");
+ return *str;
}
//