mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-07-15 23:07:59 +08:00
Force session host and improve protections (#593)
* Add force session host and update protections * Remove old popgroup protection * Harden script patcher * Replace looped options with script patches * Missing break * Use enums * Forgot to break again... * Add tooltip for force session host Co-authored-by: user <email@hostname>
This commit is contained in:
@ -75,6 +75,7 @@ namespace big
|
||||
"Terminate Maintransition",
|
||||
"Wait For Dirty Load Confirm",
|
||||
"DLC Intro Bink",
|
||||
"Spawn Into Personal Vehicle"
|
||||
};
|
||||
|
||||
auto transition_state = script_global(1574991);
|
||||
@ -108,7 +109,7 @@ namespace big
|
||||
return;
|
||||
}
|
||||
|
||||
if ((int)state > 0 && (int)std::size(transition_states))
|
||||
if ((int)state > 0 && (int)state < std::size(transition_states))
|
||||
{
|
||||
HUD::BEGIN_TEXT_COMMAND_BUSYSPINNER_ON("STRING");
|
||||
auto const spinner_text = std::format("{} | {}", transition_states[(int)state], static_cast<int>(state));
|
||||
|
@ -14,7 +14,6 @@ namespace big
|
||||
static void hud_transition_state();
|
||||
|
||||
static void tunables_disable_phone();
|
||||
static void tunables_no_idle_kick();
|
||||
|
||||
static void player_never_wanted(const player_ptr &player);
|
||||
static void player_spectate();
|
||||
@ -43,10 +42,10 @@ namespace big
|
||||
static void system_self_globals();
|
||||
static void system_update_pointers();
|
||||
static void system_desync_kick_protection();
|
||||
static void system_force_session_host();
|
||||
|
||||
static void vehicle_auto_drive();
|
||||
static void vehicle_boost_behavior();
|
||||
static void vehicle_despawn_bypass();
|
||||
static void vehicle_drive_on_water();
|
||||
static void vehicle_fly();
|
||||
static void vehicle_god_mode();
|
||||
|
@ -27,8 +27,6 @@ namespace big
|
||||
ENTITY::FREEZE_ENTITY_POSITION(vehicle, false);
|
||||
|
||||
STREAMING::SET_FOCUS_ENTITY(ped);
|
||||
|
||||
globals::disable_kill_trigger(false);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -36,8 +34,6 @@ namespace big
|
||||
|
||||
const auto target = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_player_service->get_selected()->id());
|
||||
|
||||
globals::disable_kill_trigger(true);
|
||||
|
||||
NETWORK::NETWORK_SET_IN_SPECTATOR_MODE(true, target);
|
||||
HUD::SET_MINIMAP_IN_SPECTATOR_MODE(true, target);
|
||||
|
||||
|
@ -57,7 +57,6 @@ namespace big
|
||||
vecPosition = CAM::GET_GAMEPLAY_CAM_COORD();
|
||||
vecRot = CAM::GET_GAMEPLAY_CAM_ROT(2);
|
||||
|
||||
globals::disable_kill_trigger(true);
|
||||
ENTITY::FREEZE_ENTITY_POSITION(vehicle, true);
|
||||
|
||||
CAM::SET_CAM_COORD(cCam, vecPosition.x, vecPosition.y, vecPosition.z);
|
||||
@ -75,7 +74,6 @@ namespace big
|
||||
STREAMING::SET_FOCUS_ENTITY(ped);
|
||||
|
||||
ENTITY::FREEZE_ENTITY_POSITION(vehicle, false);
|
||||
globals::disable_kill_trigger(false);
|
||||
|
||||
bLastFreeCam = false;
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "script.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
#include "gta_util.hpp"
|
||||
#include <network/Network.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
|
33
src/backend/looped/system/force_session_host.cpp
Normal file
33
src/backend/looped/system/force_session_host.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include "backend/looped/looped.hpp"
|
||||
#include "gta_util.hpp"
|
||||
#include <network/Network.hpp>
|
||||
#include <network/CCommunications.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
static bool bLastForceHost = false;
|
||||
void looped::system_force_session_host()
|
||||
{
|
||||
if (bLastForceHost != g->session.force_session_host && gta_util::get_network()->m_game_session_state == 0)
|
||||
{
|
||||
std::uint64_t host_token;
|
||||
g_pointers->m_generate_uuid(&host_token);
|
||||
|
||||
host_token = g->session.force_session_host ? 1 : host_token;
|
||||
|
||||
*g_pointers->m_host_token = host_token;
|
||||
|
||||
if (gta_util::get_network()->m_game_session_ptr)
|
||||
gta_util::get_network()->m_game_session_ptr->m_local_player.m_player_data.m_host_token = host_token;
|
||||
|
||||
g_pointers->m_profile_gamer_info->m_host_token = host_token;
|
||||
g_pointers->m_player_info_gamer_info->m_host_token = host_token;
|
||||
(*g_pointers->m_communications)->m_voice.m_connections[0]->m_gamer_info.m_host_token = host_token;
|
||||
|
||||
if (g_local_player && g_local_player->m_player_info)
|
||||
g_local_player->m_player_info->m_net_player_data.m_host_token = host_token;
|
||||
|
||||
bLastForceHost = g->session.force_session_host;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
#include "backend/looped/looped.hpp"
|
||||
#include "script_global.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
auto idle_kick_a = script_global(1648034);
|
||||
auto idle_kick_b = script_global(262145);
|
||||
|
||||
// ref: https://www.unknowncheats.me/forum/3487508-post22.html#post3487508
|
||||
void looped::tunables_no_idle_kick()
|
||||
{
|
||||
if (g->tunables.no_idle_kick)
|
||||
{
|
||||
*idle_kick_a.at(1156).as<int*>() = 0; // idle time
|
||||
*idle_kick_a.at(1172).as<int*>() = 0;
|
||||
|
||||
*idle_kick_b.at(87).as<int*>() = INT32_MAX; // IDLEKICK_WARNING1
|
||||
*idle_kick_b.at(88).as<int*>() = INT32_MAX; // IDLEKICK_WARNING2
|
||||
*idle_kick_b.at(89).as<int*>() = INT32_MAX; // IDLEKICK_WARNING3
|
||||
*idle_kick_b.at(90).as<int*>() = INT32_MAX; // IDLEKICK_KICK
|
||||
|
||||
*idle_kick_b.at(8248).as<int*>() = INT32_MAX; // ConstrainedKick_Warning1
|
||||
*idle_kick_b.at(8249).as<int*>() = INT32_MAX; // ConstrainedKick_Warning2
|
||||
*idle_kick_b.at(8250).as<int*>() = INT32_MAX; // ConstrainedKick_Warning3
|
||||
*idle_kick_b.at(8251).as<int*>() = INT32_MAX; // ConstrainedKick_Kick
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
#include "backend/looped/looped.hpp"
|
||||
#include "script_global.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
// allows for spawning unreleased vehicles in online and online vehicles in single player
|
||||
void looped::vehicle_despawn_bypass()
|
||||
{
|
||||
*script_global(4539659).as<bool*>() = true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user