Fix build

This commit is contained in:
Maksim Gamarnik 2016-05-01 22:39:43 +03:00
parent bb020a7a74
commit 7a8d64c4fa
11 changed files with 61 additions and 103 deletions

View File

@ -254,9 +254,9 @@ vorbis_download :
vorbis : $(VORBIS_LIB)
$(VORBIS_LIB): $(VORBIS_TIMESTAMP)
+ @REFRESH=0; \
+ @REFRESH=0; \
if [ ! -e ${VORBIS_TIMESTAMP_INT} ] ; then \
echo "${VORBIS_TIMESTAMP_INT} doesn't exist"; \
echo "${VORBIS_TIMESTAMP_INT} doesn't exist"; \
REFRESH=1; \
fi; \
if [ ${VORBIS_TIMESTAMP} -nt ${VORBIS_TIMESTAMP_INT} ] ; then \
@ -271,8 +271,8 @@ $(VORBIS_LIB): $(VORBIS_TIMESTAMP)
TARGET_CFLAGS+="${TARGET_CFLAGS_ADDON}" \
TARGET_LDFLAGS+="${TARGET_LDFLAGS_ADDON}" \
TARGET_CXXFLAGS+="${TARGET_CXXFLAGS_ADDON}" || exit 1; \
touch ${OGG_TIMESTAMP}; \
touch ${OGG_TIMESTAMP_INT}; \
touch ${VORBIS_TIMESTAMP}; \
touch ${VORBIS_TIMESTAMP_INT}; \
else \
echo "nothing to be done for libvorbis"; \
fi
@ -374,7 +374,7 @@ $(FREETYPE_LIB) : $(FREETYPE_TIMESTAMP)
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
export CXX=${CROSS_PREFIX}g++; \
export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \
export CPPFLAGS="$${CPPFLAGS} ${TARGET_CFLAGS_ADDON}"; \
export CPPFLAGS="$${CPPFLAGS} ${TARGET_CXXFLAGS_ADDON}"; \
export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \
export LDFLAGS="$${LDFLAGS} ${TARGET_LDFLAGS_ADDON}"; \
CC=${CROSS_PREFIX}gcc ./configure --host=${TARGET_HOST} \
@ -406,8 +406,8 @@ iconv_download :
rm libiconv-${ICONV_VERSION}.tar.gz; \
mv libiconv-${ICONV_VERSION} libiconv; \
cd libiconv; \
patch -p1 < ${ANDR_ROOT}/libiconv_android.patch; \
patch -p1 < ${ANDR_ROOT}/libiconv_stdio.patch; \
patch -p1 < ${ANDR_ROOT}/patches/libiconv_android.patch; \
patch -p1 < ${ANDR_ROOT}/patches/libiconv_stdio.patch; \
fi
iconv : $(ICONV_LIB)
@ -436,7 +436,7 @@ $(ICONV_LIB) : $(ICONV_TIMESTAMP)
export CC=${CROSS_PREFIX}gcc; \
export CXX=${CROSS_PREFIX}g++; \
export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \
export CPPFLAGS="$${CPPFLAGS} ${TARGET_CFLAGS_ADDON}"; \
export CPPFLAGS="$${CPPFLAGS} ${TARGET_CXXFLAGS_ADDON}"; \
export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \
export LDFLAGS="$${LDFLAGS} ${TARGET_LDFLAGS_ADDON}"; \
./configure --enable-static --disable-shared --host=${TARGET_HOST2} || exit 1; \
@ -555,7 +555,7 @@ $(CURL_LIB): $(CURL_TIMESTAMP)
export CXX=${CROSS_PREFIX}g++; \
export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \
#export CPPFLAGS="$${CPPFLAGS} -I${OPENSSL_DIR}/include \
export CPPFLAGS="$${CPPFLAGS} ${TARGET_CFLAGS_ADDON}"; \
export CPPFLAGS="$${CPPFLAGS} ${TARGET_CXXFLAGS_ADDON}"; \
export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \
#export LDFLAGS="$${LDFLAGS} -L${OPENSSL_DIR} ${TARGET_LDFLAGS_ADDON}"; \
export LDFLAGS="$${LDFLAGS} ${TARGET_LDFLAGS_ADDON}"; \
@ -718,19 +718,22 @@ clean_luajit:
$(RM) -R deps/luajit
assets : $(ASSETS_TIMESTAMP)
if [ ! -d ${APP_ROOT}/assets ] ; then \
REFRESH=1; \
@REFRESH=0; \
if [ ! -e ${ASSETS_TIMESTAMP} ] ; then \
REFRESH=1; \
fi; \
if [ $$REFRESH -ne 0 ] ; then \
if [ ${ASSETS_TIMESTAMP} -nt ${ASSETS_TIMESTAMP} ] ; then \
REFRESH=1; \
echo "assets changed, refreshing..."; \
$(MAKE) clean_assets; \
mkdir -p ${PROJ_ROOT}/assets/MultiCraft; \
cp -r ${PROJ_ROOT}/builtin ${APP_ROOT}/assets/MultiCraft; \
mkdir ${APP_ROOT}/assets/MultiCraft/fonts; \
cp -r ${PROJ_ROOT}/fonts/retrovillenc.ttf ${APP_ROOT}/assets/MultiCraft/fonts/; \
cp -r ${PROJ_ROOT}/games ${APP_ROOT}/assets/MultiCraft; \
cp -r ${PROJ_ROOT}/textures ${APP_ROOT}/assets/MultiCraft; \
cd ${APP_ROOT}/assets || exit 1; \
mkdir -p ${APP_ROOT}/assets/MultiCraft; \
cp -r ${PROJ_ROOT}/builtin ${APP_ROOT}/assets/MultiCraft; \
mkdir ${APP_ROOT}/assets/MultiCraft/fonts; \
cp -r ${PROJ_ROOT}/fonts/retrovillenc.ttf ${APP_ROOT}/assets/MultiCraft/fonts/; \
cp -r ${PROJ_ROOT}/games ${APP_ROOT}/assets/MultiCraft; \
cp -r ${PROJ_ROOT}/textures ${APP_ROOT}/assets/MultiCraft; \
cp -r ${PROJ_ROOT}/worlds ${APP_ROOT}/assets/MultiCraft; \
cd ${APP_ROOT}/assets || exit 1; \
find . -name "timestamp" -exec rm {} \; ; \
find . -name "*.blend" -exec rm {} \; ; \
find . -name "*~" -exec rm {} \; ; \
@ -738,10 +741,11 @@ assets : $(ASSETS_TIMESTAMP)
find . -type d -path "*.svn" -exec rm -rf {} \; ; \
find . -type f -path "*.gitignore" -exec rm -rf {} \; ; \
ls -R | grep ":$$" | sed -e 's/:$$//' -e 's/\.//' -e 's/^\///' > "index.txt"; \
find -L MultiCraft > filelist.txt; \
echo "Creating Files.zip"; \
zip -r Files.zip MultiCraft; \
cp ${ANDR_ROOT}/${ASSETS_TIMESTAMP} ${ANDR_ROOT}/${ASSETS_TIMESTAMP}.old; \
find -L MultiCraft > filelist.txt; \
echo "Creating Files.zip"; \
zip -r Files.zip MultiCraft; \
touch ${ASSETS_TIMESTAMP}; \
touch ${ASSETS_TIMESTAMP_INT}; \
else \
echo "nothing to be done for assets"; \
fi
@ -749,10 +753,11 @@ assets : $(ASSETS_TIMESTAMP)
clean_assets :
@$(RM) -r assets
apk: local.properties assets $(ICONV_LIB) $(IRRLICHT_LIB) $(CURL_LIB) $(GMP_LIB) $(LUAJIT_LIB) \ \
$(OPENAL_LIB) $(VORBIS_LIB) prep_srcdir $(ANDR_ROOT)/jni/src/android_version.h \
apk: local.properties $(ICONV_LIB) $(IRRLICHT_LIB) $(CURL_LIB) $(GMP_LIB) $(LUAJIT_LIB) \
$(OPENAL_LIB) $(VORBIS_LIB) prep_srcdir $(ANDR_ROOT)/jni/src/android_version.h \
$(ANDR_ROOT)/jni/src/android_version_githash.h sqlite3_download
@${ANDROID_NDK}/ndk-build NDK_MODULE_PATH=${NDK_MODULE_PATH} \
@$(MAKE) assets; \
${ANDROID_NDK}/ndk-build NDK_MODULE_PATH=${NDK_MODULE_PATH} \
GPROF=${GPROF} APP_ABI=${TARGET_ABI} \
APP_PLATFORM=${APP_PLATFORM} \
TARGET_LIBDIR=${TARGET_LIBDIR} && \
@ -764,7 +769,7 @@ apk: local.properties assets $(ICONV_LIB) $(IRRLICHT_LIB) $(CURL_LIB) $(GMP_LIB)
gradle assemble$$BUILD_TYPE_C && \
echo " Success! =)"; \
ant $$BUILD_TYPE && \
echo "APK stored at: build/outputs/apk/MultiCraft-$$BUILD_TYPE.apk" && \
echo "APK stored at: build/outputs/apk/MultiCraft-$$BUILD_TYPE.apk" && \
echo "You can install it with \`make install_$$BUILD_TYPE\`"
# These Intentionally doesn't depend on their respective build steps,

View File

@ -274,39 +274,6 @@ LOCAL_SRC_FILES += \
# Freetype2
LOCAL_SRC_FILES += jni/src/cguittfont/xCGUITTFont.cpp
# Lua
LOCAL_SRC_FILES += \
jni/src/lua/src/lapi.c \
jni/src/lua/src/lauxlib.c \
jni/src/lua/src/lbaselib.c \
jni/src/lua/src/lcode.c \
jni/src/lua/src/ldblib.c \
jni/src/lua/src/ldebug.c \
jni/src/lua/src/ldo.c \
jni/src/lua/src/ldump.c \
jni/src/lua/src/lfunc.c \
jni/src/lua/src/lgc.c \
jni/src/lua/src/linit.c \
jni/src/lua/src/liolib.c \
jni/src/lua/src/llex.c \
jni/src/lua/src/lmathlib.c \
jni/src/lua/src/lmem.c \
jni/src/lua/src/loadlib.c \
jni/src/lua/src/lobject.c \
jni/src/lua/src/lopcodes.c \
jni/src/lua/src/loslib.c \
jni/src/lua/src/lparser.c \
jni/src/lua/src/lstate.c \
jni/src/lua/src/lstring.c \
jni/src/lua/src/lstrlib.c \
jni/src/lua/src/ltable.c \
jni/src/lua/src/ltablib.c \
jni/src/lua/src/ltm.c \
jni/src/lua/src/lundump.c \
jni/src/lua/src/lvm.c \
jni/src/lua/src/lzio.c \
jni/src/lua/src/print.c
>>>>>>> upstream1/master
# SQLite3
LOCAL_SRC_FILES += deps/sqlite/sqlite3.c

View File

@ -1,2 +1,2 @@
rootProject.name = "Minetest"
rootProject.name = "MultiCraft"

View File

@ -110,7 +110,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("leaves_style", "fancy");
settings->setDefault("connected_glass", "false");
settings->setDefault("smooth_lighting", "true");
settings->setDefault("display_gamma", "1.8");
settings->setDefault("display_gamma", "1.5");
settings->setDefault("texture_path", "");
settings->setDefault("shader_path", "");
settings->setDefault("video_driver", "opengl");
@ -181,7 +181,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("enable_particles", "true");
settings->setDefault("enable_mesh_cache", "false");
settings->setDefault("enable_vbo", "true");
settings->setDefault("enable_minimap", "true");
settings->setDefault("minimap_shape_round", "false");
settings->setDefault("minimap_double_scan_height", "false");
@ -345,7 +345,6 @@ void set_default_settings(Settings *settings)
settings->setDefault("fullscreen", "true");
settings->setDefault("video_driver", "ogles1");
settings->setDefault("touchtarget", "true");
settings->setDefault("TMPFolder","/sdcard/tmp/");
settings->setDefault("touchscreen_threshold","20");
settings->setDefault("smooth_lighting", "false");
settings->setDefault("emergequeue_limit_diskonly", "8");
@ -354,15 +353,16 @@ void set_default_settings(Settings *settings)
settings->setDefault("enable_3d_clouds", "false");
settings->setDefault("fps_max", "30");
settings->setDefault("max_objects_per_block", "20");
settings->setDefault("sqlite_synchronous", "1");
settings->setDefault("sqlite_synchronous", "0");
settings->setDefault("gui_scaling", "1.2");
settings->setDefault("doubletap_jump", "true");
settings->setDefault("server_map_save_interval", "15");
settings->setDefault("client_mapblock_limit", "500");
settings->setDefault("active_block_range", "1");
settings->setDefault("chunksize", "3");
settings->setDefault("directional_colored_fog", "false");
settings->setDefault("viewing_range", "25");
settings->setDefault("viewing_range_secondary", "150");
settings->setDefault("inventory_image_hack", "false");
// check for device with small screen

View File

@ -18,6 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "filesys.h"
#include "porting.h"
#include "util/string.h"
#include <iostream>
#include <stdio.h>
@ -373,7 +374,7 @@ std::string TempPath()
configuration hardcodes mkstemp("/tmp/lua_XXXXXX").
*/
#ifdef __ANDROID__
return DIR_DELIM "sdcard" DIR_DELIM PROJECT_NAME DIR_DELIM "tmp";
return porting::path_cache + DIR_DELIM "tmp";
#else
return DIR_DELIM "tmp";
#endif

View File

@ -3082,10 +3082,22 @@ void Game::toggleFullViewRange(float *statustext_time)
L"Enabled full viewing range"
};
#ifdef __ANDROID__
static s16 other_range = g_settings->getS16("viewing_range_secondary");
// Switch to secondary vrange
s16 range_new = other_range;
other_range = g_settings->getS16("viewing_range");
g_settings->set("viewing_range", itos(range_new));
statustext = utf8_to_wide("Viewing range changed to "
+ itos(range_new));
#else
draw_control->range_all = !draw_control->range_all;
infostream << msg[draw_control->range_all] << std::endl;
statustext = msg[draw_control->range_all];
*statustext_time = 0;
#endif
}

View File

@ -70,9 +70,7 @@ void set_light_table(float gamma)
* of 1.8 the light values set by this function are the same as those
* hardcoded in the initalizer list for the declaration of light_LUT.
*/
// I'm not sure it can be done. But it works just fine! :)
/*static const int adjustments[LIGHT_MAX + 1] = {
static const int adjustments[LIGHT_MAX + 1] = {
7,
7,
7,
@ -88,7 +86,7 @@ void set_light_table(float gamma)
-40,
-25,
0
};*/
};
gamma = rangelim(gamma, 1.0, 3.0);
@ -96,8 +94,7 @@ void set_light_table(float gamma)
for (size_t i = 0; i < LIGHT_MAX; i++) {
light_LUT[i] = (u8)(255 * powf(brightness / 255.0f, gamma));
//light_LUT[i] = rangelim(light_LUT[i] + adjustments[i], 0, 255);
light_LUT[i] = rangelim(light_LUT[i] + 10, 0, 255);
light_LUT[i] = rangelim(light_LUT[i] + adjustments[i], 0, 255);
if (i > 1 && light_LUT[i] < light_LUT[i-1])
light_LUT[i] = light_LUT[i-1] + 1;
brightness += brightness_step;

View File

@ -425,21 +425,12 @@ static void setup_log_params(const Settings &cmd_args)
static bool create_userdata_path()
{
bool success;
#ifdef __ANDROID__
if (!fs::PathExists(porting::path_user)) {
success = fs::CreateDir(porting::path_user);
} else {
success = true;
}
porting::copyAssets();
#else
// Create user data directory
success = fs::CreateDir(porting::path_user);
if (fs::PathExists(porting::path_user))
return true;
#endif
return success;
// Create user data directory
return fs::CreateDir(porting::path_user);
}
static bool init_common(const Settings &cmd_args, int argc, char *argv[])

View File

@ -70,7 +70,7 @@ void android_main(android_app *app)
/* for it right now */
extern "C" {
JNIEXPORT void JNICALL Java_mobi_MultiCraft_GameActivity_putMessageBoxResult(
JNIEnv * env, jclass thiz, jstring text)
JNIEnv *env, jclass j_this, jstring text)
{
errorstream << "Java_mobi_MultiCraft_GameActivity_putMessageBoxResult got: "
<< std::string((const char*)env->GetStringChars(text,0))
@ -107,17 +107,6 @@ jclass findClass(std::string classname)
return (jclass) jnienv->CallObjectMethod(cls, findClass, strClassName);
}
void copyAssets()
{
jmethodID assetcopy = jnienv->GetMethodID(nativeActivity,"copyAssets","()V");
if (assetcopy == 0) {
assert("porting::copyAssets unable to find copy assets method" == 0);
}
jnienv->CallVoidMethod(app_global->activity->clazz, assetcopy);
}
void initAndroid()
{
porting::jnienv = NULL;

View File

@ -48,10 +48,6 @@ void cleanupAndroid();
*/
void initializePathsAndroid();
/**
* use java function to copy media from assets to external storage
*/
void copyAssets();
/**
* show text input dialog in java

View File

@ -197,7 +197,7 @@ void TouchScreenGUI::initButton(touch_gui_button_id id, rect<s32> button_rect,
}
static int getMaxControlPadSize(float density) {
return 290 * density * g_settings->getFloat("hud_scaling");
return 280 * density * g_settings->getFloat("hud_scaling");
}
int TouchScreenGUI::getGuiButtonSize()