From 33ca4d5003059d7d1f4b9e29649693ec0e5be262 Mon Sep 17 00:00:00 2001 From: faketruth Date: Thu, 16 Aug 2012 20:28:14 +0000 Subject: MCServer should run just fine on Android now :D The server is also stoppable from Android git-svn-id: http://mc-server.googlecode.com/svn/trunk@743 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- jni/app-android.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'jni') diff --git a/jni/app-android.cpp b/jni/app-android.cpp index d874f0fb0..d02947440 100644 --- a/jni/app-android.cpp +++ b/jni/app-android.cpp @@ -12,6 +12,7 @@ #include "cCriticalSection.h" #include "cRoot.h" +#include "cMakeDir.h" #include @@ -20,17 +21,22 @@ cCriticalSection g_CriticalSection; JNIEnv* g_CurrentJNIEnv = 0; jobject g_JavaRenderer = 0; +cRoot * pRoot = NULL; + /* Called when program/activity is created */ extern "C" void Java_com_mcserver_MainThread_NativeOnCreate( JNIEnv* env ) { g_CriticalSection.Lock(); g_CurrentJNIEnv = env; //if( !cLogger::GetSingletonPtr() ) new cLogger(); - __android_log_print(ANDROID_LOG_ERROR,"Arashi", "%s", "Logging from C++!"); + __android_log_print(ANDROID_LOG_ERROR,"MCServer", "%s", "Logging from C++!"); g_CriticalSection.Unlock(); - cRoot Root; - Root.Start(); + mkdir("/sdcard/mcserver", S_IRWXU | S_IRWXG | S_IRWXO); + + pRoot = new cRoot(); + pRoot->Start(); + delete pRoot; } extern "C" void Java_com_mcserver_MCServerActivity_NativeCleanUp( JNIEnv* env ) @@ -39,6 +45,8 @@ extern "C" void Java_com_mcserver_MCServerActivity_NativeCleanUp( JNIEnv* env ) g_CurrentJNIEnv = env; g_CriticalSection.Unlock(); + + pRoot->ServerCommand("stop"); } /* Call to initialize the graphics state */ -- cgit v1.2.3