Removed debug spam, fixed issue in libstlport - seems that it cannot be linked dynamically because

it has some export symbols with length bigger than 128, and app hangs when trying to access them.
Fortunately libstlport has MIT-like license, so it can be linked to closed-source apps statically.
This commit is contained in:
pelya
2010-05-13 14:54:11 +03:00
parent 94df8e2921
commit 5cfa74a057
8 changed files with 28 additions and 76 deletions

View File

@@ -22,9 +22,33 @@ LOCAL_SRC_FILES := $(foreach F, $(APP_SUBDIRS), $(addprefix $(F)/,$(notdir $(wil
# Uncomment to also add C sources # Uncomment to also add C sources
LOCAL_SRC_FILES += $(foreach F, $(APP_SUBDIRS), $(addprefix $(F)/,$(notdir $(wildcard $(LOCAL_PATH)/$(F)/*.c)))) 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 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)

View File

@@ -20,12 +20,8 @@
#ifndef _AS_STRING_H_ #ifndef _AS_STRING_H_
#define _AS_STRING_H_ #define _AS_STRING_H_
//#include <sstream> #include <sstream>
#include <stdio.h>
// TODO: why the hell this function deadlocks? Is ostringstream illegal in Android? And why did it work earlier?
/*
template<typename T> std::string asString(const T& obj) { template<typename T> std::string asString(const T& obj) {
std::ostringstream t; std::ostringstream t;
@@ -33,18 +29,5 @@ template<typename T> std::string asString(const T& obj) {
std::string res(t.str()); std::string res(t.str());
return res; 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 #endif

View File

@@ -74,37 +74,27 @@ int difficultyLevel;
float actBackgroundPos; float actBackgroundPos;
Game::Game() { Game::Game() {
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() 0");
videoserver = new Video(); videoserver = new Video();
screen = 0; screen = 0;
screen = videoserver->init(); screen = videoserver->init();
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() 1");
settings = new Settings(); settings = new Settings();
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() 11");
intro = new Intro( screen ); intro = new Intro( screen );
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() 12");
setDifficulty = new SetDifficulty( screen ); setDifficulty = new SetDifficulty( screen );
menuArcadeMode = new MenuArcadeMode( screen ); menuArcadeMode = new MenuArcadeMode( screen );
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() 13");
pauseSprite = surfaceDB.loadSurface( FN_PAUSED ); pauseSprite = surfaceDB.loadSurface( FN_PAUSED );
youLoseSprite = surfaceDB.loadSurface( FN_YOU_LOSE ); youLoseSprite = surfaceDB.loadSurface( FN_YOU_LOSE );
youWinSprite = surfaceDB.loadSurface( FN_YOU_WIN ); youWinSprite = surfaceDB.loadSurface( FN_YOU_WIN );
// for arcadeMode // for arcadeMode
gameOverSprite = surfaceDB.loadSurface( FN_GAME_OVER ); gameOverSprite = surfaceDB.loadSurface( FN_GAME_OVER );
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() 14");
nukeEffectSurface = surfaceDB.loadSurface( FN_NUKE_EFFECT ); nukeEffectSurface = surfaceDB.loadSurface( FN_NUKE_EFFECT );
bossAlarm = Mixer::mixer().loadSample( FN_SOUND_BOSS_ALARM, 60 ); 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 ); fontTime = new Font( FN_FONT_NUMBERS_TIME );
fontSizeTime = fontTime->getCharWidth(); fontSizeTime = fontTime->getCharWidth();
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() 16");
racers = 0; racers = 0;
explosions = 0; explosions = 0;
enemys = 0; enemys = 0;
@@ -138,8 +128,6 @@ Game::Game() {
background = new Background(); background = new Background();
loadLevel( FN_LEVEL_ONE_PLAYER ); loadLevel( FN_LEVEL_ONE_PLAYER );
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() 2");
SDL_Surface *loadingSprite = surfaceDB.loadSurface( FN_LOADING ); SDL_Surface *loadingSprite = surfaceDB.loadSurface( FN_LOADING );
SDL_Rect dest; SDL_Rect dest;
dest.x = (SCREEN_WIDTH - loadingSprite->w ) / 2; dest.x = (SCREEN_WIDTH - loadingSprite->w ) / 2;
@@ -148,9 +136,7 @@ Game::Game() {
dest.h = loadingSprite->h; dest.h = loadingSprite->h;
SDL_BlitSurface( loadingSprite, 0, screen, &dest ); SDL_BlitSurface( loadingSprite, 0, screen, &dest );
SDL_Flip( screen ); SDL_Flip( screen );
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() 3");
initAllSurfaces(); initAllSurfaces();
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Game::Game() done");
} }
Game::~Game(){ Game::~Game(){

View File

@@ -46,8 +46,6 @@ Intro::~Intro() {}
void Intro::run( GameStates &gameState ) { void Intro::run( GameStates &gameState ) {
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Intro::run()");
if ( playMusicOn && Mixer::mixer().whichMusicPlaying() != MUSIC_INTRO ) { if ( playMusicOn && Mixer::mixer().whichMusicPlaying() != MUSIC_INTRO ) {
Mixer::mixer().playMusic( MUSIC_INTRO, -1, 1000 ); Mixer::mixer().playMusic( MUSIC_INTRO, -1, 1000 );
} }

View File

@@ -39,26 +39,18 @@ Settings *settings;
Settings::Settings() { Settings::Settings() {
opfile = NULL; opfile = NULL;
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::Settings() 0");
introSprite = surfaceDB.loadSurface( FN_ALIENBLASTER_INTRO ); introSprite = surfaceDB.loadSurface( FN_ALIENBLASTER_INTRO );
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::Settings() 1");
activeChoiceSprite = surfaceDB.loadSurface( FN_INTRO_SHOW_CHOICE ); activeChoiceSprite = surfaceDB.loadSurface( FN_INTRO_SHOW_CHOICE );
bluePlain = surfaceDB.loadSurface( FN_SETTINGS_BLUE, true ); bluePlain = surfaceDB.loadSurface( FN_SETTINGS_BLUE, true );
whitePlain = surfaceDB.loadSurface( FN_SETTINGS_WHITE, false ); whitePlain = surfaceDB.loadSurface( FN_SETTINGS_WHITE, false );
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::Settings() 2");
fontMenu = new Font ( FN_FONT_SETTINGS ); fontMenu = new Font ( FN_FONT_SETTINGS );
fontMenuHighlighted = new Font ( FN_FONT_SETTINGS_HIGHLIGHTED ); fontMenuHighlighted = new Font ( FN_FONT_SETTINGS_HIGHLIGHTED );
fontNormal = new Font( FN_FONT_SETTINGS_SMALL ); fontNormal = new Font( FN_FONT_SETTINGS_SMALL );
fontKey = new Font ( FN_FONT_SETTINGS_SMALL_BLUE ); fontKey = new Font ( FN_FONT_SETTINGS_SMALL_BLUE );
fontHighlighted = new Font( FN_FONT_SETTINGS_SMALL_HIGHLIGHTED ); fontHighlighted = new Font( FN_FONT_SETTINGS_SMALL_HIGHLIGHTED );
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::Settings() 3");
playerEventNames[ PE_UNKNOWN ] = "UNKNOWN"; playerEventNames[ PE_UNKNOWN ] = "UNKNOWN";
playerEventNames[ PE_UP ] = "UP"; playerEventNames[ PE_UP ] = "UP";
playerEventNames[ PE_DOWN ] = "DOWN"; 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_WEAPONS ] ] = SDLK_LCTRL;
defaultSettings[ string("PLAYER1-") + playerEventNames[ PE_FIRE_SPECIALS ] ] = SDLK_LALT; defaultSettings[ string("PLAYER1-") + playerEventNames[ PE_FIRE_SPECIALS ] ] = SDLK_LALT;
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::Settings() 4");
setKeyNames(); setKeyNames();
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::Settings() 5");
loadSettings(); loadSettings();
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::Settings() done");
} }
@@ -114,33 +100,24 @@ void Settings::loadSettings() {
if (opfile) { if (opfile) {
delete opfile; delete opfile;
} }
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::loadSettings() 1");
opfile = new Options( FN_SETTINGS ); opfile = new Options( FN_SETTINGS );
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::loadSettings() 2");
playerKeys.clear(); playerKeys.clear();
for(int i=0; i < MAX_PLAYER_CNT; ++i) { for(int i=0; i < MAX_PLAYER_CNT; ++i) {
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::loadSettings() 21: %d", i);
PlayerEventKeys pk; PlayerEventKeys pk;
for(int t=1; t < PlayerEventCnt; ++t) { 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; int key;
string keyname = string("PLAYER") + asString(i) + "-" + playerEventNames[(PlayerEvent)t]; 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)) { if (!opfile->getInt( keyname , key)) {
key = defaultSettings[ keyname ]; key = defaultSettings[ keyname ];
restoredSettings = true; restoredSettings = true;
} }
pk[ (PlayerEvent)t ] = (SDLKey)key; pk[ (PlayerEvent)t ] = (SDLKey)key;
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::loadSettings() 24: %d %d", i, t);
} }
playerKeys.push_back(pk); playerKeys.push_back(pk);
} }
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::loadSettings() 3");
if (restoredSettings) { if (restoredSettings) {
saveSettings(); saveSettings();
} }
__android_log_print(ANDROID_LOG_VERBOSE, "alienblaster", "Settings::loadSettings() done");
} }
void Settings::saveSettings() { void Settings::saveSettings() {

View File

@@ -59,7 +59,6 @@ static void ANDROIDAUD_DeleteDevice(SDL_AudioDevice *device)
static SDL_AudioDevice *ANDROIDAUD_CreateDevice(int devindex) static SDL_AudioDevice *ANDROIDAUD_CreateDevice(int devindex)
{ {
__android_log_print(ANDROID_LOG_VERBOSE, "libSDL", "ANDROIDAUD_CreateDevice");
SDL_AudioDevice *this; SDL_AudioDevice *this;
/* Initialize all variables that we clean on shutdown */ /* 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) 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) ) if( ! (spec->format == AUDIO_S8 || spec->format == AUDIO_S16) )
return (-1); // TODO: enable format conversion? Don't know how to do that in SDL 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); SDL_mutexV(audioMutex);
__android_log_print(ANDROID_LOG_VERBOSE, "libSDL", "ANDROIDAUD_OpenAudio exit");
return(0); return(0);
} }
@@ -199,7 +195,6 @@ static void ANDROIDAUD_WaitAudio(_THIS)
static void ANDROIDAUD_PlayAudio(_THIS) static void ANDROIDAUD_PlayAudio(_THIS)
{ {
__android_log_print(ANDROID_LOG_VERBOSE, "libSDL", "ANDROIDAUD_PlayAudio: enter");
SDL_mutexP(audioMutex); SDL_mutexP(audioMutex);
//audioBuffer = this->hidden->mixbuf; //audioBuffer = this->hidden->mixbuf;
@@ -213,7 +208,6 @@ static void ANDROIDAUD_PlayAudio(_THIS)
this->hidden->mixbuf = audioBuffer; this->hidden->mixbuf = audioBuffer;
SDL_mutexV(audioMutex); SDL_mutexV(audioMutex);
__android_log_print(ANDROID_LOG_VERBOSE, "libSDL", "ANDROIDAUD_PlayAudio: exit");
} }
#ifndef SDL_JAVA_PACKAGE_PATH #ifndef SDL_JAVA_PACKAGE_PATH
@@ -302,8 +296,6 @@ extern jint JAVA_EXPORT_NAME(AudioThread_nativeAudioBufferLock) ( JNIEnv * env,
if( audioMutex == NULL ) if( audioMutex == NULL )
return(-1); return(-1);
__android_log_print(ANDROID_LOG_VERBOSE, "libSDL", "nativeAudioBufferLock");
SDL_mutexP(audioMutex); SDL_mutexP(audioMutex);
if( !audioInitialized ) if( !audioInitialized )
@@ -342,8 +334,6 @@ extern jint JAVA_EXPORT_NAME(AudioThread_nativeAudioBufferUnlock) ( JNIEnv * env
SDL_mutexV(audioMutex); SDL_mutexV(audioMutex);
__android_log_print(ANDROID_LOG_VERBOSE, "libSDL", "nativeAudioBufferUnlock");
SDL_CondSignal(audioCond); SDL_CondSignal(audioCond);
return 0; return 0;

View File

@@ -287,7 +287,6 @@ SDL_Surface *ANDROID_SetVideoMode(_THIS, SDL_Surface *current,
/* Wait 'till we can draw */ /* Wait 'till we can draw */
ANDROID_FlipHWSurface(this, current); ANDROID_FlipHWSurface(this, current);
/* We're done */ /* We're done */
__android_log_print(ANDROID_LOG_INFO, "libSDL", "SDL_SetVideoMode(): done");
return(current); return(current);
} }
@@ -362,7 +361,6 @@ static void ANDROID_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
static int ANDROID_FlipHWSurface(_THIS, SDL_Surface *surface) static int ANDROID_FlipHWSurface(_THIS, SDL_Surface *surface)
{ {
__android_log_print(ANDROID_LOG_INFO, "libSDL", "FlipHWSurface: Frame is ready to render");
if( ! WaitForNativeRender ) if( ! WaitForNativeRender )
{ {
__android_log_print(ANDROID_LOG_ERROR, "libSDL", "FlipHWSurface: called before SetVideoMode"); __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 ) if( WaitForNativeRenderState != Render_State_Started )
{ {
__android_log_print(ANDROID_LOG_INFO, "libSDL", "FlipHWSurface: Frame rendering done");
if( memBuffer == memBuffer1 ) if( memBuffer == memBuffer1 )
memBuffer = memBuffer2; memBuffer = memBuffer2;
else else
@@ -421,8 +418,6 @@ static int ANDROID_FlipHWSurface(_THIS, SDL_Surface *surface)
processAndroidTrackballKeyDelays( -1, 0 ); processAndroidTrackballKeyDelays( -1, 0 );
__android_log_print(ANDROID_LOG_INFO, "libSDL", "FlipHWSurface: exit");
return(0); return(0);
}; };
@@ -814,7 +809,6 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeRender) ( JNIEnv* env, jobject thiz, jfloa
// TODO: use accelerometer as joystick // TODO: use accelerometer as joystick
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, memX, memY, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, memBufferTemp); 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); glDrawTexiOES(0, sWindowHeight-memY, 1, memX, memY);
__android_log_print(ANDROID_LOG_INFO, "libSDL", "nativeRender: Frame rendered");
} }
//glFinish(); //glFlush(); //glFinish(); //glFlush();

View File

@@ -10,5 +10,5 @@ LOCAL_CPP_EXTENSION := .cpp
LOCAL_SRC_FILES := $(addprefix src/,$(notdir $(wildcard $(LOCAL_PATH)/src/*.cpp $(LOCAL_PATH)/src/*.c)))) LOCAL_SRC_FILES := $(addprefix src/,$(notdir $(wildcard $(LOCAL_PATH)/src/*.cpp $(LOCAL_PATH)/src/*.c))))
include $(BUILD_SHARED_LIBRARY) include $(BUILD_STATIC_LIBRARY)