Android: Fix loading sparse .pck from assets://#112507
Android: Fix loading sparse .pck from assets://#112507Repiteo merged 1 commit intogodotengine:masterfrom
.pck from assets://#112507Conversation
.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 |
|
Thanks! |
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.