From 17941872f8e1f082e8e146e85df51c75380de095 Mon Sep 17 00:00:00 2001 From: SwitchAxe Date: Mon, 12 Jan 2026 02:13:56 +0100 Subject: [PATCH 1/6] Added support for shader packs with a top-level parent directory Signed-off-by: SwitchAxe (cherry picked from commit 9a936969153e536cc3e7f9fa3fbe5730137dea8d) --- .../mod/tasks/LocalShaderPackParseTask.cpp | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp b/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp index 3443966d5..7532defad 100644 --- a/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp +++ b/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp @@ -61,11 +61,32 @@ bool processZIP(ShaderPack& pack, ProcessingLevel level) Q_ASSERT(pack.type() == ResourceType::ZIPFILE); MMCZip::ArchiveReader zip(pack.fileinfo().filePath()); - if (!zip.collectFiles()) + if (!zip.collectFiles(false)) return false; // can't open zip file if (!zip.exists("/shaders")) { - return false; // assets dir does not exists at zip root + // assets dir does not exists at zip root, but shader packs + // will sometimes be a zip file containing a folder with the + // actual contents in it. This happens + // e.g. when the shader pack is downloaded as code + // from Github. so other than "/shaders", we + // could also check for a "shaders" folder one level deep. + + QStringList files = zip.getFiles(); + + // the assumption here is that there is just one + // folder with the "shader" subfolder. In case + // there are multiple, the first one is picked. + bool isShaderPresent = false; + for (QString f: files) { + if (zip.exists(f + "/shaders")) + isShaderPresent = true; + } + + if (!isShaderPresent) + // assets dir does not exist. + return false; + } pack.setPackFormat(ShaderPackFormat::VALID); From 2692cbcdc8440d66d0df8456f9918d6246074ea1 Mon Sep 17 00:00:00 2001 From: SwitchAxe Date: Mon, 12 Jan 2026 02:35:36 +0100 Subject: [PATCH 2/6] Fixed Indentation Signed-off-by: SwitchAxe (cherry picked from commit 6ac9de7a11ae7092fb704c1b9c0291874cd28be7) --- .../minecraft/mod/tasks/LocalShaderPackParseTask.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp b/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp index 7532defad..647428a0a 100644 --- a/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp +++ b/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp @@ -79,13 +79,13 @@ bool processZIP(ShaderPack& pack, ProcessingLevel level) // there are multiple, the first one is picked. bool isShaderPresent = false; for (QString f: files) { - if (zip.exists(f + "/shaders")) - isShaderPresent = true; + if (zip.exists(f + "/shaders")) + isShaderPresent = true; } - + if (!isShaderPresent) - // assets dir does not exist. - return false; + // assets dir does not exist. + return false; } pack.setPackFormat(ShaderPackFormat::VALID); From fb77027d84981f949733b095b46d807c94be3e43 Mon Sep 17 00:00:00 2001 From: Sofia <75943257+SwitchAxe@users.noreply.github.com> Date: Mon, 12 Jan 2026 03:25:43 +0100 Subject: [PATCH 3/6] Update launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp Co-authored-by: Octol1ttle Signed-off-by: Sofia <75943257+SwitchAxe@users.noreply.github.com> (cherry picked from commit 6321db594258673af924c9a135423e943a0d10d9) --- launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp b/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp index 647428a0a..0aa77a8ca 100644 --- a/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp +++ b/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp @@ -78,7 +78,7 @@ bool processZIP(ShaderPack& pack, ProcessingLevel level) // folder with the "shader" subfolder. In case // there are multiple, the first one is picked. bool isShaderPresent = false; - for (QString f: files) { + for (QString f : files) { if (zip.exists(f + "/shaders")) isShaderPresent = true; } From 19ead6adbd1228b3e3ab6cc7875c831dc84913a2 Mon Sep 17 00:00:00 2001 From: SwitchAxe Date: Mon, 12 Jan 2026 03:36:52 +0100 Subject: [PATCH 4/6] Made the loop more efficient Signed-off-by: SwitchAxe (cherry picked from commit 8aba994312ae16d35f92b223c6b3cd818241559e) --- launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp b/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp index 0aa77a8ca..f16ef090a 100644 --- a/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp +++ b/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp @@ -79,8 +79,10 @@ bool processZIP(ShaderPack& pack, ProcessingLevel level) // there are multiple, the first one is picked. bool isShaderPresent = false; for (QString f : files) { - if (zip.exists(f + "/shaders")) - isShaderPresent = true; + if (zip.exists(f + "/shaders")) { + isShaderPresent = true; + break; + } } if (!isShaderPresent) From 0b7646740b3f512ec5c81794639fff9e7bf3589c Mon Sep 17 00:00:00 2001 From: SwitchAxe Date: Mon, 12 Jan 2026 14:43:54 +0100 Subject: [PATCH 5/6] Improved the check for the assets dir Signed-off-by: SwitchAxe (cherry picked from commit 7f0f90fcced3f6e91d79d5e42ded262d8b1b5271) --- launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp b/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp index f16ef090a..997cb9bcb 100644 --- a/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp +++ b/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp @@ -79,7 +79,7 @@ bool processZIP(ShaderPack& pack, ProcessingLevel level) // there are multiple, the first one is picked. bool isShaderPresent = false; for (QString f : files) { - if (zip.exists(f + "/shaders")) { + if (f.contains("/shaders/", Qt::CaseInsensitive)) { isShaderPresent = true; break; } From aadd88cbd8c0200b8411eac0fb760d7edc30d7a0 Mon Sep 17 00:00:00 2001 From: SwitchAxe Date: Mon, 12 Jan 2026 16:44:01 +0100 Subject: [PATCH 6/6] Fixed formatting Signed-off-by: SwitchAxe (cherry picked from commit 809e766aec1ba83127057ed1504539f53d0d434b) --- .../mod/tasks/LocalShaderPackParseTask.cpp | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp b/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp index 997cb9bcb..3a6b11b69 100644 --- a/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp +++ b/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.cpp @@ -65,30 +65,29 @@ bool processZIP(ShaderPack& pack, ProcessingLevel level) return false; // can't open zip file if (!zip.exists("/shaders")) { - // assets dir does not exists at zip root, but shader packs - // will sometimes be a zip file containing a folder with the - // actual contents in it. This happens - // e.g. when the shader pack is downloaded as code - // from Github. so other than "/shaders", we - // could also check for a "shaders" folder one level deep. + // assets dir does not exists at zip root, but shader packs + // will sometimes be a zip file containing a folder with the + // actual contents in it. This happens + // e.g. when the shader pack is downloaded as code + // from Github. so other than "/shaders", we + // could also check for a "shaders" folder one level deep. - QStringList files = zip.getFiles(); + QStringList files = zip.getFiles(); - // the assumption here is that there is just one - // folder with the "shader" subfolder. In case - // there are multiple, the first one is picked. - bool isShaderPresent = false; - for (QString f : files) { - if (f.contains("/shaders/", Qt::CaseInsensitive)) { - isShaderPresent = true; - break; - } - } - - if (!isShaderPresent) - // assets dir does not exist. - return false; - + // the assumption here is that there is just one + // folder with the "shader" subfolder. In case + // there are multiple, the first one is picked. + bool isShaderPresent = false; + for (QString f : files) { + if (f.contains("/shaders/", Qt::CaseInsensitive)) { + isShaderPresent = true; + break; + } + } + + if (!isShaderPresent) + // assets dir does not exist. + return false; } pack.setPackFormat(ShaderPackFormat::VALID);