mirror of https://github.com/zeldaret/botw.git
Add more AI matches
This commit is contained in:
parent
028ad38b41
commit
3dd4331fc9
File diff suppressed because it is too large
Load Diff
|
@ -65,9 +65,16 @@ def main() -> None:
|
||||||
if functions_by_addr[vtable1[0]].status == utils.FunctionStatus.Matching:
|
if functions_by_addr[vtable1[0]].status == utils.FunctionStatus.Matching:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
name = decomp_addr_to_symbol[vtable2[0]]
|
decomp_derive_fn_addr = vtable2[0]
|
||||||
|
if decomp_derive_fn_addr == 0:
|
||||||
|
decomp_derive_fn_addr = decomp_glob_data_table.get(ptr2 + 0x10, 0)
|
||||||
|
if decomp_derive_fn_addr == 0:
|
||||||
|
raise RuntimeError(f"Derive virtual function pointer is null "
|
||||||
|
f"(fn: {fn.decomp_name}, decomp vtable at {ptr2:#x})")
|
||||||
|
|
||||||
|
name = decomp_addr_to_symbol[decomp_derive_fn_addr]
|
||||||
new_matches[vtable1[0]] = name
|
new_matches[vtable1[0]] = name
|
||||||
utils.print_note(f"new match: {Fore.BLUE}{cxxfilt.demangle(name)}{Fore.RESET}")
|
utils.print_note(f"new match: {Fore.BLUE}{cxxfilt.demangle(name)}{Fore.RESET} (from {fn.decomp_name})")
|
||||||
|
|
||||||
# overwrite the original names because they are likely to be incorrect
|
# overwrite the original names because they are likely to be incorrect
|
||||||
utils.add_decompiled_functions(new_matches, new_orig_names=new_matches)
|
utils.add_decompiled_functions(new_matches, new_orig_names=new_matches)
|
||||||
|
|
|
@ -128,6 +128,7 @@ def get_fn_from_my_elf(name: str) -> Function:
|
||||||
|
|
||||||
|
|
||||||
R_AARCH64_GLOB_DAT = 1025
|
R_AARCH64_GLOB_DAT = 1025
|
||||||
|
R_AARCH64_RELATIVE = 1027
|
||||||
|
|
||||||
|
|
||||||
def build_glob_data_table(elf: ELFFile) -> Dict[int, int]:
|
def build_glob_data_table(elf: ELFFile) -> Dict[int, int]:
|
||||||
|
@ -142,7 +143,11 @@ def build_glob_data_table(elf: ELFFile) -> Dict[int, int]:
|
||||||
for reloc in section.iter_relocations():
|
for reloc in section.iter_relocations():
|
||||||
symtab.stream.seek(offset + reloc["r_info_sym"] * entsize)
|
symtab.stream.seek(offset + reloc["r_info_sym"] * entsize)
|
||||||
sym_value = _ElfSym.parse(symtab.stream.read(_ElfSymFormat.size)).st_value
|
sym_value = _ElfSym.parse(symtab.stream.read(_ElfSymFormat.size)).st_value
|
||||||
if reloc["r_info_type"] == R_AARCH64_GLOB_DAT:
|
info_type = reloc["r_info_type"]
|
||||||
|
if info_type == R_AARCH64_GLOB_DAT:
|
||||||
|
table[reloc["r_offset"]] = sym_value + reloc["r_addend"]
|
||||||
|
elif info_type == R_AARCH64_RELATIVE:
|
||||||
|
# FIXME: this should be Delta(S) + A
|
||||||
table[reloc["r_offset"]] = sym_value + reloc["r_addend"]
|
table[reloc["r_offset"]] = sym_value + reloc["r_addend"]
|
||||||
|
|
||||||
return table
|
return table
|
||||||
|
|
Loading…
Reference in New Issue