Advance Mame 1.4 Modified for GLES driver on RPI

I am not a GL expert, I wrote this code after playing around with line drawing in GLES. I got a lot of good help and some great example code from the Raspberry Pi Forum

2d lines using GLES2?

I wanted to see if I could hack up a simple GLES driver for vector games on the Raspberry Pi board. I recently wrote some code for another project and knew I could do the basics.

The code is a bit hacky, and I am sure it has some bugs. The main issue is that to work properly on GL the code needs some way to determine when the game has fully drawn a 'screen'. The problem is that original vector games did not draw 'screens', they simply keep drawing lines .... My solution was to use a time based algorithm to plot a 'screen' every N milliseconds. I also set the schedular to a more real time pattern.

Compiling is complete arse pain, I am not sure I have it down to an art yet. gcc-4.7 is needed to compile advancemame but the newer Raspian images dont seem to work for me (double free complaints building almost everything). I am using a pretty old raspian (as it was what was on the first RPI board I took out of the cupboard). To build the modified package is something like this:

# cd advancemame-1-4_ja_modified/
# cd src/vidhrdw/

# ./compile
# cd ../..
# make;make install

To build the whole lot from scratch see the cut&pasted text in README.jon
At the moment I am finding it tricky to build on the newer Raspian.

I have left the compiled objects (.o files) in place, it is worth just untaring and trying a make install to test it. If you run ./configure then you may need to refer to JAMakefile and put the change to CONF_LDFLAGS back in - I did say it was hacked in !.

The code is needs re-integrating into MAME. I dont know enough about the internals of it but I have hope that someone will take the code and improve it. The main chunk of code is in src/vidhrdw/vector.c and the two extra files inc_GLES_init.c and inc_plotline_gl.c

For some reason a game may run a little slowly and have broken sound, exiting and re-starting it makes it better, I have no idea why.

Download advancemame-1-4_ja_modified_V0.5.tar.gz

For a quick lazy test install a standard copy of advmame-1-4 then copy this binary into /bin.


For reference here is the config.txt (/boot/config.txt) from the Rasperry Pi 2 board I recorded the video from config.txt


Running on RPI 2 board connected to 42inch LG plasma TV.
I added 'modprobe snd-pcm-oss' to /etc/rc.local (before exit 0 !), setting hdmi_drive=2 in /boot/config.txt gave me sound via HDMI

All content on this site is (c) 2017 Jonathan Andrews, This article is marked as free and open. Feel free to copy and or republish it