maint: April update

This commit is contained in:
6arelyFuture 2024-04-26 11:04:02 +02:00
parent 97c48da499
commit 0090d894c4
6 changed files with 37 additions and 16 deletions

View File

@ -204,6 +204,7 @@ namespace bots
if (server_list::get_master_server(master) && !bot_names_received && target == master)
{
bot_names = utils::string::split(data, '\n');
console::info("Got %zu names from the master server\n", bot_names.size());
bot_names_received = true;
}
});

View File

@ -3,7 +3,9 @@
#include "game/game.hpp"
#include "command.hpp"
#include "console.hpp"
#include "network.hpp"
#include "party.hpp"
#include <utils/hook.hpp>
#include <utils/string.hpp>
@ -86,8 +88,7 @@ namespace network
return net_compare_base_address(a1, a2) && a1->port == a2->port;
}
void reconnect_migratated_client(game::mp::client_t*, game::netadr_s* from, const int, const int, const char*,
const char*, bool)
void reconnect_migrated_client(game::mp::client_t*, game::netadr_s* from, const int, const int, const char*, const char*, bool)
{
// This happens when a client tries to rejoin after being recently disconnected, OR by a duplicated guid
// We don't want this to do anything. It decides to crash seemingly randomly
@ -224,7 +225,7 @@ namespace network
utils::hook::jump(0x14041DFB0, utils::hook::assemble(set_xuid_config_string_stub), true);
utils::hook::jump(0x14041D010, net_compare_address);
utils::hook::jump(0x14041D060, net_compare_base_address);
utils::hook::jump(0x14041D060, net_compare_address);
// don't establish secure conenction
utils::hook::set<uint8_t>(0x1402ECF1D, 0xEB);
@ -275,13 +276,26 @@ namespace network
utils::hook::jump(0x1405019CB, 0x1405019F3);
// don't try to reconnect client
utils::hook::call(0x14047197E, reconnect_migratated_client);
utils::hook::call(0x14047197E, reconnect_migrated_client);
// allow server owner to modify net_port before the socket bind
utils::hook::call(0x140500FD0, register_netport_stub);
// ignore built in "print" oob command for security reasons
utils::hook::set<std::uint8_t>(0x1402C6AA4, 0xEB);
if (!game::environment::is_dedi())
{
// we need this on the client for RCon
on("print", [](const game::netadr_s& address, const std::string& message)
{
if (address != party::get_target())
{
return;
}
console::info("%s", message.data());
});
}
// patch buffer overflow
utils::hook::call(0x14041D17E, memmove_stub); // NET_DeferPacketToClient

View File

@ -132,14 +132,14 @@ namespace patches
{
if (args.size() == 1)
{
const auto current = game::Dvar_ValueToString(dvar, dvar->current);
const auto reset = game::Dvar_ValueToString(dvar, dvar->reset);
console::info("\"%s\" is: \"%s^7\" default: \"%s^7\"\n", dvar->name, current, reset);
const std::string current = game::Dvar_ValueToString(dvar, dvar->current);
const std::string reset = game::Dvar_ValueToString(dvar, dvar->reset);
console::info("\"%s\" is: \"%s^7\" default: \"%s^7\"\n", dvar->name, current.data(), reset.data());
console::info(" %s\n", dvars::dvar_get_domain(dvar->type, dvar->domain).data());
}
else
{
char command[0x1000] = {0};
char command[0x1000]{};
game::Dvar_GetCombinedString(command, 1);
game::Dvar_SetCommand(args.get(0), command);
}

View File

@ -15,6 +15,7 @@ namespace rcon
{
bool is_redirecting_ = false;
game::netadr_s redirect_target_ = {};
std::string redirect_buffer = {};
std::recursive_mutex redirect_lock;
void setup_redirect(const game::netadr_s& target)
@ -23,14 +24,18 @@ namespace rcon
is_redirecting_ = true;
redirect_target_ = target;
redirect_buffer.clear();
}
void clear_redirect()
{
std::lock_guard<std::recursive_mutex> $(redirect_lock);
network::send(redirect_target_, "print", redirect_buffer, '\n');
is_redirecting_ = false;
redirect_target_ = {};
redirect_buffer.clear();
}
std::string build_status_buffer()
@ -104,9 +109,10 @@ namespace rcon
if (is_redirecting_)
{
network::send(redirect_target_, "print\n", message);
redirect_buffer.append(message);
return true;
}
return false;
}

View File

@ -13,7 +13,7 @@ namespace demonware
{
auto result = new bdDMLRawData;
result->country_code = "US";
result->country_code = "'Murica";
result->country = "United States of America";
result->region = "New York";
result->city = "New York";
result->latitude = 0;

View File

@ -81,14 +81,14 @@ namespace dvars
switch (type)
{
case game::dvar_type::boolean:
return "Domain is 0 or 1"s;
return "Domain is 0 or 1";
case game::dvar_type::value:
if (domain.value.min == -FLT_MAX)
{
if (domain.value.max == FLT_MAX)
{
return "Domain is any number"s;
return "Domain is any number";
}
return utils::string::va("Domain is any number %g or smaller", domain.value.max);
@ -116,7 +116,7 @@ namespace dvars
{
if (domain.integer.max == INT_MAX)
{
return "Domain is any integer"s;
return "Domain is any integer";
}
return utils::string::va("Domain is any integer %i or smaller", domain.integer.max);
@ -130,10 +130,10 @@ namespace dvars
return utils::string::va("Domain is any integer from %i to %i", domain.integer.min, domain.integer.max);
case game::dvar_type::color:
return "Domain is any 4-component color, in RGBA format"s;
return "Domain is any 4-component color, in RGBA format";
case game::dvar_type::enumeration:
str = "Domain is one of the following:"s;
str = "Domain is one of the following:";
for (auto string_index = 0; string_index < domain.enumeration.stringCount; ++string_index)
{
@ -143,7 +143,7 @@ namespace dvars
return str;
case game::dvar_type::string:
return "Domain is any text"s;
return "Domain is any text";
default:
return utils::string::va("unhandled dvar type '%i'", type);