Disable output logger for release builds

This commit is contained in:
pizzaboxer 2022-01-21 14:04:32 +00:00
parent e4224542e5
commit 2943f716d0
5 changed files with 32 additions and 14 deletions

View File

@ -6,6 +6,7 @@
// RobloxApp (2010)
#ifdef MFC2010
#define ADDRESS_STANDARDOUT__PRINT 0x0059F340
#define ADDRESS_STANDARDOUT__PRINTF 0x0059F8B0
#define ADDRESS_NETWORK__RAKNETADDRESSTOSTRING 0x004FC1A0
#define ADDRESS_HTTP__TRUSTCHECK 0x005A2680
#define ADDRESS_CAPP__CREATEGAME 0x00405D20

View File

@ -103,7 +103,8 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<FunctionLevelLinking>
</FunctionLevelLinking>
<IntrinsicFunctions>false</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;POLYGONCLIENTUTILITIES_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -182,33 +182,49 @@ BOOL __fastcall Http__trustCheck_hook(const char* url)
#ifdef ARBITERBUILD
StandardOut__print_t StandardOut__print = (StandardOut__print_t)ADDRESS_STANDARDOUT__PRINT;
void __fastcall StandardOut__print_hook(void* _this, void*, int type, const std::string& message)
void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string& message)
{
if (!Logger::handle) return;
StandardOut__print(_this, type, message);
switch (type)
// so there's a slight issue here
// when the dll is compiled as release, the message's location is sometimes offset by 8 bytes
//
// here's when it works properly:
// https://media.discordapp.net/attachments/377894067712950275/934077740192235520/x32dbg_U1Y4T8xnev.png
// the message pointer location of [EBP+0xC] (0x0019F8DC) and value (0x0019F8E0) have a valid string as seen on the stack
//
// and here's when it doesn't work properly:
// https://cdn.discordapp.com/attachments/377894067712950275/934080068110655568/unknown.png
// the pointer location of [EBP+0xC] (0x0019FD2C) just points to nothing (0x04A88C70)
// however the pointer location with an actual valid string is just 8 bytes ahead (0x0019FD34)
// wtf??
#ifndef NDEBUG
if (Logger::handle)
{
switch (type)
{
case 1: // RBX::MESSAGE_OUTPUT:
Logger::Log(LogType::Output, std::string("[MESSAGE_OUTPUT] ") + message);
// Logger::Log(LogType::Output, std::string("[MESSAGE_OUTPUT] ") + message);
SetConsoleTextAttribute(Logger::handle, FOREGROUND_BLUE | FOREGROUND_INTENSITY);
break;
case 0: // RBX::MESSAGE_INFO:
Logger::Log(LogType::Output, std::string("[MESSAGE_INFO] ") + message);
// Logger::Log(LogType::Output, std::string("[MESSAGE_INFO] ") + message);
SetConsoleTextAttribute(Logger::handle, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
break;
case 2: // RBX::MESSAGE_WARNING:
Logger::Log(LogType::Output, std::string("[MESSAGE_WARNING] ") + message);
// Logger::Log(LogType::Output, std::string("[MESSAGE_WARNING] ") + message);
SetConsoleTextAttribute(Logger::handle, FOREGROUND_RED | FOREGROUND_GREEN);
break;
case 3: // RBX::MESSAGE_ERROR:
Logger::Log(LogType::Output, std::string("[MESSAGE_ERROR] ") + message);
// Logger::Log(LogType::Output, std::string("[MESSAGE_ERROR] ") + message);
SetConsoleTextAttribute(Logger::handle, FOREGROUND_RED | FOREGROUND_INTENSITY);
break;
}
printf("%s\n", message.c_str());
SetConsoleTextAttribute(Logger::handle, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
}
printf("%s\n", message.c_str());
SetConsoleTextAttribute(Logger::handle, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
StandardOut__print(_this, type, message);
#endif
}
// Network__RakNetAddressToString_t Network__RakNetAddressToString = (Network__RakNetAddressToString_t)ADDRESS_NETWORK__RAKNETADDRESSTOSTRING;

View File

@ -20,10 +20,10 @@ extern Http__trustCheck_t Http__trustCheck;
BOOL __fastcall Http__trustCheck_hook(const char* url);
#ifdef ARBITERBUILD
typedef void(__thiscall* StandardOut__print_t)(void* _this, int type, const std::string& message);
typedef void(__thiscall* StandardOut__print_t)(int _this, int type, std::string& message);
extern StandardOut__print_t StandardOut__print;
void __fastcall StandardOut__print_hook(void* _this, void*, int type, const std::string& message);
void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string& message);
// typedef void(__thiscall* Network__RakNetAddressToString_t)(int raknetAddress, bool writePort, char portDelineator);
// extern Network__RakNetAddressToString_t Network__RakNetAddressToString;