diff --git a/scripts/extract_ktsl2stbin.py b/scripts/extract_ktsl2stbin.py new file mode 100755 index 0000000..26a8b1f --- /dev/null +++ b/scripts/extract_ktsl2stbin.py @@ -0,0 +1,30 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i python3 -p python3 +import struct +import sys +import pathlib + +# i don't care about efficiency +data = open(sys.argv[1], "rb").read() +outdir = pathlib.Path(sys.argv[2]) + +if data[:4] != b"KTSR": + raise Exception("what are you doing") + +# there's some more stuff but i don't care, go straight to the entry +off = 0x40 +idx = 0 +while off < len(data): + + if data[off + 0x40 : off + 0x44] != b"KTSS": + raise Exception("oh no offset broken") + + (entry_size,) = struct.unpack("