Skip to content

Conversation

@Morilli
Copy link
Contributor

@Morilli Morilli commented May 31, 2025

Had this diff applied for the longest time and I think it should be in main considering it's required to export 14.3 and 14.4 properly.

Basically, in 14.3/14.4 the output paths of localized files changed because the same file path had differing contents in all localized wads. This requires re-exporting the files because the code assumes that unchanged (same sha256) files can be symlinked to the previous patch, which fails when the export path of the previous patch is different.

Additionally, in 14.3 only the localized UI wad contains a common path and the other files don't. So for 14.3 specifically, we need to export the localized UI wad into language-specific subdirectories and for 14.4+ we can export all localized wads into those directories.

Copy link
Member

@benoitryder benoitryder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch for the sha256 change. I just have minor suggestions.

# don't resolve hashes: we just need the sha256
logger.debug(f"filter modified WAD file: {path}")
other_sha256 = {wf.path_hash: wf.sha256 for wf in other_wad.files}
other_wad = {wf.path_hash: wf for wf in other_wad.files}
Copy link
Member

@benoitryder benoitryder Jun 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A simpler approach: compare both sha and path (through the hash, no need to resolve). If I understand your changes correctly, it should work.

# Compare the sha256 and path to find the common files.
logger.debug(f"filter modified WAD file: {path}")
# Checking the path is required for unmodified files (same sha) that are moved
# They will be exported to a different path and cannot be symlinked
other_wads = {(wf.path_hash, wf.sha256) for wf in other_wad.files}
# Change the files from the wad so it only extract these
self_wad.files = [wf for wf in self_wad.files if (wf.path_hash, wf.sha256) in other_wads]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the first comment is misleading; the point of this function is to find changed/new files and only export those. So we're looking for all files that either don't exist in other_wad or have changed.

But we do need to check the actual export path to make sure that patch-specific exporter changes are respected. In this case when self is the exporter for 14.3 and other is the exporter for 14.2, the path assets/ux/endofgame/en_us/defeat.dds from UI.en_US.wad.client has the same hash and sha for both, but the export path for other is assets/ux/endofgame/en_us/defeat.png and the one for self is en_us/assets/ux/endofgame/en_us/defeat.png. If only hash and sha are checked the file will not be kept and instead symlinked, which will result in an invalid symlink.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code assumed that the same file with the same path would be exported the same.
Exporting differently depending on the patch version is definitely clunky. :(

I'm not a fan of having to regenerate export paths at this place. But right now I don't have a good solution.

Co-authored-by: Benoît Ryder <benoit@ryder.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants