Make output logging specific to arbiter builds only

This commit is contained in:
pizzaboxer 2022-01-20 21:21:55 +00:00
parent f3eb2893c6
commit a75be0f9be
4 changed files with 18 additions and 34 deletions

View File

@ -3,16 +3,10 @@
#include "Config.h"
#include <oaidl.h>
// CWorkspace
// 2010: 0x0047EC10
// 2011: 0x0049FC90
class CWorkspace;
const auto CWorkspace__ExecUrlScript = (HRESULT(__stdcall*)(CWorkspace * workspace, LPCWSTR, VARIANTARG, VARIANTARG, VARIANTARG, VARIANTARG, LPVOID))ADDRESS_CWORKSPACE__EXECURLSCRIPT;
// CRobloxDoc
class CRobloxDoc
{
private:
@ -21,17 +15,11 @@ public:
CWorkspace* workspace;
};
// CApp
class CApp;
const auto CApp__CreateGame = (CWorkspace * (__thiscall*)(CApp * _this, LPCWSTR, LPCWSTR))ADDRESS_CAPP__CREATEGAME;
const auto CApp__RobloxAuthenticate = (void * (__thiscall*)(CApp * _this, LPCWSTR, LPCWSTR))ADDRESS_CAPP__ROBLOXAUTHENTICATE;
// CRobloxApp
// 2010: 0x0044F6E0
// 2011: 0x0045D030
class CRobloxApp
{
private:
@ -42,10 +30,6 @@ public:
const auto CRobloxApp__CreateDocument = (CRobloxDoc * (__thiscall*)(CRobloxApp * _this))ADDRESS_CROBLOXAPP__CREATEDOCUMENT;
// CRobloxCommandLineInfo
// 2010: 0x007A80A0
// 2011: 0x0081354A
class CCommandLineInfo
{
private:

View File

@ -15,9 +15,6 @@ static std::wstring authenticationTicket;
static std::wstring joinScriptUrl;
static std::string jobId;
// 2010: 0x00452900;
// 2011: 0x004613C0;
CRobloxApp__InitInstance_t CRobloxApp__InitInstance = (CRobloxApp__InitInstance_t)ADDRESS_CROBLOXAPP__INITINSTANCE;
BOOL __fastcall CRobloxApp__InitInstance_hook(CRobloxApp* _this)
@ -36,7 +33,7 @@ BOOL __fastcall CRobloxApp__InitInstance_hook(CRobloxApp* _this)
{
// TODO: use CApp__CreateGame instead
CRobloxDoc* document = CRobloxApp__CreateDocument(_this);
CWorkspace__ExecUrlScript(document->workspace, joinScriptUrl.c_str(), VARIANTARG(), VARIANTARG(), VARIANTARG(), VARIANTARG(), nullptr);
// CWorkspace__ExecUrlScript(document->workspace, joinScriptUrl.c_str(), VARIANTARG(), VARIANTARG(), VARIANTARG(), VARIANTARG(), nullptr);
// CApp__CreateGame(NULL, L"", L"44340105256");
// CApp__RobloxAuthenticate(_this->app, L"http://polygondev.pizzaboxer.xyz/", L"test");
@ -52,9 +49,6 @@ BOOL __fastcall CRobloxApp__InitInstance_hook(CRobloxApp* _this)
return TRUE;
}
// 2010: 0x00450AC0;
// 2011: 0x0045EE50;
CRobloxCommandLineInfo__ParseParam_t CRobloxCommandLineInfo__ParseParam = (CRobloxCommandLineInfo__ParseParam_t)ADDRESS_CROBLOXCOMMANDLINEINFO__PARSEPARAM;
void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo* _this, void*, const char* pszParam, BOOL bFlag, BOOL bLast)
@ -91,6 +85,7 @@ void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo*
return;
}
#ifdef ARBITERBUILD
if (hasJobId && jobId.empty())
{
jobId = std::string(pszParam);
@ -104,6 +99,7 @@ void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo*
CCommandLineInfo__ParseLast(_this, bLast);
return;
}
#endif
if (bFlag && _stricmp(pszParam, "a") == 0)
{
@ -126,19 +122,19 @@ void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo*
return;
}
#ifdef ARBITERBUILD
if (bFlag && _stricmp(pszParam, "jobId") == 0)
{
hasJobId = true;
CCommandLineInfo__ParseLast(_this, bLast);
return;
}
#endif
CRobloxCommandLineInfo__ParseParam(_this, pszParam, bFlag, bLast);
}
// 2010: 0x0059F340;
// 2011: 0x005B25E0;
#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)
@ -166,4 +162,5 @@ void __fastcall StandardOut__print_hook(void* _this, void*, int type, const std:
SetConsoleTextAttribute(handle, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
StandardOut__print(_this, type, message);
}
}
#endif

View File

@ -2,23 +2,19 @@
#include "RobloxMFCClasses.h"
// CRobloxApp
typedef BOOL(__thiscall* CRobloxApp__InitInstance_t)(CRobloxApp* _this);
extern CRobloxApp__InitInstance_t CRobloxApp__InitInstance;
BOOL __fastcall CRobloxApp__InitInstance_hook(CRobloxApp* _this);
// CRobloxCommandLineInfo
typedef void(__thiscall* CRobloxCommandLineInfo__ParseParam_t)(CRobloxCommandLineInfo* _this, const char* pszParam, BOOL bFlag, BOOL bLast);
extern CRobloxCommandLineInfo__ParseParam_t CRobloxCommandLineInfo__ParseParam;
void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo* _this, void*, const char* pszParam, BOOL bFlag, BOOL bLast);
// StandardOut
#ifdef ARBITERBUILD
typedef void(__thiscall* StandardOut__print_t)(void* _this, int type, const 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(void* _this, void*, int type, const std::string& message);
#endif

View File

@ -1,11 +1,18 @@
#include "pch.h"
#include "Config.h"
#include "Patches.h"
#include "RobloxMFCHooks.h"
START_PATCH_LIST()
#ifdef ADDRESS_CROBLOXAPP__INITINSTANCE
ADD_PATCH(CRobloxApp__InitInstance, CRobloxApp__InitInstance_hook)
#endif
#ifdef ADDRESS_CROBLOXCOMMANDLINEINFO__PARSEPARAM
ADD_PATCH(CRobloxCommandLineInfo__ParseParam, CRobloxCommandLineInfo__ParseParam_hook)
#endif
#ifdef ARBITERBUILD
ADD_PATCH(StandardOut__print, StandardOut__print_hook)
#endif
END_PATCH_LIST()
// To be added to game imports