Skip to content

Commit

Permalink
Merge branch 'Ryan-rsm-McKenzie:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
powerof3 authored Oct 22, 2022
2 parents e3c09ee + 0e9d380 commit 676d0c5
Show file tree
Hide file tree
Showing 31 changed files with 257 additions and 223 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
[![Main CI](https://img.shields.io/github/workflow/status/Ryan-rsm-McKenzie/CommonLibSSE/Main%20CI?logo=github&logoColor=white)](https://github.com/Ryan-rsm-McKenzie/CommonLibSSE/actions/workflows/main_ci.yml)

## Build Dependencies
* [binary_io](https://github.com/Ryan-rsm-McKenzie/binary_io)
* [Boost](https://www.boost.org/)
* Stl_interfaces
* [spdlog](https://github.com/gabime/spdlog)
* [Visual Studio Community 2019 16.10.0 Preview 3.0](https://visualstudio.microsoft.com/vs/preview/)
* [fmt](https://github.com/fmtlib/fmt)
* [Visual Studio Community 2022](https://visualstudio.microsoft.com/vs/preview/) (or later)
* Desktop development with C++

## End User Dependencies
Expand All @@ -16,9 +18,12 @@

## Development
* [Address Library for SKSE Plugins](https://www.nexusmods.com/skyrimspecialedition/mods/32444)
* [clang-format 12.0.0](https://github.com/llvm/llvm-project/releases)
* [clang-format 12.0.0](https://github.com/llvm/llvm-project/releases) (or later)
* [CMake](https://cmake.org/)
* [vcpkg](https://github.com/microsoft/vcpkg)

## Notes
* CommonLib is incompatible with SKSE and is intended to replace it as a static dependency. However, you will still need the runtime component.

## Tutorial
Learn how to build your very first SKSE plugin using CommonLib by following [this video tutorial](https://www.youtube.com/watch?v=FLRhsrQ8mqw).
2 changes: 2 additions & 0 deletions cmake/sourcelist.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ set(SOURCES
include/RE/B/BGSAcousticSpace.h
include/RE/B/BGSAction.h
include/RE/B/BGSActorEvent.h
include/RE/B/BGSAddToPlayerInventoryEvent.h
include/RE/B/BGSAddonNode.h
include/RE/B/BGSAnimationSequencer.h
include/RE/B/BGSApparatus.h
Expand Down Expand Up @@ -155,6 +156,7 @@ set(SOURCES
include/RE/B/BGSSoundOutput.h
include/RE/B/BGSStandardSoundDef.h
include/RE/B/BGSStaticCollection.h
include/RE/B/BGSStoryEventManager.h
include/RE/B/BGSStoryManagerBranchNode.h
include/RE/B/BGSStoryManagerEventNode.h
include/RE/B/BGSStoryManagerNodeBase.h
Expand Down
2 changes: 1 addition & 1 deletion include/RE/A/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -598,5 +598,5 @@ namespace RE
private:
TESFaction* GetCrimeFactionImpl() const;
};
static_assert(sizeof(Actor) == 0x2B0);
static_assert(sizeof(Actor) == 0x2B8);
}
2 changes: 1 addition & 1 deletion include/RE/A/ArrowProjectile.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ namespace RE
std::uint64_t unk1E0; // 1E0
AlchemyItem* poison; // 1E8
};
static_assert(sizeof(ArrowProjectile) == 0x1F0);
static_assert(sizeof(ArrowProjectile) == 0x1F8);
}
38 changes: 38 additions & 0 deletions include/RE/B/BGSAddToPlayerInventoryEvent.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#pragma once

#include "RE/B/BSPointerHandle.h"

namespace RE
{
class BGSLocation;
class TESForm;

enum class AQUIRE_TYPE
{
kNone = 0,
kSteal = 1,
kBuy = 2,
kPickPocket = 3,
kPickup = 4,
kContainer = 5,
kDeadBody = 6
};

class BGSAddToPlayerInventoryEvent
{
public:
[[nodiscard]] static std::uint32_t& GetIndex()
{
REL::Relocation<std::uint32_t*> index{ REL::ID(380074) };
return *index;
}

// members
ObjectRefHandle ownerRef; // 0x00
ObjectRefHandle containerRef; // 0x04
BGSLocation* location{ nullptr }; // 0x08
TESForm* itemBase{ nullptr }; // 0x10
stl::enumeration<AQUIRE_TYPE, std::uint32_t> acquireType{ AQUIRE_TYPE::kNone }; // 0x18
};
static_assert(sizeof(BGSAddToPlayerInventoryEvent) == 0x20);
}
45 changes: 45 additions & 0 deletions include/RE/B/BGSStoryEventManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#pragma once

#include "RE/B/BSAtomic.h"
#include "RE/B/BSTArray.h"
#include "RE/B/BSTHashMap.h"
#include "RE/B/BSTSingleton.h"

namespace RE
{
class BGSRegisteredStoryEvent;
class BGSStoryEvent;

class BGSStoryEventManager :
public BSTSingletonImplicit<BGSStoryEventManager> // 00
{
public:
[[nodiscard]] static BGSStoryEventManager* GetSingleton()
{
using func_t = decltype(&BGSStoryEventManager::GetSingleton);
REL::Relocation<func_t> func{ REL::ID(22790) };
return func();
}

template <class T>
std::uint32_t AddEvent(const T& a_event)
{
return AddEvent_Impl(T::GetIndex(), &a_event);
}

// members
BSTArray<BGSRegisteredStoryEvent> registeredEvents; // 00
BSTHashMap<std::uint32_t, std::uint32_t> registeredEventIDs; // 18
BSTArray<BGSStoryEvent> events; // 48
mutable BSSpinLock eventArrayLock; // 60

private:
std::uint32_t AddEvent_Impl(std::uint32_t a_index, const void* a_event)
{
using func_t = decltype(&BGSStoryEventManager::AddEvent_Impl);
REL::Relocation<func_t> func{ REL::ID(32359) };
return func(this, a_index, a_event);
}
};
static_assert(sizeof(BGSStoryEventManager) == 0x68);
}
2 changes: 1 addition & 1 deletion include/RE/B/BGSStoryManagerEventNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace RE
};
static_assert(sizeof(BGSStoryEventMember) == 0x18);

struct BGSRegisteredStoryEvent // ENAM
class BGSRegisteredStoryEvent // ENAM
{
char uniqueID[4]; // 00
std::uint32_t pad04; // 04
Expand Down
2 changes: 1 addition & 1 deletion include/RE/B/BarrierProjectile.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ namespace RE
std::uint32_t pad1DC; // 1DC
BSTArray<CollisionData> collisionData; // 1E0
};
static_assert(sizeof(BarrierProjectile) == 0x1F8);
static_assert(sizeof(BarrierProjectile) == 0x200);
}
2 changes: 1 addition & 1 deletion include/RE/B/BeamProjectile.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ namespace RE
// members
std::uint64_t unk238; // 238
};
static_assert(sizeof(BeamProjectile) == 0x240);
static_assert(sizeof(BeamProjectile) == 0x248);
}
2 changes: 1 addition & 1 deletion include/RE/C/Character.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ namespace RE
virtual void Unk_128(void); // 128
virtual void Unk_129(void); // 129 - { return 1; }
};
static_assert(sizeof(Character) == 0x2B0);
static_assert(sizeof(Character) == 0x2B8);
}
2 changes: 1 addition & 1 deletion include/RE/C/ConeProjectile.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ namespace RE
hkRefPtr<hkpSphereShape> collisionShape; // 1F8
BSTArray<void*> collisions; // 200
};
static_assert(sizeof(ConeProjectile) == 0x218);
static_assert(sizeof(ConeProjectile) == 0x220);
}
53 changes: 29 additions & 24 deletions include/RE/E/ExtraDataList.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,28 @@ namespace RE
class InventoryChanges;
class TESBoundObject;

class BaseExtraList
{
public:
struct PresenceBitfield
{
public:
[[nodiscard]] bool HasType(std::uint32_t a_type) const;
void MarkType(std::uint32_t a_type, bool a_cleared);

// members
std::uint8_t bits[0x18]; // 00
};
static_assert(sizeof(PresenceBitfield) == 0x18);

virtual ~BaseExtraList(); // 00

// members
BSExtraData* data = nullptr; // 08
PresenceBitfield* presence = nullptr; // 10
};
static_assert(sizeof(BaseExtraList) == 0x18);

class ExtraDataList
{
public:
Expand Down Expand Up @@ -98,9 +120,6 @@ namespace RE
using iterator = iterator_base<BSExtraData>;
using const_iterator = iterator_base<const BSExtraData>;

ExtraDataList();
~ExtraDataList();

TES_HEAP_REDEFINE_NEW();

iterator begin();
Expand Down Expand Up @@ -156,28 +175,14 @@ namespace RE
void SetInventoryChanges(InventoryChanges* a_changes);
void SetOwner(TESForm* a_owner);

protected:
struct PresenceBitfield
{
public:
[[nodiscard]] bool HasType(std::uint32_t a_type) const;
void MarkType(std::uint32_t a_type, bool a_cleared);

// members
std::uint8_t bits[0x18]; // 00
};
static_assert(sizeof(PresenceBitfield) == 0x18);

void MarkType(std::uint32_t a_type, bool a_cleared);
void MarkType(ExtraDataType a_type, bool a_cleared);

// members
BSExtraData* _data; // 00
PresenceBitfield* _presence; // 08
mutable BSReadWriteLock _lock; // 10

private:
BSExtraData* GetByTypeImpl(ExtraDataType a_type) const;
void MarkType(std::uint32_t a_type, bool a_cleared);
void MarkType(ExtraDataType a_type, bool a_cleared);

// members
BaseExtraList _extraData; // 00
mutable BSReadWriteLock _lock; // 18
};
static_assert(sizeof(ExtraDataList) == 0x18);
static_assert(sizeof(ExtraDataList) == 0x20);
}
2 changes: 1 addition & 1 deletion include/RE/F/FlameProjectile.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ namespace RE
float expirationTimer; // 1D8
float coneAngle; // 1DC
};
static_assert(sizeof(FlameProjectile) == 0x1E0);
static_assert(sizeof(FlameProjectile) == 0x1E8);
}
42 changes: 21 additions & 21 deletions include/RE/G/GFxValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ namespace RE
kViewMatrix3D = 1 << 13
};

DisplayInfo(); // Initializes the DisplayInfo structure.
DisplayInfo() = default; // Initializes the DisplayInfo structure.
DisplayInfo(double a_x, double a_y); // Initializes the DisplayInfo structure.
DisplayInfo(double a_rotation); // Initializes the DisplayInfo structure.
DisplayInfo(bool a_visible); // Initializes the DisplayInfo structure.
Expand Down Expand Up @@ -185,26 +185,26 @@ namespace RE
void ClearFlags(Flag a_flags);

// members
double _x; // 00
double _y; // 08
double _rotation; // 10
double _xScale; // 18
double _yScale; // 20
double _alpha; // 28
bool _visible; // 30
std::uint8_t _pad31; // 31
std::uint16_t _pad32; // 32
std::uint32_t _pad34; // 34
double _z; // 38
double _xRotation; // 40
double _yRotation; // 48
double _zScale; // 50
double _fov; // 58
GMatrix3D _viewMatrix3D; // 60
GMatrix3D _perspMatrix3D; // A0
stl::enumeration<Flag, std::uint16_t> _flags; // E0
std::uint16_t _padD2; // E2
std::uint32_t _padD4; // E4
double _x = 0.0; // 00
double _y = 0.0; // 08
double _rotation = 0.0; // 10
double _xScale = 0.0; // 18
double _yScale = 0.0; // 20
double _alpha = 0.0; // 28
bool _visible = false; // 30
std::uint8_t _pad31 = 0; // 31
std::uint16_t _pad32 = 0; // 32
std::uint32_t _pad34 = 0; // 34
double _z = 0.0; // 38
double _xRotation = 0.0; // 40
double _yRotation = 0.0; // 48
double _zScale = 0.0; // 50
double _fov = 0.0; // 58
GMatrix3D _viewMatrix3D; // 60
GMatrix3D _perspMatrix3D; // A0
stl::enumeration<Flag, std::uint16_t> _flags = Flag::kNone; // E0
std::uint16_t _padD2 = 0; // E2
std::uint32_t _padD4 = 0; // E4
};
static_assert(sizeof(DisplayInfo) == 0xE8);

Expand Down
2 changes: 1 addition & 1 deletion include/RE/G/GrenadeProjectile.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ namespace RE
std::uint16_t pad1E2; // 1E2
std::uint32_t pad1E4; // 1E4
};
static_assert(sizeof(GrenadeProjectile) == 0x1E8);
static_assert(sizeof(GrenadeProjectile) == 0x1F0);
}
2 changes: 1 addition & 1 deletion include/RE/H/Hazard.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ namespace RE
BSSoundHandle sound; // C8
stl::enumeration<Flags, std::uint32_t> flags; // D4
};
static_assert(sizeof(Hazard) == 0xD8);
static_assert(sizeof(Hazard) == 0xE0);
}
2 changes: 1 addition & 1 deletion include/RE/I/Inventory3DManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ namespace RE
std::uint8_t pad15B; // 15B
std::uint32_t pad15C; // 15C
};
static_assert(sizeof(Inventory3DManager) == 0x160);
static_assert(sizeof(Inventory3DManager) == 0x168);
}
2 changes: 1 addition & 1 deletion include/RE/M/MissileProjectile.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ namespace RE
std::uint8_t unk1DD; // 1DD
std::uint16_t unk1DE; // 1DE
};
static_assert(sizeof(MissileProjectile) == 0x1E0);
static_assert(sizeof(MissileProjectile) == 0x1E8);
}
6 changes: 5 additions & 1 deletion include/RE/P/PlayerCharacter.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

namespace RE
{
enum class AQUIRE_TYPE;

class Actor;
class BGSInstancedQuestObjective;
class BGSLocation;
Expand All @@ -34,6 +36,7 @@ namespace RE
class NiAVObject;
class NiNode;
class ObjectListItem;
class TESObject;
class TESObjectREFR;
class TintMask;
class UserEventEnabledEvent;
Expand Down Expand Up @@ -273,6 +276,7 @@ namespace RE
static PlayerCharacter* GetSingleton();

void ActivatePickRef();
void AddPlayerAddItemEvent(TESObject* a_object, TESForm* a_owner, TESObjectREFR* a_container, AQUIRE_TYPE a_type);
void AddSkillExperience(ActorValue a_skill, float a_experience);
bool AttemptPickpocket(TESObjectREFR* a_containerRef, InventoryEntryData* a_entry, std::int32_t a_number, bool a_fromContainer = true);
bool CenterOnCell(const char* a_cellName);
Expand Down Expand Up @@ -462,5 +466,5 @@ namespace RE
private:
bool CenterOnCell_Impl(const char* a_cellName, RE::TESObjectCELL* a_cell);
};
static_assert(sizeof(PlayerCharacter) == 0xBE0);
static_assert(sizeof(PlayerCharacter) == 0xBE8);
}
2 changes: 1 addition & 1 deletion include/RE/P/Projectile.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,5 @@ namespace RE
std::uint32_t flags; // 1CC
std::uint64_t unk1D0; // 1D0
};
static_assert(sizeof(Projectile) == 0x1D8);
static_assert(sizeof(Projectile) == 0x1E0);
}
Loading

0 comments on commit 676d0c5

Please sign in to comment.