File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import funkin.backend.assets.TranslatedAssetLibrary;
55#end
66import funkin .backend .assets .IModsAssetLibrary ;
77import lime .utils .AssetLibrary ;
8+ import haxe .ds .Map ;
89
910class AssetsLibraryList extends AssetLibrary {
1011 public var libraries : Array <AssetLibrary > = [];
@@ -141,6 +142,16 @@ class AssetsLibraryList extends AssetLibrary {
141142 public override inline function getAsset (id : String , type : String ): Dynamic
142143 return getSpecificAsset (id , type , BOTH );
143144
145+ public override function list (type : String ): Array <String > {
146+ // idk if there's a more efficient way tbh, correct if u find better
147+ var files : Map <String , Bool > = [];
148+ for (k => l in libraries ) {
149+ for (f in l .list (type ))
150+ files .set (f , false );
151+ }
152+ return [for (k => e in files ) k ];
153+ }
154+
144155 public override function isLocal (id : String , type : String ) {
145156 return true ;
146157 }
Original file line number Diff line number Diff line change @@ -149,6 +149,22 @@ class ModsFolderLibrary extends AssetLibrary implements IModsAssetLibrary {
149149 }
150150 return true ;
151151 }
152+
153+ public override function list (type : String ): Array <String > {
154+ var result = [];
155+ __listAppend (result , ' ' );
156+ return result ;
157+ }
158+
159+ function __listAppend (arr : Array <String >, folder : String ) {
160+ for (file in FileSystem .readDirectory (' $basePath / $folder ' )) {
161+ var fullPath = ' $basePath / $folder / $file ' ;
162+ if (FileSystem .isDirectory (fullPath ))
163+ __listAppend (arr , ' $folder $file /' );
164+ else
165+ arr .push (' $prefix $folder $file ' );
166+ }
167+ }
152168 #end
153169
154170 // Backwards compat
Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ class ZipFolderLibrary extends AssetLibrary implements IModsAssetLibrary {
3333 zip = SysZip .openFromFile (basePath );
3434 zip .read ();
3535 for (entry in zip .entries ) {
36+ if (entry .fileName .length < 0 || entry .fileName .endsWith (" /" ))
37+ continue ;
38+
3639 lowerCaseAssets [entry .fileName .toLowerCase ()] = assets [entry .fileName .toLowerCase ()] = assets [entry .fileName ] = entry ;
3740 nameMap .set (entry .fileName .toLowerCase (), entry .fileName );
3841 }
@@ -154,6 +157,10 @@ class ZipFolderLibrary extends AssetLibrary implements IModsAssetLibrary {
154157 return content ;
155158 }
156159
160+ public override function list (type : String ): Array <String > {
161+ return [for (k => e in nameMap ) ' $prefix $e ' ];
162+ }
163+
157164 // Backwards compat
158165
159166 @:noCompletion public var zipPath (get , set ): String ;
Original file line number Diff line number Diff line change @@ -128,13 +128,8 @@ final class XMLUtil {
128128 spr .spriteAnimType = XMLAnimType .fromString (node .att .type , spr .spriteAnimType );
129129 }
130130
131- if (node .has .applyStageMatrix ) {
132- spr .applyStageMatrix = node .att .applyStageMatrix == " true" ;
133- }
134-
135- if (node .has .useRenderTexture ) {
136- spr .useRenderTexture = node .att .useRenderTexture == " true" ;
137- }
131+ if (node .has .applyStageMatrix ) spr .applyStageMatrix = node .att .applyStageMatrix == " true" ;
132+ if (node .has .useRenderTexture ) spr .useRenderTexture = node .att .useRenderTexture == " true" ;
138133
139134 if (node .has .x ) {
140135 var x : Null <Float > = Std .parseFloat (node .att .x );
You can’t perform that action at this time.
0 commit comments