Match remaining IDO files for iQue (#2394)

This commit is contained in:
cadmic
2025-01-05 22:45:12 -08:00
committed by GitHub
parent bd606ba038
commit 3aafbf3971
5 changed files with 63 additions and 9 deletions
+1 -1
View File
@@ -134,7 +134,7 @@ A7A0,8000ABF0,src/boot/boot_main
B190,8000B5E0,src/boot/idle
BD90,8000C1E0,src/boot/z_std_dma
C500,8000C950,src/boot/zlib
FBB0,80010000,src/boot/driverominit
10310,80010760,src/boot/driverominit
10390,800107E0,src/libultra/io/vimgr
115B0,80011A00,src/libultra/io/pimgr
12940,80012D90,data/boot_common_80012D90
1 offset vram .text
134 FBB0 10310 80010000 80010760 src/boot/driverominit
135 10390 800107E0 src/libultra/io/vimgr
136 115B0 80011A00 src/libultra/io/pimgr
137 12940 80012D90 data/boot_common_80012D90
138 12BF0 80013040 .end
139
140
+34
View 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