-
-
Notifications
You must be signed in to change notification settings - Fork 23.5k
Android: Fix loading sparse .pck from assets://
#112507
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?
Android: Fix loading sparse .pck from assets://
#112507
Conversation
.pck from assets://
|
When PCK is loaded using this code? Usually it is loaded as |
|
Yeah, I'm honestly not too sure how often people typically try load As to why I ran into this myself. I was setting up native Android debugging for GodotJS. I'm using |
|
I think it'd be good to have a bug report to discuss the specific conditions and use case where this would happen |
|
The change looks good. Probably was not noticed since keystore is always read/written in one chunk. It's not really related to PCK, since anything using But I'm not sure what was the purpose of adding |
The |
Quite surprised this one managed to go unnoticed for quite some time. The implementation of
AssetData'sseekwas simply performingskip(position), however that's relative to the stream's current position. So it is only accurate if you seek immediately upon opening a file, and you can never seek backwards.This manifests in some pretty nasty bugs. I ran into this when attempting to load a sparse .pck (the default) from
assets://. The C++ implementation naturally needs to seek toward the end of the file to obtain the directory mapping. However, this fails and we overshoot the intended location and the file count read is then incorrect, as is everything else that follows.