The entrypoint is now called ONCE by the SetupPayload. Replace the usage by WUMS_APPLICATION_STARTS

This commit is contained in:
Maschell 2020-06-03 19:30:45 +02:00
parent c161712aef
commit e34863d75a
3 changed files with 19 additions and 12 deletions

View File

@ -39,7 +39,8 @@ extern "C" {
} }
typedef enum wums_hook_type_t { typedef enum wums_hook_type_t {
WUMS_HOOK_INIT, /* Called when exiting the plugin loader */ WUMS_HOOK_INIT,
WUMS_HOOK_APPLICATION_STARTS,
} wums_hook_type_t; } wums_hook_type_t;
typedef struct wums_hook_t { typedef struct wums_hook_t {
@ -49,9 +50,17 @@ typedef struct wums_hook_t {
#define WUMS_INITIALIZE() \ #define WUMS_INITIALIZE() \
void init_module(void);\ WUMS_INIT_WUT(); \
WUMS_HOOK_EX(WUMS_HOOK_INIT,init_module); \ WUMS_FINI_WUT(); \
void init_module() void __wums__init(void);\
WUMS_HOOK_EX(WUMS_HOOK_INIT, __wums__init); \
void __wums__init()
#define WUMS_APPLICATION_STARTS() \
void __wums_start(void);\
WUMS_HOOK_EX(WUMS_HOOK_APPLICATION_STARTS, __wums_start); \
void __wums_start()
#ifdef __cplusplus #ifdef __cplusplus
} }

3
libraries/libwums/crt.c Normal file
View File

@ -0,0 +1,3 @@
int main(int argc, char** argv){
return 0;
}

View File

@ -16,11 +16,6 @@ __wums_start:
lwz 4, 0x1C(31) lwz 4, 0x1C(31)
lwz 3, 0x18(31) lwz 3, 0x18(31)
bl main bl main
or 9, 3, 3
stw 9, 0x8(31)
bl __fini_wut
lwz 9, 0x8(31)
or 3, 9, 9
addi 11, 31, 0x28 addi 11, 31, 0x28
lwz 0, 0x4(11) lwz 0, 0x4(11)
mtlr 0 mtlr 0