Skip to content

Commit

Permalink
ExamineMenu related work. (#20)
Browse files Browse the repository at this point in the history
* chore: Adjust enum specification.

* feat: Declare additional callback types based on
`ExamineConfirmMenu::ICallback`.

* feat: BGSInventoryItem additions.

* feat: Add `ConsumeSelectedItems` to `ExamineMenu`.

---------

Co-authored-by: FalloutCascadia <[email protected]>
  • Loading branch information
FlenarnTemp and FalloutCascadia authored Aug 26, 2024
1 parent afe2eea commit 3b032bf
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CommonLibF4/include/RE/Bethesda/BGSDefaultObjectManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ namespace RE
public:
// members
const char* name; // 00
ENUM_FORM_ID type; // 08
REX::EnumSet<ENUM_FORM_ID, std::uint8_t> type; // 08
std::uint32_t uniqueID; // 0C
REX::EnumSet<DEFAULT_OBJECT_TYPE, std::int32_t> doType; // 10
const char* newObjectName; // 18
Expand Down
13 changes: 10 additions & 3 deletions CommonLibF4/include/RE/Bethesda/BGSInventoryItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,21 @@ namespace RE
return iter;
}

[[nodiscard]] const char* GetDisplayFullName(std::uint32_t a_stackID)
[[nodiscard]] const char* GetDisplayFullName(std::uint32_t a_stackID) const
{
using func_t = decltype(&BGSInventoryItem::GetDisplayFullName);
using func_t = const char* (BGSInventoryItem::*)(std::uint32_t) const;
static REL::Relocation<func_t> func{ REL::ID(2194079) };
return func(this, a_stackID);
}

[[nodiscard]] TBO_InstanceData* GetInstanceData(std::uint32_t a_stackID)
[[nodiscard]] const char* GetDisplayFullName(const ExtraDataList* a_extra) const
{
using func_t = const char* (BGSInventoryItem::*)(const ExtraDataList*) const;
static REL::Relocation<func_t> func{ REL::ID(2194080) };
return func(this, a_extra);
}

[[nodiscard]] TBO_InstanceData* GetInstanceData(std::uint32_t a_stackID) const
{
using func_t = decltype(&BGSInventoryItem::GetInstanceData);
static REL::Relocation<func_t> func{ REL::ID(2194072) };
Expand Down
2 changes: 1 addition & 1 deletion CommonLibF4/include/RE/Bethesda/BGSMod.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ namespace RE::BGSMod
BGSAttachParentArray attachParents; // 98
BGSTypedKeywordValueArray<KeywordType::kInstantiationFilter> filterKeywords; // B0
BGSTypedKeywordValue<KeywordType::kAttachPoint> attachPoint; // C0
ENUM_FORM_ID targetFormType; // C2
REX::EnumSet<ENUM_FORM_ID, std::uint8_t> targetFormType; // C2
std::uint8_t maxRank; // C3
std::uint8_t lvlsPerTierScaledOffset; // C4
std::int8_t priority; // C5
Expand Down
78 changes: 76 additions & 2 deletions CommonLibF4/include/RE/Bethesda/IMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -1874,9 +1874,9 @@ namespace RE
static constexpr auto RTTI{ RTTI::ExamineConfirmMenu__InitDataRepairFailure };
static constexpr auto VTABLE{ VTABLE::ExamineConfirmMenu__InitDataRepairFailure };

InitDataRepairFailure(const BSTArray<BSTTuple<TESForm*, BGSTypedFormValuePair::SharedVal>>* requiredItems) :
InitDataRepairFailure(const BSTArray<BSTTuple<TESForm*, BGSTypedFormValuePair::SharedVal>>* a_requiredItems) :
InitData(GameSettingCollection::GetSingleton()->GetSetting("sCannotRepairMessage")->GetString(), "$OK", CONFIRM_TYPE::kRepairFailure),
requiredItems(requiredItems)
requiredItems(a_requiredItems)
{
this->hasCancelButton = false;
stl::emplace_vtable(this);
Expand All @@ -1889,6 +1889,7 @@ namespace RE
// members
const BSTArray<BSTTuple<TESForm *,BGSTypedFormValuePair::SharedVal>>* requiredItems; // 20
BSTHashMap<TESBoundObject*, std::uint32_t> availableComponents; // 28

};
static_assert(sizeof(InitDataRepairFailure) == 0x58);

Expand Down Expand Up @@ -1923,6 +1924,72 @@ namespace RE
};
static_assert(sizeof(ScrapItemCallback) == 0x18);

class __declspec(novtable) RepairFailureCallback :
public ExamineConfirmMenu::ICallback // 00
{
public:
static constexpr auto RTTI{ RTTI::__RepairFailureCallback };
static constexpr auto VTABLE{ VTABLE::__RepairFailureCallback };

RepairFailureCallback(ExamineMenu* a_thisMenu) :
ExamineConfirmMenu::ICallback(a_thisMenu)
{
stl::emplace_vtable(this);
}

virtual ~RepairFailureCallback() = default; // 00

// override
virtual void OnAccept() override; // 01

F4_HEAP_REDEFINE_NEW(RepairFailureCallback);
};
static_assert(sizeof(RepairFailureCallback) == 0x10);

class __declspec(novtable) BaseBotConfirmCallback :
public ExamineConfirmMenu::ICallback // 00
{
public:
static constexpr auto RTTI{ RTTI::__BaseBotConfirmCallback };
static constexpr auto VTABLE{ VTABLE::__BaseBotConfirmCallback };

BaseBotConfirmCallback(ExamineMenu* a_thisMenu) :
ExamineConfirmMenu::ICallback(a_thisMenu)
{
stl::emplace_vtable(this);
}

virtual ~BaseBotConfirmCallback() = default; // 00

// override
virtual void OnAccept() override; // 01

F4_HEAP_REDEFINE_NEW(BaseBotConfirmCallback);
};
static_assert(sizeof(BaseBotConfirmCallback) == 0x10);

class __declspec(novtable) ModConfirmCallback :
public ExamineConfirmMenu::ICallback // 00
{
public:
static constexpr auto RTTI{ RTTI::__ModConfirmCallback };
static constexpr auto VTABLE{ VTABLE::__ModConfirmCallback };

ModConfirmCallback(ExamineMenu* a_thisMenu) :
ExamineConfirmMenu::ICallback(a_thisMenu)
{
stl::emplace_vtable(this);
}

virtual ~ModConfirmCallback() = default; // 00

// override
virtual void OnAccept() override; // 01

F4_HEAP_REDEFINE_NEW(ModConfirmCallback);
};
static_assert(sizeof(ModConfirmCallback) == 0x10);

class __declspec(novtable) ExamineMenu :
public WorkbenchMenuBase // 00
{
Expand Down Expand Up @@ -2025,6 +2092,13 @@ namespace RE
return func(this, a_data, a_callback);
}

void ConsumeSelectedItems(bool a_autoBuild, const BGSSoundDescriptorForm* a_consumeSound)
{
using func_t = decltype(&ExamineMenu::ConsumeSelectedItems);
static REL::Relocation<func_t> func{ REL::ID(2223052) };
return func(this, a_autoBuild, a_consumeSound);
}

// members
ComponentBuilderFunctor componentFunctor; // 340
REX::EnumSet<INSPECT_MODE_STATE, std::uint32_t> inspectModeState; // 368
Expand Down
18 changes: 9 additions & 9 deletions CommonLibF4/include/RE/Bethesda/TESForms.h
Original file line number Diff line number Diff line change
Expand Up @@ -1761,15 +1761,15 @@ namespace RE

enum CHARISMA_CHALLENGE_DIFFICULTY : std::uint32_t
{
CC_CHALLENGE_NONE = 0x0,
CC_CHALLENGE_EASY = 0x1,
CC_CHALLENGE_MEDIUM = 0x2,
CC_CHALLENGE_HARD = 0x3,
CC_CHALLENGE_ALWAYS_SUCCEEDS = 0x4,
CC_CHALLENGE_EASY_REPEATABLE = 0x5,
CC_CHALLENGE_MEDIUM_REPEATABLE = 0x6,
CC_CHALLENGE_HARD_REPEATABLE = 0x7,
CC_CHALLENGE_COUNT = 0x8,
CC_CHALLENGE_NONE = 0,
CC_CHALLENGE_EASY = 1,
CC_CHALLENGE_MEDIUM = 2,
CC_CHALLENGE_HARD = 3,
CC_CHALLENGE_ALWAYS_SUCCEEDS = 4,
CC_CHALLENGE_EASY_REPEATABLE = 5,
CC_CHALLENGE_MEDIUM_REPEATABLE = 6,
CC_CHALLENGE_HARD_REPEATABLE = 7,
CC_CHALLENGE_COUNT = 8,
};

enum CHARISMA_CHALLENGE_SUCCESS : int32_t
Expand Down

0 comments on commit 3b032bf

Please sign in to comment.