• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
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

Autostart and ROM load by command line

Scheduled Pinned Locked Moved Help and Support
runcommandretroarch
17 Posts 4 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.
  • P
    pjft @pmreis
    last edited by 31 Mar 2017, 14:23

    @pmreis Got it.

    I'd suspect killing retroarch is the way to go, so I'm out of ideas unfortunately. I'd try to read up on the runcommand logic, to see if there's anything you're missing there.

    Sorry for not being able to help out more.

    P 1 Reply Last reply 31 Mar 2017, 14:33 Reply Quote 0
    • P
      pmreis @pjft
      last edited by 31 Mar 2017, 14:33

      @pjft Thank you anyway! I think it actually may be because of the way retroarch is "killed", because the runcommand.logs are exactly the same with the difference in the name of the rom... it makes no sense. Can be also the "subprocess" in python that is adding some sugar, but I have no idea what can be.

      B 1 Reply Last reply 31 Mar 2017, 14:38 Reply Quote 0
      • B
        BuZz administrators @pmreis
        last edited by 31 Mar 2017, 14:38

        @pmreis send a SIGINT instead of SIGTERM and see if that helps.

        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

        P 1 Reply Last reply 31 Mar 2017, 15:27 Reply Quote 0
        • P
          pmreis @BuZz
          last edited by 31 Mar 2017, 15:27

          @BuZz the change didn't help. But I think I've narrowed it down to the way Python calls the command line.

          and I even found another post with the same problem but unfortunelly without any answer to it.

          https://retropie.org.uk/forum/topic/6167/programmatically-run-game-from-console/6

          If I run the command in terminal go to game then back to terminal and again command, everything works fine. The problem is when the terminal call is from python. Might be an issue with the python sandbox or some users permissions somehow.

          Also found out that when the gamepad is not detected the keyboard is active and allows to play the game, but that is not optimal as my 3yr old would not understand this.

          I'm using subprocess.call('<link>', shell=True) and I've tried os.console(<link>) both have the same behaviour.

          Not an linux expert to understand exactly what is happening but hopefully somebody had this problem at one point and will see this post. As soon I have an answer I will for sure post it here.

          P 1 Reply Last reply 31 Mar 2017, 16:23 Reply Quote 0
          • P
            pjft @pmreis
            last edited by 31 Mar 2017, 16:23

            @pmreis I'm certainly not a Linux expert either. What happens if you run it with shell=false, out of curiosity?

            Could you test out, instead of the script to change games, just explicitly launching two consecutive games in autostart, and exiting the first one via the standard select+start so it launches the second one, and see if the input works or not?

            P 1 Reply Last reply 31 Mar 2017, 16:30 Reply Quote 0
            • P
              pmreis @pjft
              last edited by 31 Mar 2017, 16:30

              @pjft The shell=False doesn't even allow to run the call.

              As for the other test seems quite a really good troubleshoot, now I'm on the school run but as soon as I can I'll try it out!

              Thank you.

              P 1 Reply Last reply 31 Mar 2017, 17:22 Reply Quote 0
              • P
                pmreis @pmreis
                last edited by 31 Mar 2017, 17:22

                @pmreis Just tried it and it works. So clearly the problem is in the way the runcommand.sh is called by python.

                So my workaround is to put a bunch of roms in autostart and when you click the button it will cycle through those games, in the end I just start the emulation station. Not what I was going for but might work for the purpose.

                Thank you for your help!

                P 1 Reply Last reply 31 Mar 2017, 17:25 Reply Quote 0
                • P
                  pjft @pmreis
                  last edited by 31 Mar 2017, 17:25

                  @pmreis Great to hear.

                  Truth be told, then, you might be able to replicate whatever you were going for in the bash script instead. It is quite powerful, for those who know how to make it work.

                  Alternatively, you may try to have the python script call just one (random?) game, assuming that whatever logic you have there is preserved, and just have the autostart script repeatedly call the python script.

                  Once again, without knowing what you're trying to do, I'm just guessing, but hope it helps!

                  P 1 Reply Last reply 31 Mar 2017, 17:41 Reply Quote 0
                  • P
                    pmreis @pjft
                    last edited by 31 Mar 2017, 17:41

                    @pjft true, is very possible to do it in the bash.

                    My project is very simple, a PI in a wood box with a big push button and 4 leds, and under each led there is a logo of a game. Whenever my kid wants to play he pushes the big button and starts the pi. Whenever he is tired or want a different game press again the button and goes for another game (so the respective led turns on). Whenever he wants to turn off just keeps the big button pressed.

                    That's it. So I do believe your solution fits the purpose perfectly as I can just put the 4 or 5 games in the autostart and control the leds over the python script or bash or whatever.

                    Thank you very much!

                    M 1 Reply Last reply 31 Mar 2017, 19:45 Reply Quote 1
                    • M
                      meleu @pmreis
                      last edited by 31 Mar 2017, 19:45

                      @pmreis said in Autostart and ROM load by command line:

                      My project is very simple, a PI in a wood box with a big push button and 4 leds, and under each led there is a logo of a game.

                      Then you can call yourself a frontend developer! :-)

                      I'm curious about how to get input from those buttons with "pure" bash.

                      • Useful topics
                      • joystick-selection tool
                      • rpie-art tool
                      • achievements I made
                      P 1 Reply Last reply 31 Mar 2017, 22:21 Reply Quote 0
                      • P
                        pmreis @meleu
                        last edited by 31 Mar 2017, 22:21

                        @meleu in "pure" bash I don't think is possible but you can call c programs that do that, I've done that for other projects. I was trying to get everything done with a python script (which is totally not my weapon of choice), but with the bash and a couple of tricks this can be done, it fits the purpose.

                        The issue for me might be if I had multiple physical buttons connected to several GPIO to select specific games, but by having only one button really simplifies the whole thing.

                        1 Reply Last reply Reply Quote 0
                        17 out of 17
                        • First post
                          17/17
                          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.

                          This community forum collects and processes your personal information.
                          consent.not_received