feat: BDSM crash protection & fix #668 (#680)

This commit is contained in:
Aure7138 2022-12-11 03:36:45 +08:00 committed by GitHub
parent 0bbdacbfa3
commit 86f1ce747f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 1 deletions

View File

@ -2,6 +2,7 @@
#include "natives.hpp"
#include "gta/enums.hpp"
#include "util/math.hpp"
#include "gui.hpp"
namespace big
{
@ -9,7 +10,7 @@ namespace big
{
if (g->weapons.rapid_fire)
{
if(!HUD::IS_PAUSE_MENU_ACTIVE())
if(!HUD::IS_PAUSE_MENU_ACTIVE() && !g_gui.m_opened && !PED::IS_PED_DEAD_OR_DYING(self::ped, true))
{
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_ATTACK))
{

View File

@ -65,6 +65,7 @@ namespace big
detour_hook_helper::add<hooks::invalid_mods_crash_detour>("IMCD", g_pointers->m_invalid_mods_crash_detour);
detour_hook_helper::add<hooks::constraint_attachment_crash>("CAC", g_pointers->m_constraint_attachment_crash);
detour_hook_helper::add<hooks::crash_bdsm>("CBDSM", g_pointers->m_crash_bdsm);
detour_hook_helper::add<hooks::update_presence_attribute_int>("UPAI", g_pointers->m_update_presence_attribute_int);
detour_hook_helper::add<hooks::update_presence_attribute_string>("UPAS", g_pointers->m_update_presence_attribute_string);

View File

@ -99,6 +99,7 @@ namespace big
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 std::int64_t crash_bdsm(std::int64_t a1, std::int64_t a2, unsigned int a3, int a4, std::int64_t a5);
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);

View File

@ -0,0 +1,11 @@
#include "hooking.hpp"
namespace big
{
std::int64_t hooks::crash_bdsm(std::int64_t a1, std::int64_t a2, unsigned int a3, int a4, std::int64_t a5)
{
if (a3 <= 0)
a3 = 1;
return g_hooking->get_original<hooks::crash_bdsm>()(a1, a2, a3, a4, a5);
}
}

View File

@ -670,6 +670,11 @@ namespace big
m_constraint_attachment_crash = ptr.as<PVOID>();
});
main_batch.add("CBDSM", "E8 ? ? ? ? 48 8B 47 10 4C 8B 8C 24", [this](memory::handle ptr)
{
m_crash_bdsm = ptr.add(1).rip().as<PVOID>();
});
auto mem_region = memory::module("GTA5.exe");
main_batch.run(mem_region);

View File

@ -149,6 +149,7 @@ namespace big
PVOID m_invalid_mods_crash_detour{};
PVOID m_constraint_attachment_crash{};
PVOID m_crash_bdsm{};
int64_t** m_send_chat_ptr{};
functions::send_chat_message m_send_chat_message{};