-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Improve texture replacement cache and allow read from zip #16304
Conversation
Will work on all platforms, but intended for situations like Android where random access to files on storage is horribly slow.
c31e1c4
to
a1a4841
Compare
Iterators in unordered_map get invalidated when the map rehashes, which it can do when it grows. See https://stackoverflow.com/questions/16781886/can-we-store-unordered-maptiterator for example. Will actually look at the code now - or actually later. |
I think references are fine, though: https://stackoverflow.com/questions/39868640/stdunordered-map-pointers-reference-invalidation / https://news.ycombinator.com/item?id=27597471. I'm mostly unsure because I honestly have no idea what the node type stuff is, i.e. this question: https://stackoverflow.com/questions/72255609/stdunordered-map-insert-invalidates-only-iterators-but-not-references-and-poin. -[Unknown] |
Yeah you're right, those should be fine, unlike iterators - if it was allowed to move the nodes in memory, a lot of stuff would break. |
Thank you so much for this act. Which is a hugh upgrade for reading texture pack via zip packing method. |
This makes a few changes:
Note: I'm pretty sure that pointers to values in std::unordered_map are permanent until erased, but correct me if I'm mistaken.
To use textures.zip:
Currently there's no way to directly install a textures.zip file, and as noted it's a bit more restrictive than the installer allows (i.e. with textures.ini required at the root.) That said, the installer could be changed to just copy the zip into place.
Fixes #16135.
-[Unknown]