From 1c52e8e499d0a86b1c60f42865ed96facd52c5a7 Mon Sep 17 00:00:00 2001 From: lightbulblighter <59720715+lightbulblighter@users.noreply.github.com> Date: Sat, 4 Jun 2022 03:44:12 -0700 Subject: [PATCH] Clean up some parts of the code that made me mad --- PolygonClientUtilities/Config.h | 23 +++++++++++---------- PolygonClientUtilities/RCCOutput.cpp | 30 ++++++++++++++-------------- PolygonClientUtilities/RCCOutput.h | 7 ++++++- 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/PolygonClientUtilities/Config.h b/PolygonClientUtilities/Config.h index 8eeaa61..2f86c8f 100644 --- a/PolygonClientUtilities/Config.h +++ b/PolygonClientUtilities/Config.h @@ -3,19 +3,20 @@ #define MFC2010 #define PLAYERBUILD #define ARBITERBUILD - // #define DEBUG_SERVERREPLICATOR__PROCESSPACKET -// when PLAYERBUILD is defined, the following changes occur for 2010 and 2012 only: -// the -jobId arg is parsed - -// when ARBITERBUILD is defined, the following changes occur: -// DataModel::getJobId is hooked -// DataModel::~DataModel is hooked -// StandardOut::print is hooked -// Network::RakNetAddressToString is hooked -// -jobId arg becomes available -// HTTP requests and output messages are logged to a file +/* +* PLAYERBUILD (2010 and 2012): +* - The "-jobId" argument is parsed +* +* ARBITERBUILD: +* - DataModel::getJobId is hooked +* - DataModel::~DataModel is hooked +* - StandardOut::print is hooked +* - Network::RakNetAddressToString is hooked +* - The "-jobId" argument becomes available +* - HTTP requests and console output is logged to a file +*/ // RobloxApp (2010) #ifdef MFC2010 diff --git a/PolygonClientUtilities/RCCOutput.cpp b/PolygonClientUtilities/RCCOutput.cpp index 062ce3f..5c1ee8f 100644 --- a/PolygonClientUtilities/RCCOutput.cpp +++ b/PolygonClientUtilities/RCCOutput.cpp @@ -30,9 +30,8 @@ void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string* StandardOut__print(_this, type, message); #ifdef NDEBUG - // i have absolutely no clue why but the location of the message pointer is offset 4 bytes when the dll compiled as release - int messagePtr = (int)message + 4; - message = reinterpret_cast(messagePtr); + // Message pointer is offset 4 bytes when the DLL is compiled as release + message = reinterpret_cast((int)message + 4); #endif if (message->compare("NewGame") == 0 || message->compare("NewGame2") == 0) @@ -64,19 +63,20 @@ void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string* switch (type) { - case 1: // RBX::MESSAGE_OUTPUT: - SetConsoleTextAttribute(outputHandle, FOREGROUND_BLUE | FOREGROUND_INTENSITY); - break; - case 0: // RBX::MESSAGE_INFO: - SetConsoleTextAttribute(outputHandle, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); - break; - case 2: // RBX::MESSAGE_WARNING: - SetConsoleTextAttribute(outputHandle, FOREGROUND_RED | FOREGROUND_GREEN); - break; - case 3: // RBX::MESSAGE_ERROR: - SetConsoleTextAttribute(outputHandle, FOREGROUND_RED | FOREGROUND_INTENSITY); - break; + case RBX__MESSAGE_OUTPUT: + SetConsoleTextAttribute(outputHandle, FOREGROUND_BLUE | FOREGROUND_INTENSITY); + break; + case RBX__MESSAGE_INFO: + SetConsoleTextAttribute(outputHandle, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); + break; + case RBX__MESSAGE_WARNING: + SetConsoleTextAttribute(outputHandle, FOREGROUND_RED | FOREGROUND_GREEN); + break; + case RBX__MESSAGE_ERROR: + SetConsoleTextAttribute(outputHandle, FOREGROUND_RED | FOREGROUND_INTENSITY); + break; } + printf("%s\n", message->c_str()); SetConsoleTextAttribute(outputHandle, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); } \ No newline at end of file diff --git a/PolygonClientUtilities/RCCOutput.h b/PolygonClientUtilities/RCCOutput.h index fe25b92..afdbd79 100644 --- a/PolygonClientUtilities/RCCOutput.h +++ b/PolygonClientUtilities/RCCOutput.h @@ -6,4 +6,9 @@ void InitializeOutput(); typedef void(__thiscall* StandardOut__print_t)(int _this, int type, std::string* message); void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string* message); -extern StandardOut__print_t StandardOut__print; \ No newline at end of file +extern StandardOut__print_t StandardOut__print; + +#define RBX__MESSAGE_INFO 0 +#define RBX__MESSAGE_OUTPUT 1 +#define RBX__MESSAGE_WARNING 2 +#define RBX__MESSAGE_ERROR 3 \ No newline at end of file