Monday 18 December 2023

MAME: Getting Things Working

Its frustrating when the games you love don't work.
  • Moon Cresta and Galaxian crash on ARM because of a threading glitch (possibly in discrete.cpp), with an "negative samples" exception because the threads to generate the sound go out of order
  • Tekken 1 and 2 play no sound, and the coin button doesn't work
  • Vector games look like crap (asteroid, star wars, etc.)

Multithreading Issues

When I turned off optimization, and turned on debugging, the threading issue did not manifest. Its hard to debug. I tried to ask Bard what was up with the code, and it suggested std::launder on the pointers, that only masked the issue. Then "chuckie_the_egg" on Reddit suggested something brilliant: Set the number of processors to one or two and the problem likely won't happen. And Chuckie was right. 48 hours, even with mame's debug on, and no crashing. So, in your .mame folder, create a mooncrst.ini and galaxian.ini and add numprocessors 2.

Compiling for Aarch64

Chuckie also pointed out that he compiles with -fsigned-char on as this is a key difference between ARM and Intel (gcc vs mscode). I got to thinking, maybe this, and the odd behaviors I was experiencing on games like Tekken are due to this. Decades ago I wrote a uLaw to PCM converter. I know the old Sun Microsystems machines used signed bytes to represent the signed 8 bit audio. Maybe I should care about tuning MAME for the ODroid N2L too. In the makefile: ARCHOPTS = -fsigned-char -mtune=cortex-a73.cortex-a53 -march=armv8-a Wonderful, Tekken 1 and 2 both started working with sound. (Soul Edge does not, so I need to figure out why as it does on Intel.)

Vector

This is posted in many places, but vector games at high resolutions lose points and have weak lines. To fix all vector games, created a vector.ini and put this in as it will make points and lines bigger and brighter:
beam_width_min 1.5
beam_width_max 1.5
beam_dot_size 1.5
beam_intensity_weight 1.0