TmpMenu/BigBaseV2/src/pointers.cpp

180 lines
6.6 KiB
C++
Raw Normal View History

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-01-20 03:45:40 +01:00
main_batch.add("Ped factory", "48 8B 05 ? ? ? ? 48 8B 50 ? 48 8B C1", [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**>();
});
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>();
});
// My new pointers
// Sync Local Time with Session
main_batch.add("Sync Local Time", "48 89 5C 24 ? 57 48 83 EC 20 8B F9 48 8B 0D ? ? ? ? 48 8B DA 33 D2", [this](memory::handle ptr)
{
m_sync_local_time = ptr.as<decltype(m_sync_local_time)>();
});
main_batch.add("Session Weather", "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 30 40 8A E9", [this](memory::handle ptr)
{
m_set_session_weather = ptr.as<decltype(m_set_session_weather)>();
});
main_batch.add("Get Player Name", "40 53 48 83 EC 20 80 3D ? ? ? ? ? 8B D9 74 22", [this](memory::handle ptr)
{
m_get_player_name = ptr.as<decltype(m_get_player_name)>();
});
main_batch.add("Warning/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)>();
});
main_batch.add("Increment Stat Event", "48 89 5C 24 ? 48 89 74 24 ? 55 57 41 55 41 56 41 57 48 8B EC 48 83 EC 60 8B 79 30", [this](memory::handle ptr)
{
m_increment_stat_event = ptr.as<decltype(m_increment_stat_event)>();
});
main_batch.add("Script Event Handler", "40 53 48 81 EC ? ? ? ? 44 8B 81 ? ? ? ? 4C 8B CA 41 8D 40 FF 3D ? ? ? ? 77 42", [this](memory::handle ptr)
{
m_script_event_handler = ptr.as<decltype(m_script_event_handler)>();
});
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)>();
});
main_batch.add("Spectate Player", "48 89 5C 24 ? 57 48 83 EC 20 41 8A F8 84 C9", [this](memory::handle ptr)
{
m_spectate_player = ptr.as<decltype(m_spectate_player)>();
});
main_batch.add("Get Net player", "48 83 EC 28 33 C0 38 05 ? ? ? ? 74 0A", [this](memory::handle ptr)
{
m_get_net_game_player = ptr.as<decltype(m_get_net_game_player)>();
});
main_batch.add("Get Event Data", "48 85 C0 74 14 4C 8B 10", [this](memory::handle ptr)
{
m_get_event_data = ptr.sub(28).as<decltype(m_get_event_data)>();
});
2021-01-15 16:48:47 +01:00
main_batch.add("Replay Interface", "48 8D 0D ? ? ? ? 48 8B D7 E8 ? ? ? ? 48 8D 0D ? ? ? ? 8A D8 E8 ? ? ? ? 84 DB 75 13 48 8D 0D", [this](memory::handle ptr)
{
m_replay_interface = ptr.add(3).rip().as<decltype(m_replay_interface)>();
});
main_batch.add("Pointer to Handle", "48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 8B 15 ? ? ? ? 48 8B F9 48 83 C1 10 33 DB", [this](memory::handle ptr)
{
m_ptr_to_handle = ptr.as<decltype(m_ptr_to_handle)>();
2021-01-15 16:48:47 +01:00
});
main_batch.add("Send Net Info To Lobby", "44 8D 47 78 48 8D 54 24 ? 48 8B CB E8", [this](memory::handle ptr)
{
m_send_net_info_to_lobby = ptr.add(13).rip().as<PVOID>();
});
main_batch.add("Get Label Text", "75 ? E8 ? ? ? ? 8B 0D ? ? ? ? 65 48 8B 04 25 ? ? ? ? BA ? ? ? ? 48 8B 04 C8 8B 0C 02 D1 E9", [this](memory::handle ptr)
{
m_get_label_text = ptr.sub(19).as<decltype(m_get_label_text)>();
});
2021-02-07 17:08:25 +01:00
main_batch.add("Received Event", "66 41 83 F9 ? 0F 83 ? ? ? ?", [this](memory::handle ptr)
2021-02-07 17:08:25 +01:00
{
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)
2021-02-07 17:08:25 +01:00
{
m_read_bitbuf_dword = ptr.sub(5).as<decltype(m_read_bitbuf_dword)>();
2021-02-07 17:08:25 +01:00
});
main_batch.add("Read BitBuffer Array", "48 89 5C 24 ? 57 48 83 EC 30 41 8B F8 4C", [this](memory::handle ptr)
2021-02-07 17:08:25 +01:00
{
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)>();
2021-02-07 17:08:25 +01: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;
}
}