From 6caf6341c2de0dd4c97a16e02236d3075005c9d3 Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Mon, 19 Jan 2026 12:35:51 +0100 Subject: [PATCH] Fixed atlases for mods --- .../funkin/backend/assets/AssetsLibraryList.hx | 11 +++++++++++ .../funkin/backend/assets/ModsFolderLibrary.hx | 16 ++++++++++++++++ source/funkin/backend/assets/ZipFolderLibrary.hx | 7 +++++++ source/funkin/backend/utils/XMLUtil.hx | 9 ++------- 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/source/funkin/backend/assets/AssetsLibraryList.hx b/source/funkin/backend/assets/AssetsLibraryList.hx index ea3cffdc..36204138 100644 --- a/source/funkin/backend/assets/AssetsLibraryList.hx +++ b/source/funkin/backend/assets/AssetsLibraryList.hx @@ -5,6 +5,7 @@ import funkin.backend.assets.TranslatedAssetLibrary; #end import funkin.backend.assets.IModsAssetLibrary; import lime.utils.AssetLibrary; +import haxe.ds.Map; class AssetsLibraryList extends AssetLibrary { public var libraries:Array = []; @@ -141,6 +142,16 @@ class AssetsLibraryList extends AssetLibrary { public override inline function getAsset(id:String, type:String):Dynamic return getSpecificAsset(id, type, BOTH); + public override function list(type:String):Array { + // idk if there's a more efficient way tbh, correct if u find better + var files:Map = []; + for(k=>l in libraries) { + for(f in l.list(type)) + files.set(f, false); + } + return [for(k=>e in files) k]; + } + public override function isLocal(id:String, type:String) { return true; } diff --git a/source/funkin/backend/assets/ModsFolderLibrary.hx b/source/funkin/backend/assets/ModsFolderLibrary.hx index 43db98e7..f7064cd9 100644 --- a/source/funkin/backend/assets/ModsFolderLibrary.hx +++ b/source/funkin/backend/assets/ModsFolderLibrary.hx @@ -149,6 +149,22 @@ class ModsFolderLibrary extends AssetLibrary implements IModsAssetLibrary { } return true; } + + public override function list(type:String):Array { + var result = []; + __listAppend(result, ''); + return result; + } + + function __listAppend(arr:Array, folder:String) { + for(file in FileSystem.readDirectory('$basePath/$folder')) { + var fullPath = '$basePath/$folder/$file'; + if (FileSystem.isDirectory(fullPath)) + __listAppend(arr, '$folder$file/'); + else + arr.push('$prefix$folder$file'); + } + } #end // Backwards compat diff --git a/source/funkin/backend/assets/ZipFolderLibrary.hx b/source/funkin/backend/assets/ZipFolderLibrary.hx index 68ef537a..e8c1a46e 100644 --- a/source/funkin/backend/assets/ZipFolderLibrary.hx +++ b/source/funkin/backend/assets/ZipFolderLibrary.hx @@ -33,6 +33,9 @@ class ZipFolderLibrary extends AssetLibrary implements IModsAssetLibrary { zip = SysZip.openFromFile(basePath); zip.read(); for(entry in zip.entries) { + if (entry.fileName.length < 0 || entry.fileName.endsWith("/")) + continue; + lowerCaseAssets[entry.fileName.toLowerCase()] = assets[entry.fileName.toLowerCase()] = assets[entry.fileName] = entry; nameMap.set(entry.fileName.toLowerCase(), entry.fileName); } @@ -154,6 +157,10 @@ class ZipFolderLibrary extends AssetLibrary implements IModsAssetLibrary { return content; } + public override function list(type:String):Array { + return[for(k=>e in nameMap) '$prefix$e']; + } + // Backwards compat @:noCompletion public var zipPath(get, set):String; diff --git a/source/funkin/backend/utils/XMLUtil.hx b/source/funkin/backend/utils/XMLUtil.hx index a25f5d05..688a0165 100644 --- a/source/funkin/backend/utils/XMLUtil.hx +++ b/source/funkin/backend/utils/XMLUtil.hx @@ -128,13 +128,8 @@ final class XMLUtil { spr.spriteAnimType = XMLAnimType.fromString(node.att.type, spr.spriteAnimType); } - if (node.has.applyStageMatrix) { - spr.applyStageMatrix = node.att.applyStageMatrix == "true"; - } - - if (node.has.useRenderTexture) { - spr.useRenderTexture = node.att.useRenderTexture == "true"; - } + if (node.has.applyStageMatrix) spr.applyStageMatrix = node.att.applyStageMatrix == "true"; + if (node.has.useRenderTexture) spr.useRenderTexture = node.att.useRenderTexture == "true"; if(node.has.x) { var x:Null = Std.parseFloat(node.att.x);