mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-11-23 13:09:44 +00:00
8abb09e3ff
Still work in progress. I removed splat as a submodule and started using it as a pip package instead. Everything is matching but the memory card icons part in both DRA and SEL. I still have no idea what the issue is. Once this PR is good to be merged, we can get rid of the splat fork too.
25 lines
863 B
Python
25 lines
863 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 PSXSegRaw(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}.bin"
|
|
|
|
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])
|