Initial battleye bypass (#3697)

* feat: initial battleye bypass
* disable force kick toggle too
* fix: fix pointers version
* enable exclude modders toggle by default to prevent auto-kicks
This commit is contained in:
maybegreat48 2024-09-18 22:43:52 +00:00 committed by GitHub
parent b3f1c8b5d4
commit 220322b910
15 changed files with 7816 additions and 7728 deletions

View File

@ -6592,4 +6592,5 @@
0xE6D323A5E9EFFB76,0xE6D323A5E9EFFB76
0xBEB0D930B3CCE4D5,0xBEB0D930B3CCE4D5
0x1FCB07FE230B6639,0x1FCB07FE230B6639
0x1423725069EE1D14,0x1423725069EE1D14
0x1423725069EE1D14,0x1423725069EE1D14
0x7F7E8401F81CB65B,0x7F7E8401F81CB65B

View File

@ -50884,6 +50884,16 @@
"_GET_ONLINE_VERSION"
]
},
"0x7F7E8401F81CB65B": {
"name": "_GET_BATTLEYE_INIT_STATE",
"jhash": "",
"comment": "",
"params": [],
"return_type": "int",
"build": "3323",
"old_names": [
]
},
"0x054354A99211EB96": {
"name": "NETWORK_IS_SIGNED_IN",
"jhash": "0xADD0B40F",

View File

@ -15,10 +15,32 @@
#include "services/vehicle/xml_vehicles_service.hpp"
#include "services/xml_maps/xml_map_service.hpp"
#include <game_files/GameDataHash.hpp>
namespace big
{
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};
if (auto hashes = *g_pointers->m_gta.m_game_data_hash)
{
for (int i = 0; i < valid_hashes.size(); i++)
hashes->m_data[i] = valid_hashes[i];
}
}
void backend::loop()
{
bypass_battleye();
for (auto& command : g_bool_commands)
command->refresh();
@ -32,6 +54,8 @@ namespace big
while (g_running)
{
bypass_battleye();
looped::system_self_globals();
looped::system_update_pointers();
looped::system_update_desync_kick();

View File

@ -5,11 +5,29 @@
namespace big
{
static bool is_next_in_queue()
{
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)
{
if (plyr->is_host())
continue;
if (plyr->get_net_data()->m_host_token < my_host_token)
{
return false;
}
}
return true;
}
static bool bLastKickHost = false;
void looped::session_auto_kick_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) [[unlikely]]
if (kick_host && !bLastKickHost && is_next_in_queue()) [[unlikely]]
{
g_player_service->iterate([](auto& plyr) {
// Don't kick trusted players

View File

@ -417,6 +417,8 @@ namespace big
InputMethodEditor* m_ime;
functions::get_last_keyboard_state m_get_last_keyboard_state;
PVOID m_network_can_access_multiplayer;
};
#pragma pack(pop)
static_assert(sizeof(gta_pointers) % 8 == 0, "Pointers are not properly aligned");

View File

@ -156,6 +156,8 @@ namespace big
detour_hook_helper::add<hooks::create_pool_item>("CPI", g_pointers->m_gta.m_create_pool_item);
detour_hook_helper::add<hooks::network_can_access_multiplayer>("NCAM", g_pointers->m_gta.m_network_can_access_multiplayer);
g_hooking = this;
}

View File

@ -213,6 +213,8 @@ namespace big
static void error_packet_memmove(void* dst, void* src, int size);
static void* create_pool_item(GenericPool* pool);
static bool network_can_access_multiplayer(void* a1, int* error);
};
class minhook_keepalive

View File

@ -0,0 +1,12 @@
#include "hooking/hooking.hpp"
namespace big
{
bool hooks::network_can_access_multiplayer(void* a1, int* error)
{
if (error)
*error = 0;
return true;
}
}

File diff suppressed because one or more lines are too long

View File

@ -98,6 +98,7 @@ namespace big
add_native_detour(NativeIndex::UNREGISTER_SCRIPT_VARIABLE, all_scripts::DO_NOTHING);
add_native_detour(NativeIndex::FORCE_CHECK_SCRIPT_VARIABLES, all_scripts::DO_NOTHING);
add_native_detour(NativeIndex::NETWORK_CONCEAL_PLAYER, all_scripts::NETWORK_CONCEAL_PLAYER);
add_native_detour(NativeIndex::_GET_BATTLEYE_INIT_STATE, all_scripts::RETURN_FALSE);
add_native_detour("shop_controller"_J, NativeIndex::IS_PED_SHOOTING, all_scripts::RETURN_FALSE); // prevent exploit reports
add_native_detour("shop_controller"_J, NativeIndex::SET_WARNING_MESSAGE_WITH_HEADER, shop_controller::SET_WARNING_MESSAGE_WITH_HEADER);

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
#include "gta_pointers_layout_info.hpp"
#include "sc_pointers_layout_info.hpp"
#define GTA_VERSION_TARGET "1.69-3274"
#define GTA_VERSION_TARGET "1.69-3323"
namespace big
{
@ -1977,6 +1977,15 @@ namespace big
{
g_pointers->m_gta.m_get_last_keyboard_state = ptr.as<functions::get_last_keyboard_state>();
}
},
// Network Can Access Multiplayer
{
"NCAM",
"E8 ? ? ? ? 8B 54 24 30 89 13",
[](memory::handle ptr)
{
g_pointers->m_gta.m_network_can_access_multiplayer = ptr.add(1).rip().as<PVOID>();
}
}
>(); // don't leave a trailing comma at the end

View File

@ -35,6 +35,8 @@ namespace big
// TODO: the logic is incorrect
attributes->m_param_values[0] = -0x22F37A9E;
if (g.spoofing.spoof_session_bad_sport_status == 1)
attributes->m_param_values[0] |= (1 << 14); // Bad Sport

View File

@ -138,6 +138,9 @@ namespace big
{
for (int i = 0; i < token_spoof_types.size(); i++)
{
if (i == 0)
ImGui::BeginDisabled(); // this is now required due to battleye
if (ImGui::Selectable(g_translation_service.get_translation(token_spoof_types[i]).data(), i == g.session.spoof_host_token_type))
{
g.session.spoof_host_token_type = i;
@ -146,6 +149,9 @@ namespace big
}); // this part gets a bit racy so we're setting it in a fiber pool
}
if (i == 0)
ImGui::EndDisabled();
if (i == g.session.spoof_host_token_type)
{
ImGui::SetItemDefaultFocus();
@ -173,7 +179,9 @@ namespace big
if (g.session.spoof_host_token_type != 0)
{
ImGui::BeginDisabled();
ImGui::Checkbox("KICK_HOST_ON_JOIN"_T.data(), &g.session.kick_host_when_forcing_host);
ImGui::EndDisabled();
if (g.session.kick_host_when_forcing_host)
{

View File

@ -179,16 +179,11 @@ namespace big
{
ImGui::PushID(i);
ImGui::SetNextItemWidth(200);
if (ImGui::InputScalar("##data_hash_value", ImGuiDataType_U32, &g.spoofing.game_data_hash[i], nullptr, nullptr, "%08X", ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase))
if (ImGui::InputScalar(std::to_string(i).data(), ImGuiDataType_U32, &g.spoofing.game_data_hash[i], nullptr, nullptr, "%08X", ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase))
{
g.spoofing.game_data_hash_dirty = true;
}
ImGui::PopID();
if (((i - 1) % 3) != 0 && i != 14)
{
ImGui::SameLine();
}
}
ImGui::TreePop();
}