mirror of
https://github.com/wiiu-env/FunctionPatcherModule.git
synced 2026-05-06 04:46:25 -05:00
Patch functions while holding the lock
This commit is contained in:
parent
a6da482728
commit
b2e72be198
|
|
@ -38,22 +38,21 @@ FunctionPatcherStatus FPAddFunctionPatch(function_replacement_data_t *function_d
|
||||||
return FUNCTION_PATCHER_RESULT_UNKNOWN_ERROR;
|
return FUNCTION_PATCHER_RESULT_UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto &functionData = functionDataOpt.value();
|
|
||||||
|
|
||||||
// PatchFunction calls OSFatal on fatal errors.
|
|
||||||
// If this function returns false the target function was not patched
|
|
||||||
// Usually this means the target RPL is not (yet) loaded.
|
|
||||||
auto patchResult = PatchFunction(functionData);
|
|
||||||
if (outHasBeenPatched) {
|
|
||||||
*outHasBeenPatched = patchResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (outHandle) {
|
|
||||||
*outHandle = functionData->getHandle();
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
std::lock_guard lock(gPatchedFunctionsMutex);
|
std::lock_guard lock(gPatchedFunctionsMutex);
|
||||||
|
auto &functionData = functionDataOpt.value();
|
||||||
|
// PatchFunction calls OSFatal on fatal errors.
|
||||||
|
// If this function returns false the target function was not patched
|
||||||
|
// Usually this means the target RPL is not (yet) loaded.
|
||||||
|
auto patchResult = PatchFunction(functionData);
|
||||||
|
if (outHasBeenPatched) {
|
||||||
|
*outHasBeenPatched = patchResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (outHandle) {
|
||||||
|
*outHandle = functionData->getHandle();
|
||||||
|
}
|
||||||
|
|
||||||
gPatchedFunctions.push_back(std::move(functionData));
|
gPatchedFunctions.push_back(std::move(functionData));
|
||||||
|
|
||||||
OSMemoryBarrier();
|
OSMemoryBarrier();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user