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

    [dev] Little favorite launcher (third attempt - ready for testers!) v.055! - last release I am finished

    Scheduled Pinned Locked Moved Ideas and Development
    favoritesfavouriteslaunch menu
    20 Posts 5 Posters 5.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.
    • cyperghostC
      cyperghost
      last edited by cyperghost

      Hello,

      I've managed to create a favourite launcher. It was a bit of hard work but now it's a solid piece of software. As I'm not the best coder for software I searched for an easy entrypoint to hook up the favourite launcher. The best EP is the one, that gives all systemcalls in one .... guess it's the runcommand.sh

      Prerequisite #1

      You have to manually edit the opt/retropie/supplementary/runcommand/runcommand.sh
      Follow link to PasteBin exp. after 30days
      Line 332 and block 411 are the added pieces (sorry @BuZz for missusing the runcommand)

      I just added one new line F) Favourites to code block and hooked up to the options menu with the the binary named fav-create. This binary changes pure ROM name to a description file and sets the ROM name to UPPERCASE and adds a FAV extension to the file.

      System call is: fav-create "path to favourite folder" "rompath" "emusystem" "command"

      I was able to compute favourite folder location via command call so in case you want to change Favourite folder location do so as you need.
      $rootdir/supplementary/runcommand/lfl-create "/home/pi/RetroPie/roms/fav/" "$rom" "$system" "$command"

              options+=(X "Launch")
      
              if [[ "$command" =~ retroarch ]]; then
                  options+=(L "Launch with verbose logging")
                  options+=(Z "Launch with netplay enabled")
              fi
      
      	options+=(F "Favourits (with launching)")
              options+=(Q "Exit (without launching)")
      	
              local temp_mode
              if [[ $has_tvs -eq 1 ]]; then
                  temp_mode="${mode[$mode_new_id]}"
      
      .....
      .....
      
                 X)
                      return 0
                      ;;
                  L)
                      command+=" --verbose"
                      return 0
                      ;;
                  F)
                      $rootdir/supplementary/runcommand/lfl-create "/home/pi/RetroPie/roms/fav/" "$rom" "$system" "$command"
                      sleep 5
                      return 0
                      ;;
                  Q)
                      return 1
                      ;;
              esac
       
      
      

      Prerequisite #2
      Update in Posting 9
      Create a new folder favin your ROMS folder
      Edit es_systems.cfg and ad a new "system"
      Execution of our FAV files is just a call by bash ;)

      <system>  
        <fullname>Favorites</fullname>
          <path>/home/pi/RetroPie/roms/favorites</path>
          <extension>.fav .FAV</extension>
          <command>bash %ROM%</command>
          <platform>all</platform>
          <theme>Favorites</theme>
        </system>
      

      Prerequisite #3
      Update Source Code to v0.55
      You need the binary fav-createand place it to opt/retropie/supplementary/runcommand/

      Source Code

      ' Favourite creater 0.15
      ' 06/12/17 cyperghost
      ' greetings to vika, meleu, cott, buzz, seklth
      ' this is just a small test
      ' wait for more
      dim as string path_fav,rom_fav, system_fav, rom_name, rom_favname
      dim as integer idx, z
      
      print "ROOT DIR: ";command(0)
      print "FAV PATH: ";command(1)
      print "ROM PATH: ";command(2)
      print "ROM SYST: ";command(3)
      print "SYS CALL: ";command(4)
      
      path_fav=command(1)
      rom_fav=command(2)
      system_fav=command(3)
      
      for z=1 to len(rom_fav)
      if mid(rom_fav,z,1)="/" then idx=z
      next z
      
      rom_name=mid(rom_fav,idx+1,len(rom_fav))
      
      for z=1 to len(rom_name)
      if mid(rom_name,z,1)="." then idx=z
      next z
      
      rom_favname=ucase(left(rom_name,idx-1)+".fav")
      
      ' Build FAV file
      open path_fav+rom_favname for output as #1
      print #1,command(4)
      close #1
      

      Prerequisite #4

      After creation of FAV files you need to restart emulation station to show new created files.

      Does it work?
      Yes it does!
      Look at the Screenshot of my FAV folder. There is a mix of Neogeo, Mame, FBA, Gameboy and GameGear files in and they all run out of the favourite folder. The bas files are waste from other projects :) forget them!

      0_1497290167889_fav_folder.jpg

      Download
      As always... source code, binary and a readme in one zip file via Dropbox

      This won't be possible without the work from @meleu @BuZz and many many others I forget to name here

      1 Reply Last reply Reply Quote 4
      • cyperghostC
        cyperghost
        last edited by cyperghost

        It is easily possible to implent this to gameslist.xml
        It took me nearly 2 hours to write this small code ... My editor is nano and it's a pain to code via SSH shell. This binary was compiled on a raspberry 3 but with arm6 build of basic. It may run also on rapsberry 1/0.

        Future plans:

        • Not to call FAV files via bash :) That's just quick'n'dirty coding but it's enough for a how-to release
        • Delete created FAV
        • Make filename look more beautifull with system - ROMname
        • Remove ucase function - AWFUL look

        Please give me feedback

        1 Reply Last reply Reply Quote 0
        • cyperghostC
          cyperghost
          last edited by cyperghost

          ' Favourite creater 0.55
          ' 06/13/17 cyperghost
          ' greetings to vika, meleu, cott, buzz, seklth
          ' this is just a small test
          ' wait for more
          ' 
          ' Added:
          ' Nicer looking favnames (SYSTEM - romname)
          ' launch abilitiy close to runcommand.sh
          ' Favnames or now lowercase
          ' FAVs can called by bash if there is no description available (rename .sh files from ports to .fav and copy them to Favouirite folder)
          
          dim as string path_fav,rom_fav, system_fav, rom_name, rom_favname, runcommand, sysbash
          dim as integer idx, z
          
          'print "ROOT DIR: ";command(0)
          'print "FAV PATH: ";command(1)
          'print "ROM PATH: ";command(2)
          'print "ROM SYST: ";command(3)
          'print "SYS CALL: ";command(4)
          
          
          select case ucase(right(command(1),4))
          case ".FAV" 'Act as launcher for FAV files
          rom_favname=command(1)
          
          open rom_favname for input as #1
          line input #1,rom_name
          line input #1,system_fav
          line input #1,sysbash
          close #1
          
          
          for z=1 to len(rom_favname)
          if mid(rom_favname,z,1)="/" then idx=z
          next z
          path_fav=left(rom_favname,idx)
          
          open path_fav+"runcommand_systems.txt" for input as #1
          do
          line input #1,runcommand
          loop until eof(1) or InStr(runcommand,system_fav)<>0
          close #1
          
          If InStr(runcommand,system_fav)=0 and sysbash<>"" then shell chr(34)+sysbash+chr$(34):end
          If InStr(runcommand,system_fav)=0 then shell "bash "+chr(34)+rom_favname+chr(34):end
          
          
          sysbash=mid(runcommand,1,InStr(runcommand, "%ROM%")-1)+chr(34)+rom_name+chr(34)+Mid(runcommand,InStr(runcommand, "%ROM%")+Len("%ROM%"),Len(runcommand))
          shell sysbash
          
          case else 'create fav-files
          path_fav=command(1)
          rom_fav=command(2)
          system_fav=command(3)
          sysbash=command(4)
          
          for z=1 to len(rom_fav)
          if mid(rom_fav,z,1)="/" then idx=z
          next z
          
          rom_name=mid(rom_fav,idx+1,len(rom_fav))
          
          for z=1 to len(rom_name)
          if mid(rom_name,z,1)="." then idx=z
          next z
          
          rom_favname=ucase(system_fav)+" - "+left(rom_name,idx-1)+".fav"
          
          ' Build FAV file
          open path_fav+rom_favname for output as #1
          print #1, rom_fav
          print #1, system_fav
          print #1, sysbash
          close #1
          
          end select
          
          1 Reply Last reply Reply Quote 0
          • A
            ainmosni
            last edited by ainmosni

            Good idea, I might try it out if I have some time. Just some random comments:

            • Why not just create a repo on github or gitlab or better yet, fork the RetroPie repo.
            • Nano is a horrible code editor, vim is better but has a huge learning wall. (Worth it) Maybe try something like sublime or vs code? Both have bash support and will make writing scripts like this much easier. Vim and emacs are the only decent code editors that will run in a terminal though but both are not particular beginner-friendly.

            For the rest, great work and happy to look where this is going.

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

              @ainmosni I hope that a more talented forum member will take this as a push to include a favourite system into ES. I think the idea to "launch" description files is much more versatile than using the gamelists

              Repro? Fork? No...

              S 1 Reply Last reply Reply Quote 0
              • S
                Syhles @cyperghost
                last edited by

                @cyperghost
                I would try and get ahold of @jdrassa @pjft or @Zigurana

                See if they could help with this.

                1 Reply Last reply Reply Quote 1
                • pjftP
                  pjft
                  last edited by

                  Hey.

                  Yes, "Favorites" is certainly something that @Zigurana is/was working on, so I'm leaving it with him. He already implemented it on his Kids fork, so it's just a matter of bringing it over.

                  I am currently working on systems that contain games from several ones - namely a system to show all games in a single list, the games you last played, and - yes - your favorite games in a single list. You've probably seen my not-so-subtle requests on the Comic Book theme thread for themes for those systems. :)

                  That last one, however, depends on favorites being a thing, so we'll wait. But it is - and it has been - on our horizon, certainly. :)

                  By all means, do keep going though. As long as you're having fun and learning, you should not be dissuaded from doing these things, and you can definitely benefit from the experience with working on something new with the community.

                  Better to have something working now, than a promise of something working in 3-6 months :)

                  cyperghostC 1 Reply Last reply Reply Quote 3
                  • cyperghostC
                    cyperghost @pjft
                    last edited by cyperghost

                    @pjft I will further develop this piece of software. In the next days I will made a "tribute to runcommand" version which uses the same launch parameters as runcommand uses. Just to give compatibality!

                    I think at least the version you @pjft and @Zigurana are working should be developed and forked to to final version to ES. I also hope that this version will give some entrypoints for other developers that are not "Knee-Deep" in coding (like me). Maybe a program call via button pressing are whatever. That's a kind of thing in miss in RECALBOX and I really appreciate on the runcommand.sh by @BuZz . He offers lots of accesspoints to system near functions and standarizised the call of roms via "SYS emusystem"-call. That really helps a lot

                    1 Reply Last reply Reply Quote 1
                    • cyperghostC
                      cyperghost
                      last edited by cyperghost

                      pushed code to v0.55 now - my work is done!
                      Source code ist in posting #3, feel free to use'n'compile

                      Changes

                      • FAV files are called via runcommand now (better for individual rom settings or individual launching screens)
                      • Filename for favs look more beautifull with 'SYSTEM' - ROMname naming
                      • Take use of runcommand_systems.txt these are the same runcommands as found in es_system.cfg (read point 1)
                      • lvl-create acts as FAV creater and as FAV launcher the function will be declared via command(1)
                      • if system is not available in list (nes, megadrive...) then try to launch the commandlineparameter that runcommand usually uses for that rom
                      • if that is also a failure than try to lauch fav file via bash call
                      • for interested people... basic is a very good language for manipulating file strings take this as example
                      • I can't delete FAV files that easy. I could make a flip flop if I can create it like "If fav file can be found then delete it else create fav file" - That's stupid!

                      Config es_systems.cfg

                      Add new system like done in the code box and use lfl-createas launcher for ROM files:

                        <system>
                          <name>favorites</name>
                          <fullname>Favorites</fullname>
                          <path>/home/pi/RetroPie/roms/fav123456789012345</path>
                          <extension>.fav .FAV</extension>
                          <command>/opt/retropie/supplementary/runcommand/lfl-create %ROM%</command>
                          <platform>all</platform>
                          <theme>favorites</theme>
                        </system>
                      

                      Please contribute if you use this software
                      it is tended as free but please respect the work of others

                      IDE was nano :D
                      So the code looks a bit messy :D

                      Content of created FAV file GAMEGEAR - Addams Family, The (U) [!].fav

                      /home/pi/RetroPie/roms/gamegear/Addams Family, The (U) [!].gg
                      gamegear
                      /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-genesis-plus-gx/genesis_plus_gx_libretro.so --config /opt/retropie/configs/gamegear/retroarch.cfg "/home/pi/RetroPie/roms/gamegear/Addams Family, The (U) [!].gg"
                      

                      Content of runcommand_systems.txt that has to be located into FAV-folder

                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ amstradcpc %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ arcade %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ atari2600 %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ atari7800 %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ atarilynx %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ fba %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ fds %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ gamegear %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ gb %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ gba %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ gbc %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ mame-libretro %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ mame-mame4all %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ mastersystem %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ megadrive %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ msx %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ n64 %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ neogeo %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ nes %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ ngp %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ ngpc %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ pcengine %ROM%
                      bash %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ psp %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ psx %ROM%
                      sudo /home/pi/RetroPie-Setup/retropie_packages.sh retropiemenu launch %ROM% &lt;/dev/tty &gt;/dev/tty
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ sega32x %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ segacd %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ sg-1000 %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ snes %ROM%
                      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ vectrex %ROM%
                      bash %ROM%
                      
                      pjftP 1 Reply Last reply Reply Quote 2
                      • pjftP
                        pjft @cyperghost
                        last edited by

                        @cyperghost My, you really like to suffer, editing all this in nano :) I'm sure you'd even have emacs, if you do want to do everything on the Pi!

                        You might be better off coding on your computer and copying the files to the pi for compilation, though.

                        cyperghostC 1 Reply Last reply Reply Quote 0
                        • cyperghostC
                          cyperghost @pjft
                          last edited by

                          @pjft Most of the work was done in nano.
                          Of course I made some file testing like this sysbash=mid(runcommand,1,InStr(runcommand, "%ROM%")-1)+chr(34)+rom_name+chr(34)+Mid(runcommand,InStr(runcommand, "%ROM%")+Len("%ROM%"),Len(runcommand)) on a windows mashine but inserting was done via nano!

                          So the code locks messy but it is structered via case select for

                          1. Acting as creator for FAV files
                          2. Acting as lauchner for FAV files

                          Is there a need for the binary?

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

                            @cyperghost hello mate! I was bothering BuZz to implement a feature in runcommand that I think would help you here. Such feature is now part of RetroPie-Setup.

                            I think you can use your method described in the OP without messing the "official" runcommand, just place your script at /opt/retropie/configs/all/runcommand-menu/.

                            See the conversation here to get details. I'll try to update the runcommand wiki accordingly soon.

                            • Useful topics
                            • joystick-selection tool
                            • rpie-art tool
                            • achievements I made
                            pjftP cyperghostC 2 Replies Last reply Reply Quote 3
                            • pjftP
                              pjft @meleu
                              last edited by

                              @meleu Well done good sir. Thanks for helping move the community's initiatives forward!

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

                                @meleu Sorry my friend that does not work!
                                I can't create a FAV on every time I run a ROM.
                                I need an exact entrypoint if I want to change some settings and this entry point can only be the runcommand.sh in it's selection mode. I developed this software a bit more on to version 0.65, it now deltetes created fav by toggle check fileexistance....

                                I fully understand buzz because the runcommand is his baby - and I just implanted an alien egg in. I think it's okay for personal purpose and for a few freaks but I have the deep hope that someone creates sometimes a better system.

                                Personally this laucher is very cool, because you can edit FAV files and can easily change emumashine call. I created yesterday CPS1 und CPS2 systems. Almost all CPS1 run in mame-libretro almost all CPS2 run in FBA.

                                But one or two romes of CPS1 do only run in FBA... But I have no further game selection out of ES because the CPS1 system is marked as mame-libretro. So you pick out that little coconut via FAV menu and just toggle from mame to fba by editing FAV file second line :)

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

                                  @cyperghost said in [dev] Little favorite launcher (third attempt - ready for testers!) v.055! - last release I am finished:

                                  @meleu Sorry my friend that does not work!
                                  I can't create a FAV on every time I run a ROM.
                                  I need an exact entrypoint if I want to change some settings and this entry point can only be the runcommand.sh in it's selection mode.

                                  I think you misunderstood what that PR really is. It's a way to launch a user script during runcommand only if user invoke runcommand menu and choose the option to launch the script. IMHO your method to create those .fav files fits perfectly in this feature.

                                  Sorry if I'm not being very clear, I'll try to describe it better when I update the the wiki. ;-)

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

                                    Ah understand....
                                    Yes that should work....
                                    Am I able to select specific binaries/bash schript? Or does they run all if they are called?

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

                                      @meleu Wonderfull! That's really a hit! Works like a charm. Now I can add two options....
                                      Add Favourites and Delete Favourites!

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

                                        @meleu even the EXIT codes work as they should... nice work!

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

                                          @cyperghost BuZz is a genius! :-)

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

                                            @meleu I've bumped the fav-launcher to v0.85 now
                                            Maybe you can give it a chance. With the User Menu it is now possible to add more than one FAV-system

                                            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.