[Logger] Add iw4x_onelog dvar
This commit is contained in:
parent
fe126a4308
commit
86e1f6f807
@ -195,8 +195,50 @@ namespace Components
|
||||
Logger::MessageMutex.unlock();
|
||||
}
|
||||
|
||||
void Logger::RedirectOSPath(const char* file, char* folder)
|
||||
{
|
||||
if (Dvar::Var("g_log").get<std::string>() == file)
|
||||
{
|
||||
if (folder != "userraw"s)
|
||||
{
|
||||
if (Dvar::Var("g_log").get<bool>())
|
||||
{
|
||||
strcpy_s(folder, 256, "userraw");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked) void Logger::BuildOSPathStub()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
pushad
|
||||
|
||||
push [esp + 28h]
|
||||
push [esp + 30h]
|
||||
|
||||
call Logger::RedirectOSPath
|
||||
|
||||
add esp, 8h
|
||||
|
||||
popad
|
||||
|
||||
mov eax, [esp + 8h]
|
||||
push ebp
|
||||
push esi
|
||||
mov esi, [esp + 0Ch]
|
||||
|
||||
push 64213Fh
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
Logger::Logger()
|
||||
{
|
||||
Dvar::Register<bool>("iw4x_onelog", false, Game::dvar_flag::DVAR_FLAG_LATCHED | Game::dvar_flag::DVAR_FLAG_SAVED, "Only write the game log to the 'userraw' OS folder");
|
||||
Utils::Hook(0x642139, Logger::BuildOSPathStub, HOOK_JUMP).install()->quick();
|
||||
|
||||
Logger::PipeOutput(nullptr);
|
||||
|
||||
QuickPatch::OnFrame(Logger::Frame);
|
||||
|
@ -39,6 +39,9 @@ namespace Components
|
||||
static void PrintMessagePipe(const char* data);
|
||||
static void EnqueueMessage(std::string message);
|
||||
|
||||
static void BuildOSPathStub();
|
||||
static void RedirectOSPath(const char* file, char* folder);
|
||||
|
||||
static void NetworkLog(const char* data, bool gLog);
|
||||
|
||||
static std::string Format(const char** message);
|
||||
|
Loading…
Reference in New Issue
Block a user