pIMAME with adafruit controls buttons, joystick?
  • im a complete noob with raspberry pi and i though this would be asimple and fun project to do :)

    but im having trouble getting the controls to work as to me the instructions are not really clear cut

    http://learn.adafruit.com/retro-gaming-with-raspberry-pi/buttons

    ^i am using that i have the 2 bottons and joystick connected correctly to the GPIO pins and i've downloaded the thing from github and have it on my pi, but i dont understand what to do to make it work with Pimame (mame4all)
  • This is what I have done, I have filled up my GPIO with buttons!

    You have to assign a keyboard command to each button. All the instructions you have to do are in that Adfruit guide.

    there are a few files you have to edit.

    Read through the guide and check you have followed all the steps.

    good luck.
  • yes but the instructions are terrible i dont understand what to do, i know what to edit but im using the same setup as adafruit (for now) but i dont understand what to do AFTER you have the ZIP file on your Pi
  • Zip file? Is this the adafruit file? I unzipped it on my PC (not sure how to do this on RPi via command prompt) and copied the unzipped directory to my RPI, it goes in the Home directory from memory.
  • Just reading the instructions - yeah unzip to give you a Adafruit-Retrogame folder
  • i have it unziped on my pi using 'Git clone url' its in the directory /Adafruit-Retrogame

    i got it to work but when i addred to Rc.local nothing worked and when i went bakc to change rc.local it was completely blank
  • You need to make sure that you are editing the rc.local with 'sudo nano /etc/rc.local', without the 'sudo' it won't save changes. Also, double check that you typed the path in correctly (no caps and whatnot). If the path is typed in incorrectly, it creates a new blank file.

    So here are the steps that I used for creating my system:
    -unzip files, pull them over to raspberry pi (/home/pi/Adafruit-Retrogame)

    -edit the retrogame.c file to correspond to your button/gpio layout

    -save, exit

    -type: make

    -wait for the build

    -get uinput kernel, type: sudo modprobe uinput

    -make persistent, type: sudo sh -c 'echo uinput >> /etc/modules'

    -test, type: sudo ./retrogame

    -make sure all of your buttons work, plus each direction on joystick

    -ctrl+C to quit

    -type: sudo nano /etc/rc.local

    -Before the final “exit 0” line, insert this line: /home/pi/Adafruit-Retrogame/retrogame &

    -reboot
  • I found this thread very helpful. I followed your instructions as well as adafruits instructions and completed all the steps without errors. The controls still dont seem to work in the emulators.

    If i type this command: sudo ./retrogame
    The joystick is showing output and seems to be functioning correctly.

    I have triple checked to make sure the line in /etc/rc.local is entered correctly and it persists through reboots.

    Any ideas what i could be missing or doing wrong? I have been testing in the advancemame emulator and have checked my emulators input keys to make sure they are correct.

    Thanks in advance. :-)
  • After playing with this a little more this morning I found that the joystick is working in the pimame menu and at the command line but still nothing when advmame is running.
  • you may need to edit your advmame config files. It sounds like the joystick works, but the keys are mapped wrong. Check your '/home/pi/.advance/advmame.rc' file and make sure that everything is mapped correctly. Also, check to make sure that your mappings aren't doubled anywhere in the file (make sure there is only one entry for [p1_up], [p1_left],[p1_down], etc.) Multiple entries can overwrite each other.
  • I'm getting an error "fatal error: expat.h: No such file or directory" when trying to build retrogame.c

    Would you know why that is?
  • That is because you are also including the gamera.c in your make which requires the expat and ncurses libraries. Simply type:
    sudo apt-get install ncurses-dev libexpat1-dev
    then run your make again. you should be good from there.
  • Thanks! That got me a little further. And I'm onto another problem.

    I'm not sure if this is the same issue Ajwyant is having, but my joystick runs fine when I run sudo ./retrogame. However, the two buttons won't show any input.

    I get ^[[A for up, ^[[B for down, ^[[D for left and ^[[C for right. but when I push the buttons, I get nothing. I even tried to just remove the button and tap the two leads together to see if that would at least generate some output. Still nothing.

    I did check advmame.rc and everything is mapped the same for the buttons. Any ideas?
  • I would double check your retrogame config versus your gpio pins and make sure that you have the correct pins mapped. If you are getting feedback from your joystick, then a bad configuration is most likely your culprit.
  • @mholgatem - Do you happen to know where a person could download the older Adafruit Retrogame zip package or someone that can share it?

    The newer one has some additional code in the retrogame.c for Adafruit's Cupcade and Vulcan Pinch (two-key presses) that requires the ncurses and expat install.

    The older version I believe works without the extra install piece but I can't find it anywhere. It looks like it was updated a few months ago on Github to the newer version.
  • Perfect! Thank you very much I really appreciate that!! :)
  • I have the issue that it seems most users have - followed the install etc and got the keyboard presses to work in terminal, but once you launch advmenu/advmame, there is nothing.... It seems to be a problem within those emulators - does anyone have a work around or fix for this?
  • did you run the controller config after setting up the retrogame utility?
  • I used all of the default key mappings from advmame, so didn't change anything. I did read another post somewhere that if you unplug the usb keyboard, that the joystick commands will then work. I will try that approach tomorrow and see how it goes.
  • Hi
    i created a profile simple to ask on this thread.
    i get up to the stage where i have edited the retrogame c file and try to use make but i keep getting the message
    make: *** No rule to make target 'retrogame'. stop

    any advice would be much appricated.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!