Closed clang-clang-clang closed 8 months ago
This is awesome. Earlier versions of Android had issues with mmap. I see that you have it in the wild and it seems to work now?
mmap works like a charm.
Earlier versions of Android had issues with mmap.
Are there specific problem records for early versions? We have covered the API 15, which is the minimum supported by Solar2D. Since the launch of mmap, we have never observed mmap errors in the location of loading resource.car
, but it may not be sufficient to reflect compatibility issues.
This PR removes a main thread IO to avoid ANR; allows Android to use mmap to load Lua code packages; and an additional Rtt_ASSERT correction.
Remove a main thread IO
There is a risk of ANR when
loadExpansionFiles()
in the main UI thread, so the main UI thread reading is changed to the main thread modifying the state, and the GLThread is used to read.Android to use mmap to load Lua code packages
This PR allows Android to load the Lua code package (resource.car) like other platforms, using mmap, to reduce runtime memory by extracting the resource.car at first launch. It doesn't need to be uncompressed every launch, so it also positively affects startup time.
During the public beta phase, it was observed that some models showed the situation where
AssetManager
prematurely returns -1 when decompressing resources (approximately 0.3%). This issue was resolved by improving the accuracy, reliability, and usability of theextractAssetFile()
method (at least this exception is no longer observed online). The worstcase scenario here is the same as before, when thegetBytesFromFile()
method failed to load the code package into memory all at once, resulting in a black screen after startup, but usually, it will not happen again when restarting the App.Rtt_ASSERT correction
Additionally, while debugging other issues, I found an
Rtt_ASSERT
that could not be false. After correcting it to match the context, I guess it's not allowed to moveDisplayObject
from theOrphanage()
group to theOrphanage()
group again, that is, toremoveSelf
repeatedly.Any suggestions are welcome. Thank you.