|
|
|
@ -1,5 +1,5 @@ |
|
|
|
|
#include "EventListener.h" |
|
|
|
|
#include "Util.h" |
|
|
|
|
#include "EventListener.h" |
|
|
|
|
#include "Papyrus.h" |
|
|
|
|
#include "Patches/MainMenuPatch.h" |
|
|
|
|
#include "Patches/FlatMapMarkers.h" |
|
|
|
@ -27,14 +27,26 @@ static std::map<std::string, bool> g_settings{ |
|
|
|
|
namespace { |
|
|
|
|
|
|
|
|
|
void InitializeLogging() { |
|
|
|
|
auto path = logger::log_directory(); |
|
|
|
|
if (!path) { |
|
|
|
|
SKSE::stl::report_and_fail("Failed to find standard logging directory"sv); |
|
|
|
|
wchar_t* buffer{ nullptr }; |
|
|
|
|
const auto result = ::SHGetKnownFolderPath(::FOLDERID_Documents, ::KNOWN_FOLDER_FLAG::KF_FLAG_DEFAULT, nullptr, std::addressof(buffer)); |
|
|
|
|
std::unique_ptr<wchar_t[], decltype(&::CoTaskMemFree)> knownPath(buffer, ::CoTaskMemFree); |
|
|
|
|
|
|
|
|
|
if (!knownPath || result != S_OK) { |
|
|
|
|
logger::error("failed to get known folder path"sv); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
*path /= "EnderalSE.log"sv; |
|
|
|
|
auto sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(path->string(), true); |
|
|
|
|
std::filesystem::path path = knownPath.get(); |
|
|
|
|
path /= "My Games"sv; |
|
|
|
|
if (GetModuleHandle(L"Galaxy64.dll") != NULL) { |
|
|
|
|
path /= "Skyrim Special Edition GOG"sv; |
|
|
|
|
} else { |
|
|
|
|
path /= "Skyrim Special Edition"sv; |
|
|
|
|
} |
|
|
|
|
path /= "SKSE"sv; |
|
|
|
|
path /= "EnderalSE.log"sv; |
|
|
|
|
|
|
|
|
|
auto sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(path.string(), true); |
|
|
|
|
auto log = std::make_shared<spdlog::logger>("global log"s, std::move(sink)); |
|
|
|
|
|
|
|
|
|
log->set_level(spdlog::level::info); |
|
|
|
|