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

    Create a custom ES system able to launch games for many systems

    Scheduled Pinned Locked Moved Ideas and Development
    emulationstatiocustomisationscustom theme
    157 Posts 15 Posters 67.1k 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.
    • pjftP
      pjft @Howitzer99
      last edited by

      @Howitzer99 Check my post. I ran it on a Mac, and it's a terminal script. You just need to install PowerShell for Linux.

      Howitzer99H 1 Reply Last reply Reply Quote 0
      • Howitzer99H
        Howitzer99 @pjft
        last edited by

        @pjft Awesome, thanks, will checkout PowerShell as well.

        GenGal definitely hits the request, thanks for the fast replies!

        1 Reply Last reply Reply Quote 0
        • meleuM
          meleu @Howitzer99
          last edited by meleu

          @Howitzer99 said in Create a custom ES system able to launch games for many systems:

          How is the symbolic link program going? Please let me know if you want me to run some tests.

          Almost done. I had to be away from my computers in the last few days but now I'm back. I'm going to post about it here in a couple of days. ;-)

          I'm making it create the link and the respective gamelist.xml entry at the same time. So, you will just have to run this tool to accomplish these two tasks.

          • Useful topics
          • joystick-selection tool
          • rpie-art tool
          • achievements I made
          Howitzer99H 1 Reply Last reply Reply Quote 0
          • E
            EctoOne @meleu
            last edited by

            Is there a way to expand the script @meleu made for batch linking to have maybe the original system added as suffix in the link? I finally had some time to try this out and i ran into a problem when i tried to made just a SEGA system. Since i have all my Roms zipped, i ran into an issue with having the same filename inside my GameGear and MasterSystem folder. IDK if it is possible on linux but it would be great if i could links like gamename (europe)-gamegear.zip

            # in this example I'm creating links for every file in gameboy directory
            original_system="/home/pi/RetroPie/roms/gb"
            destination_system="/home/pi/RetroPie/roms/nintendo"
            while read -r file; do
              ln -s "$original_system/$file" "$destination_system/$file"
            done < <(ls "$original_system")
            
            meleuM 1 Reply Last reply Reply Quote 0
            • meleuM
              meleu @EctoOne
              last edited by

              @EctoOne the link can have any name you want. You can batch all, and then manually create those with the same name.

              Or maybe wait a day or two and see the script I'm planning to release. ;-)

              • Useful topics
              • joystick-selection tool
              • rpie-art tool
              • achievements I made
              TMNTturtlguyT 1 Reply Last reply Reply Quote 2
              • TMNTturtlguyT
                TMNTturtlguy @meleu
                last edited by

                @meleu oh my! I can't wait! This must be an impressive script! Can you confirm that it will link the rom and gamelist info all in one script command? I was going to use your script to populate all of my new systems in the theme today, but now I will have to wait to see what you have in store for us!

                meleuM 2 Replies Last reply Reply Quote 0
                • meleuM
                  meleu @TMNTturtlguy
                  last edited by meleu

                  @TMNTturtlguy said in Create a custom ES system able to launch games for many systems:

                  Can you confirm that it will link the rom and gamelist info all in one script command?

                  Confirmed!

                  Wait a little, I'm at work now and planning to finish the script this evening. ;-)

                  edit: I mean evening in Brazil.

                  • Useful topics
                  • joystick-selection tool
                  • rpie-art tool
                  • achievements I made
                  1 Reply Last reply Reply Quote 1
                  • Howitzer99H
                    Howitzer99 @meleu
                    last edited by

                    @meleu,@pjft I just tried running GenGal, and yes it's working to add the missing video and marquees attributes to my gamelists. One problem is that it's completely overwriting the existing metadata, so how are people adding (back) the extra information that GenGal doesn't provide (game information, rating, plays, etc)?

                    Between GenGal and FatMatch, looks like I'm sorted for now dealing with naming issues and creating the missing metadata attributes, just need to be able to merge and it should be good.

                    pjftP 1 Reply Last reply Reply Quote 0
                    • pjftP
                      pjft @Howitzer99
                      last edited by

                      @Howitzer99 as said, I don't use GenGal but a separate PowerShell script that adds those to the existing gamelists without deleting anything.

                      Here's the thread:

                      https://retropie.org.uk/forum/topic/6589/easy-way-to-add-video-and-marquees-tags-in-your-gamelist-for-video-support

                      1 Reply Last reply Reply Quote 0
                      • meleuM
                        meleu @TMNTturtlguy
                        last edited by meleu

                        @TMNTturtlguy @EctoOne @Howitzer99 @mattrixk @pjft and everyone else interested in an easier way to create the symbolic links and updating the custom system gamelist.xml: I've created a "fancier" script :-)

                        You can see it here: https://github.com/meleu/share/blob/master/add-game-to-custom-system.sh

                        And get it with this command:

                        wget https://raw.githubusercontent.com/meleu/share/master/add-game-to-custom-system.sh
                        chmod a+x add-game-to-custom-system.sh
                        

                        Here is the --help output:

                        $ ./add-game-to-custom-system.sh --help
                        This script creates symbolic links for a custom ES system and tries to create
                        a gamelist.xml based on already existent metadata, boxart, marquee, and video.
                        
                        More info here: https://retropie.org.uk/forum/post/84125
                        
                        Usage:
                        ./add-game-to-custom-system.sh -d /path/to/custom/system/directory rom1 [rom2 [romN...]]
                        

                        As it gets the rom file names from command line you can use the shell wildcards, as you can see in the examples below.

                        adding Contra (NES) to konami custom system

                        $ ./add-game-to-custom-system.sh -d ~/RetroPie/roms/konami ~/RetroPie/roms/nes/Contra\ \(USA\).zip
                        

                        all gameboy games to nintendo custom system (as @EctoOne wants)

                        $ ./add-game-to-custom-system.sh -d ~/RetroPie/roms/nintendo ~/RetroPie/roms/gb/*.zip
                        

                        all Mega Man games to megaman custom system (as @meleu wants)

                        $ ./add-game-to-custom-system.sh -d ~/RetroPie/roms/megaman ~/RetroPie/roms/{gb,gba,gbc,nes,snes,megadrive}/Mega\ Man*.zip
                        
                        • Useful topics
                        • joystick-selection tool
                        • rpie-art tool
                        • achievements I made
                        Howitzer99H cyperghostC UDb23U 3 Replies Last reply Reply Quote 4
                        • Howitzer99H
                          Howitzer99 @meleu
                          last edited by

                          @meleu Awesome, congrats with finishing the script, and thanks for posting!

                          1 Reply Last reply Reply Quote 0
                          • E
                            EctoOne @meleu
                            last edited by

                            Once again, awesome job! Now my system looks so much cleaner without having systems that only had 1-5 games. The only thing i want to mention is that I had to edit /opt/retropie/configs/all/emulationstation/es_systems.cfg and NOT/etc/emulationstation/es_systems.cfgto change what system i wanted to show up.

                            meleuM 1 Reply Last reply Reply Quote 1
                            • cyperghostC
                              cyperghost @meleu
                              last edited by

                              @meleu Briliant work my friend!
                              I think we should open a new thread for that tool. I'm not very common with bash scripts ... can you show me how I can create ONE fav-system created out of one TXT file?

                              Example content of my_beloved_roms.txt

                              path to ....Mega_Man1.nes
                              path to ....Mega_Man2.nes
                              path to ....Mega_Man.gb
                              .......
                              

                              What command should I use to read out txt file line to line? head, ls, find?
                              After that I think I can pipe your script ;)
                              How long took it to create that?

                              meleuM 1 Reply Last reply Reply Quote 0
                              • meleuM
                                meleu @EctoOne
                                last edited by

                                @EctoOne actually ~/.emulationstation is a symbolic link to /opt/retropie/configs/all/emulationstation. I've updated the OP with this info, thanks!

                                • Useful topics
                                • joystick-selection tool
                                • rpie-art tool
                                • achievements I made
                                1 Reply Last reply Reply Quote 0
                                • meleuM
                                  meleu @cyperghost
                                  last edited by

                                  @cyperghost

                                  I think we should open a new thread for that tool.

                                  The tool is very specific to what we are doing here, also I updated the OP talking about the tool. I think we can stick in this same thread. :-)

                                  Example content of my_beloved_roms.txt

                                  path to ....Mega_Man1.nes
                                  path to ....Mega_Man2.nes
                                  path to ....Mega_Man.gb
                                  .......
                                  

                                  What command should I use to read out txt file line to line? head, ls, find?
                                  After that I think I can pipe your script ;)

                                  Assuming each line in my_beloved_roms.txt is a full path to a Mega Man ROM, here is the command you need:

                                  xargs -I MY_ROM -a my_beloved_roms.txt ./add-game-to-custom-system.sh -d ~/RetroPie/roms/megaman MY_ROM
                                  

                                  Sorry if it's not very clear, but xargs is the one doing the "magic" here. It might be worth reading the man page to completely understand what's happening in that command.

                                  How long took it to create that?

                                  IMHO it's reasonably fast.

                                  • Useful topics
                                  • joystick-selection tool
                                  • rpie-art tool
                                  • achievements I made
                                  cyperghostC 1 Reply Last reply Reply Quote 1
                                  • cyperghostC
                                    cyperghost @meleu
                                    last edited by

                                    @meleu
                                    You got me wrong :D

                                    How long took it to create that?

                                    IMHO it's reasonably fast.

                                    I ment how many hours of work did you invest to create that script.

                                    Thank you about the xargs
                                    The reason for doing this is, if someone created a gamelist.xml of the best roms then a script can extract pure rom_pathes out of it and then uses your script for symlinking.

                                    meleuM 1 Reply Last reply Reply Quote 0
                                    • meleuM
                                      meleu @cyperghost
                                      last edited by meleu

                                      @cyperghost said in [Create a custom ES system able to launch games for many

                                      I ment how many hours of work did you invest to create that script.

                                      I think it took 3 hours, but it's a completely inaccurate measurement. I was constantly interrupted by the kids, which delays. On the other hand I'm quite familiar with bash scripting since early 2000's and a bit familiar with xmlstarlet since I wrote that tool to create launching images based on ES theme.xml files, which speeds up...

                                      The reason for doing this is, if someone created a gamelist.xml of the best roms then a script can extract pure rom_pathes out of it and then uses your script for symlinking.

                                      You can easily get the rom paths from a gamelist.xml using xmlstarlet. Here is the command line:

                                      xmlstarlet sel -t -v "/gameList/game/path" gamelist.xml
                                      

                                      EDIT: be aware that the command above gets the path exactly as they are in the gamelist.xml file, then probably you won't get the full path to the ROM.

                                      If you want to put them in a file like your my_beloved_roms.txt above, you just have to redirect the output:

                                      xmlstarlet sel -t -v "/gameList/game/path" gamelist.xml > my_beloved_roms.txt
                                      

                                      I hope it helps.

                                      • Useful topics
                                      • joystick-selection tool
                                      • rpie-art tool
                                      • achievements I made
                                      1 Reply Last reply Reply Quote 1
                                      • meleuM
                                        meleu
                                        last edited by

                                        @cyperghost be aware that the xmlstarlet trick I said above gets the path exactly as they are in the gamelist.xml file, then probably you won't get the full path to the ROM.

                                        I edited the post with this info.

                                        • Useful topics
                                        • joystick-selection tool
                                        • rpie-art tool
                                        • achievements I made
                                        1 Reply Last reply Reply Quote 1
                                        • UDb23U
                                          UDb23 @meleu
                                          last edited by

                                          @meleu wow !

                                          1 Reply Last reply Reply Quote 0
                                          • TMNTturtlguyT
                                            TMNTturtlguy
                                            last edited by TMNTturtlguy

                                            @meleu I have come across a few issues. Forgive me if these are user errors.

                                            Issue #1 - The original Script in the OP does not work after updates made to Retropie-Setup Script at all, and your fancier script that creates the link and gamelist works with some modifications. On Friday @BuZz made a modification to the Retropie-Setup Script. It requires some scripts to need a sudo command to operate. I thought this only affected scripts in the retropie menu, but I have created your script exactly as you have it and placed it in the exact location you have shown. If i run it from command line with bash the script runs and gives me the "this is not a symbolic link" error. When i try to launch a rom from my batman folder i get a Permission Denied error. I tried adding a few sudo commands into the script but can't figure it out.

                                            Here is the log that I get:

                                            lvl2: 	 Attempting to launch game...
                                            lvl2: 		/home/pi/bin/runcustom.sh /home/pi/RetroPie/roms/mario/MarioBros.zip
                                            lvl1: 	...launch terminated with nonzero exit code 32256!
                                            

                                            And here is the error on command line of pi:

                                            sh: 1: /home/pi/bin/runcustom.sh: Permision denied
                                            

                                            I tried several fixes to this and I can't get a solution to work. Your fancier script does the same thing, However I am able to get your fancier script to work doing the following:

                                            You must run the script to create the symbolic link as a bash command:

                                            bash ./add-game-to-custom-system.sh -d ~/RetrioPie/roms/.......
                                            

                                            You must also change the command line is es_systems.cfg to a bash command

                                            <command>bash /home/pi/bin/runcustom.sh %ROM%</command>
                                            

                                            Everything works great with this script running as bash.

                                            So this leads me to issue number 2 - Note issue #1 was on a retropie 3B running latest version of ES with updated setup script. Running everything off of installed SD card. Issue #2 below is running off of the latest version of ES. I did NOT update the setup script on this build. I am running ES off of a 16gb SD card. My roms are all on a USB stick.

                                            Issue #2 - symbolic link is not permitted when roms are on USB drive. Here are screenshots of the error. The first screenshot is using the normal paths as noted in your directions (this worked on my other build with roms on the SD card)
                                            0_1497846798859_a62ebc4b-80ec-4e68-bea0-45e85a641bee-image.png

                                            So i tried to use the actual path of the usb stick /media/usb0/ and here is the same error
                                            0_1497846870731_61619e4b-e8aa-4c7a-953d-4d14f1175d36-image.png

                                            So then i tried your fancier script and again received the following errors - It did not create a link, but a black gamelist did appear in the mario folder.

                                            0_1497854077009_a270c127-df6b-42c8-a36f-cae3f8e93fe7-image.png

                                            If anyone has had success with this when Roms are on a USB please let me know the trick!

                                            E meleuM 2 Replies 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.