Assorted fixes (#3073)

* feat: unstuck more when removing blackscreen
* fix: make kicks more versatile
This commit is contained in:
maybegreat48 2024-05-09 09:05:56 +00:00 committed by GitHub
parent b7d75d4fcd
commit 29f226b316
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 65 additions and 77 deletions

View File

@ -36,7 +36,7 @@ namespace big
{
looped::system_self_globals();
looped::system_update_pointers();
looped::system_desync_kick_protection();
looped::system_update_desync_kick();
looped::system_spoofing();
looped::system_mission_creator();

View File

@ -27,7 +27,7 @@ namespace big
return;
}
g_player_service->m_player_to_use_complaint_kick = player;
player->trigger_desync_kick = true;
}
};

View File

@ -25,12 +25,12 @@ namespace big
return;
}
g_player_service->m_player_to_use_end_session_kick = player;
player->trigger_end_session_kick = true;
*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;
}
};
end_session_kick g_end_session_kick("endkick", "END_KICK", "END_KICK_DESC", 0, false);
end_session_kick g_end_session_kick("endkick", "END_KICK", "END_KICK_DESC", 0);
}

View File

@ -23,14 +23,14 @@ namespace big
if (scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[player->id()].PropertyData.Index != -1)
{
auto cxn = g_script_connection_service->create_connection("am_mp_property_int", player);
cxn->set_host_broadcast_size(1359);
cxn->set_player_broadcast_size(1185);
cxn->set_host_broadcast_size(1317);
// cxn->set_player_broadcast_size(1185);
cxn->set_no_remote_start(true);
cxn->set_wait_for_host_broadcast_data(true);
cxn->set_quick_cleanup(true);
cxn->set_debug_logging(true);
cxn->set_broadcast_modify_callback([](rage::scrThread* thread, uint64_t* server_vars, uint64_t* client_vars) {
server_vars[718] = 1;
server_vars[677] = 1; // this changes every update
});
g_fiber_pool->queue_job([cxn] {

View File

@ -25,7 +25,7 @@ namespace big
const size_t arg_count = 9;
int64_t args[arg_count] = {(int64_t)eRemoteEvent::SendTextLabelSMS, self::id, 1 << player->id()};
strcpy((char*)&args[2],
strcpy((char*)&args[3],
(std::string("SXT_") + strippers[rand() % strippers.size()] + "_" + sext_types[rand() % sext_types.size()])
.data());
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id(), (int)eRemoteEvent::SendTextLabelSMS);

View File

@ -20,7 +20,7 @@ namespace big
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
{
const int arg_count = 26;
const size_t arg_count = 27;
int64_t args[arg_count] = {(int64_t)eRemoteEvent::StartScriptBegin, (int64_t)self::id, 1 << player->id()};
args[3] = scriptId;
@ -34,7 +34,7 @@ namespace big
for (int i = 0; i < 2; i++)
{
const int arg_count_2 = 26;
const size_t arg_count_2 = 27;
int64_t args_2[arg_count_2] = {(int64_t)eRemoteEvent::StartScriptProceed, (int64_t)self::id, 1 << player->id()};
args_2[3 + 17] = 1337;
g_pointers->m_gta.m_trigger_script_event(1, args_2, arg_count_2, 1 << player->id(), (int)eRemoteEvent::StartScriptProceed);
@ -52,6 +52,6 @@ namespace big
start_script<230> g_start_badlands("badlands", "BACKEND_START_SCRIPT_START_BADLANDS_REVENGE_II", "BACKEND_START_SCRIPT_START_BADLANDS_REVENGE_II_DESC", 0);
start_script<235> g_start_space_monkey("spacemonkey", "BACKEND_START_SCRIPT_START_SPACE_MONKEY", "BACKEND_START_SCRIPT_START_SPACE_MONKEY_DESC", 0);
start_script<231> g_start_wizards_ruin("wizard", "BACKEND_START_SCRIPT_START_WIZARD", "BACKEND_START_SCRIPT_START_WIZARD_DESC", 0);
start_script<236> g_start_qub3d("qub3d", "BACKEND_START_SCRIPT_START_QUB3D", "BACKEND_START_SCRIPT_START_QUB3D_DESC", 0); // puzzle?
start_script<236> g_start_qub3d("qub3d", "BACKEND_START_SCRIPT_START_QUB3D", "BACKEND_START_SCRIPT_START_QUB3D_DESC", 0); // puzzle
start_script<237> g_start_camhedz("camhedz", "BACKEND_START_SCRIPT_START_CAMHEDZ", "BACKEND_START_SCRIPT_START_CAMHEDZ_DESC", 0);
}

View File

@ -38,7 +38,7 @@ namespace big
static void system_self_globals();
static void system_update_pointers();
static void system_desync_kick_protection();
static void system_update_desync_kick();
static void system_spoofing();
static void system_mission_creator();

View File

@ -40,9 +40,6 @@ namespace big
if (entry.second->explosion_loop)
toxic::blame_explode_player(entry.second, entry.second, EXP_TAG_SUBMARINE_BIG, 9999.0f, true, false, 9999.0f);
if (entry.second->freeze_loop && entry.second->get_ped()->m_net_object)
g_pointers->m_gta.m_clear_ped_tasks_network(entry.second->get_ped(), true);
if (entry.second->ragdoll_loop && entry.second->get_ped()->m_net_object)
g_pointers->m_gta.m_request_ragdoll(entry.second->get_ped()->m_net_object->m_object_id);

View File

@ -1,35 +0,0 @@
#include "backend/looped/looped.hpp"
#include "fiber_pool.hpp"
#include "gta_util.hpp"
#include "natives.hpp"
#include "script.hpp"
#include "services/players/player_service.hpp"
#include <network/Network.hpp>
namespace big
{
void looped::system_desync_kick_protection()
{
memset(&gta_util::get_network()->m_game_complaint_mgr.m_host_tokens_complained, 0, 64 * sizeof(uint64_t));
if (!g_player_service->m_player_to_use_complaint_kick
|| !g_player_service->m_player_to_use_complaint_kick->get()->get_net_data())
gta_util::get_network()->m_game_complaint_mgr.m_num_tokens_complained = 0;
else
{
gta_util::get_network()->m_game_complaint_mgr.m_num_tokens_complained = 1;
gta_util::get_network()->m_game_complaint_mgr.m_host_tokens_complained[0] =
g_player_service->m_player_to_use_complaint_kick->get()->get_net_data()->m_host_token;
}
auto old = gta_util::get_network()->m_game_complaint_mgr.m_host_token;
if (gta_util::get_network()->m_game_session_state > 3 && gta_util::get_network()->m_game_session_state < 6
&& g_player_service->m_player_to_use_complaint_kick && g_player_service->get_self()->is_valid()
&& !g_player_service->get_self()->is_host())
{
g_pointers->m_gta.m_reset_network_complaints(&gta_util::get_network()->m_game_complaint_mgr);
}
}
}

View File

@ -0,0 +1,33 @@
#include "backend/looped/looped.hpp"
#include "fiber_pool.hpp"
#include "gta_util.hpp"
#include "natives.hpp"
#include "script.hpp"
#include "services/players/player_service.hpp"
#include <network/Network.hpp>
namespace big
{
void looped::system_update_desync_kick()
{
memset(&gta_util::get_network()->m_game_complaint_mgr.m_host_tokens_complained, 0, 64 * sizeof(uint64_t));
gta_util::get_network()->m_game_complaint_mgr.m_num_tokens_complained = 0;
for (auto& player : g_player_service->players())
{
if (player.second->is_valid() && player.second->trigger_desync_kick)
{
gta_util::get_network()->m_game_complaint_mgr.raise_complaint(player.second->get_net_data()->m_host_token);
}
}
if (gta_util::get_network()->m_game_session_state > 3 && gta_util::get_network()->m_game_session_state < 6
&& gta_util::get_network()->m_game_complaint_mgr.m_num_tokens_complained && g_player_service->get_self()->is_valid()
&& !g_player_service->get_self()->is_host())
{
g_pointers->m_gta.m_reset_network_complaints(&gta_util::get_network()->m_game_complaint_mgr);
}
}
}

View File

@ -9,7 +9,7 @@ namespace big
bool hooks::serialize_join_request_message(RemoteGamerInfoMsg* info, void* data, int size, int* bits_serialized)
{
if (info->unk_0xC0 == 0)
info->unk_0xC0 = 1;
info->unk_0xC0 = 1; // TODO: do we need this anymore?
info->m_num_handles = 0;
return g_hooking->get_original<hooks::serialize_join_request_message>()(info, data, size, bits_serialized);

View File

@ -27,12 +27,6 @@ namespace big
return true;
}
// shouldn't have any side effects
if (hash == "peeraddr"_J)
{
value = (char*)"";
}
return g_hooking->get_original<hooks::update_presence_attribute_string>()(presence_data, profile_index, attr, value);
}
}

View File

@ -17,8 +17,10 @@ namespace big
Player orig_player;
int orig_participant;
bool need_to_use_end_session_kick = g_player_service->m_player_to_use_end_session_kick
&& target->m_player_id == g_player_service->m_player_to_use_end_session_kick->get()->id()
auto plyr = g_player_service->get_by_id(target->m_player_id);
bool need_to_use_end_session_kick = plyr && plyr->is_valid()
&& plyr->trigger_end_session_kick
&& _this->m_array == scr_globals::gsbd.as<void*>();
bool need_to_modify_wanted_level = g.session.wanted_level_all

View File

@ -34,9 +34,6 @@ namespace big
player& operator=(const player&) = default;
player& operator=(player&&) noexcept = default;
float screen_position_x = -1.f;
float screen_position_y = -1.f;
[[nodiscard]] CVehicle* get_current_vehicle() const;
[[nodiscard]] const char* get_name() const;
[[nodiscard]] rage::rlGamerInfo* get_net_data() const;
@ -64,7 +61,6 @@ namespace big
bool kill_loop = false;
bool explosion_loop = false;
bool freeze_loop = false;
bool ragdoll_loop = false;
bool rotate_cam_loop = false;
@ -98,6 +94,9 @@ namespace big
bool log_clones = false;
bool log_network_events = false;
bool trigger_desync_kick = false;
bool trigger_end_session_kick = false;
int spectating_player = -1;
protected:

View File

@ -29,8 +29,6 @@ namespace big
void player_service::do_cleanup()
{
m_player_to_use_end_session_kick.reset();
m_player_to_use_complaint_kick.reset();
m_selected_player = m_dummy;
m_players.clear();
}
@ -117,12 +115,6 @@ namespace big
});
it != m_players.end())
{
if (m_player_to_use_end_session_kick == it->second)
m_player_to_use_end_session_kick = std::nullopt;
if (m_player_to_use_complaint_kick == it->second)
m_player_to_use_complaint_kick = std::nullopt;
m_players.erase(it);
}
}

View File

@ -53,9 +53,6 @@ namespace big
}
void set_selected(player_ptr plyr);
std::optional<player_ptr> m_player_to_use_end_session_kick = std::nullopt;
std::optional<player_ptr> m_player_to_use_complaint_kick = std::nullopt;
};
inline player_service* g_player_service{};

View File

@ -18,10 +18,11 @@ namespace big
static uint8_t* get_code_address(script_data* data, uint32_t index);
static const std::optional<uint32_t> get_code_location_by_pattern(script_data* data, const memory::pattern& pattern);
public:
void enable(script_data* data);
void disable(script_data* data);
public:
inline rage::joaat_t get_script()
{
return m_script;

View File

@ -123,6 +123,9 @@ namespace big::chat
{
inline SpamReason is_text_spam(const char* text, player_ptr player)
{
if ((player->is_trusted || (g.session.trust_friends && player->is_friend())))
return SpamReason::NOT_A_SPAMMER; // don't filter messages from friends
if (g.session.use_spam_timer)
{
if (player->last_message_time.has_value())

View File

@ -83,6 +83,13 @@ namespace big
components::button("REMOVE_BLACKSCREEN"_T, [] {
CAM::DO_SCREEN_FADE_IN(0);
PLAYER::SET_PLAYER_CONTROL(self::id, true, 0);
ENTITY::FREEZE_ENTITY_POSITION(self::ped, false);
MISC::FORCE_GAME_STATE_PLAYING();
if (self::veh == 0)
TASK::CLEAR_PED_TASKS_IMMEDIATELY(self::ped);
HUD::DISPLAY_RADAR(true);
HUD::DISPLAY_HUD(true);
});
components::button("TP_TO_SAFE_POS"_T, [] {

View File

@ -97,8 +97,6 @@ namespace big
ImGui::Checkbox("KILL_LOOP"_T.data(), &g_player_service->get_selected()->kill_loop);
ImGui::SameLine();
ImGui::Checkbox("EXPLOSION_LOOP"_T.data(), &g_player_service->get_selected()->explosion_loop);
ImGui::SameLine();
ImGui::Checkbox("FREEZE_LOOP"_T.data(), &g_player_service->get_selected()->freeze_loop);
ImGui::Checkbox("RAGDOLL_LOOP"_T.data(), &g_player_service->get_selected()->ragdoll_loop);
ImGui::SameLine();