diff --git a/include/RE/B/BGSInventoryInterface.h b/include/RE/B/BGSInventoryInterface.h index bee48191..107b49bb 100644 --- a/include/RE/B/BGSInventoryInterface.h +++ b/include/RE/B/BGSInventoryInterface.h @@ -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{ ID::BGSInventoryInterface::GetInventoryObject }; - return func(this, a_handleID); + using func_t = bool (*)(const BGSInventoryInterface*, const std::uint32_t*, std::uint64_t***); + static REL::Relocation 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(out); } virtual ~BGSInventoryInterface(); // 00 // members - BSTArray agentArray; // 30 + std::uint64_t unk30; // 30 + BSTArray agentArray; // 38 }; //static_assert(sizeof(BGSInventoryInterface) == 0x48); } diff --git a/include/RE/IDs.h b/include/RE/IDs.h index 32963ac3..105b152b 100644 --- a/include/RE/IDs.h +++ b/include/RE/IDs.h @@ -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 @@ -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 @@ -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 diff --git a/src/RE/B/BSLock.cpp b/src/RE/B/BSLock.cpp index 8bd0d329..552d18f8 100644 --- a/src/RE/B/BSLock.cpp +++ b/src/RE/B/BSLock.cpp @@ -11,16 +11,14 @@ namespace RE bool BSNonReentrantSpinLock::TryLock() { - using func_t = decltype(&BSNonReentrantSpinLock::TryLock); - static REL::Relocation func{ ID::BSNonReentrantSpinLock::TryLock }; - return func(this); + return _InterlockedOr(reinterpret_cast(&this->m_lock), 1) == 0; } void BSNonReentrantSpinLock::Unlock() { - using func_t = decltype(&BSNonReentrantSpinLock::Unlock); - static REL::Relocation func{ ID::BSNonReentrantSpinLock::Unlock }; - return func(this); + using func_t = int (*)(BSNonReentrantSpinLock*, std::int32_t, std::int8_t); + static REL::Relocation func{ ID::BSNonReentrantSpinLock::UnlockSubroutine }; + func(this, 1, 2); } void BSReadWriteLock::LockRead() diff --git a/src/RE/O/Object.cpp b/src/RE/O/Object.cpp index 995c0e4f..833765a6 100644 --- a/src/RE/O/Object.cpp +++ b/src/RE/O/Object.cpp @@ -4,9 +4,10 @@ namespace RE::BSScript { void Object::dtor() { - static REL::Relocation UnkObjectDtorSubroutine{ ID::BSScript::Object::dtorUnkSub }; - typedef ObjectTypeInfo* (*ObjectTypeInfoDeallocator)(ObjectTypeInfo*, std::uint32_t); - static REL::Relocation ObjectTypeInfoDealloc{ ID::BSScript::ObjectTypeInfo::dtor }; + using func_t = decltype(&Object::dtor); + using func2_t = ObjectTypeInfo* (*)(ObjectTypeInfo*, std::uint32_t); + static REL::Relocation UnkObjectDtorSubroutine{ ID::BSScript::Object::dtorUnkSub }; + static REL::Relocation ObjectTypeInfoDealloc{ ID::BSScript::ObjectTypeInfo::dtor }; this->lockStructure = reinterpret_cast(reinterpret_cast(this->lockStructure) & 0xfffffffffffffffe);