mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-29 21:45:32 +00:00
Merge remote-tracking branch 'sandstranger/fix-bad-code-in-command-line'
This commit is contained in:
commit
545ca9c9b4
2 changed files with 11 additions and 8 deletions
|
@ -1,18 +1,20 @@
|
|||
#include "android_commandLine.h"
|
||||
#include "string.h"
|
||||
|
||||
const char *argvData[15];
|
||||
int argcData;
|
||||
|
||||
|
||||
const char **argvData;
|
||||
int argcData;
|
||||
|
||||
JNIEXPORT void JNICALL Java_ui_activity_GameActivity_commandLine(JNIEnv *env,
|
||||
jobject obj, jint argc, jobjectArray stringArray) {
|
||||
jboolean iscopy;
|
||||
argcData = (int) argc;
|
||||
argvData[0]="openmw";
|
||||
for (int i = 0; i < argcData; i++) {
|
||||
jstring string = (jstring) (*env).GetObjectArrayElement(stringArray, i);
|
||||
argvData[i+1] = (env)->GetStringUTFChars(string, &iscopy);
|
||||
argvData= new const char * [argcData+1];
|
||||
argvData[0] = "openmw";
|
||||
for (int i = 1; i < argcData+1; i++) {
|
||||
jstring string = (jstring) (*env).GetObjectArrayElement(stringArray, i-1);
|
||||
argvData[i] = (env)->GetStringUTFChars(string, &iscopy);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
extern void SDL_Android_Init(JNIEnv* env, jclass cls);
|
||||
extern int argcData;
|
||||
extern const char *argvData[15];
|
||||
extern const char **argvData;
|
||||
|
||||
int Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls,
|
||||
jobject obj) {
|
||||
|
@ -26,6 +26,7 @@ int Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls,
|
|||
int status;
|
||||
|
||||
status = main(argcData+1, argvData);
|
||||
free (argvData);
|
||||
|
||||
/* Do not issue an exit or the whole application will terminate instead of just the SDL thread */
|
||||
/* exit(status); */
|
||||
|
|
Loading…
Reference in a new issue