Fixed Inconsisent Casing In Some Classes (#27)

This commit is contained in:
tyackman 2024-07-15 20:59:37 -05:00 committed by GitHub
parent 9ef64d8529
commit 7c78535a48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 81 additions and 80 deletions

View File

@ -6,8 +6,8 @@ namespace rage
class fwExtensibleBase : public fwRefAwareBase class fwExtensibleBase : public fwRefAwareBase
{ {
public: public:
void* m_extension_container; // 0x0010 void* m_ExtensionContainer; // 0x0010
void* m_extensible_unk; // 0x0018 void* m_ExtensibleUnk; // 0x0018
}; //Size: 0x0020 }; //Size: 0x0020
static_assert(sizeof(fwExtensibleBase) == 0x20); static_assert(sizeof(fwExtensibleBase) == 0x20);
} }

View File

@ -6,6 +6,6 @@ namespace rage
class fwRefAwareBaseImpl : public T class fwRefAwareBaseImpl : public T
{ {
private: private:
void *m_ref; // 0x08 void *m_Ref; // 0x08
}; };
} }

View File

@ -76,7 +76,7 @@ public:
} }
private: private:
uint32_t m_map_size; uint32_t m_MapSize;
}; };
class pgBaseRefCounted : public pgBase { class pgBaseRefCounted : public pgBase {
@ -86,44 +86,44 @@ public:
class pgBaseMetaDataType { class pgBaseMetaDataType {
public: public:
static pgBaseMetaDataType* m_first; static pgBaseMetaDataType* m_First;
pgBaseMetaDataType(uint32_t id, uintptr_t value) pgBaseMetaDataType(uint32_t id, uintptr_t value)
: m_id(id), m_value(value), m_next(nullptr) { : m_Id(id), m_Value(value), m_Next(nullptr) {
if (!m_first) { if (!m_First) {
m_first = this; m_First = this;
} }
} }
~pgBaseMetaDataType() { ~pgBaseMetaDataType() {
if (m_first == this) { if (m_First == this) {
m_first = m_next; m_First = m_Next;
} else { } else {
pgBaseMetaDataType* current = m_first; pgBaseMetaDataType* current = m_First;
while (current && current->m_next != this) { while (current && current->m_Next != this) {
current = current->m_next; current = current->m_Next;
} }
if (current) { if (current) {
current->m_next = m_next; current->m_Next = m_Next;
} }
} }
} }
static pgBaseMetaDataType* Lookup(uint32_t id) { static pgBaseMetaDataType* Lookup(uint32_t id) {
pgBaseMetaDataType* current = m_first; pgBaseMetaDataType* current = m_First;
while (current != nullptr) { while (current != nullptr) {
if (current->m_id == id) { if (current->m_Id == id) {
return current; return current;
} }
current = current->m_next; current = current->m_Next;
} }
return nullptr; return nullptr;
} }
private: private:
uint32_t m_id; uint32_t m_Id;
uintptr_t m_value; uintptr_t m_Value;
pgBaseMetaDataType* m_next; pgBaseMetaDataType* m_Next;
}; };
} }

View File

@ -12,6 +12,6 @@ public:
virtual bool IsEventScriptCommand() { return false; } virtual bool IsEventScriptCommand() { return false; }
virtual bool ExtractData(void* data, int size) { return false; } virtual bool ExtractData(void* data, int size) { return false; }
char m_pad[0x58]; char m_Pad[0x58];
}; };
static_assert(sizeof(CEvent) == 0x60); static_assert(sizeof(CEvent) == 0x60);

View File

@ -4,19 +4,20 @@
class CGadgetData class CGadgetData
{ {
public: public:
uint32_t m_type; uint32_t m_Type;
uint8_t m_data[0xF3]; uint8_t m_Data[0xF3];
}; };
static_assert(sizeof(CGadgetData) == 0xF8); static_assert(sizeof(CGadgetData) == 0xF8);
class alignas(16) CVehicleGadgetNodeData // TODO: Fix this
class CVehicleGadgetDataNode
{ {
public: public:
bool m_has_position; bool m_HasPosition;
char pad_0001[15]; char pad_0001[15];
float m_position[4]; float m_Position[4];
uint32_t m_num_gadgets; uint32_t m_NumGadgets;
char pad_0002[12]; char pad_0002[12];
CGadgetData m_gadgets[2]; CGadgetData m_Gadgets[2];
}; };
static_assert(sizeof(CVehicleGadgetNodeData) == 0x220); static_assert(sizeof(CVehicleGadgetDataNode) == 0x220);

View File

@ -12,41 +12,41 @@ namespace rage
{ {
public: public:
atArray() : atArray() :
m_data(nullptr), m_Data(nullptr),
m_size(0), m_Size(0),
m_count(0) m_Count(0)
{ {
} }
T* begin() const T* begin() const
{ {
return &m_data[0]; return &m_Data[0];
} }
T* end() const T* end() const
{ {
return &m_data[m_size]; return &m_Data[m_Size];
} }
T* data() const T* data() const
{ {
return m_data; return m_Data;
} }
std::uint16_t size() const std::uint16_t size() const
{ {
return m_size; return m_Size;
} }
std::uint16_t count() const std::uint16_t count() const
{ {
return m_count; return m_Count;
} }
T& operator[](std::uint16_t index) const T& operator[](std::uint16_t index) const
{ {
return m_data[index]; return m_Data[index];
} }
bool contains(T comparator) bool contains(T comparator)
@ -62,9 +62,9 @@ namespace rage
} }
private: private:
T* m_data; T* m_Data;
std::uint16_t m_size; std::uint16_t m_Size;
std::uint16_t m_count; std::uint16_t m_Count;
}; };
static_assert(sizeof(rage::atArray<std::uint32_t>) == 0x10, "rage::atArray is not properly sized"); static_assert(sizeof(rage::atArray<std::uint32_t>) == 0x10, "rage::atArray is not properly sized");
#pragma pack(pop) #pragma pack(pop)

View File

@ -6,17 +6,17 @@
namespace rage namespace rage
{ {
using joaat_t = std::uint32_t; using joaat_t = std::uint32_t;
inline constexpr char joaat_to_lower(char c) inline constexpr char JoaatToLower(char c)
{ {
return c >= 'A' && c <= 'Z' ? c | 1 << 5 : c; return c >= 'A' && c <= 'Z' ? c | 1 << 5 : c;
} }
inline constexpr joaat_t joaat(const std::string_view str) inline constexpr joaat_t Joaat(const std::string_view str)
{ {
joaat_t hash = 0; joaat_t hash = 0;
for (auto c : str) for (auto c : str)
{ {
hash += joaat_to_lower(c); hash += JoaatToLower(c);
hash += (hash << 10); hash += (hash << 10);
hash ^= (hash >> 6); hash ^= (hash >> 6);
} }

View File

@ -8,29 +8,29 @@ namespace rage
{ {
uint32_t unk0; // 0x00 uint32_t unk0; // 0x00
uint32_t unk1; // 0x04 uint32_t unk1; // 0x04
char* buffer; // 0x08 char* m_Buffer; // 0x08
uint32_t curlen;// 0x10 uint32_t m_Curlen;// 0x10
uint32_t maxlen;// 0x14 uint32_t m_Maxlen;// 0x14
uint32_t unk4; // 0x18 uint32_t unk4; // 0x18
uint32_t flags; // 0x1C uint32_t m_Flags; // 0x1C
uint8_t flags2; // 0x20 uint8_t m_Flags2; // 0x20
public: public:
rlJson(char* _buffer, uint32_t _length) : rlJson(char* _buffer, uint32_t _length) :
buffer(_buffer), m_Buffer(_buffer),
maxlen(_length) m_Maxlen(_length)
{ {
unk0 = 0; unk0 = 0;
unk1 = 0; unk1 = 0;
curlen = 0; m_Curlen = 0;
unk4 = 1; unk4 = 1;
flags = 0; m_Flags = 0;
flags2 = 0; m_Flags2 = 0;
} }
inline char* GetBuffer() const inline char* GetBuffer() const
{ {
return buffer; return m_Buffer;
} }
}; };
static_assert(sizeof(rage::rlJson) == 0x24); static_assert(sizeof(rage::rlJson) == 0x24);

View File

@ -10,48 +10,48 @@ namespace rage
public: public:
constexpr void reset() constexpr void reset()
{ {
m_arg_count = 0; m_ArgCount = 0;
m_data_count = 0; m_DataCount = 0;
} }
template <typename T> template <typename T>
constexpr void push_arg(T&& value) constexpr void PushArg(T&& value)
{ {
static_assert(sizeof(T) <= sizeof(std::uint64_t)); static_assert(sizeof(T) <= sizeof(std::uint64_t));
*reinterpret_cast<std::remove_cv_t<std::remove_reference_t<T>>*>(reinterpret_cast<std::uint64_t*>(m_args) + (m_arg_count++)) = std::forward<T>(value); *reinterpret_cast<std::remove_cv_t<std::remove_reference_t<T>>*>(reinterpret_cast<std::uint64_t*>(m_Args) + (m_ArgCount++)) = std::forward<T>(value);
} }
template <typename T> template <typename T>
constexpr T& get_arg(std::size_t index) constexpr T& GetArg(std::size_t index)
{ {
static_assert(sizeof(T) <= sizeof(std::uint64_t)); static_assert(sizeof(T) <= sizeof(std::uint64_t));
return *reinterpret_cast<T*>(reinterpret_cast<std::uint64_t*>(m_args) + index); return *reinterpret_cast<T*>(reinterpret_cast<std::uint64_t*>(m_Args) + index);
} }
template <typename T> template <typename T>
constexpr void set_arg(std::size_t index, T&& value) constexpr void SetArg(std::size_t index, T&& value)
{ {
static_assert(sizeof(T) <= sizeof(std::uint64_t)); static_assert(sizeof(T) <= sizeof(std::uint64_t));
*reinterpret_cast<std::remove_cv_t<std::remove_reference_t<T>>*>(reinterpret_cast<std::uint64_t*>(m_args) + index) = std::forward<T>(value); *reinterpret_cast<std::remove_cv_t<std::remove_reference_t<T>>*>(reinterpret_cast<std::uint64_t*>(m_Args) + index) = std::forward<T>(value);
} }
template <typename T> template <typename T>
constexpr T* get_return_value() constexpr T* GetReturnValue()
{ {
return reinterpret_cast<T*>(m_return_value); return reinterpret_cast<T*>(m_ReturnValue);
} }
template <typename T> template <typename T>
constexpr void set_return_value(T&& value) constexpr void SetReturnValue(T&& value)
{ {
*reinterpret_cast<std::remove_cv_t<std::remove_reference_t<T>>*>(m_return_value) = std::forward<T>(value); *reinterpret_cast<std::remove_cv_t<std::remove_reference_t<T>>*>(m_ReturnValue) = std::forward<T>(value);
} }
protected: protected:
void* m_return_value; void* m_ReturnValue;
std::uint32_t m_arg_count; std::uint32_t m_ArgCount;
void* m_args; void* m_Args;
std::int32_t m_data_count; std::int32_t m_DataCount;
std::uint32_t m_data[48]; std::uint32_t m_Data[48];
}; };
static_assert(sizeof(scrNativeCallContext) == 0xE0); static_assert(sizeof(scrNativeCallContext) == 0xE0);

View File

@ -30,7 +30,7 @@ public:
char m_Breakpoints[0x0C]; // 0x74 This is an atMap, which we don't have the char m_Breakpoints[0x0C]; // 0x74 This is an atMap, which we don't have the
// class for ATM. // class for ATM.
bool is_valid() const { return m_CodeSize != 0; } bool IsValid() const { return m_CodeSize != 0; }
std::uint32_t GetNumCodePages() const { return (m_CodeSize + 0x3FFF) >> 14; } std::uint32_t GetNumCodePages() const { return (m_CodeSize + 0x3FFF) >> 14; }

View File

@ -67,7 +67,7 @@ namespace rage
return this->x != other.x || this->y != other.y || this->z != other.z; return this->x != other.x || this->y != other.y || this->z != other.z;
} }
std::string to_string() const std::string ToString() const
{ {
std::stringstream ss; std::stringstream ss;
ss << *this; ss << *this;

View File

@ -5,11 +5,11 @@ class CNetGamePlayer;
class CScriptParticipant class CScriptParticipant
{ {
public: public:
char pad_0000[16]; // 0x0000 char m_Pad[16]; // 0x0000
class CNetGamePlayer *m_net_game_player; // 0x0010 class CNetGamePlayer *m_NetGamePlayer; // 0x0010
char pad_0018[2]; // 0x0018 char m_Pad2[2]; // 0x0018
int16_t m_participant_index; // 0x001A int16_t m_ParticipantIndex; // 0x001A
char pad_001C[12]; // 0x001C char m_Pad3[12]; // 0x001C
}; };
static_assert(sizeof(CScriptParticipant) == 0x28); static_assert(sizeof(CScriptParticipant) == 0x28);
@ -77,7 +77,7 @@ public:
if (!m_Host) if (!m_Host)
return nullptr; return nullptr;
return m_Host->m_net_game_player; return m_Host->m_NetGamePlayer;
} }
}; };
static_assert(sizeof(rage::scriptHandlerNetComponent) == 0x170); static_assert(sizeof(rage::scriptHandlerNetComponent) == 0x170);