diff --git a/recompiler/src/recompiler_patch.cpp b/recompiler/src/recompiler_patch.cpp index f6741509..31b15bb9 100644 --- a/recompiler/src/recompiler_patch.cpp +++ b/recompiler/src/recompiler_patch.cpp @@ -23,10 +23,6 @@ uint32_t apply_one_recompiler_patch(const RecompilerPatch& patch, } // namespace -uint32_t recompiler_patch_address_key(uint32_t address) { - return address & 0x1FFFFFFFu; -} - uint32_t apply_recompiler_patch(const std::vector& patches, uint32_t address, uint32_t observed, diff --git a/recompiler/src/recompiler_patch.h b/recompiler/src/recompiler_patch.h index afb29cba..472af983 100644 --- a/recompiler/src/recompiler_patch.h +++ b/recompiler/src/recompiler_patch.h @@ -21,7 +21,9 @@ struct RecompilerPatch { std::string note; }; -uint32_t recompiler_patch_address_key(uint32_t address); +inline uint32_t recompiler_patch_address_key(uint32_t address) { + return address & 0x1FFFFFFFu; +} // Apply the patch targeting address, if any. A main-EXE guard mismatch throws; // an overlay mismatch is an expected different variant and leaves the observed diff --git a/recompiler/tests/recompiler_patch_cxx17_header_test.cpp b/recompiler/tests/recompiler_patch_cxx17_header_test.cpp index 70a1ea85..048bda43 100644 --- a/recompiler/tests/recompiler_patch_cxx17_header_test.cpp +++ b/recompiler/tests/recompiler_patch_cxx17_header_test.cpp @@ -5,5 +5,9 @@ int main() { std::vector patches; patches.push_back({"header-smoke", 0x80010000u, 0u, 0u, {}}); - return patches.front().id == "header-smoke" ? 0 : 1; + return patches.front().id == "header-smoke" && + PSXRecompV4::recompiler_patch_address_key( + patches.front().address) == 0x00010000u + ? 0 + : 1; }