diff --git a/source/FunctionAddressProvider.cpp b/source/FunctionAddressProvider.cpp index e134e14..d5f5b30 100644 --- a/source/FunctionAddressProvider.cpp +++ b/source/FunctionAddressProvider.cpp @@ -11,7 +11,7 @@ uint32_t FunctionAddressProvider::getEffectiveAddressOfFunction(function_replace for (auto &rplHandle : rpl_handles) { if (rplHandle.library == library) { if (rplHandle.handle == nullptr) { - DEBUG_FUNCTION_LINE_VERBOSE("Lets acquire handle for rpl: %s", rplHandle.rplname); + DEBUG_FUNCTION_LINE_VERBOSE("Lets check if rpl is loaded: %s", rplHandle.rplname); err = OSDynLoad_IsModuleLoaded((char *) rplHandle.rplname, &rplHandle.handle); } if (err != OS_DYNLOAD_OK || !rplHandle.handle) { diff --git a/source/PatchedFunctionData.cpp b/source/PatchedFunctionData.cpp index ca4c798..1e3a489 100644 --- a/source/PatchedFunctionData.cpp +++ b/source/PatchedFunctionData.cpp @@ -54,7 +54,7 @@ bool PatchedFunctionData::updateFunctionAddresses() { if (!this->functionName) { DEBUG_FUNCTION_LINE_ERR("Function name was empty. This should never happen."); - OSFatal("function name was empty"); + OSFatal("FunctionPatcherModule: function name was empty"); return false; } @@ -77,7 +77,7 @@ bool PatchedFunctionData::updateFunctionAddresses() { void PatchedFunctionData::generateJumpToOriginal() { if (!this->jumpToOriginal) { DEBUG_FUNCTION_LINE_ERR("this->jumpToOriginal is not allocated"); - OSFatal("this->jumpToOriginal is not allocated"); + OSFatal("FunctionPatcherModule: this->jumpToOriginal is not allocated"); } uint32_t jumpToAddress = this->realEffectiveFunctionAddress + 4; @@ -109,7 +109,7 @@ void PatchedFunctionData::generateReplacementJump() { if (this->replacementFunctionAddress > 0x01FFFFFC || this->targetProcess != FP_TARGET_PROCESS_ALL) { if (!this->jumpData) { DEBUG_FUNCTION_LINE_ERR("jumpData was not allocated"); - OSFatal("jumpData was not allocated"); + OSFatal("FunctionPatcherModule: jumpData was not allocated"); } uint32_t offset = 0; if (this->targetProcess != FP_TARGET_PROCESS_ALL) { @@ -150,13 +150,13 @@ void PatchedFunctionData::generateReplacementJump() { if (offset >= this->jumpDataSize) { DEBUG_FUNCTION_LINE_ERR("Tried to overflow buffer. offset: %08X vs array size: %08X", offset, this->jumpDataSize); - OSFatal("Wrote too much data"); + OSFatal("FunctionPatcherModule: Wrote too much data"); } // Make sure the trampoline itself is usable. if (((uint32_t) this->jumpData & 0x01FFFFFC) != (uint32_t) this->jumpData) { DEBUG_FUNCTION_LINE_ERR("Jump is impossible"); - OSFatal("Jump is impossible"); + OSFatal("FunctionPatcherModule: Jump is impossible"); } this->replaceWithInstruction = 0x48000002 | ((uint32_t) this->jumpData & 0x01FFFFFC); diff --git a/source/function_patcher.cpp b/source/function_patcher.cpp index 8aaa91f..fee12e5 100644 --- a/source/function_patcher.cpp +++ b/source/function_patcher.cpp @@ -49,7 +49,7 @@ bool PatchFunction(std::shared_ptr &patchedFunction) { if (!ReadFromPhysicalAddress(patchedFunction->realPhysicalFunctionAddress, &patchedFunction->replacedInstruction)) { DEBUG_FUNCTION_LINE_ERR("Failed to read instruction."); - OSFatal("Failed to read instruction."); + OSFatal("FunctionPatcherModule: Failed to read instruction."); return false; } @@ -108,7 +108,7 @@ bool RestoreFunction(std::shared_ptr &patchedFunction) { } if (sourceAddrPhys == 0) { - OSFatal("Failed to get physical address"); + OSFatal("FunctionPatcherModule: Failed to get physical address"); } KernelCopyData(targetAddrPhys, sourceAddrPhys, 4); diff --git a/source/main.cpp b/source/main.cpp index 6692f8f..5786ee2 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -19,18 +19,17 @@ void UpdateFunctionPointer() { OSDynLoad_Module coreinitModule; if (OSDynLoad_Acquire("coreinit", &coreinitModule) != OS_DYNLOAD_OK) { DEBUG_FUNCTION_LINE_ERR("Failed to acquire coreinit.rpl"); - OSFatal("Failed to acquire coreinit.rpl"); + OSFatal("FunctionPatcherModule: Failed to acquire coreinit.rpl"); } /* Memory allocation functions */ uint32_t *allocPtr, *freePtr; - /* Memory allocation functions */ if (OSDynLoad_FindExport(coreinitModule, true, "MEMAllocFromDefaultHeapEx", reinterpret_cast(&allocPtr)) != OS_DYNLOAD_OK) { DEBUG_FUNCTION_LINE_ERR("OSDynLoad_FindExport for MEMAllocFromDefaultHeapEx"); - OSFatal("OSDynLoad_FindExport for MEMAllocFromDefaultHeapEx"); + OSFatal("FunctionPatcherModule: OSDynLoad_FindExport for MEMAllocFromDefaultHeapEx"); } if (OSDynLoad_FindExport(coreinitModule, true, "MEMFreeToDefaultHeap", reinterpret_cast(&freePtr)) != OS_DYNLOAD_OK) { DEBUG_FUNCTION_LINE_ERR("OSDynLoad_FindExport for MEMFreeToDefaultHeap"); - OSFatal("OSDynLoad_FindExport for MEMFreeToDefaultHeap"); + OSFatal("FunctionPatcherModule: OSDynLoad_FindExport for MEMFreeToDefaultHeap"); } gMEMAllocFromDefaultHeapExForThreads = (void *(*) (uint32_t, int) ) * allocPtr; @@ -77,13 +76,13 @@ WUMS_INITIALIZE() { gJumpHeapHandle = MEMCreateExpHeapEx((void *) (gJumpHeapData), JUMP_HEAP_DATA_SIZE, 1); if (gJumpHeapHandle == nullptr) { DEBUG_FUNCTION_LINE_ERR("Failed to create heap for jump data"); - OSFatal("Failed to create heap for jump data"); + OSFatal("FunctionPatcherModule: Failed to create heap for jump data"); } gFunctionAddressProvider = make_shared_nothrow(); if (!gFunctionAddressProvider) { DEBUG_FUNCTION_LINE_ERR("Failed to create gFunctionAddressProvider"); - OSFatal("Failed to create gFunctionAddressProvider"); + OSFatal("FunctionPatcherModule: Failed to create gFunctionAddressProvider"); } } @@ -146,4 +145,4 @@ WUMS_APPLICATION_ENDS() { } WUMS_EXPORT_FUNCTION(FunctionPatcherPatchFunction); -WUMS_EXPORT_FUNCTION(FunctionPatcherRestoreFunction); +WUMS_EXPORT_FUNCTION(FunctionPatcherRestoreFunction); \ No newline at end of file