feat(Protections): Added replay_interface

This commit is contained in:
Yimura 2021-08-05 23:06:47 +02:00
parent 2437fd086f
commit 65cacc17f3
No known key found for this signature in database
GPG Key ID: 3D8FF4397E768682
8 changed files with 161 additions and 69 deletions

View File

@ -17,6 +17,11 @@ namespace big
looped::system_update_pointers(); looped::system_update_pointers();
}QUEUE_JOB_END_CLAUSE }QUEUE_JOB_END_CLAUSE
QUEUE_JOB_BEGIN_CLAUSE()
{
looped::protections_replay_interface();
}QUEUE_JOB_END_CLAUSE
QUEUE_JOB_BEGIN_CLAUSE() QUEUE_JOB_BEGIN_CLAUSE()
{ {
looped::tunables_disable_phone(); looped::tunables_disable_phone();

View File

@ -10,6 +10,8 @@ namespace big
static void player_specate(); static void player_specate();
static void protections_replay_interface();
static void self_frame_flags(); static void self_frame_flags();
static void self_godmode(); static void self_godmode();
static void self_off_radar(); static void self_off_radar();

View File

@ -0,0 +1,45 @@
#include "backend/looped/looped.hpp"
#include "gta/replay.hpp"
#include "pointers.hpp"
#include "natives.hpp"
#include "util/entity.hpp"
namespace big
{
static bool busy = false;
void looped::protections_replay_interface()
{
if (busy) return;
busy = true;
Ped player = PLAYER::PLAYER_PED_ID();
rage::CReplayInterface* replay_interface = *g_pointers->m_replay_interface;
rage::CObjectInterface* object_interface = replay_interface->m_object_interface;
const int max_obj = object_interface->m_max_objects;
for (int i = 0; i < max_obj; i++)
{
rage::CObject* obj = object_interface->get_object(i);
if (obj == nullptr) continue;
Object ent = g_pointers->m_ptr_to_handle(obj);
if (g.protections.replay_interface.attach)
{
if (ENTITY::IS_ENTITY_ATTACHED_TO_ENTITY(player, ent) || ENTITY::IS_ENTITY_ATTACHED_TO_ENTITY(PED::GET_VEHICLE_PED_IS_IN(player, true), ent))
{
entity::delete_entity(ent);
}
}
if (g.protections.replay_interface.cage && obj->m_model_info->m_model == RAGE_JOAAT("prop_gold_cont_01"))
entity::delete_entity(ent);
script::get_current()->yield();
}
busy = false;
}
}

View File

@ -22,23 +22,33 @@ struct globals {
}; };
struct protections { struct protections {
bool bounty = true; struct replay_interface {
bool ceo_ban = true; bool attach = false;
bool ceo_kick = true; bool cage = true;
bool ceo_money = true; };
bool clear_wanted_level = true;
bool fake_deposit = true; struct script_events {
bool force_mission = true; bool bounty = true;
bool force_teleport = true; bool ceo_ban = true;
bool gta_banner = true; bool ceo_kick = true;
bool personal_vehicle_destroyed = true; bool ceo_money = true;
bool remote_off_radar = true; bool clear_wanted_level = true;
bool send_to_cutscene = true; bool fake_deposit = true;
bool send_to_island = true; bool force_mission = true;
bool sound_spam = true; bool force_teleport = true;
bool spectate = true; bool gta_banner = true;
bool transaction_error = true; bool personal_vehicle_destroyed = true;
bool vehicle_kick = true; bool remote_off_radar = true;
bool send_to_cutscene = true;
bool send_to_island = true;
bool sound_spam = true;
bool spectate = true;
bool transaction_error = true;
bool vehicle_kick = true;
};
replay_interface replay_interface{};
script_events script_events{};
}; };
struct self { struct self {
@ -104,23 +114,23 @@ struct globals {
void from_json(const nlohmann::json& j) void from_json(const nlohmann::json& j)
{ {
this->protections.bounty = j["protections"]["bounty"]; this->protections.script_events.bounty = j["protections"]["script_events"]["bounty"];
this->protections.ceo_ban = j["protections"]["ceo_ban"]; this->protections.script_events.ceo_ban = j["protections"]["script_events"]["ceo_ban"];
this->protections.ceo_kick = j["protections"]["ceo_kick"]; this->protections.script_events.ceo_kick = j["protections"]["script_events"]["ceo_kick"];
this->protections.ceo_money = j["protections"]["ceo_money"]; this->protections.script_events.ceo_money = j["protections"]["script_events"]["ceo_money"];
this->protections.clear_wanted_level = j["protections"]["clear_wanted_level"]; this->protections.script_events.clear_wanted_level = j["protections"]["script_events"]["clear_wanted_level"];
this->protections.fake_deposit = j["protections"]["fake_deposit"]; this->protections.script_events.fake_deposit = j["protections"]["script_events"]["fake_deposit"];
this->protections.force_mission = j["protections"]["force_mission"]; this->protections.script_events.force_mission = j["protections"]["script_events"]["force_mission"];
this->protections.force_teleport = j["protections"]["force_teleport"]; this->protections.script_events.force_teleport = j["protections"]["script_events"]["force_teleport"];
this->protections.gta_banner = j["protections"]["gta_banner"]; this->protections.script_events.gta_banner = j["protections"]["script_events"]["gta_banner"];
this->protections.personal_vehicle_destroyed = j["protections"]["personal_vehicle_destroyed"]; this->protections.script_events.personal_vehicle_destroyed = j["protections"]["script_events"]["personal_vehicle_destroyed"];
this->protections.remote_off_radar = j["protections"]["remote_off_radar"]; this->protections.script_events.remote_off_radar = j["protections"]["script_events"]["remote_off_radar"];
this->protections.send_to_cutscene = j["protections"]["send_to_cutscene"]; this->protections.script_events.send_to_cutscene = j["protections"]["script_events"]["send_to_cutscene"];
this->protections.send_to_island = j["protections"]["send_to_island"]; this->protections.script_events.send_to_island = j["protections"]["script_events"]["send_to_island"];
this->protections.sound_spam = j["protections"]["sound_spam"]; this->protections.script_events.sound_spam = j["protections"]["script_events"]["sound_spam"];
this->protections.spectate = j["protections"]["spectate"]; this->protections.script_events.spectate = j["protections"]["script_events"]["spectate"];
this->protections.transaction_error = j["protections"]["transaction_error"]; this->protections.script_events.transaction_error = j["protections"]["script_events"]["transaction_error"];
this->protections.vehicle_kick = j["protections"]["vehicle_kick"]; this->protections.script_events.vehicle_kick = j["protections"]["script_events"]["vehicle_kick"];
this->tunables.disable_phone = j["tunables"]["disable_phone"]; this->tunables.disable_phone = j["tunables"]["disable_phone"];
this->tunables.no_idle_kick = j["tunables"]["no_idle_kick"]; this->tunables.no_idle_kick = j["tunables"]["no_idle_kick"];
@ -154,24 +164,35 @@ struct globals {
{ {
return nlohmann::json{ return nlohmann::json{
{ {
"protections", { "protections",
{ "bounty", this->protections.bounty }, {
{ "ceo_ban", this->protections.ceo_ban }, {
{ "ceo_kick", this->protections.ceo_kick }, "replay_interface", {
{ "ceo_money", this->protections.ceo_money }, { "attach", this->protections.replay_interface.attach },
{ "clear_wanted_level", this->protections.clear_wanted_level }, { "cage", this->protections.replay_interface.cage }
{ "fake_deposit", this->protections.fake_deposit }, }
{ "force_mission", this->protections.force_mission }, },
{ "force_teleport", this->protections.force_teleport }, {
{ "gta_banner", this->protections.gta_banner }, "script_events", {
{ "personal_vehicle_destroyed", this->protections.personal_vehicle_destroyed }, { "bounty", this->protections.script_events.bounty },
{ "remote_off_radar", this->protections.remote_off_radar }, { "ceo_ban", this->protections.script_events.ceo_ban },
{ "send_to_cutscene", this->protections.send_to_cutscene }, { "ceo_kick", this->protections.script_events.ceo_kick },
{ "send_to_island", this->protections.send_to_island }, { "ceo_money", this->protections.script_events.ceo_money },
{ "sound_spam", this->protections.sound_spam }, { "clear_wanted_level", this->protections.script_events.clear_wanted_level },
{ "spectate", this->protections.spectate }, { "fake_deposit", this->protections.script_events.fake_deposit },
{ "transaction_error", this->protections.transaction_error }, { "force_mission", this->protections.script_events.force_mission },
{ "vehicle_kick", this->protections.vehicle_kick } { "force_teleport", this->protections.script_events.force_teleport },
{ "gta_banner", this->protections.script_events.gta_banner },
{ "personal_vehicle_destroyed", this->protections.script_events.personal_vehicle_destroyed },
{ "remote_off_radar", this->protections.script_events.remote_off_radar },
{ "send_to_cutscene", this->protections.script_events.send_to_cutscene },
{ "send_to_island", this->protections.script_events.send_to_island },
{ "sound_spam", this->protections.script_events.sound_spam },
{ "spectate", this->protections.script_events.spectate },
{ "transaction_error", this->protections.script_events.transaction_error },
{ "vehicle_kick", this->protections.script_events.vehicle_kick }
}
}
} }
}, },
{ {

View File

@ -3,6 +3,7 @@
#include "gta/fwddec.hpp" #include "gta/fwddec.hpp"
#include "gta/player.hpp" #include "gta/player.hpp"
#include "gta/natives.hpp" #include "gta/natives.hpp"
#include "gta/replay.hpp"
namespace big::functions namespace big::functions
{ {
@ -21,6 +22,8 @@ namespace big::functions
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 = Object(rage::CObject* object);
// Received Event Signatures START // Received Event Signatures START
using read_bitbuf_array = bool(rage::datBitBuffer* buffer, PVOID read, int bits, int); 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 read_bitbuf_dword = bool(rage::datBitBuffer* buffer, PVOID read, int bits);

View File

@ -16,87 +16,87 @@ namespace big
switch (hash) switch (hash)
{ {
case RemoteEvent::Bounty: case RemoteEvent::Bounty:
if (g.protections.bounty) if (g.protections.script_events.bounty)
strcpy(type, "Bounty"); strcpy(type, "Bounty");
break; break;
case RemoteEvent::CeoBan: case RemoteEvent::CeoBan:
if (g.protections.ceo_ban) if (g.protections.script_events.ceo_ban)
strcpy(type, "Ceo Ban"); strcpy(type, "Ceo Ban");
break; break;
case RemoteEvent::CeoKick: case RemoteEvent::CeoKick:
if (g.protections.ceo_kick) if (g.protections.script_events.ceo_kick)
strcpy(type, "Ceo Kick"); strcpy(type, "Ceo Kick");
break; break;
case RemoteEvent::CeoMoney: case RemoteEvent::CeoMoney:
if (g.protections.ceo_money) if (g.protections.script_events.ceo_money)
strcpy(type, "Ceo Money"); strcpy(type, "Ceo Money");
break; break;
case RemoteEvent::ClearWantedLevel: case RemoteEvent::ClearWantedLevel:
if (g.protections.clear_wanted_level) if (g.protections.script_events.clear_wanted_level)
strcpy(type, "Clear Wanted Level"); strcpy(type, "Clear Wanted Level");
break; break;
case RemoteEvent::FakeDeposit: case RemoteEvent::FakeDeposit:
if (g.protections.fake_deposit) if (g.protections.script_events.fake_deposit)
strcpy(type, "Deposit"); strcpy(type, "Deposit");
break; break;
case RemoteEvent::ForceMission: case RemoteEvent::ForceMission:
if (g.protections.force_mission) if (g.protections.script_events.force_mission)
strcpy(type, "Force Mission"); strcpy(type, "Force Mission");
break; break;
case RemoteEvent::GtaBanner: case RemoteEvent::GtaBanner:
if (g.protections.gta_banner) if (g.protections.script_events.gta_banner)
strcpy(type, "GTA Banner"); strcpy(type, "GTA Banner");
break; break;
case RemoteEvent::PersonalVehicleDestroyed: case RemoteEvent::PersonalVehicleDestroyed:
if (g.protections.personal_vehicle_destroyed) if (g.protections.script_events.personal_vehicle_destroyed)
strcpy(type, "Personal Vehicle Destroyed"); strcpy(type, "Personal Vehicle Destroyed");
break; break;
case RemoteEvent::RemoteOffradar: case RemoteEvent::RemoteOffradar:
if (g.protections.remote_off_radar) if (g.protections.script_events.remote_off_radar)
strcpy(type, "Remote Off Radar"); strcpy(type, "Remote Off Radar");
break; break;
case RemoteEvent::SendToCutscene: case RemoteEvent::SendToCutscene:
if (g.protections.send_to_cutscene) if (g.protections.script_events.send_to_cutscene)
strcpy(type, "Send To Cutscene"); strcpy(type, "Send To Cutscene");
break; break;
case RemoteEvent::SendToIsland: case RemoteEvent::SendToIsland:
if (g.protections.send_to_island) if (g.protections.script_events.send_to_island)
strcpy(type, "Send To Island"); strcpy(type, "Send To Island");
break; break;
case RemoteEvent::SoundSpam: case RemoteEvent::SoundSpam:
if (g.protections.sound_spam) if (g.protections.script_events.sound_spam)
strcpy(type, "Sound Spam"); strcpy(type, "Sound Spam");
break; break;
case RemoteEvent::Spectate: case RemoteEvent::Spectate:
if (g.protections.spectate) if (g.protections.script_events.spectate)
strcpy(type, "Specate"); strcpy(type, "Specate");
break; break;
case RemoteEvent::Teleport: case RemoteEvent::Teleport:
if (g.protections.force_teleport) if (g.protections.script_events.force_teleport)
strcpy(type, "Force Teleport"); strcpy(type, "Force Teleport");
break; break;
case RemoteEvent::TransactionError: case RemoteEvent::TransactionError:
if (g.protections.transaction_error) if (g.protections.script_events.transaction_error)
strcpy(type, "Transaction Error"); strcpy(type, "Transaction Error");
break; break;
case RemoteEvent::VehicleKick: case RemoteEvent::VehicleKick:
if (g.protections.vehicle_kick) if (g.protections.script_events.vehicle_kick)
strcpy(type, "Vehicle Kick"); strcpy(type, "Vehicle Kick");
break; break;

View File

@ -185,6 +185,18 @@ namespace big
{ {
m_get_net_game_player = ptr.as<decltype(m_get_net_game_player)>(); m_get_net_game_player = ptr.as<decltype(m_get_net_game_player)>();
}); });
// Replay Interface
main_batch.add("RI", "48 8D 0D ? ? ? ? 48 8B D7 E8 ? ? ? ? 48 8D 0D ? ? ? ? 8A D8 E8 ? ? ? ? 84 DB 75 13 48 8D 0D", [this](memory::handle ptr)
{
m_replay_interface = ptr.add(3).rip().as<decltype(m_replay_interface)>();
});
// Pointer to Handle
main_batch.add("PTH", "48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 8B 15 ? ? ? ? 48 8B F9 48 83 C1 10 33 DB", [this](memory::handle ptr)
{
m_ptr_to_handle = ptr.as<decltype(m_ptr_to_handle)>();
});
main_batch.run(memory::module(nullptr)); main_batch.run(memory::module(nullptr));

View File

@ -2,6 +2,7 @@
#include "common.hpp" #include "common.hpp"
#include "gta/fwddec.hpp" #include "gta/fwddec.hpp"
#include "gta/enums.hpp" #include "gta/enums.hpp"
#include "gta/replay.hpp"
#include "function_types.hpp" #include "function_types.hpp"
namespace big namespace big
@ -20,6 +21,9 @@ namespace big
CPedFactory **m_ped_factory{}; CPedFactory **m_ped_factory{};
CNetworkPlayerMgr **m_network_player_mgr{}; CNetworkPlayerMgr **m_network_player_mgr{};
rage::CReplayInterface** m_replay_interface{};
functions::ptr_to_handle* m_ptr_to_handle{};
rage::scrNativeRegistrationTable *m_native_registration_table{}; rage::scrNativeRegistrationTable *m_native_registration_table{};
functions::get_native_handler_t m_get_native_handler{}; functions::get_native_handler_t m_get_native_handler{};
functions::fix_vectors_t m_fix_vectors{}; functions::fix_vectors_t m_fix_vectors{};