mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-17 13:24:45 +00:00
Match remaining IDO files for iQue (#2394)
This commit is contained in:
parent
bd606ba038
commit
3aafbf3971
5 changed files with 63 additions and 9 deletions
34
tools/patch_ique_driverominit.py
Executable file
34
tools/patch_ique_driverominit.py
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env python3
|
||||
import struct, sys, argparse
|
||||
|
||||
import elftools.elf.elffile
|
||||
|
||||
# Patches driverominit.o to change bnez t6,3c to nop at offset 0x20 in the .text section
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
parser.add_argument("file", help="input file")
|
||||
args = parser.parse_args()
|
||||
|
||||
with open(args.file, "r+b") as f:
|
||||
elf = elftools.elf.elffile.ELFFile(f)
|
||||
|
||||
text_offset = 0
|
||||
for section in elf.iter_sections():
|
||||
if section.name == ".text":
|
||||
text_offset = section["sh_offset"]
|
||||
break
|
||||
|
||||
if text_offset == 0:
|
||||
print("Error: .text section not found")
|
||||
sys.exit(1)
|
||||
|
||||
f.seek(text_offset + 0x20)
|
||||
instruction = struct.unpack(">I", f.read(4))[0]
|
||||
if instruction != 0x15C00006: # bnez t6,3c
|
||||
print("Error: expected instruction not found, found 0x%08X" % instruction)
|
||||
sys.exit(1)
|
||||
|
||||
f.seek(text_offset + 0x20)
|
||||
f.write(struct.pack(">I", 0x00000000)) # nop
|
Loading…
Add table
Add a link
Reference in a new issue