Skip to content

Commit

Permalink
Add new asset types for Ariel.
Browse files Browse the repository at this point in the history
  • Loading branch information
npjg committed Jun 3, 2024
1 parent cc2a111 commit f383b40
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
24 changes: 22 additions & 2 deletions src/MediaStation/Assets/Asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ class AssetType(IntEnum):
FONT = 0x001b # FON
CAMERA = 0x001c # CAM
CANVAS = 0x001e # CVS
# TODO: Discover how the XSND differs from regular sounds.
# Only appears in Ariel.
XSND = 0x001f
XSND_MIDI = 0x0020
# TODO: Figure out what this is. Only appears in Ariel.
RECORDER = 0x0021
FUNCTION = 0x0069 # FUN

class SectionType(IntEnum):
Expand All @@ -72,7 +78,7 @@ def export(self, directory_path, command_line_arguments):
if (Asset.AssetType.IMAGE == self.type):
self.image.name = self.name
self.image.export(directory_path, command_line_arguments)
elif (Asset.AssetType.SOUND == self.type):
elif (Asset.AssetType.SOUND == self.type) or (Asset.AssetType.XSND == self.type):
self.sound.name = self.name
self.sound.export(directory_path, command_line_arguments)
elif (Asset.AssetType.SPRITE == self.type):
Expand Down Expand Up @@ -148,7 +154,7 @@ def __init__(self, chunk):
self.image_set = BitmapSet(self)
elif (Asset.AssetType.CAMERA == self.type):
self.camera = None
elif (Asset.AssetType.SOUND == self.type):
elif (Asset.AssetType.SOUND == self.type) or (Asset.AssetType.XSND == self.type):
self.sound = Sound(self.audio_encoding)
elif (Asset.AssetType.SPRITE == self.type):
self.sprite = Sprite(self)
Expand Down Expand Up @@ -393,6 +399,9 @@ def _read_section(self, section_type, chunk):
elif section_type == 0x0770: # CAM
self.unks.append({hex(section_type): Datum(chunk).d})

elif section_type == 0x0771: # STG
self.unks.append({hex(section_type): Datum(chunk).d})

elif section_type == 0x0772: # STG
self.unks.append({hex(section_type): Datum(chunk).d})

Expand Down Expand Up @@ -420,6 +429,17 @@ def _read_section(self, section_type, chunk):
elif section_type >= 0x0773 and section_type <= 0x0780:
self.unks.append({hex(section_type): Datum(chunk).d})

elif section_type == 0x7d2: # XSND_MIDI (Ariel)
self.midi_filename = Datum(chunk).d

elif section_type == 0x7d3:
probably_asset_id = Datum(chunk).d
if probably_asset_id != self.id:
print(f'WARNING: In XSND_MIDI asset, probable asset ID field "{probably_asset_id}" does not match actual asset ID "{self.id}"')

elif section_type >= 0x07d4 and section_type <= 0x07df: # Ariel
self.unks.append({hex(section_type): Datum(chunk).d})

elif section_type >= 0x2734 and section_type <= 0x2800:
self.unks.append({hex(section_type): Datum(chunk).d})

Expand Down
2 changes: 1 addition & 1 deletion src/MediaStation/Context.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def read_asset_in_first_subfile(self, chunk):
elif (header.type == Asset.AssetType.IMAGE_SET):
header.image_set.read_chunk(chunk)

elif (header.type == Asset.AssetType.SOUND):
elif (header.type == Asset.AssetType.SOUND) or (header.type == Asset.AssetType.XSND):
header.sound.read_chunk(chunk)

elif (header.type == Asset.AssetType.SPRITE):
Expand Down

0 comments on commit f383b40

Please sign in to comment.