From 8ddba7de27453132f895a43d0048f3d72fad703f Mon Sep 17 00:00:00 2001 From: Quentin <837334+xiaoxiao921@users.noreply.github.com> Date: Fri, 24 May 2024 23:10:18 +0200 Subject: [PATCH] Revert "Direct implementation of fix vectors (#3147)" (#3179) This reverts commit 84d76f203821338ceed9ba690509eac33508f99a. --- src/function_types.hpp | 1 + src/gta_pointers.hpp | 1 + src/invoker/invoker.cpp | 8 +------- src/pointers.cpp | 9 +++++++++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/function_types.hpp b/src/function_types.hpp index 52d1cd26..83544033 100644 --- a/src/function_types.hpp +++ b/src/function_types.hpp @@ -61,6 +61,7 @@ namespace big::functions { using run_script_threads = bool (*)(uint32_t ops_to_execute); using get_native_handler = rage::scrNativeHandler (*)(rage::scrNativeRegistrationTable* registration_table, rage::scrNativeHash hash); + using fix_vectors = void (*)(rage::scrNativeCallContext* call_ctx); using get_net_game_player = CNetGamePlayer* (*)(Player player); diff --git a/src/gta_pointers.hpp b/src/gta_pointers.hpp index 7ee34585..88219f93 100644 --- a/src/gta_pointers.hpp +++ b/src/gta_pointers.hpp @@ -87,6 +87,7 @@ namespace big functions::handle_to_ptr m_handle_to_ptr; rage::scrNativeRegistrationTable* m_native_registration_table; functions::get_native_handler m_get_native_handler; + functions::fix_vectors m_fix_vectors; rage::atArray* m_script_threads; rage::scrProgramTable* m_script_program_table; diff --git a/src/invoker/invoker.cpp b/src/invoker/invoker.cpp index e701fc54..4c7a6fa8 100644 --- a/src/invoker/invoker.cpp +++ b/src/invoker/invoker.cpp @@ -19,12 +19,6 @@ namespace big void native_invoker::fix_vectors() { - for (; m_call_context.m_data_count; m_call_context.m_orig[m_call_context.m_data_count][2].Int = m_call_context.m_buffer[m_call_context.m_data_count].z) - { - --m_call_context.m_data_count; - m_call_context.m_orig[m_call_context.m_data_count]->Int = m_call_context.m_buffer[m_call_context.m_data_count].x; - m_call_context.m_orig[m_call_context.m_data_count][1].Int = m_call_context.m_buffer[m_call_context.m_data_count].y; - } - --m_call_context.m_data_count; + g_pointers->m_gta.m_fix_vectors(&m_call_context); } } diff --git a/src/pointers.cpp b/src/pointers.cpp index e9d54800..2af560b0 100644 --- a/src/pointers.cpp +++ b/src/pointers.cpp @@ -104,6 +104,15 @@ namespace big g_pointers->m_gta.m_get_native_handler = ptr.add(12).rip().as(); } }, + // Fix Vectors + { + "FV", + "83 79 18 00 48 8B D1 74 4A FF 4A 18 48 63 4A 18 48 8D 41 04 48 8B 4C CA", + [](memory::handle ptr) + { + g_pointers->m_gta.m_fix_vectors = ptr.as(); + } + }, // Script Threads { "ST",