diff options
Diffstat (limited to 'tools/splat_ext/af_ia8.py')
| -rw-r--r-- | tools/splat_ext/af_ia8.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/splat_ext/af_ia8.py b/tools/splat_ext/af_ia8.py new file mode 100644 index 0000000..ce5ffe5 --- /dev/null +++ b/tools/splat_ext/af_ia8.py @@ -0,0 +1,22 @@ +from n64img.image import Image, IA8 +from splat.util import log, options +from splat.segtypes.n64.segment import N64Segment + +class N64SegAf_ia8(N64Segment): + def __init__(self, rom_start, rom_end, type, name, vram_start, args, yaml): + super().__init__(rom_start, rom_end, type, name, vram_start, args=args, yaml=yaml), + + self.width = args[0] + self.height = args[1] + + def scan(self, rom_bytes: bytes): + self.n64img: Image = IA8(b"", 0, 0) + self.n64img.width = self.width + self.n64img.height = self.height + self.n64img.data = rom_bytes[self.rom_start : self.rom_end] + + def split(self, rom_bytes: bytes): + path = options.opts.asset_path / self.dir / f"{self.name}.ia8.png" + path.parent.mkdir(parents=True, exist_ok=True) + + self.n64img.write(path) |
