Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan-rsm-McKenzie committed Aug 20, 2020
1 parent b2c157f commit 70b438b
Show file tree
Hide file tree
Showing 19 changed files with 277 additions and 257 deletions.
98 changes: 77 additions & 21 deletions CommonLibSSE.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
<Expand>
<ArrayItems>
<Size>_size</Size>
<ValuePointer Condition="_size &gt; 0">($T1*)_data.heap</ValuePointer>
<ValuePointer Condition="_size &lt;= 0">($T1*)_data.local</ValuePointer>
<ValuePointer Condition="_size &gt; 1">($T1*)_data.heap</ValuePointer>
<ValuePointer Condition="_size &lt;= 1">($T1*)&amp;_data.local</ValuePointer>
</ArrayItems>
</Expand>
</Type>
Expand Down Expand Up @@ -137,32 +137,16 @@
</Expand>
</Type>

<Type Name="RE::BSFixedString">
<Type Name="RE::detail::BSFixedString&lt;*&gt;">
<DisplayString Condition="_data != nullptr">{_data,na}</DisplayString>
<DisplayString Condition="_data == nullptr">&quot;&quot;</DisplayString>
<StringView Condition="_data != nullptr">_data,na</StringView>
<StringView Condition="_data == nullptr">&quot;&quot;</StringView>
<Expand>
<Item Name="[size]" Condition="_data != nullptr">((RE::BSStringPool::Entry*)_data - 1)-&gt;_lengthAndRef.length &amp; 0xFFFFFF</Item>
<Item Name="[size]" Condition="_data != nullptr">((RE::BSStringPool::Entry*)_data - 1)-&gt;_length &amp; 0xFFFFFF</Item>
<Item Name="[size]" Condition="_data == nullptr">0</Item>
<ArrayItems>
<Size Condition="_data != nullptr">((RE::BSStringPool::Entry*)_data - 1)-&gt;_lengthAndRef.length &amp; 0xFFFFFF</Size>
<Size Condition="_data == nullptr">0</Size>
<ValuePointer>_data</ValuePointer>
</ArrayItems>
</Expand>
</Type>

<Type Name="RE::BSFixedStringW">
<DisplayString Condition="_data != nullptr">{_data,su}</DisplayString>
<DisplayString Condition="_data == nullptr">L&quot;&quot;</DisplayString>
<StringView Condition="_data != nullptr">_data,su</StringView>
<StringView Condition="_data == nullptr">L&quot;&quot;</StringView>
<Expand>
<Item Name="[size]" Condition="_data != nullptr">((RE::BSStringPool::Entry*)_data - 1)-&gt;_lengthAndRef.length &amp; 0xFFFFFF</Item>
<Item Name="[size]" Condition="_data == nullptr">0</Item>
<ArrayItems>
<Size Condition="_data != nullptr">((RE::BSStringPool::Entry*)_data - 1)-&gt;_lengthAndRef.length &amp; 0xFFFFFF</Size>
<Size Condition="_data != nullptr">((RE::BSStringPool::Entry*)_data - 1)-&gt;_length &amp; 0xFFFFFF</Size>
<Size Condition="_data == nullptr">0</Size>
<ValuePointer>_data</ValuePointer>
</ArrayItems>
Expand Down Expand Up @@ -242,6 +226,16 @@
</Expand>
</Type>

<Type Name="RE::BSTPointerAndFlags&lt;*&gt;">
<Intrinsic Name="Get" Expression="(typename $T1::element_type*)(_storage.address &amp; ~$T2)" />
<SmartPointer Usage="Minimal">Get()</SmartPointer>
<DisplayString Condition="Get() == nullptr">empty</DisplayString>
<DisplayString Condition="Get() != nullptr">RE::BSTPointerAndFlags {*Get()}</DisplayString>
<Expand>
<Item Name="[ptr]" Condition="Get() != nullptr">Get(),na</Item>
</Expand>
</Type>

<Type Name="RE::TESForm">
<Intrinsic Name="GetFormType" Expression="formType._impl" />
<DisplayString>{formType,en} [{formID,H}]</DisplayString>
Expand Down Expand Up @@ -682,4 +676,66 @@
<Intrinsic Name="GetType" Expression="*(uint8_t*)((char*)*(*(size_t***)this + 1) + 1)" />
<DisplayString>{{ type={(RE::ExtraDataType)GetType(),en} }}</DisplayString>
</Type>

<Type Name="RE::BSScript::ObjectTypeInfo">
<Intrinsic Name="LinkValid" Expression="linkedValid &gt;= 2" />
<Intrinsic Name="GetUserFlagIter" Expression="(UserFlagInfo*)data" />
<Intrinsic Name="GetVariableIter" Expression="(VariableInfo*)(GetUserFlagIter() + userFlagCount)" />
<Intrinsic Name="GetInitialValueIter" Expression="(InitialValueInfo*)(GetVariableIter() + variableCount)" />
<Intrinsic Name="GetPropertyIter" Expression="(PropertyInfo*)(GetInitialValueIter() + initialValueCount)" />
<Intrinsic Name="GetGlobalFuncIter" Expression="(GlobalFuncInfo*)(GetPropertyIter() + propertyCount)" />
<Intrinsic Name="GetMemberFuncIter" Expression="(MemberFuncInfo*)(GetGlobalFuncIter() + staticFunctionCount)" />
<Intrinsic Name="GetNamedStateIter" Expression="(NamedStateInfo*)(GetMemberFuncIter() + emptyStateMemberFunctionCount)" />
<DisplayString>RE::BSScript::ObjectTypeInfo {name,na}</DisplayString>
<Expand>
<Item Name="[name]">name</Item>
<Item Name="[parent]">parentTypeInfo</Item>
<Item Name="[documentation]">docString</Item>
<Item Name="[linked]">linkedValid,en</Item>
<LinkedListItems Condition="!LinkValid()">
<HeadPointer>(UnlinkedNativeFunction*)data</HeadPointer>
<NextPointer>next</NextPointer>
<ValueNode>func</ValueNode>
</LinkedListItems>
<Item Name="[user flags]" Condition="LinkValid()">userFlagCount</Item>
<ArrayItems Condition="LinkValid()">
<Size>userFlagCount</Size>
<ValuePointer>GetUserFlagIter()</ValuePointer>
</ArrayItems>
<Item Name="[variables]" Condition="LinkValid()">variableCount</Item>
<ArrayItems Condition="LinkValid()">
<Size>variableCount</Size>
<ValuePointer>GetVariableIter()</ValuePointer>
</ArrayItems>
<Item Name="[initial values]" Condition="LinkValid()">initialValueCount</Item>
<ArrayItems Condition="LinkValid()">
<Size>initialValueCount</Size>
<ValuePointer>GetInitialValueIter()</ValuePointer>
</ArrayItems>
<Item Name="[properties]" Condition="LinkValid()">propertyCount</Item>
<ArrayItems Condition="LinkValid()">
<Size>propertyCount</Size>
<ValuePointer>GetPropertyIter()</ValuePointer>
</ArrayItems>
<Item Name="[global functions]" Condition="LinkValid()">staticFunctionCount</Item>
<ArrayItems Condition="LinkValid()">
<Size>staticFunctionCount</Size>
<ValuePointer>GetGlobalFuncIter()</ValuePointer>
</ArrayItems>
<Item Name="[member functions]" Condition="LinkValid()">emptyStateMemberFunctionCount</Item>
<ArrayItems Condition="LinkValid()">
<Size>emptyStateMemberFunctionCount</Size>
<ValuePointer>GetMemberFuncIter()</ValuePointer>
</ArrayItems>
<Item Name="[named states]" Condition="LinkValid()">namedStateCount</Item>
<ArrayItems Condition="LinkValid()">
<Size>namedStateCount</Size>
<ValuePointer>GetNamedStateIter()</ValuePointer>
</ArrayItems>
</Expand>
</Type>

<Type Name="RE::BSScript::ObjectTypeInfo::UserFlagInfo">
<DisplayString>{(char*)(data &amp; ~(1ULL &lt;&lt; 0)),na}</DisplayString>
</Type>
</AutoVisualizer>
5 changes: 3 additions & 2 deletions CommonLibSSE.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@
<TreatSpecificWarningsAsErrors>4099;4717;%(TreatSpecificWarningsAsErrors)</TreatSpecificWarningsAsErrors>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RemoveUnreferencedCodeData>false</RemoveUnreferencedCodeData>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand Down Expand Up @@ -177,8 +177,8 @@
<TreatSpecificWarningsAsErrors>4099;4717;%(TreatSpecificWarningsAsErrors)</TreatSpecificWarningsAsErrors>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RemoveUnreferencedCodeData>false</RemoveUnreferencedCodeData>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand Down Expand Up @@ -1216,6 +1216,7 @@
<ClInclude Include="include\RE\NetImmerse\NiRefObject\NiObject\bhkRefObject\bhkSerializable\bhkShape\bhkShape.h" />
<ClInclude Include="include\RE\NetImmerse\NiRefObject\NiObject\bhkRefObject\bhkSerializable\bhkShape\bhkShapeCollection\bhkListShape.h" />
<ClInclude Include="include\RE\NetImmerse\NiRefObject\NiObject\bhkRefObject\bhkSerializable\bhkShape\bhkShapeCollection\bhkShapeCollection.h" />
<ClInclude Include="include\RE\NetImmerse\NiRefObject\NiObject\bhkRefObject\bhkSerializable\bhkWorld.h" />
<ClInclude Include="include\RE\NetImmerse\NiRefObject\NiObject\bhkRefObject\bhkSerializable\bhkWorldObject\bhkEntity\bhkEntity.h" />
<ClInclude Include="include\RE\NetImmerse\NiRefObject\NiObject\bhkRefObject\bhkSerializable\bhkWorldObject\bhkEntity\bhkRigidBody.h" />
<ClInclude Include="include\RE\NetImmerse\NiRefObject\NiObject\bhkRefObject\bhkSerializable\bhkWorldObject\bhkPhantom\bhkPhantom.h" />
Expand Down
3 changes: 3 additions & 0 deletions CommonLibSSE.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -2989,6 +2989,9 @@
<ClInclude Include="include\RE\NetImmerse\NiRefObject\NiObject\bhkRefObject\bhkSerializable\bhkShape\bhkShapeCollection\bhkShapeCollection.h">
<Filter>include\RE\NetImmerse\NiRefObject\NiObject\bhkRefObject\bhkSerializable\bhkShape\bhkShapeCollection</Filter>
</ClInclude>
<ClInclude Include="include\RE\NetImmerse\NiRefObject\NiObject\bhkRefObject\bhkSerializable\bhkWorld.h">
<Filter>include\RE\NetImmerse\NiRefObject\NiObject\bhkRefObject\bhkSerializable</Filter>
</ClInclude>
<ClInclude Include="include\RE\NetImmerse\NiRefObject\NiObject\bhkRefObject\bhkSerializable\bhkWorldObject\bhkEntity\bhkEntity.h">
<Filter>include\RE\NetImmerse\NiRefObject\NiObject\bhkRefObject\bhkSerializable\bhkWorldObject\bhkEntity</Filter>
</ClInclude>
Expand Down
2 changes: 2 additions & 0 deletions include/RE/BSCore/BSTArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,8 @@ namespace RE
private:
union Data
{
~Data(){};

pointer heap{ 0 };
value_type local;
};
Expand Down
84 changes: 24 additions & 60 deletions include/RE/BSCore/BSTPointerAndFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,121 +4,85 @@
namespace RE
{
// 0x8
template <class T, std::uint32_t MASK = 1>
template <class T, std::uintptr_t MASK = 1>
class BSTPointerAndFlags
{
public:
using value_type = T;
using element_type = typename T::element_type;

constexpr BSTPointerAndFlags() noexcept = default;

constexpr BSTPointerAndFlags() noexcept :
_storage()
{}
BSTPointerAndFlags(const BSTPointerAndFlags& a_rhs) { _storage.ptr = a_rhs.get(); }


BSTPointerAndFlags(const BSTPointerAndFlags& a_rhs) noexcept :
_storage()
constexpr BSTPointerAndFlags(BSTPointerAndFlags&& a_rhs) noexcept
{
_storage.ptr = a_rhs.get();
}


BSTPointerAndFlags(BSTPointerAndFlags&& a_rhs) noexcept :
_storage()
{
_storage.address = std::move(a_rhs._storage.address);
_storage.address = a_rhs._storage.address;
a_rhs._storage.address = 0;
}


constexpr BSTPointerAndFlags(std::nullptr_t) noexcept :
_storage()
{}

constexpr BSTPointerAndFlags(std::nullptr_t) noexcept {}

~BSTPointerAndFlags()
{
clear_flags();
_storage.ptr.~value_type();
_storage.address = 0;
}


BSTPointerAndFlags& operator=(const BSTPointerAndFlags& a_rhs) noexcept
BSTPointerAndFlags& operator=(const BSTPointerAndFlags& a_rhs)
{
if (this == &a_rhs) {
return *this;
if (this != std::addressof(a_rhs)) {
clear_flags();
_storage.ptr = a_rhs.get();
}

clear_flags();
_storage.ptr = a_rhs.get();
return *this;
}


BSTPointerAndFlags& operator=(BSTPointerAndFlags&& a_rhs) noexcept
{
if (this == &a_rhs) {
return *this;
if (this != std::addressof(a_rhs)) {
clear_flags();
a_rhs.clear_flags();
_storage.address = a_rhs._storage.address;
a_rhs.storage.address = 0;
}

clear_flags();
a_rhs.clear_flags();
_storage.ptr = std::move(a_rhs._storage.ptr);
return *this;
}


void reset() noexcept
{
clear_flags();
_storage.ptr.reset();
}


[[nodiscard]] constexpr element_type* get() const noexcept
[[nodiscard]] element_type* get() const noexcept
{
auto ptr = _storage.address;
return reinterpret_cast<element_type*>(ptr & ~FLAG_MASK);
}


[[nodiscard]] constexpr element_type& operator*() const noexcept
[[nodiscard]] element_type& operator*() const noexcept
{
assert(get() != 0);
assert(get() != nullptr);
return *get();
}

[[nodiscard]] element_type* operator->() const noexcept { return get(); }

[[nodiscard]] constexpr element_type* operator->() const noexcept
{
return get();
}


[[nodiscard]] explicit constexpr operator bool() const noexcept
{
return get() != 0;
}
[[nodiscard]] explicit operator bool() const noexcept { return get() != nullptr; }

protected:
union Storage
{
Storage() :
address(0) {}
~Storage() {}
~Storage() noexcept {}


value_type ptr;
std::uintptr_t address;
std::uintptr_t address{ 0 };
};


void clear_flags()
{
_storage.address &= ~FLAG_MASK;
}

constexpr void clear_flags() noexcept { _storage.address &= ~FLAG_MASK; }

static constexpr std::uintptr_t FLAG_MASK = MASK;

Expand Down
1 change: 1 addition & 0 deletions include/RE/BSHavok/hkVector4.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace RE
class hkVector4
{
public:
// members
hkQuadReal quad{}; // 00
};
static_assert(sizeof(hkVector4) == 0x10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ namespace RE
struct hkpShapeRayCastCollectorOutput
{
public:
[[nodiscard]] constexpr bool hasHit() const noexcept { return hitFraction < 1.0F; }
[[nodiscard]] constexpr bool HasHit() const noexcept { return hitFraction < 1.0F; }

constexpr void reset() noexcept
constexpr void Reset() noexcept
{
hitFraction = 1.0F;
shapeKey = HK_INVALID_SHAPE_KEY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ namespace RE
};


constexpr void changeLevel(std::int32_t a_delta) noexcept
constexpr void ChangeLevel(std::int32_t a_delta) noexcept
{
assert(shapeKeyIndex + a_delta < kMaxHierarchyDepth);
shapeKeyIndex += a_delta;
}

constexpr void setKey(hkpShapeKey a_key) noexcept { shapeKeys[shapeKeyIndex] = a_key; }
constexpr void SetKey(hkpShapeKey a_key) noexcept { shapeKeys[shapeKeyIndex] = a_key; }

constexpr void reset() noexcept
constexpr void Reset() noexcept
{
hkpShapeRayCastCollectorOutput::reset();
hkpShapeRayCastCollectorOutput::Reset();
shapeKeys[0] = HK_INVALID_SHAPE_KEY;
shapeKeyIndex = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ namespace RE
struct hkpWorldRayCastOutput : public hkpShapeRayCastOutput
{
public:
[[nodiscard]] constexpr bool hasHit() const noexcept { return rootCollidable != nullptr; }
[[nodiscard]] constexpr bool HasHit() const noexcept { return rootCollidable != nullptr; }

constexpr void reset() noexcept
constexpr void Reset() noexcept
{
hkpShapeRayCastOutput::reset();
hkpShapeRayCastOutput::Reset();
rootCollidable = nullptr;
}

Expand Down
Loading

0 comments on commit 70b438b

Please sign in to comment.