summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-07-05 19:05:29 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-07-05 19:05:29 +0200
commit2bcab030f7640387e015f232df6254e1806aa586 (patch)
treec00cb9a787c25d44364ba9a49de4196d7e4a539c /ftnoir_protocol_sc/ftnoir_protocol_sc.cpp
parent66fbdecd8aec780f2dbce6576c3df090aaf916dd (diff)
simconnect: allow operating after restarting fsx
Diffstat (limited to 'ftnoir_protocol_sc/ftnoir_protocol_sc.cpp')
-rw-r--r--ftnoir_protocol_sc/ftnoir_protocol_sc.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp
index 1735305c..eb8d1a79 100644
--- a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp
+++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp
@@ -44,22 +44,24 @@ void FTNoIR_Protocol::run()
{
Affinity thr;
- if (!SUCCEEDED(simconnect_open(&hSimConnect, "FaceTrackNoIR", NULL, 0, 0, 0)))
- return;
+ while (!should_stop)
+ {
+ if (SUCCEEDED(simconnect_open(&hSimConnect, "opentrack", NULL, 0, 0, 0)))
+ {
+ simconnect_subscribetosystemevent(hSimConnect, 0, "Frame");
- simconnect_subscribetosystemevent(hSimConnect, EVENT_PING, "Frame");
+ while (!should_stop)
+ {
+ if (FAILED(simconnect_calldispatch(hSimConnect, processNextSimconnectEvent, reinterpret_cast<void*>(this))))
+ break;
+ Sleep(1);
+ }
- //simconnect_mapclienteventtosimevent(hSimConnect, EVENT_INIT, "");
- //simconnect_addclienteventtonotificationgroup(hSimConnect, GROUP0, EVENT_INIT, false);
- //simconnect_setnotificationgrouppriority(hSimConnect, GROUP0, SIMCONNECT_GROUP_PRIORITY_HIGHEST_MASKABLE);
+ (void) simconnect_close(hSimConnect);
+ }
- while (!should_stop)
- {
- (void) (simconnect_calldispatch(hSimConnect, processNextSimconnectEvent, reinterpret_cast<void*>(this)));
- Sleep(1);
+ Sleep(100);
}
-
- (void) simconnect_close(hSimConnect);
}
void FTNoIR_Protocol::pose( const double *headpose ) {