diff options
| author | Sepalani <sepalani@hotmail.fr> | 2019-09-28 17:38:43 +0400 |
|---|---|---|
| committer | Sepalani <sepalani@hotmail.fr> | 2019-09-28 17:38:43 +0400 |
| commit | d8a3218726bd447dfeb407c5212f9f07d4e9574c (patch) | |
| tree | 9a93b35da9a78d017b03a2d7a9cccc54ee75c3ba /Source/Core | |
| parent | 82fd7f576e1dff6b616ff088955c18aa76ed45d5 (diff) | |
HLE: Fix patching functions with the same name
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/HLE/HLE.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Source/Core/Core/HLE/HLE.cpp b/Source/Core/Core/HLE/HLE.cpp index e9fc504528..3ade0d1096 100644 --- a/Source/Core/Core/HLE/HLE.cpp +++ b/Source/Core/Core/HLE/HLE.cpp @@ -192,11 +192,13 @@ u32 GetFunctionIndex(u32 address) u32 GetFirstFunctionIndex(u32 address) { - u32 index = GetFunctionIndex(address); - auto first = std::find_if( - s_original_instructions.begin(), s_original_instructions.end(), - [=](const auto& entry) { return entry.second == index && entry.first < address; }); - return first == std::end(s_original_instructions) ? index : 0; + const u32 index = GetFunctionIndex(address); + // Fixed hooks use a fixed address and don't patch the whole function + if (index == 0 || OSPatches[index].flags == HookFlag::Fixed) + return index; + + const auto symbol = g_symbolDB.GetSymbolFromAddr(address); + return (symbol && symbol->address == address) ? index : 0; } HookType GetFunctionTypeByIndex(u32 index) |
