forked from mirror/openmw-tes3mp
release jni memory
parent
bd4e832cf3
commit
db10c87b89
@ -1,20 +1,27 @@
|
|||||||
#include "android_commandLine.h"
|
#include "android_commandLine.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const char **argvData;
|
const char **argvData;
|
||||||
int argcData;
|
int argcData;
|
||||||
|
|
||||||
|
extern "C" void releaseArgv();
|
||||||
|
|
||||||
|
void releaseArgv() {
|
||||||
|
delete[] argvData;
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_ui_activity_GameActivity_commandLine(JNIEnv *env,
|
JNIEXPORT void JNICALL Java_ui_activity_GameActivity_commandLine(JNIEnv *env,
|
||||||
jobject obj, jint argc, jobjectArray stringArray) {
|
jobject obj, jint argc, jobjectArray stringArray) {
|
||||||
jboolean iscopy;
|
jboolean iscopy;
|
||||||
argcData = (int) argc;
|
argcData = (int) argc;
|
||||||
argvData= new const char * [argcData+1];
|
argvData = new const char *[argcData + 1];
|
||||||
argvData[0] = "openmw";
|
argvData[0] = "openmw";
|
||||||
for (int i = 1; i < argcData+1; i++) {
|
for (int i = 1; i < argcData + 1; i++) {
|
||||||
jstring string = (jstring) (*env).GetObjectArrayElement(stringArray, i-1);
|
jstring string = (jstring) (env)->GetObjectArrayElement(stringArray,
|
||||||
|
i - 1);
|
||||||
argvData[i] = (env)->GetStringUTFChars(string, &iscopy);
|
argvData[i] = (env)->GetStringUTFChars(string, &iscopy);
|
||||||
|
(env)->DeleteLocalRef(string);
|
||||||
}
|
}
|
||||||
|
(env)->DeleteLocalRef(stringArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue