mirror of
https://github.com/wiiu-env/libfunctionpatcher.git
synced 2024-11-21 09:09:19 +01:00
Add option to patch a function for a certain process.
This commit is contained in:
parent
17ac61488b
commit
3ae37e80e9
@ -80,6 +80,26 @@ typedef enum FunctionPatcherFunctionType {
|
||||
FUNCTION_PATCHER_DYNAMIC_FUNCTION = 1
|
||||
} FunctionPatcherFunctionType;
|
||||
|
||||
typedef enum FunctionPatcherTargetProcess {
|
||||
FP_TARGET_PROCESS_ALL = 0xFF,
|
||||
FP_TARGET_PROCESS_ROOT_RPX = 1,
|
||||
FP_TARGET_PROCESS_WII_U_MENU = 2,
|
||||
FP_TARGET_PROCESS_TVII = 3,
|
||||
FP_TARGET_PROCESS_E_MANUAL = 4,
|
||||
FP_TARGET_PROCESS_HOME_MENU = 5,
|
||||
FP_TARGET_PROCESS_ERROR_DISPLAY = 6,
|
||||
FP_TARGET_PROCESS_MINI_MIIVERSE = 7,
|
||||
FP_TARGET_PROCESS_BROWSER = 8,
|
||||
FP_TARGET_PROCESS_MIIVERSE = 9,
|
||||
FP_TARGET_PROCESS_ESHOP = 10,
|
||||
FP_TARGET_PROCESS_PFID_11 = 11,
|
||||
FP_TARGET_PROCESS_DOWNLOAD_MANAGER = 12,
|
||||
FP_TARGET_PROCESS_PFID_13 = 13,
|
||||
FP_TARGET_PROCESS_PFID_14 = 14,
|
||||
FP_TARGET_PROCESS_GAME = 15,
|
||||
FP_TARGET_PROCESS_GAME_AND_MENU = 16,
|
||||
} FunctionPatcherTargetProcess;
|
||||
|
||||
#define FUNCTION_REPLACEMENT_DATA_STRUCT_VERSION 0x00000001
|
||||
|
||||
typedef struct function_replacement_data_t {
|
||||
@ -95,16 +115,23 @@ typedef struct function_replacement_data_t {
|
||||
uint32_t restoreInstruction; /* [will be filled] Copy of the instruction we replaced to jump to our code. */
|
||||
FunctionPatcherFunctionType functionType; /* [will be filled] */
|
||||
uint8_t alreadyPatched; /* [will be filled] */
|
||||
FunctionPatcherTargetProcess targetProcess; /* [will be filled] */
|
||||
} function_replacement_data_t;
|
||||
|
||||
|
||||
#define REPLACE_FUNCTION(x, lib, function_name) \
|
||||
REPLACE_FUNCTION_EX(x, lib, function_name, 0, 0)
|
||||
REPLACE_FUNCTION_FOR_PROCESS(x, lib, function_name, FP_TARGET_PROCESS_GAME_AND_MENU)
|
||||
|
||||
#define REPLACE_FUNCTION_FOR_PROCESS(x, lib, function_name, process) \
|
||||
REPLACE_FUNCTION_EX(x, lib, function_name, 0, 0, process)
|
||||
|
||||
#define REPLACE_FUNCTION_VIA_ADDRESS(x, physicalAddress, effectiveAddress) \
|
||||
REPLACE_FUNCTION_EX(x, LIBRARY_OTHER, x, physicalAddress, effectiveAddress)
|
||||
REPLACE_FUNCTION_VIA_ADDRESS_FOR_PROCESS(x, physicalAddress, effectiveAddress, FP_TARGET_PROCESS_ALL)
|
||||
|
||||
#define REPLACE_FUNCTION_EX(x, lib, function_name, physicalAddress, effectiveAddress) \
|
||||
#define REPLACE_FUNCTION_VIA_ADDRESS_FOR_PROCESS(x, physicalAddress, effectiveAddress, process) \
|
||||
REPLACE_FUNCTION_EX(x, LIBRARY_OTHER, x, physicalAddress, effectiveAddress, process)
|
||||
|
||||
#define REPLACE_FUNCTION_EX(x, lib, function_name, physicalAddress, effectiveAddress, process) \
|
||||
{ \
|
||||
FUNCTION_REPLACEMENT_DATA_STRUCT_VERSION, \
|
||||
physicalAddress, \
|
||||
@ -118,6 +145,7 @@ typedef struct function_replacement_data_t {
|
||||
0, \
|
||||
FUNCTION_PATCHER_STATIC_FUNCTION, \
|
||||
0, \
|
||||
process \
|
||||
}
|
||||
|
||||
#define DECL_FUNCTION(res, name, ...) \
|
||||
|
Loading…
Reference in New Issue
Block a user