RECEIVED_CLONE_REMOVE player ped removal protection (#2732)
This commit is contained in:
parent
d737c01b33
commit
3a8aed2d00
@ -208,4 +208,6 @@ namespace big::functions
|
||||
using remove_player_from_sender_list = bool (*)(void* list, uint64_t* rockstar_id);
|
||||
|
||||
using get_ped_seat = CGetPedSeatReturnClass*(*)(PVOID seat_info, CPed* ped);
|
||||
|
||||
using received_clone_remove = void (*)(CNetworkObjectMgr*, CNetGamePlayer*, CNetGamePlayer*, int16_t, uint32_t);
|
||||
}
|
||||
|
@ -360,6 +360,8 @@ namespace big
|
||||
bool* m_is_social_club_overlay_active;
|
||||
|
||||
functions::get_ped_seat m_get_ped_seat;
|
||||
|
||||
functions::received_clone_remove m_received_clone_remove;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
static_assert(sizeof(gta_pointers) % 8 == 0, "Pointers are not properly aligned");
|
||||
|
@ -138,6 +138,8 @@ namespace big
|
||||
|
||||
detour_hook_helper::add<hooks::read_bits_single>("RBS", g_pointers->m_gta.m_read_bits_single);
|
||||
|
||||
detour_hook_helper::add<hooks::received_clone_remove>("RCR", g_pointers->m_gta.m_received_clone_remove);
|
||||
|
||||
g_hooking = this;
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
#include "MinHook.h"
|
||||
|
||||
#include "detour_hook.hpp"
|
||||
#include "vmt_hook.hpp"
|
||||
#include "vtable_hook.hpp"
|
||||
|
||||
#include <gta/enums.hpp>
|
||||
#include <network/netConnection.hpp> // cannot stub this
|
||||
|
||||
class CPlayerGamerDataNode;
|
||||
@ -176,6 +176,8 @@ namespace big
|
||||
|
||||
static bool read_bits_single(void* data, int* out_value, int size, int offset);
|
||||
|
||||
static void received_clone_remove(CNetworkObjectMgr* mgr, CNetGamePlayer* src, CNetGamePlayer* dst, int16_t object_id, uint32_t ownership_token);
|
||||
|
||||
static bool sync_reader_serialize_dword(void* _this, uint32_t* dword, int size);
|
||||
static bool sync_reader_serialize_word(void* _this, uint16_t* word, int size);
|
||||
static bool sync_reader_serialize_byte(void* _this, uint8_t* byte, int size);
|
||||
|
16
src/hooks/protections/received_clone_remove.cpp
Normal file
16
src/hooks/protections/received_clone_remove.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "util/notify.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void hooks::received_clone_remove(CNetworkObjectMgr* mgr, CNetGamePlayer* src, CNetGamePlayer* dst, int16_t object_id, uint32_t ownership_token)
|
||||
{
|
||||
if (dst->m_player_info->m_ped->m_net_object->m_object_id == object_id)
|
||||
{
|
||||
notify::crash_blocked(src, "player ped removal");
|
||||
return;
|
||||
}
|
||||
|
||||
g_hooking->get_original<hooks::received_clone_remove>()(mgr, src, dst, object_id, ownership_token);
|
||||
}
|
||||
}
|
@ -1754,6 +1754,15 @@ namespace big
|
||||
{
|
||||
g_pointers->m_gta.m_get_ped_seat = ptr.add(1).rip().as<functions::get_ped_seat>();
|
||||
}
|
||||
},
|
||||
// RECEIVED_CLONE_REMOVE
|
||||
{
|
||||
"RCR",
|
||||
"48 8B C4 48 89 58 08 48 89 68 10 48 89 70 18 48 89 78 20 41 54 41 56 41 57 48 83 EC 50 4C 8B F2 4D 8B E0",
|
||||
[](memory::handle ptr)
|
||||
{
|
||||
g_pointers->m_gta.m_received_clone_remove = ptr.as<functions::received_clone_remove>();
|
||||
}
|
||||
}
|
||||
>(); // don't leave a trailing comma at the end
|
||||
|
||||
|
Reference in New Issue
Block a user