mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-20 17:59:08 +02:00
ZipFileReader: Look up the exact name before the case insensitive one
The case insensitive lookup compares against every name in the zip, while an exact one uses libzip's hash table. Texture packs can have tens of thousands of files. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
f74111835f
commit
7b9e1a1c93
1 file changed
+5
-1
@@ -351,7 +351,11 @@ public:
|
||||
|
||||
VFSFileReference *ZipFileReader::GetFile(std::string_view path) {
|
||||
std::string p(path);
|
||||
int zi = zip_name_locate(zip_file_, p.c_str(), ZIP_FL_NOCASE); // this is EXPENSIVE
|
||||
// An exact match uses libzip's hash table, the case insensitive one compares every name in the zip.
|
||||
int zi = zip_name_locate(zip_file_, p.c_str(), 0);
|
||||
if (zi < 0) {
|
||||
zi = zip_name_locate(zip_file_, p.c_str(), ZIP_FL_NOCASE);
|
||||
}
|
||||
if (zi < 0) {
|
||||
// Not found.
|
||||
return nullptr;
|
||||
|
||||
Reference in new issue
Block a user