maint: April update
This commit is contained in:
parent
1ac8a93a32
commit
0857be79df
@ -197,6 +197,7 @@ namespace bots
|
||||
{
|
||||
const std::string received_data{ data };
|
||||
bot_names = utils::string::split(received_data, '\n');
|
||||
console::info("Got %zu names from the master server\n", bot_names.size());
|
||||
bot_names_received = true;
|
||||
}
|
||||
});
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "console.hpp"
|
||||
#include "dvars.hpp"
|
||||
#include "network.hpp"
|
||||
#include "party.hpp"
|
||||
|
||||
#include <utils/hook.hpp>
|
||||
#include <utils/string.hpp>
|
||||
@ -89,8 +90,7 @@ namespace network
|
||||
return net_compare_base_address(a1, a2) && a1->port == a2->port;
|
||||
}
|
||||
|
||||
void reconnect_migratated_client(void*, game::netadr_s* from, const int, const int, const char*,
|
||||
const char*, bool)
|
||||
void reconnect_migrated_client(void*, 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
|
||||
@ -210,7 +210,7 @@ namespace network
|
||||
utils::hook::nop(0x14043FFF8, 6);
|
||||
|
||||
utils::hook::jump(0x1403DA700, net_compare_address);
|
||||
utils::hook::jump(0x1403DA750, net_compare_base_address);
|
||||
utils::hook::jump(0x1403DA750, net_compare_address);
|
||||
|
||||
// don't establish secure conenction
|
||||
utils::hook::set<uint8_t>(0x140232BBD, 0xEB);
|
||||
@ -244,8 +244,8 @@ namespace network
|
||||
// ignore dw handle in SV_DirectConnect
|
||||
utils::hook::set<uint8_t>(0x140439BA8, 0xEB);
|
||||
utils::hook::set<uint8_t>(0x140439DA5, 0xEB);
|
||||
utils::hook::call(0x140439B9B, &net_compare_address);
|
||||
utils::hook::call(0x140439D98, &net_compare_address);
|
||||
utils::hook::call(0x140439B9B, net_compare_address);
|
||||
utils::hook::call(0x140439D98, net_compare_address);
|
||||
|
||||
// increase cl_maxpackets
|
||||
dvars::override::register_int("cl_maxpackets", 1000, 1, 1000, game::DVAR_FLAG_SAVED);
|
||||
@ -264,7 +264,7 @@ namespace network
|
||||
utils::hook::jump(0x1404D842B, 0x1404D8453);
|
||||
|
||||
// don't try to reconnect client
|
||||
utils::hook::call(0x140439D4D, reconnect_migratated_client);
|
||||
utils::hook::call(0x140439D4D, reconnect_migrated_client);
|
||||
utils::hook::nop(0x140439D28, 4); // this crashes when reconnecting for some reason
|
||||
|
||||
// allow server owner to modify net_port before the socket bind
|
||||
@ -280,6 +280,19 @@ namespace network
|
||||
|
||||
// ignore built in "print" oob command for security reasons
|
||||
utils::hook::set<std::uint8_t>(0x14020A723, 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(0x1403DA8A4, memmove_stub); // NET_DeferPacketToClient
|
||||
|
@ -94,9 +94,9 @@ namespace patches
|
||||
{
|
||||
if (args.size() == 1)
|
||||
{
|
||||
const auto* const current = game::Dvar_ValueToString(dvar, dvar->current);
|
||||
const auto* const 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
|
||||
|
@ -16,6 +16,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)
|
||||
@ -24,14 +25,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();
|
||||
}
|
||||
|
||||
void send_rcon_command(const std::string& password, const std::string& data)
|
||||
@ -104,7 +109,7 @@ namespace rcon
|
||||
|
||||
if (is_redirecting_)
|
||||
{
|
||||
network::send(redirect_target_, "print", message);
|
||||
redirect_buffer.append(message);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,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;
|
||||
|
@ -76,14 +76,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";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -114,7 +114,7 @@ namespace dvars
|
||||
{
|
||||
if (domain.integer.max == INT_MAX)
|
||||
{
|
||||
return "Domain is any integer"s;
|
||||
return "Domain is any integer";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -131,10 +131,10 @@ namespace dvars
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -144,7 +144,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);
|
||||
|
Loading…
Reference in New Issue
Block a user