Added sound to xmen. This is also used for other games like GI-Joe.
I've also had a detailed looked at the crash in blockout.
This turned out to be quite involved.
I recompiled MAME with debugging information and used gdb on the resulting core file.
Unfortunately, with debugging symbols the MAME executable is 20MB in size and the core 10MB. Too much for the GP2X to handle! gdb was running out of malloc().
I recreated a special version of MAME which only had what was required to run blockout, the resulting executable was only 4MB.
I then ran the game to the point where it crashed (actually had to do this about 6 times) and finally got a core dump.
Using gdb I quickly found that the problem comes from the following:
02:41:01 /mnt/sd/mame4all#>gdb
GNU gdb 6.4
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "arm-gp2x-linux".
(gdb)
(gdb) file mame
Reading symbols from /mnt/sd/mame4all/mame...done.
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb)
(gdb) core-file core.112
Core was generated by `./mame blckout2 -cyclone -drz80 -clock 250'.
Program terminated with signal 11, Segmentation fault.
#0 0x001208a0 in OPM_CALC_CH7 (CH=0x500744) at src/sound/fm.cpp:3204
*CH->connect4 += OP_OUTN(NoiseCnt,eg_out4);
I followed this through and I think the NOISE_TABLE[] is being overflowed.
Basically it would mean that a newer version of the fm.cpp core is required (although a patch may do the trick).
Which isn't really that straightforward as all the FM sound chips rely on fm.cpp.
I think mame37b16 fixes this issue.
The reason why mamegp2x (the previous version based on 0.34) works is that I actually did this update (or something similar) to fix some other problem (which was causing MAME to crash after a few times.
Anyway I am going to leave this for now - I may come back to it later.
Anyway, using this method, I think it would be pretty easy to also find out why some DrZ80 games are also crashing on exit, like many of the Sega System 16 games for example. I'll investigate some of these later.