Skip to content

Commit

Permalink
Apply alignment after header in pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
ThanatosGit committed Sep 19, 2023
1 parent 48a7447 commit f86bb25
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/mercury_engine_data_structures/formats/pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from mercury_engine_data_structures import dread_data, samus_returns_data
from mercury_engine_data_structures.construct_extensions.alignment import AlignTo
from mercury_engine_data_structures.formats.base_resource import AssetId, BaseResource, NameOrAssetId, resolve_asset_id
from mercury_engine_data_structures.game_check import Game, get_current_game
from mercury_engine_data_structures.game_check import Game


def _file_entry(target_game: Game):
Expand Down Expand Up @@ -73,9 +73,8 @@ def _parse(self, stream, context, path) -> construct.Container:
# Get the file headers
file_headers = self.file_headers_type._parsereport(stream, context, path)

if get_current_game(context) == Game.DREAD:
# Align to 128 bytes
AlignTo(128)._parsereport(stream, context, path)
# Align to 128 bytes
AlignTo(128)._parsereport(stream, context, path)

files = construct.ListContainer()
for i, header in enumerate(file_headers):
Expand All @@ -99,9 +98,8 @@ def _build(self, obj: construct.Container, stream, context, path):
# Skip over file headers
construct.stream_seek(stream, len(obj.files) * file_entry_size, 1, path)

if get_current_game(context) == Game.DREAD:
# Align to 128 bytes
AlignTo(128)._build(None, stream, context, path)
# Align to 128 bytes
AlignTo(128)._build(None, stream, context, path)

header_end = construct.stream_tell(stream, path)

Expand Down

0 comments on commit f86bb25

Please sign in to comment.