GearLoader 1.1.0
Mod loader for GGXXACPR
Loading...
Searching...
No Matches
gearLoader_c.h
1#ifndef GEARLOADER_H
2
3#if !defined(_WIN32) || defined(_WIN64)
4 #error "Mods should be built targeting 32-bit windows (x86) (same target as +R)"
5#endif
6
7#define GEARLOADER_H
8
9
10#define GEARLOADER_VERSION "0.1.0"
11#define GEARLOADER_VERSION_NUM 0x000100
12#define GEARLOADER_VERSION_SEM_VER {0,1,0}
13
14#if __cplusplus
15 #include <cstdint>
16#else
17 #include <stdint.h>
18#endif
19
20
21typedef struct SemanticVersion {
22 uint32_t major;
23 uint32_t minor;
24 uint32_t patchNum;
26
27inline int compare(const SemanticVersion* a, const SemanticVersion* b) {
28 if (a->major - b->major != 0) {
29 return a->major - b->major;
30 }
31 if (a->minor - b->minor != 0) {
32 return a->minor - b->minor;
33 }
34 return a->patchNum - b->patchNum;
35}
36
37typedef enum GearLoaderLogLevel {
38 GEARLOADER_LOG_LEVEL_DEBUG,
39 GEARLOADER_LOG_LEVEL_INFO,
40 GEARLOADER_LOG_LEVEL_WARN,
41 GEARLOADER_LOG_LEVEL_ERR,
42 GEARLOADER_LOG_LEVEL_VERBOSE
43} GearLoaderLogLevel;
44
48typedef struct GearLoaderContext GearLoaderContext;
49
50typedef struct GearLoaderApi {
52 uint32_t size;
54 uint32_t version;
55
72 int32_t __stdcall (*RetrieveModApi)(
73 GearLoaderContext* ctx,
74 const char* name,
75 const char* versionConstraint,
76 const void** pApi,
77 SemanticVersion* retrievedVersion);
78
96 int32_t __stdcall (*RegisterApi)(
97 GearLoaderContext* ctx,
98 const void* api,
99 const char* name,
101
115 uint32_t __stdcall (*Log)(
116 GearLoaderContext* ctx,
117 uint32_t logLevel,
118 const char* str);
120
121#ifdef __cplusplus
122 #define GEARLOADER_EXPORT extern "C" __declspec(dllexport)
123#else
124 #define GEARLOADER_EXPORT __declspec(dllexport)
125#endif
126#define GEARLOADER_CALL __cdecl
127
129typedef void (GEARLOADER_CALL *ModInitFunc)(GearLoaderContext* ctx, GearLoaderApi* api);
130
131#endif
Definition gearLoader_c.h:50
int32_t __stdcall(* RetrieveModApi)(GearLoaderContext *ctx, const char *name, const char *versionConstraint, const void **pApi, SemanticVersion *retrievedVersion)
Retrieves an exported API of another loaded mod.
Definition gearLoader_c.h:72
uint32_t __stdcall(* Log)(GearLoaderContext *ctx, uint32_t logLevel, const char *str)
Logs the given string to the GearLoader.log file.
Definition gearLoader_c.h:115
uint32_t size
The size of this struct.
Definition gearLoader_c.h:52
uint32_t version
The version of this struct's layout.
Definition gearLoader_c.h:54
int32_t __stdcall(* RegisterApi)(GearLoaderContext *ctx, const void *api, const char *name, SemanticVersion version)
Registers an API with the mod loader.
Definition gearLoader_c.h:96
Definition gearLoader_c.h:21