mirror of
https://github.com/wiiu-env/FunctionPatcherModule.git
synced 2025-01-08 08:00:46 +01:00
Reset function patch state if a RPL has been unloaded.
This commit is contained in:
parent
d3a65723bc
commit
e51e6a9509
@ -57,3 +57,13 @@ void FunctionAddressProvider::resetHandles() {
|
|||||||
rplHandle.handle = nullptr;
|
rplHandle.handle = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function_replacement_library_type_t FunctionAddressProvider::getTypeForHandle(OSDynLoad_Module handle) {
|
||||||
|
for (auto &rplHandle : rpl_handles) {
|
||||||
|
if (rplHandle.handle == handle) {
|
||||||
|
return rplHandle.library;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return LIBRARY_OTHER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@ public:
|
|||||||
uint32_t getEffectiveAddressOfFunction(function_replacement_library_type_t library, const char *functionName);
|
uint32_t getEffectiveAddressOfFunction(function_replacement_library_type_t library, const char *functionName);
|
||||||
void resetHandles();
|
void resetHandles();
|
||||||
|
|
||||||
|
function_replacement_library_type_t getTypeForHandle(OSDynLoad_Module toReset);
|
||||||
|
|
||||||
std::list<rpl_handling> rpl_handles = {
|
std::list<rpl_handling> rpl_handles = {
|
||||||
{LIBRARY_AVM, "avm.rpl", nullptr},
|
{LIBRARY_AVM, "avm.rpl", nullptr},
|
||||||
{LIBRARY_CAMERA, "camera.rpl", nullptr},
|
{LIBRARY_CAMERA, "camera.rpl", nullptr},
|
||||||
|
@ -96,6 +96,17 @@ void notify_callback(OSDynLoad_Module module,
|
|||||||
for (auto &cur : gPatchedFunctions) {
|
for (auto &cur : gPatchedFunctions) {
|
||||||
PatchFunction(cur);
|
PatchFunction(cur);
|
||||||
}
|
}
|
||||||
|
} else if (reason == OS_DYNLOAD_NOTIFY_UNLOADED) {
|
||||||
|
std::lock_guard<std::mutex> lock(gPatchedFunctionsMutex);
|
||||||
|
auto library = gFunctionAddressProvider->getTypeForHandle(module);
|
||||||
|
if (library != LIBRARY_OTHER) {
|
||||||
|
for (auto &cur : gPatchedFunctions) {
|
||||||
|
if (cur->library == library) {
|
||||||
|
cur->isPatched = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CheckIfPatchedFunctionsAreStillInMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user