Skip to content

Commit

Permalink
Support PKG mode for SR
Browse files Browse the repository at this point in the history
  • Loading branch information
ThanatosGit committed May 21, 2024
1 parent 60ca7a3 commit d66fedd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/mercury_engine_data_structures/file_tree_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,11 @@ def save_modifications(self, output_path: Path, output_format: OutputFormat, *,
if output_format == OutputFormat.ROMFS:
# Clear modified_pkgs, so we don't read/write any new pkg
# We keep system.pkg because .bmmaps don't read properly with exlaunch and it's only 4MB
modified_pkgs = list(filter(lambda pkg: pkg == "packs/system/system.pkg", modified_pkgs))
# We keep MSR's "_discardables.pkg" as the files are not read from RomFS without the pkg
modified_pkgs = list(

Check warning on line 330 in src/mercury_engine_data_structures/file_tree_editor.py

View check run for this annotation

Codecov / codecov/patch

src/mercury_engine_data_structures/file_tree_editor.py#L330

Added line #L330 was not covered by tests
filter(lambda pkg: pkg == "packs/system/system.pkg" or pkg.endswith("discardables.pkg"),
modified_pkgs)
)

# Ensure all pkgs we'll modify is in memory already.
# We'll need to read these files anyway to modify, so do it early to speedup
Expand Down Expand Up @@ -355,8 +359,6 @@ def save_modifications(self, output_path: Path, output_format: OutputFormat, *,
_write_to_path(output_path.joinpath(path), data)
if self._files_for_asset_id[asset_id] - {None}:
replacements.append(path)
if output_format == OutputFormat.ROMFS and asset_id in asset_ids_to_copy:
del asset_ids_to_copy[asset_id]
else:
self._toc.remove_file(asset_id)

Expand Down

0 comments on commit d66fedd

Please sign in to comment.