mirror of
https://github.com/love2d/love-android.git
synced 2026-08-20 04:31:26 +02:00
Automatically loading assets/game.love if exists
This commit is contained in:
@@ -22,21 +22,30 @@ void Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject
|
||||
|
||||
SDL_SetMainReady();
|
||||
|
||||
/* get argument from SDLMain in SDLActivity.java */
|
||||
jboolean isCopy;
|
||||
const char* str = (*env)->GetStringUTFChars(env, obj, &isCopy);
|
||||
|
||||
/* Run the application code! */
|
||||
int status;
|
||||
char *argv[4];
|
||||
int argc;
|
||||
|
||||
if (SDL_strlen(str) > 0)
|
||||
argc = 2;
|
||||
else
|
||||
argc = 1;
|
||||
|
||||
/* assemble argv depending on whether we have an argument or not */
|
||||
char *argv[argc + 1];
|
||||
argv[0] = SDL_strdup("SDL_app");
|
||||
argv[1] = SDL_strdup("--package-path");
|
||||
argv[2] = SDL_strdup(str);
|
||||
argv[3] = NULL;
|
||||
if (SDL_strlen(str) > 0)
|
||||
argv[1] = SDL_strdup(str);
|
||||
argv[argc] = NULL;
|
||||
|
||||
if (isCopy == JNI_TRUE)
|
||||
(*env)->ReleaseStringUTFChars(env, obj, str);
|
||||
|
||||
status = SDL_main(3, argv);
|
||||
status = SDL_main(argc, argv);
|
||||
|
||||
/* Do not issue an exit or the whole application will terminate instead of just the SDL thread */
|
||||
/* exit(status); */
|
||||
|
||||
Reference in New Issue
Block a user