Skip to content

Commit

Permalink
Ensure the directory exists when extracting a palette segment (ethtec…
Browse files Browse the repository at this point in the history
  • Loading branch information
Xeeynamo committed Dec 12, 2023
1 parent 63d16cf commit f978fe0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion segtypes/n64/palette.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,17 @@ def __init__(self, *args, **kwargs):
)

def split(self, rom_bytes):
path = self.out_path()
path.parent.mkdir(parents=True, exist_ok=True)

if self.raster is None:
# TODO: output with no raster
log.error(f"orphaned palette segment: {self.name} lacks ci4/ci8 sibling")

assert self.raster is not None
self.raster.n64img.palette = self.parse_palette(rom_bytes) # type: ignore

self.raster.n64img.write(self.out_path())
self.raster.n64img.write(path)
self.raster.extract = False

def parse_palette(self, rom_bytes) -> List[Tuple[int, int, int, int]]:
Expand Down

0 comments on commit f978fe0

Please sign in to comment.