diff --git a/manager/index.html b/manager/index.html index 35a452c5..0bed270c 100644 --- a/manager/index.html +++ b/manager/index.html @@ -9,7 +9,7 @@ href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;600;700;800&display=swap" /> - DCS Olympus Manager v{{OLYMPUS_VERSION_NUMBER}} + DCS Olympus Manager {{OLYMPUS_VERSION_NUMBER}} @@ -24,7 +24,7 @@
DCS Olympus Manager
-
v{{OLYMPUS_VERSION_NUMBER}}
+
{{OLYMPUS_VERSION_NUMBER}}
These are the DCS instances that the Olympus Manager has automatically detected in your system.
diff --git a/manager/javascripts/preload.js b/manager/javascripts/preload.js index 33bafd49..659c8ae3 100644 --- a/manager/javascripts/preload.js +++ b/manager/javascripts/preload.js @@ -108,13 +108,13 @@ function delay(ms) { async function installOlympus(folder) { console.log(`Installing Olympus in ${folder}`); fs.cpSync(path.join("..", "mod"), path.join(folder, "Mods", "Services", "Olympus"), {recursive: true}); - fs.cpSync(path.join("..", "scripts", "OlympusHook.lua"), path.join(folder, "Scripts", "OlympusHook.lua")); + fs.cpSync(path.join("..", "scripts", "OlympusHook.lua"), path.join(folder, "Scripts", "Hook", "OlympusHook.lua")); fs.cpSync(path.join("..", "olympus.json"), path.join(folder, "Config", "olympus.json")); if (createDesktopShortcut({ windows: { filePath: path.resolve(__dirname, '..', '..', 'client', 'client.vbs'), outputPath: folder, - name: "DCS Olympus client", + name: "DCS Olympus Client", arguments: `"${path.join(folder, "Config", "olympus.json")}"`, icon: path.resolve(__dirname, '..', '..', 'img', 'olympus.ico'), workingDirectory: path.resolve(__dirname, '..', '..', 'client') @@ -124,7 +124,7 @@ async function installOlympus(folder) { windows: { filePath: path.resolve(__dirname, '..', '..', 'client', 'server.vbs'), outputPath: folder, - name: "DCS Olympus server", + name: "DCS Olympus Server", arguments: `"${path.join(folder, "Config", "olympus.json")}"`, icon: path.resolve(__dirname, '..', '..', 'img', 'olympus_server.ico'), workingDirectory: path.resolve(__dirname, '..', '..', 'client') @@ -207,7 +207,7 @@ class InstanceDiv { if (createDesktopShortcut({ windows: { filePath: path.resolve(__dirname, '..', '..', 'client', 'client.vbs'), - name: "DCS Olympus client", + name: "DCS Olympus Client", arguments: `"${path.join(this.folder, "Config", "olympus.json")}"`, icon: path.resolve(__dirname, '..', '..', 'img', 'olympus.ico'), workingDirectory: path.resolve(__dirname, '..', '..', 'client') @@ -215,7 +215,7 @@ class InstanceDiv { }) && createDesktopShortcut({ windows: { filePath: path.resolve(__dirname, '..', '..', 'client', 'server.vbs'), - name: "DCS Olympus server", + name: "DCS Olympus Server", arguments: `"${path.join(this.folder, "Config", "olympus.json")}"`, icon: path.resolve(__dirname, '..', '..', 'img', 'olympus_server.ico'), workingDirectory: path.resolve(__dirname, '..', '..', 'client') diff --git a/manager/manager.js b/manager/manager.js index aa03834b..be66a47a 100644 --- a/manager/manager.js +++ b/manager/manager.js @@ -15,7 +15,7 @@ function createWindow() { preload: path.join(__dirname, "javascripts", 'preload.js'), nodeIntegration: true, // like here }, - icon: "./../img/olympus.ico" + icon: "./../img/olympus_configurator.ico" }); window.loadFile('index.html').then(() => { window.show(); }); diff --git a/manager/stylesheets/style.css b/manager/stylesheets/style.css index 85a790ab..426f2a05 100644 --- a/manager/stylesheets/style.css +++ b/manager/stylesheets/style.css @@ -70,7 +70,7 @@ body { } #header>div:first-child>div:last-child { - color: green; + width: 100px; } #header>div:last-child { diff --git a/src/core/src/scriptloader.cpp b/src/core/src/scriptloader.cpp index 9b6b713f..c3e1c18a 100644 --- a/src/core/src/scriptloader.cpp +++ b/src/core/src/scriptloader.cpp @@ -2,6 +2,7 @@ #include "logger.h" #include "luatools.h" #include "dcstools.h" +#include "defines.h" #include @@ -38,9 +39,9 @@ void registerLuaFunctions(lua_State* L) log("protectedCall registered successfully"); } - executeLuaScript(L, instancePath + "..\\Scripts\\mist.lua"); - executeLuaScript(L, instancePath + "..\\Scripts\\OlympusCommand.lua"); - executeLuaScript(L, instancePath + "..\\Scripts\\unitPayloads.lua"); - executeLuaScript(L, instancePath + "..\\Scripts\\templates.lua"); - executeLuaScript(L, instancePath + "..\\Scripts\\mods.lua"); + executeLuaScript(L, instancePath + MIST_SCRIPT); + executeLuaScript(L, instancePath + OLYMPUS_COMMAND_SCRIPT); + executeLuaScript(L, instancePath + UNIT_PAYLOADS_SCRIPT); + executeLuaScript(L, instancePath + TEMPLATES_SCRIPT); + executeLuaScript(L, instancePath + MODS_SCRIPT); } diff --git a/src/logger/include/interface.h b/src/logger/include/interface.h index f712e58d..802820ce 100644 --- a/src/logger/include/interface.h +++ b/src/logger/include/interface.h @@ -1,6 +1,7 @@ #pragma once #include "framework.h" +void DllExport setLogDirectory(std::string m_dirPath); void DllExport log(const std::string& sMessage, bool addToJSON = false); void DllExport log(const std::wstring& sMessage, bool addToJSON = false); void DllExport getLogsJSON(json::value& json, unsigned long long time); diff --git a/src/logger/include/logger.h b/src/logger/include/logger.h index aedd4655..529cbf54 100644 --- a/src/logger/include/logger.h +++ b/src/logger/include/logger.h @@ -8,6 +8,7 @@ public: void log(const string& sMessage, bool addToJSON); void log(const wstring& sMessage, bool addToJSON); void toJSON(json::value& json, unsigned long long time); + void setDirectory(string newDirPath); static Logger* GetLogger(); @@ -20,6 +21,7 @@ private: static Logger* m_pThis; static ofstream m_Logfile; static std::map m_logs; + static string m_dirPath; mutex mutexLock; diff --git a/src/logger/src/interface.cpp b/src/logger/src/interface.cpp index 95c3c9a3..7fdac629 100644 --- a/src/logger/src/interface.cpp +++ b/src/logger/src/interface.cpp @@ -4,6 +4,11 @@ #define LOGGER Logger::GetLogger() +void setLogDirectory(string m_dirPath) +{ + LOGGER->setDirectory(m_dirPath); +} + void log(const string& message, bool addToJSON) { LOGGER->log(message, addToJSON); diff --git a/src/logger/src/logger.cpp b/src/logger/src/logger.cpp index e32cf76f..78c5e217 100644 --- a/src/logger/src/logger.cpp +++ b/src/logger/src/logger.cpp @@ -8,25 +8,35 @@ const string Logger::m_sFileName = LOG_NAME; Logger* Logger::m_pThis = NULL; ofstream Logger::m_Logfile; std::map Logger::m_logs; +std::string m_dirPath; Logger::Logger() { } + Logger* Logger::GetLogger() { if (m_pThis == NULL) { m_pThis = new Logger(); - std::filesystem::path dirPath = std::filesystem::temp_directory_path(); - m_Logfile.open((dirPath.string() + m_sFileName).c_str(), ios::out); } return m_pThis; } +void Logger::setDirectory(string newDirPath) +{ + m_dirPath = newDirPath; +} + void Logger::Open() { - std::filesystem::path dirPath = std::filesystem::temp_directory_path(); - m_Logfile.open((dirPath.string() + m_sFileName).c_str(), ios::out | ios::app); + try { + m_Logfile.open((m_dirPath + m_sFileName).c_str(), ios::out | ios::app); + } + catch (...) { + std::filesystem::path m_dirPath = std::filesystem::temp_directory_path(); + m_Logfile.open((m_dirPath.string() + m_sFileName).c_str(), ios::out | ios::app); + } } void Logger::Close() diff --git a/src/olympus/src/olympus.cpp b/src/olympus/src/olympus.cpp index 62f5bd7c..b080000f 100644 --- a/src/olympus/src/olympus.cpp +++ b/src/olympus/src/olympus.cpp @@ -49,6 +49,9 @@ static int onSimulationStart(lua_State* L) { LogInfo(L, "Trying to load core.dll from " + modPath); SetDllDirectoryA(modPath.c_str()); + + setLogDirectory(modPath); + log("onSimulationStart callback called successfully"); string dllLocation = modPath + "\\core.dll"; diff --git a/src/shared/include/defines.h b/src/shared/include/defines.h index 4ded4e59..78fe8fac 100644 --- a/src/shared/include/defines.h +++ b/src/shared/include/defines.h @@ -1,8 +1,9 @@ #pragma once #define VERSION "v1.0.3.7bb90b4a8" -#define LOG_NAME "Olympus_log.txt" -#define REST_ADDRESS "http://localhost:30000" +#define LOG_NAME "..\\..\\..\\..\\Logs\\Olympus_log.txt" + +#define REST_ADDRESS "http://localhost:3001" #define REST_URI "olympus" #define UNITS_URI "units" #define WEAPONS_URI "weapons" @@ -19,3 +20,9 @@ #define HELICOPTER_DATABASE_PATH "..\\databases\\units\\helicopterdatabase.json" #define GROUNDUNIT_DATABASE_PATH "..\\databases\\units\\groundunitdatabase.json" #define NAVYUNIT_DATABASE_PATH "..\\databases\\units\\navyunitdatabase.json" + +#define MIST_SCRIPT "..\\Scripts\\mist.lua" +#define OLYMPUS_COMMAND_SCRIPT "..\\Scripts\\OlympusCommand.lua" +#define UNIT_PAYLOADS_SCRIPT "..\\Scripts\\unitPayloads.lua" +#define TEMPLATES_SCRIPT "..\\Scripts\\templates.lua" +#define MODS_SCRIPT "..\\Scripts\\mods.lua"