Fix merging, Android: newest irrlicht

This commit is contained in:
MoNTE48 2019-04-01 20:29:07 +02:00
parent 695e833477
commit 351257bd8a
11 changed files with 130 additions and 187 deletions

View File

@ -70,7 +70,7 @@ VORBIS_TIMESTAMP = $(VORBIS_DIR)/timestamp
VORBIS_TIMESTAMP_INT = $(ANDR_ROOT)/deps/vorbis_timestamp VORBIS_TIMESTAMP_INT = $(ANDR_ROOT)/deps/vorbis_timestamp
VORBIS_URL_GIT = https://github.com/MoNTE48/libvorbis-android VORBIS_URL_GIT = https://github.com/MoNTE48/libvorbis-android
IRRLICHT_COMMIT = 58fa0cf3419c2733159fc3c6253634bedada3bfe IRRLICHT_COMMIT = 990d475fbbb2653c95b992937906eb49960d02fb
IRRLICHT_DIR = $(ANDR_ROOT)/deps/irrlicht IRRLICHT_DIR = $(ANDR_ROOT)/deps/irrlicht
IRRLICHT_LIB = $(IRRLICHT_DIR)/lib/Android/libIrrlicht.a IRRLICHT_LIB = $(IRRLICHT_DIR)/lib/Android/libIrrlicht.a
IRRLICHT_TIMESTAMP = $(IRRLICHT_DIR)/timestamp IRRLICHT_TIMESTAMP = $(IRRLICHT_DIR)/timestamp
@ -89,7 +89,8 @@ FREETYPE_DIR = $(ANDR_ROOT)/deps/freetype
FREETYPE_LIB = $(FREETYPE_DIR)/objs/.libs/libfreetype.a FREETYPE_LIB = $(FREETYPE_DIR)/objs/.libs/libfreetype.a
FREETYPE_TIMESTAMP = $(FREETYPE_DIR)/timestamp FREETYPE_TIMESTAMP = $(FREETYPE_DIR)/timestamp
FREETYPE_TIMESTAMP_INT = $(ANDR_ROOT)/deps/freetype_timestamp FREETYPE_TIMESTAMP_INT = $(ANDR_ROOT)/deps/freetype_timestamp
FREETYPE_URL_HTTP = http://download.savannah.gnu.org/releases/freetype/freetype-$(FREETYPE_VERSION).tar.bz2 FREETYPE_URL_HTTP = https://sourceforge.net/projects/freetype/files/freetype2/2.10.0/freetype-$(FREETYPE_VERSION).tar.bz2
ICONV_VERSION = 1.15 ICONV_VERSION = 1.15
ICONV_DIR = $(ANDR_ROOT)/deps/libiconv ICONV_DIR = $(ANDR_ROOT)/deps/libiconv
@ -403,9 +404,10 @@ irrlicht_download :
mkdir -p lib/Android; \ mkdir -p lib/Android; \
patch -p1 < ${ANDR_ROOT}/patches/irrlicht-touchcount.patch || exit 1; \ patch -p1 < ${ANDR_ROOT}/patches/irrlicht-touchcount.patch || exit 1; \
patch -p1 < ${ANDR_ROOT}/patches/irrlicht-back_button.patch || exit 1; \ patch -p1 < ${ANDR_ROOT}/patches/irrlicht-back_button.patch || exit 1; \
patch -p1 < ${ANDR_ROOT}/patches/irrlicht-texturehack.patch || exit 1; \ # patch -p1 < ${ANDR_ROOT}/patches/irrlicht-texturehack.patch || exit 1; \
patch -p1 < ${ANDR_ROOT}/patches/irrlicht-optimization.patch || exit 1; \ patch -p1 < ${ANDR_ROOT}/patches/irrlicht-optimization.patch || exit 1; \
patch -p1 < ${ANDR_ROOT}/patches/irrlicht-native_activity.patch || exit 1; \ patch -p1 < ${ANDR_ROOT}/patches/irrlicht-native_activity.patch || exit 1; \
patch -p1 < ${ANDR_ROOT}/patches/irrlicht-roundingerror.patch || exit 1; \
fi fi
$(IRRLICHT_TIMESTAMP) : irrlicht_download $(IRRLICHT_TIMESTAMP) : irrlicht_download

View File

@ -4,7 +4,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.1.3' classpath 'com.android.tools.build:gradle:3.3.1'
} }
} }
@ -21,10 +21,10 @@ android {
buildToolsVersion "28.0.3" buildToolsVersion "28.0.3"
defaultConfig { defaultConfig {
applicationId "mobi.MultiCraft" applicationId 'mobi.MultiCraft'
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 28 targetSdkVersion 28
versionCode 92 versionCode 114
} }
Properties props = new Properties() Properties props = new Properties()
props.load(new FileInputStream(file("local.properties"))) props.load(new FileInputStream(file("local.properties")))
@ -53,12 +53,14 @@ android {
enable true enable true
reset() reset()
include "armeabi-v7a", "x86" include "armeabi-v7a", "x86"
//include 'armeabi-v7a', 'arm64-v8a', 'x86'
} }
} }
} }
// build multiple APKs for all ABI // build multiple APKs for all ABI
ext.abiCodes = ['armeabi-v7a': 1, x86: 2] ext.abiCodes = ['armeabi-v7a': 0, 'x86': 1]
//ext.abiCodes = ['armeabi-v7a': 0, 'arm64-v8a': 1, 'x86': 2]
import com.android.build.OutputFile import com.android.build.OutputFile
android.applicationVariants.all { variant -> android.applicationVariants.all { variant ->
@ -73,5 +75,5 @@ android.applicationVariants.all { variant ->
} }
dependencies { dependencies {
implementation 'com.android.support:support-compat:28.0.0' implementation 'com.android.support:appcompat-v7:28.0.0'
} }

View File

@ -1,5 +1,2 @@
distributionBase=GRADLE_USER_HOME #Fri Feb 22 20:02:06 CET 2019
distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

110
build/android/gradlew vendored
View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env sh
############################################################################## ##############################################################################
## ##
@ -6,47 +6,6 @@
## ##
############################################################################## ##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
PRG="$0" PRG="$0"
@ -61,9 +20,49 @@ while [ -h "$PRG" ] ; do
fi fi
done done
SAVED="`pwd`" SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&- cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`" APP_HOME="`pwd -P`"
cd "$SAVED" >&- cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@ -90,7 +89,7 @@ location of your Java installation."
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n` MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@ -114,6 +113,7 @@ fi
if $cygwin ; then if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath # We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
@ -154,11 +154,19 @@ if $cygwin ; then
esac esac
fi fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules # Escape application args
function splitJvmOpts() { save () {
JVM_OPTS=("$@") for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
} }
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS APP_ARGS=$(save "$@")
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" # Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

View File

@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell @rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome
@ -46,10 +46,9 @@ echo location of your Java installation.
goto fail goto fail
:init :init
@rem Get command-line arguments, handling Windowz variants @rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args :win9xME_args
@rem Slurp the command line arguments. @rem Slurp the command line arguments.
@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%* set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute :execute
@rem Setup the command line @rem Setup the command line

View File

@ -230,7 +230,6 @@ LOCAL_SRC_FILES := \
jni/src/client/inputhandler.cpp \ jni/src/client/inputhandler.cpp \
jni/src/client/tile.cpp \ jni/src/client/tile.cpp \
jni/src/util/sha256.c \ jni/src/util/sha256.c \
jni/lib/gmp/mini-gmp.c \
jni/src/client/joystick_controller.cpp \ jni/src/client/joystick_controller.cpp \
jni/src/irrlicht_changes/static_text.cpp jni/src/irrlicht_changes/static_text.cpp
@ -296,6 +295,9 @@ LOCAL_SRC_FILES += \
# Freetype2 # Freetype2
LOCAL_SRC_FILES += jni/src/cguittfont/xCGUITTFont.cpp LOCAL_SRC_FILES += jni/src/cguittfont/xCGUITTFont.cpp
# GMP
LOCAL_SRC_FILES += jni/lib/gmp/mini-gmp.c
# libIntl # libIntl
LOCAL_SRC_FILES += deps/libintl/internal/libintl.cpp LOCAL_SRC_FILES += deps/libintl/internal/libintl.cpp

View File

@ -1,13 +1,12 @@
--- irrlicht/source/Irrlicht/CEGLManager.cpp.orig 2018-06-10 16:58:11.357709173 +0200 --- irrlicht/source/Irrlicht/CEGLManager.cpp.orig 2018-04-24 19:27:51.034727946 +0200
+++ irrlicht/source/Irrlicht/CEGLManager.cpp 2018-06-10 16:58:25.100709843 +0200 +++ irrlicht/source/Irrlicht/CEGLManager.cpp 2018-04-24 19:27:55.084614618 +0200
@@ -9,6 +9,10 @@ @@ -8,6 +8,9 @@
#include "irrString.h"
#include "os.h" #include "irrString.h"
#include "os.h"
+#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_) +#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
+#include <android/native_activity.h> +#include <android/native_activity.h>
+#endif +#endif
+
namespace irr namespace irr
{ {
namespace video

View File

@ -0,0 +1,15 @@
--- irrlicht/include/irrMath.h.orig 2019-04-01 22:16:52.000000000 +0200
+++ irrlicht/include/irrMath.h 2019-04-01 22:22:52.000000000 +0200
@@ -198,6 +198,12 @@
}
template <>
+ inline s16 roundingError()
+ {
+ return 0;
+ }
+
+ template <>
inline s32 roundingError()
{
return ROUNDING_ERROR_S32;

View File

@ -1,13 +0,0 @@
--- a/srclib/stdio.in.h 2011-08-07 15:42:06.000000000 +0200
+++ b/srclib/stdio.in.h 2015-06-10 09:27:58.129056262 +0200
@@ -695,8 +696,9 @@ _GL_CXXALIASWARN (gets);
/* It is very rare that the developer ever has full control of stdin,
so any use of gets warrants an unconditional warning. Assume it is
always declared, since it is required by C89. */
-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+/*_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");*/
+#define gets(a) fgets( a, sizeof(*(a)), stdin)
#endif
#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@

View File

@ -1,79 +0,0 @@
package net.minetest.minetest;
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class MainActivity extends Activity {
private final static int PERMISSIONS = 1;
private static final String[] REQUIRED_SDK_PERMISSIONS = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
checkPermission();
} else {
next();
}
}
protected void checkPermission() {
final List<String> missingPermissions = new ArrayList<String>();
// check required permission
for (final String permission : REQUIRED_SDK_PERMISSIONS) {
final int result = ContextCompat.checkSelfPermission(this, permission);
if (result != PackageManager.PERMISSION_GRANTED) {
missingPermissions.add(permission);
}
}
if (!missingPermissions.isEmpty()) {
// request permission
final String[] permissions = missingPermissions
.toArray(new String[missingPermissions.size()]);
ActivityCompat.requestPermissions(this, permissions, PERMISSIONS);
} else {
final int[] grantResults = new int[REQUIRED_SDK_PERMISSIONS.length];
Arrays.fill(grantResults, PackageManager.PERMISSION_GRANTED);
onRequestPermissionsResult(PERMISSIONS, REQUIRED_SDK_PERMISSIONS,
grantResults);
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[],
@NonNull int[] grantResults) {
switch (requestCode) {
case PERMISSIONS:
for (int index = 0; index < permissions.length; index++) {
if (grantResults[index] != PackageManager.PERMISSION_GRANTED) {
// permission not granted - toast and exit
Toast.makeText(this, R.string.not_granted, Toast.LENGTH_LONG).show();
finish();
return;
}
}
// permission were granted - run
next();
break;
}
}
public void next() {
Intent intent = new Intent(this, MtNativeActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
}
}

View File

@ -1140,13 +1140,29 @@ video::IImage * Align2Npot2(video::IImage * image,
core::dimension2d<u32> dim = image->getDimension(); core::dimension2d<u32> dim = image->getDimension();
// Only GLES2 is trusted to correctly report npot support // Only GLES2 is trusted to correctly report npot support
// Note: we cache the boolean result. GL context will never change on Android.
static const bool hasNPotSupport = get_GL_major_version() > 1 && /* F*cking nrz. Broke something again - https://github.com/minetest/minetest/pull/8070
glGetString(GL_EXTENSIONS) && jni/../jni/src/client/tile.cpp:1151:35: error: invalid conversion from 'const GLubyte* {aka const unsigned char*}' to 'const char*' [-fpermissive]
strstr(glGetString(GL_EXTENSIONS), "GL_OES_texture_npot"); strstr(glGetString(GL_EXTENSIONS), "GL_OES_texture_npot");
*/
if (hasNPotSupport) // Back
std::string extensions = (char*) glGetString(GL_EXTENSIONS);
// Note: we cache the boolean result. GL context will never change on Android.
/* Revert
static const bool hasNPotSupport = get_GL_major_version() > 1 &&
glGetString(GL_EXTENSIONS) &&
strstr(glGetString(GL_EXTENSIONS), "GL_OES_texture_npot");
if (hasNPotSupport)
*/
// Back
if (get_GL_major_version() > 1 &&
extensions.find("GL_OES_texture_npot") != std::string::npos) {
// Working :)
return image; return image;
}
unsigned int height = npot2(dim.Height); unsigned int height = npot2(dim.Height);
unsigned int width = npot2(dim.Width); unsigned int width = npot2(dim.Width);
@ -1333,7 +1349,7 @@ bool TextureSource::generateImagePart(std::string part_of_name,
It is an image with a number of cracking stages It is an image with a number of cracking stages
horizontally tiled. horizontally tiled.
*/ */
#if defined(__ANDROID__) || defined(__IOS__) #if defined(__ANDROID__) || defined(__IOS__)
video::IImage *img_crack = m_sourcecache.getOrLoad( video::IImage *img_crack = m_sourcecache.getOrLoad(
"crack_anylength_touch.png", m_device); "crack_anylength_touch.png", m_device);