diff --git a/include/wums/hooks.h b/include/wums/hooks.h index 93296b1..9eb9697 100644 --- a/include/wums/hooks.h +++ b/include/wums/hooks.h @@ -39,19 +39,28 @@ extern "C" { } 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; typedef struct wums_hook_t { - wums_hook_type_t type; /* Defines the type of the hook */ - const void *target; /* Address of our own, new function */ + wums_hook_type_t type; /* Defines the type of the hook */ + const void *target; /* Address of our own, new function */ } wums_hook_t; #define WUMS_INITIALIZE() \ - void init_module(void);\ - WUMS_HOOK_EX(WUMS_HOOK_INIT,init_module); \ - void init_module() + WUMS_INIT_WUT(); \ + WUMS_FINI_WUT(); \ + 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 } diff --git a/libraries/libwums/crt.c b/libraries/libwums/crt.c new file mode 100644 index 0000000..2a90495 --- /dev/null +++ b/libraries/libwums/crt.c @@ -0,0 +1,3 @@ +int main(int argc, char** argv){ + return 0; +} \ No newline at end of file diff --git a/libraries/libwums/crt0.s b/libraries/libwums/crt0.s index 3c9d566..99d8023 100644 --- a/libraries/libwums/crt0.s +++ b/libraries/libwums/crt0.s @@ -15,12 +15,7 @@ __wums_start: bl __init_wut lwz 4, 0x1C(31) lwz 3, 0x18(31) - bl main - or 9, 3, 3 - stw 9, 0x8(31) - bl __fini_wut - lwz 9, 0x8(31) - or 3, 9, 9 + bl main addi 11, 31, 0x28 lwz 0, 0x4(11) mtlr 0