2022-05-20 14:59:24 -04:00
|
|
|
#include <std_include.hpp>
|
|
|
|
#include "loader/component_loader.hpp"
|
|
|
|
|
|
|
|
#include "game/game.hpp"
|
|
|
|
|
|
|
|
#include "console.hpp"
|
|
|
|
|
|
|
|
#include <utils/hook.hpp>
|
|
|
|
|
|
|
|
namespace logger
|
|
|
|
{
|
|
|
|
namespace
|
|
|
|
{
|
2022-05-25 07:48:49 -04:00
|
|
|
void sys_print_stub(const char* msg)
|
2022-05-20 14:59:24 -04:00
|
|
|
{
|
2022-05-25 07:48:49 -04:00
|
|
|
console::info(msg);
|
2022-05-20 14:59:24 -04:00
|
|
|
}
|
|
|
|
|
2022-05-25 07:48:49 -04:00
|
|
|
void sys_print_stubs()
|
2022-05-20 14:59:24 -04:00
|
|
|
{
|
2022-05-25 07:48:49 -04:00
|
|
|
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
|
2022-05-26 23:25:26 -04:00
|
|
|
utils::hook::call(0xB712BA_b, sys_print_stub); // G_SaveError
|
2022-05-20 14:59:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void R_WarnOncePerFrame_print_stub(char* buffer, size_t buffer_length, char* msg, va_list va)
|
|
|
|
{
|
|
|
|
vsnprintf(buffer, buffer_length, msg, va);
|
|
|
|
console::warn(buffer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class component final : public component_interface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void post_unpack() override
|
|
|
|
{
|
2022-05-25 07:48:49 -04:00
|
|
|
sys_print_stubs();
|
2022-05-20 14:59:24 -04:00
|
|
|
|
|
|
|
if (!game::environment::is_dedi())
|
|
|
|
{
|
2022-05-25 07:48:49 -04:00
|
|
|
utils::hook::call(0xE4B121_b, R_WarnOncePerFrame_print_stub);
|
2022-05-20 14:59:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-05-25 07:48:49 -04:00
|
|
|
//REGISTER_COMPONENT(logger::component)
|