Export to GitHub

mame4all-pi - issue #33

PS3 controllers not working in UI or in-game


Posted on Sep 16, 2013 by Quick Bird

What steps will reproduce the problem? 1. "apt-get install joystick" 2. Connect ps3 controller with a USB cable 3. Reboot pi 4. When booted, hit PS button on PS3 controller 5. jstest /dev/input/js0 shows axis 0 and 1 changing for left analogue stick 6. Launch mame4all, UI won't respond to axis 0/1, or buttons. Ingame buttons/axis don't register any input from the PS3 controller. 7. Supporting info - pimenu and fba2x both register input from the ps3 controller OK. On the same setup, a wired xbox controller (with xboxdrv running) works for all (mame4all, pimenu, fba2x). When using the xbox controller, I see more entries of the form "/dev/input/eventX" than I do with the PS3 controller. This may be related, maybe not.

What is the expected output? What do you see instead? Expected - ps3 controller input controls menus and ingame controls. Actual - no response to any ps3 controller input in any part of mame4all, despite working OK in pimenu and fba2x.

What version of the product are you using? On what operating system? Confirmed in 2013-09-02 release, and prior 2013-06-08 release.

Please provide any additional information below. Massive thanks for developing this port, it's by far the best retro experience on the Pi.

Comment #1

Posted on Nov 7, 2013 by Swift Bear

I can confirm this bug. Get nothing with my PS3 controller. Controller works fine in other emu's such as Retroarch. "jstest /dev/input/js0" ofcourse works.

Comment #2

Posted on Mar 12, 2014 by Grumpy Elephant

I also confirm this bug, same behaviour. I'm going to subscribe for future updates. Thanks!

Comment #3

Posted on Apr 13, 2014 by Swift Panda

I think I've figured out this bug. There is code in rpi/minimal.cpp that rejects any joystick that has more than 6 axes. The PS3 "sixaxis" (ironically) has way more than that, due to its analog buttons. I commented that section out (lines 168-174) and recompiled, and PS3 controller works perfectly. This is what it looks like:

                            if (SDL_JoystickNumAxes(myjoy[i]) > 6)
                            {
                                    SDL_JoystickClose(myjoy[i]);
                                    myjoy[i]=0;
                                    logerror("Error detected invalid joystick/keyboard\n");
                                    break;
                            }

Comment #4

Posted on Apr 13, 2014 by Swift Panda

Additionally, the "break" appears to be a bug as well. This means not only will it reject this joystick, but all subsequent joysticks won't be scanned. So if you have a PS3 as joystick 1, but something simple as joystick 2, neither will work.

Comment #5

Posted on Apr 13, 2014 by Grumpy Elephant

I recompiled with your "hint" and after the configuration in mame menu, now finally it's working the ps3 controller. Thanks!!

Comment #6

Posted on Apr 14, 2014 by Grumpy Hippo

I have commented out lines 168-174 in rpi/minimal.cpp as suggested in post #3 but I know nothing about compiling C++ code. Any advice regards commands to do this in a terminal would be appreciated. Thanks.

I am using Linux Mint 15 on my desktop and mame4all within the RetroPie package.

Comment #7

Posted on Apr 14, 2014 by Swift Panda

Try just going to the mame4all directory and typing "make." If you get errors, you may need to install some packages (my retropie seemed to have everything needed already).

Comment #8

Posted on Apr 14, 2014 by Swift Panda

Note you should actually do the compile on the retropie itself, to make sure the binary is compatible. If you do it on your desktop that's called "cross-compiling" and is more complex. The full compile will probably take several hours.

Comment #9

Posted on Apr 15, 2014 by Grumpy Hippo

The make command worked perfectly. Many thanks.

Comment #10

Posted on Sep 16, 2014 by Happy Bear

Comment deleted

Comment #11

Posted on Oct 10, 2014 by Quick Kangaroo

after i try the above suggestion when i run make command for compiling i get this error

//usr/lib/arm-linux-gnueabihf/libasound.so.2: error adding symbols: DSO missing from command line collect2: ld returned 1 exit status Makefile:67: recipe for target 'mame' failed make: * [mame] Error 1

if somebody can point me in the right direction how to solve it would be much appreciated.

thanks

Comment #12

Posted on Oct 10, 2014 by Happy Bear

Try compile with retropie 2.2 got the same issue with 2.3

Comment #13

Posted on Oct 11, 2014 by Quick Kangaroo

in case is usefull for somebody else. here is what i did to recompile: I installed a bunch of packages recommended for xbmc version of paspbian. i think not all of them are requiered but i did them all:

sudo apt-get install build-essential autoconf ccache gawk gperf mesa-utils zip unzip

sudo apt-get install autotools-dev comerr-dev dpkg-dev libalsaplayer-dev \
libapt-pkg-dev:armhf libasound2-dev:armhf libass-dev:armhf libatk1.0-dev \
libavahi-client-dev libavahi-common-dev libavcodec-dev libavformat-dev \
libavutil-dev libbison-dev:armhf libbluray-dev:armhf libboost1.49-dev \
libbz2-dev:armhf libc-dev-bin libc6-dev:armhf libcaca-dev libcairo2-dev \
libcdio-dev libclalsadrv-dev libcrypto++-dev libcups2-dev libcurl3-gnutls-dev \
libdbus-1-dev libdbus-glib-1-dev libdirectfb-dev libdrm-dev libegl1-mesa-dev \
libelf-dev libenca-dev libept-dev libevent-dev libexpat1-dev libflac-dev:armhf \
libfontconfig1-dev libfreetype6-dev libfribidi-dev libgconf2-dev \
libgcrypt11-dev libgdk-pixbuf2.0-dev libgl1-mesa-dev libgles2-mesa-dev \
libglew-dev:armhf libglewmx-dev:armhf libglib2.0-dev libglu1-mesa-dev \
libgnome-keyring-dev libgnutls-dev libgpg-error-dev libgtk2.0-dev libhal-dev \
libhunspell-dev:armhf libice-dev:armhf libicu-dev libidn11-dev libiso9660-dev \
libjasper-dev libjbig-dev:armhf libjconv-dev libjpeg8-dev:armhf libkrb5-dev \
libldap2-dev:armhf libltdl-dev:armhf liblzo2-dev libmad0-dev libmicrohttpd-dev \
libmodplug-dev libmp3lame-dev:armhf libmpeg2-4-dev libmysqlclient-dev \
libncurses5-dev libnspr4-dev libnss3-dev libogg-dev:armhf libopenal-dev:armhf \
libp11-kit-dev libpam0g-dev:armhf libpango1.0-dev libpcre++-dev libpcre3-dev \
libpixman-1-dev libpng12-dev libprotobuf-dev libpthread-stubs0-dev:armhf \
libpulse-dev:armhf librtmp-dev libsamplerate0-dev:armhf \
libsdl-image1.2-dev:armhf libsdl1.2-dev libslang2-dev:armhf \
libsm-dev:armhf libsmbclient-dev:armhf libspeex-dev:armhf \
libsqlite3-dev libssh-dev libssh2-1-dev libssl-dev libstdc++6-4.6-dev \
libtagcoll2-dev libtasn1-3-dev libtiff4-dev libtinfo-dev:armhf libtinyxml-dev \
libts-dev:armhf libudev-dev libv8-dev libva-dev:armhf libvdpau-dev:armhf \
libvorbis-dev:armhf libvpx-dev:armhf libwebp-dev:armhf libwibble-dev \
libx11-dev:armhf libx11-xcb-dev libxapian-dev libxau-dev:armhf \
libxcb-glx0-dev:armhf libxcb-render0-dev:armhf libxcb-shm0-dev:armhf \
libxcb1-dev:armhf libxcomposite-dev libxcursor-dev:armhf libxdamage-dev \
libxdmcp-dev:armhf libxext-dev:armhf libxfixes-dev libxft-dev libxi-dev \
libxinerama-dev:armhf libxml2-dev:armhf libxmu-dev:armhf libxrandr-dev \
libxrender-dev:armhf libxslt1-dev libxss-dev:armhf libxt-dev:armhf \
libxtst-dev:armhf libxxf86vm-dev libyajl-dev libzip-dev linux-libc-dev:armhf \
lzma-dev mesa-common-dev python-dev python2.7-dev x11proto-composite-dev \
x11proto-core-dev x11proto-damage-dev x11proto-dri2-dev x11proto-fixes-dev \
x11proto-gl-dev x11proto-input-dev x11proto-kb-dev x11proto-randr-dev \
x11proto-record-dev x11proto-render-dev x11proto-scrnsaver-dev \
x11proto-xext-dev x11proto-xf86vidmode-dev x11proto-xinerama-dev xtrans-dev \
zlib1g-dev:armhf

sudo apt-get clean

after i installed those packages i went into the Makefile and commented the line LIBS and replaced it by this:

LIBS = -lm -lpthread -lSDL -L$(SDKSTAGE)/opt/vc/lib -lbcm_host -lGLESv2 -lEGL -lglib-2.0 -lasound
LIBS+=-lz -lrt -lm

at least that worked for me and i was able to recompile

Comment #14

Posted on Oct 15, 2014 by Quick Wombat

Hi! need help, I am trying to configure my controls to mame ps3 by usb in RetroPie v2.3, me in the other emulators work fine, but do not get mame to work. follow the instructions below:

"sudo nano /opt/retropie/emulators/mame4all-pi/src/rpi/minimal.cpp

Comment out lines 168 to 174 so that the code appears as

// if (SDL_JoystickNumAxes(myjoy[i]) > 6) // { // SDL_JoystickClose(myjoy[i]); // myjoy[i]=0; // logerror("Error detected invalid joystick/keyboard\n"); // break; // } If you are having difficulty editing the file, then you can find an amended copy at this post at the Retropie forum to overwrite your existing copy.

Save and exit.

Recompile by going to the mame4all directory

cd /opt/retropie/emulators/mame4all-pi/

and running the following command.

make" but I get the following error when compiling:

src/rpi/minimal.cpp:130:19: warning: ‘context’ defined but not used [-Wunused-variable] src/rpi/minimal.cpp:131:30: warning: ‘nativewindow’ defined but not used [-Wunused-variable] Makefile:75: recipe for target 'obj_mame_rpi/rpi/minimal.o' failed make: *** [obj_mame_rpi/rpi/minimal.o] Error 1 pi@raspberrypi /opt/retropie/emulators/mame4all-pi $

any idea how to fix it?

Comment #15

Posted on Oct 29, 2014 by Helpful Lion

For those asking me on petroblock forum, here is the binary compiled version of mame4all-pi-v0.37-BETA-5 with fixed “not working PS3 controller” built from git for my RaspPi B+. https://drive.google.com/file/d/0B2TfYq5Awz_jWExLS2RpMHhnalE/view?usp=sharing Dont forget to use Sixpair / Sixaxis (see readme.txt) Please leave your comments on the google page. Have fun ! Tititatoo.

Comment #16

Posted on Dec 11, 2014 by Quick Lion

Pardon in advance for what I'm sure is a noob type of question but I just can't help myself. I've downloaded your very generous compiled mame version Tititatoo and updated the es_systems.cfg file to point to the mame file in the new mame4all-pi-v0.37-BETA-5 folder and also I've updated the permissions for the new mame file but whenever I attempt to load a rom from within EmulationStation, Mame informs me that all of the roms are missing. All 2270 have been verfied to be the correct 0.37b5 romset and all worked prior to installing the modified Mame version, minus the ps3 controller being recognized of course. Any suggestions would be greatly appreciated. Thank you. -Ryan

Comment #17

Posted on Dec 15, 2014 by Grumpy Hippo

For Retropie, it's best that you overwrite the existing mame binary in the /opt/retropie/emulators/mame4all-pi folder with Tititatoo's recompiled version.

There is no need to copy the other files. The rom path in the mame.cfg file in Tititatoo's compiled binary package is incorrect which may explain why mame can't find any roms. For Retropie, it should read /home/pi/RetroPie/roms/mame, should you need to change it. The mame.cfg.template and readme.txt are unchanged.

Comment #18

Posted on Dec 26, 2014 by Happy Panda

I have forked this project to https://github.com/joolswills/mame4all-pi which includes some build fixes and removal of the axis check. This will be included in retropie. I felt a fork was needed as our "on the fly" patching would have got messy, and there seems to be radio silence from the project author (Although he did read a PM from me on the raspberry pi forums, I received no reply)

Comment #19

Posted on Feb 18, 2015 by Helpful Ox

Ryan, I think you need to edit the mame.cfg file provided by Tititatoo. The path for roms should be "/home/pi/Retropie/roms"

Comment #20

Posted on Feb 20, 2015 by Swift Panda

fixed in latest version

Status: Fixed

Labels:
Type-Defect Priority-Medium