libeq_wld: Support new-format (0x1000C800) WLD files - #55
Open
djhenry wants to merge 1 commit into
Open
Conversation
|
I don't think anyone wants to review AI slop. There are way too many unnecessary changes that clutter the purpose of this PR. |
Author
Sorry about that. Let me see if I can clean it up. |
djhenry
force-pushed
the
fix/tolerant-zone-wld-parsing
branch
from
July 27, 2026 22:24
39fb132 to
aaabf45
Compare
djhenry
force-pushed
the
fix/tolerant-zone-wld-parsing
branch
from
July 27, 2026 22:41
aaabf45 to
af1c315
Compare
Zone WLDs from Luclin onward use header version 0x1000C800, which changes the encoding of DmSpriteDef2 texture coordinates from 2x i16 to 2x f32. Reading them as i16 shifted every field after the coordinate block, producing garbage faces and material groups. The format is now read from the file header, using the same check the client makes, and passed through to the fragment parser. Texture coordinates become an enum over the two encodings so that a file can be round-tripped back to its original bytes. Mesh::texture_coordinates converts both to f32 as before, so callers see no difference. Verified by parsing and re-serializing every WLD in a RoF2 install. The 25 new-format zones now parse; output for the 1569 old-format files is byte for byte identical to before.
djhenry
force-pushed
the
fix/tolerant-zone-wld-parsing
branch
from
July 27, 2026 23:02
af1c315 to
86f4461
Compare
Author
|
PR has been de-slopped. Thanks for the feedback! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Zone WLDs from Luclin onward use header version
0x1000C800, which changes the encoding ofDmSpriteDef2texture coordinates from 2x i16 to 2x f32. Reading them as i16 shifted every field after the coordinate block, so faces and material groups came out as garbage.The format is now read from the file header, using the same check the client makes (
version & 0xffff0000 == 0x10000000), and passed through to the fragment parser.DmSpriteDef2::texture_coordinatesbecomes an enum over the two encodings so a file still round-trips back to its original bytes.Mesh::texture_coordinatesconverts both to f32 as before, so callers see no difference.Breaking change:
DmSpriteDef2::texture_coordinatesis nowTextureCoordinates::Old(Vec<(i16, i16)>)orNew(Vec<(f32, f32)>)rather than a plainVec<(i16, i16)>, which also changes its serde representation.Verified by parsing and re-serializing every WLD in a RoF2 install (1594 files across 1079 archives) with this branch and with
main, and comparing the results. The 25 new-format zones now parse; output for the 1569 old-format files is byte for byte identical tomain, including the 27 old-format_objfiles that fail on both.