From 1bd1696cebd6157261f32c3e8bdecf5914312c22 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Mon, 23 Dec 2013 16:56:21 +0100 Subject: Just a quick update for the files you need to compile for Android. --- Android/jni/Android.mk | 28 +++++++++++++--------------- Android/jni/app-android.cpp | 12 +++++++----- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Android/jni/Android.mk b/Android/jni/Android.mk index 23488e359..3542e588b 100644 --- a/Android/jni/Android.mk +++ b/Android/jni/Android.mk @@ -5,7 +5,7 @@ LOCAL_MODULE := mcserver -LOCAL_SRC_FILES := $(shell find ../CryptoPP ../lua-5.1.4 ../jsoncpp-src-0.5.0 ../zlib-1.2.7 ../source ../squirrel_3_0_1_stable ../tolua++-1.0.93 ../iniFile ../WebServer ../expat '(' -name '*.cpp' -o -name '*.c' ')') +LOCAL_SRC_FILES := $(shell find ../CryptoPP ../lua ../jsoncpp ../zlib ../src ../tolua++ ../iniFile ../expat ../md5 ../sqlite ../luaexpat '(' -name '*.cpp' -o -name '*.c' ')') LOCAL_SRC_FILES := $(filter-out %SquirrelFunctions.cpp %SquirrelBindings.cpp %cPlugin_Squirrel.cpp %cSquirrelCommandBinder.cpp %minigzip.c %lua.c %tolua.c %toluabind.c %LeakFinder.cpp %StackWalker.cpp %example.c,$(LOCAL_SRC_FILES)) LOCAL_SRC_FILES := $(patsubst %.cpp,../%.cpp,$(LOCAL_SRC_FILES)) LOCAL_SRC_FILES := $(patsubst %.c,../%.c,$(LOCAL_SRC_FILES)) @@ -20,23 +20,21 @@ LOCAL_CFLAGS := -DANDROID_NDK \ LOCAL_STATIC_LIBRARIES := cpufeatures -LOCAL_C_INCLUDES := ../source \ - ../source/md5 \ - ../WebServer \ - ../source/packets \ - ../source/items \ - ../source/blocks \ - ../tolua++-1.0.93/src/lib \ - ../lua-5.1.4/src \ +LOCAL_C_INCLUDES := ../src \ + ../src/packets \ + ../src/items \ + ../src/blocks \ + ../tolua++/src/lib \ + ../lua/src \ ../zlib-1.2.7 \ ../iniFile \ - ../tolua++-1.0.93/include \ - ../jsoncpp-src-0.5.0/include \ - ../jsoncpp-src-0.5.0/src/lib_json \ - ../squirrel_3_0_1_stable/include \ - ../squirrel_3_0_1_stable \ - ../squirrel_3_0_1_stable/sqrat \ + ../tolua++/include \ + ../jsoncpp/include \ + ../jsoncpp/src/lib_json \ ../expat/ \ + ../md5/ \ + ../sqlite/ \ + ../luaexpat/ \ .. \ diff --git a/Android/jni/app-android.cpp b/Android/jni/app-android.cpp index 197df29c4..40009c77c 100644 --- a/Android/jni/app-android.cpp +++ b/Android/jni/app-android.cpp @@ -11,8 +11,9 @@ #include #include "OSSupport/CriticalSection.h" -#include "OSSupport/MakeDir.h" +#include "OSSupport/File.h" #include "ToJava.h" +#include "inifile/iniFile.h" #include "Root.h" #include "WebAdmin.h" @@ -84,7 +85,7 @@ extern "C" void Java_com_mcserver_MCServerActivity_NativeOnCreate( JNIEnv* env, //__android_log_print(ANDROID_LOG_ERROR,"MCServer", "%s", "Logging from C++!"); g_CriticalSection.Unlock(); - mkdir("/sdcard/mcserver", S_IRWXU | S_IRWXG | S_IRWXO); + cFile::CreateFolder("/sdcard/mcserver"); pRoot = new cRoot(); pRoot->Start(); @@ -105,7 +106,7 @@ extern "C" void Java_com_mcserver_MCServerActivity_NativeCleanUp( JNIEnv* env, __android_log_print(ANDROID_LOG_ERROR,"MCServer", "pRoot: %p", pRoot); if( pRoot != NULL ) { - pRoot->ExecuteConsoleCommand("stop"); + pRoot->QueueExecuteConsoleCommand("stop"); } } @@ -122,9 +123,10 @@ extern "C" jboolean Java_com_mcserver_MCServerActivity_NativeIsServerRunning( JN extern "C" jint Java_com_mcserver_MCServerActivity_NativeGetWebAdminPort( JNIEnv* env, jobject thiz ) { - if( pRoot != NULL && pRoot->GetWebAdmin() != NULL ) + cIniFile IniFile; + if (IniFile.ReadFile("/sdcard/mcserver/webadmin.ini")) { - return pRoot->GetWebAdmin()->GetPort(); + return IniFile.GetValueI("WebAdmin", "Port"); } return 0; } \ No newline at end of file -- cgit v1.2.3 From 155f1751cef82d6f2bbf40190c978d1920d5bcf0 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Tue, 24 Dec 2013 13:48:15 +0100 Subject: Added the list_item.xml --- Android/res/layout/list_item.xml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Android/res/layout/list_item.xml diff --git a/Android/res/layout/list_item.xml b/Android/res/layout/list_item.xml new file mode 100644 index 000000000..e77da47db --- /dev/null +++ b/Android/res/layout/list_item.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file -- cgit v1.2.3 From b42487744871ab4587edabe2a3b87c9d26ac030f Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Tue, 24 Dec 2013 14:44:24 +0100 Subject: Fixed getting configure button going to port 0. --- Android/jni/app-android.cpp | 7 +++---- src/WebAdmin.cpp | 6 +++--- src/WebAdmin.h | 6 ++++++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Android/jni/app-android.cpp b/Android/jni/app-android.cpp index 40009c77c..8f4346ac3 100644 --- a/Android/jni/app-android.cpp +++ b/Android/jni/app-android.cpp @@ -123,10 +123,9 @@ extern "C" jboolean Java_com_mcserver_MCServerActivity_NativeIsServerRunning( JN extern "C" jint Java_com_mcserver_MCServerActivity_NativeGetWebAdminPort( JNIEnv* env, jobject thiz ) { - cIniFile IniFile; - if (IniFile.ReadFile("/sdcard/mcserver/webadmin.ini")) + if( pRoot != NULL && pRoot->GetWebAdmin() != NULL ) { - return IniFile.GetValueI("WebAdmin", "Port"); + return atoi(pRoot->GetWebAdmin()->GetIPv4Ports().c_str()); } return 0; -} \ No newline at end of file +} diff --git a/src/WebAdmin.cpp b/src/WebAdmin.cpp index 462702893..a1f0842aa 100644 --- a/src/WebAdmin.cpp +++ b/src/WebAdmin.cpp @@ -100,10 +100,10 @@ bool cWebAdmin::Init(void) LOGD("Initialising WebAdmin..."); - AString PortsIPv4 = m_IniFile.GetValueSet("WebAdmin", "Port", "8080"); - AString PortsIPv6 = m_IniFile.GetValueSet("WebAdmin", "PortsIPv6", ""); + m_PortsIPv4 = m_IniFile.GetValueSet("WebAdmin", "Port", "8080"); + m_PortsIPv6 = m_IniFile.GetValueSet("WebAdmin", "PortsIPv6", ""); - if (!m_HTTPServer.Initialize(PortsIPv4, PortsIPv6)) + if (!m_HTTPServer.Initialize(m_PortsIPv4, m_PortsIPv6)) { return false; } diff --git a/src/WebAdmin.h b/src/WebAdmin.h index c629d44ff..0907e7bc3 100644 --- a/src/WebAdmin.h +++ b/src/WebAdmin.h @@ -132,6 +132,9 @@ public: /// Escapes text passed into it, so it can be embedded into html. static AString GetHTMLEscapedString(const AString & a_Input); + AString GetIPv4Ports(void) const { return m_PortsIPv4; } + AString GetIPv6Ports(void) const { return m_PortsIPv6; } + // tolua_end /// Returns the prefix needed for making a link point to the webadmin root from the given URL ("../../../webadmin"-style) @@ -180,6 +183,9 @@ protected: PluginList m_Plugins; + AString m_PortsIPv4; + AString m_PortsIPv6; + /// The Lua template script to provide templates: cLuaState m_TemplateScript; -- cgit v1.2.3 From 6ad0da5ce0dd01a94344ea7371f517b8307e73e9 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Tue, 24 Dec 2013 14:52:19 +0100 Subject: Removed unneeded include. --- Android/jni/app-android.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Android/jni/app-android.cpp b/Android/jni/app-android.cpp index 8f4346ac3..386f1b90e 100644 --- a/Android/jni/app-android.cpp +++ b/Android/jni/app-android.cpp @@ -13,7 +13,6 @@ #include "OSSupport/CriticalSection.h" #include "OSSupport/File.h" #include "ToJava.h" -#include "inifile/iniFile.h" #include "Root.h" #include "WebAdmin.h" -- cgit v1.2.3