From 3ae3e91532b206446ca6f96ec024d13c2ac53892 Mon Sep 17 00:00:00 2001 From: Angad <66992519+ThirdEyeSqueegee@users.noreply.github.com> Date: Tue, 19 Sep 2023 16:07:13 -0700 Subject: [PATCH] feat: add `SFSEPluginPreload` and `SFSEPluginVersion` macros (#73) Also add an overload for `PluginVersion` which accepts a `REL::Version` Related: #65 --- CommonLibSF/include/SFSE/Interfaces.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CommonLibSF/include/SFSE/Interfaces.h b/CommonLibSF/include/SFSE/Interfaces.h index f6b34dc4..2b032962 100644 --- a/CommonLibSF/include/SFSE/Interfaces.h +++ b/CommonLibSF/include/SFSE/Interfaces.h @@ -107,6 +107,8 @@ namespace SFSE constexpr void PluginVersion(std::uint32_t a_version) noexcept { pluginVersion = a_version; } + constexpr void PluginVersion(REL::Version a_version) noexcept { pluginVersion = a_version.pack(); } + [[nodiscard]] constexpr std::uint32_t GetPluginVersion() const noexcept { return pluginVersion; } constexpr void PluginName(std::string_view a_plugin) noexcept { SetCharBuffer(a_plugin, std::span{ pluginName }); } @@ -169,4 +171,6 @@ namespace SFSE static_assert(sizeof(PluginVersionData) == 0x25C); } // namespace SFSE +#define SFSEPluginPreload(...) extern "C" [[maybe_unused]] __declspec(dllexport) bool SFSEPlugin_Preload(__VA_ARGS__) #define SFSEPluginLoad(...) extern "C" [[maybe_unused]] __declspec(dllexport) bool SFSEPlugin_Load(__VA_ARGS__) +#define SFSEPluginVersion extern "C" [[maybe_unused]] __declspec(dllexport) constinit SFSE::PluginVersionData SFSEPlugin_Version