Angband's Init_Sdl_Local() Function


dftruf

Still Fresh
Joined
Aug 9, 2006
Messages
61
Hi,

I've compiled angband 3.0.9a executable for wiz by arm-linux-gcc compiler from windows sdk.
Compiler and linker doesn't print any errors. I used SDL module. I have all resources files in right path.
But when I run it, then there is error - segmentation fault.

In main-sdl.c I've put some printf for debugging.
Segmentation fault occurs between "_3" and "_4", so program doesn't print "_4"


//... in main-sdl.c ....
printf( "_1\n" );
init_paths();
printf( "_2\n" );
/* Load prefs */
load_prefs();
printf( "_3\n" );

/* Get sdl going */
init_sdl_local();
printf( "_4\n" );
//...


At the beginning of the function init_sdl_local() I have printf( "__1\n" );
Why "__1" doesn't show when I run the program ?
How to debug such painful errors?
 
I would use fprintf(stderr, "__1\n") instead of printf, because printf is buffered. It could be that "__1\n" is reached after all, but never printed on the screen because the program segfaults immediately after.

Check that init_sdl_local() doesn't call unsupported things. The screen surface should be 320x240 8 or 16 bits, and SDL_SWSURFACE only.
 
Alex. said:
I would use fprintf(stderr, "__1\n") instead of printf, because printf is buffered. It could be that "__1\n" is reached after all, but never printed on the screen because the program segfaults immediately after.

Check that init_sdl_local() doesn't call unsupported things. The screen surface should be 320x240 8 or 16 bits, and SDL_SWSURFACE only.


Thank You a lot, this is useful info for me. My porting of angband progress a little further. I'll check sources for newest version (3.1.2 v2)
 
Last edited by a moderator:
Hey dfTruF,

just to give a bit feedback. Game is in working state i'd say. However there are a few caveats even bugs.

* the split viewport which involves alot of clicking to be on the tracks
* multi-messages are not quequed like in original (with some delay) but instead overwritten:
like <xyz screams in agony> <xyz hits you> or the level up messages
* game starts to get dead slow after some while and eventually crashes soon after.

For remedy i'd suggest a resized viewport... i would reduce the amount of tiles visible on screen by redefining terminal size. Without any code insight i would assume that Angband has some scaling code built-in.

As for the multi-messages, just add some delay when that happens.

The slowdowns are serious. Only remedy so far is repeated saving while still on the hunt. I haven't checked it running on terminal but i assume its a memory leakage which slowly starts to consume main memory which you eventually run out of.
 
StarG said:
Hey dfTruF,

just to give a bit feedback. Game is in working state i'd say. However there are a few caveats even bugs.
...

I don't know why game starts to get slow, because I don't know how to debug it (I use win XP version of SDK). I know that this bug concerns memory leakage caused by some sdl function (probably some function that stores sdl surface in memory and not removes it).

I've tried to use flush functions (for keyboard, screen and terminal) implemented in the game, and still game starts to get slow after pushing few thousands buttons.

I've read in the source code that minimal terminal size is 80x24 (in char tiles). This is minimum which is understandable by the game's drawing algorithms.
I've tried to use smaller font but this looks faint and not comfortable.
 
Last edited by a moderator:
Back
Top