mirror of
https://github.com/wiiu-env/libfunctionpatcher.git
synced 2024-11-27 20:14:16 +01:00
Refactor the replace function macros to use the same base macro
This commit is contained in:
parent
b962869a34
commit
ec7c99f666
@ -94,34 +94,26 @@ typedef struct function_replacement_data_t {
|
|||||||
uint8_t alreadyPatched; /* [will be filled] */
|
uint8_t alreadyPatched; /* [will be filled] */
|
||||||
} function_replacement_data_t;
|
} function_replacement_data_t;
|
||||||
|
|
||||||
|
|
||||||
#define REPLACE_FUNCTION(x, lib, function_name) \
|
#define REPLACE_FUNCTION(x, lib, function_name) \
|
||||||
{ \
|
REPLACE_FUNCTION_EX(x, lib, function_name, 0, 0)
|
||||||
0, \
|
|
||||||
0, \
|
|
||||||
(uint32_t) my_ ## x, \
|
|
||||||
(uint32_t) &real_ ## x, \
|
|
||||||
lib, \
|
|
||||||
# function_name, \
|
|
||||||
0, \
|
|
||||||
{}, \
|
|
||||||
0, \
|
|
||||||
FUNCTION_PATCHER_STATIC_FUNCTION, \
|
|
||||||
0 \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define REPLACE_FUNCTION_VIA_ADDRESS(x, physicalAddress, effectiveAddress) \
|
#define REPLACE_FUNCTION_VIA_ADDRESS(x, physicalAddress, effectiveAddress) \
|
||||||
|
REPLACE_FUNCTION_EX(x, LIBRARY_OTHER, x, physicalAddress, effectiveAddress)
|
||||||
|
|
||||||
|
#define REPLACE_FUNCTION_EX(x, lib, function_name, physicalAddress, effectiveAddress) \
|
||||||
{ \
|
{ \
|
||||||
physicalAddress, \
|
physicalAddress, \
|
||||||
effectiveAddress, \
|
effectiveAddress, \
|
||||||
(uint32_t) my_ ## x, \
|
(uint32_t) my_ ## x, \
|
||||||
(uint32_t) &real_ ## x, \
|
(uint32_t) &real_ ## x, \
|
||||||
LIBRARY_OTHER, \
|
lib, \
|
||||||
# x, \
|
function_name, \
|
||||||
0, \
|
0, \
|
||||||
{}, \
|
{}, \
|
||||||
0, \
|
0, \
|
||||||
FUNCTION_PATCHER_STATIC_FUNCTION, \
|
FUNCTION_PATCHER_STATIC_FUNCTION, \
|
||||||
0 \
|
0, \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DECL_FUNCTION(res, name, ...) \
|
#define DECL_FUNCTION(res, name, ...) \
|
||||||
|
Loading…
Reference in New Issue
Block a user