diff --git a/src/Forms/Forms.h b/src/Forms/Forms.h index 96d6c55..1ac8232 100644 --- a/src/Forms/Forms.h +++ b/src/Forms/Forms.h @@ -35,7 +35,7 @@ class Forms "BWA_bOverrideTakingRadDamage_DO", RE::ENUM_FORM_ID::kGLOB); - DEBUG("Injected DefaultObjects"sv); + F4SE::log::debug("Injected DefaultObjects"sv); } // members diff --git a/src/PCH.h b/src/PCH.h index e364413..3f188df 100644 --- a/src/PCH.h +++ b/src/PCH.h @@ -1,137 +1,6 @@ -#pragma once +#pragma once -// c -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// cxx -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Clib #include "F4SE/F4SE.h" #include "RE/Fallout.h" -// winnt -#include - -#undef min -#undef max -#undef GetForm - using namespace std::literals; - -#define DLLEXPORT extern "C" [[maybe_unused]] __declspec(dllexport) - -// Plugin -#include "Plugin.h" - -// DKUtil -#include "DKUtil/Hook.hpp" -#include "DKUtil/Logger.hpp" - -// F4SEPlugin_Version -DLLEXPORT constinit auto F4SEPlugin_Version = []() noexcept -{ - F4SE::PluginVersionData data{}; - - data.PluginVersion(Plugin::Version); - data.PluginName(Plugin::NAME); - data.AuthorName(Plugin::AUTHOR); - data.UsesAddressLibrary(true); - data.UsesSigScanning(false); - data.IsLayoutDependent(true); - data.HasNoStructUse(false); - data.CompatibleVersions({ F4SE::RUNTIME_LATEST }); - - return data; -}(); diff --git a/src/Scripts/Papyrus/BakaWaitAnywhere.h b/src/Scripts/Papyrus/BakaWaitAnywhere.h index a821605..3395e6a 100644 --- a/src/Scripts/Papyrus/BakaWaitAnywhere.h +++ b/src/Scripts/Papyrus/BakaWaitAnywhere.h @@ -57,7 +57,7 @@ namespace WaitAnywhere if (!PlayerCharacter || !ProcessLists || !SynchedAnimManager) { - WARN("WaitAnywhere::CanPassTime: Failed to GetSingleton."sv); + F4SE::log::warn("WaitAnywhere::CanPassTime: Failed to GetSingleton."sv); RE::SendHUDMessage::ShowHUDMessage( sNoWaitDefault->GetString().data(), "UIMenuCancel", diff --git a/src/main.cpp b/src/main.cpp index ad91ed2..6be1963 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,13 +3,8 @@ namespace { - void MessageHandler(F4SE::MessagingInterface::Message* a_msg) + void MessageCallback(F4SE::MessagingInterface::Message* a_msg) { - if (!a_msg) - { - return; - } - switch (a_msg->type) { case F4SE::MessagingInterface::kPostLoad: @@ -23,32 +18,12 @@ namespace } } -DLLEXPORT bool F4SEAPI F4SEPlugin_Load(const F4SE::LoadInterface* a_F4SE) +F4SEPluginLoad(const F4SE::LoadInterface* a_F4SE) { -#ifndef NDEBUG - MessageBoxA(NULL, "Loaded. You can now attach the debugger or continue execution.", Plugin::NAME.data(), NULL); -#endif - F4SE::Init(a_F4SE); - DKUtil::Logger::Init(Plugin::NAME, std::to_string(Plugin::Version)); - INFO("{} v{} loaded."sv, Plugin::NAME, Plugin::Version); - - const auto messaging = F4SE::GetMessagingInterface(); - if (!messaging || !messaging->RegisterListener(MessageHandler)) - { - FATAL("Failed to register messaging handler, marking as incompatible."sv); - return false; - } - - const auto papyrus = F4SE::GetPapyrusInterface(); - if (!papyrus || !papyrus->Register(Papyrus::RegisterFunctions)) - { - FATAL("Failed to register Papyrus functions, marking as incompatible."sv); - return false; - } - - INFO("Plugin loaded successfully."sv); + F4SE::GetMessagingInterface()->RegisterListener(MessageCallback); + F4SE::GetPapyrusInterface()->Register(Papyrus::RegisterFunctions); return true; }