Skip to content

Commit 287a3e6

Browse files
committed
Highest init priority for AML interface (required for PSDK!)
1 parent 3fbb524 commit 287a3e6

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

mod/amlmod.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@
3333
static ModInfo modinfoLocal(#_guid, #_name, #_version, #_author); \
3434
ModInfo* modinfo = &modinfoLocal; \
3535
extern "C" JNIEXPORT ModInfo* __GetModInfo() { return modinfo; } \
36-
IAML* aml = (IAML*)GetInterface("AMLInterface");
36+
IAML* aml = NULL; \
37+
struct AMLInitStub { \
38+
AMLInitStub() { \
39+
aml = (IAML*)GetInterface("AMLInterface"); \
40+
} \
41+
}; AMLInitStub amlStub __attribute__((init_priority(101))); // Highest init prio
3742

3843
#define MYMODCFG(_guid, _name, _version, _author) \
3944
MYMOD(_guid, _name, _version, _author); \

template_of_mod/mod/amlmod.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@
3333
static ModInfo modinfoLocal(#_guid, #_name, #_version, #_author); \
3434
ModInfo* modinfo = &modinfoLocal; \
3535
extern "C" JNIEXPORT ModInfo* __GetModInfo() { return modinfo; } \
36-
IAML* aml = (IAML*)GetInterface("AMLInterface");
36+
IAML* aml = NULL; \
37+
struct AMLInitStub { \
38+
AMLInitStub() { \
39+
aml = (IAML*)GetInterface("AMLInterface"); \
40+
} \
41+
}; AMLInitStub amlStub __attribute__((init_priority(101))); // Highest init prio
3742

3843
#define MYMODCFG(_guid, _name, _version, _author) \
3944
MYMOD(_guid, _name, _version, _author); \

0 commit comments

Comments
 (0)