diff options
| author | JMC47 <JMC4789@gmail.com> | 2019-10-06 05:07:54 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-06 05:07:54 -0400 |
| commit | b6545ea285b25765bbf464774f9a8e7649f6bc15 (patch) | |
| tree | c908c580c647e6aa9b79600c7019c37c8aa44911 /Source | |
| parent | 9a68eaaa24c05de7426a46294e24e629f289403f (diff) | |
| parent | d8a3218726bd447dfeb407c5212f9f07d4e9574c (diff) | |
Merge pull request #8370 from sepalani/fix-hle-patch
HLE: Fix patching functions with the same name
Diffstat (limited to 'Source')
| -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) |
