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

    How To Create Favorites System in Retropie (yes system, not folder!)

    Scheduled Pinned Locked Moved Ideas and Development
    favoritessystememulationstaion
    57 Posts 10 Posters 16.7k 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.
    • SanoS
      Sano
      last edited by

      Very nice tweak.

      Juste thinking of something similar, but that would unfortunately require huge modifications on ES :
      Being able to modify the carrousel to switch components between Systems/Game Genres/Editors/Custom keyword (Mario, Sonic, ...)

      This would probably require to replace the gamelist.xml files with a global DB, but could be so nice, and would easily allow to implement game search too...

      My 2 cents.

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

        Update: I am currently trying to figure out all the runcommand code and how we can get the emulator to autoselect so we don't have to manually set it up. Here is what i think i have determined so far:

        /opt/retropie/supplementary/runcommand/runcommand.sh tells us that if "sys" is called out then we use argument 3 = which says to look to the favorites folder we created in /opt/retropie/configs/. Nothing earth shattering figured out here. If we keep looking down in the file we find the function default_emulator() { Again, i don't know what i am doing here, but it looks that this is telling us to go to the folder we created in /opt/retropie/configs/ for favorites and look at the emulators.cfg

        In emulators.cfg we list out all the emulators that can run in our system. We can also call out ONE single emulator to run as the default launch emulator. the runcommand.sh file says we can do this by stating default = "emulatorname" for example default = "lr-mame2003"

        So now what i need to try to understand is if we can create code in the runcommand.sh that allows us to do an ifstatement that says "if rom = .nes " Then:

        local key
        local config="$EMU_SYS_CONF"
        
        case "$type" in
            emu_sys)
                key="default NES"
                ;;
        

        Then we can go into our favorites/emulators.cfg and add the following: default NES = lr-fceumm

        I am probably waisting a lot of peoples time here, so i apologize. I am sure this is much more complex than what I am thinking, my hope is that this might jump start a few ideas that others can expand upon or point me in the right direction. OR tell me I am way off base! Thanks for your time.

        lilbudL 1 Reply Last reply Reply Quote 0
        • lilbudL
          lilbud @TMNTturtlguy
          last edited by

          @TMNTturtlguy Here is the script I tried to write

          #!/usr/bin/env bash
          
          for file in /tmp/*; do
          if echo "$file" | grep -q '.gb$'; then
          /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-
          gambatte/gambatte_libretro.so --config /opt/retropie/configs/mario/retroarch.cfg "$file"
          elif echo "$file" | grep -q '.nes$'; then
          /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-
          fceumm/fceumm_libretro.so --config /opt/retropie/configs/mario/retroarch.cfg "$file"
          elif echo "$file" | grep -q '.sfc$'; then
          /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-
          snes9x2010/snes9x2010_libretro.so --config /opt/retropie/configs/snes/retroarch.cfg 
          "$file"
          fi
          done
          

          If anyone is good with bash, tell me what i did wrong.

          Creator of the Radiocade: https://retropie.org.uk/forum/topic/6077/radiocade

          Backlog: http://backloggery.com/lilbud

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

            @lilbud I think i might have it for you, right now you are telling the script to write the launch for the .gb files to emulator list, that list does not actually run/startup the emulator. The emulator set as default is what will launch unless the rom itself has directions save to /opt/retropie/configs/all/emulators.cfg

            What we could do is create the script to add the following output for each rom in your mario folder. Here is what the required output is:

            mario_romname = "emulator"
            for example my turtles system - TMNT
            TMNT_tmnt22p = "mame4all"

            So all the script needs to do is look in your mario folder for file types .nes and then output mario_supermario = "lr-fceumm" to /opt/retropie/configs/all/emulators.cfg

            I am not good with scripts, but maybe you can test writing this and report back?

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

              Hey guys, I didn't read all the thread, sorry. But as far as I understood the OP is about creating a theme for favourites, not implementing a way to manage its contents.

              If the user is supposed to manage files/gamelist.xml manually I would suggest to use symbolic links (or full path in gamelist.xml).

              But why don't we test the branch of this PR?: https://github.com/RetroPie/EmulationStation/pull/131

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

                @TMNTturtlguy said in How To Create Favorites System in Retropie (yes system, not folder!):

                mario_supermario = "lr-fceumm

                Shouldn't that say:

                mario_nes = "lr-fceumm" ?

                Creator of the Radiocade: https://retropie.org.uk/forum/topic/6077/radiocade

                Backlog: http://backloggery.com/lilbud

                TMNTturtlguyT 1 Reply Last reply Reply Quote 0
                • lilbudL
                  lilbud @meleu
                  last edited by lilbud

                  @meleu yeah, but we get sidetracked easily. Could you look at the code above and see what's wrong?

                  Creator of the Radiocade: https://retropie.org.uk/forum/topic/6077/radiocade

                  Backlog: http://backloggery.com/lilbud

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

                    @lilbud sure. Will do as soon as I get home.

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

                      @lilbud said in How To Create Favorites System in Retropie (yes system, not folder!):

                      Shouldn't that say:
                      mario_nes = "lr-fceumm" ?

                      no, it should say the name of your system folder: mario then then name of the rom: supermario = emulator

                      I am just using supermario as the name of your rom

                      lilbudL 1 Reply Last reply Reply Quote 0
                      • lilbudL
                        lilbud @TMNTturtlguy
                        last edited by

                        @TMNTturtlguy So, like this:

                        mario_supermariorpg="lr-snes9x-2010"

                        Creator of the Radiocade: https://retropie.org.uk/forum/topic/6077/radiocade

                        Backlog: http://backloggery.com/lilbud

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

                          @meleu i just read the PR branch, not sure it is doing the same thing?

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

                            @lilbud yes, but you need a spaces between (either side of the =)

                            mario_supermariorpg = "lr-snes9x-2010"

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

                              SO i am still working on the runcommand.sh file from above.....i am making progress with the default idea, but now it reads both defaults as launch. I need a way to tell the runcommand which defualt to use. Can someone tell me what "$type" is signalling? Here is what i am trying to do:

                              function default_emulator() {
                                  local mode="$1"
                                  local type="$2"
                                  local value="$3"
                              
                                 local key
                                 local config="$EMU_SYS_CONF"
                              
                               case "$type" in
                                  emu_sys)
                                      key="default"
                                      ;;
                                  emu_cmd)
                                      key="$EMULATOR"
                                      ;;
                                  emu_rom_old)
                                      key="$SYS_SAVE_ROM_OLD"
                                      config="$EMU_CONF"
                                      ;;
                                  emu_rom)
                                      key="$SYS_SAVE_ROM"
                                      config="$EMU_CONF"
                                      ;;
                              esac
                              default_process "$config" "$mode" "$key" "$value"
                              
                              case "$type" in
                                  emu_sys)
                                      key="default NES"
                                      ;;
                                  emu_cmd)
                                      key="$EMULATOR"
                                      ;;
                                  emu_rom_old)
                                      key="$SYS_SAVE_ROM_OLD"
                                      config="$EMU_CONF"
                                      ;;
                                  emu_rom)
                                      key="$SYS_SAVE_ROM"
                                      config="$EMU_CONF"
                                      ;;
                              esac
                              default_process "$config" "$mode" "$key" "$value"
                              

                              }

                              I added the second case and when i launch it is picking it up. But now it says it is launching from both emulators. So i need to tell it to launch default NES for only .nes files. Thanks for any help or thoughts you might have.

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

                                @lilbud @meleu I think the issue with having to run a script is that you will have to do this each time you create a new "favorites" or "Mario" or any system. You would also need to run the script any time you add a new game to the "Mario" system.

                                If we can find a way to get the runcommand.sh to do this for us, it will work all the time. What i have done is created a copy of the runcommand.sh file and named it runcommandfav.sh. In my es_systems.cfg, i have just changed the runcommand file to the fav.sh file and left all the normal systems running off of the standard runcommand.sh file. This way we don't effect anything we already have set up.

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

                                  Just an FYI for anyone reading through this thread. The directions at the top in the very first post do work without any issues. I have now implemented this on 2 separate builds with 2 different branches of ES running (main branch and screensaver branch).

                                  The long line of posts are simply @lilbud and myself trying to find a away to avoid having to set the emulator for each rom in your folder. You can follow the directions in the first post and create any system you want, like "Fighters". You can put any roms from any systems in there, you just have to manually set the emulator the very first time you launch the rom by pressing "A" button and setting the emulator for that rom.

                                  lilbudL 1 Reply Last reply Reply Quote 0
                                  • lilbudL
                                    lilbud @TMNTturtlguy
                                    last edited by

                                    @TMNTturtlguy Does anyone know Recalbox manages favorites? Cause watching the videos, it seems like they got this figured out.

                                    Creator of the Radiocade: https://retropie.org.uk/forum/topic/6077/radiocade

                                    Backlog: http://backloggery.com/lilbud

                                    TMNTturtlguyT 1 Reply Last reply Reply Quote 2
                                    • TMNTturtlguyT
                                      TMNTturtlguy @lilbud
                                      last edited by

                                      @lilbud Recall box vidoes is what inspired me last night! I saw @fernbuilds videos that had Batman and Mario and Sonic systems, and thought it would be so cool if we could do that. I can build a bartop machine and put cool TMNT graphics and marquee on it and run all the TMNT games ever made! I probably need to grow up some day!?!

                                      So like @lilbud has asked, any recall box experts out there? @fernbuilds, any thoughts?

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

                                        OK guys, here is my contribution to the messy creative favorites makeshift method you're trying to implement.

                                        Premises

                                        • It uses symbolic links only. I did this way intentionally. I think that duplicating files is a bad practice. Imagine someone with various PlayStation games as favorites...
                                          That being said, the step 2 of the OP needs to be adapted. Here is the command to create the symbolic link:
                                        ln -s ~/RetroPie/roms/nes/MyFavoriteNesGame.nes ~/RetroPie/roms/favorites/MyFavoriteNesGame.nes
                                        
                                        • There's no need to create the /opt/retropie/configs/favorites directory. Then the step 4 of the OP is completely unnecessary.

                                        es_systems.cfg

                                        Here is my version:

                                         <system>
                                             <name>Favorites</name>
                                             <fullname>Favorites</fullname>
                                             <path>/home/pi/RetroPie/roms/favorites</path>
                                             <extension>.zip .ZIP .smd .SMD .smc .SMC .sfc .SFC .nes .NES .bin .BIN .pbp .PBP</extension>
                                             <command>/home/pi/bin/runfavorites.sh %ROM%</command>
                                             <platform>all</platform>
                                             <theme>favorites</theme>
                                          </system>
                                        

                                        /home/pi/bin/runfavorites.sh

                                        And here is the little script that makes the magic (thanks to sed and regular expressions sorcery):

                                        #!/usr/bin/env bash
                                        
                                        # testing if it's a symbolic link
                                        if [[ ! -L "$1" ]]; then
                                            dialog --msgbox "ERROR: \"$1\" is not a symbolic link." 0 0
                                            exit 1
                                        fi
                                        
                                        # getting the name of the file that the symbolic link points to
                                        rom="$(ls -l "$1" | sed 's|.*-> ||')"
                                        
                                        # getting the system based on the folder the rom is stored
                                        system="$(echo "$rom" | sed 's|\(.*/RetroPie/roms/[^/]*\).*|\1|' | xargs basename)"
                                        
                                        # now launch runcommand normally
                                        /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ "$system" "$rom"
                                        
                                        • Useful topics
                                        • joystick-selection tool
                                        • rpie-art tool
                                        • achievements I made
                                        1 Reply Last reply Reply Quote 2
                                        • TMNTturtlguyT
                                          TMNTturtlguy
                                          last edited by

                                          @meleu It looks like you are requiring that the games be placed into a subfolder for each system? The symbolic link is linking an entire folder. This seems to defeat the purpose of what I am doing. I am not trying to create a favorites folder, I am creating a new system, just like the arcade system in which you can put several different platforms into one system. I don't want to have to have a folder in each of my systems, and i don't necessarily intend for people to have duplicates off all of their roms either, unless they choose to do so. The intent is that we can have a favorites, or a Mario, TMNT, Batman, Fighters or Street Fighter system. We can create a system background and system logo for each of these. I can then place all of the TMNT games from all of the systems into one spot. here is a link to a video by @fernbuilds, i am not sure if he is on attract mode or recal box.

                                          I think your script and idea is very good as well! Thanks for your help and time. This may be what @lilbud is looking for so he doesn't have to manually select his emulator for each rom.

                                          meleuM fernbuildsF 3 Replies Last reply Reply Quote 0
                                          • SanoS
                                            Sano
                                            last edited by

                                            @meleu I like the way you presented it :)
                                            This is interesting and plenty of fun to do, but at most a not-so-pretty workaround.
                                            BTW all my roms stay zipped when the emulator allows it, so checking for suffix wouldn't work for me :)

                                            Correct me if I'm wrong, but as I said earlier, the clean way to do this would be first to replace the gamelist.xml files by system with a common DB (sqlite ?).
                                            This would allow to detach the ES interface from the system>rom scheme.
                                            ES would then be able to sort and present games by metadata (system/editor/genre/keyword/date/favourite...), and launch them with correct emulator according to the rom folder.

                                            I know it would be a huge lot of work, but I don't see any other clean solution to do this.
                                            I also found out yesterday that aloshi worked on a sqlite branch of ES back in 2015...

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