Some general fixes (#782)

* feat(protections): small updates
* chore(CustomText): comment out TICK_LEFTCHEAT label override
* feat(protections): make desync protections optional
* fix(matchmaking): fix pool filter
This commit is contained in:
maybegreat48 2022-12-31 00:47:01 +00:00 committed by GitHub
parent 640cf9a83d
commit 3aafd119c5
11 changed files with 73 additions and 66 deletions

View File

@ -1,4 +1,5 @@
#include "backend/player_command.hpp"
#include "backend/bool_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "core/scr_globals.hpp"
@ -24,16 +25,42 @@ namespace big
cmd.m_num_peers = 1;
cmd.m_peer_ids[0] = player->get_session_peer()->m_peer_data.m_peer_id_2;
g_pointers->m_handle_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr, player->get_session_player(), &cmd);
for (auto& [_, plyr] : g_player_service->players())
if (g.session.show_cheating_message)
cmd.m_unk = 19;
if (gta_util::get_network()->m_game_session.is_host())
{
if (plyr->id() != player->id())
g_pointers->m_send_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
g_pointers->m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr, (int)plyr->get_session_player()->m_player_data.m_peer_id_2),
gta_util::get_network()->m_game_session_ptr->m_connection_identifier, &cmd, 0x1000000);
g_pointers->m_handle_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr, player->get_session_player(), &cmd);
}
else if (player->is_host())
{
for (auto& [_, plyr] : g_player_service->players())
{
if (plyr->id() != player->id())
g_pointers->m_send_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
g_pointers->m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr, (int)plyr->get_session_player()->m_player_data.m_peer_id_2),
gta_util::get_network()->m_game_session_ptr->m_connection_identifier, &cmd, 0x1000000);
}
g_pointers->m_handle_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr, player->get_session_player(), &cmd);
}
else
{
for (auto& [_, plyr] : g_player_service->players())
{
if (plyr->is_host())
{
g_pointers->m_send_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
g_pointers->m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr, (int)plyr->get_session_player()->m_player_data.m_peer_id_2),
gta_util::get_network()->m_game_session_ptr->m_connection_identifier, &cmd, 0x1000000);
break;
}
}
}
}
};
breakup_kick g_breakup_kick("breakup", "Breakup Kick", "Nearly unblockable but could be detected by others", 0, false);
bool_command g_show_cheating_message("breakupcheating", "Show Cheating Message", "Shows a \"was detected cheating and has been removed from the session\" instead of the usual leave message when the player gets kicked", g.session.show_cheating_message);
}

View File

@ -1,38 +0,0 @@
#include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "core/scr_globals.hpp"
#include "gta_util.hpp"
#include <network/Network.hpp>
namespace big
{
class host_kick : player_command
{
using player_command::player_command;
virtual CommandAccessLevel get_access_level()
{
return CommandAccessLevel::TOXIC;
}
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{
if (!g_player_service->get_self()->is_host())
{
g_notification_service->push_error("Kick", "You have to be the session host");
return;
}
rage::snMsgRemoveGamersFromSessionCmd cmd{};
cmd.m_session_id = gta_util::get_network()->m_game_session_ptr->m_rline_session.m_session_id;
cmd.m_num_peers = 1;
cmd.m_peer_ids[0] = player->get_session_peer()->m_peer_data.m_peer_id_2;
g_pointers->m_handle_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr, player->get_session_player(), &cmd);
}
};
host_kick g_host_kick("hostkick", "Host Kick", "Unblockable and undetectable, but requires session host", 0, false);
}

View File

@ -21,8 +21,8 @@ namespace big
int64_t args[arg_count]{
(int64_t)eRemoteEvent::KickFromInterior,
(int64_t)self::id,
*scr_globals::globalplayer_bd.at(player->id(), scr_globals::size::globalplayer_bd).at(321).at(6).as<int64_t*>(),
*scr_globals::globalplayer_bd.at(player->id(), scr_globals::size::globalplayer_bd).at(321).at(7).as<int64_t*>(),
*scr_globals::globalplayer_bd.at(player->id(), scr_globals::size::globalplayer_bd).at(321).at(8).as<int64_t*>(),
};
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());

View File

@ -10,6 +10,9 @@ namespace big
{
void looped::system_desync_kick_protection()
{
if (!g.protections.desync_kick)
return;
if (g_player_service->get_self()->is_valid() && g_player_service->get_self()->is_host())
return;

View File

@ -228,11 +228,12 @@ namespace big
vehicle_kick, teleport_to_warehouse, start_activity, send_sms)
} script_events{};
bool desync_kick = false;
bool script_host_kick = true;
bool rid_join = false;
bool lessen_breakups = false; // disabled by default due to anticheat concerns
NLOHMANN_DEFINE_TYPE_INTRUSIVE(protections, script_events, script_host_kick, rid_join, lessen_breakups)
NLOHMANN_DEFINE_TYPE_INTRUSIVE(protections, script_events, script_host_kick, rid_join, lessen_breakups, desync_kick)
} protections{};
struct self
@ -337,13 +338,15 @@ namespace big
bool semi_godmode_all = false;
bool wanted_level_all = false;
bool show_cheating_message = false;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(session,
local_weather, override_time, override_weather, custom_time, disable_chat_filter, log_chat_messages,
log_text_messages, decloak_players, force_session_host, force_script_host, player_magnet_enabled,
player_magnet_count, is_team, name_spoof_enabled, advertise_menu, spoofed_name, join_in_sctv_slots,
kick_chat_spammers, kick_host_when_forcing_host, explosion_karma, damage_karma, disable_traffic,
disable_peds, force_thunder, block_ceo_money, randomize_ceo_colors, send_to_apartment_idx, send_to_warehouse_idx,
chat_commands, chat_command_default_access_level)
chat_commands, chat_command_default_access_level, show_cheating_message)
} session{};
struct settings
@ -619,6 +622,9 @@ namespace big
bool language_filter_enabled = false;
int language_filter = 0;
bool pool_filter_enabled = false;
int pool_filter = 0;
bool player_count_filter_enabled = false;
int player_count_filter_minimum = 0;
int player_count_filter_maximum = 32;
@ -630,7 +636,7 @@ namespace big
NLOHMANN_DEFINE_TYPE_INTRUSIVE(session_browser,
region_filter_enabled, region_filter, language_filter_enabled, language_filter, player_count_filter_enabled,
player_count_filter_minimum, player_count_filter_maximum, sort_method, sort_direction, replace_game_matchmaking)
player_count_filter_minimum, player_count_filter_maximum, sort_method, sort_direction, replace_game_matchmaking, pool_filter_enabled, pool_filter)
} session_browser{};
struct ugc

View File

@ -78,21 +78,19 @@ namespace big
if (!get_msg_type(msgType, buffer))
return g_hooking->get_original<hooks::receive_net_message>()(netConnectionManager, a2, frame);
if (msgType == rage::eNetMessage::MsgTransitionLaunchNotify)
if ((msgType == rage::eNetMessage::MsgTransitionLaunchNotify && frame->m_connection_identifier != gta_util::get_network()->m_game_session.m_connection_identifier) ||
(msgType == rage::eNetMessage::MsgTransitionLaunch && frame->m_connection_identifier != gta_util::get_network()->m_transition_session.m_connection_identifier))
{
if (frame->m_connection_identifier != gta_util::get_network()->m_transition_session.m_connection_identifier)
if (player)
{
if (player)
{
g_notification_service->push_error("Protections", std::format("Blocked invalid transition launch notify crash from {}", player->get_name()));
}
else
{
g_notification_service->push_error("Protections", "Blocked invalid transition launch notify remote crash");
}
return true;
g_notification_service->push_error("Protections", std::format("Blocked invalid transition launch crash from {}", player->get_name()));
}
else
{
g_notification_service->push_error("Protections", "Blocked invalid transition launch remote crash");
}
return true;
}
if (player)

View File

@ -7,7 +7,7 @@ namespace big
{
add_callback_for_labels({ RAGE_JOAAT("RESPAWN_W"), RAGE_JOAAT("RESPAWN_W_MP") }, respawn_label_callback);
add_label_overwrite(RAGE_JOAAT("GC_OTR_TMR"), "HIDING FROM CLOWNS");
add_label_overwrite(RAGE_JOAAT("TICK_LEFTCHEAT"), "~a~~HUD_COLOUR_WHITE~ has been swatted by Rockstar.");
// add_label_overwrite(RAGE_JOAAT("TICK_LEFTCHEAT"), "~a~~HUD_COLOUR_WHITE~ has been swatted by Rockstar.");
g_custom_text_service = this;
}

View File

@ -65,6 +65,9 @@ namespace big
{
m_found_sessions[i].is_valid = false;
}
if (g.session_browser.pool_filter_enabled && ((m_found_sessions[i].attributes.discriminator & (1 << 14)) == (1 << 14)) != (bool)g.session_browser.pool_filter)
m_found_sessions[i].is_valid = false;
}
if (g.session_browser.sort_method != 0)

View File

@ -140,6 +140,13 @@ namespace big
ImGui::InputInt("Maximum", &g.session_browser.player_count_filter_maximum);
}
ImGui::Checkbox("Pool Type", &g.session_browser.pool_filter_enabled);
if (g.session_browser.pool_filter_enabled)
{
ImGui::SameLine();
ImGui::Combo("###pooltype", &g.session_browser.pool_filter, "Normal\0Bad Sport");
}
ImGui::TreePop();
}

View File

@ -11,7 +11,10 @@ namespace big
auto const is_session_host = [] { return gta_util::get_network()->m_game_session_ptr->is_host(); };
components::player_command_button<"breakup">(g_player_service->get_selected());
components::disable_unless(std::not_fn(is_session_host), [] {
ImGui::SameLine();
components::command_checkbox<"breakupcheating">();
components::disable_unless(std::not_fn(is_session_host), []
{
components::player_command_button<"lckick">(g_player_service->get_selected());
});
components::player_command_button<"bailkick">(g_player_service->get_selected());
@ -19,9 +22,6 @@ namespace big
components::player_command_button<"oomkick">(g_player_service->get_selected());
components::player_command_button<"shkick">(g_player_service->get_selected());
components::player_command_button<"endkick">(g_player_service->get_selected());
components::disable_unless(is_session_host, [] {
components::player_command_button<"hostkick">(g_player_service->get_selected());
});
components::player_command_button<"desync">(g_player_service->get_selected());
ImGui::TreePop();

View File

@ -45,9 +45,10 @@ namespace big
ImGui::Checkbox("Start Activity", &g.protections.script_events.start_activity);
ImGui::Checkbox("Send SMS", &g.protections.script_events.send_sms);
components::script_patch_checkbox("Script Host Kick", &g.protections.script_host_kick);
ImGui::Checkbox("Desync Kick", &g.protections.desync_kick);
ImGui::Checkbox("RID Join", &g.protections.rid_join);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("This will block anyone trying to join you through Rockstar ID, including your friends");
ImGui::SetTooltip("This will block anyone trying to join, kick or crash you with your Rockstar ID, including your friends");
ImGui::Checkbox("Lessen Breakup Kicks As Host", &g.protections.lessen_breakups);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Attacker must join after you have become host for this to work. There are anti-cheat concerns with this feature");