Fixed Alien Blaster not working on simulation - I've added lot of debug spam, it should be removed.

The problem is in the least obvious place - the std::ostringstream output deadlocks for no reason -
see file project/jni/application/src/asstring.h.
The only reason I can think of is that previously I've has one big statically linked library,
and now libstlport and libapplication areseparate shared libraries. But why then all std::vectors etc work?
This commit is contained in:
pelya
2010-05-12 19:49:48 +03:00
parent 2adcc9b8d8
commit 94df8e2921
15 changed files with 144 additions and 37 deletions

View File

@@ -22,6 +22,7 @@ using namespace std;
#include <cassert>
#include <string>
#include <map>
#include <android/log.h>
#include "SDL.h"
#include "options.h"
#include "settings.h"
@@ -38,17 +39,26 @@ 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";
@@ -77,9 +87,16 @@ 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");
}
@@ -97,24 +114,33 @@ 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() {