Remove debug hooks for Game constructor

This commit is contained in:
pizzaboxer 2022-06-01 14:49:03 +01:00
parent c232462906
commit 0a4b9a32f7
8 changed files with 9 additions and 64 deletions

View File

@ -18,20 +18,16 @@ struct DataModel
struct Game
{
// void* padding1[26]; // 2010 has a class size of 104
// 2010 has a class size of 104 bytes
void* padding1[8];
// int dataModel;
// void* padding2[17];
std::shared_ptr<DataModel> dataModel;
void* padding2[9];
};
const auto Game__initializeClass = (Game * (__thiscall*)(void* _this, int a2))0x455D40;
const auto Game__initializeClass = (Game * (__thiscall*)(Game* _this, int a2))0x455D40;
const auto Game__construct = (int(__thiscall*)(Game* _this))0x47DBF0;
const auto sub_47C280 = (int(__thiscall*)(int _this, int a2))0x47C280;
const auto sub_902680 = (void * (__thiscall*)(void * _this))0x902680;
const auto ServiceProvider__createScriptContext = (void * (__thiscall*)(void* _this))0x4282E0;
const auto ScriptContext__setTimeout = (void (__thiscall*)(void* _this, double seconds))0x616EB0;
// const auto ScriptContext__execute = (void * (__thiscall*)(void* _this, void* a1, int identity, const char* script, const char* name, int arguments))0x617CF0;
const auto ScriptContext__execute = (void (__thiscall*)(void* _this, int identity, const char* script, const char* name))0x617C80;

View File

@ -1,11 +0,0 @@
#include "pch.h"
#include "DebugGame.h"
Game__construct_t Game__construct = (Game__construct_t)0x47DBF0;
int __fastcall Game__construct_hook(Game* _this)
{
printf("Game::Game called\n");
printf("Value of _this: %p\n", _this);
return Game__construct(_this);
}

View File

@ -1,7 +0,0 @@
#pragma once
#include "Classes.h"
typedef int (__thiscall* Game__construct_t)(Game* _this);
int __fastcall Game__construct_hook(Game* _this);
extern Game__construct_t Game__construct;

View File

@ -163,7 +163,6 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="Config.h" />
<ClInclude Include="DebugGame.h" />
<ClInclude Include="DebugScriptContext.h" />
<ClInclude Include="MFCCommandLine.h" />
<ClInclude Include="PlayerCommandLine.h" />
@ -180,7 +179,6 @@
<ClInclude Include="VerifySignatureBase64.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="DebugGame.cpp" />
<ClCompile Include="DebugScriptContext.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="MFCCommandLine.cpp" />

View File

@ -63,9 +63,6 @@
<ClInclude Include="TestHttpGetPost.h">
<Filter>Header Files\Hooks</Filter>
</ClInclude>
<ClInclude Include="DebugGame.h">
<Filter>Header Files\Hooks</Filter>
</ClInclude>
<ClInclude Include="DebugScriptContext.h">
<Filter>Header Files\Hooks</Filter>
</ClInclude>
@ -110,9 +107,6 @@
<ClCompile Include="TestHttpGetPost.cpp">
<Filter>Source Files\Hooks</Filter>
</ClCompile>
<ClCompile Include="DebugGame.cpp">
<Filter>Source Files\Hooks</Filter>
</ClCompile>
<ClCompile Include="DebugScriptContext.cpp">
<Filter>Source Files\Hooks</Filter>
</ClCompile>

View File

@ -1,6 +1,5 @@
#include "pch.h"
#include "RCCOutput.h"
#include "DebugGame.h"
#include "Patches.h"
HANDLE outputHandle;
@ -36,16 +35,9 @@ void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string*
message = reinterpret_cast<std::string*>(messagePtr);
#endif
/* if (message->compare("MakeDatamodel") == 0)
{
printf("Attempting to create DataModel...\n");
DataModel__createDataModel(true);
} */
if (message->compare("NewGame") == 0)
if (message->compare("NewGame") == 0 || message->compare("NewGame2") == 0)
{
printf("\n");
printf("Attempting to create new Game...\n");
Game* game = new Game();
@ -57,29 +49,14 @@ void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string*
}
else
{
// int datamodel = game[4];
printf("Successfully created new Game! (%p)\n", game);
// printf("Address of DataModel: %08X\n", game->dataModel);
// printf("Attempting to set DataModel Job ID to 'deez nuts'...\n");
// game->dataModel->jobId = "deez nuts";
printf("Length of DataModel Job ID: %d\n", game->dataModel->jobId.length());
printf("Attempting to create service provider...\n");
game->dataModel->jobId = "deez nuts";
auto scriptContext = ServiceProvider__createScriptContext(game->dataModel.get());
void* dataModelPointer = game->dataModel.get();
printf("Address of dataModelPointer: %p\n", dataModelPointer);
printf("Calling ServiceProvider::create<ScriptContext>()...\n");
void* scriptContext = ServiceProvider__createScriptContext(dataModelPointer);
printf("Address of scriptContext: %p\n", scriptContext);
printf("Calling ScriptContext::execute()...\n");
// void* arg;
// ScriptContext__execute(scriptContext, &arg, 1, "print('hi')", "hi", 0);
ScriptContext__execute(scriptContext, 1, "print('hi')", "hi");
// printf("Calling ScriptContext::setTimeout()...\n");
// ScriptContext__setTimeout(scriptContext, 5);
ScriptContext__execute(scriptContext, 5, "print(\"hi this should be inside the dll's created datamodel i think\")", "hi");
ScriptContext__execute(scriptContext, 5, "print(\"job id: \" .. game.jobId)", "hi");
ScriptContext__execute(scriptContext, 5, "printidentity()", "hi");
printf("\n");
}

View File

@ -3,7 +3,6 @@
#include "Patches.h"
//#include "RobloxMFCHooks.h"
#include "DebugGame.h"
#include "DebugScriptContext.h"
// #include "TestHttpGetPost.h"
#include "TrustCheck.h"
@ -26,7 +25,6 @@
#endif
START_PATCH_LIST()
ADD_PATCH(Game__construct, Game__construct_hook)
// ADD_PATCH(ScriptContext__execute, ScriptContext__execute_hook)
// ADD_PATCH(Http_httpGetPostWinInet, Http_httpGetPostWinInet_hook)