fix(network): serve raw items.dat from disk to prevent byte offset shifts - #258
Merged
Merged
Conversation
Contributor
Author
|
FUCK ESLINT IT WORKS! |
Member
|
I'll take a note on this, since i currently working on new rewrite GrowServer |
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.
Fixes the annoying "download failed" error and the malformed CDN requests on v5.56 and v5.57.
Basically, RefreshItemData.ts was using the reconstructed in-memory buffer (this.base.items.content) for Windows/Android clients. It looks like our internal parser drops a byte when re-encoding (probably missing a new struct flag in 5.56 and v5.57), which causes a 1-byte offset shift on the client side. This is why the client was trying to request item description strings instead of actual texture paths from the CDN (like GET /growtopia/hip can survive...).
This PR just changes it so we serve the raw items.dat straight from the disk for all platforms, exactly like we were already doing for macOS. Bypassing the in-memory re-encoding completely solves the shift and the download errors.
Code changes:
Changed RefreshItemData.ts to use readFileSync(join(datDir, this.base.cdn.itemsDatName)) for the fallback case instead of this.base.items.content.