Add rlMetric (#3)

* feat(metric): add rlMetric

* fix(metric): serializer fix

* feat(tls): add tlsContext

---------

Co-authored-by: maybegreat48 <email@hostname>
This commit is contained in:
maybegreat48 2023-09-23 21:47:58 +00:00 committed by GitHub
parent 6bf009fae7
commit 8d335c795b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 88 additions and 0 deletions

View File

@ -9,6 +9,9 @@
#include "player/CPlayerInfo.hpp" #include "player/CPlayerInfo.hpp"
#include "rage/atArray.hpp" #include "rage/atArray.hpp"
#include "rage/joaat.hpp" #include "rage/joaat.hpp"
#include "rage/rlJson.hpp"
#include "rage/rlMetric.hpp"
#include "rage/tlsContext.hpp"
#include "rage/vector.hpp" #include "rage/vector.hpp"
#include "script/scriptHandlerNetComponent.hpp" #include "script/scriptHandlerNetComponent.hpp"
#include "script/scrNativeHandler.hpp" #include "script/scrNativeHandler.hpp"

38
rage/rlJson.hpp Normal file
View File

@ -0,0 +1,38 @@
#pragma once
#include <cstdint>
#pragma pack(push, 4)
namespace rage
{
class rlJson
{
uint32_t unk0; // 0x00
uint32_t unk1; // 0x04
char* buffer; // 0x08
uint32_t curlen;// 0x10
uint32_t maxlen;// 0x14
uint32_t unk4; // 0x18
uint32_t flags; // 0x1C
uint8_t flags2; // 0x20
public:
rlJson(char* _buffer, uint32_t _length) :
buffer(_buffer),
maxlen(_length)
{
unk0 = 0;
unk1 = 0;
curlen = 0;
unk4 = 1;
flags = 0;
flags2 = 0;
}
inline char* GetBuffer() const
{
return buffer;
}
};
static_assert(sizeof(rage::rlJson) == 0x24);
}
#pragma pack(pop)

21
rage/rlMetric.hpp Normal file
View File

@ -0,0 +1,21 @@
#pragma once
#include "joaat.hpp"
namespace rage
{
class rlJson;
class rlMetric
{
public:
virtual ~rlMetric() = default; // 0x00
virtual int GetType() = 0; // 0x08
virtual int GetType2() = 0; // 0x10
virtual const char* GetName() = 0; // 0x18
virtual bool Serialize(rage::rlJson* serializer) = 0; // 0x20
virtual int GetSize() = 0; // 0x28
virtual joaat_t GetNameHash() = 0; // 0x30
virtual bool _0x38() = 0;
virtual bool _0x40() = 0;
};
static_assert(sizeof(rage::rlMetric) == 0x8);
}

26
rage/tlsContext.hpp Normal file
View File

@ -0,0 +1,26 @@
#pragma once
#if _WIN32
#include <intrin.h>
#endif
namespace rage
{
#pragma pack(push, 8)
class tlsContext
{
char pad[0x1700];
public:
bool m_RunningScript; // 0x1700
#if _WIN32
static tlsContext* Get()
{
constexpr std::uint32_t TlsIndex = 0x0;
return *reinterpret_cast<tlsContext**>(__readgsqword(0x58) + TlsIndex);
}
#endif
};
#pragma pack(pop)
static_assert(sizeof(rage::tlsContext) == 0x1701);
}