feat(hooks): General cleanup on hooks and pointers (#322)
This commit is contained in:
parent
6a4ee2b282
commit
10f549183b
@ -9,16 +9,19 @@ namespace big
|
||||
{
|
||||
void backend::loop()
|
||||
{
|
||||
g->attempt_save();
|
||||
looped::system_self_globals();
|
||||
looped::system_update_pointers();
|
||||
while (true) {
|
||||
g->attempt_save();
|
||||
looped::system_self_globals();
|
||||
looped::system_update_pointers();
|
||||
|
||||
if (g_local_player != nullptr && !api::util::signed_in())
|
||||
{
|
||||
g_thread_pool->push([]
|
||||
if (g_local_player != nullptr && !api::util::signed_in())
|
||||
{
|
||||
looped::api_login_session();
|
||||
});
|
||||
g_thread_pool->push([]
|
||||
{
|
||||
looped::api_login_session();
|
||||
});
|
||||
}
|
||||
script::get_current()->yield();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <optional>
|
||||
#include <variant>
|
||||
|
||||
#define FMT_HEADER_ONLY
|
||||
#include <fmt/format.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
|
@ -19,7 +19,7 @@ namespace big
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error(fmt::format("Failed to create hook '{}' at 0x{:X} (error: {})", m_name, reinterpret_cast<std::uintptr_t>(m_target), MH_StatusToString(status)));
|
||||
throw std::runtime_error(fmt::format("Failed to create hook '{}' at 0x{:X} (error: {})", m_name, uintptr_t(m_target), MH_StatusToString(status)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ namespace big
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error(fmt::format("Failed to enable hook 0x{:X} ({})", reinterpret_cast<std::uintptr_t>(m_target), MH_StatusToString(status)));
|
||||
throw std::runtime_error(fmt::format("Failed to enable hook 0x{:X} ({})", uintptr_t(m_target), MH_StatusToString(status)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,20 +66,14 @@ namespace big
|
||||
|
||||
void detour_hook::fix_hook_address()
|
||||
{
|
||||
__try
|
||||
{
|
||||
__try {
|
||||
auto ptr = memory::handle(m_target);
|
||||
while (ptr.as<std::uint8_t&>() == 0xE9)
|
||||
{
|
||||
ptr = ptr.add(1).rip();
|
||||
}
|
||||
|
||||
m_target = ptr.as<void*>();
|
||||
}
|
||||
__except (exp_handler(GetExceptionInformation(), m_name))
|
||||
{
|
||||
[this]()
|
||||
{
|
||||
__except (exp_handler(GetExceptionInformation(), m_name)) {
|
||||
[this]() {
|
||||
throw std::runtime_error(fmt::format("Failed to fix hook address for '{}'", m_name));
|
||||
}();
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
#include "common.hpp"
|
||||
#include "features.hpp"
|
||||
#include "logger.hpp"
|
||||
#include "script.hpp"
|
||||
|
||||
#include "backend/backend.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void features::run_tick()
|
||||
{
|
||||
backend::loop();
|
||||
}
|
||||
|
||||
void features::script_func()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
TRY_CLAUSE
|
||||
{
|
||||
run_tick();
|
||||
}
|
||||
EXCEPT_CLAUSE
|
||||
script::get_current()->yield();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
#pragma once
|
||||
#include "common.hpp"
|
||||
|
||||
namespace big::features
|
||||
{
|
||||
void run_tick();
|
||||
void script_func();
|
||||
}
|
@ -7,37 +7,48 @@
|
||||
|
||||
namespace big::functions
|
||||
{
|
||||
using run_script_threads_t = bool(*)(std::uint32_t ops_to_execute);
|
||||
using get_native_handler_t = rage::scrNativeHandler(*)(rage::scrNativeRegistrationTable*, rage::scrNativeHash);
|
||||
using fix_vectors_t = void(*)(rage::scrNativeCallContext*);
|
||||
using run_script_threads = bool(*)(std::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);
|
||||
using get_net_game_player = CNetGamePlayer*(*)(Player player);
|
||||
|
||||
using trigger_script_event = void(int event_group, int64_t* args, int arg_count, int player_bits);
|
||||
using trigger_script_event = void(*)(int event_group, int64_t* args, int arg_count, int player_bits);
|
||||
|
||||
using increment_stat_event = bool(uint64_t net_event_struct, int64_t sender, int64_t a3);
|
||||
using increment_stat_event = bool(*)(uint64_t net_event_struct, int64_t sender, int64_t a3);
|
||||
|
||||
using ptr_to_handle = Entity(void* entity);
|
||||
using ptr_to_handle = Entity(*)(void* entity);
|
||||
|
||||
using get_screen_coords_for_world_coords = bool(float* world_coords, float* out_x, float* out_y);
|
||||
using get_gameplay_cam_coords = Vector3(*)();
|
||||
|
||||
using get_gameplay_cam_coords = Vector3();
|
||||
using get_screen_coords_for_world_coords = bool(*)(float* world_coords, float* out_x, float* out_y);
|
||||
|
||||
using give_pickup_rewards = void(int players, uint32_t hash);
|
||||
using give_pickup_rewards = void(*)(int players, uint32_t hash);
|
||||
|
||||
// Bitbuffer read/write START
|
||||
using read_bitbuf_dword = bool(*)(rage::datBitBuffer* buffer, PVOID read, int bits);
|
||||
using read_bitbuf_string = bool(*)(rage::datBitBuffer* buffer, char* read, int bits);
|
||||
using read_bitbuf_bool = bool(*)(rage::datBitBuffer* buffer, bool* read, int bits);
|
||||
using read_bitbuf_array = bool(*)(rage::datBitBuffer* buffer, PVOID read, int bits, int unk);
|
||||
using write_bitbuf_qword = bool(*)(rage::datBitBuffer* buffer, uint64_t val, int bits);
|
||||
using write_bitbuf_dword = bool(*)(rage::datBitBuffer* buffer, uint32_t val, int bits);
|
||||
using write_bitbuf_int64 = bool(*)(rage::datBitBuffer* buffer, int64_t val, int bits);
|
||||
using write_bitbuf_int32 = bool(*)(rage::datBitBuffer* buffer, int32_t val, int bits);
|
||||
using write_bitbuf_bool = bool(*)(rage::datBitBuffer* buffer, bool val, int bits);
|
||||
using write_bitbuf_array = bool(*)(rage::datBitBuffer* buffer, uint8_t* val, int bits, int unk);
|
||||
|
||||
// Bitbuffer read/write END
|
||||
// Received Event Signatures START
|
||||
using read_bitbuf_array = bool(rage::datBitBuffer* buffer, PVOID read, int bits, int);
|
||||
using read_bitbuf_dword = bool(rage::datBitBuffer* buffer, PVOID read, int bits);
|
||||
using send_event_ack = void(rage::netEventMgr* event_manager, CNetGamePlayer* source_player, CNetGamePlayer* target_player, int event_index, int event_handled_bitset);
|
||||
using send_event_ack = void(*)(rage::netEventMgr* event_manager, CNetGamePlayer* source_player, CNetGamePlayer* target_player, int event_index, int event_handled_bitset);
|
||||
// Received Event Signatures END
|
||||
|
||||
//Sync signatures START
|
||||
using get_sync_type_info = const char* (uint16_t sync_type, char a2);
|
||||
using get_sync_type_info = const char*(*)(uint16_t sync_type, char a2);
|
||||
|
||||
using get_sync_tree_for_type = __int64(CNetworkObjectMgr* mgr, uint16_t sync_type);
|
||||
using get_sync_tree_for_type = int64_t(*)(CNetworkObjectMgr* mgr, uint16_t sync_type);
|
||||
|
||||
using get_net_object = rage::netObject* (__fastcall)(CNetworkObjectMgr* mgr, int16_t id, bool unk3);
|
||||
using get_net_object = rage::netObject*(*)(CNetworkObjectMgr* mgr, int16_t id, bool unk3);
|
||||
|
||||
using get_net_object_for_player = rage::netObject* (__fastcall) (CNetworkObjectMgr*, int16_t, CNetGamePlayer*, bool);
|
||||
using get_net_object_for_player = rage::netObject*(*)(CNetworkObjectMgr*, int16_t, CNetGamePlayer*, bool);
|
||||
//Sync signatures END
|
||||
}
|
@ -726,96 +726,96 @@ enum class NetObjEntityType : uint16_t
|
||||
NetObjEntityType_Max
|
||||
};
|
||||
|
||||
enum class RockstarEvent : uint16_t
|
||||
enum class eNetworkEvents : uint16_t
|
||||
{
|
||||
OBJECT_ID_FREED_EVENT,
|
||||
OBJECT_ID_REQUEST_EVENT,
|
||||
ARRAY_DATA_VERIFY_EVENT,
|
||||
SCRIPT_ARRAY_DATA_VERIFY_EVENT,
|
||||
REQUEST_CONTROL_EVENT,
|
||||
GIVE_CONTROL_EVENT,
|
||||
WEAPON_DAMAGE_EVENT,
|
||||
REQUEST_PICKUP_EVENT,
|
||||
REQUEST_MAP_PICKUP_EVENT,
|
||||
GAME_CLOCK_EVENT,
|
||||
GAME_WEATHER_EVENT,
|
||||
RESPAWN_PLAYER_PED_EVENT,
|
||||
GIVE_WEAPON_EVENT,
|
||||
REMOVE_WEAPON_EVENT,
|
||||
REMOVE_ALL_WEAPONS_EVENT,
|
||||
VEHICLE_COMPONENT_CONTROL_EVENT,
|
||||
FIRE_EVENT,
|
||||
EXPLOSION_EVENT,
|
||||
START_PROJECTILE_EVENT,
|
||||
UPDATE_PROJECTILE_TARGET_EVENT,
|
||||
REMOVE_PROJECTILE_ENTITY_EVENT,
|
||||
BREAK_PROJECTILE_TARGET_LOCK_EVENT,
|
||||
ALTER_WANTED_LEVEL_EVENT,
|
||||
CHANGE_RADIO_STATION_EVENT,
|
||||
RAGDOLL_REQUEST_EVENT,
|
||||
PLAYER_TAUNT_EVENT,
|
||||
PLAYER_CARD_STAT_EVENT,
|
||||
DOOR_BREAK_EVENT,
|
||||
SCRIPTED_GAME_EVENT,
|
||||
REMOTE_SCRIPT_INFO_EVENT,
|
||||
REMOTE_SCRIPT_LEAVE_EVENT,
|
||||
MARK_AS_NO_LONGER_NEEDED_EVENT,
|
||||
CONVERT_TO_SCRIPT_ENTITY_EVENT,
|
||||
SCRIPT_WORLD_STATE_EVENT,
|
||||
CLEAR_AREA_EVENT,
|
||||
CLEAR_RECTANGLE_AREA_EVENT,
|
||||
NETWORK_REQUEST_SYNCED_SCENE_EVENT,
|
||||
NETWORK_START_SYNCED_SCENE_EVENT,
|
||||
NETWORK_STOP_SYNCED_SCENE_EVENT,
|
||||
NETWORK_UPDATE_SYNCED_SCENE_EVENT,
|
||||
INCIDENT_ENTITY_EVENT,
|
||||
GIVE_PED_SCRIPTED_TASK_EVENT,
|
||||
GIVE_PED_SEQUENCE_TASK_EVENT,
|
||||
NETWORK_CLEAR_PED_TASKS_EVENT,
|
||||
NETWORK_START_PED_ARREST_EVENT,
|
||||
NETWORK_START_PED_UNCUFF_EVENT,
|
||||
NETWORK_SOUND_CAR_HORN_EVENT,
|
||||
NETWORK_ENTITY_AREA_STATUS_EVENT,
|
||||
NETWORK_GARAGE_OCCUPIED_STATUS_EVENT,
|
||||
PED_CONVERSATION_LINE_EVENT,
|
||||
SCRIPT_ENTITY_STATE_CHANGE_EVENT,
|
||||
NETWORK_PLAY_SOUND_EVENT,
|
||||
NETWORK_STOP_SOUND_EVENT,
|
||||
NETWORK_PLAY_AIRDEFENSE_FIRE_EVENT,
|
||||
NETWORK_BANK_REQUEST_EVENT,
|
||||
NETWORK_AUDIO_BARK_EVENT,
|
||||
REQUEST_DOOR_EVENT,
|
||||
NETWORK_TRAIN_REPORT_EVENT,
|
||||
NETWORK_TRAIN_REQUEST_EVENT,
|
||||
NETWORK_INCREMENT_STAT_EVENT,
|
||||
MODIFY_VEHICLE_LOCK_WORD_STATE_DATA,
|
||||
MODIFY_PTFX_WORD_STATE_DATA_SCRIPTED_EVOLVE_EVENT,
|
||||
REQUEST_PHONE_EXPLOSION_EVENT,
|
||||
REQUEST_DETACHMENT_EVENT,
|
||||
KICK_VOTES_EVENT,
|
||||
GIVE_PICKUP_REWARDS_EVENT,
|
||||
NETWORK_CRC_HASH_CHECK_EVENT,
|
||||
BLOW_UP_VEHICLE_EVENT,
|
||||
NETWORK_SPECIAL_FIRE_EQUIPPED_WEAPON,
|
||||
NETWORK_RESPONDED_TO_THREAT_EVENT,
|
||||
NETWORK_SHOUT_TARGET_POSITION,
|
||||
VOICE_DRIVEN_MOUTH_MOVEMENT_FINISHED_EVENT,
|
||||
PICKUP_DESTROYED_EVENT,
|
||||
UPDATE_PLAYER_SCARS_EVENT,
|
||||
NETWORK_CHECK_EXE_SIZE_EVENT,
|
||||
NETWORK_PTFX_EVENT,
|
||||
NETWORK_PED_SEEN_DEAD_PED_EVENT,
|
||||
REMOVE_STICKY_BOMB_EVENT,
|
||||
NETWORK_CHECK_CODE_CRCS_EVENT,
|
||||
INFORM_SILENCED_GUNSHOT_EVENT,
|
||||
PED_PLAY_PAIN_EVENT,
|
||||
CACHE_PLAYER_HEAD_BLEND_DATA_EVENT,
|
||||
REMOVE_PED_FROM_PEDGROUP_EVENT,
|
||||
REPORT_MYSELF_EVENT,
|
||||
REPORT_CASH_SPAWN_EVENT,
|
||||
ACTIVATE_VEHICLE_SPECIAL_ABILITY_EVENT,
|
||||
BLOCK_WEAPON_SELECTION,
|
||||
NETWORK_CHECK_CATALOG_CRC
|
||||
CObjectIdFreedEvent,
|
||||
CObjectIdRequestEvent,
|
||||
CArrayDataVerifyEvent,
|
||||
CScriptArrayDataVerifyEvent,
|
||||
CRequestControlEvent,
|
||||
CGiveControlEvent,
|
||||
CWeaponDamageEvent,
|
||||
CRequestPickupEvent,
|
||||
CRequestMapPickupEvent,
|
||||
CGameClockEvent,
|
||||
CGameWeatherEvent,
|
||||
CRespawnPlayerPedEvent,
|
||||
CGiveWeaponEvent,
|
||||
CRemoveWeaponEvent,
|
||||
CRemoveAllWeaponsEvent,
|
||||
CVehicleComponentControlEvent,
|
||||
CFireEvent,
|
||||
CExplosionEvent,
|
||||
CStartProjectileEvent,
|
||||
CUpdateProjectileTargetEvent,
|
||||
CRemoveProjectileEntityEvent,
|
||||
CBreakProjectileTargetLockEvent,
|
||||
CAlterWantedLevelEvent,
|
||||
CChangeRadioStationEvent,
|
||||
CRagdollRequestEvent,
|
||||
CPlayerTauntEvent,
|
||||
CPlayerCardStatEvent,
|
||||
CDoorBreakEvent,
|
||||
CScriptedGameEvent,
|
||||
CRemoteScriptInfoEvent,
|
||||
CRemoteScriptLeaveEvent,
|
||||
CMarkAsNoLongerNeededEvent,
|
||||
CConvertToScriptEntityEvent,
|
||||
CScriptWorldStateEvent,
|
||||
CClearAreaEvent,
|
||||
CClearRectangleAreaEvent,
|
||||
CNetworkRequestSyncedSceneEvent,
|
||||
CNetworkStartSyncedSceneEvent,
|
||||
CNetworkStopSyncedSceneEvent,
|
||||
CNetworkUpdateSyncedSceneEvent,
|
||||
CIncidentEntityEvent,
|
||||
CGivePedScriptedTaskEvent,
|
||||
CGivePedSequenceTaskEvent,
|
||||
CNetworkClearPedTasksEvent,
|
||||
CNetworkStartPedArrestEvent,
|
||||
CNetworkStartPedUncuffEvent,
|
||||
CNetworkSoundCarHornEvent,
|
||||
CNetworkEntityAreaStatusEvent,
|
||||
CNetworkGarageOccupiedStatusEvent,
|
||||
CPedConversationLineEvent,
|
||||
CScriptEntityStateChangeEvent,
|
||||
CNetworkPlaySoundEvent,
|
||||
CNetworkStopSoundEvent,
|
||||
CNetworkPlayAirdefenseFireEvent,
|
||||
CNetworkBankRequestEvent,
|
||||
CNetworkAudioBarkEvent,
|
||||
CRequestDoorEvent,
|
||||
CNetworkTrainReportEvent,
|
||||
CNetworkTrainRequestEvent,
|
||||
CNetworkIncrementStatEvent,
|
||||
CModifyVehicleLockWordStateData,
|
||||
CModifyPtfxWordStateDataScriptedEvolveEvent,
|
||||
CRequestPhoneExplosionEvent,
|
||||
CRequestDetachmentEvent,
|
||||
CKickVotesEvent,
|
||||
CGivePickupRewardsEvent,
|
||||
CNetworkCrcHashCheckEvent,
|
||||
CBlowUpVehicleEvent,
|
||||
CNetworkSpecialFireEquippedWeapon,
|
||||
CNetworkRespondedToThreatEvent,
|
||||
CNetworkShoutTargetPosition,
|
||||
CVoiceDrivenMouthMovementFinishedEvent,
|
||||
CPickupDestroyedEvent,
|
||||
CUpdatePlayerScarsEvent,
|
||||
CNetworkCheckExeSizeEvent,
|
||||
CNetworkPtfxEvent,
|
||||
CNetworkPedSeenDeadPedEvent,
|
||||
CRemoveStickyBombEvent,
|
||||
CNetworkCheckCodeCrcsEvent,
|
||||
CInformSilencedGunshotEvent,
|
||||
CPedPlayPainEvent,
|
||||
CCachePlayerHeadBlendDataEvent,
|
||||
CRemovePedFromPedgroupEvent,
|
||||
CUpdateFxnEvent,
|
||||
CReportCashSpawnEvent,
|
||||
CActivateVehicleSpecialAbilityEvent,
|
||||
CBlockWeaponSelection,
|
||||
CNetworkCheckCatalogCrc
|
||||
};
|
||||
|
||||
enum class BlipIcons
|
||||
|
@ -54,12 +54,45 @@ namespace rage
|
||||
std::int32_t m_data_count;
|
||||
std::uint32_t m_data[48];
|
||||
};
|
||||
|
||||
static_assert(sizeof(scrNativeCallContext) == 0xE0);
|
||||
using scrNativeHash = std::uint64_t;
|
||||
using scrNativeMapping = std::pair<scrNativeHash, scrNativeHash>;
|
||||
using scrNativeHandler = void(*)(scrNativeCallContext*);
|
||||
|
||||
class scrNativeRegistration;
|
||||
class scrNativeRegistration {
|
||||
public:
|
||||
uint64_t m_nextRegistration1;
|
||||
uint64_t m_nextRegistration2;
|
||||
void* m_handlers[7];
|
||||
uint32_t m_numEntries1;
|
||||
uint32_t m_numEntries2;
|
||||
uint64_t m_hashes;
|
||||
scrNativeRegistration* get_next_registration() {
|
||||
std::uintptr_t result;
|
||||
auto nextReg = uintptr_t(&m_nextRegistration1);
|
||||
auto newReg = nextReg ^ m_nextRegistration2;
|
||||
auto charTableOfRegs = (char*)&result - nextReg;
|
||||
for (auto i = 0; i < 3; i++) {
|
||||
*(DWORD*)&charTableOfRegs[nextReg] = static_cast<DWORD>(newReg) ^ *(DWORD*)nextReg;
|
||||
nextReg += 4;
|
||||
}
|
||||
return reinterpret_cast<scrNativeRegistration*>(result);
|
||||
}
|
||||
std::uint32_t get_num_entries() {
|
||||
return static_cast<std::uint32_t>(((std::uintptr_t)&m_numEntries1) ^ m_numEntries1 ^ m_numEntries2);
|
||||
}
|
||||
std::uint64_t get_hash(std::uint32_t index) {
|
||||
auto nativeAddress = 16 * index + std::uintptr_t(&m_nextRegistration1) + 0x54;
|
||||
std::uint64_t result;
|
||||
auto charTableOfRegs = (char*)&result - nativeAddress;
|
||||
auto addressIndex = nativeAddress ^ *(DWORD*)(nativeAddress + 8);
|
||||
for (auto i = 0; i < 3; i++) {
|
||||
*(DWORD*)&charTableOfRegs[nativeAddress] = static_cast<DWORD>(addressIndex ^ *(DWORD*)(nativeAddress));
|
||||
nativeAddress += 4;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
class scrNativeRegistrationTable
|
||||
@ -69,8 +102,6 @@ namespace rage
|
||||
bool m_initialized;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
static_assert(sizeof(scrNativeCallContext) == 0xE0);
|
||||
}
|
||||
|
||||
using Void = void;
|
||||
|
@ -7,139 +7,266 @@
|
||||
namespace rage
|
||||
{
|
||||
class netPlayer;
|
||||
|
||||
class datBitBuffer
|
||||
{
|
||||
public:
|
||||
inline datBitBuffer(void* data, uint32_t size)
|
||||
{
|
||||
datBitBuffer(uint8_t* data, uint32_t size) {
|
||||
m_data = data;
|
||||
m_f8 = 0;
|
||||
m_bitOffset = 0;
|
||||
m_maxBit = size * 8;
|
||||
m_bitsRead = 0;
|
||||
m_curBit = 0;
|
||||
m_unk2Bit = 0;
|
||||
m_highestBitsRead = 0;
|
||||
m_flagBits = 0;
|
||||
}
|
||||
|
||||
inline uint32_t GetPosition()
|
||||
{
|
||||
uint32_t GetPosition() {
|
||||
return m_bitsRead;
|
||||
}
|
||||
|
||||
inline bool Seek(uint32_t bits)
|
||||
{
|
||||
if (bits >= 0)
|
||||
{
|
||||
bool Seek(uint32_t bits) {
|
||||
if (bits >= 0) {
|
||||
uint32_t length = (m_flagBits & 1) ? m_maxBit : m_curBit;
|
||||
|
||||
if (bits <= length)
|
||||
{
|
||||
m_bitsRead = bits;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
inline int GetDataLength()
|
||||
{
|
||||
bool WriteBool(bool integer) {
|
||||
return big::g_pointers->m_write_bitbuf_bool(this, integer, 1);
|
||||
}
|
||||
bool ReadBool(bool* integer) {
|
||||
return big::g_pointers->m_read_bitbuf_bool(this, integer, 1);
|
||||
}
|
||||
bool ReadPeerId(uint64_t* integer) {
|
||||
return this->ReadQWord(integer, 0x32);
|
||||
}
|
||||
uint64_t ReadBits(size_t numBits) {
|
||||
auto const totalBits = (m_flagBits & 1) ? m_maxBit : m_curBit;
|
||||
if ((m_flagBits & 2) || m_bitsRead + numBits > totalBits)
|
||||
return 0;
|
||||
auto const bufPos = m_bitsRead + m_bitOffset;
|
||||
auto const initialBitOffset = bufPos & 0b111;
|
||||
auto const start = &m_data[bufPos / 8];
|
||||
auto const next = &start[1];
|
||||
auto result = (start[0] << initialBitOffset) & 0xff;
|
||||
for (auto i = 0; i < ((numBits - 1) / 8); i++) {
|
||||
result <<= 8;
|
||||
result |= next[i] << initialBitOffset;
|
||||
}
|
||||
if (initialBitOffset)
|
||||
result |= next[0] >> (8 - initialBitOffset);
|
||||
m_bitsRead += static_cast<uint32_t>(numBits);
|
||||
if (m_bitsRead > m_highestBitsRead)
|
||||
m_highestBitsRead = m_bitsRead;
|
||||
return result >> ((8 - numBits) % 8);
|
||||
}
|
||||
int GetDataLength() {
|
||||
int leftoverBit = (m_curBit % 8) ? 1 : 0;
|
||||
|
||||
return (m_curBit / 8) + leftoverBit;
|
||||
}
|
||||
|
||||
inline bool ReadByte(uint8_t* integer, int bits)
|
||||
{
|
||||
bool ReadString(char* string, int bits) {
|
||||
return big::g_pointers->m_read_bitbuf_string(this, string, bits);
|
||||
}
|
||||
bool WriteByte(uint8_t integer, int bits) {
|
||||
return big::g_pointers->m_write_bitbuf_dword(this, integer, bits);
|
||||
}
|
||||
bool ReadByte(uint8_t* integer, int bits) {
|
||||
uint32_t read;
|
||||
if (big::g_pointers->m_read_bitbuf_dword(this, &read, bits))
|
||||
{
|
||||
if (big::g_pointers->m_read_bitbuf_dword(this, &read, bits)) {
|
||||
*integer = read;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool ReadWord(uint16_t* integer, int bits)
|
||||
{
|
||||
bool WriteWord(uint16_t integer, int bits) {
|
||||
return big::g_pointers->m_write_bitbuf_dword(this, integer, bits);
|
||||
}
|
||||
bool ReadWord(uint16_t* integer, int bits) {
|
||||
uint32_t read;
|
||||
if (big::g_pointers->m_read_bitbuf_dword(this, &read, bits))
|
||||
{
|
||||
if (big::g_pointers->m_read_bitbuf_dword(this, &read, bits)) {
|
||||
*integer = read;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool ReadDword(uint32_t* integer, int bits)
|
||||
{
|
||||
bool WriteDword(uint32_t integer, int bits) {
|
||||
return big::g_pointers->m_write_bitbuf_dword(this, integer, bits);
|
||||
}
|
||||
bool ReadDword(uint32_t* integer, int bits) {
|
||||
return big::g_pointers->m_read_bitbuf_dword(this, integer, bits);
|
||||
}
|
||||
|
||||
inline bool ReadInt32(int32_t* integer, int bits)
|
||||
{
|
||||
bool WriteInt32(int32_t integer, int bits) {
|
||||
return big::g_pointers->m_write_bitbuf_int32(this, integer, bits);
|
||||
}
|
||||
bool ReadInt32(int32_t* integer, int bits) {
|
||||
int32_t v8;
|
||||
int32_t v9;
|
||||
if (ReadDword((uint32_t*)&v8, 1u) && ReadDword((uint32_t*)&v9, bits - 1))
|
||||
{
|
||||
if (ReadDword((uint32_t*)&v8, 1u) && ReadDword((uint32_t*)&v9, bits - 1)) {
|
||||
*integer = v8 + (v9 ^ -v8);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool ReadQWord(uint64_t* integer, int bits)
|
||||
{
|
||||
if (bits <= 32)
|
||||
{
|
||||
uint32_t v10{};
|
||||
if (ReadDword(&v10, bits))
|
||||
{
|
||||
bool WriteQWord(uint64_t integer, int bits) {
|
||||
return big::g_pointers->m_write_bitbuf_qword(this, integer, bits);
|
||||
}
|
||||
bool ReadQWord(uint64_t* integer, int bits) {
|
||||
if (bits <= 32) {
|
||||
uint32_t v10;
|
||||
if (ReadDword(&v10, bits)) {
|
||||
*integer = v10;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t v10{}, v11{};
|
||||
if (ReadDword(&v11, 32u) && ReadDword(&v10, bits - 32u))
|
||||
{
|
||||
else {
|
||||
uint32_t v10, v11;
|
||||
if (ReadDword(&v11, 32u) && ReadDword(&v10, bits - 32u)) {
|
||||
*integer = v11 | ((uint64_t)v10 << 32);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool ReadInt64(int64_t* integer, int bits)
|
||||
{
|
||||
bool WriteInt64(int64_t integer, int bits) {
|
||||
return big::g_pointers->m_write_bitbuf_int64(this, integer, bits);
|
||||
}
|
||||
bool ReadInt64(int64_t* integer, int bits) {
|
||||
uint32_t v8;
|
||||
uint64_t v9;
|
||||
if (ReadDword(&v8, 1u) && ReadQWord(&v9, bits - 1))
|
||||
{
|
||||
if (ReadDword(&v8, 1u) && ReadQWord(&v9, bits - 1)) {
|
||||
*integer = v8 + (v9 ^ -(int64_t)v8);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool ReadArray(PVOID array, int size)
|
||||
{
|
||||
bool WriteArray(uint8_t* array, int size) {
|
||||
return big::g_pointers->m_write_bitbuf_array(this, array, size, 0);
|
||||
}
|
||||
bool ReadArray(PVOID array, int size) {
|
||||
return big::g_pointers->m_read_bitbuf_array(this, array, size, 0);
|
||||
}
|
||||
|
||||
public:
|
||||
void* m_data; //0x0000
|
||||
uint32_t m_f8; //0x0008
|
||||
uint8_t* m_data; //0x0000
|
||||
uint32_t m_bitOffset; //0x0008
|
||||
uint32_t m_maxBit; //0x000C
|
||||
uint32_t m_bitsRead; //0x0010
|
||||
uint32_t m_curBit; //0x0014
|
||||
uint32_t m_unk2Bit; //0x0018
|
||||
uint32_t m_highestBitsRead; //0x0018
|
||||
uint8_t m_flagBits; //0x001C
|
||||
char pad_0x01D[3];
|
||||
uint32_t m_f20;
|
||||
};
|
||||
|
||||
enum class eNetMessage : uint32_t {
|
||||
CMsgInvalid = 0xFFFFF,
|
||||
CMsgSessionAcceptChat = 0x62,
|
||||
CMsgStartMatchCmd = 0x2D,
|
||||
CMsgSetInvitableCmd = 0x1F,
|
||||
CMsgSessionMemberIds = 0x23,
|
||||
CMsgRequestGamerInfo = 0x54,
|
||||
CMsgRemoveGamersFromSessionCmd = 0x53,
|
||||
CMsgNotMigrating = 0x35,
|
||||
CMsgMigrateHostResponse = 0x12,
|
||||
CMsgMigrateHostRequest = 0x66,
|
||||
CMsgJoinResponse = 0x2A,
|
||||
CMsgJoinRequest = 0x41,
|
||||
CMsgHostLeftWhilstJoiningCmd = 0x58,
|
||||
CMsgConfigResponse = 0x5F,
|
||||
CMsgConfigRequest = 0x48,
|
||||
CMsgChangeSessionAttributesCmd = 0x5A,
|
||||
CMsgAddGamerToSessionCmd = 0x64, // this is where send net info to lobby is called, among other things
|
||||
CMsgReassignResponse = 0x10,
|
||||
CMsgReassignNegotiate = 0x01,
|
||||
CMsgReassignConfirm = 0x26,
|
||||
CMsgPlayerData = 0x18,
|
||||
CMsgPackedReliables = 0x30,
|
||||
CMsgPackedCloneSyncACKs = 0x3B,
|
||||
CMsgNonPhysicalData = 0x16,
|
||||
CMsgNetArrayMgrUpdateAck = 0x5D,
|
||||
CMsgNetArrayMgrUpdate = 0x60,
|
||||
CMsgNetArrayMgrSplitUpdateAck = 0x25,
|
||||
CMsgScriptVerifyHostAck = 0x0B,
|
||||
CMsgScriptVerifyHost = 0x3E,
|
||||
CMsgScriptNewHost = 0x0E,
|
||||
CMsgScriptMigrateHostFailAck = 0x1A,
|
||||
CMsgScriptMigrateHost = 0x33,
|
||||
CMsgScriptLeaveAck = 0x40,
|
||||
CMsgScriptLeave = 0x17,
|
||||
CMsgScriptJoinHostAck = 0x4D,
|
||||
CMsgScriptJoinAck = 0x43,
|
||||
CMsgScriptJoin = 0x5C,
|
||||
CMsgScriptHostRequest = 0x67,
|
||||
CMsgScriptHandshakeAck = 0x5B,
|
||||
CMsgScriptHandshake = 0x57,
|
||||
CMsgScriptBotLeave = 0x2B, // unused?
|
||||
CMsgScriptBotJoinAck = 0x63, // unused?
|
||||
CMsgScriptBotJoin = 0x1C, // unused?
|
||||
CMsgScriptBotHandshakeAck = 0x31, // unused?
|
||||
CMsgScriptBotHandshake = 0x4B, // unused?
|
||||
CMsgPartyLeaveGame = 0x3D,
|
||||
CMsgPartyEnterGame = 0x1E,
|
||||
CMsgCloneSync = 0x4E, // aka clone_create, clone_sync etc.
|
||||
CMsgActivateNetworkBot = 0x65, // unused?
|
||||
CMsgRequestObjectIds = 0x29,
|
||||
CMsgInformObjectIds = 0x09,
|
||||
CMsgTextMessage = 0x24, // this one is for chat
|
||||
CMsgPlayerIsTyping = 0x61,
|
||||
CMsgPackedEvents = 0x4F, // aka received_event
|
||||
CMsgPackedEventReliablesCMsgs = 0x20,
|
||||
CMsgRequestKickFromHost = 0x0D,
|
||||
CMsgTransitionToGameStart = 0x50,
|
||||
CMsgTransitionToGameNotify = 0x02,
|
||||
CMsgTransitionToActivityStart = 0x06,
|
||||
CMsgTransitionToActivityFinish = 0x36,
|
||||
CMsgTransitionParameters = 0x3C,
|
||||
CMsgTransitionParameterString = 0x37,
|
||||
CMsgTransitionLaunchNotify = 0x1B,
|
||||
CMsgTransitionLaunch = 0x19,
|
||||
CMsgTransitionGamerInstruction = 0x14,
|
||||
CMsgTextMessage2 = 0x0A, // this one is for phone message
|
||||
CMsgSessionEstablishedRequest = 0x52,
|
||||
CMsgSessionEstablished = 0x07,
|
||||
CMsgRequestTransitionParameters = 0x42,
|
||||
CMsgRadioStationSyncRequest = 0x47,
|
||||
CMsgRadioStationSync = 0x46,
|
||||
CMsgPlayerCardSync = 0x3A,
|
||||
CMsgPlayerCardRequest = 0x6A,
|
||||
CMsgLostConnectionToHost = 0x81,
|
||||
CMsgKickPlayer = 0x34, // host kick
|
||||
CMsgDebugStall = 0x7E, // unused?
|
||||
CMsgCheckQueuedJoinRequestReply = 0x59,
|
||||
CMsgCheckQueuedJoinRequest = 0x51,
|
||||
CMsgBlacklist = 0x0C,
|
||||
CMsgRoamingRequestBubbleRequiredResponse = 0x83,
|
||||
CMsgRoamingRequestBubbleRequiredCheck = 0x82,
|
||||
CMsgRoamingRequestBubble = 0x2E,
|
||||
CMsgRoamingJoinBubble = 0x4C,
|
||||
CMsgRoamingJoinBubbleAck = 0x3F,
|
||||
CMsgRoamingInitialBubble = 0x32,
|
||||
CMsgVoiceStatus = 0x03,
|
||||
CMsgTextChatStatus = 0x00,
|
||||
CMsgJoinResponse2 = 0x08,
|
||||
CMsgJoinRequest2 = 0x68,
|
||||
CMsgNetTimeSync = 0x38, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 37
|
||||
CMsgNetComplaint = 0x55, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 54
|
||||
CMsgNetLagPing = 0x27, // unused? ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 26
|
||||
CMsgSearchResponse = 0x6B, // unused? ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 6A
|
||||
CMsgSearchRequest = 0x05, // unused?
|
||||
CMsgQosProbeResponse = 0x2C, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 2B
|
||||
CMsgQosProbeRequest = 0x1D, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 1C
|
||||
CMsgCxnRelayAddressChanged = 0x49, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 48
|
||||
CMsgCxnRequestRemoteTimeout = 0x2F, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 2E
|
||||
CMsgSessionDetailRequest = 0x22, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 21
|
||||
CMsgSessionDetailResponse = 0x13, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 12
|
||||
CMsgKeyExchangeOffer = 0x0F, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 0E (last result)
|
||||
CMsgKeyExchangeAnswer = 0x44, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 43
|
||||
CMsg_0x87 = 0x87,
|
||||
CMsg_0x88 = 0x88,
|
||||
CMsg_0x80 = 0x80,
|
||||
CMsg_0x28 = 0x28,
|
||||
CMsg_0x11 = 0x11,
|
||||
CMsg_0x45 = 0x45,
|
||||
CMsg_0x89 = 0x89,
|
||||
CMsg_0x86 = 0x86,
|
||||
};
|
||||
namespace netConnection {
|
||||
class InFrame
|
||||
{
|
||||
@ -159,122 +286,6 @@ namespace rage
|
||||
char pad_007C[4]; //0x007C
|
||||
void* m_data; //0x0080
|
||||
};
|
||||
|
||||
enum class MessageType : std::uint32_t
|
||||
{
|
||||
MsgInvalid = 0xFFFFF,
|
||||
MsgSessionAcceptChat = 0x62,
|
||||
MsgStartMatchCmd = 0x2D,
|
||||
MsgSetInvitableCmd = 0x1F,
|
||||
MsgSessionMemberIds = 0x23,
|
||||
MsgRequestGamerInfo = 0x54,
|
||||
MsgRemoveGamersFromSessionCmd = 0x53,
|
||||
MsgNotMigrating = 0x35,
|
||||
MsgMigrateHostResponse = 0x12,
|
||||
MsgMigrateHostRequest = 0x66,
|
||||
MsgJoinResponse = 0x2A,
|
||||
MsgJoinRequest = 0x41,
|
||||
MsgHostLeftWhilstJoiningCmd = 0x58,
|
||||
MsgConfigResponse = 0x5F,
|
||||
MsgConfigRequest = 0x48,
|
||||
MsgChangeSessionAttributesCmd = 0x5A,
|
||||
MsgAddGamerToSessionCmd = 0x64, // this is where send net info to lobby is called, among other things
|
||||
MsgReassignResponse = 0x10,
|
||||
MsgReassignNegotiate = 0x01,
|
||||
MsgReassignConfirm = 0x26,
|
||||
MsgPlayerData = 0x18,
|
||||
MsgPackedReliables = 0x30,
|
||||
MsgPackedCloneSyncACKs = 0x3B,
|
||||
MsgNonPhysicalData = 0x16,
|
||||
MsgNetArrayMgrUpdateAck = 0x5D,
|
||||
MsgNetArrayMgrUpdate = 0x60,
|
||||
MsgNetArrayMgrSplitUpdateAck = 0x25,
|
||||
MsgScriptVerifyHostAck = 0x0B,
|
||||
MsgScriptVerifyHost = 0x3E,
|
||||
MsgScriptNewHost = 0x0E,
|
||||
MsgScriptMigrateHostFailAck = 0x1A,
|
||||
MsgScriptMigrateHost = 0x33,
|
||||
MsgScriptLeaveAck = 0x40,
|
||||
MsgScriptLeave = 0x17,
|
||||
MsgScriptJoinHostAck = 0x4D,
|
||||
MsgScriptJoinAck = 0x43,
|
||||
MsgScriptJoin = 0x5C,
|
||||
MsgScriptHostRequest = 0x67,
|
||||
MsgScriptHandshakeAck = 0x5B,
|
||||
MsgScriptHandshake = 0x57,
|
||||
MsgScriptBotLeave = 0x2B, // unused?
|
||||
MsgScriptBotJoinAck = 0x63, // unused?
|
||||
MsgScriptBotJoin = 0x1C, // unused?
|
||||
MsgScriptBotHandshakeAck = 0x31, // unused?
|
||||
MsgScriptBotHandshake = 0x4B, // unused?
|
||||
MsgPartyLeaveGame = 0x3D,
|
||||
MsgPartyEnterGame = 0x1E,
|
||||
MsgCloneSync = 0x4E, // aka clone_create, clone_sync etc.
|
||||
MsgActivateNetworkBot = 0x65, // unused?
|
||||
MsgRequestObjectIds = 0x29,
|
||||
MsgInformObjectIds = 0x09,
|
||||
MsgTextMessage = 0x24, // this one is for chat
|
||||
MsgPlayerIsTyping = 0x61,
|
||||
MsgPackedEvents = 0x4F, // aka received_event
|
||||
MsgPackedEventReliablesMsgs = 0x20,
|
||||
MsgRequestKickFromHost = 0x0D,
|
||||
MsgTransitionToGameStart = 0x50,
|
||||
MsgTransitionToGameNotify = 0x02,
|
||||
MsgTransitionToActivityStart = 0x06,
|
||||
MsgTransitionToActivityFinish = 0x36,
|
||||
MsgTransitionParameters = 0x3C,
|
||||
MsgTransitionParameterString = 0x37,
|
||||
MsgTransitionLaunchNotify = 0x1B,
|
||||
MsgTransitionLaunch = 0x19,
|
||||
MsgTransitionGamerInstruction = 0x14,
|
||||
MsgTextMessage2 = 0x0A, // this one is for phone message
|
||||
MsgSessionEstablishedRequest = 0x52,
|
||||
MsgSessionEstablished = 0x07,
|
||||
MsgRequestTransitionParameters = 0x42,
|
||||
MsgRadioStationSyncRequest = 0x47,
|
||||
MsgRadioStationSync = 0x46,
|
||||
MsgPlayerCardSync = 0x3A,
|
||||
MsgPlayerCardRequest = 0x6A,
|
||||
MsgLostConnectionToHost = 0x81,
|
||||
MsgKickPlayer = 0x34, // host kick
|
||||
MsgDebugStall = 0x7E, // unused?
|
||||
MsgCheckQueuedJoinRequestReply = 0x59,
|
||||
MsgCheckQueuedJoinRequest = 0x51,
|
||||
MsgBlacklist = 0x0C,
|
||||
MsgRoamingRequestBubbleRequiredResponse = 0x83,
|
||||
MsgRoamingRequestBubbleRequiredCheck = 0x82,
|
||||
MsgRoamingRequestBubble = 0x2E,
|
||||
MsgRoamingJoinBubble = 0x4C,
|
||||
MsgRoamingJoinBubbleAck = 0x3F,
|
||||
MsgRoamingInitialBubble = 0x32,
|
||||
MsgVoiceStatus = 0x03,
|
||||
MsgTextChatStatus = 0x00,
|
||||
MsgJoinResponse2 = 0x08,
|
||||
MsgJoinRequest2 = 0x68,
|
||||
|
||||
MsgNetTimeSync = 0x38, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 37
|
||||
MsgNetComplaint = 0x55, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 54
|
||||
MsgNetLagPing = 0x27, // unused? ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 26
|
||||
MsgSearchResponse = 0x6B, // unused? ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 6A
|
||||
MsgSearchRequest = 0x05, // unused?
|
||||
MsgQosProbeResponse = 0x2C, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 2B
|
||||
MsgQosProbeRequest = 0x1D, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 1C
|
||||
MsgCxnRelayAddressChanged = 0x49, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 48
|
||||
MsgCxnRequestRemoteTimeout = 0x2F, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 2E
|
||||
MsgSessionDetailRequest = 0x22, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 21
|
||||
MsgSessionDetailResponse = 0x13, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 12
|
||||
MsgKeyExchangeOffer = 0x0F, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 0E (last result)
|
||||
MsgKeyExchangeAnswer = 0x44, // ctor 40 53 48 83 EC 20 BA ? ? ? ? 4C 8D 0D ? ? ? ? 48 8B D9 44 8D 42 43
|
||||
|
||||
Msg_0x87 = 0x87,
|
||||
Msg_0x88 = 0x88,
|
||||
Msg_0x80 = 0x80,
|
||||
Msg_0x28 = 0x28,
|
||||
Msg_0x11 = 0x11,
|
||||
Msg_0x45 = 0x45,
|
||||
Msg_0x89 = 0x89,
|
||||
Msg_0x86 = 0x86,
|
||||
};
|
||||
}
|
||||
|
||||
class CEventNetwork
|
||||
|
@ -83,11 +83,6 @@ namespace big
|
||||
view::always();
|
||||
}
|
||||
|
||||
void gui::script_init()
|
||||
{
|
||||
g_notification_service->push("Welcome", fmt::format("Loaded YimMenu. Press {} to open", ImGui::key_names[g->settings.hotkeys.menu_toggle]));
|
||||
}
|
||||
|
||||
void gui::script_on_tick()
|
||||
{
|
||||
TRY_CLAUSE
|
||||
@ -128,7 +123,7 @@ namespace big
|
||||
|
||||
void gui::script_func()
|
||||
{
|
||||
g_gui.script_init();
|
||||
g_notification_service->push("Welcome", fmt::format("Loaded YimMenu. Press {} to open", ImGui::key_names[g->settings.hotkeys.menu_toggle]));
|
||||
while (true)
|
||||
{
|
||||
g_gui.script_on_tick();
|
||||
|
@ -10,7 +10,6 @@ namespace big
|
||||
void dx_on_tick();
|
||||
void always_draw();
|
||||
|
||||
void script_init();
|
||||
void script_on_tick();
|
||||
static void script_func();
|
||||
public:
|
||||
|
@ -19,13 +19,9 @@ namespace big
|
||||
hooking::hooking() :
|
||||
// Swapchain
|
||||
m_swapchain_hook(*g_pointers->m_swapchain, hooks::swapchain_num_funcs),
|
||||
// SetCursorPos
|
||||
m_set_cursor_pos_hook("SCP", memory::module("user32.dll").get_export("SetCursorPos").as<void*>(), &hooks::set_cursor_pos),
|
||||
|
||||
// Script Hook
|
||||
m_run_script_threads_hook("SH", g_pointers->m_run_script_threads, &hooks::run_script_threads),
|
||||
// ConvertThreadToFibe
|
||||
m_convert_thread_to_fiber_hook("CTTF", memory::module("kernel32.dll").get_export("ConvertThreadToFiber").as<void*>(), &hooks::convert_thread_to_fiber),
|
||||
|
||||
// GTA Thead Start
|
||||
m_gta_thread_start_hook("GTS", g_pointers->m_gta_thread_start, &hooks::gta_thread_start),
|
||||
@ -80,11 +76,9 @@ namespace big
|
||||
void hooking::enable()
|
||||
{
|
||||
m_swapchain_hook.enable();
|
||||
m_og_wndproc = reinterpret_cast<WNDPROC>(SetWindowLongPtrW(g_pointers->m_hwnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(&hooks::wndproc)));
|
||||
m_set_cursor_pos_hook.enable();
|
||||
m_og_wndproc = WNDPROC(SetWindowLongPtrW(g_pointers->m_hwnd, GWLP_WNDPROC, LONG_PTR(&hooks::wndproc)));
|
||||
|
||||
m_run_script_threads_hook.enable();
|
||||
m_convert_thread_to_fiber_hook.enable();
|
||||
|
||||
m_gta_thread_start_hook.enable();
|
||||
m_gta_thread_kill_hook.enable();
|
||||
@ -137,10 +131,8 @@ namespace big
|
||||
m_gta_thread_kill_hook.disable();
|
||||
m_gta_thread_start_hook.disable();
|
||||
|
||||
m_convert_thread_to_fiber_hook.disable();
|
||||
m_run_script_threads_hook.disable();
|
||||
|
||||
m_set_cursor_pos_hook.disable();
|
||||
SetWindowLongPtrW(g_pointers->m_hwnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(m_og_wndproc));
|
||||
m_swapchain_hook.disable();
|
||||
}
|
||||
@ -164,34 +156,8 @@ namespace big
|
||||
g_script_mgr.tick();
|
||||
}
|
||||
|
||||
return g_hooking->m_run_script_threads_hook.get_original<functions::run_script_threads_t>()(ops_to_execute);
|
||||
return g_hooking->m_run_script_threads_hook.get_original<functions::run_script_threads>()(ops_to_execute);
|
||||
} EXCEPT_CLAUSE
|
||||
return false;
|
||||
}
|
||||
|
||||
void *hooks::convert_thread_to_fiber(void *param)
|
||||
{
|
||||
TRY_CLAUSE
|
||||
{
|
||||
if (IsThreadAFiber())
|
||||
{
|
||||
return GetCurrentFiber();
|
||||
}
|
||||
|
||||
return g_hooking->m_convert_thread_to_fiber_hook.get_original<decltype(&convert_thread_to_fiber)>()(param);
|
||||
} EXCEPT_CLAUSE
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BOOL hooks::set_cursor_pos(int x, int y)
|
||||
{
|
||||
TRY_CLAUSE
|
||||
{
|
||||
if (g_gui.m_opened)
|
||||
return true;
|
||||
|
||||
return g_hooking->m_set_cursor_pos_hook.get_original<decltype(&set_cursor_pos)>()(x, y);
|
||||
} EXCEPT_CLAUSE
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ namespace big
|
||||
struct hooks
|
||||
{
|
||||
static bool run_script_threads(std::uint32_t ops_to_execute);
|
||||
static void *convert_thread_to_fiber(void *param);
|
||||
|
||||
static constexpr auto swapchain_num_funcs = 19;
|
||||
static constexpr auto swapchain_present_index = 8;
|
||||
@ -21,7 +20,6 @@ namespace big
|
||||
static HRESULT swapchain_resizebuffers(IDXGISwapChain *this_, UINT buffer_count, UINT width, UINT height, DXGI_FORMAT new_format, UINT swapchain_flags);
|
||||
|
||||
static LRESULT wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
|
||||
static BOOL set_cursor_pos(int x, int y);
|
||||
|
||||
static GtaThread* gta_thread_start(unsigned int** a1, unsigned int a2);
|
||||
static rage::eThreadState gta_thread_kill(GtaThread* thread);
|
||||
@ -55,10 +53,10 @@ namespace big
|
||||
|
||||
static bool send_net_info_to_lobby(rage::netPlayerData* player, int64_t a2, int64_t a3, DWORD* a4);
|
||||
static bool receive_net_message(void* netConnectionManager, void* a2, rage::netConnection::InFrame* frame);
|
||||
static void get_network_event_data(__int64 a1, rage::CEventNetwork* net_event);
|
||||
static void get_network_event_data(int64_t unk, rage::CEventNetwork* net_event);
|
||||
|
||||
//SYNC
|
||||
static signed __int64 received_clone_sync(CNetworkObjectMgr* mgr, CNetGamePlayer* src, CNetGamePlayer* dst, unsigned __int16 sync_type, unsigned __int16 obj_id, rage::datBitBuffer* a6, unsigned __int16 a7, unsigned int timestamp);
|
||||
static int64_t received_clone_sync(CNetworkObjectMgr* mgr, CNetGamePlayer* src, CNetGamePlayer* dst, uint16_t sync_type, uint16_t obj_id, rage::datBitBuffer* bufer, uint16_t unk, uint32_t timestamp);
|
||||
};
|
||||
|
||||
struct minhook_keepalive
|
||||
@ -84,10 +82,8 @@ namespace big
|
||||
vmt_hook m_swapchain_hook;
|
||||
|
||||
WNDPROC m_og_wndproc = nullptr;
|
||||
detour_hook m_set_cursor_pos_hook;
|
||||
|
||||
detour_hook m_run_script_threads_hook;
|
||||
detour_hook m_convert_thread_to_fiber_hook;
|
||||
|
||||
detour_hook m_gta_thread_start_hook;
|
||||
detour_hook m_gta_thread_kill_hook;
|
||||
|
@ -2,11 +2,9 @@
|
||||
|
||||
namespace big
|
||||
{
|
||||
void hooks::get_network_event_data(__int64 a1, rage::CEventNetwork* net_event)
|
||||
void hooks::get_network_event_data(int64_t unk, rage::CEventNetwork* net_event)
|
||||
{
|
||||
__int64 event_type = net_event->get_type();
|
||||
|
||||
switch (event_type) {
|
||||
switch (net_event->get_type()) {
|
||||
case 161: //CEventNetworkRemovedFromSessionDueToComplaints
|
||||
{
|
||||
g_notification_service->push_warning("Kicked", "You have been desync kicked.");
|
||||
@ -14,6 +12,6 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
return g_hooking->m_get_network_event_data_hook.get_original<decltype(&get_network_event_data)>()(a1, net_event);
|
||||
return g_hooking->m_get_network_event_data_hook.get_original<decltype(&get_network_event_data)>()(unk, net_event);
|
||||
}
|
||||
}
|
@ -1,86 +1,50 @@
|
||||
#include "hooking.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
#include <natives.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
|
||||
inline bool get_message_type(rage::netConnection::MessageType& msg_type, rage::datBitBuffer& buffer)
|
||||
bool get_msg_type(rage::eNetMessage& msgType, rage::datBitBuffer& buffer)
|
||||
{
|
||||
uint32_t pos;
|
||||
uint32_t magic;
|
||||
uint32_t length;
|
||||
uint32_t extended{};
|
||||
if ((buffer.m_flagBits & 2) != 0 || (buffer.m_flagBits & 1) == 0 ? (pos = buffer.m_curBit) : (pos = buffer.m_maxBit),
|
||||
buffer.m_bitsRead + 15 > pos || !buffer.ReadDword(&magic, 14) || magic != 0x3246 || !buffer.ReadDword(&extended, 1))
|
||||
{
|
||||
msg_type = rage::netConnection::MessageType::MsgInvalid;
|
||||
buffer.m_bitsRead + 15 > pos || !buffer.ReadDword(&magic, 14) || magic != 0x3246 || !buffer.ReadDword(&extended, 1)) {
|
||||
msgType = rage::eNetMessage::CMsgInvalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
length = extended ? 16 : 8;
|
||||
|
||||
if ((buffer.m_flagBits & 1) == 0 ? (pos = buffer.m_curBit) : (pos = buffer.m_maxBit), length + buffer.m_bitsRead <= pos && buffer.ReadDword((uint32_t*)&msg_type, length))
|
||||
if ((buffer.m_flagBits & 1) == 0 ? (pos = buffer.m_curBit) : (pos = buffer.m_maxBit), length + buffer.m_bitsRead <= pos && buffer.ReadDword((uint32_t*)&msgType, length))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool hooks::receive_net_message(void* netConnectionManager, void* a2, rage::netConnection::InFrame* frame)
|
||||
{
|
||||
if (frame->get_type() == 4)
|
||||
{
|
||||
rage::datBitBuffer buffer((uint8_t*)frame->m_data, frame->m_length);
|
||||
buffer.m_flagBits = 1;
|
||||
rage::netConnection::MessageType msg_type;
|
||||
|
||||
rage::eNetMessage msgType;
|
||||
const auto player = g_player_service->get_by_msg_id(frame->m_msg_id);
|
||||
if (player && get_message_type(msg_type, buffer))
|
||||
if (player && get_msg_type(msgType, buffer))
|
||||
{
|
||||
switch (msg_type)
|
||||
switch (msgType)
|
||||
{
|
||||
//Desync Kick
|
||||
case rage::netConnection::MessageType::MsgNetComplaint:
|
||||
case rage::eNetMessage::CMsgNetComplaint:
|
||||
{
|
||||
uint64_t host_token{};
|
||||
buffer.ReadQWord(&host_token, 64);
|
||||
|
||||
std::vector<CNetGamePlayer*> players;
|
||||
|
||||
uint32_t num_of_host_token{};
|
||||
buffer.ReadDword(&num_of_host_token, 32);
|
||||
|
||||
if (num_of_host_token <= 64) {
|
||||
|
||||
std::vector<uint64_t> host_token_list{};
|
||||
for (uint32_t i = 0; i < num_of_host_token; i++) {
|
||||
|
||||
uint64_t array_element{};
|
||||
buffer.ReadQWord(&array_element, 64);
|
||||
host_token_list.push_back(array_element);
|
||||
|
||||
const auto big_player = g_player_service->get_by_host_token(array_element);
|
||||
if (big_player)
|
||||
if (CNetGamePlayer* net_player = big_player->get_net_game_player())
|
||||
players.push_back(net_player);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
uint64_t hostToken;
|
||||
buffer.ReadQWord(&hostToken, 0x40);
|
||||
buffer.Seek(0);
|
||||
player_ptr sender = g_player_service->get_by_host_token(hostToken);
|
||||
sender->get_net_game_player()->m_complaints = USHRT_MAX; //Sender
|
||||
g_notification_service->push_warning("Blocked Kick", fmt::format("Desync kick from {}", sender->get_name()));
|
||||
buffer.Seek(0);
|
||||
|
||||
if (!players.empty())
|
||||
{
|
||||
const auto& player = players.at(0);
|
||||
if (player && player->is_valid())
|
||||
{
|
||||
player->m_complaints = 65535;
|
||||
g_notification_service->push_warning("Blocked Kick", std::string("Blocked desync kick from ") + player->get_name());
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,14 +26,7 @@ namespace big {
|
||||
*/
|
||||
|
||||
|
||||
signed __int64 hooks::received_clone_sync(CNetworkObjectMgr* mgr,
|
||||
CNetGamePlayer* src,
|
||||
CNetGamePlayer* dst,
|
||||
unsigned __int16 sync_type,
|
||||
unsigned __int16 obj_id,
|
||||
rage::datBitBuffer* buffer,
|
||||
unsigned __int16 a7,
|
||||
unsigned int timestamp) {
|
||||
int64_t hooks::received_clone_sync(CNetworkObjectMgr* mgr, CNetGamePlayer* src, CNetGamePlayer* dst, uint16_t sync_type, uint16_t obj_id, rage::datBitBuffer* buffer, uint16_t unk, uint32_t timestamp) {
|
||||
|
||||
auto sync_tree = g_pointers->m_get_sync_tree_for_type(mgr, sync_type);
|
||||
auto tree_name = g_pointers->m_get_sync_type_info(sync_type, 0);
|
||||
@ -53,14 +46,15 @@ namespace big {
|
||||
|
||||
|
||||
if (invalidsync) {
|
||||
|
||||
if (g->notifications.invalid_sync.log) LOG(WARNING) << "Invalid sync: " << "Type: " << sync_type << " Tree name: " << tree_name << " From: " << src->get_name();
|
||||
if (g->notifications.invalid_sync.notify) g_notification_service->push_warning("Invalid sync " + std::string(src->get_name()), "Type: " + std::to_string(sync_type) + "\nType name: " + tree_name);
|
||||
if (g->notifications.invalid_sync.log)
|
||||
LOG(WARNING) << "Invalid sync: " << "Type: " << sync_type << " Tree name: " << tree_name << " From: " << src->get_name();
|
||||
if (g->notifications.invalid_sync.notify)
|
||||
g_notification_service->push_warning(fmt::format("Invalid Sync from {}", src->get_name()), fmt::format("Type {} in sync tree {}", sync_type, tree_name));
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
auto result = g_hooking->m_received_clone_sync_hook.get_original<decltype(&received_clone_sync)>()(mgr, src, dst, sync_type, obj_id, buffer, a7, timestamp);
|
||||
auto result = g_hooking->m_received_clone_sync_hook.get_original<decltype(&received_clone_sync)>()(mgr, src, dst, sync_type, obj_id, buffer, unk, timestamp);
|
||||
|
||||
return result;
|
||||
|
||||
|
@ -29,9 +29,9 @@ namespace big
|
||||
return;
|
||||
}
|
||||
|
||||
switch ((RockstarEvent)event_id)
|
||||
switch (static_cast<eNetworkEvents>(event_id))
|
||||
{
|
||||
case RockstarEvent::NETWORK_INCREMENT_STAT_EVENT:
|
||||
case eNetworkEvents::CNetworkIncrementStatEvent:
|
||||
{
|
||||
const auto increment_stat_event = std::make_unique<CNetworkIncrementStatEvent>();
|
||||
buffer->ReadDword(&increment_stat_event->m_stat, 0x20);
|
||||
@ -45,7 +45,7 @@ namespace big
|
||||
buffer->Seek(0);
|
||||
break;
|
||||
}
|
||||
case RockstarEvent::SCRIPT_ENTITY_STATE_CHANGE_EVENT:
|
||||
case eNetworkEvents::CScriptEntityStateChangeEvent:
|
||||
{
|
||||
uint16_t entity;
|
||||
buffer->ReadWord(&entity, 13);
|
||||
@ -53,21 +53,15 @@ namespace big
|
||||
buffer->ReadDword(&type, 4);
|
||||
uint32_t unk;
|
||||
buffer->ReadDword(&unk, 32);
|
||||
|
||||
if (type == 6)
|
||||
{
|
||||
if (type == 6) {
|
||||
uint16_t unk2;
|
||||
buffer->ReadWord(&unk2, 13);
|
||||
uint32_t action;
|
||||
buffer->ReadDword(&action, 8);
|
||||
|
||||
if (action >= 15 && action <= 18)
|
||||
{
|
||||
if (action >= 15 && action <= 18) {
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
|
||||
if (g->notifications.received_event.vehicle_temp_action.log)
|
||||
LOG(INFO) << "RECEIVED_EVENT_HANDLER : " << source_player->get_name() << "sent TASK_VEHICLE_TEMP_ACTION crash.";
|
||||
|
||||
if (g->notifications.received_event.vehicle_temp_action.notify)
|
||||
g_notification_service->push_warning("Protection",
|
||||
fmt::format("{} sent TASK_VEHICLE_TEMP_ACTION crash.", source_player->get_name()));
|
||||
@ -78,7 +72,7 @@ namespace big
|
||||
buffer->Seek(0);
|
||||
break;
|
||||
}
|
||||
case RockstarEvent::SCRIPTED_GAME_EVENT:
|
||||
case eNetworkEvents::CScriptedGameEvent:
|
||||
{
|
||||
const auto scripted_game_event = std::make_unique<CScriptedGameEvent>();
|
||||
buffer->ReadDword(&scripted_game_event->m_args_size, 32);
|
||||
@ -95,7 +89,7 @@ namespace big
|
||||
|
||||
break;
|
||||
}
|
||||
case RockstarEvent::NETWORK_CLEAR_PED_TASKS_EVENT:
|
||||
case eNetworkEvents::CNetworkClearPedTasksEvent:
|
||||
{
|
||||
if (source_player->m_player_id < 32)
|
||||
{
|
||||
@ -116,7 +110,7 @@ namespace big
|
||||
}
|
||||
// Don't block this event, we still want to report this player
|
||||
// because if we still report others, our account seems less fishy
|
||||
case RockstarEvent::REPORT_CASH_SPAWN_EVENT:
|
||||
case eNetworkEvents::CReportCashSpawnEvent:
|
||||
{
|
||||
uint32_t money;
|
||||
|
||||
@ -138,8 +132,8 @@ namespace big
|
||||
break;
|
||||
}
|
||||
// player sending this event is a modder
|
||||
case RockstarEvent::NETWORK_CHECK_CODE_CRCS_EVENT:
|
||||
case RockstarEvent::REPORT_MYSELF_EVENT:
|
||||
case eNetworkEvents::CNetworkCheckCodeCrcsEvent:
|
||||
case eNetworkEvents::CUpdateFxnEvent:
|
||||
{
|
||||
if (g->notifications.received_event.modder_detect.log)
|
||||
LOG(INFO) << "RECEIVED_EVENT_HANDLER : " << source_player->get_name() << " sent modder event.";
|
||||
@ -151,7 +145,7 @@ namespace big
|
||||
|
||||
break;
|
||||
}
|
||||
case RockstarEvent::REQUEST_CONTROL_EVENT:
|
||||
case eNetworkEvents::CRequestControlEvent:
|
||||
{
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "common.hpp"
|
||||
#include "core/globals.hpp"
|
||||
#include "features.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "gui.hpp"
|
||||
#include "logger.hpp"
|
||||
@ -82,9 +81,9 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID)
|
||||
auto gui_service_instance = std::make_unique<gui_service>();
|
||||
LOG(INFO) << "Registered service instances...";
|
||||
|
||||
g_script_mgr.add_script(std::make_unique<script>(&features::script_func, "Backend Main", false));
|
||||
g_script_mgr.add_script(std::make_unique<script>(&gui::script_func, "GUI", false));
|
||||
|
||||
g_script_mgr.add_script(std::make_unique<script>(&backend::loop, "Backend Loop", false));
|
||||
g_script_mgr.add_script(std::make_unique<script>(&backend::self_loop, "Self"));
|
||||
g_script_mgr.add_script(std::make_unique<script>(&backend::weapons_loop, "Weapon"));
|
||||
g_script_mgr.add_script(std::make_unique<script>(&backend::vehicles_loop, "Vehicle"));
|
||||
|
@ -42,20 +42,20 @@ namespace big
|
||||
main_batch.add("NH", "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>();
|
||||
m_get_native_handler = ptr.add(12).rip().as<functions::get_native_handler>();
|
||||
});
|
||||
|
||||
// Fix Vectors
|
||||
main_batch.add("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", [this](memory::handle ptr)
|
||||
{
|
||||
m_fix_vectors = ptr.as<functions::fix_vectors_t>();
|
||||
m_fix_vectors = ptr.as<functions::fix_vectors>();
|
||||
});
|
||||
|
||||
// Script Threads
|
||||
main_batch.add("ST", "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>();
|
||||
m_run_script_threads = ptr.sub(0x1F).as<functions::run_script_threads>();
|
||||
});
|
||||
|
||||
// Script Programs
|
||||
@ -120,6 +120,13 @@ namespace big
|
||||
m_received_event = ptr.as<decltype(m_received_event)>();
|
||||
});
|
||||
|
||||
// Send Event Acknowledge
|
||||
main_batch.add("SEA", "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
|
||||
|
||||
// Read Bitbugger WORD/DWORD
|
||||
main_batch.add("RBWD", "48 89 74 24 ? 57 48 83 EC 20 48 8B D9 33 C9 41 8B F0 8A", [this](memory::handle ptr)
|
||||
{
|
||||
@ -132,12 +139,65 @@ namespace big
|
||||
m_read_bitbuf_array = ptr.as<decltype(m_read_bitbuf_array)>();
|
||||
});
|
||||
|
||||
// Send Event Acknowledge
|
||||
main_batch.add("SEA", "48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 20 80 7A", [this](memory::handle ptr)
|
||||
// Read Bitbuffer WORD/DWORD
|
||||
main_batch.add("RBD", "48 89 74 24 ? 57 48 83 EC 20 48 8B D9 33 C9 41 8B F0 8A", [this](memory::handle ptr)
|
||||
{
|
||||
m_send_event_ack = ptr.sub(5).as<decltype(m_send_event_ack)>();
|
||||
m_read_bitbuf_dword = ptr.sub(5).as<decltype(m_read_bitbuf_dword)>();
|
||||
});
|
||||
|
||||
// Read Bitbuffer String
|
||||
main_batch.add("RBS", "E8 ? ? ? ? 48 8D 4F 3C", [this](memory::handle ptr)
|
||||
{
|
||||
m_read_bitbuf_string = ptr.add(1).rip().as<decltype(m_read_bitbuf_string)>();
|
||||
});
|
||||
|
||||
// Read Bitbuffer Boolean
|
||||
main_batch.add("RBB", "E8 ? ? ? ? 84 C0 74 2D 48 8D 57 20", [this](memory::handle ptr)
|
||||
{
|
||||
m_read_bitbuf_bool = ptr.add(1).rip().as<decltype(m_read_bitbuf_bool)>();
|
||||
});
|
||||
|
||||
// Read Bitbuffer Arrau
|
||||
main_batch.add("RBA", "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)>();
|
||||
});
|
||||
|
||||
// Write Bitbuffer WORD/DWORD
|
||||
main_batch.add("WBD", "48 8B C4 48 89 58 08 48 89 68 10 48 89 70 18 48 89 78 20 41 56 48 83 EC 20 8B EA BF 01 ? ? ?", [this](memory::handle ptr)
|
||||
{
|
||||
m_write_bitbuf_dword = ptr.as<decltype(m_write_bitbuf_dword)>();
|
||||
});
|
||||
|
||||
// Write Bitbuffer QWORD
|
||||
main_batch.add("WBQ", "48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 48 83 EC 20 41 8B F0 48 8B EA 48 8B D9 41 83 F8 20", [this](memory::handle ptr)
|
||||
{
|
||||
m_write_bitbuf_qword = ptr.as<decltype( m_write_bitbuf_qword)>();
|
||||
});
|
||||
|
||||
// Write Bitbuffer Int64
|
||||
main_batch.add("WBI64", "E8 ? ? ? ? 8A 53 39 48 8B CF", [this](memory::handle ptr)
|
||||
{
|
||||
m_write_bitbuf_int64 = ptr.add(1).rip().as<decltype(m_write_bitbuf_int64)>();
|
||||
});
|
||||
|
||||
// Write Bitbuffer Int32
|
||||
main_batch.add("WBI32", "E8 ? ? ? ? 8A 53 74", [this](memory::handle ptr)
|
||||
{
|
||||
m_write_bitbuf_int32 = ptr.add(1).rip().as<decltype(m_write_bitbuf_int32)>();
|
||||
});
|
||||
|
||||
// Write Bitbuffer Boolean
|
||||
main_batch.add("WBB", "E8 ? ? ? ? 8A 57 39", [this](memory::handle ptr)
|
||||
{
|
||||
m_write_bitbuf_bool = ptr.add(1).rip().as<decltype(m_write_bitbuf_bool)>();
|
||||
});
|
||||
|
||||
// Write Bitbuffer Array
|
||||
main_batch.add("WBA", "E8 ? ? ? ? 01 7E 08", [this](memory::handle ptr)
|
||||
{
|
||||
m_write_bitbuf_array = ptr.add(1).rip().as<decltype(m_write_bitbuf_array)>();
|
||||
});
|
||||
// Received Event Signatures END
|
||||
|
||||
// Request Control of Entity PATCH
|
||||
main_batch.add("RCOE-Patch", "48 89 5C 24 ? 57 48 83 EC 20 8B D9 E8 ? ? ? ? ? ? ? ? 8B CB", [this](memory::handle ptr)
|
||||
@ -215,13 +275,13 @@ namespace big
|
||||
// GET_SCREEN_COORDS_FROM_WORLD_COORDS
|
||||
main_batch.add("GSCFWC", "E8 ? ? ? ? 84 C0 74 19 F3 0F 10 44 24", [this](memory::handle ptr)
|
||||
{
|
||||
m_get_screen_coords_for_world_coords = ptr.add(1).rip().as<functions::get_screen_coords_for_world_coords*>();
|
||||
m_get_screen_coords_for_world_coords = ptr.add(1).rip().as<functions::get_screen_coords_for_world_coords>();
|
||||
});
|
||||
|
||||
// Get Gameplay Cam Coords
|
||||
main_batch.add("GGCC", "8B 90 ? ? ? ? 89 13", [this](memory::handle ptr)
|
||||
{
|
||||
m_get_gamplay_cam_coords = ptr.sub(0xE).as<functions::get_gameplay_cam_coords*>();
|
||||
m_get_gameplay_cam_coords = ptr.sub(0xE).as<functions::get_gameplay_cam_coords>();
|
||||
});
|
||||
|
||||
// Give Pickup Reward
|
||||
|
@ -19,28 +19,27 @@ namespace big
|
||||
public:
|
||||
HWND m_hwnd{};
|
||||
|
||||
eGameState *m_game_state{};
|
||||
bool *m_is_session_started{};
|
||||
eGameState* m_game_state{};
|
||||
bool* m_is_session_started{};
|
||||
|
||||
CPedFactory** m_ped_factory{};
|
||||
CNetworkPlayerMgr** m_network_player_mgr{};
|
||||
CNetworkObjectMgr** m_network_object_mgr{};
|
||||
|
||||
rage::CReplayInterface** m_replay_interface{};
|
||||
functions::ptr_to_handle* m_ptr_to_handle{};
|
||||
|
||||
rage::scrNativeRegistrationTable *m_native_registration_table{};
|
||||
functions::get_native_handler_t m_get_native_handler{};
|
||||
functions::fix_vectors_t m_fix_vectors{};
|
||||
functions::ptr_to_handle m_ptr_to_handle{};
|
||||
rage::scrNativeRegistrationTable* m_native_registration_table{};
|
||||
functions::get_native_handler m_get_native_handler{};
|
||||
functions::fix_vectors m_fix_vectors{};
|
||||
|
||||
rage::atArray<GtaThread*> *m_script_threads{};
|
||||
rage::scrProgramTable *m_script_program_table{};
|
||||
functions::run_script_threads_t m_run_script_threads{};
|
||||
std::int64_t **m_script_globals{};
|
||||
rage::atArray<GtaThread*>* m_script_threads{};
|
||||
rage::scrProgramTable* m_script_program_table{};
|
||||
functions::run_script_threads m_run_script_threads{};
|
||||
std::int64_t** m_script_globals{};
|
||||
|
||||
CGameScriptHandlerMgr **m_script_handler_mgr{};
|
||||
CGameScriptHandlerMgr** m_script_handler_mgr{};
|
||||
|
||||
IDXGISwapChain **m_swapchain{};
|
||||
IDXGISwapChain** m_swapchain{};
|
||||
|
||||
int* m_resolution_x;
|
||||
int* m_resolution_y;
|
||||
@ -54,7 +53,7 @@ namespace big
|
||||
|
||||
FriendRegistry* m_friend_registry{};
|
||||
|
||||
functions::get_screen_coords_for_world_coords* m_get_screen_coords_for_world_coords{};
|
||||
functions::get_screen_coords_for_world_coords m_get_screen_coords_for_world_coords{};
|
||||
|
||||
HashTable<CBaseModelInfo*>* m_model_table;
|
||||
|
||||
@ -68,33 +67,43 @@ namespace big
|
||||
PVOID m_player_has_joined{};
|
||||
PVOID m_player_has_left{};
|
||||
|
||||
functions::get_gameplay_cam_coords* m_get_gamplay_cam_coords;
|
||||
functions::get_gameplay_cam_coords m_get_gameplay_cam_coords;
|
||||
|
||||
functions::give_pickup_rewards* m_give_pickup_rewards{};
|
||||
functions::give_pickup_rewards m_give_pickup_rewards{};
|
||||
|
||||
functions::trigger_script_event* m_trigger_script_event{};
|
||||
functions::trigger_script_event m_trigger_script_event{};
|
||||
|
||||
// Bitbuffer Read/Write START
|
||||
functions::read_bitbuf_dword m_read_bitbuf_dword{};
|
||||
functions::read_bitbuf_string m_read_bitbuf_string{};
|
||||
functions::read_bitbuf_bool m_read_bitbuf_bool{};
|
||||
functions::read_bitbuf_array m_read_bitbuf_array{};
|
||||
functions::write_bitbuf_qword m_write_bitbuf_qword{};
|
||||
functions::write_bitbuf_dword m_write_bitbuf_dword{};
|
||||
functions::write_bitbuf_int64 m_write_bitbuf_int64{};
|
||||
functions::write_bitbuf_int32 m_write_bitbuf_int32{};
|
||||
functions::write_bitbuf_bool m_write_bitbuf_bool{};
|
||||
functions::write_bitbuf_array m_write_bitbuf_array{};
|
||||
// Bitbuffer Read/Write END
|
||||
|
||||
// Received Event Signatures START
|
||||
functions::read_bitbuf_array* m_read_bitbuf_array{};
|
||||
functions::read_bitbuf_dword* m_read_bitbuf_dword{};
|
||||
PVOID m_received_event{};
|
||||
functions::send_event_ack* m_send_event_ack{};
|
||||
functions::send_event_ack m_send_event_ack{};
|
||||
// Received Event Signatures END
|
||||
|
||||
//Sync Signatures START
|
||||
PVOID m_received_clone_sync;
|
||||
functions::get_sync_tree_for_type* m_get_sync_tree_for_type{};
|
||||
functions::get_sync_type_info* m_get_sync_type_info{};
|
||||
functions::get_net_object* m_get_net_object{};
|
||||
functions::get_net_object_for_player* m_get_net_object_for_player{};
|
||||
functions::get_sync_tree_for_type m_get_sync_tree_for_type{};
|
||||
functions::get_sync_type_info m_get_sync_type_info{};
|
||||
functions::get_net_object m_get_net_object{};
|
||||
functions::get_net_object_for_player m_get_net_object_for_player{};
|
||||
//Sync Signatures END
|
||||
|
||||
PVOID m_send_net_info_to_lobby{};
|
||||
|
||||
PVOID m_receive_net_message{};
|
||||
PVOID m_get_network_event_data{};
|
||||
|
||||
};
|
||||
|
||||
inline pointers *g_pointers{};
|
||||
inline pointers* g_pointers{};
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ namespace big::math
|
||||
inline float calculate_distance_from_game_cam (rage::fvector3 player_position)
|
||||
{
|
||||
const Vector3 plyr_coords = { player_position.x, player_position.y, player_position.z };
|
||||
const Vector3 cam_coords = g_pointers->m_get_gamplay_cam_coords();
|
||||
const Vector3 cam_coords = g_pointers->m_get_gameplay_cam_coords();
|
||||
|
||||
return (float)distance_between_vectors(plyr_coords, cam_coords);
|
||||
}
|
||||
|
Reference in New Issue
Block a user