From 3ac53ff133872121ff117cd12909c5a172e8346f Mon Sep 17 00:00:00 2001 From: qaate47 Date: Fri, 29 Nov 2024 01:05:20 +0100 Subject: [PATCH] test bo4 shield plugin --- premake5.lua | 36 ++++++++++++++++++++++++++++++ src/shield-plugin/dll_includes.hpp | 7 ++++++ src/shield-plugin/main.cpp | 24 ++++++++++++++++++++ src/shield-plugin/shield_sdk.hpp | 22 ++++++++++++++++++ 4 files changed, 89 insertions(+) create mode 100644 src/shield-plugin/dll_includes.hpp create mode 100644 src/shield-plugin/main.cpp create mode 100644 src/shield-plugin/shield_sdk.hpp diff --git a/premake5.lua b/premake5.lua index b1ec9c8..ac03ef1 100644 --- a/premake5.lua +++ b/premake5.lua @@ -207,6 +207,42 @@ project "AtianCodToolsBO4DLL2" dependson "detours" dependson "asmjit" +project "AtianCodToolsBO4ShieldPlugin" + kind "SharedLib" + language "C++" + cppdialect "C++20" + targetdir "%{wks.location}/bin/" + objdir "%{wks.location}/obj/" + + targetname "acts-shield-plugin" + + files { + "./src/shield-plugin/**.hpp", + "./src/shield-plugin/**.h", + "./src/shield-plugin/**.cpp", + } + + includedirs { + "src/shield-plugin", + "src/shared", + -- link detours + "deps/Detours/src/", + "deps/asmjit/src/", + "deps/curl/include/", + } + + vpaths { + ["*"] = "*" + } + + links { "ACTSSharedLibrary" } + links { "detours" } + links { "asmjit" } + links { "libcurl" } + dependson "ACTSSharedLibrary" + dependson "detours" + dependson "asmjit" + project "AtianCodToolsBOCWDLL" kind "SharedLib" language "C++" diff --git a/src/shield-plugin/dll_includes.hpp b/src/shield-plugin/dll_includes.hpp new file mode 100644 index 0000000..c5654fb --- /dev/null +++ b/src/shield-plugin/dll_includes.hpp @@ -0,0 +1,7 @@ +#pragma once + +#include +#include +#include + +#define EXPORT extern "C" __declspec(dllexport) diff --git a/src/shield-plugin/main.cpp b/src/shield-plugin/main.cpp new file mode 100644 index 0000000..5cc067f --- /dev/null +++ b/src/shield-plugin/main.cpp @@ -0,0 +1,24 @@ +#include +#include +#include +#include + +BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { + return TRUE; // Nothing by default +} + +EXPORT const char* PBO4_GetPluginName() { + return "acts-shield"; +} + +EXPORT bool PBO4_PreStart() { + shield_sdk::log(shield_sdk::LOG_TYPE_INFO, "prestart acts plugin"); + return true; +} + +EXPORT void PBO4_PostUnpack() { + shield_sdk::log(shield_sdk::LOG_TYPE_INFO, "post unpack acts plugin"); +} + +EXPORT void PBO4_PreDestroy() {} // nothing +EXPORT void PBO4_Clean() {} // nothing diff --git a/src/shield-plugin/shield_sdk.hpp b/src/shield-plugin/shield_sdk.hpp new file mode 100644 index 0000000..0728e30 --- /dev/null +++ b/src/shield-plugin/shield_sdk.hpp @@ -0,0 +1,22 @@ +#pragma once + +#ifdef SHIELD_PROXY_DLL +# define SHIELD_SDK __declspec(dllexport) +#else +# define SHIELD_SDK __declspec(dllimport) +#endif + +namespace shield_sdk +{ + enum log_type + { + LOG_TYPE_DEBUG = 0, + LOG_TYPE_INFO = 1, + LOG_TYPE_WARN = 2, + LOG_TYPE_ERROR = 3, + LOG_TYPE_CONSOLE = 4 + }; + + SHIELD_SDK void log(log_type type, std::string str); + SHIELD_SDK void log(log_type type, const char* fmt, ...); +}