Skip to content

Commit

Permalink
refactor: cleanup (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirdEyeSqueegee authored Oct 22, 2023
1 parent 58e83c1 commit 696a6c0
Show file tree
Hide file tree
Showing 32 changed files with 1,176 additions and 1,266 deletions.
1 change: 0 additions & 1 deletion CommonLibSF/include/RE/A/ActorValueOwner.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include "RE/A/ActorValueInfo.h"
#include "RE/A/ActorValues.h"

namespace RE
Expand Down
150 changes: 71 additions & 79 deletions CommonLibSF/include/RE/A/Array.h
Original file line number Diff line number Diff line change
@@ -1,90 +1,82 @@
#pragma once

#include "RE/B/BSContainer.h"
#include "RE/B/BSFixedString.h"
#include "RE/B/BSIntrusiveRefCounted.h"
#include "RE/B/BSLock.h"
#include "RE/B/BSTArray.h"
#include "RE/B/BSTEvent.h"
#include "RE/B/BSTSmartPointer.h"
#include "RE/M/MemoryManager.h"
#include "RE/T/TypeInfo.h"
#include "RE/V/Variable.h"

namespace RE
namespace RE::BSScript
{
namespace BSScript
class TypeInfo;
class Variable;

class Array :
public BSIntrusiveRefCounted // 00
{
class TypeInfo;
class Variable;

class Array :
public BSIntrusiveRefCounted // 00
{
private:
Array* ctor(const TypeInfo* type_info, std::uint32_t initial_size = 0);
void dtor();

public:
using value_type = Variable;
using size_type = std::uint32_t;
using difference_type = std::int32_t;
using reference = value_type&;
using const_reference = const value_type&;
using pointer = value_type*;
using const_pointer = const value_type*;
using iterator = value_type*;
using const_iterator = const value_type*;
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;

Array(const TypeInfo* type_info, std::uint32_t initial_size = 0);
~Array();

[[nodiscard]] reference operator[](size_type a_pos);
[[nodiscard]] const_reference operator[](size_type a_pos) const;

[[nodiscard]] reference front();
[[nodiscard]] const_reference front() const;

[[nodiscard]] reference back();
[[nodiscard]] const_reference back() const;

[[nodiscard]] pointer data() noexcept;
[[nodiscard]] const_pointer data() const noexcept;

[[nodiscard]] iterator begin() noexcept;
[[nodiscard]] const_iterator begin() const noexcept;
[[nodiscard]] const_iterator cbegin() const noexcept;

[[nodiscard]] iterator end() noexcept;
[[nodiscard]] const_iterator end() const noexcept;
[[nodiscard]] const_iterator cend() const noexcept;

[[nodiscard]] reverse_iterator rbegin() noexcept;
[[nodiscard]] const_reverse_iterator rbegin() const noexcept;
[[nodiscard]] const_reverse_iterator crbegin() const noexcept;

[[nodiscard]] reverse_iterator rend() noexcept;
[[nodiscard]] const_reverse_iterator rend() const noexcept;
[[nodiscard]] const_reverse_iterator crend() const noexcept;

[[nodiscard]] bool empty() const noexcept;

[[nodiscard]] size_type size() const noexcept;

[[nodiscard]] size_type max_size() const noexcept;

[[nodiscard]] TypeInfo& type_info();
[[nodiscard]] const TypeInfo& type_info() const;

[[nodiscard]] TypeInfo::RawType type() const;

// members
TypeInfo elementType; // 08
BSSpinLock elementsLock; // 10
BSTArray<Variable> elements; // 18
};
static_assert(sizeof(Array) == 0x28);
}
private:
Array* ctor(const TypeInfo* type_info, std::uint32_t initial_size = 0);
void dtor();

public:
using value_type = Variable;
using size_type = std::uint32_t;
using difference_type = std::int32_t;
using reference = value_type&;
using const_reference = const value_type&;
using pointer = value_type*;
using const_pointer = const value_type*;
using iterator = value_type*;
using const_iterator = const value_type*;
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;

Array(const TypeInfo* type_info, std::uint32_t initial_size = 0);
~Array();

[[nodiscard]] reference operator[](size_type a_pos);
[[nodiscard]] const_reference operator[](size_type a_pos) const;

[[nodiscard]] reference front();
[[nodiscard]] const_reference front() const;

[[nodiscard]] reference back();
[[nodiscard]] const_reference back() const;

[[nodiscard]] pointer data() noexcept;
[[nodiscard]] const_pointer data() const noexcept;

[[nodiscard]] iterator begin() noexcept;
[[nodiscard]] const_iterator begin() const noexcept;
[[nodiscard]] const_iterator cbegin() const noexcept;

[[nodiscard]] iterator end() noexcept;
[[nodiscard]] const_iterator end() const noexcept;
[[nodiscard]] const_iterator cend() const noexcept;

[[nodiscard]] reverse_iterator rbegin() noexcept;
[[nodiscard]] const_reverse_iterator rbegin() const noexcept;
[[nodiscard]] const_reverse_iterator crbegin() const noexcept;

[[nodiscard]] reverse_iterator rend() noexcept;
[[nodiscard]] const_reverse_iterator rend() const noexcept;
[[nodiscard]] const_reverse_iterator crend() const noexcept;

[[nodiscard]] bool empty() const noexcept;

[[nodiscard]] size_type size() const noexcept;

[[nodiscard]] size_type max_size() const noexcept;

[[nodiscard]] TypeInfo& type_info();
[[nodiscard]] const TypeInfo& type_info() const;

[[nodiscard]] TypeInfo::RawType type() const;

// members
TypeInfo elementType; // 08
BSSpinLock elementsLock; // 10
BSTArray<Variable> elements; // 18
};
static_assert(sizeof(Array) == 0x28);
}
40 changes: 17 additions & 23 deletions CommonLibSF/include/RE/B/BGSMod.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,27 @@
#include "RE/B/BSTArray.h"
#include "RE/B/BaseFormComponent.h"

namespace RE
namespace RE::BGSMod::Template
{
namespace BGSMod
class Items : public BaseFormComponent
{
namespace Template
{
class Items : public BaseFormComponent
{
public:
SF_RTTI_VTABLE(BGSMod__Template__Items);
public:
SF_RTTI_VTABLE(BGSMod__Template__Items);

virtual ~Items() override;
virtual ~Items() override;

// override (BaseFormComponent)
const BSFixedString& GetFormComponentType() const override; // 01 - { return "BGSMod_Template_Component"; }
void InitializeDataComponent() override; // 02
// override (BaseFormComponent)
const BSFixedString& GetFormComponentType() const override; // 01 - { return "BGSMod_Template_Component"; }
void InitializeDataComponent() override; // 02

// add
virtual void Unk_0B(); // 0B
virtual void Unk_0C(); // 0C
virtual void Unk_0D(); // 0D
// add
virtual void Unk_0B(); // 0B
virtual void Unk_0C(); // 0C
virtual void Unk_0D(); // 0D

// members
BSTArray<void*> unk08; // 08
BSFixedString unk18; // 18
};
static_assert(sizeof(Items) == 0x20);
}
}
// members
BSTArray<void*> unk08; // 08
BSFixedString unk18; // 18
};
static_assert(sizeof(Items) == 0x20);
}
12 changes: 6 additions & 6 deletions CommonLibSF/include/RE/B/BSLock.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace RE

private:
// members
volatile std::uint32_t _lock{ 0 }; // 0
volatile std::uint32_t _lock{}; // 0
};
static_assert(sizeof(BSNonReentrantSpinLock) == 0x4);

Expand All @@ -25,8 +25,8 @@ namespace RE

private:
// members
std::uint32_t _writerThread{ 0 }; // 0
volatile std::uint32_t _lock{ 0 }; // 4
std::uint32_t _writerThread{}; // 0
volatile std::uint32_t _lock{}; // 4
};
static_assert(sizeof(BSReadWriteLock) == 0x8);

Expand All @@ -39,8 +39,8 @@ namespace RE

private:
// members
std::uint32_t _owningThread{ 0 }; // 0
volatile std::uint32_t _lock{ 0 }; // 4
std::uint32_t _owningThread{}; // 0
volatile std::uint32_t _lock{}; // 4
};
static_assert(sizeof(BSSpinLock) == 0x8);

Expand Down Expand Up @@ -101,7 +101,7 @@ namespace RE

private:
// members
mutex_type* _lock{ nullptr }; // 00
mutex_type* _lock{}; // 00
};
static_assert(sizeof(BSAutoLock<void*>) == 0x8);

Expand Down
105 changes: 51 additions & 54 deletions CommonLibSF/include/RE/B/BSReflection.h
Original file line number Diff line number Diff line change
@@ -1,59 +1,56 @@
#pragma once

namespace RE
namespace RE::BSReflection
{
namespace BSReflection
class IObject
{
class IObject
{
public:
SF_RTTI_VTABLE(BSReflection__IObject);

virtual void Unk_00(); // 00
virtual ~IObject(); // 01
};

struct TypedData;

class IType
{
public:
SF_RTTI(BSReflection__IType);

// add
virtual TypedData* GetZeroed(TypedData* a_dst, void* a_buf) = 0;
virtual TypedData* Copy(TypedData* a_dst, void* a_buf, TypedData* a_src) = 0;
virtual TypedData* Copy2(TypedData* a_dst, void* a_buf, TypedData* a_src) = 0;
virtual void Unk03() = 0;
virtual const char* GetName() = 0;
};
static_assert(sizeof(IType) == 0x08);

class BasicType : public IType
{
public:
SF_RTTI_VTABLE(BSReflection__BasicType);

// members
std::uint32_t size; // 08
std::uint16_t size2; // 0C - repeat of size field?
std::uint8_t unk0E; // 0E - 00
std::uint8_t unk0F; // 0F - FF
const char* name; // 10
std::uint8_t id; // 18
std::uint8_t isSigned; // 19
std::uint16_t unk1A; // 1A
std::uint32_t unk1C; // 1C
};
static_assert(sizeof(BasicType) == 0x20);

struct TypedData
{
public:
// members
IType* type; // 00
void* data; // 08
};
static_assert(sizeof(TypedData) == 0x10);
}
public:
SF_RTTI_VTABLE(BSReflection__IObject);

virtual void Unk_00(); // 00
virtual ~IObject(); // 01
};

struct TypedData;

class IType
{
public:
SF_RTTI(BSReflection__IType);

// add
virtual TypedData* GetZeroed(TypedData* a_dst, void* a_buf) = 0;
virtual TypedData* Copy(TypedData* a_dst, void* a_buf, TypedData* a_src) = 0;
virtual TypedData* Copy2(TypedData* a_dst, void* a_buf, TypedData* a_src) = 0;
virtual void Unk03() = 0;
virtual const char* GetName() = 0;
};
static_assert(sizeof(IType) == 0x08);

class BasicType : public IType
{
public:
SF_RTTI_VTABLE(BSReflection__BasicType);

// members
std::uint32_t size; // 08
std::uint16_t size2; // 0C - repeat of size field?
std::uint8_t unk0E; // 0E - 00
std::uint8_t unk0F; // 0F - FF
const char* name; // 10
std::uint8_t id; // 18
std::uint8_t isSigned; // 19
std::uint16_t unk1A; // 1A
std::uint32_t unk1C; // 1C
};
static_assert(sizeof(BasicType) == 0x20);

struct TypedData
{
public:
// members
IType* type; // 00
void* data; // 08
};
static_assert(sizeof(TypedData) == 0x10);
}
4 changes: 2 additions & 2 deletions CommonLibSF/include/RE/E/ExtraDataList.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ namespace RE

private:
// members
BSExtraData* _head{ nullptr }; // 00
BSExtraData* _head{}; // 00
BSExtraData** _tail{ std::addressof(_head) }; // 08
std::uint8_t* _flags{ nullptr }; // 10
std::uint8_t* _flags{}; // 10
};
static_assert(sizeof(BaseExtraList) == 0x18);

Expand Down
Loading

0 comments on commit 696a6c0

Please sign in to comment.