|
7 | 7 | #include <stdlib.h> |
8 | 8 | #include <signal.h> |
9 | 9 |
|
10 | | -#ifdef __arm__ |
| 10 | +#if defined(__arm__) || defined(_WIN32) |
11 | 11 | #define AML32 |
12 | 12 | #define BYBIT(__32val, __64val) (__32val) |
13 | | -#elif defined __aarch64__ |
| 13 | +#elif defined(__aarch64__) || defined(_WIN64) |
14 | 14 | #define AML64 |
15 | 15 | #define BYBIT(__32val, __64val) (__64val) |
16 | 16 | #else |
|
24 | 24 |
|
25 | 25 | #ifdef __GNUC__ |
26 | 26 | #define ASM_NAKED __attribute__((naked)) |
27 | | - #define EXPORT __attribute__((visibility("default"))) |
28 | 27 | #else |
29 | 28 | #define ASM_NAKED __declspec(naked) |
30 | | - #define EXPORT |
31 | 29 | #endif |
| 30 | +#define EXPORT JNIEXPORT |
32 | 31 |
|
33 | 32 | #define MYMOD(_guid, _name, _version, _author) \ |
34 | 33 | static ModInfo modinfoLocal(#_guid, #_name, #_version, #_author); \ |
35 | 34 | ModInfo* modinfo = &modinfoLocal; \ |
36 | | - extern "C" ModInfo* __GetModInfo() { return modinfo; } \ |
| 35 | + extern "C" JNIEXPORT ModInfo* __GetModInfo() { return modinfo; } \ |
37 | 36 | IAML* aml = (IAML*)GetInterface("AMLInterface"); |
38 | 37 |
|
39 | 38 | #define MYMODCFG(_guid, _name, _version, _author) \ |
|
47 | 46 | Config* cfg = &cfgLocal; |
48 | 47 |
|
49 | 48 | #define NEEDGAME(_pkg_name) \ |
50 | | - extern "C" const char* __INeedASpecificGame() {return #_pkg_name;} |
51 | | - |
52 | | -#define MYMODDECL() \ |
53 | | - extern ModInfo* modinfo; // Just in case if you need to use that somewhere else in your mod |
| 49 | + extern "C" JNIEXPORT const char* __INeedASpecificGame() { return #_pkg_name; } |
54 | 50 |
|
55 | 51 | /* Dependencies! */ |
56 | 52 | #define BEGIN_DEPLIST() \ |
|
64 | 60 |
|
65 | 61 | #define END_DEPLIST() \ |
66 | 62 | {"", ""} }; \ |
67 | | - extern "C" ModInfoDependency* __GetDepsList() { return &g_listDependencies[0]; } |
| 63 | + extern "C" JNIEXPORT ModInfoDependency* __GetDepsList() { return &g_listDependencies[0]; } |
68 | 64 |
|
69 | 65 | /* Macros to stop forgetting stuff! */ |
70 | 66 | #define ON_MOD_PRELOAD() \ |
71 | | - extern "C" void OnModPreLoad() |
| 67 | + extern "C" JNIEXPORT void OnModPreLoad() |
72 | 68 |
|
73 | 69 | #define ON_MOD_LOAD() \ |
74 | | - extern "C" void OnModLoad() |
| 70 | + extern "C" JNIEXPORT void OnModLoad() |
75 | 71 |
|
76 | 72 | #define ON_ALL_MODS_LOAD() \ |
77 | | - extern "C" void OnAllModsLoaded() |
| 73 | + extern "C" JNIEXPORT void OnAllModsLoaded() |
78 | 74 |
|
79 | 75 | #define ON_MOD_UNLOAD() \ |
80 | | - extern "C" void OnModUnload() /*Not guaranteed*/ |
| 76 | + extern "C" JNIEXPORT void OnModUnload() /*Not guaranteed*/ |
81 | 77 |
|
82 | 78 | #define ON_GAME_CRASH() \ |
83 | | - extern "C" void OnGameCrash(const char* library, int sig, int code, uintptr_t libaddr, mcontext_t* mcontext) /*Not guaranteed*/ |
| 79 | + extern "C" JNIEXPORT void OnGameCrash(const char* library, int sig, int code, uintptr_t libaddr, mcontext_t* mcontext) /*Not guaranteed*/ |
84 | 80 |
|
85 | 81 | #define UPDATER_URL() \ |
86 | | - extern "C" const char* OnUpdaterURLRequested() |
| 82 | + extern "C" JNIEXPORT const char* OnUpdaterURLRequested() |
87 | 83 |
|
88 | 84 | #define ON_NEW_INTERFACE() \ |
89 | | - extern "C" void OnInterfaceAdded(const char* name, const void* ptr) |
| 85 | + extern "C" JNIEXPORT void OnInterfaceAdded(const char* name, const void* ptr) |
90 | 86 |
|
91 | 87 |
|
92 | 88 |
|
@@ -203,7 +199,7 @@ class ModInfo |
203 | 199 | }; |
204 | 200 |
|
205 | 201 | typedef ModInfo* (*GetModInfoFn)(); |
206 | | - |
| 202 | +extern ModInfo* modinfo; |
207 | 203 |
|
208 | 204 |
|
209 | 205 | #include "iaml.h" |
|
0 commit comments