silly rabbit

This commit is contained in:
izzy2lost
2025-08-13 09:53:43 -04:00
parent bcbb81a6fa
commit a67e0fd5bd
2 changed files with 11 additions and 13 deletions
@@ -33,8 +33,6 @@ import android.content.pm.ActivityInfo;
import android.view.KeyEvent;
public class MainActivity extends SDLActivity {
public static native void nativeSetAppDirs(String internal);
static {
System.loadLibrary("Starship");
}
+11 -11
View File
@@ -98,18 +98,23 @@ void waitForSetupFromNative() {
}
#endif
GameEngine::GameEngine() {
#ifdef __ANDROID__
const char* sdlInternal = SDL_AndroidGetInternalStoragePath();
const std::string appDir = (sdlInternal && *sdlInternal) ? std::string(sdlInternal) : std::string(".");
const std::string main_path = appDir + "/sf64.o2r";
const std::string assets_path = appDir + "/starship.o2r";
#else
const std::string main_path = Ship::Context::GetPathRelativeToAppDirectory("sf64.o2r");
const std::string assets_path = Ship::Context::LocateFileAcrossAppDirs("starship.o2r");
#endif
std::vector<std::string> archiveFiles;
#ifdef __ANDROID__
{
const char* sdlInternal = SDL_AndroidGetInternalStoragePath();
if (sdlInternal && *sdlInternal) {
auto* pm = Ship::Context::GetInstance()->GetPathManager();
pm->SetAppDirectoryPath(sdlInternal);
pm->SetAppDirectoryPath(sdlInternal);
pm->SetUserDirectoryPath(sdlInternal);
SPDLOG_INFO("Android app/user dir set to: {}", sdlInternal);
} else {
@@ -898,13 +903,8 @@ extern "C" void GameEngine_Free(void* ptr) {
#ifdef __ANDROID__
extern "C" JNIEXPORT void JNICALL
Java_com_starship_android_MainActivity_nativeSetAppDirs(JNIEnv* env, jclass, jstring jpath) {
if (!jpath) return;
const char* p = env->GetStringUTFChars(jpath, nullptr);
if (p) {
auto* pm = Ship::Context::GetInstance()->GetPathManager();
pm->SetAppDirectoryPath(p);
pm->SetUserDirectoryPath(p);
SPDLOG_INFO("JNI set app/user dir to {}", p);
// No-op: paths resolved via SDL_AndroidGetInternalStoragePath in GameEngine::GameEngine
}", p);
env->ReleaseStringUTFChars(jpath, p);
}
}