mirror of
https://github.com/blupi-games/planetblupi-dev
synced 2024-12-30 13:55:36 +01:00
Remove obsolete content (since SDL 2.0.6)
Fix link error on stderr.
This commit is contained in:
parent
af5d600757
commit
7f4d0b725e
@ -1,84 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
SDL_android_main.c, placed in the public domain by Sam Lantinga 3/13/14
|
SDL_android_main.c, placed in the public domain by Sam Lantinga 3/13/14
|
||||||
*/
|
*/
|
||||||
//#include "../../SDL_internal.h"
|
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
|
||||||
|
|
||||||
/* Include the SDL main definition header */
|
|
||||||
//#include "SDL_main.h"
|
|
||||||
#include <SDL2/SDL.h>
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
Functions called by JNI
|
|
||||||
*******************************************************************************/
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
/* Called before SDL_main() to initialize JNI bindings in SDL library */
|
#undef stderr
|
||||||
extern void SDL_Android_Init(JNIEnv* env, jclass cls);
|
FILE *stderr = &__sF[2];
|
||||||
|
|
||||||
/* This prototype is needed to prevent a warning about the missing prototype for global function below */
|
|
||||||
JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject array);
|
|
||||||
|
|
||||||
/* Start up the SDL app */
|
|
||||||
JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject array)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
int argc;
|
|
||||||
int status;
|
|
||||||
int len;
|
|
||||||
char** argv;
|
|
||||||
|
|
||||||
/* This interface could expand with ABI negotiation, callbacks, etc. */
|
|
||||||
SDL_Android_Init(env, cls);
|
|
||||||
|
|
||||||
SDL_SetMainReady();
|
|
||||||
|
|
||||||
/* Prepare the arguments. */
|
|
||||||
|
|
||||||
len = (*env)->GetArrayLength(env, array);
|
|
||||||
argv = SDL_stack_alloc(char*, 1 + len + 1);
|
|
||||||
argc = 0;
|
|
||||||
/* Use the name "app_process" so PHYSFS_platformCalcBaseDir() works.
|
|
||||||
https://bitbucket.org/MartinFelis/love-android-sdl2/issue/23/release-build-crash-on-start
|
|
||||||
*/
|
|
||||||
argv[argc++] = SDL_strdup("app_process");
|
|
||||||
for (i = 0; i < len; ++i) {
|
|
||||||
const char* utf;
|
|
||||||
char* arg = NULL;
|
|
||||||
jstring string = (*env)->GetObjectArrayElement(env, array, i);
|
|
||||||
if (string) {
|
|
||||||
utf = (*env)->GetStringUTFChars(env, string, 0);
|
|
||||||
if (utf) {
|
|
||||||
arg = SDL_strdup(utf);
|
|
||||||
(*env)->ReleaseStringUTFChars(env, string, utf);
|
|
||||||
}
|
|
||||||
(*env)->DeleteLocalRef(env, string);
|
|
||||||
}
|
|
||||||
if (!arg) {
|
|
||||||
arg = SDL_strdup("");
|
|
||||||
}
|
|
||||||
argv[argc++] = arg;
|
|
||||||
}
|
|
||||||
argv[argc] = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
/* Run the application. */
|
|
||||||
|
|
||||||
status = SDL_main(argc, argv);
|
|
||||||
|
|
||||||
/* Release the arguments. */
|
|
||||||
|
|
||||||
for (i = 0; i < argc; ++i) {
|
|
||||||
SDL_free(argv[i]);
|
|
||||||
}
|
|
||||||
SDL_stack_free(argv);
|
|
||||||
/* Do not issue an exit or the whole application will terminate instead of just the SDL thread */
|
|
||||||
/* exit(status); */
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* __ANDROID__ */
|
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user