From e8d8bdd2b3152253f6e1fde48720e4caeab19f83 Mon Sep 17 00:00:00 2001 From: maybegreat48 <96936658+maybegreat48@users.noreply.github.com> Date: Wed, 20 Dec 2023 14:49:40 +0000 Subject: [PATCH] Assorted fixes (#157) * feat(GtaThread): add force cleanup fields * fix(scrThreadContext): there is no TIMER_C * feat(GtaThread): add the flag * fix(scrProgram): add scrNativeHandler include * fix(scrNativeHandler): make data fields public --------- Co-authored-by: maybegreat48 --- script/GtaThread.hpp | 30 ++++++++++++++++++------------ script/scrNativeHandler.hpp | 2 +- script/scrProgram.hpp | 1 + script/scrThread.hpp | 9 ++++----- script/scrThreadContext.hpp | 2 +- 5 files changed, 25 insertions(+), 19 deletions(-) diff --git a/script/GtaThread.hpp b/script/GtaThread.hpp index 9d0b5db..da2a9e6 100644 --- a/script/GtaThread.hpp +++ b/script/GtaThread.hpp @@ -4,17 +4,23 @@ class GtaThread : public rage::scrThread { public: - rage::joaat_t m_script_hash; // 0x120 - char m_padding3[0x14]; // 0x124 - std::int32_t m_instance_id; // 0x138 - char m_padding4[0x04]; // 0x13C - std::uint8_t m_flag1; // 0x140 - bool m_safe_for_network_game; // 0x141 - char m_padding5[0x02]; // 0x142 - bool m_is_minigame_script; // 0x144 - char m_padding6[0x02]; // 0x145 - bool m_can_be_paused; // 0x147 - bool m_can_remove_blips_from_other_scripts; // 0x148 - char m_padding7[0x0F]; // 0x149 + rage::joaat_t m_script_hash; // 0x128 + int m_force_cleanup_ip; // 0x12C + int m_force_cleanup_fp; // 0x130 + int m_force_cleanup_sp; // 0x134 + int m_force_cleanup_filter; // 0x138 + int m_force_cleanup_cause; // 0x13C + std::int32_t m_instance_id; // 0x140 + char m_padding4[0x04]; // 0x144 + std::uint8_t m_flag1; // 0x148 + bool m_safe_for_network_game; // 0x149 + char m_padding5[0x02]; // 0x14A + bool m_is_minigame_script; // 0x14C + char m_padding6[0x02]; // 0x14D + bool m_can_be_paused; // 0x14F + bool m_can_remove_blips_from_other_scripts; // 0x150 + char m_padding7[0x2]; // 0x151 + std::uint8_t m_force_cleanup_state; // 0x153 + char m_padding8[0xC]; // 0x154 }; static_assert(sizeof(GtaThread) == 0x160); \ No newline at end of file diff --git a/script/scrNativeHandler.hpp b/script/scrNativeHandler.hpp index f3ba6a7..cfda788 100644 --- a/script/scrNativeHandler.hpp +++ b/script/scrNativeHandler.hpp @@ -46,7 +46,7 @@ namespace rage { *reinterpret_cast>*>(m_return_value) = std::forward(value); } - protected: + void* m_return_value; std::uint32_t m_arg_count; void* m_args; diff --git a/script/scrProgram.hpp b/script/scrProgram.hpp index 23e929c..592ec21 100644 --- a/script/scrProgram.hpp +++ b/script/scrProgram.hpp @@ -3,6 +3,7 @@ #include "../base/pgBase.hpp" #include "../rage/scrValue.hpp" +#include "scrNativeHandler.hpp" #pragma pack(push, 1) namespace rage diff --git a/script/scrThread.hpp b/script/scrThread.hpp index 184c8cc..9074191 100644 --- a/script/scrThread.hpp +++ b/script/scrThread.hpp @@ -17,16 +17,15 @@ namespace rage public: scrThreadContext m_context; // 0x08 - scrValue* m_stack; // 0xB0 + scrValue* m_stack; // 0xB0 char m_padding[0x4]; // 0xB8 uint32_t m_arg_size; // 0xBC uint32_t m_arg_loc; // 0xC0 char m_padding2[0x4]; // 0xC4 const char* m_exit_message; // 0xC8 - char m_pad[0x4]; + char m_pad[0x4]; // 0xD0 char m_name[0x40]; // 0xD4 - scriptHandler* m_handler; // 0x114 - scriptHandlerNetComponent* m_net_component; // 0x11C - + scriptHandler* m_handler; // 0x118 + scriptHandlerNetComponent* m_net_component; // 0x120 }; } diff --git a/script/scrThreadContext.hpp b/script/scrThreadContext.hpp index fdfcf0e..e47aed5 100644 --- a/script/scrThreadContext.hpp +++ b/script/scrThreadContext.hpp @@ -25,7 +25,7 @@ namespace rage std::uint32_t m_stack_pointer; // 0x14 float m_timer_a; // 0x18 float m_timer_b; // 0x1C - float m_timer_c; // 0x20 + float m_wait_timer; // 0x20 char m_padding1[0x2C]; // 0x24 std::uint32_t m_stack_size; // 0x50 char m_padding2[0x54]; // 0x54