mirror of
https://github.com/wiiu-env/FunctionPatcherModule.git
synced 2024-11-17 07:19:23 +01:00
Add FunctionPatcherRestoreDynamicFunctions
This commit is contained in:
parent
e745f34b3a
commit
978678675c
@ -36,6 +36,24 @@ void writeDataAndFlushIC(CThread *thread, void *arg) {
|
||||
ICInvalidateRange((void *) (effective_address), 4);
|
||||
}
|
||||
|
||||
void FunctionPatcherRestoreDynamicFunctions(function_replacement_data_t *replacements, uint32_t size) {
|
||||
for (uint32_t i = 0; i < size; i++) {
|
||||
function_replacement_data_t *function_data = &replacements[i];
|
||||
if (function_data->VERSION != FUNCTION_REPLACEMENT_DATA_STRUCT_VERSION) {
|
||||
OSFatal("Failed to patch function. struct version mismatch");
|
||||
}
|
||||
|
||||
uint32_t targetAddrPhys = function_data->physicalAddr;
|
||||
if (function_data->library != LIBRARY_OTHER) {
|
||||
targetAddrPhys = (uint32_t) OSEffectiveToPhysical(function_data->realAddr);
|
||||
}
|
||||
if (isDynamicFunction(targetAddrPhys)) {
|
||||
DEBUG_FUNCTION_LINE("Setting alreadyPatched to false for %s because it's a dynamic function", function_data->function_name);
|
||||
function_data->alreadyPatched = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FunctionPatcherPatchFunction(function_replacement_data_t *replacements, uint32_t size) {
|
||||
for (uint32_t i = 0; i < size; i++) {
|
||||
function_replacement_data_t *function_data = &replacements[i];
|
||||
|
@ -12,6 +12,8 @@ typedef struct rpl_handling {
|
||||
OSDynLoad_Module handle;
|
||||
} rpl_handling;
|
||||
|
||||
void FunctionPatcherRestoreDynamicFunctions(function_replacement_data_t *replacements, uint32_t size);
|
||||
|
||||
void FunctionPatcherPatchFunction(function_replacement_data_t *replacements, uint32_t size);
|
||||
|
||||
void FunctionPatcherRestoreFunctions(function_replacement_data_t *replacements, uint32_t size);
|
||||
|
@ -16,3 +16,4 @@ WUMS_APPLICATION_STARTS() {
|
||||
|
||||
WUMS_EXPORT_FUNCTION(FunctionPatcherPatchFunction);
|
||||
WUMS_EXPORT_FUNCTION(FunctionPatcherRestoreFunctions);
|
||||
WUMS_EXPORT_FUNCTION(FunctionPatcherRestoreDynamicFunctions);
|
||||
|
Loading…
Reference in New Issue
Block a user