aboutsummaryrefslogtreecommitdiff
Commit message (Expand)AuthorAge
...
* cleaned the smooth lighting code a bitPerttu Ahola2011-04-24
* disable tiling of textures only if smooth lighting is usedPerttu Ahola2011-04-24
* Added a setting for disabling smooth lighting. Updated changelog.Perttu Ahola2011-04-24
* Added a simple software "ambient occlusion" effect, like minecraft's "smooth ...Perttu Ahola2011-04-24
* removed /usr prefix from install pathsPerttu Ahola2011-04-24
* Made the main menu a bit more unique lookingPerttu Ahola2011-04-24
* updated changelogPerttu Ahola2011-04-23
* changed version for making a test binaryPerttu Ahola2011-04-23
* fix to the previous commitPerttu Ahola2011-04-23
* tuned error reporting a bitPerttu Ahola2011-04-23
* port to be not set to 0 from configurationPerttu Ahola2011-04-23
* Code refactoring; split half of main.cpp to game.cpp.Perttu Ahola2011-04-23
* cleaning up main.cpp a bitPerttu Ahola2011-04-23
* fixed flowing water lighting when it is below a solid blockPerttu Ahola2011-04-23
* Updated to-do list and added the give_initial_stuff setting for testingPerttu Ahola2011-04-22
* Removed IrrlichtWrapperPerttu Ahola2011-04-22
* set client to not show hp if server doesn't support itPerttu Ahola2011-04-21
* Some work-in-progress in hp and mobs and a frightening amount of random fixes.Perttu Ahola2011-04-21
* item drop multiplication fixPerttu Ahola2011-04-19
* Menu will now ignore an invalid port or the port 0.Perttu Ahola2011-04-15
* fixed port setting not being loaded from configuration file for clientPerttu Ahola2011-04-12
* fixingPerttu Ahola2011-04-12
* Fixed some problems with crafting and inventoryPerttu Ahola2011-04-11
* updated example map generator python scriptPerttu Ahola2011-04-11
* support for format 0 and 1 mapsPerttu Ahola2011-04-11
* Added installing build-essential to build instructions and modified the main....Perttu Ahola2011-04-11
* fixed warnings reported by cppcheckPerttu Ahola2011-04-11
* Fixed error reported by cppcheck:Perttu Ahola2011-04-11
* fixed problem with vc++ build crashing at startupPerttu Ahola2011-04-11
* hopefully fixed a bit morePerttu Ahola2011-04-11
* improved old map supportPerttu Ahola2011-04-11
* added ignoring of map_meta.txt to better support old mapsPerttu Ahola2011-04-11
* updated changelog and versionPerttu Ahola2011-04-10
* fixed the object update interval thingyPerttu Ahola2011-04-10
* changed server to do object management at longer intervals (0.5s)Perttu Ahola2011-04-10
* Made environment to not consider disconnected players when dealing with Activ...Perttu Ahola2011-04-10
* better support for old mapsPerttu Ahola2011-04-10
* missing include for server buildPerttu Ahola2011-04-10
* added missing filePerttu Ahola2011-04-10
* Map generation is now properly threaded and doesn't block block placement and...Perttu Ahola2011-04-10
* a commit before starting to reorganize the map loading/generation logicPerttu Ahola2011-04-10
* new-style rats are now generated in the mapPerttu Ahola2011-04-10
* fixed a bitPerttu Ahola2011-04-10
* implemented rats in new system to verify that it worksPerttu Ahola2011-04-10
* items now fall by gravity... also some other random updatingPerttu Ahola2011-04-10
* new object systemPerttu Ahola2011-04-10
* added libgl1-mesa-dev to dependenciesPerttu Ahola2011-04-09
* set GUIInventoryMenu to be scaled according to the height of the window (not ...Perttu Ahola2011-04-09
* Some progress on transitioning from MapBlockObject to ActiveObject.Perttu Ahola2011-04-08
* stone shovel now needs cobble, not stone.Perttu Ahola2011-04-06
lass="hl opt">*argv[]); void android_main(android_app *app) { int retval = 0; porting::app_global = app; Thread::setName("Main"); try { app_dummy(); char *argv[] = {strdup(PROJECT_NAME), NULL}; main(ARRLEN(argv) - 1, argv); free(argv[0]); } catch (std::exception &e) { errorstream << "Uncaught exception in main thread: " << e.what() << std::endl; retval = -1; } catch (...) { errorstream << "Uncaught exception in main thread!" << std::endl; retval = -1; } porting::cleanupAndroid(); infostream << "Shutting down." << std::endl; exit(retval); } /* handler for finished message box input */ /* Intentionally NOT in namespace porting */ /* TODO this doesn't work as expected, no idea why but there's a workaround */ /* for it right now */ extern "C" { JNIEXPORT void JNICALL Java_net_minetest_MtNativeActivity_putMessageBoxResult( JNIEnv * env, jclass thiz, jstring text) { errorstream << "Java_net_minetest_MtNativeActivity_putMessageBoxResult got: " << std::string((const char*)env->GetStringChars(text,0)) << std::endl; } } namespace porting { std::string path_storage = DIR_DELIM "sdcard" DIR_DELIM; android_app* app_global; JNIEnv* jnienv; jclass nativeActivity; jclass findClass(std::string classname) { if (jnienv == 0) { return 0; } jclass nativeactivity = jnienv->FindClass("android/app/NativeActivity"); jmethodID getClassLoader = jnienv->GetMethodID(nativeactivity,"getClassLoader", "()Ljava/lang/ClassLoader;"); jobject cls = jnienv->CallObjectMethod(app_global->activity->clazz, getClassLoader); jclass classLoader = jnienv->FindClass("java/lang/ClassLoader"); jmethodID findClass = jnienv->GetMethodID(classLoader, "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;"); jstring strClassName = jnienv->NewStringUTF(classname.c_str()); return (jclass) jnienv->CallObjectMethod(cls, findClass, strClassName); } void copyAssets() { jmethodID assetcopy = jnienv->GetMethodID(nativeActivity,"copyAssets","()V"); if (assetcopy == 0) { assert("porting::copyAssets unable to find copy assets method" == 0); } jnienv->CallVoidMethod(app_global->activity->clazz, assetcopy); } void initAndroid() { porting::jnienv = NULL; JavaVM *jvm = app_global->activity->vm; JavaVMAttachArgs lJavaVMAttachArgs; lJavaVMAttachArgs.version = JNI_VERSION_1_6; lJavaVMAttachArgs.name = PROJECT_NAME_C "NativeThread"; lJavaVMAttachArgs.group = NULL; #ifdef NDEBUG // This is a ugly hack as arm v7a non debuggable builds crash without this // printf ... if someone finds out why please fix it! infostream << "Attaching native thread. " << std::endl; #endif if ( jvm->AttachCurrentThread(&porting::jnienv, &lJavaVMAttachArgs) == JNI_ERR) { errorstream << "Failed to attach native thread to jvm" << std::endl; exit(-1); } nativeActivity = findClass("net/minetest/minetest/MtNativeActivity"); if (nativeActivity == 0) { errorstream << "porting::initAndroid unable to find java native activity class" << std::endl; } #ifdef GPROF /* in the start-up code */ __android_log_print(ANDROID_LOG_ERROR, PROJECT_NAME_C, "Initializing GPROF profiler"); monstartup("libminetest.so"); #endif } void cleanupAndroid() { #ifdef GPROF errorstream << "Shutting down GPROF profiler" << std::endl; setenv("CPUPROFILE", (path_user + DIR_DELIM + "gmon.out").c_str(), 1); moncleanup(); #endif JavaVM *jvm = app_global->activity->vm; jvm->DetachCurrentThread(); } static std::string javaStringToUTF8(jstring js) { std::string str; // Get string as a UTF-8 c-string const char *c_str = jnienv->GetStringUTFChars(js, NULL); // Save it str = c_str; // And free the c-string jnienv->ReleaseStringUTFChars(js, c_str); return str; } // Calls static method if obj is NULL static std::string getAndroidPath(jclass cls, jobject obj, jclass cls_File, jmethodID mt_getAbsPath, const char *getter) { // Get getter method jmethodID mt_getter; if (obj) mt_getter = jnienv->GetMethodID(cls, getter, "()Ljava/io/File;"); else mt_getter = jnienv->GetStaticMethodID(cls, getter, "()Ljava/io/File;"); // Call getter jobject ob_file; if (obj) ob_file = jnienv->CallObjectMethod(obj, mt_getter); else ob_file = jnienv->CallStaticObjectMethod(cls, mt_getter); // Call getAbsolutePath jstring js_path = (jstring) jnienv->CallObjectMethod(ob_file, mt_getAbsPath); return javaStringToUTF8(js_path); } void initializePathsAndroid() { // Get Environment class jclass cls_Env = jnienv->FindClass("android/os/Environment"); // Get File class jclass cls_File = jnienv->FindClass("java/io/File"); // Get getAbsolutePath method jmethodID mt_getAbsPath = jnienv->GetMethodID(cls_File, "getAbsolutePath", "()Ljava/lang/String;"); path_cache = getAndroidPath(nativeActivity, app_global->activity->clazz, cls_File, mt_getAbsPath, "getCacheDir"); path_storage = getAndroidPath(cls_Env, NULL, cls_File, mt_getAbsPath, "getExternalStorageDirectory"); path_user = path_storage + DIR_DELIM + PROJECT_NAME_C; path_share = path_storage + DIR_DELIM + PROJECT_NAME_C; migrateCachePath(); } void showInputDialog(const std::string& acceptButton, const std::string& hint, const std::string& current, int editType) { jmethodID showdialog = jnienv->GetMethodID(nativeActivity,"showDialog", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V"); if (showdialog == 0) { assert("porting::showInputDialog unable to find java show dialog method" == 0); }