Skip to content

Commit

Permalink
an attempt at fixing assets crash
Browse files Browse the repository at this point in the history
for android
  • Loading branch information
JordanSantiagoYT committed Oct 15, 2023
1 parent 881c3fe commit bbf177f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions source/Paths.hx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class Paths

inline public static function getPreloadPath(file:String = '')
{
return 'assets/$file';
return SUtil.getPath() + 'assets/$file';
}

inline static public function file(file:String, type:AssetType = TEXT, ?library:String)
Expand All @@ -177,30 +177,30 @@ class Paths

inline static public function txt(key:String, ?library:String)
{
return getPath(SUtil.getPath() + 'data/$key.txt', TEXT, library);
return getPath('data/$key.txt', TEXT, library);
}

inline static public function xml(key:String, ?library:String)
{
return getPath(SUtil.getPath() + 'data/$key.xml', TEXT, library);
return getPath('data/$key.xml', TEXT, library);
}

inline static public function json(key:String, ?library:String)
{
return getPath(SUtil.getPath() + 'data/$key.json', TEXT, library);
return getPath('data/$key.json', TEXT, library);
}

inline static public function shaderFragment(key:String, ?library:String)
{
return getPath(SUtil.getPath() + 'shaders/$key.frag', TEXT, library);
return getPath('shaders/$key.frag', TEXT, library);
}
inline static public function shaderVertex(key:String, ?library:String)
{
return getPath(SUtil.getPath() + 'shaders/$key.vert', TEXT, library);
return getPath('shaders/$key.vert', TEXT, library);
}
inline static public function lua(key:String, ?library:String)
{
return getPath(SUtil.getPath() + '$key.lua', TEXT, library);
return getPath('$key.lua', TEXT, library);
}
//Video loading (part of it)
static public function video(key:String)
Expand Down Expand Up @@ -450,7 +450,7 @@ class Paths
#end
{
// I hate this so god damn much
var gottenPath:String = SUtil.getPath() + getPath('$path/$key.$SOUND_EXT', SOUND, library);
var gottenPath:String = getPath('$path/$key.$SOUND_EXT', SOUND, library);
file = gottenPath.substring(gottenPath.indexOf(':') + 1, gottenPath.length);
if (path == 'songs')
gottenPath = 'songs:' + gottenPath;
Expand Down Expand Up @@ -493,7 +493,7 @@ class Paths
}
#end
// I hate this so god damn much
var gottenPath:String = SUtil.getPath() + getPath('$path/$key.$SOUND_EXT', SOUND, library);
var gottenPath:String = getPath('$path/$key.$SOUND_EXT', SOUND, library);
gottenPath = gottenPath.substring(gottenPath.indexOf(':') + 1, gottenPath.length);
// trace(gottenPath);
if(!currentTrackedSounds.exists(gottenPath))
Expand Down
8 changes: 4 additions & 4 deletions source/TitleState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class TitleState extends MusicBeatState
// music.play();

if(FlxG.sound.music == null) {
FlxG.sound.playMusic(Paths.music('freakyMenu-' + ClientPrefs.daMenuMusic), 0);
FlxG.sound.playMusic(SUtil.getPath() + Paths.music('freakyMenu-' + ClientPrefs.daMenuMusic), 0);
}
}

Expand Down Expand Up @@ -646,7 +646,7 @@ class TitleState extends MusicBeatState
{
case 1:
//FlxG.sound.music.stop();
FlxG.sound.playMusic(Paths.music('freakyMenu-' + ClientPrefs.daMenuMusic), 0);
FlxG.sound.playMusic(SUtil.getPath() + Paths.music('freakyMenu-' + ClientPrefs.daMenuMusic), 0);
FlxG.sound.music.fadeIn(4, 0, 0.7);
case 2:
#if PSYCH_WATERMARKS
Expand Down Expand Up @@ -756,7 +756,7 @@ class TitleState extends MusicBeatState
skippedIntro = true;
playJingle = false;

FlxG.sound.playMusic(Paths.music('freakyMenu-' + ClientPrefs.daMenuMusic), 0);
FlxG.sound.playMusic(SUtil.getPath() + Paths.music('freakyMenu-' + ClientPrefs.daMenuMusic), 0);
FlxG.sound.music.fadeIn(4, 0, 0.7);
return;
}
Expand All @@ -778,7 +778,7 @@ class TitleState extends MusicBeatState
remove(credGroup);
FlxG.camera.flash(FlxColor.WHITE, 3);
sound.onComplete = function() {
FlxG.sound.playMusic(Paths.music('freakyMenu-' + ClientPrefs.daMenuMusic), 0);
FlxG.sound.playMusic(SUtil.getPath() + Paths.music('freakyMenu-' + ClientPrefs.daMenuMusic), 0);
FlxG.sound.music.fadeIn(4, 0, 0.7);
transitioning = false;
};
Expand Down

0 comments on commit bbf177f

Please sign in to comment.