RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Show Control Panel Layout before game starts in RetroPie, just like Arcade1UP does.

    Scheduled Pinned Locked Moved Projects and Themes
    arcade1upcontrolruncommandjoy2key
    92 Posts 20 Posters 21.3k 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.
    • markwkiddM
      markwkidd @Texacate
      last edited by markwkidd

      @Texacate said in Show Control Panel Layout before game starts in RetroPie, just like Arcade1UP does.:

      How are you managing the parent / clones control data? Are you just archiving the parent ?
      Similarly, how are you managing the different (but related) parents that have identical control information ?

      As @robertvb83 mentioned and is described in detail in the MAME 2003-Plus developer docs that are linked there, the mapping between the control names happens elsewhere, in the driver source.

      This can also be grepped/scripted easily because there are macro names (the GAMEC macros, etc) that can be used as tokens for finding the mappings.

      1 Reply Last reply Reply Quote 0
      • T
        Texacate
        last edited by

        @robertvb83 Most excellent! As a "User" contributor, the only thing I didn't see on that Wiki page was how to best get the info to the lr2003plus team. (email to someone, a forum post somewhere, a github issue...) And I assume if the parent of ROM isn't already mentioned controls.c, those would be the one(s) you are most interested in. Correct? I'll do my best to contribute using the format in the wiki. Ive gone through a bunch of games on my cabinet, and added new button labels. ~50 so far, only 800 to go, LOL

        robertvb83R 1 Reply Last reply Reply Quote 0
        • robertvb83R
          robertvb83 @Texacate
          last edited by robertvb83

          @Texacate hey thanks thats a good point with contact information. I cannot change this myself but i think @markwkidd can add that info/links.

          The button names for retroarch are great especially for unusual joypad layouts. So i already contributed some exotic games like stonebal or space wars. With written functions instead of btn1 btn2 btn3 it is now much easier to configure those games for any joypad that people use.

          Of course missing clones are always welcome or even missing parent roms. But be aware not always are clones the same as parent by means of button names

          Would be super cool if your naming contributions find their way into mame2003-plus as well

          My full size arcade cabinet Robotron vs. Octolyzer

          1 Reply Last reply Reply Quote 0
          • T
            TheRealSmilebit
            last edited by

            Kinda circled around back to this. You all are doing more with this than I can. This is a mock up of what I originally was going for:
            astdelux-cplayout.jpg

            And keep in mind this is tailored to my tastes and nothing is automatically built...everything is manual.

            However, my goal was to get to where the background, control panel, marquee, ect. were in a separate folder for either a system or game and then have a XML setting file to assemble the file based on what files were supplied. Would work on once part at a time.

            After looking at what you are all doing...may be making this a bit to complex. Will be trying out Texacate's example this weekend to see if I can get that up and running.

            T 1 Reply Last reply Reply Quote 0
            • T
              Texacate @TheRealSmilebit
              last edited by Texacate

              @TheRealSmilebit

              Cool. I love your concept example! Maybe someday. BTW, I just put my latest script, plus the CSV files, on GitHub. It's not very polished yet. But much better than previous versions.

              • I added support to run the main image creation script button_map.sh on the RPi.
              • Updated the Wiki on installing ImageMagick on the RPi.
              • If button data for a clone is not available, the script will attempt to use the button data from the parent rom.
              • Generates a place holder image, when no button data is available. Leaves them in the the tmp directory.
              • Uploaded a separate file with my suggested button data for additional roms. I have about 250 roms listed in custom_map.csv so far. More to come, I play a dozen or so games every day, and try to figure out what the appropriate names are for the buttons. I do try to look for a picture of the original arcade cabinet, and use those labels if possible.
              • Added a new script for doing your entire collection, all at once. for_all_roms.sh

              I'm amazed how many games are just vertical shooters, with the exact same Fire,SuperBomb buttons. I found a fun unique variation on that theme. Check out dfeveron.zip and its Disco Bomb!

              T 1 Reply Last reply Reply Quote 1
              • T
                TheRealSmilebit @Texacate
                last edited by

                @Texacate Thanks...I plan on installing it this weekend. I have been looking at ImageMagick and messing around with it as well. Will let you know how your install goes.

                T 1 Reply Last reply Reply Quote 0
                • T
                  Texacate @TheRealSmilebit
                  last edited by Texacate

                  @TheRealSmilebit
                  custom_map.csv contains 600 labels now! Getting the data from www.arcade-museum.com, but its not automated. Clicking on each game's web page, and copy/paste . Not all pages have labels, but it's been much faster than playing each game. Downside is, there's a chance I don't have the buttons in the right order. Verification will be needed at some point.

                  T 1 Reply Last reply Reply Quote 0
                  • T
                    Texacate @Texacate
                    last edited by

                    Update: I have collected button label data for ~1000 games, plus the ~1000 from the the controls.dat project, for a total of ~2000 titles. For now I'm done collecting the button data, and will work on improving usability of the image generation script. Suggestions are welcome.

                    T 1 Reply Last reply Reply Quote 1
                    • T
                      Texacate @Texacate
                      last edited by Texacate

                      I received some feedback and have flipped how the two rows are labeled by default;

                      New Mapping

                      MAME   RetroPad  CntrPnl
                      123  -->  YXL -->  123
                      456  -->  BAR -->  456
                      

                      Before it was

                      MAME   RetroPad  CntrPnl
                      456  -->  YXL -->  123
                      123  -->  BAR -->  456
                      

                      Also, the script searches three database files for label data, (vs one previously). Now: custom_map.csv file is truly reserved for user customizations, button_map.csv file was renamed primary_map.csv, and the additional data I collected is in secondary_map.csv

                      J 1 Reply Last reply Reply Quote 2
                      • J
                        janderclander14 @Texacate
                        last edited by

                        @Texacate Thanks a lot for this project! I plan to use it on a secondary SPI LCD connected to the GPIO. I assume that in this case I need to modfiy the server so that it outputs the images in a second framebuffer, rather than a second Raspberry.

                        Regarding the mappings, could this be made configurable via an external file? The motivation is that, whereas Mame-2003plus default mapping is:

                        123
                        456

                        In FBalpha (which I use more often for arcade games) it is:

                        456
                        123

                        Also, with this approach it could be possible to support global custom controls.

                        T 3 Replies Last reply Reply Quote 0
                        • T
                          Texacate @janderclander14
                          last edited by Texacate

                          @janderclander14 said in Show Control Panel Layout before game starts in RetroPie, just like Arcade1UP does.:

                          @Texacate Thanks a lot for this project! I plan to use it on a secondary SPI LCD connected to the GPIO. I assume that in this case I need to modfiy the server so that it outputs the images in a second framebuffer, rather than a second Raspberry.

                          Yes. Discard the simpleClient.py file completely, and strip out all the socket communication code from simpleServer.py, and only keep the bits that reassembles a full pathname of the desired image from the system name & rom name, and displays it. By the way, the whole reason I chose python for that part was I found a good tutorial on client/server communication. If I was coding it to work all on a single RPi, then the file-display stuff would have been written in bash.

                          Could (the mapping) be made configurable via an external file?
                          ( Mame)
                          123
                          456

                          In FBalpha (which I use more often for arcade games) it is:
                          456
                          123

                          Yes, button_map.sh could certainly be enhanced to read an external config file. But assuming the number of different configs is small and predictable, it might be easier to pre-code the required mappings, and just add a switch to select the one you want. Something like: if ($arg2 = "-fba") use 456123, else use 123456.

                          Also, with this approach it could be possible to support global custom controls.

                          I'm not sure I understand what you mean by global custom controls. Are you thinking of something beyond button labels? As in; joystick direction labeling, trackballs active/inactive, different control panel arrangements, etc.

                          1 Reply Last reply Reply Quote 0
                          • T
                            Texacate @janderclander14
                            last edited by

                            @janderclander14

                            Also a the RPi (out of the box) has only one frame buffer. This is baked right into Raspian. I did some google research on adding a second frame buffer. There are some success stories out there, but as I recall, details were sketchy and the whole thing seemed pretty advanced. That was another reason I chose a second RPI. If you find the solution, please post! I gave up, and spent an extra $30 on another RPi.

                            1 Reply Last reply Reply Quote 0
                            • T
                              Texacate @janderclander14
                              last edited by

                              @janderclander14 said in Show Control Panel Layout before game starts in RetroPie, just like Arcade1UP does.:

                              In FBalpha (which I use more often for arcade games) it is:

                              456
                              123

                              I use that arrangement too. I've updated the script to handle it. Try the latest version on github, and append the switch"-fba" to the command line. Default is still:
                              123
                              456

                              But button_map.sh <game> -fba gives you:
                              456
                              123

                              Also added button_map.sh <game> -8btn which gives you:
                              1237
                              4568

                              J 1 Reply Last reply Reply Quote 0
                              • J
                                janderclander14 @Texacate
                                last edited by janderclander14

                                @Texacate Thanks a lot! This adds quite a lot of flexibility across emulators and control layouts.

                                Regarding the frame buffer, the RPi only supports two framebuffers if the second one corresponds to a LCD screen connected to the GPIO via SPI. These are usually small screens that plug like a HAT and that, because of the serial connection, offer poor refresh rates. However, they are fine for displaying static images like the panel layout or the marquee.

                                Here you can see the build of a user that employed one of these small screens to display the title of the game in a snes cartridge while using the HDMI output as the main display:

                                https://retropie.org.uk/forum/topic/3376/pi-in-a-super-famicom-build

                                He also provides a runcommand script to detect the running game and display the artwork, similarly to your project.

                                As far as using two framebuffers in general, for example, combining the HDMI and DSI outputs, I'm only aware of a beta kernel that seems to support this but does not seem to be included in the public distribution yet:

                                https://www.raspberrypi.org/forums/viewtopic.php?t=216399

                                T 1 Reply Last reply Reply Quote 0
                                • T
                                  Texacate @janderclander14
                                  last edited by

                                  @janderclander14
                                  Thanks for the pointers! I noticed that post #177 of the Super Famicom project included the runcommand_onstart.sh code, to display the image on the SPI based LCD. Very cool. I'd say go with that versus what's in my simpleServer.py script. It seems to follow very similar "fall-back rules" when the desired image isn't found.

                                  Let us know how your build goes! Do let me know if you find errors in the primary and secondary database files. The secondary one especially was a whole lot of copy-n-paste.

                                  J 1 Reply Last reply Reply Quote 0
                                  • K
                                    Kjarkur
                                    last edited by

                                    Hey, thanks a lot for this project. I adapted the source code and put game snaps as background, new buttons and instead of rom file name the game name. Second I modified it to use a crt friendly resolution of 320 x 240 for my arcade cab via pi2jamma.

                                    Here's a little video.

                                    Cheers

                                    B T 2 Replies Last reply Reply Quote 0
                                    • B
                                      BJRetro @Kjarkur
                                      last edited by

                                      @Kjarkur wow guys this video is like what everyone envisioned for this project - great teamwork. Is there some way to incorporate this easily into retropie setup some day? This project is a huge advancement for the retropie user interface for people with arcade setups.

                                      K 1 Reply Last reply Reply Quote 1
                                      • K
                                        Kjarkur @BJRetro
                                        last edited by

                                        @BJRetro the video shows my own regamebox distribution. I can make a fork on github.com. Of course it can be done with retropie easily. General steps are this

                                        • create the button mapping pictures in advance
                                        • put a picture viewer in runcommand-onstart.sh

                                        I have used here a own picture viewer based on SDL. Reason was that I wanted to use something like quit on all keys and quit after 10 seconds.

                                        F R 3 Replies Last reply Reply Quote 1
                                        • T
                                          Texacate @Kjarkur
                                          last edited by

                                          @Kjarkur I like what you did with the code. Using a game-specific background is a great idea!

                                          T 1 Reply Last reply Reply Quote 1
                                          • J
                                            janderclander14 @Texacate
                                            last edited by

                                            @Texacate It took a longer than expected but I managed to setup up everything. First, I used a Waveshare 4inch SPI LCD connected to the GPIO, as explained here.

                                            After that, I configured the lcd screen by using the overlays available here. It was quite straightforward. Just need to activate SPI in /boot/config.txt and add the overlay file corresponding to the screen. You may even use parameters to increase the refresh rate or rotate the screen (it uses a vertical orientation by default). The lcd is detected as a secondary framebuffer in /dev/fb1

                                            Finally, as you suggested, I modified the script proposed here to call for the images generated by your button_map.sh tool once the emulator runs.

                                            I post here the code that looks for the button image or falls-back to title or generic system images if not found.

                                            # /opt/retropie/configs/all/runcommand-onstart.sh
                                            # get the full path filename of the ROM
                                            rom=$3
                                            # get the system name
                                            system=$1
                                            # get rom filename without folder
                                            rom_bn=$(basename "$rom")
                                            #get rom filename without extension
                                            rom_bn="${rom_bn%.*}"
                                            # escape square brackets in rom filename
                                            rom_bn="${rom_bn//[/\[}"
                                            rom_bn="${rom_bn//]/\]}"
                                            # Set a TFT-specific image if there is one
                                            img="$(find "/home/pi/button_images/${system}" -type f -name "${rom_bn}.*" -print -quit)"
                                            # If a TFT-specific image was not found, look in the images folder in the ROMs directory for that system
                                            if [[ -z "${img}" ]];
                                            then
                                               img="$(find "/home/pi/RetroPie/roms/${system}/media/cover" -type f -name "${rom_bn}.*" -print -quit)"
                                            fi
                                            # If cover is not found, look for the title
                                            if [[ -z "${img}" ]];
                                            then
                                               img="$(find "/home/pi/RetroPie/roms/${system}/media/title" -type f -name "${rom_bn}.*" -print -quit)"
                                            fi
                                            # If no game images are found, display one for the system being emulated
                                            if [[ -z "${img}" ]];
                                            then
                                               img="$(find "/home/pi/button_images/systems" -type f -name "${system}.*" -print -quit)"
                                            fi
                                            # If no system image is found, default back to the Picade logo
                                            if [[ -z "${img}" ]];
                                            then
                                               img="/home/pi/button_images/systems/picade.png"
                                            fi
                                            # run the script to display the image
                                            sudo fbv -c -u -i -e -k /home/pi/button_images/systems/black.png > /dev/null 2>&1 &
                                            sudo fbv -c -u -i -e -k "${img}" > /dev/null 2>&1 &
                                            

                                            I used the fbv tool to display static images in the secondary framebuffer, but the more common fbi tool can also be used.

                                            T 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.