Skip to content
This repository has been archived by the owner on Jan 26, 2025. It is now read-only.

Commit

Permalink
use throw in failed chart load crash
Browse files Browse the repository at this point in the history
  • Loading branch information
MaybeMaru committed Dec 11, 2023
1 parent 4bdb2bf commit a683a10
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
Binary file added assets/preload/sounds/volume.mp3
Binary file not shown.
6 changes: 5 additions & 1 deletion source/FlxFunkGame.hx
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,13 @@ class FlxFunkSoundTray extends FlxSoundTray {

override function show(up:Bool = false) {
if (!silent) {
final sound = FlxAssets.getSound("assets/sounds/volume");
#if desktop
final sound = FlxAssets.getSound("assets/sounds/volume");
if (sound != null)
FlxG.sound.load(sound).play();
#else
CoolUtil.playSound("volume");
#end
}

_timer = 4;
Expand Down
7 changes: 5 additions & 2 deletions source/funkin/util/Paths.hx
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,11 @@ class Paths
}

inline static public function exists(file:String, type:AssetType):Bool {
#if desktop return FileSystem.exists(removeAssetLib(file));
#else return OpenFlAssets.exists(file, type); #end
#if desktop
return FileSystem.exists(removeAssetLib(file));
#else
return OpenFlAssets.exists(file, type);
#end
}

inline static public function removeAssetLib(path:String):String {
Expand Down
3 changes: 2 additions & 1 deletion source/funkin/util/song/Song.hx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ class Song {
}
}
trace('$folder-$diff CHART NOT FOUND');
return loadFromFile('hard','tutorial');
if (folder == "tutorial" && diff == "hard") throw 'Failed to load chart'; // Couldnt even find tutorial
else return loadFromFile('hard','tutorial');
}

inline public static function getSongMeta(song:String):Null<SongMeta> {
Expand Down

0 comments on commit a683a10

Please sign in to comment.