-
Notifications
You must be signed in to change notification settings - Fork 37
Support 14.3/14.4 export path changes properly #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Support 14.3/14.4 export path changes properly #112
Conversation
benoitryder
left a comment
There was a problem hiding this 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} |
There was a problem hiding this comment.
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]There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
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.