Fixes and enhancements from my MCPE repository. (https://github.com/mschiller890/mcpe64)

This commit is contained in:
Michal Schiller
2026-03-10 19:31:40 +01:00
parent 0c97ceb340
commit 2fc323639a
69 changed files with 2509 additions and 639 deletions

View File

@@ -1,5 +1,6 @@
#include "App.h"
#include "AppPlatform_android.h"
#include <android_native_app_glue.h>
// Horrible, I know. / A
#ifndef MAIN_CLASS
@@ -38,7 +39,15 @@ static void setupExternalPath(struct android_app* state, MAIN_CLASS* app)
const char* str = env->GetStringUTFChars((jstring) pathString, NULL);
app->externalStoragePath = str;
app->externalCacheStoragePath = str;
LOGI(str);
LOGI("%s", str);
// ensure the process working directory is set to a writable location
// on Android the default cwd may be '/' which isn't writable. By chdir'ing
// to the external storage path we make relative fopen calls (e.g. "options.txt")
// succeed and persist across launches, fixing the "options never save" bug.
if (chdir(str) != 0) {
LOGI("chdir to %s failed: %s", str, strerror(errno));
}
env->ReleaseStringUTFChars((jstring)pathString, str);