diff --git a/Dalamud.Boot/Dalamud.Boot.vcxproj b/Dalamud.Boot/Dalamud.Boot.vcxproj
index fe33e5406..e71750f47 100644
--- a/Dalamud.Boot/Dalamud.Boot.vcxproj
+++ b/Dalamud.Boot/Dalamud.Boot.vcxproj
@@ -121,6 +121,7 @@
NotUsing
NotUsing
+
NotUsing
@@ -161,7 +162,7 @@
-
+
diff --git a/Dalamud.Boot/Dalamud.Boot.vcxproj.filters b/Dalamud.Boot/Dalamud.Boot.vcxproj.filters
index 594264a3a..b527ec60c 100644
--- a/Dalamud.Boot/Dalamud.Boot.vcxproj.filters
+++ b/Dalamud.Boot/Dalamud.Boot.vcxproj.filters
@@ -70,6 +70,9 @@
Dalamud.Boot DLL
+
+ Dalamud.Boot DLL
+
@@ -99,7 +102,7 @@
Dalamud.Boot DLL
-
+
Dalamud.Boot DLL
diff --git a/Dalamud.Boot/DalamudStartInfo.cpp b/Dalamud.Boot/DalamudStartInfo.cpp
new file mode 100644
index 000000000..5a825f4a0
--- /dev/null
+++ b/Dalamud.Boot/DalamudStartInfo.cpp
@@ -0,0 +1,113 @@
+#include "pch.h"
+#include "DalamudStartInfo.h"
+
+#include "utils.h"
+
+DalamudStartInfo g_startInfo;
+
+void from_json(const nlohmann::json& json, DalamudStartInfo::WaitMessageboxFlags& value) {
+ if (json.is_number_integer()) {
+ value = static_cast(json.get());
+
+ } else if (json.is_array()) {
+ value = DalamudStartInfo::WaitMessageboxFlags::None;
+ for (const auto& item : json) {
+ if (item.is_number_integer()) {
+ value = static_cast(static_cast(value) | item.get());
+
+ } else if (item.is_string()) {
+ const auto iteml = unicode::convert(item.get(), &unicode::lower);
+ if (item == "beforeinitialize")
+ value = static_cast(static_cast(value) | static_cast(DalamudStartInfo::WaitMessageboxFlags::BeforeInitialize));
+ else if (item == "beforedalamudentrypoint")
+ value = static_cast(static_cast(value) | static_cast(DalamudStartInfo::WaitMessageboxFlags::BeforeDalamudEntrypoint));
+ }
+ }
+
+ } else if (json.is_string()) {
+ value = DalamudStartInfo::WaitMessageboxFlags::None;
+ for (const auto& item : utils::split(json.get(), ",")) {
+ const auto iteml = unicode::convert(item, &unicode::lower);
+ if (iteml == "beforeinitialize")
+ value = static_cast(static_cast(value) | static_cast(DalamudStartInfo::WaitMessageboxFlags::BeforeInitialize));
+ else if (iteml == "beforedalamudentrypoint")
+ value = static_cast(static_cast(value) | static_cast(DalamudStartInfo::WaitMessageboxFlags::BeforeDalamudEntrypoint));
+ }
+ }
+}
+
+void from_json(const nlohmann::json& json, DalamudStartInfo::DotNetOpenProcessHookMode& value) {
+ if (json.is_number_integer()) {
+ value = static_cast(json.get());
+
+ } else if (json.is_string()) {
+ const auto langstr = unicode::convert(json.get(), &unicode::lower);
+ if (langstr == "importhooks")
+ value = DalamudStartInfo::DotNetOpenProcessHookMode::ImportHooks;
+ else if (langstr == "directhook")
+ value = DalamudStartInfo::DotNetOpenProcessHookMode::DirectHook;
+ }
+}
+
+void from_json(const nlohmann::json& json, DalamudStartInfo::ClientLanguage& value) {
+ if (json.is_number_integer()) {
+ value = static_cast(json.get());
+
+ } else if (json.is_string()) {
+ const auto langstr = unicode::convert(json.get(), &unicode::lower);
+ if (langstr == "japanese")
+ value = DalamudStartInfo::ClientLanguage::Japanese;
+ else if (langstr == "english")
+ value = DalamudStartInfo::ClientLanguage::English;
+ else if (langstr == "german")
+ value = DalamudStartInfo::ClientLanguage::German;
+ else if (langstr == "french")
+ value = DalamudStartInfo::ClientLanguage::French;
+ }
+}
+
+void from_json(const nlohmann::json& json, DalamudStartInfo& config) {
+ if (!json.is_object())
+ return;
+
+ config.WorkingDirectory = json.value("WorkingDirectory", config.WorkingDirectory);
+ config.ConfigurationPath = json.value("ConfigurationPath", config.ConfigurationPath);
+ config.PluginDirectory = json.value("PluginDirectory", config.PluginDirectory);
+ config.DefaultPluginDirectory = json.value("DefaultPluginDirectory", config.DefaultPluginDirectory);
+ config.AssetDirectory = json.value("AssetDirectory", config.AssetDirectory);
+ config.Language = json.value("Language", config.Language);
+ config.GameVersion = json.value("GameVersion", config.GameVersion);
+ config.DelayInitializeMs = json.value("DelayInitializeMs", config.DelayInitializeMs);
+
+ config.BootShowConsole = json.value("BootShowConsole", config.BootShowConsole);
+ config.BootDisableFallbackConsole = json.value("BootDisableFallbackConsole", config.BootDisableFallbackConsole);
+ config.BootWaitMessageBox = json.value("BootWaitMessageBox", config.BootWaitMessageBox);
+ config.BootWaitDebugger = json.value("BootWaitDebugger", config.BootWaitDebugger);
+ config.BootVehEnabled = json.value("BootVehEnabled", config.BootVehEnabled);
+ config.BootVehFull = json.value("BootVehFull", config.BootVehFull);
+ config.BootDotnetOpenProcessHookMode = json.value("BootDotnetOpenProcessHookMode", config.BootDotnetOpenProcessHookMode);
+ if (const auto it = json.find("EnabledGameFixes"); it != json.end() && it->is_array()) {
+ config.BootEnabledGameFixes.clear();
+ for (const auto& val : *it)
+ config.BootEnabledGameFixes.insert(unicode::convert(val.get(), &unicode::lower));
+ }
+ if (const auto it = json.find("BootUnhookDlls"); it != json.end() && it->is_array()) {
+ config.BootUnhookDlls.clear();
+ for (const auto& val : *it)
+ config.BootUnhookDlls.insert(unicode::convert(val.get(), &unicode::lower));
+ }
+}
+
+void DalamudStartInfo::from_envvars() {
+ 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"));
+ BootWaitDebugger = utils::get_env(L"DALAMUD_WAIT_DEBUGGER");
+ BootVehEnabled = utils::get_env(L"DALAMUD_IS_VEH");
+ BootVehFull = utils::get_env(L"DALAMUD_IS_VEH_FULL");
+ BootDotnetOpenProcessHookMode = static_cast(utils::get_env(L"DALAMUD_DOTNET_OPENPROCESS_HOOKMODE"));
+ for (const auto& item : utils::get_env_list(L"DALAMUD_GAMEFIX_LIST"))
+ BootEnabledGameFixes.insert(unicode::convert(item, &unicode::lower));
+ for (const auto& item : utils::get_env_list(L"DALAMUD_UNHOOK_DLLS"))
+ BootUnhookDlls.insert(unicode::convert(item, &unicode::lower));
+}
diff --git a/Dalamud.Boot/DalamudStartInfo.h b/Dalamud.Boot/DalamudStartInfo.h
new file mode 100644
index 000000000..3dd19fc0c
--- /dev/null
+++ b/Dalamud.Boot/DalamudStartInfo.h
@@ -0,0 +1,48 @@
+#pragma once
+
+struct DalamudStartInfo {
+ enum class WaitMessageboxFlags : int {
+ None = 0,
+ BeforeInitialize = 1 << 0,
+ BeforeDalamudEntrypoint = 1 << 1,
+ };
+ friend void from_json(const nlohmann::json&, WaitMessageboxFlags&);
+
+ enum class DotNetOpenProcessHookMode : int {
+ ImportHooks = 0,
+ DirectHook = 1,
+ };
+ friend void from_json(const nlohmann::json&, DotNetOpenProcessHookMode&);
+
+ enum class ClientLanguage : int {
+ Japanese,
+ English,
+ German,
+ French,
+ };
+ friend void from_json(const nlohmann::json&, ClientLanguage&);
+
+ std::string WorkingDirectory;
+ std::string ConfigurationPath;
+ std::string PluginDirectory;
+ std::string DefaultPluginDirectory;
+ std::string AssetDirectory;
+ ClientLanguage Language = ClientLanguage::English;
+ std::string GameVersion;
+ int DelayInitializeMs = 0;
+
+ bool BootShowConsole = false;
+ bool BootDisableFallbackConsole = false;
+ WaitMessageboxFlags BootWaitMessageBox = WaitMessageboxFlags::None;
+ bool BootWaitDebugger = false;
+ bool BootVehEnabled = false;
+ bool BootVehFull = false;
+ DotNetOpenProcessHookMode BootDotnetOpenProcessHookMode = DotNetOpenProcessHookMode::ImportHooks;
+ std::set BootEnabledGameFixes{};
+ std::set BootUnhookDlls{};
+
+ friend void from_json(const nlohmann::json&, DalamudStartInfo&);
+ void from_envvars();
+};
+
+extern DalamudStartInfo g_startInfo;
diff --git a/Dalamud.Boot/bootconfig.h b/Dalamud.Boot/bootconfig.h
deleted file mode 100644
index 574a7f4ef..000000000
--- a/Dalamud.Boot/bootconfig.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#pragma once
-
-#include "utils.h"
-
-namespace bootconfig {
- enum WaitMessageboxFlags : int {
- None = 0,
- BeforeInitialize = 1 << 0,
- BeforeDalamudEntrypoint = 1 << 1,
- };
-
- inline WaitMessageboxFlags wait_messagebox() {
- return static_cast(utils::get_env(L"DALAMUD_WAIT_MESSAGEBOX"));
- }
-
- enum DotNetOpenProcessHookMode : int {
- ImportHooks = 0,
- DirectHook = 1,
- };
-
- inline DotNetOpenProcessHookMode dotnet_openprocess_hook_mode() {
- return static_cast(utils::get_env(L"DALAMUD_DOTNET_OPENPROCESS_HOOKMODE"));
- }
-
- inline bool is_show_console() {
- return utils::get_env(L"DALAMUD_SHOW_CONSOLE");
- }
-
- inline bool is_disable_fallback_console() {
- return utils::get_env(L"DALAMUD_DISABLE_FALLBACK_CONSOLE");
- }
-
- inline bool is_wait_debugger() {
- return utils::get_env(L"DALAMUD_WAIT_DEBUGGER");
- }
-
- inline bool is_veh_enabled() {
- return utils::get_env(L"DALAMUD_IS_VEH");
- }
-
- inline bool is_veh_full() {
- return utils::get_env(L"DALAMUD_IS_VEH_FULL");
- }
-
- inline bool gamefix_is_enabled(const wchar_t* name) {
- static const auto list = utils::get_env_list(L"DALAMUD_GAMEFIX_LIST");
- for (const auto& item : list)
- if (item == name)
- return true;
- return false;
- }
-
- inline std::vector gamefix_unhookdll_list() {
- return utils::get_env_list(L"DALAMUD_UNHOOK_DLLS");
- }
-}
diff --git a/Dalamud.Boot/dllmain.cpp b/Dalamud.Boot/dllmain.cpp
index 62cac4e24..72c56e939 100644
--- a/Dalamud.Boot/dllmain.cpp
+++ b/Dalamud.Boot/dllmain.cpp
@@ -1,7 +1,8 @@
#include "pch.h"
-#include "bootconfig.h"
+#include "DalamudStartInfo.h"
#include "logging.h"
+#include "utils.h"
#include "veh.h"
#include "xivfixes.h"
@@ -9,30 +10,69 @@ HMODULE g_hModule;
HINSTANCE g_hGameInstance = GetModuleHandleW(nullptr);
DllExport DWORD WINAPI Initialize(LPVOID lpParam, HANDLE hMainThreadContinue) {
- if (bootconfig::is_show_console())
+ MessageBoxW(nullptr, L"", L"", MB_OK);
+
+ g_startInfo.from_envvars();
+
+ std::string jsonParseError;
+ try {
+ from_json(nlohmann::json::parse(std::string_view(static_cast(lpParam))), g_startInfo);
+ } catch (const std::exception& e) {
+ jsonParseError = e.what();
+ }
+
+ if (g_startInfo.BootShowConsole)
ConsoleSetup(L"Dalamud Boot");
logging::update_dll_load_status(true);
+ auto attemptFallbackLog = false;
if (const auto logFilePath = utils::get_env("DALAMUD_BOOT_LOGFILE"); logFilePath.empty()) {
- if (!bootconfig::is_show_console() && !bootconfig::is_disable_fallback_console())
- ConsoleSetup(L"Dalamud Boot - Fallback Console");
+ attemptFallbackLog = true;
logging::I("No log file path given; not logging to file.");
} else {
try {
- logging::start_file_logging(logFilePath, !bootconfig::is_show_console());
+ logging::start_file_logging(logFilePath, !g_startInfo.BootShowConsole);
logging::I("Logging to file: {}", logFilePath);
} catch (const std::exception& e) {
- if (!bootconfig::is_show_console() && !bootconfig::is_disable_fallback_console())
- ConsoleSetup(L"Dalamud Boot - Fallback Console");
+ attemptFallbackLog = true;
logging::E("Couldn't open log file: {}", logFilePath);
logging::E("Error: {} / {}", errno, e.what());
}
}
+ if (!jsonParseError.empty())
+ logging::E("Couldn't parse input JSON: {}", jsonParseError);
+
+ if (attemptFallbackLog) {
+ std::wstring logFilePath(PATHCCH_MAX_CCH + 1, L'\0');
+ logFilePath.resize(GetTempPathW(static_cast(logFilePath.size()), &logFilePath[0]));
+ if (logFilePath.empty()) {
+ logFilePath.resize(PATHCCH_MAX_CCH + 1);
+ logFilePath.resize(GetCurrentDirectoryW(static_cast(logFilePath.size()), &logFilePath[0]));
+ }
+ if (!logFilePath.empty() && logFilePath.back() != '/' && logFilePath.back() != '\\')
+ logFilePath += L"\\";
+ SYSTEMTIME st;
+ GetLocalTime(&st);
+ logFilePath += std::format(L"Dalamud.Boot.{:04}{:02}{:02}.{:02}{:02}{:02}.{:03}.{}.log", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds, GetCurrentProcessId());
+
+ try {
+ logging::start_file_logging(logFilePath, !g_startInfo.BootShowConsole);
+ logging::I("Logging to fallback log file: {}", logFilePath);
+
+ } catch (const std::exception& e) {
+ if (!g_startInfo.BootShowConsole && !g_startInfo.BootDisableFallbackConsole)
+ ConsoleSetup(L"Dalamud Boot - Fallback Console");
+
+ logging::E("Couldn't open fallback log file: {}", logFilePath);
+ logging::E("Error: {} / {}", errno, e.what());
+ }
+ }
+
auto minHookLoaded = false;
if (const auto mhStatus = MH_Initialize(); mhStatus == MH_OK) {
logging::I("MinHook initialized.");
@@ -47,7 +87,7 @@ DllExport DWORD WINAPI Initialize(LPVOID lpParam, HANDLE hMainThreadContinue) {
logging::I("Dalamud.Boot Injectable, (c) 2021 XIVLauncher Contributors");
logging::I("Built at: " __DATE__ "@" __TIME__);
- if (bootconfig::wait_messagebox() & bootconfig::WaitMessageboxFlags::BeforeInitialize)
+ if (static_cast(g_startInfo.BootWaitMessageBox) & static_cast(DalamudStartInfo::WaitMessageboxFlags::BeforeInitialize))
MessageBoxW(nullptr, L"Press OK to continue", L"Dalamud Boot", MB_OK);
if (minHookLoaded) {
@@ -58,7 +98,7 @@ DllExport DWORD WINAPI Initialize(LPVOID lpParam, HANDLE hMainThreadContinue) {
logging::W("Skipping fixes, as MinHook has failed to load.");
}
- if (bootconfig::is_wait_debugger()) {
+ if (g_startInfo.BootWaitDebugger) {
logging::I("Waiting for debugger to attach...");
while (!IsDebuggerPresent())
Sleep(100);
@@ -94,8 +134,8 @@ DllExport DWORD WINAPI Initialize(LPVOID lpParam, HANDLE hMainThreadContinue) {
logging::I("Initializing VEH...");
if (utils::is_running_on_linux()) {
logging::I("=> VEH was disabled, running on linux");
- } else if (bootconfig::is_veh_enabled()) {
- if (veh::add_handler(bootconfig::is_veh_full()))
+ } else if (g_startInfo.BootVehEnabled) {
+ if (veh::add_handler(g_startInfo.BootVehFull))
logging::I("=> Done!");
else
logging::I("=> Failed!");
@@ -105,7 +145,7 @@ DllExport DWORD WINAPI Initialize(LPVOID lpParam, HANDLE hMainThreadContinue) {
// ============================== Dalamud ==================================== //
- if (bootconfig::wait_messagebox() & bootconfig::WaitMessageboxFlags::BeforeDalamudEntrypoint)
+ if (static_cast(g_startInfo.BootWaitMessageBox) & static_cast(DalamudStartInfo::WaitMessageboxFlags::BeforeDalamudEntrypoint))
MessageBoxW(nullptr, L"Press OK to continue", L"Dalamud Boot", MB_OK);
if (hMainThreadContinue) {
diff --git a/Dalamud.Boot/pch.h b/Dalamud.Boot/pch.h
index 37f15f1b1..bbd4b3d73 100644
--- a/Dalamud.Boot/pch.h
+++ b/Dalamud.Boot/pch.h
@@ -53,6 +53,9 @@
#include "../lib/CoreCLR/CoreCLR.h"
#include "../lib/CoreCLR/boot.h"
+// https://github.com/nlohmann/json
+#include "../lib/nlohmann-json/json.hpp"
+
#include "unicode.h"
// Commonly used macros
diff --git a/Dalamud.Boot/unicode.cpp b/Dalamud.Boot/unicode.cpp
index 9598fb509..b558d667a 100644
--- a/Dalamud.Boot/unicode.cpp
+++ b/Dalamud.Boot/unicode.cpp
@@ -231,3 +231,15 @@ size_t unicode::encode(EncodingTag, char* ptr, char32_t c, bool strict) {
size_t unicode::encode(EncodingTag, wchar_t* ptr, char32_t c, bool strict) {
return encode(EncodingTag(), reinterpret_cast(ptr), c, strict);
}
+
+char32_t unicode::lower(char32_t in) {
+ if ('A' <= in && in <= 'Z')
+ return in - 'A' + 'a';
+ return in;
+}
+
+char32_t unicode::upper(char32_t in) {
+ if ('a' <= in && in <= 'z')
+ return in - 'a' + 'A';
+ return in;
+}
diff --git a/Dalamud.Boot/unicode.h b/Dalamud.Boot/unicode.h
index 1cc8c8349..c4e26bb41 100644
--- a/Dalamud.Boot/unicode.h
+++ b/Dalamud.Boot/unicode.h
@@ -41,52 +41,68 @@ namespace unicode {
return encode(EncodingTag(), ptr, c, strict);
}
+ char32_t lower(char32_t in);
+ char32_t upper(char32_t in);
+
template>
- inline TTo& convert(TTo& out, const std::basic_string_view& in, bool strict = true) {
+ TTo& convert(TTo& out, const std::basic_string_view& in, char32_t(*pfnCharMap)(char32_t) = nullptr, bool strict = false) {
out.reserve(out.size() + in.size() * 4 / sizeof(in[0]) / sizeof(out[0]));
char32_t c{};
- for (size_t decLen = 0, decIdx = 0; decIdx < in.size() && (decLen = unicode::decode(c, &in[decIdx], in.size() - decIdx, strict)); decIdx += decLen) {
+ for (size_t decLen = 0, decIdx = 0; decIdx < in.size() && ((decLen = decode(c, &in[decIdx], in.size() - decIdx, strict))); decIdx += decLen) {
+ if (pfnCharMap)
+ c = pfnCharMap(c);
+
const auto encIdx = out.size();
- const auto encLen = unicode::encode(nullptr, c, strict);
+ const auto encLen = encode(nullptr, c, strict);
out.resize(encIdx + encLen);
- unicode::encode(&out[encIdx], c, strict);
+ encode(&out[encIdx], c, strict);
}
return out;
}
template, class TFromAlloc = std::allocator>
- inline TTo& convert(TTo& out, const std::basic_string& in, bool strict = true) {
- return convert(out, std::basic_string_view(in), strict);
+ TTo& convert(TTo& out, const std::basic_string& in, char32_t(*pfnCharMap)(char32_t) = nullptr, bool strict = false) {
+ return convert(out, std::basic_string_view(in), pfnCharMap, strict);
}
template>>
- inline TTo& convert(TTo& out, const TFromElem* in, size_t length = (std::numeric_limits::max)(), bool strict = true) {
+ TTo& convert(TTo& out, const TFromElem* in, size_t length = (std::numeric_limits::max)(), char32_t(*pfnCharMap)(char32_t) = nullptr, bool strict = false) {
if (length == (std::numeric_limits::max)())
length = std::char_traits::length(in);
- return convert(out, std::basic_string_view(in, length), strict);
+ return convert(out, std::basic_string_view(in, length), pfnCharMap, strict);
}
template>
- inline TTo convert(const std::basic_string_view& in, bool strict = true) {
+ TTo convert(const std::basic_string_view& in, char32_t(*pfnCharMap)(char32_t) = nullptr, bool strict = false) {
TTo out{};
- return convert(out, in, strict);
+ return convert(out, in, pfnCharMap, strict);
}
template, class TFromAlloc = std::allocator>
- inline TTo convert(const std::basic_string& in, bool strict = true) {
+ TTo convert(const std::basic_string& in, char32_t(*pfnCharMap)(char32_t) = nullptr, bool strict = false) {
TTo out{};
- return convert(out, std::basic_string_view(in), strict);
+ return convert(out, std::basic_string_view(in), pfnCharMap, strict);
}
template>>
- inline TTo convert(const TFromElem* in, size_t length = (std::numeric_limits::max)(), bool strict = true) {
+ TTo convert(const TFromElem* in, size_t length = (std::numeric_limits::max)(), char32_t(*pfnCharMap)(char32_t) = nullptr, bool strict = false) {
if (length == (std::numeric_limits::max)())
length = std::char_traits::length(in);
TTo out{};
- return convert(out, std::basic_string_view(in, length), strict);
+ return convert(out, std::basic_string_view(in, length), pfnCharMap, strict);
}
+
+ inline const std::u8string& convert(const std::u8string& in) { return in; }
+
+ inline const std::u16string& convert(const std::u16string& in) { return in; }
+
+ inline const std::u32string& convert(const std::u32string& in) { return in; }
+
+ inline const std::string& convert(const std::string& in) { return in; }
+
+ inline const std::wstring& convert(const std::wstring& in) { return in; }
}
diff --git a/Dalamud.Boot/utils.cpp b/Dalamud.Boot/utils.cpp
index bc54ecf14..f51ef7e49 100644
--- a/Dalamud.Boot/utils.cpp
+++ b/Dalamud.Boot/utils.cpp
@@ -463,6 +463,17 @@ std::vector utils::get_env_list(const wchar_t* pcszName) {
return res;
}
+template<>
+std::vector utils::get_env_list(const wchar_t* pcszName) {
+ const auto src = utils::get_env(pcszName);
+ auto res = utils::split(src, ",");
+ for (auto& s : res)
+ s = utils::trim(s);
+ if (res.size() == 1 && res[0].empty())
+ return {};
+ return res;
+}
+
bool utils::is_running_on_linux() {
if (get_env(L"XL_WINEONLINUX"))
return true;
diff --git a/Dalamud.Boot/utils.h b/Dalamud.Boot/utils.h
index 04bf4fbd9..bbcba1f84 100644
--- a/Dalamud.Boot/utils.h
+++ b/Dalamud.Boot/utils.h
@@ -243,6 +243,9 @@ namespace utils {
template<>
std::vector get_env_list(const wchar_t* pcwzName);
+ template<>
+ std::vector get_env_list(const wchar_t* pcwzName);
+
template
std::vector get_env_list(const char* pcszName) {
return get_env_list(unicode::convert(pcszName).c_str());
diff --git a/Dalamud.Boot/xivfixes.cpp b/Dalamud.Boot/xivfixes.cpp
index d96fdb0f0..fd4f28d91 100644
--- a/Dalamud.Boot/xivfixes.cpp
+++ b/Dalamud.Boot/xivfixes.cpp
@@ -2,7 +2,7 @@
#include "xivfixes.h"
-#include "bootconfig.h"
+#include "DalamudStartInfo.h"
#include "hooks.h"
#include "logging.h"
#include "utils.h"
@@ -17,8 +17,6 @@ void xivfixes::unhook_dll(bool bApply) {
static const auto LogTag = "[xivfixes:unhook_dll]";
static const auto LogTagW = L"[xivfixes:unhook_dll]";
- const auto targetDllNames = bootconfig::gamefix_unhookdll_list();
-
if (!bApply)
return;
@@ -60,13 +58,7 @@ void xivfixes::unhook_dll(bool bApply) {
return;
}
- auto doRestore = false;
- for (const auto& targetDllName : targetDllNames) {
- if (0 == _wcsicmp(path.filename().wstring().c_str(), targetDllName.c_str())) {
- doRestore = true;
- break;
- }
- }
+ const auto doRestore = g_startInfo.BootUnhookDlls.contains(unicode::convert(path.filename().u8string()));
std::optional tenderizer;
for (size_t i = 0, instructionLength = 1, printed = 0; i < buf.size(); i += instructionLength) {
@@ -192,7 +184,7 @@ void xivfixes::prevent_devicechange_crashes(bool bApply) {
static std::optional s_hookWndProc;
if (bApply) {
- if (!bootconfig::gamefix_is_enabled(L"prevent_devicechange_crashes")) {
+ if (!g_startInfo.BootEnabledGameFixes.contains("prevent_devicechange_crashes")) {
logging::I("{} Turned off via environment variable.", LogTag);
return;
}
@@ -304,7 +296,7 @@ void xivfixes::disable_game_openprocess_access_check(bool bApply) {
static std::optional> s_hook;
if (bApply) {
- if (!bootconfig::gamefix_is_enabled(L"disable_game_openprocess_access_check")) {
+ if (!g_startInfo.BootEnabledGameFixes.contains("disable_game_openprocess_access_check")) {
logging::I("{} Turned off via environment variable.", LogTag);
return;
}
@@ -345,7 +337,7 @@ void xivfixes::redirect_openprocess(bool bApply) {
static std::set s_silenceSet;
if (bApply) {
- if (!bootconfig::gamefix_is_enabled(L"redirect_openprocess")) {
+ if (!g_startInfo.BootEnabledGameFixes.contains("redirect_openprocess")) {
logging::I("{} Turned off via environment variable.", LogTag);
return;
}
@@ -354,7 +346,7 @@ void xivfixes::redirect_openprocess(bool bApply) {
return;
}
- if (bootconfig::dotnet_openprocess_hook_mode() == bootconfig::ImportHooks) {
+ if (g_startInfo.BootDotnetOpenProcessHookMode == DalamudStartInfo::DotNetOpenProcessHookMode::ImportHooks) {
auto hook = std::make_shared>("kernel32.dll!OpenProcess (global import, redirect_openprocess)", L"kernel32.dll", "OpenProcess");
hook->set_detour([hook = hook.get()](DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId)->HANDLE {
if (dwProcessId == GetCurrentProcessId()) {
diff --git a/lib/nlohmann-json/json.hpp b/lib/nlohmann-json/json.hpp
new file mode 100644
index 000000000..cb27e0581
--- /dev/null
+++ b/lib/nlohmann-json/json.hpp
@@ -0,0 +1,22091 @@
+/*
+ __ _____ _____ _____
+ __| | __| | | | JSON for Modern C++
+| | |__ | | | | | | version 3.10.5
+|_____|_____|_____|_|___| https://github.com/nlohmann/json
+
+Licensed under the MIT License .
+SPDX-License-Identifier: MIT
+Copyright (c) 2013-2022 Niels Lohmann .
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+/****************************************************************************\
+ * Note on documentation: The source files contain links to the online *
+ * documentation of the public API at https://json.nlohmann.me. This URL *
+ * contains the most recent documentation and should also be applicable to *
+ * previous versions; documentation for deprecated functions is not *
+ * removed, but marked deprecated. See "Generate documentation" section in *
+ * file doc/README.md. *
+\****************************************************************************/
+
+#ifndef INCLUDE_NLOHMANN_JSON_HPP_
+#define INCLUDE_NLOHMANN_JSON_HPP_
+
+#define NLOHMANN_JSON_VERSION_MAJOR 3
+#define NLOHMANN_JSON_VERSION_MINOR 10
+#define NLOHMANN_JSON_VERSION_PATCH 5
+
+#include // all_of, find, for_each
+#include // nullptr_t, ptrdiff_t, size_t
+#include // hash, less
+#include // initializer_list
+#ifndef JSON_NO_IO
+ #include // istream, ostream
+#endif // JSON_NO_IO
+#include // random_access_iterator_tag
+#include // unique_ptr
+#include // accumulate
+#include // string, stoi, to_string
+#include // declval, forward, move, pair, swap
+#include // vector
+
+// #include
+
+
+#include
+#include
+
+// #include
+
+
+#include // transform
+#include // array
+#include // forward_list
+#include // inserter, front_inserter, end
+#include