mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-11-23 13:09:44 +00:00
3649d507c1
Instead of outputting a `D_80123456.dec` from an extracted compressed asset, now a PNG is written from the decompressed data from the specified YAML entry. The asset tool will synchronize with splat to retrieve the symbol names for graphics and palettes. The new splat extension `cmpgfx` will also be able to detect unused graphics by failing with a hint on how to tweak the YAML. That way I found some unused placeholders under the name `stage_placeholder` and some kind of beta graphics from the prologue stage.
24 lines
865 B
Python
24 lines
865 B
Python
from splat.util import options, log
|
|
from splat.segtypes.n64.i4 import N64SegI4
|
|
from splat.segtypes.n64.rgba16 import N64SegRgba16
|
|
from splat.segtypes.n64.segment import N64Segment
|
|
from typing import Optional
|
|
from pathlib import Path
|
|
|
|
|
|
class PSXSegPal(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, yaml),
|
|
|
|
def out_path(self) -> Optional[Path]:
|
|
return options.opts.asset_path / self.dir / self.name
|
|
|
|
def src_path(self) -> Optional[Path]:
|
|
return options.opts.asset_path / self.dir / f"{self.name}.palbin"
|
|
|
|
def split(self, rom_bytes):
|
|
path = self.src_path()
|
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
with open(path, "wb") as f:
|
|
f.write(rom_bytes[self.rom_start : self.rom_end])
|