Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion include/RE/B/BSAnimationGraph.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#pragma once

#include "RE/B/BGSAnimationPathImplementation.h"
#include "RE/B/BSIntrusiveRefCounted.h"
#include "RE/B/BSLock.h"
#include "RE/B/BSTEvent.h"
#include "RE/B/BSTSmartPointer.h"

namespace RE
{
class BGSAnimationPathImplementation;
class BSAnimationGraphEvent;
class BSFadeNode;
struct BSMovementDataChangedEvent;
Expand Down Expand Up @@ -80,6 +80,11 @@ namespace RE
public:
virtual ~AnimationManager();

[[nodiscard]] TESObjectREFR* GetTargetReference() const
{
return animationPath ? animationPath->reference : nullptr;
}

// members
std::byte unkA8[0x218]; // A8
BGSAnimationPathImplementation* animationPath; // 2C0
Expand Down
109 changes: 109 additions & 0 deletions include/RE/B/BSService.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#pragma once

#include "RE/B/BSLock.h"

namespace RE
{
namespace BSService
{
class QueuedDelegate
{
public:
virtual ~QueuedDelegate() = default; // 00

virtual void RunAndDispose() // 01
{
Run();
delete this;
}

virtual void Unk02() {} // 02
virtual void Unk03() {} // 03
virtual void* GetProfilerContext() { return nullptr; } // 04
virtual void Unk05() {} // 05
virtual void Unk06() {} // 06
virtual void Unk07() {} // 07

virtual void Run() = 0;

std::uint32_t IncRef() const
{
REX::TAtomicRef myRefCount{ refCount };
return ++myRefCount;
}

void Release() const
{
REX::TAtomicRef myRefCount{ refCount };
if (--myRefCount == 0) {
const_cast<QueuedDelegate*>(this)->RunAndDispose();
}
}

// members
mutable volatile std::uint32_t refCount{ 1 }; // 08
std::uint32_t pad0C{ 0 }; // 0C
std::byte pad10[0x18]{}; // 10
BSReadWriteLock lock; // 28
const void* profilerCategory{}; // 30
std::byte pad38[0xE8]{}; // 38
};
static_assert(offsetof(QueuedDelegate, refCount) == 0x08);
static_assert(offsetof(QueuedDelegate, lock) == 0x28);
static_assert(offsetof(QueuedDelegate, profilerCategory) == 0x30);
static_assert(sizeof(QueuedDelegate) == 0x120);

namespace detail
{
template <class Fn>
class QueuedFunctorDelegate :
public QueuedDelegate
{
public:
explicit QueuedFunctorDelegate(Fn a_fn) :
_fn(std::move(a_fn))
{}

void Run() override { _fn(); }

private:
Fn _fn;
};
}

class TaskQueue
{
public:
[[nodiscard]] static TaskQueue* GetSingleton()
{
static REL::Relocation<TaskQueue**> singleton{ ID::BSService::TaskQueue::Singleton };
return *singleton;
}

void QueueTask(QueuedDelegate*& a_task)
{
using func_t = void (*)(TaskQueue*, QueuedDelegate**);
static REL::Relocation<func_t> func{ ID::BSService::TaskQueue::QueueTask };
func(this, std::addressof(a_task));
}

void AddTask(QueuedDelegate* a_task)
{
if (!a_task) {
return;
}
QueueTask(a_task);
if (a_task) {
a_task->Release();
}
}

template <class Fn>
requires(std::invocable<std::remove_cvref_t<Fn>&>)
void AddTask(Fn&& a_fn)
{
AddTask(new detail::QueuedFunctorDelegate<std::remove_cvref_t<Fn>>(std::forward<Fn>(a_fn)));
}
};
}
}
16 changes: 11 additions & 5 deletions include/RE/IDs.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ namespace RE::ID

namespace ActorEquipManager
{
inline constexpr REL::ID Singleton{ 938503 }; // 879425
inline constexpr REL::ID EquipObject{ 0 }; // 151991 -> TODO: Verify 101949 in 1.15
inline constexpr REL::ID UnequipObject{ 0 }; // 152007 -> TODO: Verify 101951 in 1.15
inline constexpr REL::ID Singleton{ 938503 }; // 879425
inline constexpr REL::ID EquipObject{ 101949 }; // 151991
inline constexpr REL::ID UnequipObject{ 101951 }; // 152007
}

namespace ActorCellChangeEvent::Event
Expand Down Expand Up @@ -338,6 +338,12 @@ namespace RE::ID
}
}

namespace BSService::TaskQueue
{
inline constexpr REL::ID Singleton{ 883606 };
inline constexpr REL::ID QueueTask{ 100121 };
}

namespace BSSpinLock
{
inline constexpr REL::ID Lock{ 123819 };
Expand Down Expand Up @@ -1631,7 +1637,7 @@ namespace RE::ID

namespace SaveLoadEvent
{
inline constexpr REL::ID GetEventSource{ 0 }; // 129747
inline constexpr REL::ID GetEventSource{ 82710 }; // 129747
}

namespace Scaleform
Expand Down Expand Up @@ -2289,7 +2295,7 @@ namespace RE::ID

namespace TESLoadGameEvent
{
inline constexpr REL::ID GetEventSource{ 0 }; // 1868757
inline constexpr REL::ID GetEventSource{ 64149 }; // 1868757
}

namespace TESLockChangedEvent
Expand Down
1 change: 1 addition & 0 deletions include/RE/Starfield.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
#include "RE/B/BSReflection.h"
#include "RE/B/BSResourceEnums.h"
#include "RE/B/BSScriptUtil.h"
#include "RE/B/BSService.h"
#include "RE/B/BSStorage.h"
#include "RE/B/BSStringPool.h"
#include "RE/B/BSStringT.h"
Expand Down
28 changes: 6 additions & 22 deletions include/RE/T/TESDataHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ namespace RE
{
public:
// members
BSTArray<TESFile*> files; // 00
BSTArray<TESFile*> smallFiles; // 10
BSTArray<TESFile*> files; // 00
BSTArray<TESFile*> smallFiles; // 10
BSTArray<TESFile*> mediumFiles; // 20
};
static_assert(sizeof(TESFileCollection) == 0x20);
static_assert(sizeof(TESFileCollection) == 0x30);

class TESDataHandler :
public BSTEventSource<BGSHotloadCompletedEvent> // 0000
Expand Down Expand Up @@ -67,25 +68,8 @@ namespace RE
std::uint64_t unk14E0; // 14E0
std::uint64_t unk14E8; // 14E8
BSSimpleList<TESFile*> files; // 14F0
TESFileCollection compiledFileCollection; // 1500
std::uint64_t unk1520; // 1520
std::uint64_t unk1528; // 1528
std::uint64_t unk1530; // 1530
std::uint64_t unk1538; // 1538
std::uint64_t unk1540; // 1540
std::uint64_t unk1548; // 1548
std::uint64_t unk1550; // 1550
std::uint64_t unk1558; // 1558
std::uint64_t unk1560; // 1560
std::uint64_t unk1568; // 1568
std::uint64_t unk1570; // 1570
std::uint64_t unk1578; // 1578
std::uint64_t unk1580; // 1580
std::uint64_t unk1588; // 1588
std::uint64_t unk1590; // 1590
std::uint64_t unk1598; // 1598
std::uint64_t unk15A0; // 15A0
std::uint64_t unk15A8; // 15A8
std::byte pad1500[0x80]; // 1500
TESFileCollection compiledFileCollection; // 1580
std::uint64_t unk15B0; // 15B0
std::uint64_t unk15B8; // 15B8
std::uint64_t unk15C0; // 15C0
Expand Down
2 changes: 2 additions & 0 deletions include/RE/T/TESFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ namespace RE

std::uint8_t pad0[0x38]; //0
char fileName[260]; //38
std::uint8_t pad13C[0x7B]; //13C
std::uint8_t compileIndex; //1B7
};
}
Loading