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

    Can't see new system in EmulationStation

    Scheduled Pinned Locked Moved Help and Support
    emulationstationscriptmodulesystem
    25 Posts 4 Posters 4.4k 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.
    • hiulitH
      hiulit @BuZz
      last edited by

      @BuZz Thanks! All clear ;)

      My little contributions to the RetroPie project:

      • Shell-Script-Boilerplate
      • Fun-Facts-Splashscreens
      • Limit-Last-Played-Games
      1 Reply Last reply Reply Quote 0
      • hiulitH
        hiulit
        last edited by hiulit

        @mitu @BuZz Sorry to "open" this thread again, but could you tell me if addEmulator works inside a loop? Something like:

            for i in "${!bin_files[@]}"; do
                addEmulator ...
            done
        

        Because it's only adding one emulator right now.

        Or let me rephrase it: How can I add more than one emulator in emulators.cfg?

        Thanks!

        My little contributions to the RetroPie project:

        • Shell-Script-Boilerplate
        • Fun-Facts-Splashscreens
        • Limit-Last-Played-Games
        mituM 1 Reply Last reply Reply Quote 0
        • mituM
          mitu Global Moderator @hiulit
          last edited by

          @hiulit said in Can't see new system in EmulationStation:

          Or let me rephrase it: How can I add more than one emulator in emulators.cfg?

          Yes, it should work. For instance

          • adding multiple entries for the same system (i.e. the same emulators.cfg) - xroar
          • adding multiple entries in multiple systems (i.e. different emulators.cfg) - lr-fbalpha.
          hiulitH 1 Reply Last reply Reply Quote 0
          • hiulitH
            hiulit @mitu
            last edited by

            @mitu Ok, it works fine when adding multiple emulators "one by one", like in the examples you showed me, but not if try to add them inside a loop. And I think it's because the emulators.cfg file gets overwritten every time addEmulator is called, right?

            Anyway, I did it like the examples you showed me and it works. Thanks :)

            My little contributions to the RetroPie project:

            • Shell-Script-Boilerplate
            • Fun-Facts-Splashscreens
            • Limit-Last-Played-Games
            mituM 1 Reply Last reply Reply Quote 0
            • mituM
              mitu Global Moderator @hiulit
              last edited by

              @hiulit said in Can't see new system in EmulationStation:

              And I think it's because the emulators.cfg file gets overwritten every time addEmulator is called, right?

              Not really, the same thing happens also in the xroar installation script and it's not a problem.

              hiulitH 1 Reply Last reply Reply Quote 0
              • hiulitH
                hiulit @mitu
                last edited by

                @mitu But in the xroar there's no loop to add the emulators.

                When I try to use something like:

                 for i in "${!bin_files[@]}"; do
                        addEmulator ...
                    done
                

                Only the last emulator gets written in emulators.cfg

                My little contributions to the RetroPie project:

                • Shell-Script-Boilerplate
                • Fun-Facts-Splashscreens
                • Limit-Last-Played-Games
                mituM 1 Reply Last reply Reply Quote 0
                • mituM
                  mitu Global Moderator @hiulit
                  last edited by

                  @hiulit Without looking at the full code fragment, it's hard to say if it's a bug in your code or something in addEmulator.

                  hiulitH 1 Reply Last reply Reply Quote 0
                  • hiulitH
                    hiulit @mitu
                    last edited by

                    @mitu Well, I've already used the "one-by-one" method, but here's what I had

                    function configure_godot-engine() {
                        mkRomDir "godot-engine"
                    
                        local bin_files
                    
                        if isPlatform "x86"; then
                            bin_files=("godot-3.0-x11-x86-32.bin" "godot-3.1-x11-x86-32.bin")
                        elif isPlatform "aarch64"; then
                            bin_files=("frt_094_310_arm64.bin")
                        elif isPlatform "rpi1"; then
                            bin_files=("frt_094_310_pi1.bin")
                        elif isPlatform "rpi2" || isPlatform "rpi3"; then
                            bin_files=("frt_094_310_pi2.bin")
                        fi
                    
                        for i in "${!bin_files[@]}"; do
                            addEmulator 0 "$md_id-$i" "godot-engine" "$md_inst/${bin_files[$i]} --main-pack %ROM%"
                        done
                    
                        addSystem "godot-engine" "Godot" ".pck .zip"
                    }
                    

                    My little contributions to the RetroPie project:

                    • Shell-Script-Boilerplate
                    • Fun-Facts-Splashscreens
                    • Limit-Last-Played-Games
                    mituM 1 Reply Last reply Reply Quote 1
                    • EfriimE
                      Efriim
                      last edited by Efriim

                      Indirect expansion will not work in a loop, is possibly how to get only one emulator.

                      Try using single quotation for the variables, so that it knows the expansion is protected and invariable.

                      and/or without the indirect reference since it will be read like

                      for i in godot-3.0-x11-x86-32.bin godot-3.1-x11-x86-32.bin do
                      add emulator
                      
                      1 Reply Last reply Reply Quote 0
                      • BuZzB
                        BuZz administrators
                        last edited by

                        Ignore my previous msg. Misread (and deleted it). Run with sudo __debug=1 ./retropie_packages etc and check what's going on. Or add some debugging manually.

                        To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

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

                          @hiulit The code you posted seems ok. I've scoured through the existing modules and I've found something similar to your case - Oricutrun. It adds a few emulators for the same system (i.e same emulators.cfg). Incidentally, the code has a bug (i.e. always ads a default emulator instead of using $default).
                          I've run the install script and the .cfg file is created correctly - has all the emulators' entries.

                          Just a crazy idea - remove the emulators.cfg and re-run the configure action for your module

                          sudo ./retropie_packages.sh godot-engine configure
                          

                          and check again the .cfg file.

                          hiulitH 1 Reply Last reply Reply Quote 0
                          • hiulitH
                            hiulit @mitu
                            last edited by

                            @mitu @BuZz @Efriim I finally got it working! :D

                                local bin_file
                                local bin_files
                                local default
                                local id
                                local index
                                local version
                            
                                ... some other code ...
                            
                                for index in "${!bin_files[@]}"; do
                                    default=0
                                    [[ "$index" -eq "${#bin_files[@]}-1" ]] && default=1 # Default to the last item in 'bin_files'.
                                    
                                    version="${bin_files[$index]}"
                                    version="$(echo $version | cut -d'_' -f 2)"
                                    
                                    addEmulator "$default" "$md_id-$version-$id" "godot-engine" "$md_inst/${bin_files[$index]} --main-pack %ROM%"
                                done
                            

                            So it seems like the error had something to do with the index variable (previously it was named i). Either it needed to be initialized as a local variable or the script didn't like that it was called i... I really don't know. But I got it working :)

                            Another thing that I found and maybe it's worth mentioning (and correct me if I'm wrong) is that when I run:

                            sudo ./retropie_packages.sh godot-engine configure
                            

                            the config file:

                            /opt/retropie/configs/godot-engine/emulators.cfg
                            

                            seems to just add the new stuff on top of the previous configs that were already there. I mean, it doesn't delete the file and creates it again with the new configs.

                            Shouldn't "deleting the old file and creating a new one" be the "correct" thing to do?

                            Thanks! :)

                            My little contributions to the RetroPie project:

                            • Shell-Script-Boilerplate
                            • Fun-Facts-Splashscreens
                            • Limit-Last-Played-Games
                            1 Reply Last reply Reply Quote 1
                            • 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.