From f3482fbf08e682ea305a5780b5d88d0da3264298 Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Thu, 4 Apr 2024 04:01:04 +0000 Subject: [PATCH] oh no i wanted music --- scripts/extract_ktsl2stbin.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 scripts/extract_ktsl2stbin.py 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("