#include "EventListener.h" #include "Papyrus.h" #include "Achievements.h" #include "Util.h" using namespace SKSE; namespace { void InitializeLogging() { auto path = logger::log_directory(); if (!path) { SKSE::stl::report_and_fail("Failed to find standard logging directory"sv); } *path /= "EnderalSteam.log"sv; auto sink = std::make_shared(path->string(), true); auto log = std::make_shared("global log"s, std::move(sink)); log->set_level(spdlog::level::info); log->flush_on(spdlog::level::info); spdlog::set_default_logger(std::move(log)); spdlog::set_pattern("[%l] %v"s); } void InitializeMessaging() { GetMessagingInterface()->RegisterListener([](MessagingInterface::Message* message) { if (message->type == MessagingInterface::kPostLoad) { EventListener::Install(); } }); } } SKSEPluginLoad(const LoadInterface* skse) { GetLoadInterface(skse); InitializeLogging(); auto* plugin = PluginDeclaration::GetSingleton(); auto version = plugin->GetVersion(); logger::info("{} {} is loading...", plugin->GetName(), version); Init(skse); InitializeMessaging(); GetPapyrusInterface()->Register(Papyrus::Bind); logger::info("{} has finished loading.", plugin->GetName()); return true; }