From 75156643be2408fd70ac95517e1cb0de8b345bab Mon Sep 17 00:00:00 2001 From: Craig Robinson Date: Sun, 23 Nov 2025 18:22:13 +0000 Subject: [PATCH 1/6] Plugin Groundwork. --- include/SFSE/Version.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/SFSE/Version.h b/include/SFSE/Version.h index cebdd3c2..1820568a 100644 --- a/include/SFSE/Version.h +++ b/include/SFSE/Version.h @@ -20,7 +20,8 @@ namespace SFSE constexpr REL::Version RUNTIME_SF_1_14_70(1, 14, 70, 0); constexpr REL::Version RUNTIME_SF_1_14_74(1, 14, 74, 0); constexpr REL::Version RUNTIME_SF_1_15_216(1, 15, 216, 0); - constexpr auto RUNTIME_LATEST = RUNTIME_SF_1_15_216; + constexpr REL::Version RUNTIME_SF_1_15_222(1, 15, 222, 0); + constexpr auto RUNTIME_LATEST = RUNTIME_SF_1_15_222; - constexpr REL::Version SFSE_PACK_LATEST(0, 2, 17, 0); + constexpr REL::Version SFSE_PACK_LATEST(0, 2, 18, 0); } From 2433147a80f31e4cca22fb086e3f3815d4f9d74f Mon Sep 17 00:00:00 2001 From: Craig Robinson Date: Fri, 28 Nov 2025 14:50:56 +0000 Subject: [PATCH 2/6] Update Version.h --- include/SFSE/Version.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/SFSE/Version.h b/include/SFSE/Version.h index cebdd3c2..1820568a 100644 --- a/include/SFSE/Version.h +++ b/include/SFSE/Version.h @@ -20,7 +20,8 @@ namespace SFSE constexpr REL::Version RUNTIME_SF_1_14_70(1, 14, 70, 0); constexpr REL::Version RUNTIME_SF_1_14_74(1, 14, 74, 0); constexpr REL::Version RUNTIME_SF_1_15_216(1, 15, 216, 0); - constexpr auto RUNTIME_LATEST = RUNTIME_SF_1_15_216; + constexpr REL::Version RUNTIME_SF_1_15_222(1, 15, 222, 0); + constexpr auto RUNTIME_LATEST = RUNTIME_SF_1_15_222; - constexpr REL::Version SFSE_PACK_LATEST(0, 2, 17, 0); + constexpr REL::Version SFSE_PACK_LATEST(0, 2, 18, 0); } From 47912355c8fc74f6d251fdf6f87ca3003d252fe2 Mon Sep 17 00:00:00 2001 From: Craig Robinson Date: Fri, 28 Nov 2025 14:54:22 +0000 Subject: [PATCH 3/6] Added NiNode.h --- include/RE/N/NiNode.h | 57 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 include/RE/N/NiNode.h diff --git a/include/RE/N/NiNode.h b/include/RE/N/NiNode.h new file mode 100644 index 00000000..08af2320 --- /dev/null +++ b/include/RE/N/NiNode.h @@ -0,0 +1,57 @@ +#pragma once + +#include "RE/B/BSTArray.h" +#include "RE/N/NiAVObject.h" +#include "RE/N/NiTransform.h" + +#include +#include +#include +#include + +namespace RE +{ + class NiAVObject; // base for renderable objects + class NiRefObject; // ref-counted base + class NiObject; // intermediate base + class NiObjectNET; // intermediate base + struct NiTransform; // position/rotation/scale block + class BSFixedString; // engine fixed-string wrapper + template class BSTHashMap; + + class NiNode : public NiAVObject + { + public: + // Virtual destructor / vtable are present (attributes = 0x40 in RTTI). + virtual ~NiNode(); + + // Utility / accessors (typical of prior NiNode implementations) + virtual NiNode* GetAsNiNode(); // return this typed pointer + virtual void AddChild(NiAVObject* child); // attach child + virtual bool RemoveChild(NiAVObject* child); // detach child + virtual NiAVObject* GetObjectByName(const BSFixedString& name); + virtual NiAVObject* FindObjectRecursive(const BSFixedString& name); // recursive search + + // Transform accessors (CE2 likely uses NiTransform or similar) + virtual NiTransform* GetLocalTransform(); + virtual void SetLocalTransform(const NiTransform& t); + + public: + + BSTArray> children; // dynamic list of child pointers + + // Optional extra per-node metadata (CE2 often adds an "extraData" pointer or structure) + void* extraData; // pointer to NodeExtra/metadata (inferred) + + // Transform (local) + NiTransform localTransform; // position/rotation/scale for this node + + // Flags, LOD, visibility, or other engine-specific fields + std::uint32_t flags; // generic flags + std::uint32_t pad; // padding / reserved + + + }; + + static_assert(sizeof(NiNode) == 0x40); +} \ No newline at end of file From 6b87cce88d68d0a61504ebdc10159e66899205eb Mon Sep 17 00:00:00 2001 From: DarthSidious666 <57962477+DarthSidious666@users.noreply.github.com> Date: Sun, 30 Nov 2025 13:35:39 +0000 Subject: [PATCH 4/6] Refactor NiNode class and update member functions --- include/RE/N/NiNode.h | 72 ++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 46 deletions(-) diff --git a/include/RE/N/NiNode.h b/include/RE/N/NiNode.h index 08af2320..36981f52 100644 --- a/include/RE/N/NiNode.h +++ b/include/RE/N/NiNode.h @@ -4,54 +4,34 @@ #include "RE/N/NiAVObject.h" #include "RE/N/NiTransform.h" -#include -#include -#include -#include - namespace RE { - class NiAVObject; // base for renderable objects - class NiRefObject; // ref-counted base - class NiObject; // intermediate base - class NiObjectNET; // intermediate base - struct NiTransform; // position/rotation/scale block - class BSFixedString; // engine fixed-string wrapper - template class BSTHashMap; - class NiNode : public NiAVObject { - public: - // Virtual destructor / vtable are present (attributes = 0x40 in RTTI). - virtual ~NiNode(); - - // Utility / accessors (typical of prior NiNode implementations) - virtual NiNode* GetAsNiNode(); // return this typed pointer - virtual void AddChild(NiAVObject* child); // attach child - virtual bool RemoveChild(NiAVObject* child); // detach child - virtual NiAVObject* GetObjectByName(const BSFixedString& name); - virtual NiAVObject* FindObjectRecursive(const BSFixedString& name); // recursive search - - // Transform accessors (CE2 likely uses NiTransform or similar) - virtual NiTransform* GetLocalTransform(); - virtual void SetLocalTransform(const NiTransform& t); - - public: - - BSTArray> children; // dynamic list of child pointers - - // Optional extra per-node metadata (CE2 often adds an "extraData" pointer or structure) - void* extraData; // pointer to NodeExtra/metadata (inferred) - - // Transform (local) - NiTransform localTransform; // position/rotation/scale for this node - - // Flags, LOD, visibility, or other engine-specific fields - std::uint32_t flags; // generic flags - std::uint32_t pad; // padding / reserved - - + public: + inline static constexpr auto RTTI = RTTI_NiNode; + + ~NiNode() override; + NiNode* GetAsNiNode() override; + void AddChild(NiAVObject* a_child) override; + bool RemoveChild(NiAVObject* a_child) override; + NiAVObject* GetObjectByName(const BSFixedString& a_name) override; + NiAVObject* FindObjectRecursive(const BSFixedString& a_name) override; + NiTransform* GetLocalTransform() override; + void SetLocalTransform(const NiTransform& a_transform) override; // 38 + + // members + BSTArray> children; // 130 + void* extraData; // 138 + std::uint32_t childCount; // 140 + std::uint32_t flags; // 144 + std::uint64_t pad148; // 148 + + static_assert(sizeof(BSTArray>) == 0x8); + static_assert(offsetof(NiNode, children) == 0x130); + static_assert(offsetof(NiNode, extraData) == 0x138); + static_assert(offsetof(NiNode, childCount) == 0x140); + static_assert(offsetof(NiNode, flags) == 0x144); + static_assert(sizeof(NiNode) == 0x150); }; - - static_assert(sizeof(NiNode) == 0x40); -} \ No newline at end of file +} From 0aa33056b0826ef72c36233d2d186ab856123ecb Mon Sep 17 00:00:00 2001 From: DarthSidious666 <57962477+DarthSidious666@users.noreply.github.com> Date: Sun, 30 Nov 2025 13:43:53 +0000 Subject: [PATCH 5/6] Match layout --- include/RE/N/NiNode.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/include/RE/N/NiNode.h b/include/RE/N/NiNode.h index 36981f52..36c6a962 100644 --- a/include/RE/N/NiNode.h +++ b/include/RE/N/NiNode.h @@ -6,19 +6,21 @@ namespace RE { - class NiNode : public NiAVObject + class __declspec(novtable) NiNode : + public NiAVObject { public: - inline static constexpr auto RTTI = RTTI_NiNode; + SF_RTTI(NiNode); - ~NiNode() override; - NiNode* GetAsNiNode() override; - void AddChild(NiAVObject* a_child) override; - bool RemoveChild(NiAVObject* a_child) override; - NiAVObject* GetObjectByName(const BSFixedString& a_name) override; - NiAVObject* FindObjectRecursive(const BSFixedString& a_name) override; - NiTransform* GetLocalTransform() override; - void SetLocalTransform(const NiTransform& a_transform) override; // 38 + //add + virtual ~NiNode() = default; + virtual NiNode* GetAsNiNode(); + virtual void* AddChild(NiAVObject* child); + virtual bool* RemoveChild(NiAVObject* child); + virtual NiAVObject* GetObjectByName(const BSFixedString& name); + virtual NiAVObject* FindObjectRecursive(const BSFixedString& name); + virtual NiTransform* GetLocalTransform(); + virtual void* SetLocalTransform(const NiTransform& transform); // members BSTArray> children; // 130 From 93b39bd96e060dfba4918e6c5453ded2a77379df Mon Sep 17 00:00:00 2001 From: DarthSidious666 <57962477+DarthSidious666@users.noreply.github.com> Date: Sun, 30 Nov 2025 13:46:22 +0000 Subject: [PATCH 6/6] Remove comments --- include/RE/N/NiNode.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/RE/N/NiNode.h b/include/RE/N/NiNode.h index 36c6a962..dc8ae558 100644 --- a/include/RE/N/NiNode.h +++ b/include/RE/N/NiNode.h @@ -23,12 +23,12 @@ namespace RE virtual void* SetLocalTransform(const NiTransform& transform); // members - BSTArray> children; // 130 - void* extraData; // 138 - std::uint32_t childCount; // 140 - std::uint32_t flags; // 144 - std::uint64_t pad148; // 148 - + BSTArray> children; + void* extraData; + std::uint32_t childCount; + std::uint32_t flags; + std::uint64_t pad148; + static_assert(sizeof(BSTArray>) == 0x8); static_assert(offsetof(NiNode, children) == 0x130); static_assert(offsetof(NiNode, extraData) == 0x138);