diff --git a/src/common/memory_patcher.cpp b/src/common/memory_patcher.cpp index fb6ef7542..336bf3ad5 100644 --- a/src/common/memory_patcher.cpp +++ b/src/common/memory_patcher.cpp @@ -1,8 +1,7 @@ -#include "memory_patcher.h" #include "common/logging/log.h" +#include "memory_patcher.h" -namespace MemoryPatcher -{ +namespace MemoryPatcher { uintptr_t g_eboot_address; @@ -25,8 +24,7 @@ void ApplyPendingPatches() { void PatchMemory(std::string modNameStr, std::string offsetStr, std::string valueStr) { // Send a request to modify the process memory. - void* cheatAddress = - reinterpret_cast(g_eboot_address + std::stoi(offsetStr, 0, 16)); + void* cheatAddress = reinterpret_cast(g_eboot_address + std::stoi(offsetStr, 0, 16)); std::vector bytePatch; @@ -38,7 +36,8 @@ void PatchMemory(std::string modNameStr, std::string offsetStr, std::string valu } std::memcpy(cheatAddress, bytePatch.data(), bytePatch.size()); - LOG_INFO(Loader, "Applied patch:{}, Offset:{}, Value:{}", modNameStr, (uintptr_t)cheatAddress, valueStr); + LOG_INFO(Loader, "Applied patch:{}, Offset:{}, Value:{}", modNameStr, (uintptr_t)cheatAddress, + valueStr); } -} \ No newline at end of file +} // namespace MemoryPatcher \ No newline at end of file diff --git a/src/common/memory_patcher.h b/src/common/memory_patcher.h index f06e547ec..43039fdb2 100644 --- a/src/common/memory_patcher.h +++ b/src/common/memory_patcher.h @@ -1,24 +1,23 @@ #pragma once #include -#include #include +#include -namespace MemoryPatcher -{ - extern uintptr_t g_eboot_address; +namespace MemoryPatcher { - struct patchInfo { - std::string modNameStr; - std::string offsetStr; - std::string valueStr; - }; +extern uintptr_t g_eboot_address; - extern std::vector pending_patches; +struct patchInfo { + std::string modNameStr; + std::string offsetStr; + std::string valueStr; +}; - void AddPatchToQueue(patchInfo patchToAdd); - void ApplyPendingPatches(); +extern std::vector pending_patches; - void PatchMemory(std::string modNameStr, std::string offsetStr, std::string valueStr); +void AddPatchToQueue(patchInfo patchToAdd); +void ApplyPendingPatches(); +void PatchMemory(std::string modNameStr, std::string offsetStr, std::string valueStr); -} \ No newline at end of file +} // namespace MemoryPatcher \ No newline at end of file diff --git a/src/core/module.cpp b/src/core/module.cpp index 338025475..2f1212448 100644 --- a/src/core/module.cpp +++ b/src/core/module.cpp @@ -5,13 +5,13 @@ #include "common/alignment.h" #include "common/assert.h" #include "common/logging/log.h" +#include "common/memory_patcher.h" #include "common/string_util.h" #include "core/aerolib/aerolib.h" #include "core/cpu_patches.h" #include "core/loader/dwarf.h" #include "core/memory.h" #include "core/module.h" -#include "common/memory_patcher.h" namespace Core { @@ -197,11 +197,9 @@ void Module::LoadModuleToMemory(u32& max_tls_index) { if (MemoryPatcher::g_eboot_address == 0) { if (name == "eboot") { MemoryPatcher::g_eboot_address = base_virtual_addr; - MemoryPatcher::ApplyPendingPatches(); } } - } void Module::LoadDynamicInfo() {