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

    Runcommand + runcommand-onstart.sh script

    Scheduled Pinned Locked Moved Help and Support
    runcommandscripthelp
    2 Posts 2 Posters 1.6k 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.
    • L
      Lupin
      last edited by

      Pi Model 3 B
      RetroPie Version: 4.3.8 + running emulation station
      USB Devices connected: Wifi Keyboard, 2 x Zero_Delay Arcade Interface
      Using windows +Notepad and SSH to transfer files to Pi.

      Trying to get runcommand-onstart.sh to work:
      #!/usr/bin/env bash

      system="$1"
      emulator="$2"

      if [[ "$emulator" == "playback" ]]; then
      /opt/retropie/supplementary/runcommand/joy2key.py /dev/input/js0 kcub1 kcuf1 kcuu1 kcud1 0x70 0x71 &
      fi

      Wanted to use joy2key.py to program joystick with basic key controls for OMXPlayer when "playback" emulator selected.
      Runcommand passed as arguments to these scripts:
      $1 - the system (eg: atari2600, nes, snes, megadrive, fba, etc).
      $2 - the emulator (eg: lr-stella, lr-fceumm, lr-picodrive, pifba, etc).
      $3 - the full path to the rom file.
      $4 - the full command line used to launch the emulator.

      But error log showing:
      /opt/retropie/configs/all/runcommand-onstart.sh: line 2: $'\r': command not found
      /opt/retropie/configs/all/runcommand-onstart.sh: line 5: $'\r': command not found
      /opt/retropie/configs/all/runcommand-onstart.sh: line 11: syntax error: unexpected end of file
      Parameters:
      Executing: omxplayer -r -o both "/home/pi/RetroPie/roms/video.mp4"
      Video codec omx-h264 width 1280 height 720 profile 100 fps 30.000000
      Audio codec aac channels 2 samplerate 44100 bitspersample 16
      Subtitle count: 0, state: off, index: 1, delay: 0
      V:PortSettingsChanged: 1280x720@30.00 interlace:0 deinterlace:0 anaglyph:0 par:1.00 display:0 layer:0 alpha:255 aspectMode:0
      Stopped at: 00:00:02
      have a nice day ;)

      I should have been able to bug check this, but can not even run example script listed here without similar errors (METHOD 1):
      https://github.com/RetroPie/RetroPie-Setup/wiki/Take-and-Scrape-Your-Own-Screenshots

      Checked runcommand-onend.sh running ok and stopping joy2key.py:
      #!/usr/bin/env bash

      killall joy2key.py

      But can not make mistake on 1 line :)

      Can anyone help with correcting script (Then line wrong for SURE) and why example script also will not run?

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

        @lupin Check if you script has UNIX end-of-line, instead of DOS - https://superuser.com/questions/479756/eol-in-notepad-and-notepad.

        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.