-
Notifications
You must be signed in to change notification settings - Fork 25
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
ADT does not handle offsets correctly #14
Comments
This library is pretty much on ice at the moment; I don't have time to actively maintain and develop it. It needs a lot of updates and modernization, and I'm afraid I won't be able to take care of this issue any time soon :( |
To comment on this, ADT Offsets are relative to their reading location in MHDR, which in case map chunk offsets in each ADT File is 0x14. Easy way to fix this would be to just get the current position in the reader and add the offset to it, thereby fixing this problem. I mean, most people of us are probably gonna use this to edit ADT and WDT files rather than the rest, so if someone could throw in a Push-Request, that would fix it.(I can't do it since I can't compile the library without some modifications(Disabling FxCopAnalyzer, idk what is happening there)) |
I already have it fixed on my side, + 8 offset is required for current chunk offset. |
@wachag +8 can't be the offset. It was +20 for most ADT files I tested. Might be different across several versions in which case, you'd have to use my approach by reading the start of the MHDR section(After the signature and size parameter, but before the Flags since thats data) and saving that location. |
It is: '''
''' |
Of course, I am relative to the MHDR, +8 is because how the chunk reading is organized in the lib |
For similar reasons, from MCNK offsets we need to subtract 8. |
In MapChunkHeader.cs these are incorrectly read (stream position will be wrong after these): |
When an ADT file is parsed, this call throws an invalid chunk exception, failing to load ADT
libwarcraft/libwarcraft/ADT/TerrainTile.cs
Line 124 in 355fb29
The text was updated successfully, but these errors were encountered: