• 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

Starting a game from a script file

Scheduled Pinned Locked Moved Help and Support
scriptprogrammingruncommand
10 Posts 3 Posters 1.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.
  • T
    teethree89
    last edited by teethree89 28 Oct 2021, 12:28

    Alrighty, so with the help of you guys I was able to get the kill script to work for this loader, and then was able to hook it into the godot game to run on a key stroke (yay!) my next conundrum I am having is running a game after the kill, I have tried a few different combinations but the closest I have gotten is an emulationstation BSOD, here is the code I have in the kill script:

    #!/bin/bash
    ps -ef | awk '/godot-engine/ {print $2}' | xargs kill ;
    sleep 2s &&
    /home/pi/RetroPie/scripts/startmk3.sh

    and then in the startmk3.sh:

    #!/bin/bash
    /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ arcade ~/RetroPie/roms/arcade/mk3.zip && emulationstation

    So in theory it will kill the godot engine/loader and then wait 2 seconds and then run the second script, but it either hangs or BSODs, I have tried getting rid of the script and just going direct with it too, quite the head scratcher :(

    I'm thinking it might be because the script kills the "godot" processes which includes the script itself? Therefore when the second script attempts to boot it emulationstation it stops it half way through on the kill command? If so would I have to run a second "job" for the script/action to be autonomous?

    1 Reply Last reply Reply Quote 0
    • M
      mitu Global Moderator
      last edited by mitu 28 Oct 2021, 13:22

      Why don't you just have your code exit cleanly from the game/Godot engine ?
      Why are you using runcommand instead of launching the game directly ?

      What's the error from runcommand ? Look into the log file /dev/shm/runcommand.log.

      EDIT: EmulationStation also has a log file in $HOME/.emulationstation, you can check here also for errors.

      T 1 Reply Last reply 28 Oct 2021, 13:40 Reply Quote 0
      • T
        teethree89 @mitu
        last edited by teethree89 28 Oct 2021, 13:40

        @mitu from that log file i have the following:

        /dev/shm/runcommand.log: line 1: Parameters:: command not found
        /dev/shm/runcommand.log: line 2: Executing:: command not found
        /dev/shm/runcommand.log: line 3: ERROR:: command not found
        /dev/shm/runcommand.log: line 4: At:: command not found
        /dev/shm/runcommand.log: line 5: WARNING:: command not found
        /dev/shm/runcommand.log: line 6: At:: command not found
        /dev/shm/runcommand.log: line 7: ERROR:: command not found
        /dev/shm/runcommand.log: line 8: At:: command not found

        I thought runcommand was the best way to launch the game, what would be the best way to do that?
        I tried the following and got this result

        pi@retropie:~ $ bash ~/RetroPie/roms/arcade/mk3.zip && emulationstation
        /home/pi/RetroPie/roms/arcade/mk3.zip: /home/pi/RetroPie/roms/arcade/mk3.zip: cannot execute binary file

        I probably could just have the launcher/godot game exit on it's own without a kill script, I for some reason didn't think of that lol.

        M 1 Reply Last reply 28 Oct 2021, 13:58 Reply Quote 0
        • M
          mitu Global Moderator @teethree89
          last edited by mitu 28 Oct 2021, 13:58

          @teethree89 said in Starting a game from a script file:

          I thought runcommand was the best way to launch the game, what would be the best way to do that?

          Just launch the program you want ? runcommand is just a wrapper over the actual emulator that does a few other things that are RetroPie specific.

          /home/pi/RetroPie/roms/arcade/mk3.zip: /home/pi/RetroPie/roms/arcade/mk3.zip: cannot execute binary file

          Why would you try to execute a .zip file ? You'll need to start the emulator needed to load and run the ROM contained in the .zip file. If you're unsure how to start it and what parameters you need, just launch the game from EmulationStation and then look in /dev/shm/runcommand.log to see what's the actual command used.

          EDIT: to see the contents of the /dev/shm/runcommand.log, use either a text editor like nano or the less/more pagers (i.e. less /dev/shm/runcommand.log).

          T 1 Reply Last reply 28 Oct 2021, 14:04 Reply Quote 0
          • T
            teethree89 @mitu
            last edited by 28 Oct 2021, 14:04

            @mitu basically I am trying to make a loader similar to what the 6-in-1 pacman arcades have except for mortal kombat 1,2, and 3, from which the user can just select the game they want and launch it directly, godot gives me a lot of control over interface, effects etc and has the export I need to run on retropie linux/android etc, thats why I am using the script to try to launch a game without opening the emulator, and the runcommand seemed to have worked for the initial launch sh script to boot directly into a game, if that all makes sense :)

            so my path of logic was as follows: Boot into loader (works) > choose game and close loader (works) > launch script for new game to open after close (BSOD or hangs)

            M 1 Reply Last reply 28 Oct 2021, 14:22 Reply Quote 0
            • M
              mitu Global Moderator @teethree89
              last edited by 28 Oct 2021, 14:22

              @teethree89 said in Starting a game from a script file:

              basically I am trying to make a loader similar to what the 6-in-1 pacman arcades have except for mortal kombat 1,2, and 3, from which the user can just select the game they want and launch it directly

              That what EmulationStation does, seems to me you're trying to re-invent the wheel.

              T 1 Reply Last reply 28 Oct 2021, 14:47 Reply Quote 0
              • T
                teethree89 @mitu
                last edited by 28 Oct 2021, 14:47

                @mitu kind of lol, I just want better control of the interface and graphic effects etc for a more classic feel vs having a list of games to scroll through. I know I can re-skin emulationstation but that limits what I can do with it, and I don't see a good custom-izable loader bouncing around the community yet :)

                M F 2 Replies Last reply 28 Oct 2021, 14:53 Reply Quote 0
                • M
                  mitu Global Moderator @teethree89
                  last edited by mitu 28 Oct 2021, 14:53

                  @teethree89 said in Starting a game from a script file:

                  I don't see a good custom-izable loader bouncing around the community yet :)

                  The no.1 most popular topic in the forum - https://retropie.org.uk/forum/topic/9598/announcing-pegasus-frontend, not mentioning Attract-Mode.

                  T 1 Reply Last reply 28 Oct 2021, 15:05 Reply Quote 0
                  • T
                    teethree89 @mitu
                    last edited by 28 Oct 2021, 15:05

                    @mitu welp, there goes this right into the bin, thank you!

                    1 Reply Last reply Reply Quote 0
                    • F
                      Folly @teethree89
                      last edited by 28 Oct 2021, 15:50

                      @teethree89

                      2 old projects of mine, perhaps something to peek in :

                      https://github.com/FollyMaddy/retropieXstation

                      and

                      I always use this in the desktop environment, running games directly from the explorer :
                      https://github.com/FollyMaddy/RetroRun

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