2019-03-21 20:18:31 +01:00
|
|
|
#include "common.hpp"
|
|
|
|
#include "logger.hpp"
|
|
|
|
#include "pointers.hpp"
|
|
|
|
#include "memory/all.hpp"
|
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
|
|
|
pointers::pointers()
|
|
|
|
{
|
|
|
|
memory::pattern_batch main_batch;
|
|
|
|
|
|
|
|
main_batch.add("Game state", "83 3D ? ? ? ? ? 75 17 8B 42 20 25", [this](memory::handle ptr)
|
|
|
|
{
|
|
|
|
m_game_state = ptr.add(2).rip().as<eGameState*>();
|
|
|
|
});
|
|
|
|
|
|
|
|
main_batch.add("Is session started", "40 38 35 ? ? ? ? 75 0E 4C 8B C3 49 8B D7 49 8B CE", [this](memory::handle ptr)
|
|
|
|
{
|
|
|
|
m_is_session_started = ptr.add(3).rip().as<bool*>();
|
|
|
|
});
|
|
|
|
|
2021-05-18 23:03:42 +02:00
|
|
|
main_batch.add("Ped factory", "48 8B 05 ? ? ? ? 48 8B 48 08 48 85 C9 74 52 8B 81", [this](memory::handle ptr)
|
2019-03-21 20:18:31 +01:00
|
|
|
{
|
|
|
|
m_ped_factory = ptr.add(3).rip().as<CPedFactory**>();
|
|
|
|
});
|
|
|
|
|
|
|
|
main_batch.add("Network player manager", "48 8B 0D ? ? ? ? 8A D3 48 8B 01 FF 50 ? 4C 8B 07 48 8B CF", [this](memory::handle ptr)
|
|
|
|
{
|
|
|
|
m_network_player_mgr = ptr.add(3).rip().as<CNetworkPlayerMgr**>();
|
|
|
|
});
|
|
|
|
|
|
|
|
main_batch.add("Native handlers", "48 8D 0D ? ? ? ? 48 8B 14 FA E8 ? ? ? ? 48 85 C0 75 0A", [this](memory::handle ptr)
|
|
|
|
{
|
|
|
|
m_native_registration_table = ptr.add(3).rip().as<rage::scrNativeRegistrationTable*>();
|
|
|
|
m_get_native_handler = ptr.add(12).rip().as<functions::get_native_handler_t>();
|
|
|
|
});
|
|
|
|
|
|
|
|
main_batch.add("Fix vectors", "83 79 18 00 48 8B D1 74 4A FF 4A 18 48 63 4A 18 48 8D 41 04 48 8B 4C CA", [this](memory::handle ptr)
|
|
|
|
{
|
|
|
|
m_fix_vectors = ptr.as<functions::fix_vectors_t>();
|
|
|
|
});
|
|
|
|
|
|
|
|
main_batch.add("Script threads", "45 33 F6 8B E9 85 C9 B8", [this](memory::handle ptr)
|
|
|
|
{
|
|
|
|
m_script_threads = ptr.sub(4).rip().sub(8).as<decltype(m_script_threads)>();
|
|
|
|
m_run_script_threads = ptr.sub(0x1F).as<functions::run_script_threads_t>();
|
|
|
|
});
|
|
|
|
|
|
|
|
main_batch.add("Script programs", "44 8B 0D ? ? ? ? 4C 8B 1D ? ? ? ? 48 8B 1D ? ? ? ? 41 83 F8 FF 74 3F 49 63 C0 42 0F B6 0C 18 81 E1", [this](memory::handle ptr)
|
|
|
|
{
|
|
|
|
m_script_program_table = ptr.add(17).rip().as<decltype(m_script_program_table)>();
|
|
|
|
});
|
|
|
|
|
|
|
|
main_batch.add("Script globals", "48 8D 15 ? ? ? ? 4C 8B C0 E8 ? ? ? ? 48 85 FF 48 89 1D", [this](memory::handle ptr)
|
|
|
|
{
|
|
|
|
m_script_globals = ptr.add(3).rip().as<std::int64_t**>();
|
|
|
|
});
|
|
|
|
|
|
|
|
main_batch.add("CGameScriptHandlerMgr", "48 8B 0D ? ? ? ? 4C 8B CE E8 ? ? ? ? 48 85 C0 74 05 40 32 FF", [this](memory::handle ptr)
|
|
|
|
{
|
|
|
|
m_script_handler_mgr = ptr.add(3).rip().as<CGameScriptHandlerMgr**>();
|
|
|
|
});
|
|
|
|
|
|
|
|
main_batch.add("Swapchain", "48 8B 0D ? ? ? ? 48 8B 01 44 8D 43 01 33 D2 FF 50 40 8B C8", [this](memory::handle ptr)
|
|
|
|
{
|
|
|
|
m_swapchain = ptr.add(3).rip().as<IDXGISwapChain**>();
|
|
|
|
});
|
|
|
|
|
2020-02-22 18:37:42 -05:00
|
|
|
main_batch.add("Model Spawn Bypass", "48 8B C8 FF 52 30 84 C0 74 05 48", [this](memory::handle ptr)
|
|
|
|
{
|
|
|
|
m_model_spawn_bypass = ptr.add(8).as<PVOID>();
|
|
|
|
});
|
|
|
|
|
2021-05-18 23:03:42 +02:00
|
|
|
// new pointers
|
|
|
|
main_batch.add("Native Return Spoofer", "FF E3", [this](memory::handle ptr)
|
2020-12-26 17:35:05 +01:00
|
|
|
{
|
2021-05-18 23:03:42 +02:00
|
|
|
m_native_return = ptr.add(0).as<PVOID>();
|
2020-12-26 17:35:05 +01:00
|
|
|
});
|
2021-05-19 00:07:13 +02:00
|
|
|
|
|
|
|
main_batch.add("Event Register", "48 83 EC 28 E8 ? ? ? ? 48 8B 0D ? ? ? ? 4C 8D 0D ? ? ? ? 4C 8D 05 ? ? ? ? BA 03", [this](memory::handle ptr)
|
|
|
|
{
|
2021-05-19 00:23:04 +02:00
|
|
|
m_event_register = ptr.as<char*>();
|
2021-05-19 00:07:13 +02:00
|
|
|
|
2021-05-19 00:23:04 +02:00
|
|
|
if (m_event_register)
|
|
|
|
{
|
|
|
|
const char* pattern = "\x4C\x8D\x05";
|
|
|
|
for (int i = 0, x = 0, found = 0, matches = 0; found < event_count; i++)
|
2021-05-19 00:07:13 +02:00
|
|
|
{
|
2021-05-19 00:23:04 +02:00
|
|
|
if (m_event_register[i] == pattern[x])
|
2021-05-19 00:07:13 +02:00
|
|
|
{
|
2021-05-19 00:23:04 +02:00
|
|
|
if (++matches == 3)
|
2021-05-19 00:07:13 +02:00
|
|
|
{
|
2021-05-19 00:23:04 +02:00
|
|
|
m_event_ptr.push_back((void*)(reinterpret_cast<uint64_t>(m_event_register + i - x) + *reinterpret_cast<int*>(m_event_register + i + 1) + 7));
|
2021-05-19 00:07:13 +02:00
|
|
|
|
2021-05-19 00:23:04 +02:00
|
|
|
found++;
|
|
|
|
x = matches = 0;
|
2021-05-19 00:07:13 +02:00
|
|
|
}
|
|
|
|
|
2021-05-19 00:23:04 +02:00
|
|
|
x++;
|
|
|
|
|
|
|
|
continue;
|
2021-05-19 00:07:13 +02:00
|
|
|
}
|
2021-05-19 00:23:04 +02:00
|
|
|
|
|
|
|
x = matches = 0;
|
2021-05-19 00:07:13 +02:00
|
|
|
}
|
2021-05-19 00:23:04 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
main_batch.add("Incompatible Version", "48 89 5C 24 ? 55 56 57 41 54 41 55 41 56 41 57 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 33 FF 48 8B DA", [this](memory::handle ptr)
|
|
|
|
{
|
2021-05-19 18:11:42 +02:00
|
|
|
uint8_t* incompatible_version = ptr.add(0x365).as<uint8_t*>();
|
2021-05-19 00:23:04 +02:00
|
|
|
|
2021-05-19 18:11:42 +02:00
|
|
|
memset(incompatible_version, 0x90, 0x1E);
|
2021-05-19 00:07:13 +02:00
|
|
|
});
|
2021-05-19 00:41:55 +02:00
|
|
|
|
|
|
|
main_batch.add("Thread Tick", "48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 80 B9 ? ? ? ? ? 8B FA 48 8B D9 74 05", [this](memory::handle ptr)
|
|
|
|
{
|
|
|
|
m_gta_thread_tick = ptr.as<decltype(m_gta_thread_tick)>();
|
|
|
|
});
|
|
|
|
|
|
|
|
main_batch.add("Thread Kill", "48 89 5C 24 ? 57 48 83 EC 20 48 83 B9 ? ? ? ? ? 48 8B D9 74 14", [this](memory::handle ptr)
|
|
|
|
{
|
|
|
|
m_gta_thread_kill = ptr.as<decltype(m_gta_thread_kill)>();
|
|
|
|
});
|
2021-05-19 16:19:38 +02:00
|
|
|
|
2021-05-20 15:49:36 +02:00
|
|
|
main_batch.add("Error Screen", "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 41 56 41 57 48 83 EC 60 4C 8B F2 48 8B 94 24 ? ? ? ? 33 DB", [this](memory::handle ptr)
|
|
|
|
{
|
|
|
|
m_error_screen = ptr.as<decltype(m_error_screen)>();
|
|
|
|
});
|
2021-05-21 00:59:09 +02:00
|
|
|
|
|
|
|
main_batch.add("Trigger Script Event", "48 8B C4 48 89 58 08 48 89 68 10 48 89 70 18 48 89 78 20 41 56 48 81 EC ? ? ? ? 45 8B F0 41 8B F9", [this](memory::handle ptr)
|
|
|
|
{
|
|
|
|
m_trigger_script_event = ptr.as<decltype(m_trigger_script_event)>();
|
|
|
|
});
|
2021-05-25 12:58:33 +02:00
|
|
|
|
|
|
|
// Received Event Signatures START
|
|
|
|
main_batch.add("Received Event", "66 41 83 F9 ? 0F 83 ? ? ? ?", [this](memory::handle ptr)
|
|
|
|
{
|
|
|
|
m_received_event = ptr.as<decltype(m_received_event)>();
|
|
|
|
});
|
|
|
|
|
|
|
|
main_batch.add("Read BitBuffer WORD/DWORD", "48 89 74 24 ? 57 48 83 EC 20 48 8B D9 33 C9 41 8B F0 8A", [this](memory::handle ptr)
|
|
|
|
{
|
|
|
|
m_read_bitbuf_dword = ptr.sub(5).as<decltype(m_read_bitbuf_dword)>();
|
|
|
|
});
|
|
|
|
|
|
|
|
main_batch.add("Read BitBuffer Array", "48 89 5C 24 ? 57 48 83 EC 30 41 8B F8 4C", [this](memory::handle ptr)
|
|
|
|
{
|
|
|
|
m_read_bitbuf_array = ptr.as<decltype(m_read_bitbuf_array)>();
|
|
|
|
});
|
|
|
|
|
|
|
|
main_batch.add("Send Event Ack", "48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 20 80 7A", [this](memory::handle ptr)
|
|
|
|
{
|
|
|
|
m_send_event_ack = ptr.sub(5).as<decltype(m_send_event_ack)>();
|
|
|
|
});
|
|
|
|
// Received Event Signatures END
|
2021-05-18 23:03:42 +02:00
|
|
|
|
2019-03-21 20:18:31 +01:00
|
|
|
main_batch.run(memory::module(nullptr));
|
|
|
|
|
|
|
|
m_hwnd = FindWindowW(L"grcWindow", nullptr);
|
|
|
|
if (!m_hwnd)
|
|
|
|
throw std::runtime_error("Failed to find the game's window.");
|
|
|
|
|
|
|
|
g_pointers = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
pointers::~pointers()
|
|
|
|
{
|
|
|
|
g_pointers = nullptr;
|
|
|
|
}
|
|
|
|
}
|