mirror of
https://github.com/wiiu-env/WiiUPluginSystem.git
synced 2024-12-24 17:11:58 +01:00
[WUPS] Added Macro for the Initialization hook
This commit is contained in:
parent
17e34ad60b
commit
81b5bed341
6
wups.ld
6
wups.ld
@ -5,12 +5,16 @@ SECTIONS {
|
||||
.wups.load : {
|
||||
*(.wups.load*)
|
||||
}
|
||||
.wups.hooks : {
|
||||
*(.wups.hooks*)
|
||||
}
|
||||
.text : {
|
||||
*(.text*)
|
||||
}
|
||||
.sdata : {
|
||||
*(.sdata*)
|
||||
}.data : {
|
||||
}
|
||||
.data : {
|
||||
*(.data*)
|
||||
}
|
||||
.rodata : {
|
||||
|
@ -7,4 +7,8 @@ SECTIONS {
|
||||
wups_load = .;
|
||||
*(.wups.load*)
|
||||
}
|
||||
.wups.hooks : {
|
||||
wups_hooks = .;
|
||||
*(.wups.hooks*)
|
||||
}
|
||||
}
|
@ -39,12 +39,6 @@ extern "C" {
|
||||
res (* real_ ## name)(__VA_ARGS__) __attribute__((section(".data"))); \
|
||||
res my_ ## name(__VA_ARGS__)
|
||||
|
||||
typedef enum wups_loader_entry_type_t {
|
||||
WUPS_LOADER_ENTRY_FUNCTION,
|
||||
WUPS_LOADER_ENTRY_FUNCTION_MANDATORY,
|
||||
WUPS_LOADER_ENTRY_EXPORT
|
||||
} wups_loader_entry_type_t;
|
||||
|
||||
typedef enum wups_loader_library_type_t {
|
||||
WUPS_LOADER_LIBRARY_AVM,
|
||||
WUPS_LOADER_LIBRARY_CAMERA,
|
||||
@ -114,6 +108,36 @@ typedef enum wups_loader_library_type_t {
|
||||
WUPS_LOADER_LIBRARY_ZLIB125,
|
||||
} wups_loader_library_type_t;
|
||||
|
||||
|
||||
|
||||
typedef enum wups_loader_hook_type_t {
|
||||
WUPS_LOADER_HOOK_INIT_FUNCTION
|
||||
} wups_loader_hook_type_t;
|
||||
|
||||
typedef struct wups_loader_hook_t {
|
||||
wups_loader_hook_type_t type;
|
||||
const void *target; /*Address of our own, new function (my_XXX)*/
|
||||
} wups_loader_hook_t;
|
||||
|
||||
#define WUPS_HOOK_INIT(original_func) \
|
||||
extern const wups_loader_hook_t wups_hooks_init_ ## original_func \
|
||||
WUPS_SECTION("hooks"); \
|
||||
const wups_loader_hook_t wups_hooks_init_ ## original_func = { \
|
||||
.type = WUPS_LOADER_HOOK_INIT_FUNCTION, \
|
||||
.target = (const void*)&(original_func) \
|
||||
}
|
||||
|
||||
#define INITIALIZE() \
|
||||
void init();\
|
||||
WUPS_HOOK_INIT(init); \
|
||||
void init()
|
||||
|
||||
typedef enum wups_loader_entry_type_t {
|
||||
WUPS_LOADER_ENTRY_FUNCTION,
|
||||
WUPS_LOADER_ENTRY_FUNCTION_MANDATORY,
|
||||
WUPS_LOADER_ENTRY_EXPORT
|
||||
} wups_loader_entry_type_t;
|
||||
|
||||
typedef struct wups_loader_entry_t {
|
||||
wups_loader_entry_type_t type;
|
||||
union {
|
||||
@ -127,8 +151,6 @@ typedef struct wups_loader_entry_t {
|
||||
} data;
|
||||
} wups_loader_entry_t;
|
||||
|
||||
|
||||
|
||||
#define WUPS_MUST_REPLACE(x, lib, function_name) WUPS_MUST_REPLACE_EX(real_ ## x, lib, my_ ## x, function_name);
|
||||
|
||||
#define WUPS_MUST_REPLACE_EX(original_func, rpl_type, replace_func, replace_function_name) \
|
||||
|
Loading…
Reference in New Issue
Block a user