Skip to content

Commit 4f0afef

Browse files
authored
feat: merge pull request #14 from RunnerScrab/runnerscrab_refactorGetInventoryObject
Runnerscrab refactor get inventory object
2 parents efef77f + fd90392 commit 4f0afef

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

include/RE/B/BGSInventoryInterface.h

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,22 @@ namespace RE
5656

5757
[[nodiscard]] TESBoundObject* GetInventoryObject(const std::uint32_t& a_handleID) const
5858
{
59-
using func_t = bool (*)(const BGSInventoryInterface*, const std::uint32_t*, std::uint64_t***);
60-
static REL::Relocation<func_t> subfn{ ID::BGSInventoryInterface::GetInventoryObjectSub };
59+
struct UnkStruct
60+
{
61+
TESBoundObject** ppObj;
62+
std::uint64_t unk08;
63+
};
6164

6265
std::uint32_t handle = a_handleID;
63-
std::uint64_t out = 0;
64-
std::uint64_t* outarr[2];
65-
std::uint64_t** pout;
66-
outarr[0] = &out;
67-
pout = (std::uint64_t**)&outarr;
68-
subfn(this, &handle, &pout);
69-
return reinterpret_cast<TESBoundObject*>(out);
66+
TESBoundObject* pObj = 0;
67+
UnkStruct outstruct = { .ppObj = &pObj, .unk08 = 0 };
68+
UnkStruct* pOutstruct = &outstruct;
69+
70+
using func_t = bool (*)(const BGSInventoryInterface*, const std::uint32_t*, UnkStruct**);
71+
static REL::Relocation<func_t> GetInventoryObjectHelperFn{ ID::BGSInventoryInterface::GetInventoryObjectSub };
72+
GetInventoryObjectHelperFn(this, &handle, &pOutstruct);
73+
74+
return pObj;
7075
}
7176

7277
virtual ~BGSInventoryInterface(); // 00

0 commit comments

Comments
 (0)