More recording
This commit is contained in:
+18
-5
@@ -43,6 +43,7 @@ XPLMDataRef roll;
|
||||
XPLMDataRef quaternion;
|
||||
|
||||
data toSend;
|
||||
Path p;
|
||||
|
||||
/*
|
||||
* Callbacks
|
||||
@@ -162,6 +163,12 @@ PLUGIN_API void XPluginStop(void)
|
||||
wantsExit = true;
|
||||
delete connector;
|
||||
serverThread.join();
|
||||
recordingThread.join();
|
||||
|
||||
std::ofstream out("Resources/plugins/GAConnector/flight.rec");
|
||||
out.write(reinterpret_cast<const char *>(p.getBinaryData()),
|
||||
(std::streamsize)p.getBinaryLength());
|
||||
out.close();
|
||||
}
|
||||
|
||||
PLUGIN_API void XPluginDisable(void) {}
|
||||
@@ -240,7 +247,7 @@ void recordingWorker()
|
||||
{
|
||||
util::setThreadName("GARecordingWorker");
|
||||
|
||||
Path p;
|
||||
PathSegment lastPath;
|
||||
|
||||
while (!wantsExit) {
|
||||
data copy;
|
||||
@@ -250,10 +257,16 @@ void recordingWorker()
|
||||
memcpy(©, &toSend, sizeof(data));
|
||||
}
|
||||
|
||||
p.addSegment({static_cast<std::uint16_t>(copy.alt),
|
||||
static_cast<std::uint16_t>(copy.gs),
|
||||
copy.lat,
|
||||
copy.lon});
|
||||
PathSegment currentPath(static_cast<std::uint16_t>(copy.alt),
|
||||
static_cast<std::uint16_t>(copy.gs),
|
||||
copy.lat,
|
||||
copy.lon);
|
||||
|
||||
if (strcmp(copy.path, "") != 0 && copy.pause &&
|
||||
lastPath != currentPath) {
|
||||
p.addSegment(currentPath);
|
||||
lastPath = currentPath;
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user