From 40c85d55f6fcc4a4287ee0bba9132d8a9f95c772 Mon Sep 17 00:00:00 2001 From: Aaron M Date: Fri, 25 Dec 2020 08:13:50 +1300 Subject: [PATCH] Add Score Submission to OpenParrot --- OpenParrot/src/Functions/Global.cpp | 55 ++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/OpenParrot/src/Functions/Global.cpp b/OpenParrot/src/Functions/Global.cpp index eba2ea4..38694f1 100644 --- a/OpenParrot/src/Functions/Global.cpp +++ b/OpenParrot/src/Functions/Global.cpp @@ -3,6 +3,9 @@ #include "Global.h" #include "Utility/GameDetect.h" #include "Utility/Hooking.Patterns.h" +#include + +#pragma comment(lib,"shlwapi.lib") #pragma optimize("", off) void *__cdecl memcpy_0(void *a1, const void *a2, size_t a3) @@ -66,20 +69,6 @@ DWORD WINAPI QuitGameThread(__in LPVOID lpParameter) Sleep(300); } -} - -DWORD WINAPI OutputsThread(__in LPVOID lpParameter) -{ - blaster = LoadLibraryA("OutputBlaster.dll"); - if (blaster) - { - printf("OutputBlaster loaded!"); - } - else - { - printf("Failed to Load OutputBlaster!"); - } - return 0; } /* WINDOW HOOKS */ @@ -298,8 +287,42 @@ static InitFunction globalFunc([]() hook::pattern::InitializeHints(); CreateThread(NULL, 0, QuitGameThread, NULL, 0, NULL); if (ToBool(config["General"]["Enable Outputs"])) - { - CreateThread(NULL, 0, OutputsThread, NULL, 0, NULL); + { + blaster = LoadLibraryA("OutputBlaster.dll"); + if (blaster) + { + printf("OutputBlaster loaded!"); + } + else + { + printf("Failed to Load OutputBlaster!"); + } + } + + if (ToBool(config["Score"]["Enable Submission (Patreon Only)"])) + { + static char buf[MAX_PATH]; + HMODULE hMod; +#if defined(_M_IX86) + hMod = LoadLibrary(L"OpenParrot.dll"); +#else + hMod = LoadLibrary(L"OpenParrot64.dll"); +#endif + GetModuleFileNameA(hMod, buf, MAX_PATH); + PathRemoveFileSpecA(buf); + PathAppendA(buf, ("..")); +#if defined(_M_IX86) + strcat(buf, "\\TeknoParrot\\ScoreSubmission.dll"); +#else + strcat(buf, "\\TeknoParrot\\ScoreSubmission64.dll"); +#endif + HMODULE hModA = LoadLibraryA(buf); + + if (hModA) + { + void(*fn)() = (void(*)())GetProcAddress(hModA, "Score_Submit_Init"); + fn(); + } } }, GameID::Global); #pragma optimize("", on) \ No newline at end of file