mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
@@ -27,17 +27,18 @@ Logger* Logger::GetLogger()
|
|||||||
void Logger::setDirectory(string newDirPath)
|
void Logger::setDirectory(string newDirPath)
|
||||||
{
|
{
|
||||||
m_dirPath = newDirPath;
|
m_dirPath = newDirPath;
|
||||||
|
Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logger::Clear()
|
void Logger::Clear()
|
||||||
{
|
{
|
||||||
lock_guard<mutex> guard(mutexLock);
|
lock_guard<mutex> guard(mutexLock);
|
||||||
try {
|
try {
|
||||||
m_Logfile.open((m_dirPath + m_sFileName).c_str(), ios::out | std::ios::trunc);
|
m_Logfile.open((m_dirPath + m_sFileName).c_str(), ios::out | ios::trunc);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
std::filesystem::path m_dirPath = std::filesystem::temp_directory_path();
|
std::filesystem::path m_dirPath = std::filesystem::temp_directory_path();
|
||||||
m_Logfile.open((m_dirPath.string() + m_sFileName).c_str(), ios::out | std::ios::trunc);
|
m_Logfile.open((m_dirPath.string() + m_sFileName).c_str(), ios::out | ios::trunc);
|
||||||
}
|
}
|
||||||
m_Logfile << "Creating a new log instance\n";
|
m_Logfile << "Creating a new log instance\n";
|
||||||
m_pThis->Close();
|
m_pThis->Close();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ local _prevLuaExportStop = LuaExportStop
|
|||||||
local server = nil
|
local server = nil
|
||||||
local port = 3003
|
local port = 3003
|
||||||
local headers = "Access-Control-Allow-Private-Network: true\r\nAccess-Control-Allow-Origin: *\r\nAccess-Control-Allow-Methods: *\r\nAccess-Control-Allow-Headers: *\r\nAccess-Control-Max-Age: 86400\r\nVary: Accept-Encoding, Origin\r\n\r\n"
|
local headers = "Access-Control-Allow-Private-Network: true\r\nAccess-Control-Allow-Origin: *\r\nAccess-Control-Allow-Methods: *\r\nAccess-Control-Allow-Headers: *\r\nAccess-Control-Max-Age: 86400\r\nVary: Accept-Encoding, Origin\r\n\r\n"
|
||||||
|
local positionToSet = nil
|
||||||
|
|
||||||
function startTCPServer()
|
function startTCPServer()
|
||||||
log.write('OLYMPUSCAMERACONTROL.EXPORT.LUA', log.INFO, 'Starting TCP Server')
|
log.write('OLYMPUSCAMERACONTROL.EXPORT.LUA', log.INFO, 'Starting TCP Server')
|
||||||
@@ -36,8 +37,6 @@ function receiveTCP()
|
|||||||
local acc = ""
|
local acc = ""
|
||||||
local data = ""
|
local data = ""
|
||||||
|
|
||||||
log.write('OLYMPUSCAMERACONTROL.EXPORT.LUA', log.INFO, 'CONNECTION')
|
|
||||||
|
|
||||||
-- Start receiving data, accumulate it in acc
|
-- Start receiving data, accumulate it in acc
|
||||||
while data ~= nil do
|
while data ~= nil do
|
||||||
-- Receive a new line
|
-- Receive a new line
|
||||||
@@ -139,7 +138,9 @@ function setCameraPosition(position)
|
|||||||
z = {x = 0, y = 0, z = 1},
|
z = {x = 0, y = 0, z = 1},
|
||||||
p = {x = point.x, y = altitude, z = point.z}
|
p = {x = point.x, y = altitude, z = point.z}
|
||||||
}
|
}
|
||||||
LoSetCameraPosition(pos)
|
|
||||||
|
-- Store the value in a variable so that it can be set at the next frame
|
||||||
|
positionToSet = pos
|
||||||
|
|
||||||
return '{"northRotation": ' .. rotation .. '}'
|
return '{"northRotation": ' .. rotation .. '}'
|
||||||
end
|
end
|
||||||
@@ -160,6 +161,11 @@ LuaExportStart = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
LuaExportBeforeNextFrame = function()
|
LuaExportBeforeNextFrame = function()
|
||||||
|
if positionToSet ~= nil then
|
||||||
|
LoSetCameraPosition(positionToSet)
|
||||||
|
positionToSet = nil
|
||||||
|
end
|
||||||
|
|
||||||
receiveTCP()
|
receiveTCP()
|
||||||
|
|
||||||
-- call original
|
-- call original
|
||||||
|
|||||||
Reference in New Issue
Block a user