Skip to content

Commit

Permalink
test bo4 shield plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ate47 committed Nov 29, 2024
1 parent 2565754 commit 3ac53ff
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 0 deletions.
36 changes: 36 additions & 0 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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++"
Expand Down
7 changes: 7 additions & 0 deletions src/shield-plugin/dll_includes.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <includes_shared.hpp>
#include <hook/refs.hpp>
#include <utils/hash.hpp>

#define EXPORT extern "C" __declspec(dllexport)
24 changes: 24 additions & 0 deletions src/shield-plugin/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <dll_includes.hpp>
#include <core/actsinfo.hpp>
#include <core/config.hpp>
#include <shield_sdk.hpp>

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
22 changes: 22 additions & 0 deletions src/shield-plugin/shield_sdk.hpp
Original file line number Diff line number Diff line change
@@ -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, ...);
}

0 comments on commit 3ac53ff

Please sign in to comment.