Exit hedgewars cleanly and return to the frontend with out crashing + fixed error messages "foo" -> HWEngine_Loader hedgeroid
authorXeli
Fri, 16 Sep 2011 18:24:50 +0200
branchhedgeroid
changeset 5934 9f05a0f43003
parent 5932 5164d17b6374
child 5936 849f01d63538
Exit hedgewars cleanly and return to the frontend with out crashing + fixed error messages "foo" -> HWEngine_Loader
project_files/Android-build/SDL-android-project/jni/SDL/src/main/android/SDL_android_main.cpp
project_files/Android-build/SDL-android-project/jni/src/hedgewars_main.c
project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/SDLActivity.java
--- a/project_files/Android-build/SDL-android-project/jni/SDL/src/main/android/SDL_android_main.cpp	Fri Sep 16 18:17:16 2011 +0200
+++ b/project_files/Android-build/SDL-android-project/jni/SDL/src/main/android/SDL_android_main.cpp	Fri Sep 16 18:24:50 2011 +0200
@@ -43,7 +43,7 @@
     }
 
     /* We exit here for consistency with other platforms. */
-    exit(status);
+    //exit(status); Xeli: Or lets not crash the entire app.....
 }
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/project_files/Android-build/SDL-android-project/jni/src/hedgewars_main.c	Fri Sep 16 18:17:16 2011 +0200
+++ b/project_files/Android-build/SDL-android-project/jni/src/hedgewars_main.c	Fri Sep 16 18:24:50 2011 +0200
@@ -17,8 +17,8 @@
         __android_log_print(ANDROID_LOG_INFO, TAG, "HWEngine being loaded");
 	handle = dlopen("libhwengine.so", RTLD_NOW|RTLD_GLOBAL);
 	if(!handle){
-		__android_log_print(ANDROID_LOG_INFO, "foo", dlerror());
-		__android_log_print(ANDROID_LOG_INFO, "foo", "error dlopen");
+		__android_log_print(ANDROID_LOG_INFO, TAG, dlerror());
+		__android_log_print(ANDROID_LOG_INFO, TAG, "error dlopen");
 		exit(EXIT_FAILURE);
 	}
 	dlerror();
@@ -28,13 +28,13 @@
 
 	Game = (HWEngine_Game) dlsym(handle,"Game");
 	if((error = dlerror()) != NULL){
-		__android_log_print(ANDROID_LOG_INFO, "foo", error);
-		__android_log_print(ANDROID_LOG_INFO, "foo", "error dlsym");
+		__android_log_print(ANDROID_LOG_INFO, TAG, error);
+		__android_log_print(ANDROID_LOG_INFO, TAG, "error dlsym");
 		exit(EXIT_FAILURE);
 	}
-	__android_log_print(ANDROID_LOG_INFO, "foo", "dlsym succeeded");
+	__android_log_print(ANDROID_LOG_INFO, TAG, "dlsym succeeded");
 	Game(argv);
-	__android_log_print(ANDROID_LOG_INFO, "foo", "Game() succeeded");
+	__android_log_print(ANDROID_LOG_INFO, TAG, "Game() ended");
 
 	dlclose(handle);
 }
--- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/SDLActivity.java	Fri Sep 16 18:17:16 2011 +0200
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/SDLActivity.java	Fri Sep 16 18:24:50 2011 +0200
@@ -285,7 +285,8 @@
 				String.valueOf(surfaceWidth), String.valueOf(surfaceHeight),
 				"0", "null", "xeli", "1", "1", "1", "0", "", path });
 
-		// Log.v("SDL", "SDL thread terminated");
+		//Log.v("SDL", "SDL thread terminated");
+		SDLActivity.mSingleton.finish();
 	}
 }
 
@@ -514,7 +515,7 @@
 			Log.v("SDL", "key down: " + keyCode);
 			if(keyCode == KeyEvent.KEYCODE_BACK){//TODO ask user to quit or not
 				SDLActivity.nativeQuit();
-				SDLActivity.mSingleton.finish();
+				//SDLActivity.mSingleton.finish();
 			}else{
 				SDLActivity.onNativeKeyDown(keyCode);	
 			}