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
17 changes: 13 additions & 4 deletions include/RE/B/BGSInventoryInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,24 @@ namespace RE

[[nodiscard]] TESBoundObject* GetInventoryObject(const std::uint32_t& a_handleID) const
{
using func_t = decltype(&BGSInventoryInterface::GetInventoryObject);
static REL::Relocation<func_t> func{ ID::BGSInventoryInterface::GetInventoryObject };
return func(this, a_handleID);
using func_t = bool (*)(const BGSInventoryInterface*, const std::uint32_t*, std::uint64_t***);
static REL::Relocation<func_t> subfn{ ID::BGSInventoryInterface::GetInventoryObjectSub };

std::uint32_t handle = a_handleID;
std::uint64_t out = 0;
std::uint64_t* outarr[2];
std::uint64_t** pout;
outarr[0] = &out;
pout = (std::uint64_t**)&outarr;
subfn(this, &handle, &pout);
return reinterpret_cast<TESBoundObject*>(out);
}

virtual ~BGSInventoryInterface(); // 00

// members
BSTArray<Agent> agentArray; // 30
std::uint64_t unk30; // 30
BSTArray<Agent> agentArray; // 38
};
//static_assert(sizeof(BGSInventoryInterface) == 0x48);
}
24 changes: 13 additions & 11 deletions include/RE/IDs.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@ namespace RE::ID

namespace ActorValue
{
inline constexpr REL::ID GetSingleton{ 0 }; // 36266
inline constexpr REL::ID GetSingleton{ 43134 }; // 36266
}

namespace ActorEquipManager
{
inline constexpr REL::ID Singleton{ 0 }; // 879425
inline constexpr REL::ID EquipObject{ 0 }; // 151991
inline constexpr REL::ID UnequipObject{ 0 }; // 152007
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
}

namespace ActorCellChangeEvent::Event
{
inline constexpr REL::ID GetEventSource{ 0 }; // 107081
inline constexpr REL::ID GetEventSource{ 64106 }; // 107081
}

namespace ActorItemEquipped::Event
{
inline constexpr REL::ID GetEventSource{ 0 }; // 151162
inline constexpr REL::ID GetEventSource{ 100427 }; // 151162
}

namespace AttachReference::Event
Expand Down Expand Up @@ -140,13 +140,14 @@ namespace RE::ID

namespace BGSInventoryInterface
{
inline constexpr REL::ID Singleton{ 0 }; // 825787
inline constexpr REL::ID GetInventoryObject{ 0 }; // 87520
inline constexpr REL::ID Singleton{ 883301 }; // 825787
inline constexpr REL::ID GetInventoryObject{ 0 }; // 87520 - inlined
inline constexpr REL::ID GetInventoryObjectSub{ 63846 };
}

namespace BGSObjectInstance
{
inline constexpr REL::ID ctor{ 0 }; // 101725
inline constexpr REL::ID ctor{ 59786 }; // 101725
}

namespace BGSPlanet::PlayerKnowledgeFlagSetEvent
Expand Down Expand Up @@ -247,8 +248,9 @@ namespace RE::ID
namespace BSNonReentrantSpinLock
{
inline constexpr REL::ID Lock{ 37396 };
inline constexpr REL::ID TryLock{ 0 }; // 74235 - inlined?
inline constexpr REL::ID Unlock{ 0 }; // 73895 - inlined?
inline constexpr REL::ID TryLock{ 0 }; // 74235 - inlined
inline constexpr REL::ID Unlock{ 0 }; // 73895 - inlined
inline constexpr REL::ID UnlockSubroutine{ 37393 };
}

namespace BSPointerHandleManagerInterface
Expand Down
10 changes: 4 additions & 6 deletions src/RE/B/BSLock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ namespace RE

bool BSNonReentrantSpinLock::TryLock()
{
using func_t = decltype(&BSNonReentrantSpinLock::TryLock);
static REL::Relocation<func_t> func{ ID::BSNonReentrantSpinLock::TryLock };
return func(this);
return _InterlockedOr(reinterpret_cast<volatile long*>(&this->m_lock), 1) == 0;
}

void BSNonReentrantSpinLock::Unlock()
{
using func_t = decltype(&BSNonReentrantSpinLock::Unlock);
static REL::Relocation<func_t> func{ ID::BSNonReentrantSpinLock::Unlock };
return func(this);
using func_t = int (*)(BSNonReentrantSpinLock*, std::int32_t, std::int8_t);
static REL::Relocation<func_t> func{ ID::BSNonReentrantSpinLock::UnlockSubroutine };
func(this, 1, 2);
}

void BSReadWriteLock::LockRead()
Expand Down
7 changes: 4 additions & 3 deletions src/RE/O/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ namespace RE::BSScript
{
void Object::dtor()
{
static REL::Relocation<void (*)(Object*)> UnkObjectDtorSubroutine{ ID::BSScript::Object::dtorUnkSub };
typedef ObjectTypeInfo* (*ObjectTypeInfoDeallocator)(ObjectTypeInfo*, std::uint32_t);
static REL::Relocation<ObjectTypeInfoDeallocator> ObjectTypeInfoDealloc{ ID::BSScript::ObjectTypeInfo::dtor };
using func_t = decltype(&Object::dtor);
using func2_t = ObjectTypeInfo* (*)(ObjectTypeInfo*, std::uint32_t);
static REL::Relocation<func_t> UnkObjectDtorSubroutine{ ID::BSScript::Object::dtorUnkSub };
static REL::Relocation<func2_t> ObjectTypeInfoDealloc{ ID::BSScript::ObjectTypeInfo::dtor };

this->lockStructure =
reinterpret_cast<void*>(reinterpret_cast<volatile std::uint64_t>(this->lockStructure) & 0xfffffffffffffffe);
Expand Down