Skip to content

Commit f4fae4d

Browse files
committed
feat: merge upstream
2 parents 1b19796 + 03ac0e7 commit f4fae4d

24 files changed

+677
-99
lines changed

include/RE/B/BSPathing.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ namespace RE
2222
std::uint8_t flags; // 2A
2323
std::uint8_t clientData; // 2B
2424
};
25-
2625
static_assert(sizeof(BSPathingLocation) == 0x30);
2726

2827
struct BSVirtualPathingNode

include/RE/B/BSPathingCell.h

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
namespace RE
66
{
7+
class bhkWorld;
8+
class BSPathingSpace;
9+
class BSPathingStreamRead;
10+
class BSPathingStreamWrite;
11+
struct BSPathingNumericIDVisitor;
12+
713
class BSPathingCell : public BSIntrusiveRefCounted
814
{
915
public:
@@ -14,14 +20,14 @@ namespace RE
1420

1521
// add
1622
virtual std::uint32_t GetType() const = 0; // 01 - crc32 hash of class name
17-
virtual void Unk_02(void) = 0; // 02
18-
virtual void Unk_03(void) = 0; // 03
19-
virtual void Unk_04(void) = 0; // 04
20-
virtual void Unk_05(void) = 0; // 05
21-
virtual void Unk_06(void) = 0; // 06
22-
virtual void Unk_07(void) = 0; // 07
23-
virtual void Unk_08(void) = 0; // 08
24-
virtual void Unk_09(void) = 0; // 09
23+
virtual void Write(const BSPathingStreamWrite& a_stream) = 0; // 02
24+
virtual void Read(const BSPathingStreamRead& a_stream) = 0; // 03
25+
virtual void FixupNumericID(BSPathingNumericIDVisitor& a_visitor) = 0; // 04
26+
virtual void GetSpace(BSTSmartPointer<BSPathingSpace>& a_out) = 0; // 05
27+
virtual bhkWorld* GetBhkWorld() = 0; // 06
28+
virtual bool QValid() const = 0; // 07
29+
virtual bool QAttached() const = 0; // 08
30+
virtual bool QLoaded() const = 0; // 09
2531
virtual bool IsInSameSpace(BSTSmartPointer<BSPathingCell>* a_otherCell) = 0; // 0A
2632
};
2733
static_assert(sizeof(BSPathingCell) == 0x10);

include/RE/B/BSPointerHandle.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,17 @@ namespace RE
152152

153153
void reset() noexcept { _handle.reset(); }
154154

155-
[[nodiscard]] NiPointer<T> get() const
155+
[[nodiscard]] NiPointer<T> get()
156156
{
157157
NiPointer<T> ptr;
158158
get_smartptr(ptr);
159159
return ptr;
160160
}
161161

162-
[[nodiscard]] NiPointer<T> getsafe() const
162+
[[nodiscard]] NiPointer<T> get() const
163163
{
164164
NiPointer<T> ptr;
165-
get_validated_smartptr(ptr);
165+
get_smartptr(ptr);
166166
return ptr;
167167
}
168168

@@ -185,8 +185,8 @@ namespace RE
185185
friend class BSPointerHandle;
186186

187187
void get_handle(T* a_ptr);
188+
bool get_smartptr(NiPointer<T>& a_smartPointerOut);
188189
bool get_smartptr(NiPointer<T>& a_smartPointerOut) const;
189-
bool get_validated_smartptr(NiPointer<T>& a_smartPointerOut) const;
190190

191191
Handle _handle;
192192
};
@@ -222,17 +222,17 @@ namespace RE
222222
return func(a_ptr);
223223
}
224224

225-
static bool GetSmartPointer(const BSPointerHandle<T>& a_handle, NiPointer<T>& a_smartPointerOut)
225+
static bool GetSmartPointer(BSPointerHandle<T>& a_handle, NiPointer<T>& a_smartPointerOut) // clears the handle
226226
{
227-
using func_t = decltype(&BSPointerHandleManagerInterface<T, Manager>::GetSmartPointer);
228-
static REL::Relocation<func_t> func{ RELOCATION_ID(12204, 12332) };
227+
using func_t = bool (*)(BSPointerHandle<T>&, NiPointer<T>&);
228+
static REL::Relocation<func_t> func{ RELOCATION_ID(12785, 12922) };
229229
return func(a_handle, a_smartPointerOut);
230230
}
231231

232-
static bool GetHandleValidatedSmartPointer(const BSPointerHandle<T>& a_handle, NiPointer<T>& a_smartPointerOut)
232+
static bool GetSmartPointer(const BSPointerHandle<T>& a_handle, NiPointer<T>& a_smartPointerOut)
233233
{
234-
using func_t = decltype(&BSPointerHandleManagerInterface<T, Manager>::GetHandleValidatedSmartPointer);
235-
static REL::Relocation<func_t> func{ RELOCATION_ID(12785, 12922) };
234+
using func_t = bool (*)(const BSPointerHandle<T>&, NiPointer<T>&);
235+
static REL::Relocation<func_t> func{ RELOCATION_ID(12204, 12332) };
236236
return func(a_handle, a_smartPointerOut);
237237
}
238238
};
@@ -248,14 +248,14 @@ namespace RE
248248
}
249249

250250
template <class T, class Handle>
251-
bool BSPointerHandle<T, Handle>::get_smartptr(NiPointer<T>& a_smartPointerOut) const
251+
bool BSPointerHandle<T, Handle>::get_smartptr(NiPointer<T>& a_smartPointerOut)
252252
{
253253
return BSPointerHandleManagerInterface<T>::GetSmartPointer(*this, a_smartPointerOut);
254254
}
255255

256256
template <class T, class Handle>
257-
bool BSPointerHandle<T, Handle>::get_validated_smartptr(NiPointer<T>& a_smartPointerOut) const
257+
bool BSPointerHandle<T, Handle>::get_smartptr(NiPointer<T>& a_smartPointerOut) const
258258
{
259-
return BSPointerHandleManagerInterface<T>::GetHandleValidatedSmartPointer(*this, a_smartPointerOut);
259+
return BSPointerHandleManagerInterface<T>::GetSmartPointer(*this, a_smartPointerOut);
260260
}
261261
}
Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include "RE/B/BSHandleRefObject.h"
3+
#include "RE/B/BSPointerHandle.h"
44
#include "RE/N/NiSmartPointer.h"
55

66
namespace RE
@@ -12,23 +12,42 @@ namespace RE
1212
struct Entry
1313
{
1414
public:
15-
enum EntryBitfieldConstants : std::uint32_t
15+
enum class EntryBitfieldConstants
1616
{
17-
//kAgeInc = (1 << T::kFreeListBits), // 0x100000
18-
//kFreeListMask = kAgeInc - 1, // 0xFFFFF
19-
//kInUseBit = kAgeInc << kAgeShift // 0x4000000
17+
kAgeInc = 1 << 20, // (1 << T::kFreeListBits)
18+
kFreeListMask = kAgeInc - 1, // 0xFFFFF
19+
kInUseBit = 1 << 26 // kAgeInc << T::kAgeShift
2020
};
2121

22+
[[nodiscard]] bool IsInUse() const
23+
{
24+
return handleEntryBits.any(EntryBitfieldConstants::kInUseBit);
25+
}
26+
2227
// members
23-
std::uint32_t handleEntryBits; // 00
24-
std::uint32_t pad04; // 04
25-
NiPointer<BSHandleRefObject> pointer; // 08
28+
REX::TEnumSet<EntryBitfieldConstants, std::uint32_t> handleEntryBits; // 00
29+
std::uint32_t pad04; // 04
30+
NiPointer<BSHandleRefObject> pointer; // 08
2631
};
32+
static_assert(sizeof(Entry) == 0x10);
33+
34+
[[nodiscard]] static bool IsValid(const ObjectRefHandle& a_handle)
35+
{
36+
using func_t = decltype(&BSPointerHandleManager<TESObjectREFR>::IsValid);
37+
static REL::Relocation<func_t> func{ RELOCATION_ID(75454, 77239) };
38+
return func(a_handle);
39+
}
2740

2841
[[nodiscard]] static auto GetHandleEntries()
2942
{
3043
static REL::Relocation<Entry(*)[0x100000]> entries{ RELOCATION_ID(514478, 400622) };
3144
return std::span<Entry, 0x100000>{ *entries };
3245
}
46+
47+
[[nodiscard]] static BSReadWriteLock& GetHandleManagerLock()
48+
{
49+
static REL::Relocation<BSReadWriteLock*> handleManagerLock{ RELOCATION_ID(514477, 400621) };
50+
return *handleManagerLock;
51+
}
3352
};
3453
}

include/RE/B/BSShadowDirectionalLight.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include "RE/B/BSShadowLight.h"
4+
#include "REX/W32/D3D.h"
45

56
namespace RE
67
{
@@ -14,15 +15,15 @@ namespace RE
1415
~BSShadowDirectionalLight() override; // 00
1516

1617
// override (BSShadowLight)
17-
bool GetIsFrustumOrDirectionalLight() override; // 04
18-
void GetIsDirectionalLight() override; // 06
19-
void Accumulate(std::uint32_t& a_globalShadowLightCount, std::uint32_t& a_shadowMaskChannel, const NiPointer<NiAVObject>& a_cullingScene) override; // 09
20-
void Render() override; // 0A
21-
void ClearShadowMapData() override; // 0C
22-
std::uint32_t GetPassExtraParam(std::uint32_t a_accumFlag) override; // 0D
23-
bool GetNeedsClipPlanes() override; // 0E
24-
void UpdateClipPlanes(void* a_unk1, void* a_unk2) override; // 0F
25-
bool UpdateCamera(const NiCamera* a_viewCamera) override; // 10
18+
bool GetIsFrustumOrDirectionalLight() override; // 04
19+
void GetIsDirectionalLight() override; // 06
20+
void Accumulate(std::uint32_t& a_globalShadowLightCount, std::uint32_t& a_shadowMaskChannel, NiAVObject* a_cullingScene) override; // 09
21+
void Render(std::uint32_t& a_index) override; // 0A
22+
void ReturnShadowmaps() override; // 0C
23+
std::uint32_t GetPassExtraParam(std::uint32_t a_accumFlag) override; // 0D
24+
bool GetNeedsClipPlanes() override; // 0E
25+
void TransformClipSpacePlanes(REX::W32::D3DMATRIX* a_matrix1, REX::W32::D3DMATRIX* a_matrix2) override; // 0F
26+
bool UpdateCamera(const NiCamera* a_viewCamera) override; // 10
2627

2728
// members
2829
NiPoint3 sunVector; // 560

include/RE/B/BSShadowFrustumLight.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ namespace RE
1313
~BSShadowFrustumLight() override; // 00
1414

1515
// override (BSShadowLight)
16-
bool GetIsFrustumOrDirectionalLight() override; // 04
17-
bool GetIsFrustumLight() override; // 05
18-
void Accumulate(std::uint32_t& a_globalShadowLightCount, std::uint32_t& a_shadowMaskChannel, const NiPointer<NiAVObject>& a_cullingScene) override; // 09
19-
void Render() override; // 0A
20-
bool UpdateCamera(const NiCamera* a_viewCamera) override; // 10
16+
bool GetIsFrustumOrDirectionalLight() override; // 04
17+
bool GetIsFrustumLight() override; // 05
18+
void Accumulate(std::uint32_t& a_globalShadowLightCount, std::uint32_t& a_shadowMaskChannel, NiAVObject* a_cullingScene) override; // 09
19+
void Render(std::uint32_t& a_index) override; // 0A
20+
bool UpdateCamera(const NiCamera* a_viewCamera) override; // 10
2121

2222
// members
2323
float xFOV; // 560

include/RE/B/BSShadowLight.h

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "RE/B/BSLight.h"
44
#include "RE/N/NiFrustumPlanes.h"
55
#include "RE/N/NiRect.h"
6+
#include "REX/W32/D3D.h"
67

78
namespace RE
89
{
@@ -32,19 +33,19 @@ namespace RE
3233
~BSShadowLight() override; // 00
3334

3435
// add
35-
virtual bool GetIsFrustumOrDirectionalLight() = 0; // 04
36-
virtual bool GetIsFrustumLight(); // 05
37-
virtual void GetIsDirectionalLight(); // 06
38-
virtual bool GetIsParabolicLight(); // 07
39-
virtual bool GetIsOmniLight(); // 08
40-
virtual void Accumulate(std::uint32_t& a_globalShadowLightCount, std::uint32_t& a_shadowMaskChannel, const NiPointer<NiAVObject>& a_cullingScene) = 0; // 09
41-
virtual void Render() = 0; // 0A
42-
virtual void SetShadowMapCount(std::uint32_t a_count); // 0B
43-
virtual void ClearShadowMapData(); // 0C
44-
virtual std::uint32_t GetPassExtraParam(std::uint32_t a_accumFlag); // 0D
45-
virtual bool GetNeedsClipPlanes(); // 0E
46-
virtual void UpdateClipPlanes(void* a_unk1, void* a_unk2); // 0F
47-
virtual bool UpdateCamera(const NiCamera* a_viewCamera) = 0; // 10
36+
virtual bool GetIsFrustumOrDirectionalLight() = 0; // 04
37+
virtual bool GetIsFrustumLight(); // 05
38+
virtual void GetIsDirectionalLight(); // 06
39+
virtual bool GetIsParabolicLight(); // 07
40+
virtual bool GetIsOmniLight(); // 08
41+
virtual void Accumulate(std::uint32_t& a_globalShadowLightCount, std::uint32_t& a_shadowMaskChannel, NiAVObject* a_cullingScene) = 0; // 09
42+
virtual void Render(std::uint32_t& a_index) = 0; // 0A
43+
virtual void SetShadowMapCount(std::uint32_t a_count); // 0B
44+
virtual void ReturnShadowmaps(); // 0C
45+
virtual std::uint32_t GetPassExtraParam(std::uint32_t a_accumFlag); // 0D
46+
virtual bool GetNeedsClipPlanes(); // 0E
47+
virtual void TransformClipSpacePlanes(REX::W32::D3DMATRIX* a_matrix1, REX::W32::D3DMATRIX* a_matrix2); // 0F
48+
virtual bool UpdateCamera(const NiCamera* a_viewCamera) = 0; // 10
4849

4950
// members
5051
std::uint32_t shadowMapCount; // 140

include/RE/B/BSShadowParabolicLight.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ namespace RE
1313
~BSShadowParabolicLight() override; // 00
1414

1515
// override (BSShadowLight)
16-
bool GetIsParabolicLight() override; // 07
17-
bool GetIsOmniLight() override; // 08
18-
void Accumulate(std::uint32_t& a_globalShadowLightCount, std::uint32_t& a_shadowMaskChannel, const NiPointer<NiAVObject>& a_cullingScene) override; // 09
19-
void Render() override; // 0A
20-
void SetShadowMapCount(std::uint32_t a_count) override; // 0B
21-
void ClearShadowMapData() override; // 0C
22-
std::uint32_t GetPassExtraParam(std::uint32_t a_accumFlag) override; // 0D
23-
bool GetNeedsClipPlanes() override; // 0E
24-
bool UpdateCamera(const NiCamera* a_viewCamera) override; // 10
16+
bool GetIsParabolicLight() override; // 07
17+
bool GetIsOmniLight() override; // 08
18+
void Accumulate(std::uint32_t& a_globalShadowLightCount, std::uint32_t& a_shadowMaskChannel, NiAVObject* a_cullingScene) override; // 09
19+
void Render(std::uint32_t& a_index) override; // 0A
20+
void SetShadowMapCount(std::uint32_t a_count) override; // 0B
21+
void ReturnShadowmaps() override; // 0C
22+
std::uint32_t GetPassExtraParam(std::uint32_t a_accumFlag) override; // 0D
23+
bool GetNeedsClipPlanes() override; // 0E
24+
bool UpdateCamera(const NiCamera* a_viewCamera) override; // 10
2525
};
2626
static_assert(sizeof(BSShadowParabolicLight) == 0x560);
2727
}

0 commit comments

Comments
 (0)