• 0 Votes
    26 Posts
    2k Views
    KrakatoaK

    @WeirdH I fixed that issue by using brackets around the code.

  • 3 Votes
    17 Posts
    4k Views
    F

    @clyde i have a custom solution for this since im running on ODROID with SDL2 and so if im not quitting the process soon enough im getting graphical glitches with on screen borders or other weird problems:

    This is my solution by now - its not perfect since it can make problems when a rom cant load (then i have to restart the system) otherwise it works flawlessly on my ODROID with retropie:

    Basically i have 2 scripts
    runcommand-onstart.sh (mine did not exist since i installed retropie from the distro directly)

    pkill fbi pkill tail # the image i want to load loader="/etc/emulationstation/splashes/$1/launching.png" if [-f "$loader"]; then # if image is found - start fbi with the image and no timelimit, also start the check script in same directory fbi -1 -t 0 -noverbose -a "$loader" </dev/tty &>/dev/null & (/opt/retropie/configs/all/check.sh) & fi

    and the check.sh script:

    # you have to enable retroarch logs - always log everything input=/opt/retropie/configs/all/retroarch/logs/retroarch.log timeout 15 tail -f $input | while read LOGLINE # if any of this lines are seen - kill everything related to launchimages - in this case fbi and tail # "Found display server" is the first command in the log before the emulator kicks in do if [[ $LOGLINE == *"Found display server"* ]]; then pkill tail pkill fbi fi if [[ $LOGLINE == *"Failed to load content"* ]]; then pkill tail pkill fbi fi if [[ $LOGLINE == *"Bus error"* ]]; then pkill tail pkill fbi fi done

    So what this is doing:
    it starts FBI forever and the check script checks the logs for "exit tokens" - if a exit token is hit every process related to the imageloading gets killed.

    If the rom cant load before 15 seconds (timeout 15 - set this to the possible highest value) the process should get automatically killed.

    works btw with the newest (current master in repo) mame-plus and mame emulators at my side. If you have "Enter Problems" - do what i said before - just add the clean commands for the tty additional to the pkill commands

    maybe that idea/solution gives some ideas to you :)

  • 0 Votes
    3 Posts
    1k Views
    D

    @mitu Thanks! I was about ready to download a fresh image just to see if onstart would be there

  • Redirecting Runcommand

    Help and Support
    8
    0 Votes
    8 Posts
    1k Views
    mituM

    I'd probably rewrite it like

    #!/usr/bin/env bash ROMDIR=/home/pi/RetroPie/roms/snes MSUROMDIR=/home/pi/RetroPie/roms/msu rom=$1 if [[ $rom == *"act2_msu1.sfc" ]]; then rom="${MSUROMDIR}/Act Raiser 2 MSU v1 Kurrono, Conn 2018-03-25/act2_msu1.sfc" fi if [[ $rom =~ *"actraiser_msu1.sfc" ]]; then rom="${MSUROMDIR}/Actraiser - Abyss Rebirth OST, MSU v1 Darkshock/actraiser_msu1.sfc" fi # and all other roms... /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ snes "$rom"
  • 0 Votes
    17 Posts
    3k Views
    meleuM

    @nemecyys said in runcommand-onstart.sh pass data to python script:

    Because im running this python script every time i run onstart.sh or onend.sh does that mean there will be LOTS of instances of it running?

    On normal typical usage, no. The runcommand script calls the onstart one and waits it finish. The way you're invoking your python script in onstart also makes it wait the python script to finish.

    Then, from what I'm seeing from the codes, I believe that there won't be lots of instances running.

    With a Bash Script:
    Would this also be the case?
    Would i want to exit the bash after running and achieving the desired result?

    There's no need.

    *also, any links to some of meleu's coding goodness?

    You can find links to some of my scripts on the "useful topics" post (link on my signature). You can find many other useful info there. ;-)

    Oh, as @cyperghost said, we usually use this thread to talk about shell scripting.

    By the way, you asked above and I'm not sure if you got an answer: the /dev/shm/runcommand.log file is deleted after a shutdown/reboot.