Auto Host Kick, become Host in Quere #1

This commit is contained in:
ThePosiDong 2024-10-24 07:15:31 +02:00
parent f844e77a0c
commit 4d567f35a4
3 changed files with 15 additions and 7 deletions

View File

@ -21,14 +21,23 @@ namespace big
{ {
void bypass_battleye() void bypass_battleye()
{ {
auto old = g.session.spoof_host_token_type;
g.session.spoof_host_token_type = std::max(old, 1);
if (old != g.session.spoof_host_token_type)
{
g.session.spoof_host_token_dirty = true;
}
g.session.kick_host_when_forcing_host = true;
g.session.exclude_modders_from_kick_host = true; // useful
constexpr std::array<std::uint32_t, 16> valid_hashes = {1410389794, 967, 1523678325, 472, 0, 0, 1323039495, 0, 0, 1731098795, 2256610353, 17956, 414639110, 307143837, 3443181821, 0}; constexpr std::array<std::uint32_t, 16> valid_hashes = {1410389794, 967, 1523678325, 472, 0, 0, 1323039495, 0, 0, 1731098795, 2256610353, 17956, 414639110, 307143837, 3443181821, 0};
if (auto hashes = *g_pointers->m_gta.m_game_data_hash) if (auto hashes = *g_pointers->m_gta.m_game_data_hash)
{ {
for (int i = 0; i < valid_hashes.size(); i++) for (int i = 0; i < valid_hashes.size(); i++)
{
hashes->m_data[i] = valid_hashes[i]; hashes->m_data[i] = valid_hashes[i];
} }
} }
}
void backend::loop() void backend::loop()
{ {

View File

@ -8,25 +8,24 @@ namespace big
static bool is_next_in_queue() static bool is_next_in_queue()
{ {
uint64_t my_host_token = g_player_service->get_self()->get_net_data()->m_host_token; uint64_t my_host_token = g_player_service->get_self()->get_net_data()->m_host_token;
for (const auto& plyr : g_player_service->players() | std::ranges::views::values) for (const auto& plyr : g_player_service->players() | std::ranges::views::values)
{ {
if (plyr->is_host()) if (plyr->is_host())
{
continue; continue;
}
if (plyr->get_net_data()->m_host_token < my_host_token) if (plyr->get_net_data()->m_host_token < my_host_token)
{ {
return false; return false;
} }
} }
return true; return true;
} }
static bool bLastKickHost = false; static bool bLastKickHost = false;
void looped::session_auto_kick_host() void looped::session_auto_kick_host()
{ {
#if 0
bool kick_host = *g_pointers->m_gta.m_is_session_started && g.session.spoof_host_token_type != 0 && g.session.kick_host_when_forcing_host; bool kick_host = *g_pointers->m_gta.m_is_session_started && g.session.spoof_host_token_type != 0 && g.session.kick_host_when_forcing_host;
if (kick_host && !bLastKickHost && is_next_in_queue()) [[unlikely]] if (kick_host && !bLastKickHost && is_next_in_queue()) [[unlikely]]
{ {
@ -43,6 +42,6 @@ namespace big
}); });
} }
bLastKickHost = kick_host; bLastKickHost = kick_host;
#endif
} }
} }

View File

@ -34,7 +34,7 @@ namespace big
attributes->m_param_values[2] = std::min(29u, attributes->m_param_values[2]); attributes->m_param_values[2] = std::min(29u, attributes->m_param_values[2]);
// TODO: the logic is incorrect // TODO: the logic is incorrect
attributes->m_param_values[0] = -0x22F37A9E;
if (g.spoofing.spoof_session_bad_sport_status == 1) if (g.spoofing.spoof_session_bad_sport_status == 1)
attributes->m_param_values[0] |= (1 << 14); // Bad Sport attributes->m_param_values[0] |= (1 << 14); // Bad Sport