Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

events and pr madness #14

Merged
merged 18 commits into from
Jul 23, 2024
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
1 change: 1 addition & 0 deletions CommonLibF4/cmake/sourcelist.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ set(SOURCES
include/RE/Bethesda/NavMesh.h
include/RE/Bethesda/NavMeshInfoMap.h
include/RE/Bethesda/PipboyDataGroup.h
include/RE/Bethesda/PipboyInventoryData.h
include/RE/Bethesda/PipboyInventoryUtils.h
include/RE/Bethesda/PipboyManager.h
include/RE/Bethesda/PipboyValue.h
Expand Down
7 changes: 7 additions & 0 deletions CommonLibF4/include/RE/Bethesda/BGSInventoryItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ namespace RE
return func(this, a_stackID, a_scale);
}

ExtraDataList GetExtraDataAt(std::uint32_t a_index)
{
using func_t = decltype(&BGSInventoryItem::GetExtraDataAt);
static REL::Relocation<func_t> func{ REL::ID(2194092) };
return func(this, a_index);
}

// members
TESBoundObject* object; // 00
BSTSmartPointer<Stack> stackData; // 08
Expand Down
27 changes: 26 additions & 1 deletion CommonLibF4/include/RE/Bethesda/BSExtraData.h
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,23 @@ namespace RE
!std::is_reference_v<T>;
}

namespace ComparisonQualifiers
{
static bool ContainerQualifier(const BSExtraData* a_extraData)
{
using func_t = decltype(ComparisonQualifiers::ContainerQualifier);
REL::Relocation<func_t> func{ REL::ID(2190674) };
return func(a_extraData);
}

static bool UIQualifier(const BSExtraData* a_extraData)
{
using func_t = decltype(ComparisonQualifiers::UIQualifier);
REL::Relocation<func_t> func{ REL::ID(2190675) };
return func(a_extraData);
}
};

class ExtraDataList :
public BSIntrusiveRefCounted // 00
{
Expand Down Expand Up @@ -983,9 +1000,17 @@ namespace RE
return func(this);
}

typedef bool (*ComparisonQualifier)(const BSExtraData*);
bool CompareList(const ExtraDataList* a_compare, ComparisonQualifier a_qualifier)
{
using func_t = decltype(&ExtraDataList::CompareList);
REL::Relocation<func_t> func{ REL::ID(2190098) };
return func(this, a_compare, a_qualifier);
}

// members
BaseExtraList extraData; // 08
mutable BSReadWriteLock extraRWLock; // 20
mutable BSReadWriteLock extraRWLock; // 20
};
static_assert(sizeof(ExtraDataList) == 0x28);
}
65 changes: 63 additions & 2 deletions CommonLibF4/include/RE/Bethesda/Events.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,74 @@ namespace RE
{
// members
REX::EnumSet<Type, std::uint16_t> changeType; // 00
const BGSObjectInstance* itemAffected; // 08
Actor* actorAffected; // 10
const BGSObjectInstance* itemAffected; // 08
Actor* actorAffected; // 10
std::uint32_t stackID; // 18
};
static_assert(sizeof(Event) == 0x20);
}

namespace PerkValueEvents
{
enum class Type
{
Add = 0,
Remove
};

struct PerkValueChangedEvent
{
Type changeType; // 00
BSPointerHandle<Actor, BSUntypedPointerHandle<21, 5>> owner; // 04
BGSPerk* perk; // 08
std::uint8_t rank; // 10
};
static_assert(sizeof(PerkValueChangedEvent) == 0x18);

struct PerkEntryUpdatedEvent
{
BSPointerHandle<Actor, BSUntypedPointerHandle<21, 5>> owner; // 00
BGSPerkEntry* perkEntry; // 08
};
static_assert(sizeof(PerkEntryUpdatedEvent) == 0x10);
}

namespace HolotapeStateChanged
{
// intentional
struct Event
{};
}

namespace BGSInventoryItemEvent
{
struct Event
{
BSPointerHandle<TESObjectREFR, BSUntypedPointerHandle<21, 5>> owner; // 00
InventoryInterface::Handle* item; // 04
};
}

namespace FavoriteMgr_Events
{
struct ComponentFavoriteEvent
{
BGSComponent* component; // 00
bool isFavorited;
};
static_assert(sizeof(ComponentFavoriteEvent) == 0x10);
}

namespace PlayerDifficultySettingChanged
{
struct Event
{
std::uint32_t oldDifficulty;
std::uint32_t newDifficulty;
};
static_assert(sizeof(Event) == 0x8);
}

struct BGSActorEvent
{
public:
Expand Down
65 changes: 65 additions & 0 deletions CommonLibF4/include/RE/Bethesda/PipboyInventoryData.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#pragma once

#include "RE/Bethesda/BGSInventoryInterface.h"
#include "RE/Bethesda/BSTArray.h"
#include "RE/Bethesda/BSTHashMap.h"
#include "RE/Bethesda/BSTList.h"
#include "RE/Bethesda/PipboyDataGroup.h"

namespace RE
{
class PipboyDataGroup;

class PipboyInventoryData :
public PipboyDataGroup, // 00
public BSTEventSink<BGSInventoryListEvent::Event>, // 98
public BSTEventSink<ActorEquipManagerEvent::Event>, // A0
public BSTEventSink<ActorValueEvents::ActorValueChangedEvent>, // A8
public BSTEventSink<PerkValueEvents::PerkEntryUpdatedEvent>, // B0
public BSTEventSink<PerkValueEvents::PerkValueChangedEvent>, // B8
public BSTEventSink<InventoryInterface::FavoriteChangedEvent>, // C0
public BSTEventSink<HolotapeStateChanged::Event>, // C8
public BSTEventSink<BGSInventoryItemEvent::Event>, // D0
public BSTEventSink<FavoriteMgr_Events::ComponentFavoriteEvent>, // D8
public BSTEventSink<PlayerDifficultySettingChanged::Event> // E0
{
public:
enum ENTRY_TYPE
{
ENTRY_INT = 0,
ENTRY_FIXED_STRING,
ENTRY_FLOAT
};

enum SORT_ON_FIELD
{
SOF_ALPHABETICALLY = 0,
SOF_DAMAGE,
SOF_ROF,
SOF_RANGE,
SOF_ACCURARY,
SOF_VALUE,
SOF_WEIGHT
};

struct StackEntry
{
PipboyObject* linkedObject; // 00
const InventoryInterface::Handle inventoryHandle; // 08
};
static_assert(sizeof(StackEntry) == 0x10);

struct ItemEntry
{
void* stackEntries; // 00 - BSTList<PipboyInventoryData::StackEntry*>
};
static_assert(sizeof(ItemEntry) == 0x8);

// members
PipboyObject* inventoryObject; // E8
BSTHashMap<std::uint32_t, PipboyInventoryData::ItemEntry> itemEntries; // F0
BSTHashMap<const BGSComponent*, PipboyObject*> invComponents; // 120
BSTArray<PipboyObject*> sortedItems; // 150
BSTSet<ENUM_FORM_ID> queuedRepopulateCategories; // 168
};
}
1 change: 1 addition & 0 deletions CommonLibF4/include/RE/Fallout.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
#include "RE/Bethesda/NavMesh.h"
#include "RE/Bethesda/NavMeshInfoMap.h"
#include "RE/Bethesda/PipboyDataGroup.h"
#include "RE/Bethesda/PipboyInventoryData.h"
#include "RE/Bethesda/PipboyInventoryUtils.h"
#include "RE/Bethesda/PipboyManager.h"
#include "RE/Bethesda/PipboyValue.h"
Expand Down