| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,310 @@ | ||
| LOCAL_PATH := $(call my-dir)/.. | ||
|
|
||
| #LOCAL_ADDRESS_SANITIZER:=true | ||
|
|
||
| include $(CLEAR_VARS) | ||
| LOCAL_MODULE := Irrlicht | ||
| LOCAL_SRC_FILES := deps/irrlicht/lib/Android/libIrrlicht.a | ||
| include $(PREBUILT_STATIC_LIBRARY) | ||
|
|
||
| #include $(CLEAR_VARS) | ||
| #LOCAL_MODULE := LevelDB | ||
| #LOCAL_SRC_FILES := deps/leveldb/libleveldb.a | ||
| #include $(PREBUILT_STATIC_LIBRARY) | ||
|
|
||
| include $(CLEAR_VARS) | ||
| LOCAL_MODULE := curl | ||
| LOCAL_SRC_FILES := deps/curl-7.35.0/lib/.libs/libcurl.a | ||
| include $(PREBUILT_STATIC_LIBRARY) | ||
|
|
||
| include $(CLEAR_VARS) | ||
| LOCAL_MODULE := freetype | ||
| LOCAL_SRC_FILES := deps/freetype2-android/Android/obj/local/$(TARGET_ARCH_ABI)/libfreetype2-static.a | ||
| include $(PREBUILT_STATIC_LIBRARY) | ||
|
|
||
| include $(CLEAR_VARS) | ||
| LOCAL_MODULE := openal | ||
| LOCAL_SRC_FILES := deps/openal-soft/libs/$(TARGET_LIBDIR)/libopenal.so | ||
| include $(PREBUILT_SHARED_LIBRARY) | ||
|
|
||
| include $(CLEAR_VARS) | ||
| LOCAL_MODULE := ogg | ||
| LOCAL_SRC_FILES := deps/libvorbis-libogg-android/libs/$(TARGET_LIBDIR)/libogg.so | ||
| include $(PREBUILT_SHARED_LIBRARY) | ||
|
|
||
| include $(CLEAR_VARS) | ||
| LOCAL_MODULE := vorbis | ||
| LOCAL_SRC_FILES := deps/libvorbis-libogg-android/libs/$(TARGET_LIBDIR)/libvorbis.so | ||
| include $(PREBUILT_SHARED_LIBRARY) | ||
|
|
||
| include $(CLEAR_VARS) | ||
| LOCAL_MODULE := ssl | ||
| LOCAL_SRC_FILES := deps/openssl-android/libs/$(TARGET_LIBDIR)/libssl.so | ||
| include $(PREBUILT_SHARED_LIBRARY) | ||
|
|
||
| include $(CLEAR_VARS) | ||
| LOCAL_MODULE := crypto | ||
| LOCAL_SRC_FILES := deps/openssl-android/libs/$(TARGET_LIBDIR)/libcrypto.so | ||
| include $(PREBUILT_SHARED_LIBRARY) | ||
|
|
||
|
|
||
| include $(CLEAR_VARS) | ||
| LOCAL_MODULE := minetest | ||
|
|
||
| LOCAL_CPP_FEATURES += exceptions | ||
|
|
||
| ifdef GPROF | ||
| GPROF_DEF=-DGPROF | ||
| endif | ||
|
|
||
| LOCAL_CFLAGS := -D_IRR_ANDROID_PLATFORM_ \ | ||
| -DHAVE_TOUCHSCREENGUI \ | ||
| -DUSE_CURL=1 \ | ||
| -DUSE_SOUND=1 \ | ||
| -DUSE_FREETYPE=1 \ | ||
| $(GPROF_DEF) \ | ||
| -pipe -fstrict-aliasing | ||
|
|
||
| ifndef NDEBUG | ||
| LOCAL_CFLAGS += -g -D_DEBUG -O0 -fno-omit-frame-pointer | ||
| else | ||
| LOCAL_CFLAGS += -fexpensive-optimizations -O3 | ||
| endif | ||
|
|
||
| ifdef GPROF | ||
| PROFILER_LIBS := android-ndk-profiler | ||
| LOCAL_CFLAGS += -pg | ||
| endif | ||
|
|
||
| # LOCAL_CFLAGS += -fsanitize=address | ||
| # LOCAL_LDFLAGS += -fsanitize=address | ||
|
|
||
| ifeq ($(TARGET_ARCH_ABI),x86) | ||
| LOCAL_CFLAGS += -fno-stack-protector | ||
| endif | ||
|
|
||
| LOCAL_C_INCLUDES := \ | ||
| jni/src jni/src/sqlite \ | ||
| jni/src/script \ | ||
| jni/src/lua/src \ | ||
| jni/src/json \ | ||
| jni/src/cguittfont \ | ||
| deps/irrlicht/include \ | ||
| deps/freetype2-android/include \ | ||
| deps/curl-7.35.0/include \ | ||
| deps/openal-soft/jni/OpenAL/include \ | ||
| deps/libvorbis-libogg-android/jni/include | ||
|
|
||
| # deps/leveldb/include \ | ||
| LOCAL_SRC_FILES := \ | ||
| jni/src/ban.cpp \ | ||
| jni/src/base64.cpp \ | ||
| jni/src/biome.cpp \ | ||
| jni/src/camera.cpp \ | ||
| jni/src/cavegen.cpp \ | ||
| jni/src/chat.cpp \ | ||
| jni/src/client.cpp \ | ||
| jni/src/clientiface.cpp \ | ||
| jni/src/clientmap.cpp \ | ||
| jni/src/clientmedia.cpp \ | ||
| jni/src/clientobject.cpp \ | ||
| jni/src/clouds.cpp \ | ||
| jni/src/collision.cpp \ | ||
| jni/src/connection.cpp \ | ||
| jni/src/content_abm.cpp \ | ||
| jni/src/content_cao.cpp \ | ||
| jni/src/content_cso.cpp \ | ||
| jni/src/content_mapblock.cpp \ | ||
| jni/src/content_mapnode.cpp \ | ||
| jni/src/content_nodemeta.cpp \ | ||
| jni/src/content_sao.cpp \ | ||
| jni/src/convert_json.cpp \ | ||
| jni/src/craftdef.cpp \ | ||
| jni/src/database-dummy.cpp \ | ||
| jni/src/database-sqlite3.cpp \ | ||
| jni/src/database.cpp \ | ||
| jni/src/debug.cpp \ | ||
| jni/src/defaultsettings.cpp \ | ||
| jni/src/drawscene.cpp \ | ||
| jni/src/dungeongen.cpp \ | ||
| jni/src/emerge.cpp \ | ||
| jni/src/environment.cpp \ | ||
| jni/src/filecache.cpp \ | ||
| jni/src/filesys.cpp \ | ||
| jni/src/game.cpp \ | ||
| jni/src/genericobject.cpp \ | ||
| jni/src/gettext.cpp \ | ||
| jni/src/guiChatConsole.cpp \ | ||
| jni/src/guiEngine.cpp \ | ||
| jni/src/guiFileSelectMenu.cpp \ | ||
| jni/src/guiFormSpecMenu.cpp \ | ||
| jni/src/guiKeyChangeMenu.cpp \ | ||
| jni/src/guiPasswordChange.cpp \ | ||
| jni/src/guiTable.cpp \ | ||
| jni/src/guiVolumeChange.cpp \ | ||
| jni/src/httpfetch.cpp \ | ||
| jni/src/hud.cpp \ | ||
| jni/src/inventory.cpp \ | ||
| jni/src/inventorymanager.cpp \ | ||
| jni/src/itemdef.cpp \ | ||
| jni/src/keycode.cpp \ | ||
| jni/src/light.cpp \ | ||
| jni/src/localplayer.cpp \ | ||
| jni/src/log.cpp \ | ||
| jni/src/main.cpp \ | ||
| jni/src/map.cpp \ | ||
| jni/src/mapblock.cpp \ | ||
| jni/src/mapblock_mesh.cpp \ | ||
| jni/src/mapgen.cpp \ | ||
| jni/src/mapgen_indev.cpp \ | ||
| jni/src/mapgen_math.cpp \ | ||
| jni/src/mapgen_singlenode.cpp \ | ||
| jni/src/mapgen_v6.cpp \ | ||
| jni/src/mapgen_v7.cpp \ | ||
| jni/src/mapnode.cpp \ | ||
| jni/src/mapsector.cpp \ | ||
| jni/src/mesh.cpp \ | ||
| jni/src/mods.cpp \ | ||
| jni/src/nameidmapping.cpp \ | ||
| jni/src/nodedef.cpp \ | ||
| jni/src/nodemetadata.cpp \ | ||
| jni/src/nodetimer.cpp \ | ||
| jni/src/noise.cpp \ | ||
| jni/src/object_properties.cpp \ | ||
| jni/src/particles.cpp \ | ||
| jni/src/pathfinder.cpp \ | ||
| jni/src/player.cpp \ | ||
| jni/src/porting_android.cpp \ | ||
| jni/src/porting.cpp \ | ||
| jni/src/quicktune.cpp \ | ||
| jni/src/rollback.cpp \ | ||
| jni/src/rollback_interface.cpp \ | ||
| jni/src/serialization.cpp \ | ||
| jni/src/server.cpp \ | ||
| jni/src/serverlist.cpp \ | ||
| jni/src/serverobject.cpp \ | ||
| jni/src/sha1.cpp \ | ||
| jni/src/shader.cpp \ | ||
| jni/src/sky.cpp \ | ||
| jni/src/socket.cpp \ | ||
| jni/src/sound.cpp \ | ||
| jni/src/sound_openal.cpp \ | ||
| jni/src/staticobject.cpp \ | ||
| jni/src/subgame.cpp \ | ||
| jni/src/test.cpp \ | ||
| jni/src/tile.cpp \ | ||
| jni/src/tool.cpp \ | ||
| jni/src/treegen.cpp \ | ||
| jni/src/version.cpp \ | ||
| jni/src/voxel.cpp \ | ||
| jni/src/voxelalgorithms.cpp \ | ||
| jni/src/util/directiontables.cpp \ | ||
| jni/src/util/numeric.cpp \ | ||
| jni/src/util/pointedthing.cpp \ | ||
| jni/src/util/serialize.cpp \ | ||
| jni/src/util/string.cpp \ | ||
| jni/src/util/timetaker.cpp \ | ||
| jni/src/touchscreengui.cpp | ||
|
|
||
| # jni/src/database-leveldb.cpp \ | ||
| # lua api | ||
| LOCAL_SRC_FILES += \ | ||
| jni/src/script/common/c_content.cpp \ | ||
| jni/src/script/common/c_converter.cpp \ | ||
| jni/src/script/common/c_internal.cpp \ | ||
| jni/src/script/common/c_types.cpp \ | ||
| jni/src/script/cpp_api/s_base.cpp \ | ||
| jni/src/script/cpp_api/s_entity.cpp \ | ||
| jni/src/script/cpp_api/s_env.cpp \ | ||
| jni/src/script/cpp_api/s_inventory.cpp \ | ||
| jni/src/script/cpp_api/s_item.cpp \ | ||
| jni/src/script/cpp_api/s_mainmenu.cpp \ | ||
| jni/src/script/cpp_api/s_node.cpp \ | ||
| jni/src/script/cpp_api/s_nodemeta.cpp \ | ||
| jni/src/script/cpp_api/s_player.cpp \ | ||
| jni/src/script/cpp_api/s_server.cpp \ | ||
| jni/src/script/cpp_api/s_async.cpp \ | ||
| jni/src/script/lua_api/l_base.cpp \ | ||
| jni/src/script/lua_api/l_craft.cpp \ | ||
| jni/src/script/lua_api/l_env.cpp \ | ||
| jni/src/script/lua_api/l_inventory.cpp \ | ||
| jni/src/script/lua_api/l_item.cpp \ | ||
| jni/src/script/lua_api/l_mainmenu.cpp \ | ||
| jni/src/script/lua_api/l_mapgen.cpp \ | ||
| jni/src/script/lua_api/l_nodemeta.cpp \ | ||
| jni/src/script/lua_api/l_nodetimer.cpp \ | ||
| jni/src/script/lua_api/l_noise.cpp \ | ||
| jni/src/script/lua_api/l_object.cpp \ | ||
| jni/src/script/lua_api/l_particles.cpp \ | ||
| jni/src/script/lua_api/l_rollback.cpp \ | ||
| jni/src/script/lua_api/l_server.cpp \ | ||
| jni/src/script/lua_api/l_settings.cpp \ | ||
| jni/src/script/lua_api/l_util.cpp \ | ||
| jni/src/script/lua_api/l_vmanip.cpp \ | ||
| jni/src/script/scripting_game.cpp \ | ||
| jni/src/script/scripting_mainmenu.cpp | ||
|
|
||
| #freetype2 support | ||
| 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 | ||
|
|
||
| # sqlite | ||
| LOCAL_SRC_FILES += jni/src/sqlite/sqlite3.c | ||
|
|
||
| # jthread | ||
| LOCAL_SRC_FILES += \ | ||
| jni/src/jthread/pthread/jevent.cpp \ | ||
| jni/src/jthread/pthread/jmutex.cpp \ | ||
| jni/src/jthread/pthread/jsemaphore.cpp \ | ||
| jni/src/jthread/pthread/jthread.cpp | ||
|
|
||
| # json | ||
| LOCAL_SRC_FILES += jni/src/json/jsoncpp.cpp | ||
|
|
||
| LOCAL_SHARED_LIBRARIES := openal ogg vorbis ssl crypto | ||
| LOCAL_STATIC_LIBRARIES := Irrlicht freetype curl android_native_app_glue $(PROFILER_LIBS) | ||
| # LevelDB | ||
| LOCAL_LDLIBS := -lEGL -llog -lGLESv1_CM -lGLESv2 -lz -landroid | ||
|
|
||
| include $(BUILD_SHARED_LIBRARY) | ||
|
|
||
| # at the end of Android.mk | ||
| ifdef GPROF | ||
| $(call import-module,android-ndk-profiler) | ||
| endif | ||
| $(call import-module,android/native_app_glue) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # NDK_TOOLCHAIN_VERSION := clang3.3 | ||
|
|
||
| APP_PLATFORM := android-9 | ||
| APP_MODULES := minetest | ||
| APP_STL := gnustl_static | ||
|
|
||
| APP_CPPFLAGS += -fexceptions | ||
| APP_GNUSTL_FORCE_CPP_FEATURES := rtti |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| --- libvorbis-libogg-android/jni/libvorbis-jni/Android.mk.orig 2014-06-17 19:22:50.621559073 +0200 | ||
| +++ libvorbis-libogg-android/jni/libvorbis-jni/Android.mk 2014-06-17 19:38:20.641581140 +0200 | ||
| @@ -4,9 +4,6 @@ | ||
|
|
||
| LOCAL_MODULE := vorbis-jni | ||
| LOCAL_CFLAGS += -I$(LOCAL_PATH)/../include -fsigned-char | ||
| -ifeq ($(TARGET_ARCH),arm) | ||
| - LOCAL_CFLAGS += -march=armv6 -marm -mfloat-abi=softfp -mfpu=vfp | ||
| -endif | ||
|
|
||
| LOCAL_SHARED_LIBRARIES := libogg libvorbis | ||
|
|
||
| --- libvorbis-libogg-android/jni/libvorbis/Android.mk.orig 2014-06-17 19:22:39.077558797 +0200 | ||
| +++ libvorbis-libogg-android/jni/libvorbis/Android.mk 2014-06-17 19:38:52.121581887 +0200 | ||
| @@ -4,9 +4,6 @@ | ||
|
|
||
| LOCAL_MODULE := libvorbis | ||
| LOCAL_CFLAGS += -I$(LOCAL_PATH)/../include -ffast-math -fsigned-char | ||
| -ifeq ($(TARGET_ARCH),arm) | ||
| - LOCAL_CFLAGS += -march=armv6 -marm -mfloat-abi=softfp -mfpu=vfp | ||
| -endif | ||
| LOCAL_SHARED_LIBRARIES := libogg | ||
|
|
||
| LOCAL_SRC_FILES := \ | ||
| --- libvorbis-libogg-android/jni/libogg/Android.mk.orig 2014-06-17 19:22:33.965558675 +0200 | ||
| +++ libvorbis-libogg-android/jni/libogg/Android.mk 2014-06-17 19:38:25.337581252 +0200 | ||
| @@ -4,10 +4,6 @@ | ||
|
|
||
| LOCAL_MODULE := libogg | ||
| LOCAL_CFLAGS += -I$(LOCAL_PATH)/../include -ffast-math -fsigned-char | ||
| -ifeq ($(TARGET_ARCH),arm) | ||
| - LOCAL_CFLAGS += -march=armv6 -marm -mfloat-abi=softfp -mfpu=vfp | ||
| -endif | ||
| - | ||
|
|
||
| LOCAL_SRC_FILES := \ | ||
| bitwise.c \ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| target=android-10 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:layout_width="fill_parent" | ||
| android:layout_height="fill_parent" | ||
| android:orientation="vertical" > | ||
|
|
||
| <ProgressBar | ||
| android:id="@+id/progressBar1" | ||
| style="?android:attr/progressBarStyleHorizontal" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:layout_gravity="center_vertical" /> | ||
|
|
||
| <TextView | ||
| android:id="@+id/textView1" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:layout_gravity="center_horizontal" | ||
| android:text="preparing media ..." | ||
| android:textAppearance="?android:attr/textAppearanceSmall" /> | ||
|
|
||
| </LinearLayout> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <resources> | ||
| <style name="Theme.Transparent" parent="android:Theme"> | ||
| <item name="android:windowIsTranslucent">true</item> | ||
| <item name="android:windowBackground">@android:color/transparent</item> | ||
| <item name="android:windowContentOverlay">@null</item> | ||
| <item name="android:windowNoTitle">true</item> | ||
| <item name="android:windowIsFloating">true</item> | ||
| <item name="android:backgroundDimEnabled">false</item> | ||
| </style> | ||
| </resources> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,288 @@ | ||
| package org.minetest.minetest; | ||
|
|
||
| import java.io.BufferedReader; | ||
| import java.io.File; | ||
| import java.io.FileOutputStream; | ||
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
| import java.io.InputStreamReader; | ||
| import java.io.OutputStream; | ||
| import java.util.Vector; | ||
|
|
||
| import android.app.Activity; | ||
| import android.content.res.AssetFileDescriptor; | ||
|
|
||
| import android.os.AsyncTask; | ||
| import android.os.Bundle; | ||
| import android.os.Environment; | ||
| import android.util.Log; | ||
| import android.view.Display; | ||
| import android.widget.ProgressBar; | ||
| import android.widget.TextView; | ||
|
|
||
| public class MinetestAssetCopy extends Activity { | ||
|
|
||
| @Override | ||
| public void onCreate(Bundle savedInstanceState) { | ||
| super.onCreate(savedInstanceState); | ||
|
|
||
| setContentView(R.layout.assetcopy); | ||
|
|
||
| m_ProgressBar = (ProgressBar) findViewById(R.id.progressBar1); | ||
| m_Filename = (TextView) findViewById(R.id.textView1); | ||
|
|
||
| Display display = getWindowManager().getDefaultDisplay(); | ||
| m_ProgressBar.getLayoutParams().width = (int) (display.getWidth() * 0.8); | ||
| m_ProgressBar.invalidate(); | ||
|
|
||
| m_AssetCopy = new copyAssetTask(); | ||
| m_AssetCopy.execute(); | ||
| } | ||
|
|
||
| ProgressBar m_ProgressBar; | ||
| TextView m_Filename; | ||
|
|
||
| copyAssetTask m_AssetCopy; | ||
|
|
||
| private class copyAssetTask extends AsyncTask<String, Integer, String>{ | ||
|
|
||
| private void copyElement(String name, String path) { | ||
| String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath(); | ||
| String full_path; | ||
| if (path != "") { | ||
| full_path = path + "/" + name; | ||
| } | ||
| else { | ||
| full_path = name; | ||
| } | ||
| //is a folder read asset list | ||
| if (m_foldernames.contains(full_path)) { | ||
| m_Foldername = full_path; | ||
| publishProgress(0); | ||
| File current_folder = new File(baseDir + "/" + full_path); | ||
| if (!current_folder.exists()) { | ||
| if (!current_folder.mkdirs()) { | ||
| Log.w("MinetestAssetCopy","\t failed create folder: " + baseDir + "/" + full_path); | ||
| } | ||
| else { | ||
| Log.w("MinetestAssetCopy","\t created folder: " + baseDir + "/" + full_path); | ||
| } | ||
| } | ||
| try { | ||
| String[] current_assets = getAssets().list(full_path); | ||
| for(int i=0; i < current_assets.length; i++) { | ||
| copyElement(current_assets[i],full_path); | ||
| } | ||
| } catch (IOException e) { | ||
| Log.w("MinetestAssetCopy","\t failed to read contents of folder"); | ||
| // TODO Auto-generated catch block | ||
| e.printStackTrace(); | ||
| } | ||
| } | ||
| //is a file just copy | ||
| else { | ||
| boolean refresh = true; | ||
|
|
||
| File testme = new File(baseDir + "/" + full_path); | ||
|
|
||
| long asset_filesize = -1; | ||
| long stored_filesize = -1; | ||
|
|
||
| if (testme.exists()) { | ||
| try { | ||
| AssetFileDescriptor fd = getAssets().openFd(full_path); | ||
| asset_filesize = fd.getLength(); | ||
| fd.close(); | ||
| } catch (IOException e) { | ||
| refresh = true; | ||
| m_asset_size_unknown.add(full_path); | ||
| } | ||
|
|
||
| stored_filesize = testme.length(); | ||
|
|
||
| if (asset_filesize == stored_filesize) { | ||
| refresh = false; | ||
| } | ||
|
|
||
| } | ||
|
|
||
| if (refresh) { | ||
| m_tocopy.add(full_path); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private long getFullSize(String filename) { | ||
| long size = 0; | ||
| try { | ||
| InputStream src = getAssets().open(filename); | ||
| byte[] buf = new byte[1024]; | ||
|
|
||
| int len = 0; | ||
| while ((len = src.read(buf)) > 0) { | ||
| size += len; | ||
| } | ||
| } | ||
| catch (IOException e) { | ||
| e.printStackTrace(); | ||
| } | ||
| return size; | ||
| } | ||
|
|
||
| @Override | ||
| protected String doInBackground(String... files) { | ||
|
|
||
| m_foldernames = new Vector<String>(); | ||
| m_tocopy = new Vector<String>(); | ||
| m_asset_size_unknown = new Vector<String>(); | ||
| String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath() + "/"; | ||
|
|
||
| File TempFolder = new File(baseDir + "Minetest/tmp/"); | ||
|
|
||
| if (!TempFolder.exists()) { | ||
| TempFolder.mkdir(); | ||
| } | ||
| else { | ||
| File[] todel = TempFolder.listFiles(); | ||
|
|
||
| for(int i=0; i < todel.length; i++) { | ||
| Log.w("MinetestAssetCopy","deleting: " + todel[i].getAbsolutePath()); | ||
| todel[i].delete(); | ||
| } | ||
| } | ||
|
|
||
| // add a .nomedia file | ||
| try { | ||
| OutputStream dst = new FileOutputStream(baseDir + "Minetest/.nomedia"); | ||
| dst.close(); | ||
| } catch (IOException e) { | ||
| Log.w("MinetestAssetCopy","Failed to create .nomedia file"); | ||
| e.printStackTrace(); | ||
| } | ||
|
|
||
| try { | ||
| InputStream is = getAssets().open("index.txt"); | ||
| BufferedReader reader = new BufferedReader(new InputStreamReader(is)); | ||
|
|
||
| String line = reader.readLine(); | ||
| while(line != null){ | ||
| m_foldernames.add(line); | ||
| line = reader.readLine(); | ||
| } | ||
| } catch (IOException e1) { | ||
| // TODO Auto-generated catch block | ||
| e1.printStackTrace(); | ||
| } | ||
|
|
||
| copyElement("Minetest",""); | ||
|
|
||
| m_copy_started = true; | ||
| m_ProgressBar.setMax(m_tocopy.size()); | ||
|
|
||
| for (int i = 0; i < m_tocopy.size(); i++) { | ||
| try { | ||
| String filename = m_tocopy.get(i); | ||
| publishProgress(i); | ||
|
|
||
| boolean asset_size_unknown = false; | ||
| long filesize = -1; | ||
|
|
||
| if (m_asset_size_unknown.contains(filename)) { | ||
| File testme = new File(baseDir + "/" + filename); | ||
|
|
||
| if(testme.exists()) { | ||
| filesize = testme.length(); | ||
| } | ||
| asset_size_unknown = true; | ||
| } | ||
|
|
||
| InputStream src; | ||
| try { | ||
| src = getAssets().open(filename); | ||
| } catch (IOException e) { | ||
| Log.w("MinetestAssetCopy","Copying file: " + filename + " FAILED (not in assets)"); | ||
| // TODO Auto-generated catch block | ||
| e.printStackTrace(); | ||
| continue; | ||
| } | ||
|
|
||
| // Transfer bytes from in to out | ||
| byte[] buf = new byte[1*1024]; | ||
| int len = src.read(buf, 0, 1024); | ||
|
|
||
| /* following handling is crazy but we need to deal with */ | ||
| /* compressed assets.Flash chips limited livetime sue to */ | ||
| /* write operations, we can't allow large files to destroy */ | ||
| /* users flash. */ | ||
| if (asset_size_unknown) { | ||
| if ( (len > 0) && (len < buf.length) && (len == filesize)) { | ||
| src.close(); | ||
| continue; | ||
| } | ||
|
|
||
| if (len == buf.length) { | ||
| src.close(); | ||
| long size = getFullSize(filename); | ||
| if ( size == filesize) { | ||
| continue; | ||
| } | ||
| src = getAssets().open(filename); | ||
| len = src.read(buf, 0, 1024); | ||
| } | ||
| } | ||
| if (len > 0) { | ||
| int total_filesize = 0; | ||
| OutputStream dst; | ||
| try { | ||
| dst = new FileOutputStream(baseDir + "/" + filename); | ||
| } catch (IOException e) { | ||
| Log.w("MinetestAssetCopy","Copying file: " + baseDir + | ||
| "/" + filename + " FAILED (couldn't open output file)"); | ||
| e.printStackTrace(); | ||
| src.close(); | ||
| continue; | ||
| } | ||
| dst.write(buf, 0, len); | ||
| total_filesize += len; | ||
|
|
||
| while ((len = src.read(buf)) > 0) { | ||
| dst.write(buf, 0, len); | ||
| total_filesize += len; | ||
| } | ||
|
|
||
| dst.close(); | ||
| Log.w("MinetestAssetCopy","Copied file: " + m_tocopy.get(i) + " (" + total_filesize + " bytes)"); | ||
| } | ||
| else if (len < 0) { | ||
| Log.w("MinetestAssetCopy","Copying file: " + m_tocopy.get(i) + " failed, size < 0"); | ||
| } | ||
| src.close(); | ||
| } catch (IOException e) { | ||
| Log.w("MinetestAssetCopy","Copying file: " + m_tocopy.get(i) + " failed"); | ||
| e.printStackTrace(); | ||
| } | ||
| } | ||
|
|
||
| return ""; | ||
| } | ||
|
|
||
| protected void onProgressUpdate(Integer... progress) { | ||
| if (m_copy_started) { | ||
| m_ProgressBar.setProgress(progress[0]); | ||
| m_Filename.setText(m_tocopy.get(progress[0])); | ||
| } | ||
| else { | ||
| m_Filename.setText("scanning " + m_Foldername + " ..."); | ||
| } | ||
| } | ||
|
|
||
| protected void onPostExecute (String result) { | ||
| finish(); | ||
| } | ||
| boolean m_copy_started = false; | ||
| String m_Foldername = "media"; | ||
| Vector<String> m_foldernames; | ||
| Vector<String> m_tocopy; | ||
| Vector<String> m_asset_size_unknown; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| package org.minetest.minetest; | ||
|
|
||
| import android.app.Activity; | ||
| import android.app.AlertDialog; | ||
| import android.content.DialogInterface; | ||
| import android.content.Intent; | ||
| import android.os.Bundle; | ||
| import android.text.InputType; | ||
| import android.util.Log; | ||
| import android.view.KeyEvent; | ||
| import android.view.View; | ||
| import android.view.View.OnKeyListener; | ||
| import android.widget.EditText; | ||
|
|
||
| public class MinetestTextEntry extends Activity { | ||
| public AlertDialog mTextInputDialog; | ||
| public EditText mTextInputWidget; | ||
|
|
||
| private final int MultiLineTextInput = 1; | ||
| private final int SingleLineTextInput = 2; | ||
| private final int SingleLinePasswordInput = 3; | ||
|
|
||
| @Override | ||
| public void onCreate(Bundle savedInstanceState) { | ||
| super.onCreate(savedInstanceState); | ||
|
|
||
| Bundle b = getIntent().getExtras(); | ||
| String acceptButton = b.getString("EnterButton"); | ||
| String hint = b.getString("hint"); | ||
| String current = b.getString("current"); | ||
| int editType = b.getInt("editType"); | ||
|
|
||
| AlertDialog.Builder builder = new AlertDialog.Builder(this); | ||
| mTextInputWidget = new EditText(this); | ||
| mTextInputWidget.setHint(hint); | ||
| mTextInputWidget.setText(current); | ||
| mTextInputWidget.setMinWidth(300); | ||
| if (editType == SingleLinePasswordInput) { | ||
| mTextInputWidget.setInputType(InputType.TYPE_CLASS_TEXT | | ||
| InputType.TYPE_TEXT_VARIATION_PASSWORD); | ||
| } | ||
| else { | ||
| mTextInputWidget.setInputType(InputType.TYPE_CLASS_TEXT); | ||
| } | ||
|
|
||
|
|
||
| builder.setView(mTextInputWidget); | ||
|
|
||
| if (editType == MultiLineTextInput) { | ||
| builder.setPositiveButton(acceptButton, new DialogInterface.OnClickListener() { | ||
| public void onClick(DialogInterface dialog, int whichButton) | ||
| { pushResult(mTextInputWidget.getText().toString()); } | ||
| }); | ||
| } | ||
|
|
||
| builder.setOnCancelListener(new DialogInterface.OnCancelListener() { | ||
| public void onCancel(DialogInterface dialog) { | ||
| cancelDialog(); | ||
| } | ||
| }); | ||
|
|
||
| mTextInputWidget.setOnKeyListener(new OnKeyListener() { | ||
| @Override | ||
| public boolean onKey(View view, int KeyCode, KeyEvent event) { | ||
| if ( KeyCode == KeyEvent.KEYCODE_ENTER){ | ||
|
|
||
| pushResult(mTextInputWidget.getText().toString()); | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
| }); | ||
|
|
||
| mTextInputDialog = builder.create(); | ||
| mTextInputDialog.show(); | ||
| } | ||
|
|
||
| public void pushResult(String text) { | ||
| Intent resultData = new Intent(); | ||
| resultData.putExtra("text", text); | ||
| setResult(Activity.RESULT_OK,resultData); | ||
| mTextInputDialog.dismiss(); | ||
| finish(); | ||
| } | ||
|
|
||
| public void cancelDialog() { | ||
| setResult(Activity.RESULT_CANCELED); | ||
| mTextInputDialog.dismiss(); | ||
| finish(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| package org.minetest.minetest; | ||
|
|
||
| import android.app.NativeActivity; | ||
| import android.content.Intent; | ||
| import android.os.Bundle; | ||
| import android.util.Log; | ||
| import android.view.WindowManager; | ||
|
|
||
| public class MtNativeActivity extends NativeActivity { | ||
| @Override | ||
| public void onCreate(Bundle savedInstanceState) { | ||
| super.onCreate(savedInstanceState); | ||
| m_MessagReturnCode = -1; | ||
| m_MessageReturnValue = ""; | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void onDestroy() { | ||
| super.onDestroy(); | ||
| } | ||
|
|
||
|
|
||
| public void copyAssets() { | ||
| Intent intent = new Intent(this, MinetestAssetCopy.class); | ||
| startActivity(intent); | ||
| } | ||
|
|
||
| public void showDialog(String acceptButton, String hint, String current, | ||
| int editType) { | ||
|
|
||
| Intent intent = new Intent(this, MinetestTextEntry.class); | ||
| Bundle params = new Bundle(); | ||
| params.putString("acceptButton", acceptButton); | ||
| params.putString("hint", hint); | ||
| params.putString("current", current); | ||
| params.putInt("editType", editType); | ||
| intent.putExtras(params); | ||
| startActivityForResult(intent, 101); | ||
| m_MessageReturnValue = ""; | ||
| m_MessagReturnCode = -1; | ||
| } | ||
|
|
||
| public static native void putMessageBoxResult(String text); | ||
|
|
||
| /* ugly code to workaround putMessageBoxResult not beeing found */ | ||
| public int getDialogState() { | ||
| return m_MessagReturnCode; | ||
| } | ||
|
|
||
| public String getDialogValue() { | ||
| m_MessagReturnCode = -1; | ||
| return m_MessageReturnValue; | ||
| } | ||
|
|
||
| public float getDensity() { | ||
| return getResources().getDisplayMetrics().density; | ||
| } | ||
|
|
||
| public int getDisplayWidth() { | ||
| return getResources().getDisplayMetrics().widthPixels; | ||
| } | ||
|
|
||
| public int getDisplayHeight() { | ||
| return getResources().getDisplayMetrics().heightPixels; | ||
| } | ||
|
|
||
| @Override | ||
| protected void onActivityResult(int requestCode, int resultCode, | ||
| Intent data) { | ||
| if (requestCode == 101) { | ||
| if (resultCode == RESULT_OK) { | ||
| String text = data.getStringExtra("text"); | ||
| m_MessagReturnCode = 0; | ||
| m_MessageReturnValue = text; | ||
| } | ||
| else { | ||
| m_MessagReturnCode = 1; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| static { | ||
| System.loadLibrary("openal"); | ||
| System.loadLibrary("ogg"); | ||
| System.loadLibrary("vorbis"); | ||
| System.loadLibrary("ssl"); | ||
| System.loadLibrary("crypto"); | ||
| } | ||
|
|
||
| private int m_MessagReturnCode; | ||
| private String m_MessageReturnValue; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| --Minetest | ||
| --Copyright (C) 2014 sapier | ||
| -- | ||
| --This program is free software; you can redistribute it and/or modify | ||
| --it under the terms of the GNU Lesser General Public License as published by | ||
| --the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. | ||
| -- | ||
| --You should have received a copy of the GNU Lesser General Public License along | ||
| --with this program; if not, write to the Free Software Foundation, Inc., | ||
| --51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
|
|
||
| mt_color_grey = "#AAAAAA" | ||
| mt_color_blue = "#0000DD" | ||
| mt_color_green = "#00DD00" | ||
| mt_color_dark_green = "#003300" | ||
|
|
||
| --marker for android specific code | ||
| ANDROID = true | ||
|
|
||
| local menupath = core.get_mainmenu_path() | ||
| local basepath = core.get_builtin_path() | ||
| defaulttexturedir = core.get_texturepath_share() .. DIR_DELIM .. "base" .. | ||
| DIR_DELIM .. "pack" .. DIR_DELIM | ||
|
|
||
| dofile(basepath .. DIR_DELIM .. "common" .. DIR_DELIM .. "async_event.lua") | ||
| dofile(basepath .. DIR_DELIM .. "common" .. DIR_DELIM .. "filterlist.lua") | ||
| dofile(basepath .. DIR_DELIM .. "fstk" .. DIR_DELIM .. "buttonbar.lua") | ||
| dofile(basepath .. DIR_DELIM .. "fstk" .. DIR_DELIM .. "dialog.lua") | ||
| dofile(basepath .. DIR_DELIM .. "fstk" .. DIR_DELIM .. "tabview.lua") | ||
| dofile(basepath .. DIR_DELIM .. "fstk" .. DIR_DELIM .. "ui.lua") | ||
| dofile(menupath .. DIR_DELIM .. "common.lua") | ||
| dofile(menupath .. DIR_DELIM .. "gamemgr.lua") | ||
| dofile(menupath .. DIR_DELIM .. "modmgr.lua") | ||
| dofile(menupath .. DIR_DELIM .. "store.lua") | ||
| dofile(menupath .. DIR_DELIM .. "dlg_config_world.lua") | ||
| dofile(menupath .. DIR_DELIM .. "tab_simple_main.lua") | ||
| dofile(menupath .. DIR_DELIM .. "tab_credits.lua") | ||
| dofile(menupath .. DIR_DELIM .. "tab_mods.lua") | ||
| dofile(menupath .. DIR_DELIM .. "tab_settings.lua") | ||
|
|
||
| -------------------------------------------------------------------------------- | ||
| local function main_event_handler(tabview,event) | ||
| if event == "MenuQuit" then | ||
| core.close() | ||
| end | ||
| return true | ||
| end | ||
|
|
||
| local function init_globals() | ||
| --init gamedata | ||
| gamedata.worldindex = 0 | ||
|
|
||
| local worldlist = core.get_worlds() | ||
|
|
||
| local found_singleplayerworld = false | ||
|
|
||
| for i=1,#worldlist,1 do | ||
| if worldlist[i].name == "singleplayerworld" then | ||
| found_singleplayerworld = true | ||
| gamedata.worldindex = i | ||
| end | ||
| end | ||
|
|
||
| if not found_singleplayerworld then | ||
| core.create_world("singleplayerworld", 1) | ||
|
|
||
| local worldlist = core.get_worlds() | ||
|
|
||
| for i=1,#worldlist,1 do | ||
| if worldlist[i].name == "singleplayerworld" then | ||
| gamedata.worldindex = i | ||
| end | ||
| end | ||
| end | ||
|
|
||
| --create main tabview | ||
| local tv_main = tabview_create("maintab",{x=12,y=5.2},{x=-0,y=-0}) | ||
| tv_main:add(tab_simple_main) | ||
| tv_main:add(tab_mods) | ||
| tv_main:add(tab_settings) | ||
| tv_main:add(tab_credits) | ||
| tv_main:set_global_event_handler(main_event_handler) | ||
| tv_main:set_fixed_size(false) | ||
| ui.set_default("maintab") | ||
| tv_main:show() | ||
|
|
||
| --create modstore ui | ||
| modstore.init({x=12,y=6},3,2) | ||
|
|
||
| ui.update() | ||
|
|
||
| core.sound_play("main_menu", true) | ||
| end | ||
|
|
||
| init_globals() | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| Minetest Android port | ||
| ===================== | ||
| Date: 2014 06 28 | ||
|
|
||
| Controls | ||
| -------- | ||
| The Android port doesn't support everything you can do on PC due to the | ||
| limited capabilities of common devices. What can be done is described | ||
| below: | ||
|
|
||
| While you're playing the game normally (that is, no menu or inventory is | ||
| shown), the following controls are available: | ||
| * Look around: touch screen and slide finger | ||
| * double tap: place a node or use selected item | ||
| * long tap: dig node | ||
| * touch shown buttons: press button | ||
| * Buttons: | ||
| ** left upper corner: chat | ||
| ** right lower corner: jump | ||
| ** right lower corner: crouch | ||
| ** left lower corner: walk/step... | ||
| left up right | ||
| down | ||
| ** left lower corner: display inventory | ||
|
|
||
| When a menu or inventory is displayed: | ||
| * double tap outside menu area: close menu | ||
| * tap on an item stack: select that stack | ||
| * tap on an empty slot: if you selected a stack already, that stack is placed here | ||
| * drag and drop: touch stack and hold finger down, move the stack to another | ||
| slot, tap another finger while keeping first finger on screen | ||
| --> places a single item from dragged stack into current (first touched) slot | ||
|
|
||
| Special settings | ||
| ---------------- | ||
| There are some settings esspecially usefull for Android users. Minetest's config | ||
| file can usually be found at /mnt/sdcard/Minetest. | ||
|
|
||
| * gui_scaling: this is a user-specified scaling factor for the GUI- In case | ||
| main menu is to big or small on your device, try changing this | ||
| value. | ||
| * inventory_image_hack: if your inventory items are messed up, try setting | ||
| this to true | ||
|
|
||
| Known issues | ||
| ------------ | ||
| Not all issues are fixed by now: | ||
|
|
||
| * Unable to exit from volume menu -- don't use the volume menu, use Android's | ||
| volume controls instead. | ||
| * 512 MB RAM seems to be inadequate -- this depends on the server you join. | ||
| Try to play on more lightweight servers. | ||
|
|
||
| Versioning | ||
| ---------- | ||
| Android version numbers are 4 digits instead of Minetest's 3 digits. The last | ||
| number of Android's version represents the Android internal version code. This | ||
| version code is strictly incremental. It's incremented for each official | ||
| Minetest Android build. | ||
|
|
||
| E.g. pre-release Minetest Android builds have been 0.4.9.3, while the first | ||
| official version most likely will be 0.4.10.4 | ||
|
|
||
| Requirements | ||
| ------------ | ||
|
|
||
| In order to build, your PC has to be set up to build Minetest in the usual | ||
| manner (see the regular Minetest documentation for how to get this done). | ||
| In addition to what is required for Minetest in general, you will need the | ||
| following software packages. The version number in parenthesis denotes the | ||
| version that was tested at the time this README was drafted; newer/older | ||
| versions may or may not work. | ||
|
|
||
| * android SDK (x86_64 20131030) | ||
| * android NDK (r9d) | ||
| * wget (1.13.4) | ||
|
|
||
| Additionally, you'll need to have an Internet connection available on the | ||
| build system, as the Android build will download some source packages. | ||
|
|
||
| Build | ||
| ----- | ||
|
|
||
| Debug build: | ||
| * Enter "build/android" subdirectory | ||
| * Execute "make" | ||
| * Answer the questions about where SDK and NDK are located on your filesystem | ||
| * Wait for build to finish | ||
|
|
||
| After the build is finished, the resulting apk can be fond in | ||
| build/android/bin/. It will be called Minetest-debug.apk | ||
|
|
||
| Release build: | ||
|
|
||
| * In order to make a release build you'll have to have a keystore setup to sign | ||
| the resulting apk package. How this is done is not part of this README. There | ||
| are different tutorials on the web explaining how to do it | ||
| - choose one yourself. | ||
|
|
||
| * Once your keystore is setup, enter build/android subdirectory and create a new | ||
| file "ant.properties" there. Add following lines to that file: | ||
|
|
||
| > key.store=<path to your keystore> | ||
| > key.alias=Minetest | ||
|
|
||
| * Execute "make release" | ||
| * Enter your keystore as well as your Mintest key password once asked. Be | ||
| carefull it's shown on console in clear text! | ||
| * The result can be found at "bin/Minetest-release.apk" | ||
|
|
||
| Other things that may be nice to know | ||
| ------------ | ||
| * The environment for Android development tools is saved within Android build | ||
| build folder. If you want direct access to it do: | ||
|
|
||
| > make envpaths | ||
| > . and_env | ||
|
|
||
| After you've done this you'll have your path and path variables set correct | ||
| to use adb and all other Android development tools | ||
|
|
||
| * You can build a single dependency by calling make and the dependency's name, | ||
| e.g.: | ||
|
|
||
| > make irrlicht | ||
|
|
||
| * You can completely cleanup a dependency by calling make and the "clean" target, | ||
| e.g.: | ||
|
|
||
| > make clean_irrlicht |