add lui logging
This commit is contained in:
parent
a349d386cb
commit
f026440581
@ -140,7 +140,8 @@ namespace command
|
||||
|
||||
bool check_cheats(int client_num)
|
||||
{
|
||||
if (!game::Dvar_FindVar("sv_cheats")->current.enabled)
|
||||
const auto sv_cheats = game::Dvar_FindVar("sv_cheats");
|
||||
if (!sv_cheats || !sv_cheats->current.enabled)
|
||||
{
|
||||
client_println(client_num, "Cheats are not enabled on this server");
|
||||
return false;
|
||||
|
@ -50,14 +50,13 @@ namespace fastfiles
|
||||
return db_init_load_x_file_hook.invoke<void>(name, offset);
|
||||
}
|
||||
|
||||
void db_load_x_zone_stub(const char* parent_name, unsigned int zone_flags, bool is_base_map, int failure_mode)
|
||||
void db_load_x_zone_stub(const char* parent_name, const unsigned int zone_flags, const bool is_base_map, const int failure_mode)
|
||||
{
|
||||
console::info("Loading zone %s\n", parent_name);
|
||||
|
||||
return db_load_x_zone_hook.invoke<void>(parent_name, zone_flags, is_base_map, failure_mode);
|
||||
}
|
||||
|
||||
game::XAssetHeader db_find_xasset_header_stub(game::XAssetType type, const char* name, int allow_create_default)
|
||||
game::XAssetHeader db_find_xasset_header_stub(game::XAssetType type, const char* name, const int allow_create_default)
|
||||
{
|
||||
auto result = db_find_xasset_header_hook.invoke<game::XAssetHeader>(type, name, allow_create_default);
|
||||
if (!result.data)
|
||||
|
@ -16,9 +16,9 @@ namespace logger
|
||||
console::info(msg);
|
||||
}
|
||||
|
||||
void print(const char* msg, ...)
|
||||
void print_info(const char* msg, ...)
|
||||
{
|
||||
char buffer[2048]{ 0 };
|
||||
char buffer[0x1000]{ 0 };
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, msg);
|
||||
@ -30,15 +30,49 @@ namespace logger
|
||||
console::info(buffer);
|
||||
}
|
||||
|
||||
void sys_print_stubs()
|
||||
void print_warn(const char* msg, ...)
|
||||
{
|
||||
utils::hook::call(0xC6E57A_b, sys_print_stub); // SV_SpawnServer: completed\n
|
||||
utils::hook::call(0xC13641_b, sys_print_stub); // SV_CmdsSP_MapRestart: completed\n
|
||||
utils::hook::jump(0x519772_b, sys_print_stub); // OnlineAutoTest:: Map load success. Server is listen.\n
|
||||
utils::hook::call(0xB712BA_b, sys_print_stub); // G_SaveError
|
||||
char buffer[0x1000]{ 0 };
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, msg);
|
||||
|
||||
vsnprintf_s(buffer, sizeof(buffer), _TRUNCATE, msg, ap);
|
||||
|
||||
va_end(ap);
|
||||
|
||||
console::warn(buffer);
|
||||
}
|
||||
|
||||
void r_warn_once_per_frame_print_stub(char* buffer, size_t buffer_length, char* msg, va_list va)
|
||||
void print_error(const char* msg, ...)
|
||||
{
|
||||
char buffer[0x1000]{ 0 };
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, msg);
|
||||
|
||||
vsnprintf_s(buffer, sizeof(buffer), _TRUNCATE, msg, ap);
|
||||
|
||||
va_end(ap);
|
||||
|
||||
console::error(buffer);
|
||||
}
|
||||
|
||||
void print_debug(const char* msg, ...)
|
||||
{
|
||||
char buffer[0x1000]{ 0 };
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, msg);
|
||||
|
||||
vsnprintf_s(buffer, sizeof(buffer), _TRUNCATE, msg, ap);
|
||||
|
||||
va_end(ap);
|
||||
|
||||
console::debug(buffer);
|
||||
}
|
||||
|
||||
void r_warn_once_per_frame_vsnprintf_stub(char* buffer, size_t buffer_length, char* msg, va_list va)
|
||||
{
|
||||
vsnprintf(buffer, buffer_length, msg, va);
|
||||
console::warn(buffer);
|
||||
@ -50,17 +84,25 @@ namespace logger
|
||||
public:
|
||||
void post_unpack() override
|
||||
{
|
||||
sys_print_stubs();
|
||||
// Sys_Print
|
||||
utils::hook::call(0xC6E57A_b, sys_print_stub); // SV_SpawnServer: completed\n
|
||||
utils::hook::call(0xC13641_b, sys_print_stub); // SV_CmdsSP_MapRestart: completed\n
|
||||
utils::hook::jump(0x519772_b, sys_print_stub); // OnlineAutoTest:: Map load success. Server is listen.\n
|
||||
utils::hook::call(0xB712BA_b, sys_print_stub); // G_SaveError
|
||||
|
||||
// com_printf
|
||||
utils::hook::jump(0x343080_b, print);
|
||||
// Com_Printf
|
||||
utils::hook::jump(0x343080_b, print_info);
|
||||
|
||||
if (!game::environment::is_dedi())
|
||||
{
|
||||
utils::hook::call(0xE4B121_b, r_warn_once_per_frame_print_stub);
|
||||
// LUI_Interface_DebugPrint
|
||||
utils::hook::jump(0x61C430_b, print_debug);
|
||||
|
||||
// R_WarnOncePerFrame
|
||||
utils::hook::call(0xE4B121_b, r_warn_once_per_frame_vsnprintf_stub);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//REGISTER_COMPONENT(logger::component)
|
||||
REGISTER_COMPONENT(logger::component)
|
@ -9,8 +9,8 @@ namespace game
|
||||
|
||||
void load_base_address()
|
||||
{
|
||||
const auto module = GetModuleHandle(NULL);
|
||||
base_address = uint64_t(module);
|
||||
const auto module = GetModuleHandleA(0);
|
||||
base_address = reinterpret_cast<uint64_t>(module);
|
||||
}
|
||||
|
||||
int Cmd_Argc()
|
||||
@ -49,7 +49,7 @@ namespace game
|
||||
"xanim",
|
||||
"xmodelsurfs",
|
||||
"xmodel",
|
||||
"mayhem", // not confirmed
|
||||
"mayhem",
|
||||
"material",
|
||||
"computeshader",
|
||||
"vertexshader",
|
||||
|
Loading…
Reference in New Issue
Block a user