From 6a2ecb23edd8f1f09cee03c439c9a023eb7c3cf9 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Fri, 21 Jun 2024 01:22:33 -0400 Subject: [PATCH] Remove overwrite() --- libreborn/include/libreborn/patch.h | 17 ----------------- libreborn/src/patch/patch.cpp | 7 ------- mods/src/misc/misc.cpp | 2 +- 3 files changed, 1 insertion(+), 25 deletions(-) diff --git a/libreborn/include/libreborn/patch.h b/libreborn/include/libreborn/patch.h index 83f243cefb..2f840700fc 100644 --- a/libreborn/include/libreborn/patch.h +++ b/libreborn/include/libreborn/patch.h @@ -58,23 +58,6 @@ void _overwrite_calls_within(const char *file, int line, void *from, void *to, s // Get Target Address From BL Instruction void *extract_from_bl_instruction(unsigned char *from); -// Replace Method start With target -void _overwrite_manual(const char *file, int line, void *start, void *target); -#define overwrite_manual(...) \ - _overwrite(__FILE__, __LINE__, __VA_ARGS__) -template -void _overwrite(const char *file, int line, start_t start, start_t target) { - _overwrite_manual(file, line, (void *) start, (void *) target); -} -#define overwrite(start, ...) \ - _overwrite< \ - __raw_##start##_t \ - >( \ - __FILE__, __LINE__, \ - start, \ - __VA_ARGS__ \ - ) - // Patch Instruction void _patch(const char *file, int line, void *start, unsigned char patch[4]); #define patch(...) \ diff --git a/libreborn/src/patch/patch.cpp b/libreborn/src/patch/patch.cpp index 8026f8ed4d..fb0cf80f39 100644 --- a/libreborn/src/patch/patch.cpp +++ b/libreborn/src/patch/patch.cpp @@ -112,13 +112,6 @@ void _overwrite_calls_within_manual(const char *file, int line, void *from /* in increment_code_block(); } -// Overwrite Function -void _overwrite_manual(const char *file, int line, void *start, void *target) { - // Replace the function's start with a call - // to the replacement function. - _overwrite_call_internal(file, line, start, target, 1); -} - // Print Patch Debug Data #define PATCH_PRINTF(file, line, start, str) if (file != NULL) DEBUG("(%s:%i): Patching (%p) - " str ": %02x %02x %02x %02x", file, line, start, data[0], data[1], data[2], data[3]); diff --git a/mods/src/misc/misc.cpp b/mods/src/misc/misc.cpp index fc0bcde2dd..b9dfe4c51f 100644 --- a/mods/src/misc/misc.cpp +++ b/mods/src/misc/misc.cpp @@ -961,7 +961,7 @@ void init_misc() { // Replace 2011 std::sort With Optimized(TM) Code if (feature_has("Optimized Chunk Sorting", server_enabled)) { - overwrite_manual((void *) 0x51fac, (void *) sort_chunks); + overwrite_calls_manual((void *) 0x51fac, (void *) sort_chunks); } // Display Date In Select World Screen