Fix for long loading screen for a specific mod
This commit is contained in:
@@ -8,7 +8,6 @@ import lime.utils.AssetLibrary;
|
||||
import haxe.ds.Map;
|
||||
|
||||
class AssetsLibraryList extends AssetLibrary {
|
||||
|
||||
public var libraries:Array<AssetLibrary> = [];
|
||||
public var cleanLibraries(get, never):Array<AssetLibrary>;
|
||||
function get_cleanLibraries():Array<AssetLibrary> {
|
||||
@@ -32,6 +31,7 @@ class AssetsLibraryList extends AssetLibrary {
|
||||
#end
|
||||
|
||||
private var cachePaths:Map<String, AssetLibrary> = [];
|
||||
private var cacheNonExistentPaths:Map<String, Int> = [];
|
||||
|
||||
public function removeLibrary(lib:AssetLibrary) {
|
||||
if (lib != null) {
|
||||
@@ -58,18 +58,27 @@ class AssetsLibraryList extends AssetLibrary {
|
||||
return true;
|
||||
|
||||
// There's a mod that heavily relies on addons and that can causes lags just to get a path.
|
||||
if (cachePaths.exists(id)) {
|
||||
final sec = Date.now().getSeconds();
|
||||
if (cacheNonExistentPaths.exists(id) && sec - 10 < cacheNonExistentPaths.get(id)) {
|
||||
return false;
|
||||
}
|
||||
else if (cachePaths.exists(id)) {
|
||||
if (cachePaths.get(id).exists(id, type)) return true;
|
||||
else cachePaths.remove(id);
|
||||
}
|
||||
|
||||
|
||||
for(k=>l in libraries) {
|
||||
if (shouldSkipLib(l, source)) continue;
|
||||
if (l.exists(id, type)) {
|
||||
//trace("EXISTS", id, type, source);
|
||||
cachePaths.set(id, l);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//trace("DOESNT EXISTS", id, type, source);
|
||||
cacheNonExistentPaths.set(id, sec);
|
||||
return false;
|
||||
}
|
||||
public override inline function exists(id:String, type:String):Bool
|
||||
|
||||
@@ -125,8 +125,8 @@ class Main extends Sprite
|
||||
funkin.options.PlayerSettings.init();
|
||||
Options.load();
|
||||
|
||||
game.focusLostFramerate = 30;
|
||||
FlxG.fixedTimestep = false;
|
||||
|
||||
FlxG.scaleMode = scaleMode = new FunkinRatioScaleMode();
|
||||
|
||||
Conductor.init();
|
||||
|
||||
Reference in New Issue
Block a user