Chat delay fix and improved crash protections (#1572)
* feat(protections): filter invalid sector position from the player game state data node * feat(chat): bypass chat delay * fix(world): fix auto disarm * fix(chat): true instant messaging
This commit is contained in:
parent
a43d3d8824
commit
57ac1a315c
@ -25,7 +25,7 @@ namespace big
|
||||
|
||||
if (!PED::IS_PED_A_PLAYER(handle) && ENTITY::DOES_ENTITY_EXIST(PED::GET_PED_TARGET_FROM_COMBAT_PED(handle, false)))
|
||||
{
|
||||
if (entity::take_control_of(handle))
|
||||
if (entity::take_control_of(handle, 0))
|
||||
{
|
||||
if (WEAPON::IS_PED_ARMED(handle, 1 | 2 | 4))
|
||||
WEAPON::REMOVE_ALL_PED_WEAPONS(handle, false);
|
||||
|
@ -261,12 +261,11 @@ namespace big
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(script_events, bounty, ceo_money, clear_wanted_level, fake_deposit, force_mission, force_teleport, gta_banner, mc_teleport, personal_vehicle_destroyed, remote_off_radar, rotate_cam, send_to_cutscene, send_to_location, sound_spam, spectate, give_collectible, vehicle_kick, teleport_to_warehouse, start_activity, send_sms)
|
||||
} script_events{};
|
||||
|
||||
bool rid_join = false;
|
||||
bool lessen_breakups = false; // disabled by default due to anticheat concerns
|
||||
bool receive_pickup = false;
|
||||
bool admin_check = true;
|
||||
bool rid_join = false;
|
||||
bool receive_pickup = false;
|
||||
bool admin_check = true;
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(protections, script_events, rid_join, lessen_breakups, receive_pickup, admin_check)
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(protections, script_events, rid_join, receive_pickup, admin_check)
|
||||
} protections{};
|
||||
|
||||
struct self
|
||||
|
@ -93,9 +93,9 @@ namespace big::functions
|
||||
|
||||
using get_gamer_online_state = bool (*)(int profile_index, rage::rlGamerHandle* handles, std::uint32_t count, int* online_state, rage::rlTaskStatus* status);
|
||||
using start_get_session_by_gamer_handle = bool (*)(int profile_index, rage::rlGamerHandle* handles, int count, rage::rlSessionByGamerTaskResult* result, int unk, bool* success, rage::rlTaskStatus* state);
|
||||
using start_matchmaking_find_sessions = bool (*)(int profile_index, int available_slots, NetworkGameFilterMatchmakingComponent* m_filter, unsigned int max_sessions, rage::rlSessionInfo* result_sessions, int* result_session_count, rage::rlTaskStatus* state);
|
||||
using start_get_presence_attributes = bool (*)(int profile_index, rage::rlScHandle* handle, rage::rlQueryPresenceAttributesContext* contexts, int count, rage::rlTaskStatus* state);
|
||||
using join_session_by_info = bool (*)(Network* network, rage::rlSessionInfo* info, int unk, int flags, rage::rlGamerHandle* handles, int handlecount);
|
||||
using start_matchmaking_find_sessions = bool (*)(int profile_index, int available_slots, NetworkGameFilterMatchmakingComponent* m_filter, unsigned int max_sessions, rage::rlSessionInfo* result_sessions, int* result_session_count, rage::rlTaskStatus* state);
|
||||
using start_get_presence_attributes = bool (*)(int profile_index, rage::rlScHandle* handle, rage::rlQueryPresenceAttributesContext* contexts, int count, rage::rlTaskStatus* state);
|
||||
using join_session_by_info = bool (*)(Network* network, rage::rlSessionInfo* info, int unk, int flags, rage::rlGamerHandle* handles, int handlecount);
|
||||
|
||||
using generate_uuid = bool (*)(std::uint64_t* uuid);
|
||||
|
||||
@ -110,10 +110,10 @@ namespace big::functions
|
||||
using send_chat_message = bool (*)(int64_t* send_chat_ptr, rage::rlGamerInfo* gamer_info, char* message, bool is_team);
|
||||
|
||||
using send_network_damage = void (*)(rage::CEntity* source, rage::CEntity* target, rage::fvector3* position, int hit_component, bool override_default_damage, int weapon_type, float override_damage, int tire_index, int suspension_index, int flags, std::uint32_t action_result_hash, std::int16_t action_result_id, int action_unk, bool hit_weapon, bool hit_weapon_ammo_attachment, bool silenced, bool unk, rage::fvector3* impact_direction);
|
||||
using request_ragdoll = void (*)(uint16_t object_id);
|
||||
using request_control = void (*)(rage::netObject* net_object);
|
||||
using request_ragdoll = void (*)(uint16_t object_id);
|
||||
using request_control = void (*)(rage::netObject* net_object);
|
||||
|
||||
using get_connection_peer = rage::netConnectionPeer* (*)(rage::netConnectionManager* manager, int peer_id);
|
||||
using get_connection_peer = rage::netConnectionPeer* (*)(rage::netConnectionManager* manager, int peer_id);
|
||||
using send_remove_gamer_cmd = void (*)(rage::netConnectionManager* net_connection_mgr, rage::netConnectionPeer* player, int connection_id, rage::snMsgRemoveGamersFromSessionCmd* cmd, int flags);
|
||||
using handle_remove_gamer_cmd = void* (*)(rage::snSession* session, rage::snPlayer* origin, rage::snMsgRemoveGamersFromSessionCmd* cmd);
|
||||
|
||||
@ -128,8 +128,8 @@ namespace big::functions
|
||||
using save_json_data = char* (*)(datafile_commands::SveFileObject* object, int* out_length, const char* reason);
|
||||
|
||||
using sync_network_time = bool (*)(rage::netConnectionManager* mgr, rage::netConnectionPeer* peer, int connection_id, rage::netTimeSyncMsg* msg, int flags);
|
||||
using send_packet = bool (*)(rage::netConnectionManager* mgr, rage::netConnectionPeer* peer, int connection_id, void* data, int size, int flags);
|
||||
using connect_to_peer = bool (*)(rage::netConnectionManager* mgr, rage::rlGamerInfoBase* gamer_info, rage::snConnectToPeerTaskData* data, rage::snConnectToPeerTaskResult* result, rage::rlTaskStatus* status);
|
||||
using send_packet = bool (*)(rage::netConnectionManager* mgr, rage::netConnectionPeer* peer, int connection_id, void* data, int size, int flags);
|
||||
using connect_to_peer = bool (*)(rage::netConnectionManager* mgr, rage::rlGamerInfoBase* gamer_info, rage::snConnectToPeerTaskData* data, rage::snConnectToPeerTaskResult* result, rage::rlTaskStatus* status);
|
||||
|
||||
using clear_ped_tasks_network = void (*)(CPed* ped, bool immediately);
|
||||
|
||||
@ -137,4 +137,6 @@ namespace big::functions
|
||||
using get_entity_attached_to = rage::CDynamicEntity* (*)(rage::CDynamicEntity* entity);
|
||||
|
||||
using migrate_object = void (*)(CNetGamePlayer* player, rage::netObject* object, int type);
|
||||
|
||||
using handle_chat_message = void (*)(void* chat_data, void*, rage::rlGamerHandle* handle, const char* text, bool is_team);
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
#include "fwddec.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include <base/atRTTI.hpp>
|
||||
|
||||
#include <base/atRTTI.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
#pragma pack(push, 1)
|
||||
@ -31,9 +31,9 @@ namespace rage
|
||||
virtual bool SerializeFloat(float* flt, float divisor, int size) = 0;
|
||||
virtual bool SerializeNetworkId(uint16_t* net_id) = 0;
|
||||
virtual bool SerializeVector3(rage::fvector3* vec3, float divisor, int size) = 0;
|
||||
virtual bool SerializeQuaternion(void* unk) = 0;// i have no clue what that is
|
||||
virtual bool SerializeQuaternion(void* unk) = 0; // i have no clue what that is
|
||||
virtual bool SerializeVector3SignedZComponent(rage::fvector3* vec3, float divisor, int size) = 0;
|
||||
virtual bool SerializeOrientation(rage::fvector4* vec4, float size) = 0;// yes, the size is a float
|
||||
virtual bool SerializeOrientation(rage::fvector4* vec4, float size) = 0; // yes, the size is a float
|
||||
virtual bool SerializeArray(void* array, int size) = 0;
|
||||
virtual bool SerializeString(char* str, int max_length) = 0;
|
||||
virtual bool IsSizeCalculator() = 0;
|
||||
@ -212,6 +212,16 @@ namespace rage
|
||||
{
|
||||
return big::g_pointers->m_gta.m_write_bitbuf_array(this, array, size, 0);
|
||||
}
|
||||
|
||||
void WriteString(char* string, int max_len)
|
||||
{
|
||||
auto len = std::min(max_len, (int)strlen(string) + 1);
|
||||
bool extended = len > 127;
|
||||
Write<bool>(extended, 1);
|
||||
Write<int>(len, extended ? 15 : 7);
|
||||
WriteArray(string, 8 * len);
|
||||
}
|
||||
|
||||
bool ReadArray(PVOID array, int size)
|
||||
{
|
||||
return big::g_pointers->m_gta.m_read_bitbuf_array(this, array, size, 0);
|
||||
@ -291,13 +301,13 @@ namespace rage
|
||||
}
|
||||
|
||||
public:
|
||||
void* 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_highestBitsRead;//0x0018
|
||||
uint8_t m_flagBits; //0x001C
|
||||
void* 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_highestBitsRead; //0x0018
|
||||
uint8_t m_flagBits; //0x001C
|
||||
};
|
||||
|
||||
enum class eNetMessage : uint32_t
|
||||
@ -318,7 +328,7 @@ namespace rage
|
||||
MsgConfigResponse = 0x5F,
|
||||
MsgConfigRequest = 0x48,
|
||||
MsgChangeSessionAttributesCmd = 0x5A,
|
||||
MsgAddGamerToSessionCmd = 0x64,// this is where send net info to lobby is called, among other things
|
||||
MsgAddGamerToSessionCmd = 0x64, // this is where send net info to lobby is called, among other things
|
||||
MsgReassignResponse = 0x10,
|
||||
MsgReassignNegotiate = 0x01,
|
||||
MsgReassignConfirm = 0x26,
|
||||
@ -342,20 +352,20 @@ namespace rage
|
||||
MsgScriptHostRequest = 0x67,
|
||||
MsgScriptHandshakeAck = 0x5B,
|
||||
MsgScriptHandshake = 0x57,
|
||||
MsgScriptBotLeave = 0x2B,// unused?
|
||||
MsgScriptBotJoinAck = 0x63,// unused?
|
||||
MsgScriptBotJoin = 0x1C,// unused?
|
||||
MsgScriptBotHandshakeAck = 0x31,// unused?
|
||||
MsgScriptBotHandshake = 0x4B,// unused?
|
||||
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?
|
||||
MsgCloneSync = 0x4E, // aka clone_create, clone_sync etc.
|
||||
MsgActivateNetworkBot = 0x65, // unused?
|
||||
MsgRequestObjectIds = 0x29,
|
||||
MsgInformObjectIds = 0x09,
|
||||
MsgTextMessage = 0x24,// this one is for chat
|
||||
MsgTextMessage = 0x24, // this one is for chat
|
||||
MsgPlayerIsTyping = 0x61,
|
||||
MsgPackedEvents = 0x4F,// aka received_event
|
||||
MsgPackedEvents = 0x4F, // aka received_event
|
||||
MsgPackedEventReliablesMsgs = 0x20,
|
||||
MsgRequestKickFromHost = 0x0D,
|
||||
MsgTransitionToGameStart = 0x50,
|
||||
@ -367,7 +377,7 @@ namespace rage
|
||||
MsgTransitionLaunchNotify = 0x1B,
|
||||
MsgTransitionLaunch = 0x19,
|
||||
MsgTransitionGamerInstruction = 0x14,
|
||||
MsgTextMessage2 = 0x0A,// this one is for phone message
|
||||
MsgTextMessage2 = 0x0A, // this one is for phone message
|
||||
MsgSessionEstablishedRequest = 0x52,
|
||||
MsgSessionEstablished = 0x07,
|
||||
MsgRequestTransitionParameters = 0x42,
|
||||
@ -376,8 +386,8 @@ namespace rage
|
||||
MsgPlayerCardSync = 0x3A,
|
||||
MsgPlayerCardRequest = 0x6A,
|
||||
MsgLostConnectionToHost = 0x81,
|
||||
MsgKickPlayer = 0x34,// host kick
|
||||
MsgDebugStall = 0x7E,// unused?
|
||||
MsgKickPlayer = 0x34, // host kick
|
||||
MsgDebugStall = 0x7E, // unused?
|
||||
MsgCheckQueuedJoinRequestReply = 0x59,
|
||||
MsgCheckQueuedJoinRequest = 0x51,
|
||||
MsgBlacklist = 0x0C,
|
||||
@ -391,19 +401,19 @@ namespace rage
|
||||
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
|
||||
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,
|
||||
@ -433,16 +443,16 @@ namespace rage
|
||||
virtual EventType get_event_type() = 0;
|
||||
virtual uint32_t _0x18() = 0;
|
||||
|
||||
uint32_t m_timestamp; //0x0008
|
||||
char pad_0008[52]; //0x000C
|
||||
uint32_t m_msg_id; //0x0040
|
||||
uint32_t m_connection_identifier;//0x0044
|
||||
InFrame* m_this; //0x0048
|
||||
uint32_t m_peer_id; //0x0050
|
||||
char pad_0050[44]; //0x0058
|
||||
uint32_t m_length; //0x0080
|
||||
char pad_007C[4]; //0x0084
|
||||
void* m_data; //0x0088
|
||||
uint32_t m_timestamp; //0x0008
|
||||
char pad_0008[52]; //0x000C
|
||||
uint32_t m_msg_id; //0x0040
|
||||
uint32_t m_connection_identifier; //0x0044
|
||||
InFrame* m_this; //0x0048
|
||||
uint32_t m_peer_id; //0x0050
|
||||
char pad_0050[44]; //0x0058
|
||||
uint32_t m_length; //0x0080
|
||||
char pad_007C[4]; //0x0084
|
||||
void* m_data; //0x0088
|
||||
};
|
||||
static_assert(sizeof(rage::netConnection::InFrame) == 0x90);
|
||||
}
|
||||
@ -541,32 +551,32 @@ namespace rage
|
||||
{
|
||||
public:
|
||||
DEFINE_RAGE_RTTI(rage::CEventNetwork);
|
||||
virtual void unk_0008() = 0; //0x0008 (1)
|
||||
virtual void unk_0010() = 0; //0x0010 (2)
|
||||
virtual eEventNetworkType get_type() = 0; //0x0018 (3)
|
||||
virtual void unk_0020() = 0; //0x0020 (4)
|
||||
virtual void unk_0028() = 0; //0x0028 (5)
|
||||
virtual bool get_extra_information(void* info_array, int check) = 0; //0x0030 (6)
|
||||
virtual void unk_0038() = 0; //0x0038 (7)
|
||||
}; //Size: 0x0008
|
||||
virtual void unk_0008() = 0; //0x0008 (1)
|
||||
virtual void unk_0010() = 0; //0x0010 (2)
|
||||
virtual eEventNetworkType get_type() = 0; //0x0018 (3)
|
||||
virtual void unk_0020() = 0; //0x0020 (4)
|
||||
virtual void unk_0028() = 0; //0x0028 (5)
|
||||
virtual bool get_extra_information(void* info_array, int check) = 0; //0x0030 (6)
|
||||
virtual void unk_0038() = 0; //0x0038 (7)
|
||||
}; //Size: 0x0008
|
||||
|
||||
class sEntityDamagedData
|
||||
{
|
||||
public:
|
||||
alignas(8) Entity m_victim_index; //0x0000
|
||||
alignas(8) Entity m_damager_index; //0x0008
|
||||
alignas(8) float m_damage; //0x0010
|
||||
alignas(8) float m_endurance_damage; //0x0018
|
||||
alignas(8) bool m_victim_incapacitated; //0x0020
|
||||
alignas(8) bool m_victim_destroyed; //0x0028
|
||||
alignas(8) int m_weapon_used; //0x0030
|
||||
alignas(8) float m_victim_speed; //0x0038
|
||||
alignas(8) float m_damager_speed; //0x0040
|
||||
alignas(8) bool m_is_responsible_for_collision;//0x0048
|
||||
alignas(8) bool m_is_headshot; //0x0050
|
||||
alignas(8) bool m_is_with_melee_weapon; //0x0058
|
||||
alignas(8) int m_hit_material; //0x0060
|
||||
}; //Size: 0x0068
|
||||
alignas(8) Entity m_victim_index; //0x0000
|
||||
alignas(8) Entity m_damager_index; //0x0008
|
||||
alignas(8) float m_damage; //0x0010
|
||||
alignas(8) float m_endurance_damage; //0x0018
|
||||
alignas(8) bool m_victim_incapacitated; //0x0020
|
||||
alignas(8) bool m_victim_destroyed; //0x0028
|
||||
alignas(8) int m_weapon_used; //0x0030
|
||||
alignas(8) float m_victim_speed; //0x0038
|
||||
alignas(8) float m_damager_speed; //0x0040
|
||||
alignas(8) bool m_is_responsible_for_collision; //0x0048
|
||||
alignas(8) bool m_is_headshot; //0x0050
|
||||
alignas(8) bool m_is_with_melee_weapon; //0x0058
|
||||
alignas(8) int m_hit_material; //0x0060
|
||||
}; //Size: 0x0068
|
||||
static_assert(sizeof(sEntityDamagedData) == 0x68);
|
||||
|
||||
class netGameEvent
|
||||
@ -635,19 +645,19 @@ namespace rage
|
||||
};
|
||||
|
||||
public:
|
||||
std::uint16_t m_id; // 0x08
|
||||
bool m_requires_reply;// 0x0A
|
||||
std::uint16_t m_id; // 0x08
|
||||
bool m_requires_reply; // 0x0A
|
||||
private:
|
||||
char m_padding1[0x05];// 0x0B
|
||||
char m_padding1[0x05]; // 0x0B
|
||||
public:
|
||||
netPlayer* m_source_player; // 0x10
|
||||
netPlayer* m_target_player; // 0x18
|
||||
std::uint32_t m_resend_time;// 0x20
|
||||
netPlayer* m_source_player; // 0x10
|
||||
netPlayer* m_target_player; // 0x18
|
||||
std::uint32_t m_resend_time; // 0x20
|
||||
private:
|
||||
std::uint16_t m_0x24;// 0x24
|
||||
std::uint8_t m_0x26; // 0x26
|
||||
std::uint8_t m_0x27; // 0x27
|
||||
std::uint32_t m_0x28;// 0x28
|
||||
std::uint16_t m_0x24; // 0x24
|
||||
std::uint8_t m_0x26; // 0x26
|
||||
std::uint8_t m_0x27; // 0x27
|
||||
std::uint32_t m_0x28; // 0x28
|
||||
char m_padding2[0x04];
|
||||
};
|
||||
}
|
||||
@ -655,16 +665,16 @@ namespace rage
|
||||
class CScriptedGameEvent : public rage::netGameEvent
|
||||
{
|
||||
public:
|
||||
char m_padding[0x40]; // 0x30
|
||||
std::int64_t m_args[54]; // 0x70
|
||||
std::uint32_t m_bitset; // 0x220
|
||||
std::uint32_t m_args_size;// 0x224
|
||||
char m_padding[0x40]; // 0x30
|
||||
std::int64_t m_args[54]; // 0x70
|
||||
std::uint32_t m_bitset; // 0x220
|
||||
std::uint32_t m_args_size; // 0x224
|
||||
};
|
||||
|
||||
class CNetworkIncrementStatEvent : public rage::netGameEvent
|
||||
{
|
||||
public:
|
||||
Hash m_stat; // 0x30
|
||||
std::uint32_t m_amount;// 0x34
|
||||
Hash m_stat; // 0x30
|
||||
std::uint32_t m_amount; // 0x34
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
@ -176,9 +176,6 @@ namespace big
|
||||
|
||||
PVOID m_sort_session_details;
|
||||
|
||||
PVOID m_add_player_to_session;
|
||||
PVOID m_send_chat_net_message;
|
||||
|
||||
PVOID m_process_matchmaking_find_response;
|
||||
PVOID m_serialize_player_data_msg;
|
||||
|
||||
@ -259,6 +256,10 @@ namespace big
|
||||
GenericPool** m_ped_pool{};
|
||||
GenericPool** m_prop_pool{};
|
||||
VehiclePool*** m_vehicle_pool{};
|
||||
|
||||
PVOID m_netfilter_handle_message{};
|
||||
|
||||
functions::handle_chat_message m_handle_chat_message{};
|
||||
};
|
||||
#pragma pack(pop)
|
||||
static_assert(sizeof(gta_pointers) % 8 == 0, "Pointers are not properly aligned");
|
||||
|
@ -69,9 +69,7 @@ namespace big
|
||||
|
||||
detour_hook_helper::add<hooks::sort_session_details>("SSD", g_pointers->m_gta.m_sort_session_details);
|
||||
|
||||
detour_hook_helper::add<hooks::add_player_to_session>("APTS", g_pointers->m_gta.m_add_player_to_session);
|
||||
detour_hook_helper::add<hooks::send_chat_message>("SCM", g_pointers->m_gta.m_send_chat_message);
|
||||
detour_hook_helper::add<hooks::send_chat_net_message>("SCNM", g_pointers->m_gta.m_send_chat_net_message);
|
||||
|
||||
detour_hook_helper::add<hooks::process_matchmaking_find_response>("PMFR", g_pointers->m_gta.m_process_matchmaking_find_response);
|
||||
detour_hook_helper::add<hooks::serialize_player_data_msg>("SJPD", g_pointers->m_gta.m_serialize_player_data_msg);
|
||||
@ -118,6 +116,8 @@ namespace big
|
||||
|
||||
detour_hook_helper::add<hooks::allow_weapons_in_vehicle>("AWIV", g_pointers->m_gta.m_allow_weapons_in_vehicle);
|
||||
|
||||
detour_hook_helper::add<hooks::netfilter_handle_message>("NHM", g_pointers->m_gta.m_netfilter_handle_message);
|
||||
|
||||
g_hooking = this;
|
||||
}
|
||||
|
||||
|
@ -98,22 +98,16 @@ namespace big
|
||||
static bool write_player_game_state_data_node(rage::netObject* player, CPlayerGameStateDataNode* node);
|
||||
|
||||
static void invalid_mods_crash_detour(int64_t a1, int64_t a2, int a3, char a4);
|
||||
static std::int64_t constraint_attachment_crash(std::uintptr_t a1);
|
||||
static uint64_t invalid_decal(uintptr_t a1, int a2);
|
||||
static uint64_t task_parachute_object_0x270(uint64_t _this, int a2, int a3);
|
||||
|
||||
static bool update_presence_attribute_int(void* presence_data, int profile_index, char* attr, std::uint64_t value);
|
||||
static bool update_presence_attribute_string(void* presence_data, int profile_index, char* attr, char* value);
|
||||
|
||||
static void serialize_ped_inventory_data_node(CPedInventoryDataNode* node, rage::CSyncDataBase* data);
|
||||
static void serialize_vehicle_gadget_data_node(CVehicleGadgetDataNode* node, rage::CSyncDataBase* data);
|
||||
|
||||
static bool handle_join_request(Network* network, rage::snSession* session, rage::rlGamerInfo* player_info, CJoinRequestContext* ctx, BOOL is_transition_session);
|
||||
|
||||
static bool sort_session_details(SessionSortEntry* e1, SessionSortEntry* e2);
|
||||
|
||||
static bool add_player_to_session(rage::netConnectionManager* mgr, int receiver_msg_id, int* out_command_hndl, RemoteGamerInfoMsg* msg, int flags, void* unk);
|
||||
static bool send_chat_net_message(rage::netConnectionManager* mgr, int receiver_msg_id, CMsgTextMessage* msg, int flags, void* unk);
|
||||
static bool send_chat_message(void* team_mgr, rage::rlGamerInfo* local_gamer_info, char* message, bool is_team);
|
||||
|
||||
static bool process_matchmaking_find_response(void* _this, void* unused, rage::JSONNode* node, int* unk);
|
||||
@ -137,8 +131,6 @@ namespace big
|
||||
static void queue_dependency(void* dependency);
|
||||
static void prepare_metric_for_sending(rage::datBitBuffer* bit_buffer, int unk, int time, rage::rlMetric* metric);
|
||||
|
||||
static void* infinite_train_crash(void* carriage);
|
||||
|
||||
static bool received_array_update(rage::netArrayHandlerBase* array, CNetGamePlayer* sender, rage::datBitBuffer* buffer, int size, std::int16_t cycle);
|
||||
|
||||
static bool receive_pickup(rage::netObject* netobject, void* unk, CPed* ped);
|
||||
@ -163,6 +155,7 @@ namespace big
|
||||
static bool fipackfile_mount(rage::fiPackfile* this_, const char* mount_point);
|
||||
|
||||
static bool allow_weapons_in_vehicle(int64_t unk, int weaponinfo_group);
|
||||
static int netfilter_handle_message(__int64 filter, char* message, int flags);
|
||||
};
|
||||
|
||||
class minhook_keepalive
|
||||
|
14
src/hooks/misc/netfilter_handle_message.cpp
Normal file
14
src/hooks/misc/netfilter_handle_message.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "hooking.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
int hooks::netfilter_handle_message(__int64 filter, char* message, int flags)
|
||||
{
|
||||
int* features = (int*)(filter + 0x24);
|
||||
int old = *features;
|
||||
*features = 0;
|
||||
auto id = g_hooking->get_original<netfilter_handle_message>()(filter, message, flags);
|
||||
*features = old;
|
||||
return id;
|
||||
}
|
||||
}
|
@ -1,16 +1,38 @@
|
||||
#include "backend/command.hpp"
|
||||
#include "backend/context/chat_command_context.hpp"
|
||||
#include "gta/net_game_event.hpp"
|
||||
#include "gta_util.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "packet.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
inline void gamer_handle_serialize(rage::rlGamerHandle& hnd, rage::datBitBuffer& buf)
|
||||
{
|
||||
constexpr int PC_PLATFORM = 3;
|
||||
buf.Write<uint8_t>(PC_PLATFORM, 8);
|
||||
buf.WriteInt64(*(int64_t*)&hnd.m_rockstar_id, 64);
|
||||
buf.Write<uint8_t>(hnd.unk_0009, 8);
|
||||
}
|
||||
|
||||
bool hooks::send_chat_message(void* team_mgr, rage::rlGamerInfo* local_gamer_info, char* message, bool is_team)
|
||||
{
|
||||
if (g.session.chat_commands && message[0] == g.session.chat_command_prefix)
|
||||
command::process(std::string(message + 1), std::make_shared<chat_command_context>(g_player_service->get_self()));
|
||||
|
||||
return g_hooking->get_original<hooks::send_chat_message>()(team_mgr, local_gamer_info, message, is_team);
|
||||
packet msg{};
|
||||
msg.write_message(rage::eNetMessage::MsgTextMessage);
|
||||
msg.m_buffer.WriteString(message, 256);
|
||||
gamer_handle_serialize(g_player_service->get_self()->get_net_data()->m_gamer_handle, msg.m_buffer);
|
||||
msg.write<bool>(is_team, 1);
|
||||
|
||||
for (auto& player : g_player_service->players())
|
||||
if (player.second->get_net_game_player())
|
||||
msg.send(player.second->get_net_game_player()->m_msg_id);
|
||||
|
||||
return true;
|
||||
|
||||
//return g_hooking->get_original<hooks::send_chat_message>()(team_mgr, local_gamer_info, message, is_team);
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
#include "gta_util.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
|
||||
#include <network/CMsgTextMessage.hpp>
|
||||
#include <network/Network.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool hooks::send_chat_net_message(rage::netConnectionManager* mgr, int receiver_msg_id, CMsgTextMessage* msg, int flags, void* unk)
|
||||
{
|
||||
if (g.m_spoofed_peer_ids.contains(msg->m_peer_id))
|
||||
msg->m_peer_id = g.m_spoofed_peer_ids[msg->m_peer_id];
|
||||
|
||||
return g_hooking->get_original<hooks::send_chat_net_message>()(mgr, receiver_msg_id, msg, flags, unk);
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
#include "gta_util.hpp"
|
||||
#include "hooking.hpp"
|
||||
|
||||
#include <network/Network.hpp>
|
||||
#include <network/RemoteGamerInfoMsg.hpp>
|
||||
|
||||
// https://stackoverflow.com/questions/8120062/generate-random-64-bit-integer
|
||||
unsigned static rand256()
|
||||
{
|
||||
static unsigned const limit = RAND_MAX - RAND_MAX % 256;
|
||||
unsigned result = rand();
|
||||
while (result >= limit)
|
||||
{
|
||||
result = rand();
|
||||
}
|
||||
return result % 256;
|
||||
}
|
||||
|
||||
unsigned long long static rand64bits()
|
||||
{
|
||||
unsigned long long results = 0ULL;
|
||||
for (int count = 8; count > 0; --count)
|
||||
{
|
||||
results = 256U * results + rand256();
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool hooks::add_player_to_session(rage::netConnectionManager* mgr, int receiver_msg_id, int* out_command_hndl, RemoteGamerInfoMsg* msg, int flags, void* unk)
|
||||
{
|
||||
if (msg->m_gamer_info.m_gamer_handle.m_rockstar_id
|
||||
== g_local_player->m_player_info->m_net_player_data.m_gamer_handle.m_rockstar_id
|
||||
&& gta_util::get_network()->m_game_session_ptr->is_host() && g.protections.lessen_breakups)
|
||||
{
|
||||
std::uint64_t peer_id = rand64bits();
|
||||
g.m_spoofed_peer_ids.emplace(msg->m_gamer_info.m_peer_id_2, peer_id);
|
||||
msg->m_gamer_info.m_peer_id_2 = peer_id;
|
||||
}
|
||||
|
||||
return g_hooking->get_original<hooks::add_player_to_session>()(mgr, receiver_msg_id, out_command_hndl, msg, flags, unk);
|
||||
}
|
||||
}
|
@ -16,6 +16,7 @@
|
||||
#include "netsync/nodes/pickup/CPickupCreationDataNode.hpp"
|
||||
#include "netsync/nodes/player/CPlayerAppearanceDataNode.hpp"
|
||||
#include "netsync/nodes/player/CPlayerCreationDataNode.hpp"
|
||||
#include "netsync/nodes/player/CPlayerGameStateDataNode.hpp"
|
||||
#include "netsync/nodes/proximity_migrateable/CSectorDataNode.hpp"
|
||||
#include "netsync/nodes/train/CTrainGameStateDataNode.hpp"
|
||||
#include "netsync/nodes/vehicle/CVehicleCreationDataNode.hpp"
|
||||
@ -65,8 +66,7 @@ namespace big
|
||||
|
||||
std::array<sync_node_vft_to_ids, sync_tree_count> sync_trees_sync_node_vft_to_ids;
|
||||
|
||||
std::array<sync_tree_node_array_index_to_node_id_t, sync_tree_count> sync_trees_node_array_index_to_node_id =
|
||||
{
|
||||
std::array<sync_tree_node_array_index_to_node_id_t, sync_tree_count> sync_trees_node_array_index_to_node_id = {
|
||||
{
|
||||
// AUTOMOBILE
|
||||
{
|
||||
@ -505,7 +505,6 @@ namespace big
|
||||
class sync_node_finder
|
||||
{
|
||||
private:
|
||||
|
||||
static inline sync_node_finder_t finder;
|
||||
|
||||
public:
|
||||
@ -620,6 +619,17 @@ namespace big
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool is_local_player_an_occupant(CVehicleProximityMigrationDataNode* node)
|
||||
{
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
if (node->m_has_occupants[i] && node->m_occupants[i] == g_local_player->m_net_object->m_object_id)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool check_node(rage::netSyncNodeBase* node, CNetGamePlayer* sender, rage::netObject* object)
|
||||
{
|
||||
if (node->IsParentNode())
|
||||
@ -754,7 +764,18 @@ namespace big
|
||||
const auto sector_node = (CSectorDataNode*)(node);
|
||||
if (sector_node->m_pos_x == 712 || sector_node->m_pos_y == 712 || sector_node->m_pos_z == 712)
|
||||
{
|
||||
notify::crash_blocked(sender, "invalid sector position");
|
||||
notify::crash_blocked(sender, "invalid sector position (sector node)");
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case sync_node_id("CPlayerGameStateDataNode"):
|
||||
{
|
||||
const auto game_state_node = (CPlayerGameStateDataNode*)(node);
|
||||
if (game_state_node->m_population_control_sphere_x == 712 || game_state_node->m_population_control_sphere_y == 712
|
||||
|| game_state_node->m_population_control_sphere_z == 712)
|
||||
{
|
||||
notify::crash_blocked(sender, "invalid sector position (player game state node)");
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
@ -773,17 +794,15 @@ namespace big
|
||||
{
|
||||
if (object && g_local_player && g_local_player->m_net_object)
|
||||
{
|
||||
const auto migration_node = (CVehicleProximityMigrationDataNode*)(node);
|
||||
|
||||
if (!g_local_player->m_vehicle || !g_local_player->m_vehicle->m_net_object
|
||||
|| g_local_player->m_vehicle->m_net_object->m_object_id != object->m_object_id
|
||||
|| !is_in_vehicle(g_local_player, g_local_player->m_vehicle))
|
||||
{
|
||||
const auto migration_node = (CVehicleProximityMigrationDataNode*)(node);
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
if (is_local_player_an_occupant(migration_node))
|
||||
{
|
||||
if (migration_node->m_has_occupants[i]
|
||||
&& migration_node->m_occupants[i] == g_local_player->m_net_object->m_object_id)
|
||||
return true; // remote teleport
|
||||
return true; // remote teleport
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -792,7 +811,7 @@ namespace big
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -117,10 +117,10 @@ namespace big
|
||||
player->is_spammer = true;
|
||||
if (g.session.kick_chat_spammers)
|
||||
{
|
||||
if(g_player_service->get_self()->is_host())
|
||||
if (g_player_service->get_self()->is_host())
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("breakup")))->call(player, {}),
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("hostkick")))->call(player, {});
|
||||
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("hostkick")))->call(player, {});
|
||||
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("bailkick")))->call(player, {});
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("nfkick")))->call(player, {});
|
||||
}
|
||||
@ -135,6 +135,20 @@ namespace big
|
||||
command::process(std::string(message + 1), std::make_shared<chat_command_context>(player));
|
||||
else
|
||||
g_lua_manager->trigger_event<"chat_message_received">(player->id(), message);
|
||||
|
||||
if (msgType == rage::eNetMessage::MsgTextMessage && g_pointers->m_gta.m_chat_data && player->get_net_data())
|
||||
{
|
||||
rage::rlGamerHandle temp{};
|
||||
gamer_handle_deserialize(temp, buffer);
|
||||
bool is_team = buffer.Read<bool>(1);
|
||||
|
||||
g_pointers->m_gta.m_handle_chat_message(*g_pointers->m_gta.m_chat_data,
|
||||
nullptr,
|
||||
&player->get_net_data()->m_gamer_handle,
|
||||
message,
|
||||
is_team);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -715,24 +715,6 @@ namespace big
|
||||
g_pointers->m_gta.m_sort_session_details = ptr.sub(0x10).as<PVOID>();
|
||||
}
|
||||
},
|
||||
// Add Player To Session
|
||||
{
|
||||
"APTS",
|
||||
"E8 ? ? ? ? 48 8D 8D F0 01 00 00 8A D8",
|
||||
[](memory::handle ptr)
|
||||
{
|
||||
g_pointers->m_gta.m_add_player_to_session = ptr.add(1).rip().as<PVOID>();
|
||||
}
|
||||
},
|
||||
// Send Chat Net Message
|
||||
{
|
||||
"SCNM",
|
||||
"E8 ? ? ? ? 41 FF C4 48 83 C5 08",
|
||||
[](memory::handle ptr)
|
||||
{
|
||||
g_pointers->m_gta.m_send_chat_net_message = ptr.add(1).rip().as<PVOID>();
|
||||
}
|
||||
},
|
||||
// Process Matchmaking Find Response
|
||||
{
|
||||
"PMFR",
|
||||
@ -1213,6 +1195,24 @@ namespace big
|
||||
g_pointers->m_gta.m_taskjump_constructor = ptr.as<PVOID>();
|
||||
}
|
||||
},
|
||||
// NetFilter Handle Message
|
||||
{
|
||||
"NHM",
|
||||
"40 55 56 57 41 54 41 55 41 56 41 57 48 81 EC 50 01 00 00 48 8D 6C 24 30",
|
||||
[](memory::handle ptr)
|
||||
{
|
||||
g_pointers->m_gta.m_netfilter_handle_message = ptr.as<PVOID>();
|
||||
}
|
||||
},
|
||||
// Handle Chat Message
|
||||
{
|
||||
"HCM",
|
||||
"4D 85 C9 0F 84 8D",
|
||||
[](memory::handle ptr)
|
||||
{
|
||||
g_pointers->m_gta.m_handle_chat_message = ptr.as<functions::handle_chat_message>();
|
||||
}
|
||||
},
|
||||
// Max Wanted Level
|
||||
{
|
||||
"MWL",
|
||||
|
@ -80,4 +80,6 @@ namespace big::spam
|
||||
|
||||
spam_log.close();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -41,12 +41,9 @@ namespace big
|
||||
ImGui::Checkbox("BLOCK_RID_JOINING"_T.data(), &g.protections.rid_join);
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::SetTooltip("BLOCK_RID_JOINING_DESCRIPTION"_T.data());
|
||||
ImGui::Checkbox("LESSEN_BREAKUP_KICK"_T.data(), &g.protections.lessen_breakups);
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::SetTooltip("LESSEN_BREAKUP_KICK_DESCRIPTION"_T.data());
|
||||
ImGui::Checkbox("RECEIVE_PICKUP"_T.data(), &g.protections.receive_pickup);
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::SetTooltip("This prevents any pickup from the ground such as unwanted money drops.\nAttention: Normal pickups are also no longer possible.");
|
||||
ImGui::SetTooltip("This prevents the collection of pickups such as unwanted money bags\nNote: Normal pickups are also no longer possible to collect with this enabled");
|
||||
ImGui::Checkbox("ADMIN_CHECK"_T.data(), &g.protections.admin_check);
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
|
Reference in New Issue
Block a user