Skip to content

Commit ca08536

Browse files
committed
Fix for long loading screen for a specific mod
1 parent 0530bd0 commit ca08536

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

source/funkin/backend/assets/AssetsLibraryList.hx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import lime.utils.AssetLibrary;
88
import haxe.ds.Map;
99

1010
class AssetsLibraryList extends AssetLibrary {
11-
1211
public var libraries:Array<AssetLibrary> = [];
1312
public var cleanLibraries(get, never):Array<AssetLibrary>;
1413
function get_cleanLibraries():Array<AssetLibrary> {
@@ -32,6 +31,7 @@ class AssetsLibraryList extends AssetLibrary {
3231
#end
3332

3433
private var cachePaths:Map<String, AssetLibrary> = [];
34+
private var cacheNonExistentPaths:Map<String, Int> = [];
3535

3636
public function removeLibrary(lib:AssetLibrary) {
3737
if (lib != null) {
@@ -58,18 +58,27 @@ class AssetsLibraryList extends AssetLibrary {
5858
return true;
5959

6060
// There's a mod that heavily relies on addons and that can causes lags just to get a path.
61-
if (cachePaths.exists(id)) {
61+
final sec = Date.now().getSeconds();
62+
if (cacheNonExistentPaths.exists(id) && sec - 10 < cacheNonExistentPaths.get(id)) {
63+
return false;
64+
}
65+
else if (cachePaths.exists(id)) {
6266
if (cachePaths.get(id).exists(id, type)) return true;
6367
else cachePaths.remove(id);
6468
}
6569

70+
6671
for(k=>l in libraries) {
6772
if (shouldSkipLib(l, source)) continue;
6873
if (l.exists(id, type)) {
74+
//trace("EXISTS", id, type, source);
6975
cachePaths.set(id, l);
7076
return true;
7177
}
7278
}
79+
80+
//trace("DOESNT EXISTS", id, type, source);
81+
cacheNonExistentPaths.set(id, sec);
7382
return false;
7483
}
7584
public override inline function exists(id:String, type:String):Bool

source/funkin/backend/system/Main.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ class Main extends Sprite
125125
funkin.options.PlayerSettings.init();
126126
Options.load();
127127

128+
game.focusLostFramerate = 30;
128129
FlxG.fixedTimestep = false;
129-
130130
FlxG.scaleMode = scaleMode = new FunkinRatioScaleMode();
131131

132132
Conductor.init();

0 commit comments

Comments
 (0)