Reset the cached function handle if RPL has been unloaded

This commit is contained in:
Maschell 2023-01-02 16:24:38 +01:00
parent e51e6a9509
commit ac0c341eb4
3 changed files with 12 additions and 0 deletions

View File

@ -67,3 +67,12 @@ function_replacement_library_type_t FunctionAddressProvider::getTypeForHandle(OS
return LIBRARY_OTHER;
}
bool FunctionAddressProvider::resetHandle(OSDynLoad_Module handle) {
for (auto &rplHandle : rpl_handles) {
if (rplHandle.handle == handle) {
rplHandle.handle = nullptr;
return true;
}
}
return false;
}

View File

@ -18,6 +18,8 @@ public:
function_replacement_library_type_t getTypeForHandle(OSDynLoad_Module toReset);
bool resetHandle(OSDynLoad_Module handle);
std::list<rpl_handling> rpl_handles = {
{LIBRARY_AVM, "avm.rpl", nullptr},
{LIBRARY_CAMERA, "camera.rpl", nullptr},

View File

@ -106,6 +106,7 @@ void notify_callback(OSDynLoad_Module module,
}
}
}
gFunctionAddressProvider->resetHandle(module);
CheckIfPatchedFunctionsAreStillInMemory();
}
}