diff --git a/g35pe2_ml_patch.py b/g35pe2_ml_patch.py index 2dbe341..2b7bdc1 100755 --- a/g35pe2_ml_patch.py +++ b/g35pe2_ml_patch.py @@ -223,18 +223,22 @@ def main(g1a_input, g1a_output): t6k11_addr2 = make_pattern("b4010000") refs2 = search_pattern(t6k11_addr2, data, 0, len(data), alignment=4) + fun_occ = [] + if len(refs1) == 0: print(f"no reference to T6K11 address {t6k11_addr1} found") return 1 for offset, _ in refs1: print(f"T6K11 reference address {t6k11_addr1} found at 0x{offset:08x}") - fun_occ = pcrel_find(offset, data, 0, len(data)) + local_fun_occ = pcrel_find(offset, data, 0, len(data)) - if len(fun_occ) == 0: + if len(local_fun_occ) == 0: print(" Never loaded") - for (pc, n) in fun_occ: + for (pc, n) in local_fun_occ: print(f" 0x{pc:08x}: Load into r{n}") + + fun_occ += local_fun_occ print() # Find function boundaries around, assuming rts marks the end of a function