Clean up some parts of the code that made me mad

This commit is contained in:
lightbulblighter 2022-06-04 03:44:12 -07:00
parent ef76a754f0
commit 1c52e8e499
No known key found for this signature in database
GPG Key ID: 0B2452F9DE0E2D01
3 changed files with 33 additions and 27 deletions

View File

@ -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

View File

@ -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<std::string*>(messagePtr);
// Message pointer is offset 4 bytes when the DLL is compiled as release
message = reinterpret_cast<std::string*>((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);
}

View File

@ -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;
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