From 7b9e1a1c939fa9da05b607201f40dbcd99a1ca4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 20 Oct 2026 10:01:20 +0200 Subject: [PATCH] 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) --- Common/File/VFS/ZipFileReader.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Common/File/VFS/ZipFileReader.cpp b/Common/File/VFS/ZipFileReader.cpp index 83655bc989..d9dcf4a84c 100644 --- a/Common/File/VFS/ZipFileReader.cpp +++ b/Common/File/VFS/ZipFileReader.cpp @@ -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;