Merge pull request #469 from mc-server/Android_Update

Android update
master
Tiger Wang 2013-12-24 08:20:55 -08:00
commit 9e5e415674
5 changed files with 34 additions and 23 deletions

View File

@ -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 := $(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 %.cpp,../%.cpp,$(LOCAL_SRC_FILES))
LOCAL_SRC_FILES := $(patsubst %.c,../%.c,$(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_STATIC_LIBRARIES := cpufeatures
LOCAL_C_INCLUDES := ../source \ LOCAL_C_INCLUDES := ../src \
../source/md5 \ ../src/packets \
../WebServer \ ../src/items \
../source/packets \ ../src/blocks \
../source/items \ ../tolua++/src/lib \
../source/blocks \ ../lua/src \
../tolua++-1.0.93/src/lib \
../lua-5.1.4/src \
../zlib-1.2.7 \ ../zlib-1.2.7 \
../iniFile \ ../iniFile \
../tolua++-1.0.93/include \ ../tolua++/include \
../jsoncpp-src-0.5.0/include \ ../jsoncpp/include \
../jsoncpp-src-0.5.0/src/lib_json \ ../jsoncpp/src/lib_json \
../squirrel_3_0_1_stable/include \
../squirrel_3_0_1_stable \
../squirrel_3_0_1_stable/sqrat \
../expat/ \ ../expat/ \
../md5/ \
../sqlite/ \
../luaexpat/ \
.. \ .. \

View File

@ -11,7 +11,7 @@
#include <assert.h> #include <assert.h>
#include "OSSupport/CriticalSection.h" #include "OSSupport/CriticalSection.h"
#include "OSSupport/MakeDir.h" #include "OSSupport/File.h"
#include "ToJava.h" #include "ToJava.h"
#include "Root.h" #include "Root.h"
@ -84,7 +84,7 @@ extern "C" void Java_com_mcserver_MCServerActivity_NativeOnCreate( JNIEnv* env,
//__android_log_print(ANDROID_LOG_ERROR,"MCServer", "%s", "Logging from C++!"); //__android_log_print(ANDROID_LOG_ERROR,"MCServer", "%s", "Logging from C++!");
g_CriticalSection.Unlock(); g_CriticalSection.Unlock();
mkdir("/sdcard/mcserver", S_IRWXU | S_IRWXG | S_IRWXO); cFile::CreateFolder("/sdcard/mcserver");
pRoot = new cRoot(); pRoot = new cRoot();
pRoot->Start(); pRoot->Start();
@ -105,7 +105,7 @@ extern "C" void Java_com_mcserver_MCServerActivity_NativeCleanUp( JNIEnv* env,
__android_log_print(ANDROID_LOG_ERROR,"MCServer", "pRoot: %p", pRoot); __android_log_print(ANDROID_LOG_ERROR,"MCServer", "pRoot: %p", pRoot);
if( pRoot != NULL ) if( pRoot != NULL )
{ {
pRoot->ExecuteConsoleCommand("stop"); pRoot->QueueExecuteConsoleCommand("stop");
} }
} }
@ -124,7 +124,7 @@ extern "C" jint Java_com_mcserver_MCServerActivity_NativeGetWebAdminPort( JNIEnv
{ {
if( pRoot != NULL && pRoot->GetWebAdmin() != NULL ) if( pRoot != NULL && pRoot->GetWebAdmin() != NULL )
{ {
return pRoot->GetWebAdmin()->GetPort(); return atoi(pRoot->GetWebAdmin()->GetIPv4Ports().c_str());
} }
return 0; return 0;
} }

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</TextView>

View File

@ -100,10 +100,10 @@ bool cWebAdmin::Init(void)
LOGD("Initialising WebAdmin..."); LOGD("Initialising WebAdmin...");
AString PortsIPv4 = m_IniFile.GetValueSet("WebAdmin", "Port", "8080"); m_PortsIPv4 = m_IniFile.GetValueSet("WebAdmin", "Port", "8080");
AString PortsIPv6 = m_IniFile.GetValueSet("WebAdmin", "PortsIPv6", ""); m_PortsIPv6 = m_IniFile.GetValueSet("WebAdmin", "PortsIPv6", "");
if (!m_HTTPServer.Initialize(PortsIPv4, PortsIPv6)) if (!m_HTTPServer.Initialize(m_PortsIPv4, m_PortsIPv6))
{ {
return false; return false;
} }

View File

@ -132,6 +132,9 @@ public:
/// Escapes text passed into it, so it can be embedded into html. /// Escapes text passed into it, so it can be embedded into html.
static AString GetHTMLEscapedString(const AString & a_Input); static AString GetHTMLEscapedString(const AString & a_Input);
AString GetIPv4Ports(void) const { return m_PortsIPv4; }
AString GetIPv6Ports(void) const { return m_PortsIPv6; }
// tolua_end // tolua_end
/// Returns the prefix needed for making a link point to the webadmin root from the given URL ("../../../webadmin"-style) /// 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; PluginList m_Plugins;
AString m_PortsIPv4;
AString m_PortsIPv6;
/// The Lua template script to provide templates: /// The Lua template script to provide templates:
cLuaState m_TemplateScript; cLuaState m_TemplateScript;