Huge protection improvements and other stuff (#1963)

* feat(protections): add a fuzzer
* feat(protections): improve protections
* feat(spoofing): add warning
* feat(world): force object cleanup
* fix(weapons): fix custom weapon code
* fix(weapons): fix for #1983
This commit is contained in:
maybegreat48
2023-08-19 11:01:08 +00:00
committed by GitHub
parent 9a51d381c9
commit 5eead0436f
120 changed files with 15579 additions and 20690 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ include(FetchContent)
FetchContent_Declare(
gtav_classes
GIT_REPOSITORY https://github.com/Yimura/GTAV-Classes.git
GIT_TAG 9da68ec82769c684068023c00ac5e5acd7836c97
GIT_TAG 0f88abb93d1499c04f440b77095ae4e02e5144ae
GIT_PROGRESS TRUE
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
@@ -25,6 +25,8 @@ namespace big
g_player_service->m_player_to_use_end_session_kick = player;
*scr_globals::gsbd.as<int*>() = (int)(__rdtsc() % 50000) + 6; // making the game trigger the broadcast is a bit difficult and requires a little bit of tampering with the value and some luck
script::get_current()->yield(5s);
*scr_globals::gsbd.as<int*>() = 4;
}
};
@@ -55,16 +55,11 @@ namespace big
if (wanted_level > 0)
{
auto& gpbd = scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id];
gpbd.RemoteWantedLevelPlayer = id;
gpbd.RemoteWantedLevelAmount = wanted_level;
for (int i = 0; PLAYER::GET_PLAYER_WANTED_LEVEL(id) < wanted_level && i < 3600; i++)
script::get_current()->yield(1ms);
gpbd.RemoteWantedLevelPlayer = -1;
gpbd.RemoteWantedLevelAmount = -1;
for (int i = 0; PLAYER::GET_PLAYER_WANTED_LEVEL(id) < wanted_level && player->is_valid() && i < 10; i++)
{
g_pointers->m_gta.m_set_wanted_level(player->get_net_game_player(), wanted_level, 0, -1);
script::get_current()->yield(200ms);
}
}
}
}
@@ -0,0 +1,46 @@
#include "backend/player_command.hpp"
#include "gta/net_game_event.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "util/teleport.hpp"
namespace big
{
inline void break_vehicle_door(CVehicle* vehicle, std::uint8_t door_index)
{
if (!vehicle->m_net_object)
return;
int object_id = vehicle->m_net_object->m_object_id;
g_pointers->m_gta.m_check_event_queue(*g_pointers->m_gta.m_net_event_manager, true);
CDoorBreakEvent* event =
reinterpret_cast<CDoorBreakEvent*>(g_pointers->m_gta.m_get_new_pool_item(*g_pointers->m_gta.m_net_event_pool));
if (!event)
return;
g_pointers->m_gta.m_construct_door_break_event(event);
event->m_vehicle_id = object_id;
event->m_door_id = door_index;
g_pointers->m_gta.m_queue_network_event(*g_pointers->m_gta.m_net_event_manager, event);
}
class break_doors : player_command
{
using player_command::player_command;
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx)
{
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
Vehicle vehicle = PED::GET_VEHICLE_PED_IS_IN(ped, false);
for (int i = 0; i < VEHICLE::GET_NUMBER_OF_VEHICLE_DOORS(vehicle); i++)
break_vehicle_door(player->get_current_vehicle(), i);
}
};
break_doors g_break_doors("breakdoors", "Break Vehicle Doors", "Breaks all vehicle doors", 0);
}
@@ -33,5 +33,5 @@ namespace big
}
};
burst_tyres g_burst_tyres("burstwheels", "Burst Vehicle Tyres", "Removes their tyres.", 0);
burst_tyres g_burst_tyres("burstwheels", "Burst Vehicle Tyres", "Removes their tyres", 0);
}
@@ -41,6 +41,6 @@ namespace big
};
flip_180
g_flip_180("flip180", "Rotate 180", "Rotates their car around", 0)
g_flip_180("flip180", "Rotate 180", "Rotates the player's car around", 0)
;
}
@@ -29,5 +29,5 @@ namespace big
}
};
flying_vehicle g_flying_vehicle("flyingveh", "Flying Vehicle", "Catapults their car to the sky.", 0);
flying_vehicle g_flying_vehicle("flyingveh", "Flying Vehicle", "Catapults the player's car to the sky", 0);
}
@@ -22,7 +22,7 @@ namespace big
if (entity::take_control_of(vehicle))
{
for (int i = 0; i < VEHICLE::GET_NUMBER_OF_VEHICLE_DOORS(i); i++)
for (int i = 0; i < VEHICLE::GET_NUMBER_OF_VEHICLE_DOORS(vehicle); i++)
{
VEHICLE::SET_VEHICLE_DOOR_OPEN(vehicle, i, true, false);
}
@@ -0,0 +1,31 @@
#include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "util/teleport.hpp"
namespace big
{
template<int ability_type>
class vehicle_special_ability : player_command
{
using player_command::player_command;
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx)
{
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true))
{
g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data());
}
else
{
g_pointers->m_gta.m_activate_special_ability(player->get_current_vehicle(), ability_type);
}
}
};
vehicle_special_ability<0> g_special_jump_vehicle("svehjump", "Special: Jump", "Activates the vehicle jump on the player's vehicle. This may cause undefined behavior if the vehicle cannot jump", 0);
vehicle_special_ability<1> g_special_boost_vehicle("svehboost", "Special: Boost", "Activates the boost on the player's vehicle. This may cause undefined behavior if the vehicle cannot boost", 0);
vehicle_special_ability<3> g_special_shunt_left("sshuntleft", "Special: Shunt Left", "Shunts the player's vehicle to the left", 0);
vehicle_special_ability<2> g_special_shunt_right("sshuntright", "Special: Shunt Right", "Shunts the player's vehicle to the right", 0);
}
@@ -31,5 +31,5 @@ namespace big
}
};
stop_vehicle g_stop_vehicle("stopveh", "Stop Vehicle", "Stops players vehicle", 0);
stop_vehicle g_stop_vehicle("stopveh", "Stop Vehicle", "Stops the player's vehicle", 0);
}
@@ -18,5 +18,5 @@ namespace big
}
};
unlock_vehicle g_unlock_vehicle("unlockveh", "Unlock Vehicle Doors", "Unlocks Vehicle Doors", 0);
unlock_vehicle g_unlock_vehicle("unlockveh", "Unlock Vehicle Doors", "Unlocks all vehicle doors", 0);
}
@@ -24,5 +24,5 @@ namespace big
}
};
black_tint g_black_tint("blacktint", "Black Window Tint", "Makes their windows black.", 0);
black_tint g_black_tint("blacktint", "Black Window Tint", "Makes the player's vehicle windows black", 0);
}
@@ -61,5 +61,17 @@ namespace big
}
});
}
if (g.session.vehicle_fix_all)
{
g_pointers->m_gta.m_give_pickup_rewards(-1, REWARD_VEHICLE_FIX);
}
else
{
g_player_service->iterate([](const player_entry& entry) {
if (entry.second->fix_vehicle)
g_pointers->m_gta.m_give_pickup_rewards(-1, REWARD_VEHICLE_FIX);
});
}
}
}
+5 -3
View File
@@ -1,8 +1,9 @@
#include "backend/looped/looped.hpp"
#include "services/outfit/outfit_service.hpp"
#include "natives.hpp"
#include "file_manager.hpp"
#include "logger/logger.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "services/outfit/outfit_service.hpp"
namespace big
{
@@ -32,6 +33,7 @@ namespace big
i >> outfit;
}
outfit_service::apply_outfit(outfit, false);
if (outfit.contains("model") && outfit["model"].get<uint32_t>() == ENTITY::GET_ENTITY_MODEL(self::ped))
outfit_service::apply_outfit(outfit, false);
}
}
@@ -3,17 +3,25 @@
namespace big
{
class increased_damage : looped_command
{
using looped_command::looped_command;
Hash ped_weapon;
virtual void on_tick() override
{
if (g.weapons.increased_damage != 1)
{
Hash weapon{};
WEAPON::GET_CURRENT_PED_WEAPON(self::ped, &weapon, 0);
if (weapon != ped_weapon)
{
WEAPON::SET_WEAPON_DAMAGE_MODIFIER(weapon, 1);
ped_weapon = weapon;
}
WEAPON::SET_WEAPON_DAMAGE_MODIFIER(weapon, g.weapons.increased_damage);
}
}
+3 -3
View File
@@ -9,13 +9,13 @@ namespace big
{
if (g.weapons.custom_weapon == CustomWeapon::TP_GUN && (!g.self.custom_weapon_stop || WEAPON::IS_PED_ARMED(self::ped, 4 | 2)))
{
Vector3 c; entity::raycast(&c);
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
{
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_ATTACK))
{
ENTITY::SET_ENTITY_COORDS(self::ped, c.x, c.y, c.z, 0, 0, 0, 0);
Vector3 c;
entity::raycast(&c);
PED::SET_PED_COORDS_KEEP_VEHICLE(self::ped, c.x, c.y, c.z);
}
}
}
+29
View File
@@ -0,0 +1,29 @@
#include "backend/looped_command.hpp"
#include "core/data/weathers.hpp"
#include "fiber_pool.hpp"
#include "gta_util.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "script.hpp"
#include "services/tunables/tunables_service.hpp"
namespace big
{
class blackout : looped_command
{
using looped_command::looped_command;
virtual void on_tick() override
{
GRAPHICS::SET_ARTIFICIAL_LIGHTS_STATE(true);
}
virtual void on_disable() override
{
GRAPHICS::SET_ARTIFICIAL_LIGHTS_STATE(false);
}
};
blackout g_blackout("blackout", "Blackout", "Enables blackout mode. This is local and cannot be seen by other players",
g.world.blackout);
}
-35
View File
@@ -1,35 +0,0 @@
#pragma once
#include "logger.hpp"
namespace big
{
using namespace std::chrono;
class benchmark
{
public:
explicit benchmark(std::string name = "") :
m_start(high_resolution_clock::now()),
m_name(name)
{
}
void get_runtime()
{
auto now = high_resolution_clock::now();
auto milliseconds_elapsed = duration_cast<milliseconds>(now - m_start);
auto microseconds_elapsed = duration_cast<microseconds>(now - m_start);
LOG(INFO) << m_name << " finished with a resulting time of: " << milliseconds_elapsed.count() << "ms "
<< microseconds_elapsed.count() % 1000 << "us";
}
void reset()
{
m_start = high_resolution_clock::now();
}
private:
high_resolution_clock::time_point m_start;
std::string m_name;
};
}
+3
View File
@@ -80,6 +80,9 @@ namespace big
// Prevent the game from crashing when flooded with outgoing events
memory::byte_patch::make(g_pointers->m_gta.m_free_event_error, std::vector{0x90, 0x90, 0x90, 0x90, 0x90})->apply();
// Always send the special ability event
memory::byte_patch::make(g_pointers->m_gta.m_activate_special_ability_patch, std::to_array({0xB0, 0x01, 0xC3}))->apply();
}
byte_patch_manager::byte_patch_manager()
+6 -2
View File
@@ -6,12 +6,12 @@ namespace big
// Add new values to the bottom
enum class Infraction
{
DESYNC_PROTECTION,
DESYNC_PROTECTION, // do not use
BREAKUP_KICK_DETECTED, // do not use
LOST_CONNECTION_KICK_DETECTED, // do not use
SPOOFED_ROCKSTAR_ID, // do not use
TRIGGERED_ANTICHEAT,
TRIED_CRASH_PLAYER, // do not use
TRIED_CRASH_PLAYER,
TRIED_KICK_PLAYER,
BLAME_EXPLOSION_DETECTED, // do not use (for now)
ATTACKING_WITH_GODMODE,
@@ -20,6 +20,8 @@ namespace big
SPOOFED_DATA,
SPOOFED_HOST_TOKEN,
INVALID_PLAYER_MODEL,
SUPER_JUMP,
UNDEAD_OTR,
};
inline std::unordered_map<Infraction, const char*> infraction_desc = {
@@ -37,5 +39,7 @@ namespace big
{Infraction::SPOOFED_DATA, "Had spoofed data"},
{Infraction::SPOOFED_HOST_TOKEN, "Had spoofed their host token"},
{Infraction::INVALID_PLAYER_MODEL, "Had used an invalid player model"},
{Infraction::SUPER_JUMP, "Had used super jump"},
{Infraction::UNDEAD_OTR, "Had used undead OTR"},
};
}

Some files were not shown because too many files have changed in this diff Show More