RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Pi 4 - Mouse support in RetroArch

    Scheduled Pinned Locked Moved Help and Support
    pi4lightgunmouseretroarch
    8 Posts 2 Posters 242 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      MrLightgun
      last edited by

      Hi Everyone

      I tried the work in progress build on the Pi 4 as per the usual instructions a few weeks ago but RetroArch just refused to see my mouse devices, either normal USB mouse or Lightgun Mouse device. The mice are all viewable fine using /dev but when loading a RetroArch core they cannot be seen and also when I do logging there is no mention of the mice where it usually comes up.

      I also changed the RetroArch input API to udev but that didn't fix it. I was sure that was going to be the issue when I found it wasn't set to udev but that didn't help. I tried a reinstallation too.

      I feel like it is a permission issue but don't have the linux skills to diagnose and fix it. I did try adding various udev permissions but that didn't work. I also tried a few flags on the build strings but that didn't help either. The same devices all work fine in RetroArch on the 3B+.

      Has anyone managed to get their mice to work in RetroArch on the Pi 4? Did you do anything special?

      Best regards

      Mr Lightgun

      1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator
        last edited by mitu

        Mice do work on the PI4 - I just tested the scenario from the other topic (FCEumm and Duck Hunt) on the Pi4 and didn't have any issues.
        Generally, Linux distributions nowadays are automatically setting permissions on /dev devices so you don't have to fiddle with it, so I don't think that's an issue here. As long as your account is part of the input group, that's ok (the default Raspbian - pi - user is already set-up with the proper permissions).

        Are you using the a 'stock' RetroArch version or the one distributed through the RetroPie setup script (1.7.1) ? Did you add any patches/have any custom developments on the source ? (I know you've sent some patches upstream, that's why I'm asking).

        For the record, I'm using the 1.7.9.2 installed through this PR.

        1 Reply Last reply Reply Quote 0
        • M
          MrLightgun
          last edited by

          Hi @mitu

          Thank you for the reply. That is good news. The fact it works for you without you doing anything special gives me hope I just did something I shouldn't. I will try again and keep it as simple as possible, making sure stock works before attempting any patches. I think your theory is probably correct or I typed one of the build commands wrong. At the time I just assumed the functionality wasn't there yet.

          At least that way if I have any issues I can be clearer on what I have done.

          Best regards

          Mr Lightgun

          1 Reply Last reply Reply Quote 0
          • M
            MrLightgun
            last edited by

            Hi @mitu

            So the good thing is that the mouse worked so I obviously broke it previously trying to update RetroArch. The thing is there are bugs in RetroArch I need to fix for my stuff to work correctly. Running your 1.7.9.2 would help because that version has the 2 biggest show stoppers fixed but I do have a 3rd which is not yet committed.

            I want to manually install RetroArch with my bug fixes. I followed the instructions from here:
            https://retropie.org.uk/forum/topic/16926/retroarch-cores-crash-on-trigger-press-mouse-click-with-overlay-active/28
            In the post by SuperJim at 6 Mar 2019, 08:03

            However his instructions rely on the correct build flags which I obviously failed to get correct on the Pi 4. Could you tell me what the correct CFLAGS are for the Pi 4 at this step or if there is an alternative way to change a RetroArch release. I have my own branch but I can't change a release.

            Thanks

            Mr Lightgun

            1 Reply Last reply Reply Quote 0
            • mituM
              mitu Global Moderator
              last edited by mitu

              I'm not sure how you're building your RetroArch branch, but to get RetroPie to compile it with the right flags, you just have to modify the scriptmodule in $HOME/RetroPie-Setup/scriptmodules/emulators/retroarch.sh and look into the sources_retroarch function here. You can change the branch/tag used to build RetroArch - and my advice would be to comment out the following applyPatch lines since the RetroPie specific patches might not apply cleanly to the release you would be using.

              After that you can either use the RetroPie-Setup script to re-install RetroArch from source or run from the command line

              cd $HOME/RetroPie-Setup
              sudo ./retropie_packages.sh retroarch
              

              to build and install from source.
              NOTE: the resulting installation could have some quirks w.r.t. RetroPie integration, but it would add the necessary dependencies for building RetroArch on Pi4 and the proper compile flags to make it work.

              Alternatively, if you'd like to build manually, use the following CFLAGS when configuring RetroArch:

              -O2 -march=armv8-a+crc -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard -ftree-vectorize -funsafe-math-optimizations
              
              1 Reply Last reply Reply Quote 0
              • M
                MrLightgun
                last edited by

                Thank you @mitu

                I was happy with V1.7.6 so I did this:

                **cd
                git clone https://github.com/libretro/RetroArch.git
                cd RetroArch
                git checkout tags/v1.7.6

                CFLAGS="-O2 -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -ftree-vectorize -funsafe-math-optimizations" ./configure --disable-sdl --enable-sdl2 --disable-oss --disable-al --disable-jack --disable-qt --disable-x11 --disable-pulse --enable-neon --enable-floathard --enable-dispmanx

                git apply ~/RetroPie-Setup/scriptmodules/emulators/retroarch/01_hotkey_hack.diff
                git apply ~/RetroPie-Setup/scriptmodules/emulators/retroarch/02_disable_search.diff
                git apply ~/RetroPie-Setup/scriptmodules/emulators/retroarch/03_disable_udev_sort.diff

                I changed the source here

                make
                sudo cp retroarch /opt/retropie/emulators/retroarch/bin**

                BUT I replaced the CFLAGS with what you provided but I didn't previously spot the ./configure part. Could you tell me the ./configure parameters for the Pi4 also please? Thank you so much for your help.

                Mr Lightgun

                1 Reply Last reply Reply Quote 0
                • mituM
                  mitu Global Moderator
                  last edited by

                  The parameters to ./configure are dynamically created, but something like this should work:

                  /configure --prefix=/opt/retropie/emulators/retroarch --disable-sdl --enable-sdl2 --disable-oss --disable-al --disable-jack --disable-qt --disable-pulse --enable-opengles --disable-videocore --disable-vulkan --disable-wayland --enable-kms --enable-egl --enable-floathard --enable-neon
                  
                  1 Reply Last reply Reply Quote 0
                  • M
                    MrLightgun
                    last edited by

                    Thank you @mitu

                    That worked, I needed to throw in a --disable-x11 too:

                    CFLAGS="-O2 -march=armv8-a+crc -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard -ftree-vectorize -funsafe-math-optimizations" ./configure --prefix=/opt/retropie/emulators/retroarch --disable-sdl --enable-sdl2 --disable-oss --disable-al --disable-jack --disable-qt --disable-pulse --enable-opengles --disable-videocore --disable-vulkan --disable-wayland --enable-kms --enable-egl --enable-floathard --enable-neon --disable-x11
                    

                    I may have got rid of the --prefix bit, I can't quite remember now.

                    Appreciate the help.

                    Mr Lightgun

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post

                    Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                    Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.