diff --git a/bsp_tool/archives/alcohol.py b/bsp_tool/archives/alcohol.py index 931f5291..abbedaec 100644 --- a/bsp_tool/archives/alcohol.py +++ b/bsp_tool/archives/alcohol.py @@ -5,7 +5,7 @@ import io from typing import List -from ..branches.base import Struct +# from ..branches.base import Struct # CIRCULAR IMPORT from . import base @@ -17,26 +17,26 @@ class MediaType(enum.Enum): DVD_R = 18 -class MdsHeader(Struct): - __slots__ = [ - "magic", "version", "media_type", "num_sessions", - "unknown_1", "bca_length", "unknown_2", "bca_offset", - "unknown_3", "disc_struct_offset", "unknown_4", - "sessions_offset", "dpm_offset"] - _format = "16s2B2HIH15I" # 88 bytes - _arrays = { - "version": ["major", "minor"], - "unknown_2": 2, "unknown_3": 6, "unknown_4": 3} - _classes = { - "media_type": MediaType} +# class MdsHeader(Struct): +# __slots__ = [ +# "magic", "version", "media_type", "num_sessions", +# "unknown_1", "bca_length", "unknown_2", "bca_offset", +# "unknown_3", "disc_struct_offset", "unknown_4", +# "sessions_offset", "dpm_offset"] +# _format = "16s2B2HIH15I" # 88 bytes +# _arrays = { +# "version": ["major", "minor"], +# "unknown_2": 2, "unknown_3": 6, "unknown_4": 3} +# _classes = { +# "media_type": MediaType} -class MdsSessionHeader(Struct): - __slots__ = [ - "first_sector", "last_sector", "num_sessions", "num_tracks", - "num_tracks_2", "first_track", "last_track", "unknown", - "tracks_offset"] - _format = "2IH2B2H2I" +# class MdsSessionHeader(Struct): +# __slots__ = [ +# "first_sector", "last_sector", "num_sessions", "num_tracks", +# "num_tracks_2", "first_track", "last_track", "unknown", +# "tracks_offset"] +# _format = "2IH2B2H2I" class TrackMode(enum.Enum): @@ -50,27 +50,27 @@ class TrackMode(enum.Enum): MODE2_SUB = 0xEC # Mode2 w/ subchannels -class MdsTrack(Struct): - index: int # track_number - __slots__ = [ - "mode", "num_subchannels", "adr", "index", "point_number", - "minutes", "seconds", "frames", "zero", "pmin", "psec", "pframe", - "index_block_offset", "sector_size", "unknown_1", "first_sector", - "sector_offset", "num_filenames", "filenames_offset", "unknown_2"] - _format = "12BI10HIQ2I6I" - _arrays = { - "unknown_1": 9, "unknown_2": 6} - _classes = { - "mode": TrackMode} +# class MdsTrack(Struct): +# index: int # track_number +# __slots__ = [ +# "mode", "num_subchannels", "adr", "index", "point_number", +# "minutes", "seconds", "frames", "zero", "pmin", "psec", "pframe", +# "index_block_offset", "sector_size", "unknown_1", "first_sector", +# "sector_offset", "num_filenames", "filenames_offset", "unknown_2"] +# _format = "12BI10HIQ2I6I" +# _arrays = { +# "unknown_1": 9, "unknown_2": 6} +# _classes = { +# "mode": TrackMode} class Mds(base.Archive): """Media Descriptor Sidecar""" # NOTE: needs linked .mdf (Media Descriptor File) data files _file: io.BytesIO # DEBUG - header: MdsHeader - session_header: MdsSessionHeader # 1x, not per-session? - tracks: List[MdsTrack] + # header: MdsHeader + # session_header: MdsSessionHeader # 1x, not per-session? + # tracks: List[MdsTrack] filenames: List[str] def __init__(self): @@ -79,18 +79,19 @@ def __init__(self): @classmethod def from_stream(cls, stream: io.BytesIO) -> Mds: + raise NotImplementedError() out = cls() - out.header = MdsHeader.from_stream(stream) - assert out.header.magic == b"MEDIA DESCRIPTOR" - assert out.header.version.major == 1 - assert out.header.version.minor == 3 - # sessions - stream.seek(out.header.sessions_offset, 1) - out.session_header = MdsSessionHeader.from_stream(stream) # incorrect? - # stream.seek(out.session_header.tracks_offset, 1) - # out.tracks = [ - # MdsTrack.from_stream(stream) - # for i in range(out.session_header.num_tracks)] - # TODO: filenames + # out.header = MdsHeader.from_stream(stream) + # assert out.header.magic == b"MEDIA DESCRIPTOR" + # assert out.header.version.major == 1 + # assert out.header.version.minor == 3 + # # sessions + # stream.seek(out.header.sessions_offset, 1) + # out.session_header = MdsSessionHeader.from_stream(stream) # incorrect? + # # stream.seek(out.session_header.tracks_offset, 1) + # # out.tracks = [ + # # MdsTrack.from_stream(stream) + # # for i in range(out.session_header.num_tracks)] + # # TODO: filenames out._file = stream # DEBUG return out