Also Scan .data.rel.ro
CI / Build (AMD64, Server) (push) Successful in 12m2s Details
CI / Build (AMD64, Client) (push) Successful in 12m22s Details
CI / Build (ARM64, Server) (push) Successful in 13m4s Details
CI / Build (ARM64, Client) (push) Successful in 13m36s Details
CI / Build (ARMHF, Server) (push) Successful in 8m37s Details
CI / Build (ARMHF, Client) (push) Successful in 11m27s Details
CI / Test (Server) (push) Successful in 12m26s Details
CI / Test (Client) (push) Successful in 15m7s Details
CI / Release (push) Has been skipped Details
CI / Build Example Mods (push) Successful in 7m22s Details

This commit is contained in:
TheBrokenRail 2024-02-12 00:55:50 -05:00
parent a2b3bb128b
commit b033912633
1 changed files with 15 additions and 8 deletions

View File

@ -29,19 +29,26 @@ void _overwrite_call(const char *file, int line, void *start, void *target) {
// .rodata Information
#define RODATA_START 0x1020c8
#define RODATA_END 0x11665c
// .data.rel.ro Information
#define DATA_REL_RO_START 0x1352b8
#define DATA_REL_RO_END 0x135638
// Search And Patch VTables Containing Function
#define scan_vtables(section) \
for (uintptr_t i = section##_START; i < section##_END; i = i + 4) { \
uint32_t *addr = (uint32_t *) i; \
if (*addr == (uintptr_t) target) { \
/* Found VTable Entry */ \
_patch_address(file, line, addr, replacement); \
found++; \
} \
}
static int _patch_vtables(const char *file, int line, void *target, void *replacement) {
int found = 0;
for (uintptr_t i = RODATA_START; i < RODATA_END; i = i + 4) {
uint32_t *addr = (uint32_t *) i;
if (*addr == (uintptr_t) target) {
// Found VTable Entry
_patch_address(file, line, addr, replacement);
found++;
}
}
scan_vtables(RODATA);
scan_vtables(DATA_REL_RO);
return found;
}
#undef scan_vtables
// Patch Calls Within Range
static int _overwrite_calls_within_internal(const char *file, int line, void *from, void *to, void *target, void *replacement) {