From 14adf08cacb08edc019fb19ed5b68d1a17fd9038 Mon Sep 17 00:00:00 2001 From: Forever Gone <78507032+Faint0002@users.noreply.github.com> Date: Sat, 10 Jun 2023 05:39:23 -0400 Subject: [PATCH] Added scrValue (#116) --- rage/scrValue.hpp | 19 +++++++++++++++++++ script/scrProgram.hpp | 11 ++++++----- script/scrThread.hpp | 5 +++-- 3 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 rage/scrValue.hpp diff --git a/rage/scrValue.hpp b/rage/scrValue.hpp new file mode 100644 index 0000000..291f666 --- /dev/null +++ b/rage/scrValue.hpp @@ -0,0 +1,19 @@ +#pragma once +#include +using LPCSTR = const char*; //For Linux support, but I didn't want to make the class inaccurate + +namespace rage +{ + union scrValue + { + int Int; + unsigned int Uns; + float Float; + LPCSTR String; + scrValue* Reference; + uint64_t Any; + bool operator==(const scrValue& val) { + return Int == val.Int; + } + }; +} diff --git a/script/scrProgram.hpp b/script/scrProgram.hpp index 770a9c0..23e929c 100644 --- a/script/scrProgram.hpp +++ b/script/scrProgram.hpp @@ -2,6 +2,7 @@ #include #include "../base/pgBase.hpp" +#include "../rage/scrValue.hpp" #pragma pack(push, 1) namespace rage @@ -16,9 +17,9 @@ namespace rage std::uint32_t m_local_count; // 0x24 std::uint32_t m_global_count; // 0x28 std::uint32_t m_native_count; // 0x2C - void *m_local_data; // 0x30 - std::int64_t **m_global_data; // 0x38 - void **m_native_entrypoints; // 0x40 + scrValue *m_local_data; // 0x30 + scrValue **m_global_data; // 0x38 + scrNativeHandler *m_native_entrypoints; // 0x40 std::uint32_t m_proc_count; // 0x48 char pad_004C[4]; // 0x4C const char** m_proc_names; // 0x50 @@ -84,7 +85,7 @@ namespace rage return nullptr; } - void** get_address_of_native_entrypoint(void* entrypoint) + scrNativeHandler* get_address_of_native_entrypoint(scrNativeHandler entrypoint) { for (std::uint32_t i = 0; i < m_native_count; ++i) { @@ -99,4 +100,4 @@ namespace rage }; static_assert(sizeof(scrProgram) == 0x80); } -#pragma pack(pop) \ No newline at end of file +#pragma pack(pop) diff --git a/script/scrThread.hpp b/script/scrThread.hpp index bb4fcd9..184c8cc 100644 --- a/script/scrThread.hpp +++ b/script/scrThread.hpp @@ -2,6 +2,7 @@ #include "scriptHandler.hpp" #include "scriptHandlerNetComponent.hpp" #include "scrThreadContext.hpp" +#include "../rage/scrValue.hpp" namespace rage { @@ -16,7 +17,7 @@ namespace rage public: scrThreadContext m_context; // 0x08 - void* m_stack; // 0xB0 + scrValue* m_stack; // 0xB0 char m_padding[0x4]; // 0xB8 uint32_t m_arg_size; // 0xBC uint32_t m_arg_loc; // 0xC0 @@ -28,4 +29,4 @@ namespace rage scriptHandlerNetComponent* m_net_component; // 0x11C }; -} \ No newline at end of file +}