Move setenv from engine to split library to allow lazy engine library loading

This commit is contained in:
Alibek Omarov (a1batross) 2017-03-02 22:29:30 +03:00
parent af63c6fd5b
commit 66eacf4839
4 changed files with 45 additions and 1 deletions

View file

@ -37,7 +37,7 @@ APP_ABI := x86 armeabi armeabi-v7a-hard
# ARMv6 and ARMv5 xash3d builds use softfp only and compatible only with softfp mods
# Build both armeabi-v7a-hard and armeabi-v7a supported only for mods, not for engine
APP_MODULES := xash menu client server NanoGL
APP_MODULES := xash menu client server NanoGL jnisetenv
ifeq ($(XASH_SDL),1)
APP_MODULES += SDL2
endif

View file

@ -0,0 +1,13 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := jnisetenv
APP_PLATFORM := android-12
include $(XASH3D_CONFIG)
LOCAL_SRC_FILES := setenv.c
include $(BUILD_SHARED_LIBRARY)

View file

@ -0,0 +1,26 @@
/*
setenv.c -- a jni wrapper for setenv() call for XashActivity
Copyright (C) 2016 a1batross
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#include <stdlib.h>
JAVA_EXPORT int Java_in_celest_xash3d_XashActivity_setenv( JNIEnv* env, jclass clazz, jstring key, jstring value, jboolean overwrite )
{
char* k = (char *) (*env)->GetStringUTFChars(env, key, NULL);
char* v = (char *) (*env)->GetStringUTFChars(env, value, NULL);
int err = setenv(k, v, overwrite);
(*env)->ReleaseStringUTFChars(env, key, k);
(*env)->ReleaseStringUTFChars(env, value, v);
return err;
}

View file

@ -75,6 +75,11 @@ public class XashActivity extends Activity {
private static String SIG = "DMsE8f5hlR7211D8uehbFpbA0n8=";
private static String SIG_TEST = ""; // a1ba: mittorn, add your signature later
// Load the .so
static {
System.loadLibrary("jnisetenv");
}
// Shared between this activity and LauncherActivity
public static boolean dumbAntiPDALifeCheck( Context context )
{