Tried to duplicate your work to see what's going on.
I changed the obvious things in the Makefile, and in global.h wrote:
const int SCREEN_WIDTH = 320;
const int SCREEN_HEIGHT = 240;
const int BIT_DEPTH = 16;
ran make, stripped the executable to save some space, copied executable and what I think is the gamedata to sd card.
ran alienblaster on gp2x using sterm, got some initialisation messages and then a SEGV.
Then I made a native build to compare, that seemed to start up fine, although with the smaller screen the menus are messed up, so it's going to be more work to make it work on GP2X anyway.
Looked a little closer at the source, video.cc calls SDL_SetVideoMode with SDL_DOUBLEBUF, which doesn't work on GP2X:
http://wiki.gp2x.org/wiki/SDL_FAQ
Will try a little more (have some time during my nightshift)
Edit 1:
changed the video.cc lines to read:
screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, BIT_DEPTH, SDL_SWSURFACE /* | SDL_FULLSCREEN */ );
now it doesn't give a SEGV anymore, but "does not exist!es/tile-water.bmp" comes up instead. Looks like it overwrote part of the error message, so it's a little hard to interpret, but looking at the imag
es directory there _is_ a tile-water.bmp there. Maybe it needs a ./ as some of the names in the .cfg files do have this and some don't.
Edit 2:
The error seems to come from surfaceDB.cc:
Code:
// open the file for reading
ifstream inputFile ( fn.c_str(), ios::in);
if (!inputFile.good()) {
cout << "ERROR: file " << fn << " does not exist!" << endl;
exit(1);
}
added some extra debug output (developers have it dump to cout, not cerr, so I followed suit):
cout << "Opened: " << fn << endl;
This prints out about 21 files that are 'good()', then it fails for the water tile. probably some resource is running out... I doubt that if good() returns false, it means for sure that the file doesn't exists, so probably need to add better error handling here to figure out what is going on.
Going to have to brush up on my C++ to do this though...
More later.
Edit 3:
Read
http://www.cplusplus.com/ref/iostream/ios/good.html, added more debugging to the surfaceDB.cc file:
Code:
out << inputFile.bad() << endl << inputFile.eof() << endl << inputFile.fail() << endl;
this returns 0 0 1 , so the 'fail bit' is set in the stream. looks like the function is never closing these files it opens, so maybe it's running out of handles. Also it's just opening them to check if the files exist. probably would be better to just check if SDL_LoadBMP returns a non NULL pointer instead. Ripping this part out of the function:
Code:
SDL_Surface *SurfaceDB::loadSurface( string fn, bool alpha ) {
SDL_Surface *searchResult = getSurface( fn );
if ( searchResult ) {
return searchResult;
}
cout << "Opening: " << fn << endl;
SDL_Surface *newSurface = SDL_LoadBMP( fn.c_str() );
if (newSurface == NULL) {
cout << SDL_GetError() << endl;
exit(1);
}
SDL_SetColorKey( newSurface, SDL_SRCCOLORKEY,
SDL_MapRGB(newSurface->format, transR, transG, transB) );
if ( alpha ) {
SDL_SetAlpha( newSurface, SDL_SRCALPHA, 128 );
}
surfaceDB[ fn ] = newSurface;
return newSurface;
}
Doesn't help much, the SDL error is just "Couldn't open ./images/tile-water.bmp"
Pieter