From 291c18673172410cd714ae6b2b59ad7f22a45358 Mon Sep 17 00:00:00 2001 From: Yimura Date: Tue, 5 Jul 2022 11:11:16 +0200 Subject: [PATCH] Added model hashtable (#319) --- BigBaseV2/src/pointers.cpp | 36 ++++++++++++++++++++++++++++++++++++ BigBaseV2/src/pointers.hpp | 5 +++-- vendor/GTAV-Classes | 2 +- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/BigBaseV2/src/pointers.cpp b/BigBaseV2/src/pointers.cpp index a477de7e..7867b848 100644 --- a/BigBaseV2/src/pointers.cpp +++ b/BigBaseV2/src/pointers.cpp @@ -270,6 +270,42 @@ namespace big m_get_sync_type_info = ptr.add(0x78).rip().as(); // 44 0F B7 C1 4C 8D 0D .as() }); + // Model Hash Table + main_batch.add("MHT", "4C 03 05 ? ? ? ? EB 03", [this](memory::handle ptr) + { + m_model_table = ptr.add(3).rip().as*>(); + + // sample code to iterator models + /*for (int i = 0; i < m_model_table->m_size; ++i) + { + for (auto node = m_model_table->m_lookup_table[i]; node; node = node->m_next) + { + if (const auto table_idx = node->m_idx; table_idx < m_model_table->m_size) + { + if (const auto model = m_model_table->m_data[table_idx]; model && model->m_model_type == eModelType::Vehicle) + { + + } + } + } + }*/ + + // sample code to get a specific model + /*auto adder_hash = RAGE_JOAAT("adder"); + for (auto i = m_model_table->m_lookup_table[adder_hash % m_model_table->m_lookup_key]; i; i = i->m_next) + { + if (i->m_hash == adder_hash) + { + if (const auto model = m_model_table->m_data[i->m_idx]; model) + { + LOG(G3LOG_DEBUG) << "Found Model: " << HEX_TO_UPPER(model->m_model_hash) << " => type: " << (int)model->m_model_type; + + break; + } + } + }*/ + }); + auto mem_region = memory::module(nullptr); main_batch.run(mem_region); diff --git a/BigBaseV2/src/pointers.hpp b/BigBaseV2/src/pointers.hpp index db34807f..714e414c 100644 --- a/BigBaseV2/src/pointers.hpp +++ b/BigBaseV2/src/pointers.hpp @@ -1,9 +1,8 @@ #pragma once #include "common.hpp" -#include "atSingleton.hpp" #include "CNetworkPlayerMgr.hpp" -#include "CTunables.hpp" #include "FriendRegistry.hpp" +#include "HashTable.hpp" #include "gta/fwddec.hpp" #include "gta/enums.hpp" #include "gta/replay.hpp" @@ -57,6 +56,8 @@ namespace big functions::get_screen_coords_for_world_coords* m_get_screen_coords_for_world_coords{}; + HashTable* m_model_table; + PVOID m_gta_thread_start{}; PVOID m_gta_thread_kill{}; diff --git a/vendor/GTAV-Classes b/vendor/GTAV-Classes index e7b43afe..a2740d55 160000 --- a/vendor/GTAV-Classes +++ b/vendor/GTAV-Classes @@ -1 +1 @@ -Subproject commit e7b43afec36c02174b538c06ae926c86a020a6ca +Subproject commit a2740d556ac1a665e2091b8fd66eb802a79206ba