diff --git a/src/Components/Modules/Ceg.cpp b/src/Components/Modules/Ceg.cpp index 907a9e20..da0c2432 100644 --- a/src/Components/Modules/Ceg.cpp +++ b/src/Components/Modules/Ceg.cpp @@ -4,7 +4,7 @@ namespace Components { Ceg::Ceg() { - Utils::Hook::Signature signature(0x401000, 0x740000); + Utils::Hook::Signature signature(0x401000, 0x340000); // Generic killer caller. signature.add({ diff --git a/src/Components/Modules/Logger.cpp b/src/Components/Modules/Logger.cpp index 3acd6f93..0c5ee6cf 100644 --- a/src/Components/Modules/Logger.cpp +++ b/src/Components/Modules/Logger.cpp @@ -26,25 +26,33 @@ namespace Components void Logger::MessagePrint(const int channel, const std::string& msg) { + std::string out = msg; + + // Filter out coloured strings + if (out[0] == '^' && out[1] != '\0') + { + out = out.substr(2); + } + if (Flags::HasFlag("stdout") || Loader::IsPerformingUnitTests()) { - printf("%s", msg.data()); + printf("%s", out.data()); fflush(stdout); return; } if (!Logger::IsConsoleReady()) { - OutputDebugStringA(msg.data()); + OutputDebugStringA(out.data()); } if (!Game::Sys_IsMainThread()) { - Logger::EnqueueMessage(msg); + Logger::EnqueueMessage(out); } else { - Game::Com_PrintMessage(channel, msg.data(), 0); + Game::Com_PrintMessage(channel, out.data(), 0); } } @@ -54,7 +62,8 @@ namespace Components const auto msg = std::vformat(fmt, args); const auto out = std::format("Debug:\n {}\nFile: {}\nLine: {}\n", msg, loc.file_name(), loc.line()); #else - const auto out = std::vformat(fmt, args) + "\n"; + const auto msg = std::vformat(fmt, args); + const auto out = std::format("^2{}\n", msg); #endif Logger::MessagePrint(Game::CON_CHANNEL_DONT_FILTER, out); diff --git a/src/Components/Modules/Logger.hpp b/src/Components/Modules/Logger.hpp index 88f9f1da..cd281624 100644 --- a/src/Components/Modules/Logger.hpp +++ b/src/Components/Modules/Logger.hpp @@ -16,7 +16,6 @@ namespace Components static void Flush(); - static void MessagePrint(int channel, const std::string& msg); static void PrintInternal(int channel, std::string_view fmt, std::format_args&& args); static void ErrorInternal(Game::errorParm_t error, std::string_view fmt, std::format_args&& args); static void PrintErrorInternal(int channel, std::string_view fmt, std::format_args&& args); @@ -99,6 +98,7 @@ namespace Components static std::vector LoggingAddresses[2]; static void(*PipeCallback)(const std::string&); + static void MessagePrint(int channel, const std::string& msg); static void Frame(); static void G_LogPrintfStub(const char* fmt, ...); static void PrintMessageStub(); diff --git a/src/Utils/Hooking.cpp b/src/Utils/Hooking.cpp index e996e4f7..3b2f4544 100644 --- a/src/Utils/Hooking.cpp +++ b/src/Utils/Hooking.cpp @@ -9,7 +9,7 @@ namespace Utils { if (this->signatures.empty()) return; - char* _start = reinterpret_cast(this->start); + char* _start = static_cast(this->start); unsigned int sigCount = this->signatures.size(); Hook::Signature::Container* containers = this->signatures.data();