Skip to content

Commit

Permalink
get asset fix
Browse files Browse the repository at this point in the history
  • Loading branch information
NexIsDumb committed Feb 5, 2024
1 parent e9e7daa commit 6e7abd1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
14 changes: 6 additions & 8 deletions source/funkin/backend/assets/AssetsLibraryList.hx
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,21 @@ class AssetsLibraryList extends AssetLibrary {

public function getSpecificAsset(id:String, type:String, source:AssetSource = BOTH, ?avoidRoot:Bool = false):Dynamic {
try {
var fileFromAssets:Bool = id.startsWith("assets/");

if (!fileFromAssets) {
if (!id.startsWith("assets/")) {
var ass = getSpecificAsset('assets/$id', type, source);
if (ass != null)
return ass;
}

if (fileFromAssets) {
} else {
for (lib in assetsLibs) {
if (shouldSkipLib(libraries.indexOf(lib), source)) continue;

var asset = lib.getAsset(id, type);
if (asset != null)
return asset;
}
} else if (!avoidRoot) {
}

if (!avoidRoot) {
for (lib in rootLibs) {
if (shouldSkipLib(libraries.indexOf(lib), source)) continue;

Expand Down Expand Up @@ -182,7 +180,7 @@ class AssetsLibraryList extends AssetLibrary {

if (finalLib is IModsAssetLibrary)
assetsLibs.insert(0, finalLib);
else
else
rootLibs.insert(0, finalLib);
return lib;
}
Expand Down
5 changes: 3 additions & 2 deletions source/funkin/menus/credits/CreditsMain.hx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ class CreditsMain extends TreeMenu {
add(bg);

var selectables:Array<OptionType> = [];
var xmlPath = Paths.xml('config/credits');
for(source in [funkin.backend.assets.AssetsLibraryList.AssetSource.SOURCE, funkin.backend.assets.AssetsLibraryList.AssetSource.MODS]) {
if (Paths.assetsTree.existsSpecific(Paths.xml('config/credits'), "TEXT", source)) {
if (Paths.assetsTree.existsSpecific(xmlPath, "TEXT", source)) {
var access:Access = null;
try {
access = new Access(Xml.parse(Paths.assetsTree.getSpecificAsset(Paths.xml('config/credits'), "TEXT", source)));
access = new Access(Xml.parse(Paths.assetsTree.getSpecificAsset(xmlPath, "TEXT", source)));
} catch(e) {
Logs.trace('Error while parsing credits.xml: ${Std.string(e)}', ERROR);
}
Expand Down

0 comments on commit 6e7abd1

Please sign in to comment.