mirror of
https://github.com/love2d/love-android.git
synced 2026-08-20 04:31:26 +02:00
Merged GameLauncher and GameActivity together
The GameActivity would not run otherwise as the App started via GameActivity would call in love::android::getSelectedGameFile() the wrong activity (namely GameLauncher) that was not initialized properly. Hence it would result in a segfault.
This commit is contained in:
@@ -54,26 +54,26 @@ double getScreenScale()
|
||||
|
||||
const char* getSelectedGameFile()
|
||||
{
|
||||
static const char *path = NULL;
|
||||
static const char *path = NULL;
|
||||
|
||||
if (!path) {
|
||||
JNIEnv *env = (JNIEnv*) SDL_AndroidGetJNIEnv();
|
||||
jclass activity = env->FindClass("org/love2d/android/GameLauncher");
|
||||
if (!path) {
|
||||
JNIEnv *env = (JNIEnv*) SDL_AndroidGetJNIEnv();
|
||||
jclass activity = env->FindClass("org/love2d/android/GameActivity");
|
||||
|
||||
jmethodID getGamePath = env->GetStaticMethodID(activity, "getGamePath", "()Ljava/lang/String;");
|
||||
jstring gamePath = (jstring) env->CallStaticObjectMethod(activity, getGamePath);
|
||||
const char *utf = env->GetStringUTFChars(gamePath, 0);
|
||||
if (utf)
|
||||
{
|
||||
path = SDL_strdup(utf);
|
||||
env->ReleaseStringUTFChars(gamePath, utf);
|
||||
}
|
||||
jmethodID getGamePath = env->GetStaticMethodID(activity, "getGamePath", "()Ljava/lang/String;");
|
||||
jstring gamePath = (jstring) env->CallStaticObjectMethod(activity, getGamePath);
|
||||
const char *utf = env->GetStringUTFChars(gamePath, 0);
|
||||
if (utf)
|
||||
{
|
||||
path = SDL_strdup(utf);
|
||||
env->ReleaseStringUTFChars(gamePath, utf);
|
||||
}
|
||||
|
||||
env->DeleteLocalRef (gamePath);
|
||||
env->DeleteLocalRef (activity);
|
||||
}
|
||||
env->DeleteLocalRef (gamePath);
|
||||
env->DeleteLocalRef (activity);
|
||||
}
|
||||
|
||||
return path;
|
||||
return path;
|
||||
}
|
||||
|
||||
} // android
|
||||
|
||||
Reference in New Issue
Block a user