diff --git a/alienblaster/project/jni/application/Android.mk b/alienblaster/project/jni/application/Android.mk index c4b3ab370..5c4a0c108 100644 --- a/alienblaster/project/jni/application/Android.mk +++ b/alienblaster/project/jni/application/Android.mk @@ -22,9 +22,33 @@ LOCAL_SRC_FILES := $(foreach F, $(APP_SUBDIRS), $(addprefix $(F)/,$(notdir $(wil # Uncomment to also add C sources LOCAL_SRC_FILES += $(foreach F, $(APP_SUBDIRS), $(addprefix $(F)/,$(notdir $(wildcard $(LOCAL_PATH)/$(F)/*.c)))) -LOCAL_SHARED_LIBRARIES := sdl sdl_mixer tremor stlport +LOCAL_SHARED_LIBRARIES := sdl sdl_mixer tremor + +LOCAL_STATIC_LIBRARIES := stlport LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog -lz -include $(BUILD_SHARED_LIBRARY) +LIBS_WITH_LONG_SYMBOLS := $(strip $(shell \ + for f in $(LOCAL_PATH)/../../libs/armeabi/*.so ; do \ + if echo $$f | grep "libapplication[.]so" > /dev/null ; then \ + continue ; \ + fi ; \ + if [ -e "$$f" ] ; then \ + if nm -g $$f | cut -c 12- | egrep '.{128}' > /dev/null ; then \ + echo $$f | grep -o 'lib[^/]*[.]so' ; \ + fi ; \ + fi ; \ + done \ +) ) +ifneq "$(LIBS_WITH_LONG_SYMBOLS)" "" +$(foreach F, $(LIBS_WITH_LONG_SYMBOLS), \ +$(info Library $(F): abusing symbol names are: \ +$(shell nm -g $(LOCAL_PATH)/../../libs/armeabi/$(F) | cut -c 12- | egrep '.{128}' ) ) \ +$(info Library $(F) contains symbol names longer than 128 bytes, \ +YOUR CODE WILL DEADLOCK WITHOUT ANY WARNING when you'll access such function - \ +please make this library static to avoid problems. ) ) +$(error Detected libraries with too long symbol names. Remove all files under project/libs/armeabi, make these libs static, and recompile) +endif + +include $(BUILD_SHARED_LIBRARY) diff --git a/alienblaster/project/jni/application/src/asstring.h b/alienblaster/project/jni/application/src/asstring.h index 518122e6b..bd63bf4c3 100644 --- a/alienblaster/project/jni/application/src/asstring.h +++ b/alienblaster/project/jni/application/src/asstring.h @@ -20,12 +20,8 @@ #ifndef _AS_STRING_H_ #define _AS_STRING_H_ -//#include -#include +#include - -// TODO: why the hell this function deadlocks? Is ostringstream illegal in Android? And why did it work earlier? -/* template std::string asString(const T& obj) { std::ostringstream t; @@ -33,18 +29,5 @@ template std::string asString(const T& obj) { std::string res(t.str()); return res; } -*/ - -static inline std::string asString(int obj) { - char t[64]; - sprintf(t, "%i", obj); - return std::string (t); -} - -static inline std::string asString(unsigned int obj) { - char t[64]; - sprintf(t, "%u", obj); - return std::string (t); -} #endif diff --git a/alienblaster/project/jni/application/src/game.cpp b/alienblaster/project/jni/application/src/game.cpp index 98a4c1c74..471a042a5 100644 --- a/alienblaster/project/jni/application/src/game.cpp +++ b/alienblaster/project/jni/application/src/game.cpp @@ -74,37 +74,27 @@ int difficultyLevel; float actBackgroundPos; Game::Game() { - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() 0"); videoserver = new Video(); screen = 0; screen = videoserver->init(); - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() 1"); settings = new Settings(); - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() 11"); intro = new Intro( screen ); - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() 12"); setDifficulty = new SetDifficulty( screen ); menuArcadeMode = new MenuArcadeMode( screen ); - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() 13"); pauseSprite = surfaceDB.loadSurface( FN_PAUSED ); youLoseSprite = surfaceDB.loadSurface( FN_YOU_LOSE ); youWinSprite = surfaceDB.loadSurface( FN_YOU_WIN ); // for arcadeMode gameOverSprite = surfaceDB.loadSurface( FN_GAME_OVER ); - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() 14"); nukeEffectSurface = surfaceDB.loadSurface( FN_NUKE_EFFECT ); bossAlarm = Mixer::mixer().loadSample( FN_SOUND_BOSS_ALARM, 60 ); - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() 15"); - fontTime = new Font( FN_FONT_NUMBERS_TIME ); fontSizeTime = fontTime->getCharWidth(); - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() 16"); - racers = 0; explosions = 0; enemys = 0; @@ -138,8 +128,6 @@ Game::Game() { background = new Background(); loadLevel( FN_LEVEL_ONE_PLAYER ); - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() 2"); - SDL_Surface *loadingSprite = surfaceDB.loadSurface( FN_LOADING ); SDL_Rect dest; dest.x = (SCREEN_WIDTH - loadingSprite->w ) / 2; @@ -148,9 +136,7 @@ Game::Game() { dest.h = loadingSprite->h; SDL_BlitSurface( loadingSprite, 0, screen, &dest ); SDL_Flip( screen ); - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() 3"); initAllSurfaces(); - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() done"); } Game::~Game(){ diff --git a/alienblaster/project/jni/application/src/intro.cpp b/alienblaster/project/jni/application/src/intro.cpp index 9fa5ace40..2ed88919f 100644 --- a/alienblaster/project/jni/application/src/intro.cpp +++ b/alienblaster/project/jni/application/src/intro.cpp @@ -46,8 +46,6 @@ Intro::~Intro() {} void Intro::run( GameStates &gameState ) { - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Intro::run()"); - if ( playMusicOn && Mixer::mixer().whichMusicPlaying() != MUSIC_INTRO ) { Mixer::mixer().playMusic( MUSIC_INTRO, -1, 1000 ); } diff --git a/alienblaster/project/jni/application/src/settings.cpp b/alienblaster/project/jni/application/src/settings.cpp index 09c2a7d34..c582adb6a 100644 --- a/alienblaster/project/jni/application/src/settings.cpp +++ b/alienblaster/project/jni/application/src/settings.cpp @@ -39,26 +39,18 @@ Settings *settings; Settings::Settings() { opfile = NULL; - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::Settings() 0"); - introSprite = surfaceDB.loadSurface( FN_ALIENBLASTER_INTRO ); - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::Settings() 1"); - activeChoiceSprite = surfaceDB.loadSurface( FN_INTRO_SHOW_CHOICE ); bluePlain = surfaceDB.loadSurface( FN_SETTINGS_BLUE, true ); whitePlain = surfaceDB.loadSurface( FN_SETTINGS_WHITE, false ); - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::Settings() 2"); - fontMenu = new Font ( FN_FONT_SETTINGS ); fontMenuHighlighted = new Font ( FN_FONT_SETTINGS_HIGHLIGHTED ); fontNormal = new Font( FN_FONT_SETTINGS_SMALL ); fontKey = new Font ( FN_FONT_SETTINGS_SMALL_BLUE ); fontHighlighted = new Font( FN_FONT_SETTINGS_SMALL_HIGHLIGHTED ); - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::Settings() 3"); - playerEventNames[ PE_UNKNOWN ] = "UNKNOWN"; playerEventNames[ PE_UP ] = "UP"; playerEventNames[ PE_DOWN ] = "DOWN"; @@ -87,16 +79,10 @@ Settings::Settings() { defaultSettings[ string("PLAYER1-") + playerEventNames[ PE_FIRE_WEAPONS ] ] = SDLK_LCTRL; defaultSettings[ string("PLAYER1-") + playerEventNames[ PE_FIRE_SPECIALS ] ] = SDLK_LALT; - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::Settings() 4"); - setKeyNames(); - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::Settings() 5"); - loadSettings(); - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::Settings() done"); - } @@ -114,33 +100,24 @@ void Settings::loadSettings() { if (opfile) { delete opfile; } - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::loadSettings() 1"); opfile = new Options( FN_SETTINGS ); - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::loadSettings() 2"); playerKeys.clear(); for(int i=0; i < MAX_PLAYER_CNT; ++i) { - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::loadSettings() 21: %d", i); PlayerEventKeys pk; for(int t=1; t < PlayerEventCnt; ++t) { - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::loadSettings() 22: %d %d", i, t); - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::loadSettings() 221: %d %d str %s", i, t, asString(i).c_str()); int key; string keyname = string("PLAYER") + asString(i) + "-" + playerEventNames[(PlayerEvent)t]; - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::loadSettings() 23: %d %d", i, t); if (!opfile->getInt( keyname , key)) { key = defaultSettings[ keyname ]; restoredSettings = true; } pk[ (PlayerEvent)t ] = (SDLKey)key; - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::loadSettings() 24: %d %d", i, t); } playerKeys.push_back(pk); } - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::loadSettings() 3"); if (restoredSettings) { saveSettings(); } - __android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::loadSettings() done"); } void Settings::saveSettings() { diff --git a/alienblaster/project/jni/sdl/src/audio/android/SDL_androidaudio.c b/alienblaster/project/jni/sdl/src/audio/android/SDL_androidaudio.c index 210d831ed..09f6f0d2e 100644 --- a/alienblaster/project/jni/sdl/src/audio/android/SDL_androidaudio.c +++ b/alienblaster/project/jni/sdl/src/audio/android/SDL_androidaudio.c @@ -59,7 +59,6 @@ static void ANDROIDAUD_DeleteDevice(SDL_AudioDevice *device) static SDL_AudioDevice *ANDROIDAUD_CreateDevice(int devindex) { - __android_log_print(ANDROID_LOG_VERBOSE, "libSDL", "ANDROIDAUD_CreateDevice"); SDL_AudioDevice *this; /* Initialize all variables that we clean on shutdown */ @@ -152,7 +151,6 @@ static void ANDROIDAUD_CloseAudio(_THIS) static int ANDROIDAUD_OpenAudio(_THIS, SDL_AudioSpec *spec) { - __android_log_print(ANDROID_LOG_VERBOSE, "libSDL", "ANDROIDAUD_OpenAudio"); if( ! (spec->format == AUDIO_S8 || spec->format == AUDIO_S16) ) return (-1); // TODO: enable format conversion? Don't know how to do that in SDL @@ -186,8 +184,6 @@ static int ANDROIDAUD_OpenAudio(_THIS, SDL_AudioSpec *spec) SDL_mutexV(audioMutex); - __android_log_print(ANDROID_LOG_VERBOSE, "libSDL", "ANDROIDAUD_OpenAudio exit"); - return(0); } @@ -199,7 +195,6 @@ static void ANDROIDAUD_WaitAudio(_THIS) static void ANDROIDAUD_PlayAudio(_THIS) { - __android_log_print(ANDROID_LOG_VERBOSE, "libSDL", "ANDROIDAUD_PlayAudio: enter"); SDL_mutexP(audioMutex); //audioBuffer = this->hidden->mixbuf; @@ -213,7 +208,6 @@ static void ANDROIDAUD_PlayAudio(_THIS) this->hidden->mixbuf = audioBuffer; SDL_mutexV(audioMutex); - __android_log_print(ANDROID_LOG_VERBOSE, "libSDL", "ANDROIDAUD_PlayAudio: exit"); } #ifndef SDL_JAVA_PACKAGE_PATH @@ -302,8 +296,6 @@ extern jint JAVA_EXPORT_NAME(AudioThread_nativeAudioBufferLock) ( JNIEnv * env, if( audioMutex == NULL ) return(-1); - __android_log_print(ANDROID_LOG_VERBOSE, "libSDL", "nativeAudioBufferLock"); - SDL_mutexP(audioMutex); if( !audioInitialized ) @@ -342,8 +334,6 @@ extern jint JAVA_EXPORT_NAME(AudioThread_nativeAudioBufferUnlock) ( JNIEnv * env SDL_mutexV(audioMutex); - __android_log_print(ANDROID_LOG_VERBOSE, "libSDL", "nativeAudioBufferUnlock"); - SDL_CondSignal(audioCond); return 0; diff --git a/alienblaster/project/jni/sdl/src/video/android/SDL_androidvideo.c b/alienblaster/project/jni/sdl/src/video/android/SDL_androidvideo.c index 4c35660e4..e37b7c7e7 100644 --- a/alienblaster/project/jni/sdl/src/video/android/SDL_androidvideo.c +++ b/alienblaster/project/jni/sdl/src/video/android/SDL_androidvideo.c @@ -287,7 +287,6 @@ SDL_Surface *ANDROID_SetVideoMode(_THIS, SDL_Surface *current, /* Wait 'till we can draw */ ANDROID_FlipHWSurface(this, current); /* We're done */ - __android_log_print(ANDROID_LOG_INFO, "libSDL", "SDL_SetVideoMode(): done"); return(current); } @@ -362,7 +361,6 @@ static void ANDROID_UpdateRects(_THIS, int numrects, SDL_Rect *rects) static int ANDROID_FlipHWSurface(_THIS, SDL_Surface *surface) { - __android_log_print(ANDROID_LOG_INFO, "libSDL", "FlipHWSurface: Frame is ready to render"); if( ! WaitForNativeRender ) { __android_log_print(ANDROID_LOG_ERROR, "libSDL", "FlipHWSurface: called before SetVideoMode"); @@ -395,7 +393,6 @@ static int ANDROID_FlipHWSurface(_THIS, SDL_Surface *surface) if( WaitForNativeRenderState != Render_State_Started ) { - __android_log_print(ANDROID_LOG_INFO, "libSDL", "FlipHWSurface: Frame rendering done"); if( memBuffer == memBuffer1 ) memBuffer = memBuffer2; else @@ -421,8 +418,6 @@ static int ANDROID_FlipHWSurface(_THIS, SDL_Surface *surface) processAndroidTrackballKeyDelays( -1, 0 ); - __android_log_print(ANDROID_LOG_INFO, "libSDL", "FlipHWSurface: exit"); - return(0); }; @@ -814,7 +809,6 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeRender) ( JNIEnv* env, jobject thiz, jfloa // TODO: use accelerometer as joystick glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, memX, memY, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, memBufferTemp); glDrawTexiOES(0, sWindowHeight-memY, 1, memX, memY); - __android_log_print(ANDROID_LOG_INFO, "libSDL", "nativeRender: Frame rendered"); } //glFinish(); //glFlush(); diff --git a/alienblaster/project/jni/stlport/Android.mk b/alienblaster/project/jni/stlport/Android.mk index f38d518cf..00340f9bd 100644 --- a/alienblaster/project/jni/stlport/Android.mk +++ b/alienblaster/project/jni/stlport/Android.mk @@ -10,5 +10,5 @@ LOCAL_CPP_EXTENSION := .cpp LOCAL_SRC_FILES := $(addprefix src/,$(notdir $(wildcard $(LOCAL_PATH)/src/*.cpp $(LOCAL_PATH)/src/*.c)))) -include $(BUILD_SHARED_LIBRARY) +include $(BUILD_STATIC_LIBRARY)