VCMI crashes when loading libapplication.so, it does not even reach SDL_main, debugging on emulator did not help, so I'm giving up for now on porting it

This commit is contained in:
pelya
2011-06-07 17:21:10 +03:00
parent b118aed813
commit d8f2263a7f
2 changed files with 42 additions and 1 deletions

View File

@@ -0,0 +1,41 @@
Index: global.h
===================================================================
--- global.h (revision 2170)
+++ global.h (working copy)
@@ -10,6 +10,10 @@
using boost::logic::tribool;
#include <boost/cstdint.hpp>
#include <assert.h>
+#ifdef ANDROID
+#include <android/log.h>
+#include <sstream>
+#endif
//filesystem version 3 causes problems (and it's default as of boost 1.46)
#define BOOST_FILESYSTEM_VERSION 2
typedef boost::uint64_t ui64; //unsigned int 64 bits (8 bytes)
@@ -623,7 +627,25 @@
CLogger& operator<<(std::ostream& (*fun)(std::ostream&))
{
if(lvl < CONSOLE_LOGGING_LEVEL)
+ {
+#ifdef ANDROID
+ std::ostringstream os;
+ os << fun;
+ int loglevel = ANDROID_LOG_INFO;
+ switch(lvl) {
+ case 0: loglevel = ANDROID_LOG_INFO; break;
+ case 1: loglevel = ANDROID_LOG_FATAL; break;
+ case 2: loglevel = ANDROID_LOG_ERROR; break;
+ case 3: loglevel = ANDROID_LOG_WARN; break;
+ case 4: loglevel = ANDROID_LOG_INFO; break;
+ case 5: loglevel = ANDROID_LOG_DEBUG; break;
+ case 6: case -2: loglevel = ANDROID_LOG_VERBOSE; break;
+ };
+ __android_log_print(loglevel, "VCMI", "%s", os.str().c_str());
+#else
std::cout << fun;
+#endif
+ }
if((lvl < FILE_LOGGING_LEVEL) && logfile)
*logfile << fun;
return *this;