Skip to content

Commit

Permalink
feat: add SFSEPluginPreload and SFSEPluginVersion macros (#73)
Browse files Browse the repository at this point in the history
Also add an overload for `PluginVersion` which accepts a `REL::Version`

Related: #65
  • Loading branch information
ThirdEyeSqueegee authored Sep 19, 2023
1 parent 39cc8a9 commit 3ae3e91
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CommonLibSF/include/SFSE/Interfaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 }); }
Expand Down Expand Up @@ -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

0 comments on commit 3ae3e91

Please sign in to comment.