• 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

Start a game in paused mode (Retroarch)?

Scheduled Pinned Locked Moved Help and Support
retroarchpauselr-mame2003plus
12 Posts 3 Posters 1.9k 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.
  • J
    johnodon
    last edited by johnodon 27 Jun 2020, 17:21

    Is there a way to have RA start start a game in paused mode when it is first loaded (specifically mame2003-plus)?

    1 Reply Last reply Reply Quote 0
    • M
      mitu Global Moderator
      last edited by 28 Jun 2020, 02:34

      I don't think there's an option for it in RetroArch. You may be able to use a runcommand onstart script to send a toggle pause command to it via the network control interface, but you'll have to time it properly and also bind the Pause command on your gamepad so you can properly resume the gameplay.

      J 1 Reply Last reply 28 Jun 2020, 10:36 Reply Quote 0
      • J
        johnodon @mitu
        last edited by johnodon 28 Jun 2020, 10:36

        @mitu said in Start a game in paused mode (Retroarch)?:

        I don't think there's an option for it in RetroArch. You may be able to use a runcommand onstart script to send a toggle pause command to it via the network control interface, but you'll have to time it properly and also bind the Pause command on your gamepad so you can properly resume the gameplay.

        I saw those commands yesterday but couldn't figure out a way to call them. The runcommand onstart should do the trick. Maybe I can wrap the call in a loop that looks for the retrorarch PID and executes it as soon as it finds it. Or, maybe look for a lock file if RA creates one (researching that now).

        1 Reply Last reply Reply Quote 0
        • J
          johnodon
          last edited by 28 Jun 2020, 13:44

          OK, I need some help with the logic in my script. If I put the below into a test.sh and run it, it behaves exactly as I want. As soon as it finds a process with 'retroarch' in the name, it sleeps 1 and then sends a pause.

          However, if I put the same code into runcommand-onstart.sh, retroarch never launches (makes sense) and I am stuck in the loop.

          Is there a way to tell the while loop to continue with the script while it waits for the process to appear?

          #! /bin/bash
          while ! pgrep retroarch >/dev/null; do
          :
          done
          sleep 1
          echo -n "PAUSE_TOGGLE" | nc -u -w1 127.0.0.1 55355
          1 Reply Last reply Reply Quote 0
          • J
            johnodon
            last edited by johnodon 28 Jun 2020, 14:12

            @mitu Thank you for pointing me in the right direction.

            I think I may have worked through this unless someone can tell me a cleaner way of doing it with only the runcommand-onstart.sh...

            runcommand-onstart.sh

            #! /bin/bash
            ( /opt/retropie/configs/all/pause.sh ) &

            The & at the end is key as it allows the onstart script to continue to run in the background.

            pause.sh

            #! /bin/bash
            while ! pgrep retroarch >/dev/null; do
            :
            done
            sleep 1
            echo -n "PAUSE_TOGGLE" | nc -u -w1 127.0.0.1 55355
            M 1 Reply Last reply 28 Jun 2020, 16:36 Reply Quote 0
            • R
              Rion
              last edited by 28 Jun 2020, 14:43

              @johnodon

              I'm curious why you need this function?

              FBNeo rom filtering
              Mame2003 Arcade Bezels
              Fba Arcade Bezels
              Fba NeoGeo Bezels

              J 1 Reply Last reply 28 Jun 2020, 14:49 Reply Quote 0
              • J
                johnodon @Rion
                last edited by johnodon 28 Jun 2020, 14:49

                @Rion said in Start a game in paused mode (Retroarch)?:

                @johnodon

                I'm curious why you need this function?

                Glad you asked... :)

                I want to start the game paused and show an overlay (bezel) that has game-specific controls. When the RA 'pause_toggle' hotkey is pressed, the game will unpause and display the normal, transparent overlay (bezel). The player can press the pause button at anytime during gameplay to see the controls again. BTW...I have overlay_next and pause_toggle mapped to the same button.

                Game paused at start and controls displayed:
                1.png

                Pause toggle button pressed...game unpaused and normal bezel displayed.
                2.png

                Pause toggle button pressed during gameplay pauses the game and displays the controls again.
                3.png

                1 Reply Last reply Reply Quote 1
                • J
                  johnodon
                  last edited by 28 Jun 2020, 15:34

                  Quick video showing the transitions. Sorry...poor quality and no sound...only intended to show the functionality.

                  1 Reply Last reply Reply Quote 1
                  • M
                    mitu Global Moderator @johnodon
                    last edited by 28 Jun 2020, 16:36

                    @johnodon said in Start a game in paused mode (Retroarch)?:

                    I think I may have worked through this unless someone can tell me a cleaner way of doing it with only the runcommand-onstart.sh...

                    You can add the commands in the sub-shell, but it will look ugly. As for the 2nd script, you might want to add a 2nd sleep 1 inside the loop, so it won't waste resources waiting for RetroArch to show up.

                    J 1 Reply Last reply 28 Jun 2020, 18:57 Reply Quote 0
                    • J
                      johnodon @mitu
                      last edited by johnodon 28 Jun 2020, 18:57

                      @mitu said in Start a game in paused mode (Retroarch)?:

                      @johnodon said in Start a game in paused mode (Retroarch)?:

                      I think I may have worked through this unless someone can tell me a cleaner way of doing it with only the runcommand-onstart.sh...

                      You can add the commands in the sub-shell, but it will look ugly. As for the 2nd script, you might want to add a 2nd sleep 1 inside the loop, so it won't waste resources waiting for RetroArch to show up.

                      I wasn't sure if that was necessary since I was using : which is supposed to do nothing. I'll play safe and take your advice and add the sleep 1 inside the loop.

                      Thanks

                      1 Reply Last reply Reply Quote 0
                      • J
                        johnodon
                        last edited by 28 Jun 2020, 18:58

                        Getting closer to a finished product...

                        popeye.png

                        1 Reply Last reply Reply Quote 0
                        • J
                          johnodon
                          last edited by 28 Jun 2020, 20:41

                          One final note...

                          I had been doing all of my testing on an x86 platform. Since moving the scripts/overlays to my RPI4, I had to increase the sleep outside the loop to 2 otherwise it wouldn't pause.

                          #! /bin/bash
                          while ! pgrep retroarch >/dev/null; do
                          :
                          sleep 1
                          done
                          sleep 2
                          echo -n "PAUSE_TOGGLE" | nc -u -w1 127.0.0.1 55355
                          1 Reply Last reply Reply Quote 0
                          6 out of 12
                          • First post
                            6/12
                            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