fixes
This commit is contained in:
parent
7463dd95a1
commit
d077447322
@ -3,7 +3,7 @@ include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
gtav_classes
|
||||
GIT_REPOSITORY https://github.com/Yimura/GTAV-Classes.git
|
||||
GIT_TAG e45f7f505ac2394c9213f1577831ab100cc74fa2
|
||||
GIT_TAG b1a2ef201bdbd8b4171e932d5c8de68cc9df0283
|
||||
GIT_PROGRESS TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
|
@ -230,6 +230,4 @@ namespace big::functions
|
||||
using can_do_damage_to_ped = bool (*)(CPed* from, CWeaponInfo* current_weapon, CPed* target);
|
||||
|
||||
using get_last_keyboard_state = KeyboardState (*)();
|
||||
|
||||
using base_64_encode = bool(*)(void* in, int in_size, char* out, int out_size, int* bytes_written);
|
||||
}
|
||||
|
@ -419,8 +419,6 @@ namespace big
|
||||
functions::get_last_keyboard_state m_get_last_keyboard_state;
|
||||
|
||||
PVOID m_network_can_access_multiplayer;
|
||||
|
||||
functions::base_64_encode m_base_64_encode;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
static_assert(sizeof(gta_pointers) % 8 == 0, "Pointers are not properly aligned");
|
||||
|
@ -753,7 +753,7 @@ namespace big
|
||||
|
||||
if (client && player)
|
||||
{
|
||||
g_battleye_service.recieve_message(player->get_net_game_player()->get_host_token(), &data, size);
|
||||
g_battleye_service.receive_message(player->get_net_game_player()->get_host_token(), &data, size);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -1986,15 +1986,6 @@ namespace big
|
||||
{
|
||||
g_pointers->m_gta.m_network_can_access_multiplayer = ptr.add(1).rip().as<PVOID>();
|
||||
}
|
||||
},
|
||||
// Base 64 Encode
|
||||
{
|
||||
"B64E",
|
||||
"8D 2C 95 01 00 00 00",
|
||||
[](memory::handle ptr)
|
||||
{
|
||||
g_pointers->m_gta.m_base_64_encode = ptr.sub(0x4F).as<functions::base_64_encode>();
|
||||
}
|
||||
}
|
||||
>(); // don't leave a trailing comma at the end
|
||||
|
||||
|
@ -8,6 +8,46 @@
|
||||
|
||||
#include <network/snSession.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
static std::string base64_encode(const std::string& data)
|
||||
{
|
||||
static constexpr char sEncodingTable[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'};
|
||||
|
||||
size_t in_len = data.size();
|
||||
size_t out_len = 4 * ((in_len + 2) / 3);
|
||||
std::string ret(out_len, '\0');
|
||||
size_t i;
|
||||
char* p = ret.data();
|
||||
|
||||
for (i = 0; i < in_len - 2; i += 3)
|
||||
{
|
||||
*p++ = sEncodingTable[(data[i] >> 2) & 0x3F];
|
||||
*p++ = sEncodingTable[((data[i] & 0x3) << 4) | ((int)(data[i + 1] & 0xF0) >> 4)];
|
||||
*p++ = sEncodingTable[((data[i + 1] & 0xF) << 2) | ((int)(data[i + 2] & 0xC0) >> 6)];
|
||||
*p++ = sEncodingTable[data[i + 2] & 0x3F];
|
||||
}
|
||||
if (i < in_len)
|
||||
{
|
||||
*p++ = sEncodingTable[(data[i] >> 2) & 0x3F];
|
||||
if (i == (in_len - 1))
|
||||
{
|
||||
*p++ = sEncodingTable[((data[i] & 0x3) << 4)];
|
||||
*p++ = '=';
|
||||
}
|
||||
else
|
||||
{
|
||||
*p++ = sEncodingTable[((data[i] & 0x3) << 4) | ((int)(data[i + 1] & 0xF0) >> 4)];
|
||||
*p++ = sEncodingTable[((data[i + 1] & 0xF) << 2)];
|
||||
}
|
||||
*p++ = '=';
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace big
|
||||
{
|
||||
class battleye_server : looped_command
|
||||
@ -175,14 +215,13 @@ namespace big
|
||||
return;
|
||||
|
||||
char string[32]{};
|
||||
char guid[45]{};
|
||||
|
||||
snprintf(string, sizeof(string), "%I64d", rockstar_id);
|
||||
g_pointers->m_gta.m_base_64_encode(string, strlen(string), guid, sizeof(guid), nullptr);
|
||||
|
||||
auto guid = base64_encode(string);
|
||||
|
||||
m_battleye_api.m_add_player(token, -1, 0, name, false);
|
||||
m_battleye_api.m_assign_guid(token, guid, strlen(guid));
|
||||
m_battleye_api.m_assign_guid_verified(token, guid, strlen(guid));
|
||||
m_battleye_api.m_assign_guid(token, guid.data(), guid.length());
|
||||
m_battleye_api.m_assign_guid_verified(token, guid.data(), guid.length());
|
||||
m_battleye_api.m_set_player_state(token, 1);
|
||||
}
|
||||
|
||||
@ -196,7 +235,7 @@ namespace big
|
||||
m_battleye_api.m_set_player_state(token, -1);
|
||||
}
|
||||
|
||||
void battleye_service::recieve_message(std::uint64_t token, void* message, int size)
|
||||
void battleye_service::receive_message(std::uint64_t token, void* message, int size)
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
|
||||
|
@ -50,7 +50,7 @@ namespace big
|
||||
void stop();
|
||||
void add_player(std::uint64_t token, std::uint64_t rockstar_id, const char* name);
|
||||
void remove_player(std::uint64_t token);
|
||||
void recieve_message(std::uint64_t token, void* message, int size);
|
||||
void receive_message(std::uint64_t token, void* message, int size);
|
||||
void send_message(std::uint64_t token, void* message, int size);
|
||||
void kick_player(std::uint64_t token, const char* reason);
|
||||
void script_func();
|
||||
|
Reference in New Issue
Block a user