From b2044d37375c2f662d124d712c72b18f08973704 Mon Sep 17 00:00:00 2001 From: shad0wshayd3 <2724172+shad0wshayd3@users.noreply.github.com> Date: Sun, 30 Aug 2026 20:52:32 -0600 Subject: [PATCH 1/5] feat: `commonlibsse.archive` rule --- lib/commonlib-shared | 2 +- xmake.lua | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/commonlib-shared b/lib/commonlib-shared index c4379b2082..25cd18580b 160000 --- a/lib/commonlib-shared +++ b/lib/commonlib-shared @@ -1 +1 @@ -Subproject commit c4379b2082a464f99c45618f79b920daf6d15dd3 +Subproject commit 25cd18580becf57a10e7d04af8e5b02edb8eb171 diff --git a/xmake.lua b/xmake.lua index 4f7c8e1786..fbf1dcb2dd 100644 --- a/xmake.lua +++ b/xmake.lua @@ -67,3 +67,13 @@ rule("commonlibsse.plugin", function() target:add("installfiles", target:symbolfile(), { prefixdir = "SKSE/Plugins" }) end) end) + +rule("commonlibsse.archive", function() + add_deps("commonlib.archive") + + on_load(function(target) + target:data_set("commonlib.archive.config", target:extraconf("rules", "commonlibsse.archive")) + target:data_set("commonlib.archive.format", "-sse" ) + target:data_set("commonlib.archive.extension", ".bsa") + end) +end) From f0f80e54801af7e5cb98c586bf183c3fa18749a7 Mon Sep 17 00:00:00 2001 From: shad0wshayd3 <2724172+shad0wshayd3@users.noreply.github.com> Date: Mon, 31 Aug 2026 05:01:15 -0600 Subject: [PATCH 2/5] feat: `commonlibsse.papyrus` rule --- lib/commonlib-shared | 2 +- xmake.lua | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/commonlib-shared b/lib/commonlib-shared index 25cd18580b..69d53eff31 160000 --- a/lib/commonlib-shared +++ b/lib/commonlib-shared @@ -1 +1 @@ -Subproject commit 25cd18580becf57a10e7d04af8e5b02edb8eb171 +Subproject commit 69d53eff31593bb6e8cb3bf212f1a6e4e370383d diff --git a/xmake.lua b/xmake.lua index fbf1dcb2dd..cd0aa4f3c6 100644 --- a/xmake.lua +++ b/xmake.lua @@ -77,3 +77,15 @@ rule("commonlibsse.archive", function() target:data_set("commonlib.archive.extension", ".bsa") end) end) + +rule("commonlibsse.papyrus", function() + add_deps("commonlib.papyrus") + + on_load(function(target) + target:data_set("commonlib.papyrus.config", target:extraconf("rules", "commonlibsse.papyrus")) + target:data_set("commonlib.papyrus.game", "skyrim" ) + target:data_set("commonlib.papyrus.gamevar", "XSE_TES5_GAME_PATH") + target:data_set("commonlib.papyrus.defaults", { "Data/Source/Scripts" } ) + target:data_set("commonlib.papyrus.flags", "TESV_Papyrus_Flags.flg") + end) +end) From 6c184f423a37bdcfedc3760c4feafe1cd229475f Mon Sep 17 00:00:00 2001 From: shad0wshayd3 <2724172+shad0wshayd3@users.noreply.github.com> Date: Wed, 2 Sep 2026 20:00:34 -0600 Subject: [PATCH 3/5] feat: unify `XSEPlugin_Version` impl --- include/SKSE/Interfaces.h | 39 ++++++++++++++++++++-------------- lib/commonlib-shared | 2 +- res/commonlibsse-plugin.cpp.in | 6 ++++-- xmake.lua | 32 ++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 19 deletions(-) diff --git a/include/SKSE/Interfaces.h b/include/SKSE/Interfaces.h index 92cdaa45aa..78c3c856d5 100644 --- a/include/SKSE/Interfaces.h +++ b/include/SKSE/Interfaces.h @@ -533,7 +533,7 @@ namespace SKSE struct PluginVersionData { public: - enum + enum Version : std::uint32_t { kVersion = 1, }; @@ -567,24 +567,25 @@ namespace SKSE [[nodiscard]] constexpr std::string_view GetAuthorEmail() const noexcept { return std::string_view{ supportEmail }; } - constexpr void UsesAddressLibrary() noexcept { versionIndependence |= kVersionIndependent_AddressLibraryPostAE; } - constexpr void UsesSigScanning() noexcept { versionIndependence |= kVersionIndependent_Signatures; } - constexpr void UsesUpdatedStructs() noexcept { versionIndependence |= kVersionIndependent_StructsPost629; } + constexpr void UsesSigScanning(const bool a_value) noexcept { SetOrClearBit(versionIndependence, kAddressIndependence_Signatures, a_value); } - constexpr void UsesNoStructs() noexcept { versionIndependenceEx |= kVersionIndependentEx_NoStructUse; } + constexpr void UsesAddressLibrary(const bool a_value) noexcept { SetOrClearBit(versionIndependence, kVersionIndependent_AddressLibraryPostAE, a_value); } - constexpr void MinimumRequiredXSEVersion(REL::Version a_version) noexcept { xseMinimum = a_version.pack(); } + constexpr void HasNoStructUse(const bool a_value) noexcept { SetOrClearBit(versionIndependenceEx, kVersionIndependentEx_NoStructUse, a_value); } + + constexpr void IsLayoutDependent(const bool a_value) noexcept { SetOrClearBit(versionIndependence, kVersionIndependent_StructsPost629, a_value); } constexpr void CompatibleVersions(std::initializer_list a_versions) noexcept { + // must be zero-terminated assert(a_versions.size() < std::size(compatibleVersions) - 1); - std::transform( - a_versions.begin(), - a_versions.end(), - std::begin(compatibleVersions), - [](const REL::Version& a_version) noexcept { return a_version.pack(); }); + std::ranges::transform(a_versions, std::begin(compatibleVersions), [](const REL::Version& a_version) noexcept { + return a_version.pack(); + }); } + constexpr void MinimumRequiredXSEVersion(REL::Version a_version) noexcept { xseMinimum = a_version.pack(); } + [[nodiscard]] static const PluginVersionData* GetSingleton() noexcept; const std::uint32_t dataVersion{ kVersion }; @@ -598,13 +599,19 @@ namespace SKSE std::uint32_t xseMinimum = 0; private: - static constexpr void SetCharBuffer( - std::string_view a_src, - std::span a_dst) noexcept + static constexpr void SetCharBuffer(std::string_view a_src, std::span a_dst) noexcept { assert(a_src.size() < a_dst.size()); - std::fill(a_dst.begin(), a_dst.end(), '\0'); - std::copy(a_src.begin(), a_src.end(), a_dst.begin()); + std::ranges::fill(a_dst, '\0'); + std::ranges::copy(a_src, a_dst.begin()); + } + + static constexpr void SetOrClearBit(std::uint32_t& a_data, const std::uint32_t a_bit, const bool a_set) noexcept + { + if (a_set) + a_data |= a_bit; + else + a_data &= ~a_bit; } }; static_assert(offsetof(PluginVersionData, dataVersion) == 0x000); diff --git a/lib/commonlib-shared b/lib/commonlib-shared index 5d2a62760b..c5e869f86b 160000 --- a/lib/commonlib-shared +++ b/lib/commonlib-shared @@ -1 +1 @@ -Subproject commit 5d2a62760be2c336ffbc3117e54a48555cd6eb52 +Subproject commit c5e869f86b7c6a1e8b9256a7f33ef5f424bf8cbe diff --git a/res/commonlibsse-plugin.cpp.in b/res/commonlibsse-plugin.cpp.in index 1a49fc4e70..db1f47255f 100644 --- a/res/commonlibsse-plugin.cpp.in +++ b/res/commonlibsse-plugin.cpp.in @@ -6,8 +6,10 @@ SKSE_EXPORT constinit auto SKSEPlugin_Version = []() { v.PluginName("${COMMONLIB_PLUGIN_NAME}"); v.AuthorName("${COMMONLIB_PLUGIN_AUTHOR}"); v.AuthorEmail("${COMMONLIB_PLUGIN_CONTACT}"); - v.UsesAddressLibrary(); - v.UsesUpdatedStructs(); + v.UsesSigScanning(${COMMONLIBSSE_OPTION_SIG_SCANNING}); + v.UsesAddressLibrary(${COMMONLIBSSE_OPTION_ADDRESS_LIBRARY}); + v.HasNoStructUse(${COMMONLIBSSE_OPTION_NO_STRUCT_USE}); + v.IsLayoutDependent(${COMMONLIBSSE_OPTION_LAYOUT_DEPENDENT}); v.CompatibleVersions({ SKSE::RUNTIME_LATEST }); v.MinimumRequiredXSEVersion({ ${COMMONLIB_PLUGIN_XSE_VERSION_MAJOR}, ${COMMONLIB_PLUGIN_XSE_VERSION_MINOR}, ${COMMONLIB_PLUGIN_XSE_VERSION_PATCH}, 0 }); return v; diff --git a/xmake.lua b/xmake.lua index cd0aa4f3c6..57bf858d70 100644 --- a/xmake.lua +++ b/xmake.lua @@ -57,6 +57,38 @@ rule("commonlibsse.plugin", function() target:add("configfiles", path.join(os.scriptdir(), "res/commonlibsse-plugin.cpp.in")) target:add("files", path.join(target:configdir(), "commonlibsse-plugin.cpp")) + local conf = target:extraconf("rules", "commonlibsse.plugin") + if conf.options then + if conf.options.sig_scanning then + conf.options.address_library = false + else + conf.options.sig_scanning = false + if conf.options.address_library == nil then + conf.options.address_library = true + end + end + if conf.options.no_struct_use then + conf.options.layout_dependent = false + else + conf.options.no_struct_use = false + if conf.options.layout_dependent == nil then + conf.options.layout_dependent = true + end + end + else + conf.options = { + sig_scanning = false, + address_library = true, + no_struct_use = false, + layout_dependent = true + } + end + + target:set("configvar", "COMMONLIBSSE_OPTION_SIG_SCANNING", tostring(conf.options.sig_scanning)) + target:set("configvar", "COMMONLIBSSE_OPTION_ADDRESS_LIBRARY", tostring(conf.options.address_library)) + target:set("configvar", "COMMONLIBSSE_OPTION_NO_STRUCT_USE", tostring(conf.options.no_struct_use)) + target:set("configvar", "COMMONLIBSSE_OPTION_LAYOUT_DEPENDENT", tostring(conf.options.layout_dependent)) + if os.getenv("XSE_TES5_MODS_PATH") then target:set("installdir", path.join(os.getenv("XSE_TES5_MODS_PATH"), target:name())) elseif os.getenv("XSE_TES5_GAME_PATH") then From 205cf8a84da9fe19eeb9e3178cfe93198163e246 Mon Sep 17 00:00:00 2001 From: shad0wshayd3 <2724172+shad0wshayd3@users.noreply.github.com> Date: Wed, 2 Sep 2026 20:11:10 -0600 Subject: [PATCH 4/5] fix: enum name --- include/SKSE/Interfaces.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SKSE/Interfaces.h b/include/SKSE/Interfaces.h index 78c3c856d5..24b1cec041 100644 --- a/include/SKSE/Interfaces.h +++ b/include/SKSE/Interfaces.h @@ -567,7 +567,7 @@ namespace SKSE [[nodiscard]] constexpr std::string_view GetAuthorEmail() const noexcept { return std::string_view{ supportEmail }; } - constexpr void UsesSigScanning(const bool a_value) noexcept { SetOrClearBit(versionIndependence, kAddressIndependence_Signatures, a_value); } + constexpr void UsesSigScanning(const bool a_value) noexcept { SetOrClearBit(versionIndependence, kVersionIndependent_Signatures, a_value); } constexpr void UsesAddressLibrary(const bool a_value) noexcept { SetOrClearBit(versionIndependence, kVersionIndependent_AddressLibraryPostAE, a_value); } From 24c7be404bd8231f2c156eca68ed78036a0f3be9 Mon Sep 17 00:00:00 2001 From: shad0wshayd3 <2724172+shad0wshayd3@users.noreply.github.com> Date: Wed, 2 Sep 2026 20:21:05 -0600 Subject: [PATCH 5/5] feat: update lib --- lib/commonlib-shared | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/commonlib-shared b/lib/commonlib-shared index c5e869f86b..9fbb74d628 160000 --- a/lib/commonlib-shared +++ b/lib/commonlib-shared @@ -1 +1 @@ -Subproject commit c5e869f86b7c6a1e8b9256a7f33ef5f424bf8cbe +Subproject commit 9fbb74d628134ab4ea3a3cf5c0ed3f7eeabbd01d