crow_riot said:
-) what was the problem all others including me experienced - if there was such a thing
-) how did you find it
-) what was the solution to it
Like planned, I started from the Wiz version, and as that has custom framebuffer code, I've ifdefed that out and put code from PCSX instead. With that done, menu started fine, but the game would hang shortly after starting. To figure out what's going on, I've disabled optimization add added debug information (-g) to compiler options. Starting such version under gdb and interrupting it (ctrl-c) after it hangs, I could see there are 2 threads and both of them wait on cond variable in sound.c .
After reviewing the code and printing out some variables with gdb, I found out that main thread produced some sound and started waiting for sound thread to play it, but sound thread did not start playing as SDL asked for more data on it's first call then the main thread ever produced. After some more code review it turned out gpSP did not check buffer size after setting it, was assuming it set smaller buffer that SDL really accepted, causing it not to produce enough sound data in it's main thread. To fix that, I've made it to read buffer size back from SDL_AudioSpec that SDL_OpenAudio() returns, and the hang was gone.
There is still another problem though - sound only works properly if you compile without optimization, to fix it, I'll need to:
- turn on all compiler warnings - gpSP has them off for some reason
- find out the c file responsible by disabling optimization selectively on source files
- find the exact optimization causing the problem by disabling optimizations selectively (-f-no-whatever-optimization) to get more clues about the problem
- review code, perhaps move portions to separate .c file temporary to find out what's responsible
Don't know about all those cache/bad jump problems, it just worked for me. Maybe only GP2X-SDL version suffers from it or something.