hide some stuff under _debug preprocessors

This commit is contained in:
lightbulblighter 2022-06-11 03:39:32 -07:00
parent f9f88d761f
commit fc64a4002a
No known key found for this signature in database
GPG Key ID: 0B2452F9DE0E2D01
4 changed files with 30 additions and 2 deletions

View File

View File

@ -0,0 +1,15 @@
#include "pch.h"
#include "Util.h"
#include "Hooks/ContentProvider.h"
ContentProvider__findLocalFile_t ContentProvider__findLocalFile = (ContentProvider__findLocalFile_t)ADDRESS_CONTENTPROVIDER__FINDLOCALFILE;
int __fastcall ContentProvider__findLocalFile_hook(void* _this, void*, const std::string& url, std::string* filename)
{
printf("url: %d\n", url.length());
ContentProvider__findLocalFile(_this, url, filename);
return 0;
}

View File

@ -12,8 +12,10 @@ void InitializeOutput()
outputHandle = CreateFileA("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
SetStdHandle(STD_OUTPUT_HANDLE, outputHandle);
printf("PolygonDLL v1.0.0\n");
#ifdef _DEBUG
printf("[[[ DLL COMPILED AS DEBUG ]]]\n");
SetConsoleTextAttribute(outputHandle, FOREGROUND_RED | FOREGROUND_GREEN);
printf("Compiled as Debug\n\n");
#endif
// lol
@ -35,6 +37,7 @@ void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string*
message = reinterpret_cast<std::string*>((int)message + 4);
#endif
#ifdef _DEBUG
if (message->compare("NewGame") == 0 || message->compare("NewGame2") == 0)
{
printf("\n");
@ -54,7 +57,6 @@ void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string*
game->dataModel->jobId = "deez nuts";
auto scriptContext = ServiceProvider__createScriptContext(game->dataModel.get());
// BELOW NEEDS TO DIE NOW (PUt tat shit on debug mode)
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");
@ -62,6 +64,7 @@ void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string*
printf("\n");
}
}
#endif
switch (type)
{

View File

@ -0,0 +1,10 @@
#pragma once
#include "Classes.h"
// const auto ContentProvider__findLocalFile = (bool(__cdecl*)(const char* url))ADDRESS_CONTENTPROVIDER__ISURL;
typedef bool(__thiscall* ContentProvider__findLocalFile_t)(void* _this, const std::string& url, std::string* filename);
int __fastcall ContentProvider__findLocalFile_hook(void* _this, void*, const std::string& url, std::string* filename);
extern ContentProvider__findLocalFile_t ContentProvider__findLocalFile;