Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mcagabe19 committed Apr 20, 2024
1 parent 9e0979d commit 6046139
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
8 changes: 6 additions & 2 deletions source/mobile/backend/SUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.Permissions;
import android.Settings;
import funkin.options.Options;
#end
import lime.system.System as LimeSystem;
import funkin.backend.utils.NativeAPI;
#if sys
import sys.io.File;
Expand All @@ -28,9 +29,12 @@ class SUtil
var daPath:String;
#if android
daPath = force ? StorageType.fromStrForce(Options.storageType) : StorageType.fromStr(Options.storageType);
if (!FileSystem.exists(LimeSystem.applicationStorageDirectory + 'storagetype.txt')) File.saveContent(LimeSystem.applicationStorageDirectory + 'storagetype.txt', Options.storageType);
var curStorageType:String = File.getContent(LimeSystem.applicationStorageDirectory + 'storagetype.txt');
daPath = force ? StorageType.fromStrForce(curStorageType) : StorageType.fromStr(curStorageType);
daPath = haxe.io.Path.addTrailingSlash(daPath);
#elseif ios
daPath = lime.system.System.documentsDirectory;
daPath = LimeSystem.documentsDirectory;
#end

return daPath;
Expand Down Expand Up @@ -106,7 +110,7 @@ class SUtil
catch (e:Dynamic)
{
NativeAPI.showMessageBox("Error!", "Please create folder to\n" + SUtil.getStorageDirectory(true) + "\nPress OK to close the game", MSG_ERROR);
lime.system.System.exit(1);
LimeSystem.exit(1);
}
}
}
Expand Down
17 changes: 10 additions & 7 deletions source/mobile/options/categories/MobileOptions.hx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import funkin.backend.MusicBeatState;
import mobile.substates.MobileControlSelectSubState;
import funkin.options.OptionsScreen;
import funkin.options.Options;
import lime.system.System as LimeSystem;
#if sys
import sys.io.File;
#end

class MobileOptions extends OptionsScreen {
var canEnter:Bool = true;
Expand Down Expand Up @@ -43,22 +47,21 @@ class MobileOptions extends OptionsScreen {
#if android
add(new funkin.options.type.ArrayOption(
"Storage Type",
"Test reasons",
['EXTERNAL_DATA', 'EXTERNAL_OBB', 'EXTERNAL', 'EXTERNAL_OBB'],
['Data', 'Obb', '.' + lime.app.Application.current.meta.get('file'), 'Media'],
"Choose which folder Codename Engine should use!",
['EXTERNAL_DATA', 'EXTERNAL_OBB', 'EXTERNAL_MEDIA', 'EXTERNAL'],
['Data', 'Obb', 'Media', '.' + lime.app.Application.current.meta.get('file')],
'storageType'));
#end
}

override function update(elapsed) super.update(elapsed);

override public function destroy() {
/*Options.save();
Options.applySettings();*/
lime.system.System.allowScreenTimeout = Options.screenTimeOut;
File.saveContent(LimeSystem.applicationStorageDirectory + 'storagetype.txt', Options.storageType);
LimeSystem.allowScreenTimeout = Options.screenTimeOut;
if (Options.storageType != lastStorageType) {
funkin.backend.utils.NativeAPI.showMessageBox('Notice!', 'Storage Type has been changed and you needed restart the game!!\nPress OK to close the game.');
lime.system.System.exit(0);
LimeSystem.exit(0);
}
}

Expand Down

0 comments on commit 6046139

Please sign in to comment.