maint: update
This commit is contained in:
@ -62,7 +62,6 @@ namespace bots
|
||||
return;
|
||||
}
|
||||
|
||||
// SV_BotGetRandomName
|
||||
const auto* const bot_name = game::SV_BotGetRandomName();
|
||||
const auto* bot_ent = game::SV_AddBot(bot_name);
|
||||
if (bot_ent)
|
||||
|
@ -1,14 +1,13 @@
|
||||
#include <std_include.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include "game/game.hpp"
|
||||
#include "game/engine/sv_game.hpp"
|
||||
#include "game/dvars.hpp"
|
||||
|
||||
#include "command.hpp"
|
||||
#include "console.hpp"
|
||||
#include "game_console.hpp"
|
||||
#include "scheduler.hpp"
|
||||
#include "fastfiles.hpp"
|
||||
#include "game_console.hpp"
|
||||
|
||||
#include <utils/hook.hpp>
|
||||
#include <utils/string.hpp>
|
||||
@ -236,15 +235,13 @@ namespace command
|
||||
{
|
||||
if (!dvars::sv_cheats->current.enabled)
|
||||
{
|
||||
game::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE,
|
||||
"f \"Cheats are not enabled on this server\"");
|
||||
game::engine::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE, "f \"Cheats are not enabled on this server\"");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ent->health < 1)
|
||||
{
|
||||
game::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE,
|
||||
"f \"You must be alive to use this command\"");
|
||||
game::engine::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE, "f \"You must be alive to use this command\"");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -582,8 +579,7 @@ namespace command
|
||||
|
||||
ent->flags ^= game::FL_GODMODE;
|
||||
|
||||
game::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE,
|
||||
utils::string::va("f \"godmode %s\"", (ent->flags & game::FL_GODMODE) ? "^2on" : "^1off"));
|
||||
game::engine::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE, utils::string::va("f \"godmode %s\"", (ent->flags & game::FL_GODMODE) ? "^2on" : "^1off"));
|
||||
});
|
||||
|
||||
add_sv("demigod", [](game::mp::gentity_s* ent, const params_sv&)
|
||||
@ -593,8 +589,7 @@ namespace command
|
||||
|
||||
ent->flags ^= game::FL_DEMI_GODMODE;
|
||||
|
||||
game::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE,
|
||||
utils::string::va("f \"demigod mode %s\"", (ent->flags & game::FL_DEMI_GODMODE) ? "^2on" : "^1off"));
|
||||
game::engine::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE, utils::string::va("f \"demigod mode %s\"", (ent->flags & game::FL_DEMI_GODMODE) ? "^2on" : "^1off"));
|
||||
});
|
||||
|
||||
add_sv("notarget", [](game::mp::gentity_s* ent, const params_sv&)
|
||||
@ -604,8 +599,7 @@ namespace command
|
||||
|
||||
ent->flags ^= game::FL_NOTARGET;
|
||||
|
||||
game::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE,
|
||||
utils::string::va("f \"notarget %s\"", (ent->flags & game::FL_NOTARGET) ? "^2on" : "^1off"));
|
||||
game::engine::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE, utils::string::va("f \"notarget %s\"", (ent->flags & game::FL_NOTARGET) ? "^2on" : "^1off"));
|
||||
});
|
||||
|
||||
add_sv("noclip", [](game::mp::gentity_s* ent, const params_sv&)
|
||||
@ -615,8 +609,7 @@ namespace command
|
||||
|
||||
ent->client->flags ^= 1;
|
||||
|
||||
game::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE,
|
||||
utils::string::va("f \"noclip %s\"", ent->client->flags & 1 ? "^2on" : "^1off"));
|
||||
game::engine::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE, utils::string::va("f \"noclip %s\"", ent->client->flags & 1 ? "^2on" : "^1off"));
|
||||
});
|
||||
|
||||
add_sv("ufo", [](game::mp::gentity_s* ent, const params_sv&)
|
||||
@ -626,8 +619,7 @@ namespace command
|
||||
|
||||
ent->client->flags ^= 2;
|
||||
|
||||
game::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE,
|
||||
utils::string::va("f \"ufo %s\"", ent->client->flags & 2 ? "^2on" : "^1off"));
|
||||
game::engine::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE, utils::string::va("f \"ufo %s\"", ent->client->flags & 2 ? "^2on" : "^1off"));
|
||||
});
|
||||
|
||||
add_sv("give", [](game::mp::gentity_s* ent, const params_sv& params)
|
||||
@ -637,8 +629,7 @@ namespace command
|
||||
|
||||
if (params.size() < 2)
|
||||
{
|
||||
game::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE,
|
||||
"f \"You did not specify a weapon name\"");
|
||||
game::engine::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE, "f \"You did not specify a weapon name\"");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -661,8 +652,7 @@ namespace command
|
||||
|
||||
if (params.size() < 2)
|
||||
{
|
||||
game::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE,
|
||||
"f \"You did not specify a weapon name\"");
|
||||
game::engine::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE, "f \"You did not specify a weapon name\"");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <std_include.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
#include "game/game.hpp"
|
||||
#include "game/engine/sv_game.hpp"
|
||||
|
||||
#include "console.hpp"
|
||||
#include "scheduler.hpp"
|
||||
@ -99,8 +100,7 @@ namespace dedicated
|
||||
|
||||
for (const auto& command : queue)
|
||||
{
|
||||
game::Cbuf_AddText(0, command.data());
|
||||
game::Cbuf_AddText(0, "\n");
|
||||
command::execute(command);
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,36 +123,10 @@ namespace dedicated
|
||||
|
||||
void kill_server()
|
||||
{
|
||||
for (auto i = 0; i < *game::mp::svs_numclients; ++i)
|
||||
{
|
||||
if (game::mp::svs_clients[i].header.state >= 3)
|
||||
{
|
||||
game::SV_GameSendServerCommand(i, game::SV_CMD_CAN_IGNORE,
|
||||
utils::string::va("r \"%s\"", "EXE_ENDOFGAME"));
|
||||
}
|
||||
}
|
||||
game::engine::SV_GameSendServerCommand(-1, game::SV_CMD_CAN_IGNORE, utils::string::va("r \"%s\"", "EXE_ENDOFGAME"));
|
||||
|
||||
com_quit_f_hook.invoke<void>();
|
||||
}
|
||||
|
||||
void sys_error_stub(const char* msg, ...)
|
||||
{
|
||||
char buffer[2048]{};
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, msg);
|
||||
|
||||
vsnprintf_s(buffer, _TRUNCATE, msg, ap);
|
||||
|
||||
va_end(ap);
|
||||
|
||||
scheduler::once([]
|
||||
{
|
||||
command::execute("map_rotate");
|
||||
}, scheduler::main, 3s);
|
||||
|
||||
game::Com_Error(game::ERR_DROP, "%s", buffer);
|
||||
}
|
||||
}
|
||||
|
||||
void initialize()
|
||||
@ -190,8 +164,6 @@ namespace dedicated
|
||||
// Don't allow sv_hostname to be changed by the game
|
||||
dvars::disable::set_string("sv_hostname");
|
||||
|
||||
// Stop crashing from sys_errors
|
||||
utils::hook::jump(0x1404D6260, sys_error_stub);
|
||||
|
||||
// Hook R_SyncGpu
|
||||
utils::hook::jump(0x1405A7630, sync_gpu_stub);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <std_include.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include "game/game.hpp"
|
||||
#include "game/engine/sv_game.hpp"
|
||||
#include "game/dvars.hpp"
|
||||
|
||||
#include "console.hpp"
|
||||
@ -130,7 +130,7 @@ namespace dvar_cheats
|
||||
const auto* dvar = game::Scr_GetString(0); // grab the original dvar again since it's never stored on stack
|
||||
const auto* command = utils::string::va("q %s \"%s\"", dvar, value);
|
||||
|
||||
game::SV_GameSendServerCommand(entity_num, game::SV_CMD_RELIABLE, command);
|
||||
game::engine::SV_GameSendServerCommand(static_cast<char>(entity_num), game::SV_CMD_RELIABLE, command);
|
||||
}
|
||||
|
||||
const auto player_cmd_set_client_dvar = utils::hook::assemble([](utils::hook::assembler& a)
|
||||
|
@ -64,20 +64,22 @@ namespace filesystem
|
||||
|
||||
void startup()
|
||||
{
|
||||
register_path("s1");
|
||||
const auto base = std::filesystem::current_path();
|
||||
|
||||
register_path(base / "s1");
|
||||
register_path(get_binary_directory() + "\\data");
|
||||
|
||||
if (get_binary_directory() != std::filesystem::current_path())
|
||||
if (get_binary_directory() != base)
|
||||
{
|
||||
register_path(std::filesystem::current_path() / "data");
|
||||
register_path(base / "data");
|
||||
}
|
||||
|
||||
// game's search paths
|
||||
register_path("devraw");
|
||||
register_path("devraw_shared");
|
||||
register_path("raw_shared");
|
||||
register_path("raw");
|
||||
register_path("main");
|
||||
register_path(base / "devraw");
|
||||
register_path(base / "devraw_shared");
|
||||
register_path(base / "raw_shared");
|
||||
register_path(base / "raw");
|
||||
register_path(base / "main");
|
||||
}
|
||||
|
||||
void check_for_startup()
|
||||
|
@ -419,7 +419,7 @@ namespace gsc
|
||||
public:
|
||||
void post_load() override
|
||||
{
|
||||
gsc_ctx = std::make_unique<xsk::gsc::s1_pc::context>();
|
||||
gsc_ctx = std::make_unique<xsk::gsc::s1_pc::context>(xsk::gsc::instance::server);
|
||||
}
|
||||
|
||||
void post_unpack() override
|
||||
|
@ -29,7 +29,7 @@ namespace lui
|
||||
{
|
||||
if (params.size() <= 1)
|
||||
{
|
||||
console::info("usage: lui_open <name>\n");
|
||||
console::info("USAGE: %s <name>\n", params.get(0));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ namespace lui
|
||||
{
|
||||
if (params.size() <= 1)
|
||||
{
|
||||
console::info("usage: lui_open_popup <name>\n");
|
||||
console::info("USAGE: %s <name>\n", params.get(0));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <std_include.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
#include "game/game.hpp"
|
||||
#include "game/engine/sv_game.hpp"
|
||||
#include "game/dvars.hpp"
|
||||
|
||||
#include "party.hpp"
|
||||
@ -442,7 +443,7 @@ namespace party
|
||||
{
|
||||
scheduler::once([i, reason]
|
||||
{
|
||||
game::SV_KickClientNum(i, reason.data());
|
||||
game::SV_KickClientNum(i, reason.c_str());
|
||||
}, scheduler::pipeline::server);
|
||||
}
|
||||
return;
|
||||
@ -456,7 +457,7 @@ namespace party
|
||||
|
||||
scheduler::once([client_num, reason]()
|
||||
{
|
||||
game::SV_KickClientNum(client_num, reason.data());
|
||||
game::SV_KickClientNum(client_num, reason.c_str());
|
||||
}, scheduler::pipeline::server);
|
||||
});
|
||||
|
||||
@ -476,9 +477,8 @@ namespace party
|
||||
const auto message = params.join(2);
|
||||
const auto* const name = game::Dvar_FindVar("sv_sayName")->current.string;
|
||||
|
||||
game::SV_GameSendServerCommand(client_num, game::SV_CMD_CAN_IGNORE,
|
||||
utils::string::va("%c \"%s: %s\"", 84, name, message.data()));
|
||||
printf("%s -> %i: %s\n", name, client_num, message.data());
|
||||
game::engine::SV_GameSendServerCommand(static_cast<char>(client_num), game::SV_CMD_CAN_IGNORE, utils::string::va("%c \"%s: %s\"", 84, name, message.c_str()));
|
||||
printf("%s -> %i: %s\n", name, client_num, message.c_str());
|
||||
});
|
||||
|
||||
command::add("tellraw", [](const command::params& params)
|
||||
@ -491,9 +491,8 @@ namespace party
|
||||
const auto client_num = atoi(params.get(1));
|
||||
const auto message = params.join(2);
|
||||
|
||||
game::SV_GameSendServerCommand(client_num, game::SV_CMD_CAN_IGNORE,
|
||||
utils::string::va("%c \"%s\"", 84, message.data()));
|
||||
printf("%i: %s\n", client_num, message.data());
|
||||
game::engine::SV_GameSendServerCommand(static_cast<char>(client_num), game::SV_CMD_CAN_IGNORE, utils::string::va("%c \"%s\"", 84, message.c_str()));
|
||||
printf("%i: %s\n", client_num, message.c_str());
|
||||
});
|
||||
|
||||
command::add("say", [](const command::params& params)
|
||||
@ -506,9 +505,8 @@ namespace party
|
||||
const auto message = params.join(1);
|
||||
const auto* const name = game::Dvar_FindVar("sv_sayName")->current.string;
|
||||
|
||||
game::SV_GameSendServerCommand(
|
||||
-1, game::SV_CMD_CAN_IGNORE, utils::string::va("%c \"%s: %s\"", 84, name, message.data()));
|
||||
printf("%s: %s\n", name, message.data());
|
||||
game::engine::SV_GameSendServerCommand(-1, game::SV_CMD_CAN_IGNORE, utils::string::va("%c \"%s: %s\"", 84, name, message.c_str()));
|
||||
printf("%s: %s\n", name, message.c_str());
|
||||
});
|
||||
|
||||
command::add("sayraw", [](const command::params& params)
|
||||
@ -520,8 +518,7 @@ namespace party
|
||||
|
||||
const auto message = params.join(1);
|
||||
|
||||
game::SV_GameSendServerCommand(-1, game::SV_CMD_CAN_IGNORE,
|
||||
utils::string::va("%c \"%s\"", 84, message.data()));
|
||||
game::engine::SV_GameSendServerCommand(-1, game::SV_CMD_CAN_IGNORE, utils::string::va("%c \"%s\"", 84, message.c_str()));
|
||||
printf("%s\n", message.data());
|
||||
});
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <std_include.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
#include "game/game.hpp"
|
||||
#include "game/engine/sv_game.hpp"
|
||||
#include "game/dvars.hpp"
|
||||
|
||||
#include "command.hpp"
|
||||
@ -178,7 +179,7 @@ namespace patches
|
||||
const auto client = &game::mp::svs_clients[ent->s.number];
|
||||
|
||||
// 22 => "end_game"
|
||||
if (menu_id == 22 && client->header.remoteAddress.type != game::NA_LOOPBACK)
|
||||
if (menu_id == 22 && client->header.netchan.remoteAddress.type != game::NA_LOOPBACK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -239,6 +240,10 @@ namespace patches
|
||||
|
||||
static void patch_mp()
|
||||
{
|
||||
// Bypass Arxan function
|
||||
utils::hook::nop(0x14043E120, 9);
|
||||
utils::hook::jump(0x14043E120, game::engine::SV_GameSendServerCommand);
|
||||
|
||||
// Use name dvar
|
||||
live_get_local_client_name_hook.create(0x1404D47F0, &live_get_local_client_name);
|
||||
|
||||
|
@ -96,8 +96,8 @@ namespace rcon
|
||||
(client->header.state == 2) ? "CNCT" : (client->header.state == 1) ? "ZMBI" : utils::string::va("%4i", game::SV_GetClientPing(i)),
|
||||
game::SV_GetGuid(i),
|
||||
clean_name,
|
||||
network::net_adr_to_string(client->header.remoteAddress),
|
||||
client->header.remoteAddress.port)
|
||||
network::net_adr_to_string(client->header.netchan.remoteAddress),
|
||||
client->header.netchan.remoteAddress.port)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -206,6 +206,27 @@ namespace ui_scripting
|
||||
setup_functions();
|
||||
|
||||
lua["print"] = function(reinterpret_cast<game::hks::lua_function>(0x14007CB70));
|
||||
|
||||
lua["directoryexists"] = [](const std::string& string)
|
||||
{
|
||||
return utils::io::directory_exists(string);
|
||||
};
|
||||
|
||||
lua["listfiles"] = [](const std::string& string)
|
||||
{
|
||||
return utils::io::list_files(string);
|
||||
};
|
||||
|
||||
lua["directoryisempty"] = [](const std::string& string)
|
||||
{
|
||||
return utils::io::directory_is_empty(string);
|
||||
};
|
||||
|
||||
lua["fileexists"] = [](const std::string& string)
|
||||
{
|
||||
return utils::io::file_exists(string);
|
||||
};
|
||||
|
||||
lua["table"]["unpack"] = lua["unpack"];
|
||||
lua["luiglobals"] = lua;
|
||||
|
||||
|
Reference in New Issue
Block a user