From fc64a4002a40373ae9eb2d457753b5c1967b7c29 Mon Sep 17 00:00:00 2001 From: lightbulblighter <59720715+lightbulblighter@users.noreply.github.com> Date: Sat, 11 Jun 2022 03:39:32 -0700 Subject: [PATCH] hide some stuff under _debug preprocessors --- PolygonDLL/ContentProvider.cpp | 0 PolygonDLL/Hooks/ContentProvider.cpp | 15 +++++++++++++++ PolygonDLL/Hooks/StandardOut.cpp | 7 +++++-- PolygonDLL/Include/Hooks/ContentProvider.h | 10 ++++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 PolygonDLL/ContentProvider.cpp create mode 100644 PolygonDLL/Hooks/ContentProvider.cpp create mode 100644 PolygonDLL/Include/Hooks/ContentProvider.h diff --git a/PolygonDLL/ContentProvider.cpp b/PolygonDLL/ContentProvider.cpp new file mode 100644 index 0000000..e69de29 diff --git a/PolygonDLL/Hooks/ContentProvider.cpp b/PolygonDLL/Hooks/ContentProvider.cpp new file mode 100644 index 0000000..d40cb01 --- /dev/null +++ b/PolygonDLL/Hooks/ContentProvider.cpp @@ -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; +} \ No newline at end of file diff --git a/PolygonDLL/Hooks/StandardOut.cpp b/PolygonDLL/Hooks/StandardOut.cpp index 15282e1..2eccdb8 100644 --- a/PolygonDLL/Hooks/StandardOut.cpp +++ b/PolygonDLL/Hooks/StandardOut.cpp @@ -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((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) { diff --git a/PolygonDLL/Include/Hooks/ContentProvider.h b/PolygonDLL/Include/Hooks/ContentProvider.h new file mode 100644 index 0000000..86af8f3 --- /dev/null +++ b/PolygonDLL/Include/Hooks/ContentProvider.h @@ -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; \ No newline at end of file