From f3eb2893c638dc1ef8f979b3fa6bd0045a5b6203 Mon Sep 17 00:00:00 2001
From: pizzaboxer <41478239+pizzaboxer@users.noreply.github.com>
Date: Thu, 20 Jan 2022 21:07:56 +0000
Subject: [PATCH] Add address configs for multiple client versions
---
PolygonClientUtilities/Config.h | 28 ++++++++++
.../PolygonClientUtilities.vcxproj | 1 +
.../PolygonClientUtilities.vcxproj.filters | 3 +
PolygonClientUtilities/RobloxMFCClasses.h | 23 ++++++--
PolygonClientUtilities/RobloxMFCHooks.cpp | 55 ++++++++++++++++++-
5 files changed, 102 insertions(+), 8 deletions(-)
create mode 100644 PolygonClientUtilities/Config.h
diff --git a/PolygonClientUtilities/Config.h b/PolygonClientUtilities/Config.h
new file mode 100644
index 0000000..42e0fa7
--- /dev/null
+++ b/PolygonClientUtilities/Config.h
@@ -0,0 +1,28 @@
+#pragma once
+
+#define MFC2011
+#define ARBITERBUILD
+
+// RobloxApp (2010)
+#ifdef MFC2010
+#define ADDRESS_STANDARDOUT__PRINT 0x0059F340
+#define ADDRESS_CAPP__CREATEGAME 0x00405D20
+#define ADDRESS_CAPP__ROBLOXAUTHENTICATE 0x00408060
+#define ADDRESS_CROBLOXAPP__INITINSTANCE 0x00452900
+#define ADDRESS_CROBLOXAPP__CREATEDOCUMENT 0x0044F6E0
+#define ADDRESS_CWORKSPACE__EXECURLSCRIPT 0x0047EC10
+#define ADDRESS_CROBLOXCOMMANDLINEINFO__PARSEPARAM 0x00450AC0
+#define ADDRESS_CCOMMANDLINEINFO__PARSELAST 0x007A80A0
+#endif
+
+// RobloxApp (2011)
+#ifdef MFC2011
+#define ADDRESS_STANDARDOUT__PRINT 0x005B25E0
+#define ADDRESS_CAPP__CREATEGAME 0x0
+#define ADDRESS_CAPP__ROBLOXAUTHENTICATE 0x0
+#define ADDRESS_CROBLOXAPP__INITINSTANCE 0x004613C0
+#define ADDRESS_CROBLOXAPP__CREATEDOCUMENT 0x0045D030
+#define ADDRESS_CWORKSPACE__EXECURLSCRIPT 0x0049FC90
+#define ADDRESS_CROBLOXCOMMANDLINEINFO__PARSEPARAM 0x0045EE50
+#define ADDRESS_CCOMMANDLINEINFO__PARSELAST 0x0081354A
+#endif
\ No newline at end of file
diff --git a/PolygonClientUtilities/PolygonClientUtilities.vcxproj b/PolygonClientUtilities/PolygonClientUtilities.vcxproj
index 8aff6b4..32aca89 100644
--- a/PolygonClientUtilities/PolygonClientUtilities.vcxproj
+++ b/PolygonClientUtilities/PolygonClientUtilities.vcxproj
@@ -157,6 +157,7 @@
+
diff --git a/PolygonClientUtilities/PolygonClientUtilities.vcxproj.filters b/PolygonClientUtilities/PolygonClientUtilities.vcxproj.filters
index 0a546db..d7cac03 100644
--- a/PolygonClientUtilities/PolygonClientUtilities.vcxproj.filters
+++ b/PolygonClientUtilities/PolygonClientUtilities.vcxproj.filters
@@ -27,6 +27,9 @@
Header Files
+
+ Header Files
+
diff --git a/PolygonClientUtilities/RobloxMFCClasses.h b/PolygonClientUtilities/RobloxMFCClasses.h
index 1d4eebc..e097756 100644
--- a/PolygonClientUtilities/RobloxMFCClasses.h
+++ b/PolygonClientUtilities/RobloxMFCClasses.h
@@ -1,5 +1,6 @@
#pragma once
+#include "Config.h"
#include
// CWorkspace
@@ -8,7 +9,7 @@
class CWorkspace;
-const auto CWorkspace__ExecUrlScript = (HRESULT(__stdcall*)(CWorkspace * workspace, LPCWSTR, VARIANTARG, VARIANTARG, VARIANTARG, VARIANTARG, LPVOID))0x0047EC10;
+const auto CWorkspace__ExecUrlScript = (HRESULT(__stdcall*)(CWorkspace * workspace, LPCWSTR, VARIANTARG, VARIANTARG, VARIANTARG, VARIANTARG, LPVOID))ADDRESS_CWORKSPACE__EXECURLSCRIPT;
// CRobloxDoc
@@ -20,14 +21,26 @@ 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;
+class CRobloxApp
+{
+private:
+ void* padding1[124];
+public:
+ CApp* app;
+};
-const auto CRobloxApp__CreateDocument = (CRobloxDoc * (__thiscall*)(CRobloxApp * _this))0x0044F6E0;
-// const auto CRobloxApp__CreateGame = (CWorkspace * (__thiscall*)(CRobloxApp * _this, LPCWSTR))0x00405D20; // is CApp the same thing as CRobloxApp??
+const auto CRobloxApp__CreateDocument = (CRobloxDoc * (__thiscall*)(CRobloxApp * _this))ADDRESS_CROBLOXAPP__CREATEDOCUMENT;
// CRobloxCommandLineInfo
// 2010: 0x007A80A0
@@ -43,4 +56,4 @@ public:
class CRobloxCommandLineInfo : public CCommandLineInfo {};
-const auto CCommandLineInfo__ParseLast = (void(__thiscall*)(CCommandLineInfo * _this, BOOL bLast))0x007A80A0;
\ No newline at end of file
+const auto CCommandLineInfo__ParseLast = (void(__thiscall*)(CCommandLineInfo * _this, BOOL bLast))ADDRESS_CCOMMANDLINEINFO__PARSELAST;
\ No newline at end of file
diff --git a/PolygonClientUtilities/RobloxMFCHooks.cpp b/PolygonClientUtilities/RobloxMFCHooks.cpp
index 0c4925e..6df3265 100644
--- a/PolygonClientUtilities/RobloxMFCHooks.cpp
+++ b/PolygonClientUtilities/RobloxMFCHooks.cpp
@@ -1,31 +1,46 @@
#include "pch.h"
+#include "Config.h"
#include "RobloxMFCHooks.h"
static HANDLE handle;
static std::ofstream jobLog;
+static bool hasAuthUrlArg = false;
+static bool hasAuthTicketArg = false;
static bool hasJoinArg = false;
static bool hasJobId = false;
+static std::wstring authenticationUrl;
+static std::wstring authenticationTicket;
static std::wstring joinScriptUrl;
static std::string jobId;
// 2010: 0x00452900;
// 2011: 0x004613C0;
-CRobloxApp__InitInstance_t CRobloxApp__InitInstance = (CRobloxApp__InitInstance_t)0x00452900;
+CRobloxApp__InitInstance_t CRobloxApp__InitInstance = (CRobloxApp__InitInstance_t)ADDRESS_CROBLOXAPP__INITINSTANCE;
BOOL __fastcall CRobloxApp__InitInstance_hook(CRobloxApp* _this)
{
if (!CRobloxApp__InitInstance(_this))
return FALSE;
+ if (hasAuthUrlArg && hasAuthTicketArg && !authenticationUrl.empty() && !authenticationTicket.empty())
+ {
+ // TODO: implement this
+ }
+
if (hasJoinArg && !joinScriptUrl.empty())
{
try
{
+ // TODO: use CApp__CreateGame instead
CRobloxDoc* document = CRobloxApp__CreateDocument(_this);
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");
+ // CRobloxApp__CreateDocument(_this);
}
catch (std::runtime_error& exception)
{
@@ -40,7 +55,7 @@ BOOL __fastcall CRobloxApp__InitInstance_hook(CRobloxApp* _this)
// 2010: 0x00450AC0;
// 2011: 0x0045EE50;
-CRobloxCommandLineInfo__ParseParam_t CRobloxCommandLineInfo__ParseParam = (CRobloxCommandLineInfo__ParseParam_t)0x00450AC0;
+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)
{
@@ -56,6 +71,26 @@ void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo*
return;
}
+ if (hasAuthUrlArg && authenticationUrl.empty())
+ {
+ int size = MultiByteToWideChar(CP_ACP, 0, pszParam, strlen(pszParam), nullptr, 0);
+ authenticationUrl.resize(size);
+ MultiByteToWideChar(CP_ACP, 0, pszParam, strlen(pszParam), &authenticationUrl[0], size);
+
+ CCommandLineInfo__ParseLast(_this, bLast);
+ return;
+ }
+
+ if (hasAuthTicketArg && authenticationTicket.empty())
+ {
+ int size = MultiByteToWideChar(CP_ACP, 0, pszParam, strlen(pszParam), nullptr, 0);
+ authenticationTicket.resize(size);
+ MultiByteToWideChar(CP_ACP, 0, pszParam, strlen(pszParam), &authenticationTicket[0], size);
+
+ CCommandLineInfo__ParseLast(_this, bLast);
+ return;
+ }
+
if (hasJobId && jobId.empty())
{
jobId = std::string(pszParam);
@@ -70,6 +105,20 @@ void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo*
return;
}
+ if (bFlag && _stricmp(pszParam, "a") == 0)
+ {
+ hasAuthUrlArg = true;
+ CCommandLineInfo__ParseLast(_this, bLast);
+ return;
+ }
+
+ if (bFlag && _stricmp(pszParam, "t") == 0)
+ {
+ hasAuthTicketArg = true;
+ CCommandLineInfo__ParseLast(_this, bLast);
+ return;
+ }
+
if (bFlag && _stricmp(pszParam, "j") == 0)
{
hasJoinArg = true;
@@ -90,7 +139,7 @@ void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo*
// 2010: 0x0059F340;
// 2011: 0x005B25E0;
-StandardOut__print_t StandardOut__print = (StandardOut__print_t)0x0059F340;
+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)
{