diff --git a/Dalamud.Boot/DalamudStartInfo.cpp b/Dalamud.Boot/DalamudStartInfo.cpp index 5a825f4a0..76e60a78e 100644 --- a/Dalamud.Boot/DalamudStartInfo.cpp +++ b/Dalamud.Boot/DalamudStartInfo.cpp @@ -79,6 +79,7 @@ void from_json(const nlohmann::json& json, DalamudStartInfo& config) { config.GameVersion = json.value("GameVersion", config.GameVersion); config.DelayInitializeMs = json.value("DelayInitializeMs", config.DelayInitializeMs); + config.BootLogPath = json.value("BootLogPath", config.BootLogPath); config.BootShowConsole = json.value("BootShowConsole", config.BootShowConsole); config.BootDisableFallbackConsole = json.value("BootDisableFallbackConsole", config.BootDisableFallbackConsole); config.BootWaitMessageBox = json.value("BootWaitMessageBox", config.BootWaitMessageBox); @@ -99,6 +100,7 @@ void from_json(const nlohmann::json& json, DalamudStartInfo& config) { } void DalamudStartInfo::from_envvars() { + BootLogPath = utils::get_env(L"DALAMUD_BOOT_LOGFILE"); BootShowConsole = utils::get_env(L"DALAMUD_SHOW_CONSOLE"); BootDisableFallbackConsole = utils::get_env(L"DALAMUD_DISABLE_FALLBACK_CONSOLE"); BootWaitMessageBox = static_cast(utils::get_env(L"DALAMUD_WAIT_MESSAGEBOX")); diff --git a/Dalamud.Boot/DalamudStartInfo.h b/Dalamud.Boot/DalamudStartInfo.h index 3dd19fc0c..dcf75d663 100644 --- a/Dalamud.Boot/DalamudStartInfo.h +++ b/Dalamud.Boot/DalamudStartInfo.h @@ -31,6 +31,7 @@ struct DalamudStartInfo { std::string GameVersion; int DelayInitializeMs = 0; + std::string BootLogPath; bool BootShowConsole = false; bool BootDisableFallbackConsole = false; WaitMessageboxFlags BootWaitMessageBox = WaitMessageboxFlags::None; diff --git a/Dalamud.Boot/dllmain.cpp b/Dalamud.Boot/dllmain.cpp index 72c56e939..01e09cd0b 100644 --- a/Dalamud.Boot/dllmain.cpp +++ b/Dalamud.Boot/dllmain.cpp @@ -1,5 +1,7 @@ #include "pch.h" +#include + #include "DalamudStartInfo.h" #include "logging.h" #include "utils.h" @@ -26,8 +28,10 @@ DllExport DWORD WINAPI Initialize(LPVOID lpParam, HANDLE hMainThreadContinue) { logging::update_dll_load_status(true); + const auto logFilePath = unicode::convert(g_startInfo.BootLogPath); + auto attemptFallbackLog = false; - if (const auto logFilePath = utils::get_env("DALAMUD_BOOT_LOGFILE"); logFilePath.empty()) { + if (logFilePath.empty()) { attemptFallbackLog = true; logging::I("No log file path given; not logging to file.");