Remove overwrite()

This commit is contained in:
TheBrokenRail 2024-06-21 01:22:33 -04:00
parent 5e229fb6a8
commit 6a2ecb23ed
3 changed files with 1 additions and 25 deletions

View File

@ -58,23 +58,6 @@ void _overwrite_calls_within(const char *file, int line, void *from, void *to, s
// Get Target Address From BL Instruction // Get Target Address From BL Instruction
void *extract_from_bl_instruction(unsigned char *from); 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 <typename start_t>
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 // Patch Instruction
void _patch(const char *file, int line, void *start, unsigned char patch[4]); void _patch(const char *file, int line, void *start, unsigned char patch[4]);
#define patch(...) \ #define patch(...) \

View File

@ -112,13 +112,6 @@ void _overwrite_calls_within_manual(const char *file, int line, void *from /* in
increment_code_block(); 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 // 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]); #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]);

View File

@ -961,7 +961,7 @@ void init_misc() {
// Replace 2011 std::sort With Optimized(TM) Code // Replace 2011 std::sort With Optimized(TM) Code
if (feature_has("Optimized Chunk Sorting", server_enabled)) { 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 // Display Date In Select World Screen