Skip to content

Instantly share code, notes, and snippets.

@cattleguard
Created April 22, 2016 21:35
Show Gist options
  • Save cattleguard/fcc3a9c40b08d41a8f58ff0d2100d3b1 to your computer and use it in GitHub Desktop.
Save cattleguard/fcc3a9c40b08d41a8f58ff0d2100d3b1 to your computer and use it in GitHub Desktop.

Revisions

  1. cattleguard created this gist Apr 22, 2016.
    24 changes: 24 additions & 0 deletions NES_feeling_lucky.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    #!/bin/bash

    # Description:
    # Adds a game to your retropie NES called 'Feeling Lucky' which launches a random game from your collection

    # INSTALL: Point your nes launcher in /etc/emulationstation/es_systems.cfg
    # to this script. (e.g. /home/pi/NES_feeling_lucky.sh %ROM%)

    flag="$HOME/RetroPie/roms/nes/Feeling Lucky.nes"

    if [ ! -e "$flag" ]
    then
    touch "$flag"
    fi

    gamename=`basename "$1"`

    if [ "$gamename" == "Feeling Lucky.nes" ]
    then
    files=($HOME/RetroPie/roms/nes/*)
    exit `/opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ nes "${files[RANDOM % ${#files[@]}]}"`
    else
    exit `/opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ nes "$1"`
    fi