mirror of
https://github.com/wiiu-env/WiiUPluginSystem.git
synced 2026-08-28 20:56:55 -05:00
Add clang-format for formatting, check building the example in CI
This commit is contained in:
@@ -26,9 +26,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "wups/common.h"
|
||||
#include "wups/meta.h"
|
||||
#include "wups/function_patching.h"
|
||||
#include "wups/config.h"
|
||||
#include "wups/hooks.h"
|
||||
#include "wups/config_imports.h"
|
||||
#include "wups/function_patching.h"
|
||||
#include "wups/hooks.h"
|
||||
#include "wups/meta.h"
|
||||
#include "wups/storage.h"
|
||||
|
||||
@@ -25,24 +25,24 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define WUPS_SECTION(x) __attribute__((__section__ (".wups." x)))
|
||||
#define WUPS_SECTION(x) __attribute__((__section__(".wups." x)))
|
||||
|
||||
#define WUPS_META(id, value) \
|
||||
extern const char wups_meta_ ## id [] WUPS_SECTION("meta"); \
|
||||
const char wups_meta_ ## id [] = #id "=" value
|
||||
#define WUPS_META(id, value) \
|
||||
extern const char wups_meta_##id[] WUPS_SECTION("meta"); \
|
||||
const char wups_meta_##id[] = #id "=" value
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -19,17 +19,17 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define WUPS_CONFIG_BUTTON_NONE 0
|
||||
#define WUPS_CONFIG_BUTTON_LEFT (1<<0)
|
||||
#define WUPS_CONFIG_BUTTON_RIGHT (1<<1)
|
||||
#define WUPS_CONFIG_BUTTON_UP (1<<2)
|
||||
#define WUPS_CONFIG_BUTTON_DOWN (1<<3)
|
||||
#define WUPS_CONFIG_BUTTON_A (1<<4)
|
||||
#define WUPS_CONFIG_BUTTON_B (1<<5)
|
||||
#define WUPS_CONFIG_BUTTON_ZL (1<<6)
|
||||
#define WUPS_CONFIG_BUTTON_ZR (1<<7)
|
||||
#define WUPS_CONFIG_BUTTON_L (1<<8)
|
||||
#define WUPS_CONFIG_BUTTON_R (1<<9)
|
||||
#define WUPS_CONFIG_BUTTON_NONE 0
|
||||
#define WUPS_CONFIG_BUTTON_LEFT (1 << 0)
|
||||
#define WUPS_CONFIG_BUTTON_RIGHT (1 << 1)
|
||||
#define WUPS_CONFIG_BUTTON_UP (1 << 2)
|
||||
#define WUPS_CONFIG_BUTTON_DOWN (1 << 3)
|
||||
#define WUPS_CONFIG_BUTTON_A (1 << 4)
|
||||
#define WUPS_CONFIG_BUTTON_B (1 << 5)
|
||||
#define WUPS_CONFIG_BUTTON_ZL (1 << 6)
|
||||
#define WUPS_CONFIG_BUTTON_ZR (1 << 7)
|
||||
#define WUPS_CONFIG_BUTTON_L (1 << 8)
|
||||
#define WUPS_CONFIG_BUTTON_R (1 << 9)
|
||||
typedef int32_t WUPSConfigButtons;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -20,20 +20,20 @@ bool WUPSConfigItemBoolean_AddToCategoryEx(WUPSConfigCategoryHandle cat, const c
|
||||
const char *falseValue);
|
||||
|
||||
#define WUPSConfigItemBoolean_AddToCategoryHandled(__config__, __cat__, __configID__, __displayName__, __defaultValue__, __callback__) \
|
||||
do { \
|
||||
if (!WUPSConfigItemBoolean_AddToCategory(__cat__, __configID__, __displayName__, __defaultValue__, __callback__)) { \
|
||||
WUPSConfig_Destroy(__config__); \
|
||||
return 0; \
|
||||
} \
|
||||
} while(0)
|
||||
do { \
|
||||
if (!WUPSConfigItemBoolean_AddToCategory(__cat__, __configID__, __displayName__, __defaultValue__, __callback__)) { \
|
||||
WUPSConfig_Destroy(__config__); \
|
||||
return 0; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define WUPSConfigItemBoolean_AddToCategoryHandledEx(__config__, __cat__, __configID__, __displayName__, __defaultValue__, __callback__, __trueValue__, __falseValue__) \
|
||||
do { \
|
||||
if (!WUPSConfigItemBoolean_AddToCategoryEx(__cat__, __configID__, __displayName__, __defaultValue__, __callback__, __trueValue__, __falseValue__)) { \
|
||||
WUPSConfig_Destroy(__config__); \
|
||||
return 0; \
|
||||
} \
|
||||
} while(0)
|
||||
do { \
|
||||
if (!WUPSConfigItemBoolean_AddToCategoryEx(__cat__, __configID__, __displayName__, __defaultValue__, __callback__, __trueValue__, __falseValue__)) { \
|
||||
WUPSConfig_Destroy(__config__); \
|
||||
return 0; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -15,18 +15,17 @@ typedef struct ConfigItemIntegerRange {
|
||||
|
||||
typedef void (*IntegerRangeValueChangedCallback)(ConfigItemIntegerRange *, int32_t);
|
||||
|
||||
bool
|
||||
WUPSConfigItemIntegerRange_AddToCategory(WUPSConfigCategoryHandle cat, const char *configID, const char *displayName,
|
||||
int32_t defaultValue, int32_t minValue, int32_t maxValue,
|
||||
IntegerRangeValueChangedCallback callback);
|
||||
bool WUPSConfigItemIntegerRange_AddToCategory(WUPSConfigCategoryHandle cat, const char *configID, const char *displayName,
|
||||
int32_t defaultValue, int32_t minValue, int32_t maxValue,
|
||||
IntegerRangeValueChangedCallback callback);
|
||||
|
||||
#define WUPSConfigItemIntegerRange_AddToCategoryHandled(__config__, __cat__, __configID__, __displayName__, __defaultValue__, __minValue__, __maxValue__, __callback__) \
|
||||
do { \
|
||||
if (!WUPSConfigItemIntegerRange_AddToCategory(__cat__, __configID__, __displayName__, __defaultValue__, __minValue__, __maxValue__, __callback__)) { \
|
||||
WUPSConfig_Destroy(__config__); \
|
||||
return 0; \
|
||||
} \
|
||||
} while(0)
|
||||
do { \
|
||||
if (!WUPSConfigItemIntegerRange_AddToCategory(__cat__, __configID__, __displayName__, __defaultValue__, __minValue__, __maxValue__, __callback__)) { \
|
||||
WUPSConfig_Destroy(__config__); \
|
||||
return 0; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -25,12 +25,12 @@ bool WUPSConfigItemMultipleValues_AddToCategory(WUPSConfigCategoryHandle cat, co
|
||||
int pairCount, MultipleValuesChangedCallback callback);
|
||||
|
||||
#define WUPSConfigItemMultipleValues_AddToCategoryHandled(__config__, __cat__, __configID__, __displayName__, __defaultValueIndex__, __possibleValues__, __pairCount__, __callback__) \
|
||||
do { \
|
||||
if(!WUPSConfigItemMultipleValues_AddToCategory(__cat__, __configID__, __displayName__, __defaultValueIndex__, __possibleValues__, __pairCount__, __callback__)) { \
|
||||
WUPSConfig_Destroy(__config__); \
|
||||
return 0; \
|
||||
} \
|
||||
} while(0)
|
||||
do { \
|
||||
if (!WUPSConfigItemMultipleValues_AddToCategory(__cat__, __configID__, __displayName__, __defaultValueIndex__, __possibleValues__, __pairCount__, __callback__)) { \
|
||||
WUPSConfig_Destroy(__config__); \
|
||||
return 0; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "stdint.h"
|
||||
#include "config.h"
|
||||
#include "stdint.h"
|
||||
|
||||
extern "C" int32_t WUPSConfigItem_Create(WUPSConfigItemHandle *out, const char *configID, const char *displayName, WUPSConfigCallbacks_t callbacks, void *context);
|
||||
|
||||
@@ -37,17 +37,17 @@ extern "C" int32_t WUPSConfigCategory_GetName(WUPSConfigCategoryHandle handle, c
|
||||
|
||||
extern "C" int32_t WUPSConfigCategory_AddItem(WUPSConfigCategoryHandle handle, WUPSConfigItemHandle item_Handle);
|
||||
|
||||
#define WUPSConfig_AddCategoryByNameHandled(__config__, __categoryName__, __out__) \
|
||||
do { \
|
||||
#define WUPSConfig_AddCategoryByNameHandled(__config__, __categoryName__, __out__) \
|
||||
do { \
|
||||
if (WUPSConfig_AddCategoryByName(__config__, __categoryName__, __out__) < 0) { \
|
||||
WUPSConfig_Destroy(__config__); \
|
||||
return 0;\
|
||||
} \
|
||||
} while(0)
|
||||
WUPSConfig_Destroy(__config__); \
|
||||
return 0; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define WUPSConfig_CreateHandled(__config__, __configName__) \
|
||||
do { \
|
||||
#define WUPSConfig_CreateHandled(__config__, __configName__) \
|
||||
do { \
|
||||
if (WUPSConfig_Create(__config__, __configName__) < 0) { \
|
||||
return 0; \
|
||||
} \
|
||||
} while(0)
|
||||
return 0; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@@ -108,65 +108,63 @@ typedef enum wups_loader_entry_type_t {
|
||||
} wups_loader_entry_type_t;
|
||||
|
||||
typedef enum WUPSFPTargetProcess {
|
||||
WUPS_FP_TARGET_PROCESS_ALL = 0xFF,
|
||||
WUPS_FP_TARGET_PROCESS_ROOT_RPX = 1,
|
||||
WUPS_FP_TARGET_PROCESS_WII_U_MENU = 2,
|
||||
WUPS_FP_TARGET_PROCESS_TVII = 3,
|
||||
WUPS_FP_TARGET_PROCESS_E_MANUAL = 4,
|
||||
WUPS_FP_TARGET_PROCESS_HOME_MENU = 5,
|
||||
WUPS_FP_TARGET_PROCESS_ERROR_DISPLAY = 6,
|
||||
WUPS_FP_TARGET_PROCESS_MINI_MIIVERSE = 7,
|
||||
WUPS_FP_TARGET_PROCESS_BROWSER = 8,
|
||||
WUPS_FP_TARGET_PROCESS_MIIVERSE = 9,
|
||||
WUPS_FP_TARGET_PROCESS_ESHOP = 10,
|
||||
WUPS_FP_TARGET_PROCESS_PFID_11 = 11,
|
||||
WUPS_FP_TARGET_PROCESS_DOWNLOAD_MANAGER = 12,
|
||||
WUPS_FP_TARGET_PROCESS_PFID_13 = 13,
|
||||
WUPS_FP_TARGET_PROCESS_PFID_14 = 14,
|
||||
WUPS_FP_TARGET_PROCESS_GAME = 15,
|
||||
WUPS_FP_TARGET_PROCESS_GAME_AND_MENU = 16,
|
||||
WUPS_FP_TARGET_PROCESS_ALL = 0xFF,
|
||||
WUPS_FP_TARGET_PROCESS_ROOT_RPX = 1,
|
||||
WUPS_FP_TARGET_PROCESS_WII_U_MENU = 2,
|
||||
WUPS_FP_TARGET_PROCESS_TVII = 3,
|
||||
WUPS_FP_TARGET_PROCESS_E_MANUAL = 4,
|
||||
WUPS_FP_TARGET_PROCESS_HOME_MENU = 5,
|
||||
WUPS_FP_TARGET_PROCESS_ERROR_DISPLAY = 6,
|
||||
WUPS_FP_TARGET_PROCESS_MINI_MIIVERSE = 7,
|
||||
WUPS_FP_TARGET_PROCESS_BROWSER = 8,
|
||||
WUPS_FP_TARGET_PROCESS_MIIVERSE = 9,
|
||||
WUPS_FP_TARGET_PROCESS_ESHOP = 10,
|
||||
WUPS_FP_TARGET_PROCESS_PFID_11 = 11,
|
||||
WUPS_FP_TARGET_PROCESS_DOWNLOAD_MANAGER = 12,
|
||||
WUPS_FP_TARGET_PROCESS_PFID_13 = 13,
|
||||
WUPS_FP_TARGET_PROCESS_PFID_14 = 14,
|
||||
WUPS_FP_TARGET_PROCESS_GAME = 15,
|
||||
WUPS_FP_TARGET_PROCESS_GAME_AND_MENU = 16,
|
||||
} WUPSFPTargetProcess;
|
||||
|
||||
typedef struct wups_loader_entry_t {
|
||||
wups_loader_entry_type_t type;
|
||||
struct {
|
||||
const void * physical_address; /* (optional) Physical Address. If set, the name and lib will be ignored */
|
||||
const void * virtual_address; /* (optional) Physical Address. If set, the name and lib will be ignored */
|
||||
const char * name; /* Name of the function that will be replaced */
|
||||
const wups_loader_library_type_t library; /**/
|
||||
const char * my_function_name; /* Function name of your own, new function (my_XXX) */
|
||||
const void * target; /* Address of our own, new function (my_XXX)*/
|
||||
const void * call_addr; /* Address for calling the real function.(real_XXX) */
|
||||
const WUPSFPTargetProcess targetProcess; /* Target process*/
|
||||
const void *physical_address; /* (optional) Physical Address. If set, the name and lib will be ignored */
|
||||
const void *virtual_address; /* (optional) Physical Address. If set, the name and lib will be ignored */
|
||||
const char *name; /* Name of the function that will be replaced */
|
||||
const wups_loader_library_type_t library; /**/
|
||||
const char *my_function_name; /* Function name of your own, new function (my_XXX) */
|
||||
const void *target; /* Address of our own, new function (my_XXX)*/
|
||||
const void *call_addr; /* Address for calling the real function.(real_XXX) */
|
||||
const WUPSFPTargetProcess targetProcess; /* Target process*/
|
||||
} _function;
|
||||
} wups_loader_entry_t;
|
||||
|
||||
#define WUPS_MUST_REPLACE_PHYSICAL(x, physical_address, virtual_address) WUPS_MUST_REPLACE_PHYSICAL_FOR_PROCESS(x, physical_address, virtual_address, WUPS_FP_TARGET_PROCESS_GAME_AND_MENU)
|
||||
#define WUPS_MUST_REPLACE_PHYSICAL_FOR_PROCESS(x, physical_address, virtual_address, targetProcess) WUPS_MUST_REPLACE_EX(physical_address, virtual_address, real_ ## x, WUPS_LOADER_LIBRARY_OTHER, my_ ## x, x, targetProcess)
|
||||
#define WUPS_MUST_REPLACE_PHYSICAL(x, physical_address, virtual_address) WUPS_MUST_REPLACE_PHYSICAL_FOR_PROCESS(x, physical_address, virtual_address, WUPS_FP_TARGET_PROCESS_GAME_AND_MENU)
|
||||
#define WUPS_MUST_REPLACE_PHYSICAL_FOR_PROCESS(x, physical_address, virtual_address, targetProcess) WUPS_MUST_REPLACE_EX(physical_address, virtual_address, real_##x, WUPS_LOADER_LIBRARY_OTHER, my_##x, x, targetProcess)
|
||||
|
||||
#define WUPS_MUST_REPLACE(x, lib, function_name) WUPS_MUST_REPLACE_FOR_PROCESS(x, lib, function_name, WUPS_FP_TARGET_PROCESS_GAME_AND_MENU)
|
||||
#define WUPS_MUST_REPLACE_FOR_PROCESS(x, lib, function_name, targetProcess) WUPS_MUST_REPLACE_EX(NULL, NULL, real_ ## x, lib, my_ ## x, function_name, targetProcess)
|
||||
#define WUPS_MUST_REPLACE(x, lib, function_name) WUPS_MUST_REPLACE_FOR_PROCESS(x, lib, function_name, WUPS_FP_TARGET_PROCESS_GAME_AND_MENU)
|
||||
#define WUPS_MUST_REPLACE_FOR_PROCESS(x, lib, function_name, targetProcess) WUPS_MUST_REPLACE_EX(NULL, NULL, real_##x, lib, my_##x, function_name, targetProcess)
|
||||
|
||||
#define WUPS_MUST_REPLACE_EX(pAddress, vAddress, original_func, rpl_type, replace_func, replace_function_name, process) \
|
||||
extern const wups_loader_entry_t wups_load_ ## replace_func \
|
||||
WUPS_SECTION("load"); \
|
||||
const wups_loader_entry_t wups_load_ ## replace_func = { \
|
||||
.type = WUPS_LOADER_ENTRY_FUNCTION_MANDATORY, \
|
||||
._function = { \
|
||||
.physical_address = (const void*) pAddress, \
|
||||
.virtual_address = (const void*) vAddress, \
|
||||
.name = #replace_function_name, \
|
||||
.library = rpl_type, \
|
||||
.my_function_name = #replace_func, \
|
||||
.target = (const void*)&(replace_func), \
|
||||
.call_addr = (const void*)&(original_func), \
|
||||
.targetProcess = process\
|
||||
} \
|
||||
}
|
||||
extern const wups_loader_entry_t wups_load_##replace_func \
|
||||
WUPS_SECTION("load"); \
|
||||
const wups_loader_entry_t wups_load_##replace_func = { \
|
||||
.type = WUPS_LOADER_ENTRY_FUNCTION_MANDATORY, \
|
||||
._function = { \
|
||||
.physical_address = (const void *) pAddress, \
|
||||
.virtual_address = (const void *) vAddress, \
|
||||
.name = #replace_function_name, \
|
||||
.library = rpl_type, \
|
||||
.my_function_name = #replace_func, \
|
||||
.target = (const void *) &(replace_func), \
|
||||
.call_addr = (const void *) &(original_func), \
|
||||
.targetProcess = process}}
|
||||
|
||||
#define DECL_FUNCTION(res, name, ...) \
|
||||
res (* real_ ## name)(__VA_ARGS__) __attribute__((section(".data"))); \
|
||||
res my_ ## name(__VA_ARGS__)
|
||||
#define DECL_FUNCTION(res, name, ...) \
|
||||
res (*real_##name)(__VA_ARGS__) __attribute__((section(".data"))); \
|
||||
res my_##name(__VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -23,12 +23,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define WUPS_HOOK_EX(type_def, original_func) \
|
||||
extern const wups_loader_hook_t wups_hooks_ ## original_func WUPS_SECTION("hooks"); \
|
||||
const wups_loader_hook_t wups_hooks_ ## original_func = { \
|
||||
.type = type_def, \
|
||||
.target = (const void*)&(original_func) \
|
||||
}
|
||||
#define WUPS_HOOK_EX(type_def, original_func) \
|
||||
extern const wups_loader_hook_t wups_hooks_##original_func WUPS_SECTION("hooks"); \
|
||||
const wups_loader_hook_t wups_hooks_##original_func = { \
|
||||
.type = type_def, \
|
||||
.target = (const void *) &(original_func)}
|
||||
|
||||
typedef enum wups_loader_hook_type_t {
|
||||
WUPS_LOADER_HOOK_INIT_WUT_MALLOC,
|
||||
@@ -42,85 +41,85 @@ typedef enum wups_loader_hook_type_t {
|
||||
WUPS_LOADER_HOOK_INIT_WUT_SOCKETS,
|
||||
WUPS_LOADER_HOOK_FINI_WUT_SOCKETS,
|
||||
|
||||
WUPS_LOADER_HOOK_INIT_WRAPPER, /* Calls __init */
|
||||
WUPS_LOADER_HOOK_FINI_WRAPPER, /* Calls __fini */
|
||||
WUPS_LOADER_HOOK_INIT_WRAPPER, /* Calls __init */
|
||||
WUPS_LOADER_HOOK_FINI_WRAPPER, /* Calls __fini */
|
||||
|
||||
WUPS_LOADER_HOOK_GET_CONFIG,
|
||||
WUPS_LOADER_HOOK_CONFIG_CLOSED,
|
||||
|
||||
WUPS_LOADER_HOOK_INIT_STORAGE, /* Only for internal usage */
|
||||
WUPS_LOADER_HOOK_INIT_STORAGE, /* Only for internal usage */
|
||||
|
||||
WUPS_LOADER_HOOK_INIT_PLUGIN, /* Called when exiting the plugin loader */
|
||||
WUPS_LOADER_HOOK_DEINIT_PLUGIN, /* Called when re-entering the plugin loader */
|
||||
WUPS_LOADER_HOOK_APPLICATION_STARTS, /* Called when an application gets started */
|
||||
WUPS_LOADER_HOOK_FUNCTIONS_PATCHED, /* Called when the functions where patched */
|
||||
WUPS_LOADER_HOOK_RELEASE_FOREGROUND, /* Called when an foreground is going to be released */
|
||||
WUPS_LOADER_HOOK_ACQUIRED_FOREGROUND, /* Called when an foreground is acquired */
|
||||
WUPS_LOADER_HOOK_APPLICATION_REQUESTS_EXIT, /* Called when an application wants to exit */
|
||||
WUPS_LOADER_HOOK_APPLICATION_ENDS, /* Called when an application ends */
|
||||
WUPS_LOADER_HOOK_INIT_PLUGIN, /* Called when exiting the plugin loader */
|
||||
WUPS_LOADER_HOOK_DEINIT_PLUGIN, /* Called when re-entering the plugin loader */
|
||||
WUPS_LOADER_HOOK_APPLICATION_STARTS, /* Called when an application gets started */
|
||||
WUPS_LOADER_HOOK_FUNCTIONS_PATCHED, /* Called when the functions where patched */
|
||||
WUPS_LOADER_HOOK_RELEASE_FOREGROUND, /* Called when an foreground is going to be released */
|
||||
WUPS_LOADER_HOOK_ACQUIRED_FOREGROUND, /* Called when an foreground is acquired */
|
||||
WUPS_LOADER_HOOK_APPLICATION_REQUESTS_EXIT, /* Called when an application wants to exit */
|
||||
WUPS_LOADER_HOOK_APPLICATION_ENDS, /* Called when an application ends */
|
||||
} wups_loader_hook_type_t;
|
||||
|
||||
typedef struct wups_loader_hook_t {
|
||||
wups_loader_hook_type_t type; /* Defines the type of the hook */
|
||||
const void *target; /* Address of our own, new function */
|
||||
wups_loader_hook_type_t type; /* Defines the type of the hook */
|
||||
const void *target; /* Address of our own, new function */
|
||||
} wups_loader_hook_t;
|
||||
|
||||
#define INITIALIZE_PLUGIN() \
|
||||
void init_plugin(void);\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_PLUGIN,init_plugin); \
|
||||
#define INITIALIZE_PLUGIN() \
|
||||
void init_plugin(void); \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_PLUGIN, init_plugin); \
|
||||
void init_plugin()
|
||||
|
||||
#define DEINITIALIZE_PLUGIN() \
|
||||
void deinit_plugin(void);\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_DEINIT_PLUGIN,deinit_plugin); \
|
||||
#define DEINITIALIZE_PLUGIN() \
|
||||
void deinit_plugin(void); \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_DEINIT_PLUGIN, deinit_plugin); \
|
||||
void deinit_plugin()
|
||||
|
||||
#define ON_APPLICATION_START() \
|
||||
void on_app_starting();\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_APPLICATION_STARTS,on_app_starting); \
|
||||
#define ON_APPLICATION_START() \
|
||||
void on_app_starting(); \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_APPLICATION_STARTS, on_app_starting); \
|
||||
void on_app_starting()
|
||||
|
||||
#define ON_FUNCTIONS_PATCHED() \
|
||||
void on_functions_patched();\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FUNCTIONS_PATCHED,on_functions_patched); \
|
||||
#define ON_FUNCTIONS_PATCHED() \
|
||||
void on_functions_patched(); \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FUNCTIONS_PATCHED, on_functions_patched); \
|
||||
void on_functions_patched()
|
||||
|
||||
#define ON_RELEASE_FOREGROUND() \
|
||||
void on_release_foreground(void);\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_RELEASE_FOREGROUND,on_release_foreground); \
|
||||
#define ON_RELEASE_FOREGROUND() \
|
||||
void on_release_foreground(void); \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_RELEASE_FOREGROUND, on_release_foreground); \
|
||||
void on_release_foreground(void)
|
||||
|
||||
#define ON_ACQUIRED_FOREGROUND() \
|
||||
void on_acquired_foreground(void);\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_ACQUIRED_FOREGROUND,on_acquired_foreground); \
|
||||
#define ON_ACQUIRED_FOREGROUND() \
|
||||
void on_acquired_foreground(void); \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_ACQUIRED_FOREGROUND, on_acquired_foreground); \
|
||||
void on_acquired_foreground(void)
|
||||
|
||||
#define ON_APPLICATION_REQUESTS_EXIT() \
|
||||
void on_app_requests_exit(void);\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_APPLICATION_REQUESTS_EXIT,on_app_requests_exit); \
|
||||
#define ON_APPLICATION_REQUESTS_EXIT() \
|
||||
void on_app_requests_exit(void); \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_APPLICATION_REQUESTS_EXIT, on_app_requests_exit); \
|
||||
void on_app_requests_exit(void)
|
||||
|
||||
#define ON_APPLICATION_ENDS() \
|
||||
void on_app_ending(void);\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_APPLICATION_ENDS,on_app_ending); \
|
||||
#define ON_APPLICATION_ENDS() \
|
||||
void on_app_ending(void); \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_APPLICATION_ENDS, on_app_ending); \
|
||||
void on_app_ending(void)
|
||||
|
||||
#define WUPS_GET_CONFIG() \
|
||||
WUPSConfigHandle on_get_wups_config(void);\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_GET_CONFIG,on_get_wups_config); \
|
||||
#define WUPS_GET_CONFIG() \
|
||||
WUPSConfigHandle on_get_wups_config(void); \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_GET_CONFIG, on_get_wups_config); \
|
||||
WUPSConfigHandle on_get_wups_config(void)
|
||||
|
||||
#define WUPS_CONFIG_CLOSED() \
|
||||
void on_wups_config_closed(void);\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_CONFIG_CLOSED,on_wups_config_closed); \
|
||||
#define WUPS_CONFIG_CLOSED() \
|
||||
void on_wups_config_closed(void); \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_CONFIG_CLOSED, on_wups_config_closed); \
|
||||
void on_wups_config_closed(void)
|
||||
|
||||
#define WUPS_USE_STORAGE(x) \
|
||||
WUPS_META(storage_id, x); \
|
||||
void init_storage(wups_loader_init_storage_args_t);\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_STORAGE,init_storage); \
|
||||
void init_storage(wups_loader_init_storage_args_t args){ \
|
||||
WUPS_InitStorage(args);\
|
||||
#define WUPS_USE_STORAGE(x) \
|
||||
WUPS_META(storage_id, x); \
|
||||
void init_storage(wups_loader_init_storage_args_t); \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_STORAGE, init_storage); \
|
||||
void init_storage(wups_loader_init_storage_args_t args) { \
|
||||
WUPS_InitStorage(args); \
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -129,79 +128,79 @@ typedef struct wups_loader_hook_t {
|
||||
#define __EXTERN_C_MACRO
|
||||
#endif
|
||||
|
||||
#define WUPS_USE_WUT_MALLOC() \
|
||||
__EXTERN_C_MACRO void __init_wut_malloc(); \
|
||||
void on_init_wut_malloc(){ \
|
||||
__init_wut_malloc(); \
|
||||
}\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_WUT_MALLOC,on_init_wut_malloc); \
|
||||
__EXTERN_C_MACRO void __fini_wut_malloc(); \
|
||||
void on_fini_wut_malloc(){ \
|
||||
__fini_wut_malloc(); \
|
||||
} \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FINI_WUT_MALLOC,on_fini_wut_malloc)
|
||||
#define WUPS_USE_WUT_MALLOC() \
|
||||
__EXTERN_C_MACRO void __init_wut_malloc(); \
|
||||
void on_init_wut_malloc() { \
|
||||
__init_wut_malloc(); \
|
||||
} \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_WUT_MALLOC, on_init_wut_malloc); \
|
||||
__EXTERN_C_MACRO void __fini_wut_malloc(); \
|
||||
void on_fini_wut_malloc() { \
|
||||
__fini_wut_malloc(); \
|
||||
} \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FINI_WUT_MALLOC, on_fini_wut_malloc)
|
||||
|
||||
#define WUPS_USE_WUT_DEVOPTAB() \
|
||||
__EXTERN_C_MACRO void __init_wut_devoptab(); \
|
||||
void on_init_wut_devoptab(){ \
|
||||
__init_wut_devoptab(); \
|
||||
}\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_WUT_DEVOPTAB,on_init_wut_devoptab); \
|
||||
__EXTERN_C_MACRO void __fini_wut_devoptab(); \
|
||||
void on_fini_wut_devoptab(){ \
|
||||
__fini_wut_devoptab(); \
|
||||
}\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FINI_WUT_DEVOPTAB,on_fini_wut_devoptab)
|
||||
#define WUPS_USE_WUT_DEVOPTAB() \
|
||||
__EXTERN_C_MACRO void __init_wut_devoptab(); \
|
||||
void on_init_wut_devoptab() { \
|
||||
__init_wut_devoptab(); \
|
||||
} \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_WUT_DEVOPTAB, on_init_wut_devoptab); \
|
||||
__EXTERN_C_MACRO void __fini_wut_devoptab(); \
|
||||
void on_fini_wut_devoptab() { \
|
||||
__fini_wut_devoptab(); \
|
||||
} \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FINI_WUT_DEVOPTAB, on_fini_wut_devoptab)
|
||||
|
||||
#define WUPS_USE_WUT_NEWLIB() \
|
||||
__EXTERN_C_MACRO void __init_wut_newlib(); \
|
||||
void on_init_wut_newlib(){ \
|
||||
__init_wut_newlib(); \
|
||||
}\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_WUT_NEWLIB,on_init_wut_newlib); \
|
||||
__EXTERN_C_MACRO void __fini_wut_newlib(); \
|
||||
void on_fini_wut_newlib(){ \
|
||||
__fini_wut_newlib(); \
|
||||
}\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FINI_WUT_NEWLIB,on_fini_wut_newlib)
|
||||
#define WUPS_USE_WUT_NEWLIB() \
|
||||
__EXTERN_C_MACRO void __init_wut_newlib(); \
|
||||
void on_init_wut_newlib() { \
|
||||
__init_wut_newlib(); \
|
||||
} \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_WUT_NEWLIB, on_init_wut_newlib); \
|
||||
__EXTERN_C_MACRO void __fini_wut_newlib(); \
|
||||
void on_fini_wut_newlib() { \
|
||||
__fini_wut_newlib(); \
|
||||
} \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FINI_WUT_NEWLIB, on_fini_wut_newlib)
|
||||
|
||||
#define WUPS_USE_WUT_STDCPP() \
|
||||
__EXTERN_C_MACRO void __init_wut_stdcpp(); \
|
||||
void on_init_wut_stdcpp(){ \
|
||||
__init_wut_stdcpp(); \
|
||||
}\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_WUT_STDCPP,on_init_wut_stdcpp); \
|
||||
__EXTERN_C_MACRO void __fini_wut_stdcpp(); \
|
||||
void on_fini_wut_stdcpp(){ \
|
||||
__fini_wut_stdcpp(); \
|
||||
}\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FINI_WUT_STDCPP,on_fini_wut_stdcpp)
|
||||
#define WUPS_USE_WUT_STDCPP() \
|
||||
__EXTERN_C_MACRO void __init_wut_stdcpp(); \
|
||||
void on_init_wut_stdcpp() { \
|
||||
__init_wut_stdcpp(); \
|
||||
} \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_WUT_STDCPP, on_init_wut_stdcpp); \
|
||||
__EXTERN_C_MACRO void __fini_wut_stdcpp(); \
|
||||
void on_fini_wut_stdcpp() { \
|
||||
__fini_wut_stdcpp(); \
|
||||
} \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FINI_WUT_STDCPP, on_fini_wut_stdcpp)
|
||||
|
||||
#define WUPS___INIT_WRAPPER() \
|
||||
#define WUPS___INIT_WRAPPER() \
|
||||
__EXTERN_C_MACRO void __init(); \
|
||||
void __init_wrapper(){ \
|
||||
__init(); \
|
||||
}\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_WRAPPER,__init_wrapper);
|
||||
void __init_wrapper() { \
|
||||
__init(); \
|
||||
} \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_WRAPPER, __init_wrapper);
|
||||
|
||||
#define WUPS___FINI_WRAPPER() \
|
||||
#define WUPS___FINI_WRAPPER() \
|
||||
__EXTERN_C_MACRO void __fini(); \
|
||||
void __fini_wrapper(){ \
|
||||
__fini(); \
|
||||
}\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FINI_WRAPPER,__fini_wrapper);
|
||||
void __fini_wrapper() { \
|
||||
__fini(); \
|
||||
} \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FINI_WRAPPER, __fini_wrapper);
|
||||
|
||||
#define WUPS_USE_WUT_SOCKETS() \
|
||||
__EXTERN_C_MACRO void __attribute__((weak)) __init_wut_socket(); \
|
||||
void on_init_wut_sockets(){ \
|
||||
if (&__init_wut_socket) __init_wut_socket(); \
|
||||
} \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_WUT_SOCKETS,on_init_wut_sockets); \
|
||||
__EXTERN_C_MACRO void __attribute__((weak)) __fini_wut_socket(); \
|
||||
void on_fini_wut_sockets(){ \
|
||||
if (&__fini_wut_socket) __fini_wut_socket(); \
|
||||
}\
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FINI_WUT_SOCKETS,on_fini_wut_sockets)
|
||||
#define WUPS_USE_WUT_SOCKETS() \
|
||||
__EXTERN_C_MACRO void __attribute__((weak)) __init_wut_socket(); \
|
||||
void on_init_wut_sockets() { \
|
||||
if (&__init_wut_socket) __init_wut_socket(); \
|
||||
} \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_WUT_SOCKETS, on_init_wut_sockets); \
|
||||
__EXTERN_C_MACRO void __attribute__((weak)) __fini_wut_socket(); \
|
||||
void on_fini_wut_sockets() { \
|
||||
if (&__fini_wut_socket) __fini_wut_socket(); \
|
||||
} \
|
||||
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FINI_WUT_SOCKETS, on_fini_wut_sockets)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -32,21 +32,22 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define WUPS_PLUGIN_NAME(x) WUPS_META(name, x); \
|
||||
WUPS_META(wups, "0.7.0"); \
|
||||
WUPS_USE_WUT_MALLOC(); \
|
||||
WUPS_USE_WUT_SOCKETS(); \
|
||||
WUPS_USE_WUT_NEWLIB(); \
|
||||
WUPS_USE_WUT_STDCPP(); \
|
||||
WUPS___INIT_WRAPPER(); \
|
||||
WUPS___FINI_WRAPPER(); \
|
||||
WUPS_META(buildtimestamp, __DATE__ " " __TIME__);
|
||||
#define WUPS_PLUGIN_NAME(x) \
|
||||
WUPS_META(name, x); \
|
||||
WUPS_META(wups, "0.7.0"); \
|
||||
WUPS_USE_WUT_MALLOC(); \
|
||||
WUPS_USE_WUT_SOCKETS(); \
|
||||
WUPS_USE_WUT_NEWLIB(); \
|
||||
WUPS_USE_WUT_STDCPP(); \
|
||||
WUPS___INIT_WRAPPER(); \
|
||||
WUPS___FINI_WRAPPER(); \
|
||||
WUPS_META(buildtimestamp, __DATE__ " " __TIME__);
|
||||
|
||||
#define WUPS_PLUGIN_AUTHOR(x) WUPS_META(author, x)
|
||||
#define WUPS_PLUGIN_VERSION(x) WUPS_META(version, x)
|
||||
#define WUPS_PLUGIN_LICENSE(x) WUPS_META(license, x)
|
||||
#define WUPS_PLUGIN_DESCRIPTION(x) WUPS_META(description, x)
|
||||
#define WUPS_PLUGIN_CONFIG_REVISION(x) WUPS_META(config_revision, #x)
|
||||
#define WUPS_PLUGIN_AUTHOR(x) WUPS_META(author, x)
|
||||
#define WUPS_PLUGIN_VERSION(x) WUPS_META(version, x)
|
||||
#define WUPS_PLUGIN_LICENSE(x) WUPS_META(license, x)
|
||||
#define WUPS_PLUGIN_DESCRIPTION(x) WUPS_META(description, x)
|
||||
#define WUPS_PLUGIN_CONFIG_REVISION(x) WUPS_META(config_revision, #x)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ typedef enum wups_storage_type_t_ {
|
||||
} wups_storage_type_t;
|
||||
|
||||
enum {
|
||||
WUPS_STORAGE_ERROR_SUCCESS = 0,
|
||||
WUPS_STORAGE_ERROR_SUCCESS = 0,
|
||||
WUPS_STORAGE_ERROR_NOT_OPENED = -1,
|
||||
WUPS_STORAGE_ERROR_ALREADY_OPENED = -2,
|
||||
WUPS_STORAGE_ERROR_INVALID_ARGS = -3,
|
||||
|
||||
Reference in New Issue
Block a user