0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-16 03:05:06 +00:00

android: set current dir to cache so boot.rom and file i/o are usable

This commit is contained in:
Sigrid Solveig Haflínudóttir 2021-12-27 23:16:27 +01:00
parent 20a6f050fc
commit dce68e0e41
2 changed files with 11 additions and 2 deletions

View file

@ -1698,7 +1698,11 @@ class SDLMain implements Runnable {
// Runs SDL_main()
String library = SDLActivity.mSingleton.getMainSharedObject();
String function = SDLActivity.mSingleton.getMainFunction();
String[] arguments = SDLActivity.mSingleton.getArguments();
String[] a = SDLActivity.mSingleton.getArguments();
String[] args = new String[a.length + 2];
System.arraycopy(a, 0, args, 0, a.length);
args[a.length + 0] = "-cd";
args[a.length + 1] = SDLActivity.mSingleton.getCacheDir().getPath();
try {
android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_DISPLAY);
@ -1708,7 +1712,7 @@ class SDLMain implements Runnable {
Log.v(SDLActivity.TAG, "Running main function " + function + " from library " + library);
SDLActivity.nativeRunMain(library, function, arguments);
SDLActivity.nativeRunMain(library, function, args);
Log.v(SDLActivity.TAG, "Finished main function");

View file

@ -565,6 +565,11 @@ main(int argc, char **argv)
set_zoom(atoi(argv[++i]));
else
return error("Opt", "-s No scale provided.");
} else if(strcmp(argv[i], "-cd") == 0) {
if(i < argc - 1)
chdir(argv[++i]);
else
return error("Opt", "-cd No path provided.");
} else if(!loaded++) {
if(!start(&u, argv[i]))
return error("Boot", "Failed to boot.");