mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Switch android to leveldb as sqlite3 is broken and fails to save any mapblock there
This commit is contained in:
parent
d020e0771d
commit
b459f53ac3
@ -628,7 +628,7 @@ assets : $(ASSETS_TIMESTAMP)
|
|||||||
clean_assets :
|
clean_assets :
|
||||||
@$(RM) -r assets
|
@$(RM) -r assets
|
||||||
|
|
||||||
apk: $(PATHCFGFILE) assets $(IRRLICHT_LIB) $(CURL_LIB) \
|
apk: $(PATHCFGFILE) assets $(IRRLICHT_LIB) $(CURL_LIB) $(LEVELDB_LIB) \
|
||||||
$(OPENAL_LIB) $(OGG_LIB) prep_srcdir $(ROOT)/jni/src/android_version.h
|
$(OPENAL_LIB) $(OGG_LIB) prep_srcdir $(ROOT)/jni/src/android_version.h
|
||||||
@export NDEBUG=$$NDEBUG; $(MAKE) -j${PARALLEL} manifest; \
|
@export NDEBUG=$$NDEBUG; $(MAKE) -j${PARALLEL} manifest; \
|
||||||
export PATH=$$PATH:${SDKFOLDER}/platform-tools:${ANDROID_NDK}; \
|
export PATH=$$PATH:${SDKFOLDER}/platform-tools:${ANDROID_NDK}; \
|
||||||
|
@ -7,10 +7,10 @@ LOCAL_MODULE := Irrlicht
|
|||||||
LOCAL_SRC_FILES := deps/irrlicht/lib/Android/libIrrlicht.a
|
LOCAL_SRC_FILES := deps/irrlicht/lib/Android/libIrrlicht.a
|
||||||
include $(PREBUILT_STATIC_LIBRARY)
|
include $(PREBUILT_STATIC_LIBRARY)
|
||||||
|
|
||||||
#include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
#LOCAL_MODULE := LevelDB
|
LOCAL_MODULE := LevelDB
|
||||||
#LOCAL_SRC_FILES := deps/leveldb/libleveldb.a
|
LOCAL_SRC_FILES := deps/leveldb/libleveldb.a
|
||||||
#include $(PREBUILT_STATIC_LIBRARY)
|
include $(PREBUILT_STATIC_LIBRARY)
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := curl
|
LOCAL_MODULE := curl
|
||||||
@ -62,6 +62,7 @@ LOCAL_CFLAGS := -D_IRR_ANDROID_PLATFORM_ \
|
|||||||
-DUSE_CURL=1 \
|
-DUSE_CURL=1 \
|
||||||
-DUSE_SOUND=1 \
|
-DUSE_SOUND=1 \
|
||||||
-DUSE_FREETYPE=1 \
|
-DUSE_FREETYPE=1 \
|
||||||
|
-DUSE_LEVELDB=1 \
|
||||||
$(GPROF_DEF) \
|
$(GPROF_DEF) \
|
||||||
-pipe -fstrict-aliasing
|
-pipe -fstrict-aliasing
|
||||||
|
|
||||||
@ -93,9 +94,8 @@ LOCAL_C_INCLUDES := \
|
|||||||
deps/freetype2-android/include \
|
deps/freetype2-android/include \
|
||||||
deps/curl-7.35.0/include \
|
deps/curl-7.35.0/include \
|
||||||
deps/openal-soft/jni/OpenAL/include \
|
deps/openal-soft/jni/OpenAL/include \
|
||||||
deps/libvorbis-libogg-android/jni/include
|
deps/libvorbis-libogg-android/jni/include \
|
||||||
|
deps/leveldb/include \
|
||||||
# deps/leveldb/include \
|
|
||||||
|
|
||||||
LOCAL_SRC_FILES := \
|
LOCAL_SRC_FILES := \
|
||||||
jni/src/ban.cpp \
|
jni/src/ban.cpp \
|
||||||
@ -205,9 +205,8 @@ LOCAL_SRC_FILES := \
|
|||||||
jni/src/util/serialize.cpp \
|
jni/src/util/serialize.cpp \
|
||||||
jni/src/util/string.cpp \
|
jni/src/util/string.cpp \
|
||||||
jni/src/util/timetaker.cpp \
|
jni/src/util/timetaker.cpp \
|
||||||
jni/src/touchscreengui.cpp
|
jni/src/touchscreengui.cpp \
|
||||||
|
jni/src/database-leveldb.cpp
|
||||||
# jni/src/database-leveldb.cpp \
|
|
||||||
|
|
||||||
# lua api
|
# lua api
|
||||||
LOCAL_SRC_FILES += \
|
LOCAL_SRC_FILES += \
|
||||||
@ -297,8 +296,7 @@ LOCAL_SRC_FILES += \
|
|||||||
LOCAL_SRC_FILES += jni/src/json/jsoncpp.cpp
|
LOCAL_SRC_FILES += jni/src/json/jsoncpp.cpp
|
||||||
|
|
||||||
LOCAL_SHARED_LIBRARIES := openal ogg vorbis ssl crypto
|
LOCAL_SHARED_LIBRARIES := openal ogg vorbis ssl crypto
|
||||||
LOCAL_STATIC_LIBRARIES := Irrlicht freetype curl android_native_app_glue $(PROFILER_LIBS)
|
LOCAL_STATIC_LIBRARIES := Irrlicht freetype curl LevelDB android_native_app_glue $(PROFILER_LIBS)
|
||||||
# LevelDB
|
|
||||||
LOCAL_LDLIBS := -lEGL -llog -lGLESv1_CM -lGLESv2 -lz -landroid
|
LOCAL_LDLIBS := -lEGL -llog -lGLESv1_CM -lGLESv2 -lz -landroid
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
@ -187,12 +187,12 @@ void Database_SQLite3::saveBlock(MapBlock *block)
|
|||||||
const char *bytes = tmp.c_str();
|
const char *bytes = tmp.c_str();
|
||||||
|
|
||||||
if(sqlite3_bind_int64(m_database_write, 1, getBlockAsInteger(p3d)) != SQLITE_OK)
|
if(sqlite3_bind_int64(m_database_write, 1, getBlockAsInteger(p3d)) != SQLITE_OK)
|
||||||
infostream<<"WARNING: Block position failed to bind: "<<sqlite3_errmsg(m_database)<<std::endl;
|
errorstream<<"WARNING: Block position failed to bind: "<<sqlite3_errmsg(m_database)<<std::endl;
|
||||||
if(sqlite3_bind_blob(m_database_write, 2, (void *)bytes, o.tellp(), NULL) != SQLITE_OK) // TODO this mught not be the right length
|
if(sqlite3_bind_blob(m_database_write, 2, (void *)bytes, o.tellp(), NULL) != SQLITE_OK) // TODO this mught not be the right length
|
||||||
infostream<<"WARNING: Block data failed to bind: "<<sqlite3_errmsg(m_database)<<std::endl;
|
errorstream<<"WARNING: Block data failed to bind: "<<sqlite3_errmsg(m_database)<<std::endl;
|
||||||
int written = sqlite3_step(m_database_write);
|
int written = sqlite3_step(m_database_write);
|
||||||
if(written != SQLITE_DONE)
|
if(written != SQLITE_DONE)
|
||||||
infostream<<"WARNING: Block failed to save ("<<p3d.X<<", "<<p3d.Y<<", "<<p3d.Z<<") "
|
errorstream<<"WARNING: Block failed to save ("<<p3d.X<<", "<<p3d.Y<<", "<<p3d.Z<<") "
|
||||||
<<sqlite3_errmsg(m_database)<<std::endl;
|
<<sqlite3_errmsg(m_database)<<std::endl;
|
||||||
// Make ready for later reuse
|
// Make ready for later reuse
|
||||||
sqlite3_reset(m_database_write);
|
sqlite3_reset(m_database_write);
|
||||||
|
@ -242,7 +242,12 @@ bool initializeWorld(const std::string &path, const std::string &gameid)
|
|||||||
infostream<<"Creating world.mt ("<<worldmt_path<<")"<<std::endl;
|
infostream<<"Creating world.mt ("<<worldmt_path<<")"<<std::endl;
|
||||||
fs::CreateAllDirs(path);
|
fs::CreateAllDirs(path);
|
||||||
std::ostringstream ss(std::ios_base::binary);
|
std::ostringstream ss(std::ios_base::binary);
|
||||||
ss<<"gameid = "<<gameid<<"\nbackend = sqlite3\n";
|
ss<<"gameid = "<<gameid<<
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
"\nbackend = leveldb\n";
|
||||||
|
#else
|
||||||
|
"\nbackend = sqlite3\n";
|
||||||
|
#endif
|
||||||
fs::safeWriteToFile(worldmt_path, ss.str());
|
fs::safeWriteToFile(worldmt_path, ss.str());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user