mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2024-12-22 20:17:24 +08:00
Fix lua explosion bypass (#2255)
* move explosion_anti_cheat_bypass to its own file * fix(lua): make sure lua user don't get tapped by game ac when using ADD_OWNED_EXPLOSION
This commit is contained in:
parent
b43dfc82f8
commit
2d2f4368fd
@ -4,8 +4,8 @@
|
||||
#include "hooking.hpp"
|
||||
#include "memory/byte_patch.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "util/explosion_anti_cheat_bypass.hpp"
|
||||
#include "util/police.hpp"
|
||||
#include "util/toxic.hpp"
|
||||
#include "util/vehicle.hpp"
|
||||
|
||||
extern "C" void sound_overload_detour();
|
||||
@ -22,9 +22,9 @@ namespace big
|
||||
memory::byte_patch::make(g_pointers->m_gta.m_max_wanted_level.add(14).rip().as<uint32_t*>(), 0).get();
|
||||
|
||||
// Patch blocked explosions
|
||||
toxic::explosion_anti_cheat_bypass::m_can_blame_others =
|
||||
explosion_anti_cheat_bypass::m_can_blame_others =
|
||||
memory::byte_patch::make(g_pointers->m_gta.m_blame_explode.as<uint16_t*>(), 0xE990).get();
|
||||
toxic::explosion_anti_cheat_bypass::m_can_use_blocked_explosions =
|
||||
explosion_anti_cheat_bypass::m_can_use_blocked_explosions =
|
||||
memory::byte_patch::make(g_pointers->m_gta.m_explosion_patch.sub(12).as<uint16_t*>(), 0x9090).get();
|
||||
|
||||
// Skip matchmaking session validity checks
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "lua_native_binding.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "util/explosion_anti_cheat_bypass.hpp"
|
||||
|
||||
namespace lua::native
|
||||
{
|
||||
@ -63,7 +64,11 @@ namespace lua::native
|
||||
|
||||
static void LUA_NATIVE_FIRE_ADD_OWNED_EXPLOSION(Ped ped, float x, float y, float z, int explosionType, float damageScale, bool isAudible, bool isInvisible, float cameraShake)
|
||||
{
|
||||
big::explosion_anti_cheat_bypass::apply();
|
||||
|
||||
FIRE::ADD_OWNED_EXPLOSION(ped, x, y, z, explosionType, damageScale, isAudible, isInvisible, cameraShake);
|
||||
|
||||
big::explosion_anti_cheat_bypass::restore();
|
||||
}
|
||||
|
||||
static void LUA_NATIVE_FIRE_ADD_EXPLOSION_WITH_USER_VFX(float x, float y, float z, int explosionType, Hash explosionFx, float damageScale, bool isAudible, bool isInvisible, float cameraShake)
|
||||
|
@ -95,6 +95,9 @@ class NativeFunc:
|
||||
s += "\n"
|
||||
s += "\t{\n"
|
||||
|
||||
if self.cpp_name == "ADD_OWNED_EXPLOSION":
|
||||
s+= "\t\tbig::explosion_anti_cheat_bypass::apply();\n\n"
|
||||
|
||||
call_native = "\t\t"
|
||||
if len(self.out_params) > 0:
|
||||
if returning_multiple_values:
|
||||
@ -127,6 +130,9 @@ class NativeFunc:
|
||||
|
||||
s += call_native
|
||||
|
||||
if self.cpp_name == "ADD_OWNED_EXPLOSION":
|
||||
s+= "\n\n\t\tbig::explosion_anti_cheat_bypass::restore();"
|
||||
|
||||
if returning_multiple_values:
|
||||
assign_return_values = "\n"
|
||||
if self.return_type != "void":
|
||||
@ -262,6 +268,8 @@ def generate_native_binding_cpp_and_hpp_files(functions_per_namespaces):
|
||||
|
||||
file_buffer += '#include "lua_native_binding.hpp"\n'
|
||||
file_buffer += '#include "natives.hpp"\n'
|
||||
if namespace_name == "FIRE":
|
||||
file_buffer += '#include "util/explosion_anti_cheat_bypass.hpp"\n'
|
||||
file_buffer += "\n"
|
||||
file_buffer += "namespace lua::native\n"
|
||||
file_buffer += "{\n"
|
||||
|
23
src/util/explosion_anti_cheat_bypass.hpp
Normal file
23
src/util/explosion_anti_cheat_bypass.hpp
Normal file
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include "memory/byte_patch.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
struct explosion_anti_cheat_bypass
|
||||
{
|
||||
inline static memory::byte_patch* m_can_blame_others;
|
||||
inline static memory::byte_patch* m_can_use_blocked_explosions;
|
||||
|
||||
inline static void apply()
|
||||
{
|
||||
explosion_anti_cheat_bypass::m_can_blame_others->apply();
|
||||
explosion_anti_cheat_bypass::m_can_use_blocked_explosions->apply();
|
||||
}
|
||||
|
||||
inline static void restore()
|
||||
{
|
||||
explosion_anti_cheat_bypass::m_can_use_blocked_explosions->restore();
|
||||
explosion_anti_cheat_bypass::m_can_blame_others->restore();
|
||||
}
|
||||
};
|
||||
}
|
@ -5,6 +5,7 @@
|
||||
#include "gta/pickup_rewards.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "services/gta_data/gta_data_service.hpp"
|
||||
#include "util/explosion_anti_cheat_bypass.hpp"
|
||||
#include "util/scripts.hpp"
|
||||
#include "util/session.hpp"
|
||||
#include "util/system.hpp"
|
||||
@ -18,16 +19,9 @@
|
||||
|
||||
namespace big::toxic
|
||||
{
|
||||
struct explosion_anti_cheat_bypass
|
||||
{
|
||||
inline static memory::byte_patch* m_can_blame_others;
|
||||
inline static memory::byte_patch* m_can_use_blocked_explosions;
|
||||
};
|
||||
|
||||
inline void blame_explode_coord(player_ptr to_blame, Vector3 pos, eExplosionTag explosion_type, float damage, bool is_audible, bool is_invisible, float camera_shake)
|
||||
{
|
||||
explosion_anti_cheat_bypass::m_can_blame_others->apply();
|
||||
explosion_anti_cheat_bypass::m_can_use_blocked_explosions->apply();
|
||||
explosion_anti_cheat_bypass::apply();
|
||||
|
||||
FIRE::ADD_OWNED_EXPLOSION(
|
||||
(*g_pointers->m_gta.m_is_session_started && to_blame) ? PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(to_blame->id()) : 0,
|
||||
@ -40,8 +34,7 @@ namespace big::toxic
|
||||
is_invisible,
|
||||
camera_shake);
|
||||
|
||||
explosion_anti_cheat_bypass::m_can_use_blocked_explosions->restore();
|
||||
explosion_anti_cheat_bypass::m_can_blame_others->restore();
|
||||
explosion_anti_cheat_bypass::restore();
|
||||
}
|
||||
|
||||
inline void blame_explode_player(player_ptr to_blame, player_ptr target, eExplosionTag explosion_type, float damage, bool is_audible, bool is_invisible, float camera_shake)
|
||||
|
Loading…
Reference in New Issue
Block a user