Skip to content

Commit 7eafc43

Browse files
authored
feat: introduce local patcher dll to cmake (#374)
* feat: introduce local patcher dll to cmake * chore: Add `/build/` to .gitignore. * chore: revert miniz bs
1 parent c867697 commit 7eafc43

File tree

5 files changed

+79
-18
lines changed

5 files changed

+79
-18
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,3 +705,10 @@ healthchecksdb
705705
MigrationBackup/
706706

707707
# End of https://www.gitignore.io/api/c,qt,vim,qml,c++,linux,macos,cmake,clion,windows,kdevelop4,qtcreator,visualstudio,visualstudiocode
708+
709+
# Allow vendor files
710+
!cslol-tools/vendor/**
711+
712+
# Validated local build
713+
/cslol-tools/build/
714+
/build/

cslol-tools/CMakeLists.txt

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -99,25 +99,12 @@ if (WIN32)
9999
endif()
100100

101101
if (WIN32)
102-
FetchContent_Declare(
103-
cslol-patcher
104-
URL https://github.com/LeagueToolkit/cslol-patcher/releases/download/7/cslol-patcher.zip
105-
URL_HASH SHA256=46b6dba49b1e1b79a93f4864110aa0ef8996cef09bf6e561d83ce1a89d88a734
106-
CONFIGURE_COMMAND ""
107-
BUILD_COMMAND ""
108-
DOWNLOAD_EXTRACT_TIMESTAMP True
102+
add_library(cslol-patcher SHARED IMPORTED GLOBAL)
103+
set_target_properties(cslol-patcher PROPERTIES
104+
IMPORTED_IMPLIB "${CMAKE_CURRENT_SOURCE_DIR}/vendor/cslol-patcher/cslol-dll.lib"
105+
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/vendor/cslol-patcher/cslol-dll.dll"
106+
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/vendor/cslol-patcher"
109107
)
110-
FetchContent_GetProperties(cslol-patcher)
111-
if(NOT cslol-patcher_POPULATED)
112-
FetchContent_Populate(cslol-patcher)
113-
114-
add_library(cslol-patcher SHARED IMPORTED)
115-
set_target_properties(cslol-patcher PROPERTIES
116-
IMPORTED_IMPLIB "${cslol-patcher_SOURCE_DIR}/cslol-dll.lib"
117-
IMPORTED_LOCATION "${cslol-patcher_SOURCE_DIR}/cslol-dll.dll"
118-
INTERFACE_INCLUDE_DIRECTORIES "${cslol-patcher_SOURCE_DIR}"
119-
)
120-
endif()
121108

122109
target_link_libraries(cslol-lib PUBLIC cslol-patcher)
123110
add_custom_command(TARGET mod-tools POST_BUILD
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#ifndef CSLOL_API_H
2+
#define CSLOL_API_H
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif // __cplusplus
7+
8+
#include <stdbool.h>
9+
#include <uchar.h>
10+
11+
#ifdef CSLOL_IMPL
12+
# ifdef _MSC_VER
13+
# define CSLOL_API __declspec(dllexport)
14+
# else
15+
# define CSLOL_API
16+
# endif
17+
#else
18+
# ifdef _MSC_VER
19+
# define CSLOL_API __declspec(dllimport)
20+
# else
21+
# define CSLOL_API extern
22+
# endif
23+
#endif
24+
25+
typedef enum cslol_hook_flags {
26+
CSLOL_HOOK_DISALBE_NONE = 0u,
27+
CSLOL_HOOK_DISABLE_VERIFY = 1u,
28+
CSLOL_HOOK_DISABLE_FILE = 2u,
29+
CSLOL_HOOK_DISABLE_ALL = (unsigned)(-1),
30+
} cslol_hook_flags;
31+
32+
typedef enum cslol_log_level {
33+
CSLOL_LOG_ERROR = 0,
34+
CSLOL_LOG_INFO = 0x10,
35+
CSLOL_LOG_DEBUG = 0x20,
36+
CSLOL_LOG_ALL = 0x1000,
37+
} cslol_log_level;
38+
39+
// Msg proc used for injection.
40+
CSLOL_API intptr_t cslol_msg_hookproc(int code, uintptr_t wParam, intptr_t lParam);
41+
42+
// Initialize IPC, returns error if any.
43+
CSLOL_API const char* cslol_init();
44+
45+
// Sets prefix folder, returns error if any.
46+
CSLOL_API const char* cslol_set_config(const char16_t* prefix);
47+
48+
// Sets flags, return error if any.
49+
CSLOL_API const char* cslol_set_flags(cslol_hook_flags flags);
50+
51+
// Set log level, return error if any.
52+
CSLOL_API const char* cslol_set_log_level(cslol_log_level level);
53+
54+
// Pull log message if any.
55+
CSLOL_API const char* cslol_log_pull();
56+
57+
// Find thread id of running lol instance.
58+
CSLOL_API unsigned cslol_find();
59+
60+
// Hook, return error if any.
61+
CSLOL_API const char* cslol_hook(unsigned tid, unsigned post_iters, unsigned event_iters);
62+
63+
#ifdef __cplusplus
64+
}
65+
#endif // __cplusplus
66+
67+
#endif // CSLOL_API_H
394 KB
Binary file not shown.
2.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)