From 4fe99822c07922e3c6de4e4d83b19b672ad7a829 Mon Sep 17 00:00:00 2001 From: rjindael Date: Wed, 26 Jul 2023 21:15:28 -0700 Subject: [PATCH] cmake lists --- CMakeLists.txt | 4 +- Kiseki.Patcher/CMakeLists.txt | 51 +++++++++++++++++++++++++ Kiseki.Patcher/Header/Hooks/CRoblox.hpp | 8 +++- Kiseki.Patcher/Source/Hooks/CRoblox.cpp | 15 ++++++-- 4 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 Kiseki.Patcher/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index f04df9b..a9c7e07 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,4 +3,6 @@ cmake_minimum_required(VERSION 3.4) project(Kiseki.Patcher VERSION 1.0.0) option(COMPILE_PLAYER "Include player-specific code" OFF) -option(COMPILE_SERVER "Include server-specific code" OFF) \ No newline at end of file +option(COMPILE_SERVER "Include server-specific code" OFF) + +add_subdirectory(Kiseki.Patcher) \ No newline at end of file diff --git a/Kiseki.Patcher/CMakeLists.txt b/Kiseki.Patcher/CMakeLists.txt new file mode 100644 index 0000000..61a4bca --- /dev/null +++ b/Kiseki.Patcher/CMakeLists.txt @@ -0,0 +1,51 @@ +list(APPEND SOURCE + Source/main.cpp + Source/Patcher.cpp + Source/Helpers.cpp + + Source/Hooks/Crypt.cpp + Source/Hooks/Http.cpp +) + +list(APPEND HEADER + Header/Patcher.hpp + Header/Helpers.hpp + + Header/Hooks/Crypt.hpp + Header/Hooks/Http.hpp + + Resource/Information.h + Resource/Script.h +) + +if(COMPILE_PLAYER) + list(APPEND SOURCE + Source/Discord.cpp + Source/Hooks/CRoblox.cpp + ) + + list(APPEND HEADER + Header/Discord.cpp + Header/Hooks/CRoblox.hpp + ) +endif() + +if(COMPILE_SERVER) + list(APPEND SOURCE + Source/Server.cpp + + Source/Hooks/DataModel.cpp + Source/Hooks/ServerReplicator.cpp + Source/Hooks/StandardOut.cpp + ) + + list(APPEND HEADER + Header/Server.cpp + + Header/Hooks/DataModel.cpp + Header/Hooks/ServerReplicator.cpp + Header/Hooks/StandardOut.cpp + ) +endif() + +add_library(Kiseki.Patcher ${SOURCE} ${HEADER}) \ No newline at end of file diff --git a/Kiseki.Patcher/Header/Hooks/CRoblox.hpp b/Kiseki.Patcher/Header/Hooks/CRoblox.hpp index f23d0c2..a970dd1 100644 --- a/Kiseki.Patcher/Header/Hooks/CRoblox.hpp +++ b/Kiseki.Patcher/Header/Hooks/CRoblox.hpp @@ -1,3 +1,5 @@ +#if defined(PLAYER) || defined(SERVER) + #pragma once #include @@ -43,5 +45,9 @@ void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo* extern CRobloxApp__InitInstance_t CRobloxApp__InitInstance; extern CRobloxCommandLineInfo__ParseParam_t CRobloxCommandLineInfo__ParseParam; +#ifdef SERVER extern std::wstring jobId; -extern bool hasJobId; \ No newline at end of file +extern bool hasJobId; +#endif + +#endif \ No newline at end of file diff --git a/Kiseki.Patcher/Source/Hooks/CRoblox.cpp b/Kiseki.Patcher/Source/Hooks/CRoblox.cpp index b612a62..0e4b17c 100644 --- a/Kiseki.Patcher/Source/Hooks/CRoblox.cpp +++ b/Kiseki.Patcher/Source/Hooks/CRoblox.cpp @@ -1,3 +1,5 @@ +#if defined(PLAYER) || defined(SERVER) + #include "Hooks/CRoblox.hpp" #ifdef SERVER @@ -7,12 +9,15 @@ bool hasAuthenticationUrl = false; bool hasAuthenticationTicket = false; bool hasJoinScriptUrl = false; -bool hasJobId = false; std::wstring authenticationUrl; std::wstring authenticationTicket; std::wstring joinScriptUrl; + +#ifdef SERVER +bool hasJobId = false; std::wstring jobId; +#endif CRobloxApp__InitInstance_t CRobloxApp__InitInstance = (CRobloxApp__InitInstance_t)ADDRESS_CROBLOXAPP__INITINSTANCE; CRobloxCommandLineInfo__ParseParam_t CRobloxCommandLineInfo__ParseParam = (CRobloxCommandLineInfo__ParseParam_t)ADDRESS_CROBLOXCOMMANDLINEINFO__PARSEPARAM; @@ -44,14 +49,14 @@ BOOL __fastcall CRobloxApp__InitInstance_hook(CRobloxApp* _this) } } -#ifdef PLAYER +#ifdef SERVER if (!hasAuthenticationUrl || !hasAuthenticationTicket || !hasJoinScriptUrl) { return FALSE; } #endif -#ifdef SERVER +#ifdef PLAYER if (!hasAuthenticationUrl || !hasAuthenticationTicket || !hasJoinScriptUrl || !hasJobId) { ShellExecute(0, 0, L"https://kiseki.lol/games", 0, 0, SW_SHOW); @@ -145,4 +150,6 @@ void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo* #endif CRobloxCommandLineInfo__ParseParam(_this, pszParam, bFlag, bLast); -} \ No newline at end of file +} + +#endif \ No newline at end of file