Please do not post a support request without first reading and following the advice in

add Moonlight to RetroPie Front-end

  • Hi.
    I'm new to RetroPie but I've been using Linux for some time. still learning.
    What i'm after is that i use moonlight for streaming content from my computer in the basement to my RPi3. but what I need is a front end that i can just push a button and start moonlight with the settings i approve.
    But so far i haven't found any instructions on how to add custom scripts or add-on to Retropi. Is there anyone who can guide me to my goal.

    Commend used for moonlight
    "moonlight stream -1080 -60fps -forcehw -surround <ip-adress-to-computer>"


  • @halfe add?

  • @halfe
    I'm not sure if I completely understand your question and the subject "add" isn't very descriptive either. If you give your post a better subject, you'll get more views from user that know about that subject. It also helps if you post a link to the walkthrough you followed to get moonlight setup.

    Please read this:

    Anyways, I assume you already have moonlight installed and it's pair with your PC with a supported Nvidia graphics card.

    If you haven't already paired them, then run this from RPi3 command line:
    moonlight pair <IP from gaming PC>

    You'll also need a joystick map file. Run this and follow directions:
    mkdir /opt/retropie/configs/moonlight
    moonlight map /opt/retropie/configs/moonlight/

    If all you're wanting is a Steam menu on EmulationStation than just add this to /etc/emulationstation/es_systems.cfg somewhere:

        <extension>.sh .SH</extension>

    Now you need to make a simple script to connect to moonlight. I should note here that the Raspberry Pi 3 won't do both 1080p and 60fps very well. You have to do either -1080 -30fps or -720 -60fps.

    Make this script /home/pi//RetroPie/roms/moonlight/ (if you don't have that "moonlight" directory then make it first):

    moonlight stream <ip address> -720 -60fps -mapping /opt/retropie/configs/moonlight/

    And another one /home/pi//RetroPie/roms/moonlight/

    moonlight stream <ip address> -1080 -30fps -mapping /opt/retropie/configs/moonlight/

    Now run this from command line to make those 2 scripts exactable:
    chmod +x /home/pi/RetroPie/roms/moonlight/*.sh

    Last restart EmulationStation (or you RPi3)

    If you're having trouble with these scripts connecting correctly try these steps!

    Add "-app Steam" to script like this:
    moonlight stream <ip address> -720 -60fps -mapping /opt/retropie/configs/moonlight/ -app Steam

    Try removing the "fps" from the script like this:
    moonlight stream <ip address> -1080 -mapping /opt/retropie/configs/moonlight/ -app Steam

  • @halfe as backstander stated, you really should edit your title. Not only to help you but to help others who come here looking for an answer to the same problem. Also stating what version of raspberry pi, version of retropie (not just saying latest) helps as well.

  • Sorry for the Topic. PC was a bit weird this morning.

    Moonlight working perfect from CLI with xbox controller and "Keyboard & Mouse.

    Missing to add moonlight to Front-end. but thanks to @backstander i got it.
    (is there a way to start moonlight without going into the menu? just push the Steam icon and you are there. :) (just asking)

    thanks for helping me with mapping controller :)

    I would like to add this to my blog if i can?

  • @halfe

    I would like to add this to my blog if i can?

    That's fine with me :)

    (is there a way to start moonlight without going into the menu? just push the Steam icon and you are there. :) (just asking)

    I can't think of a way to do that. It may not be possible with EmulationStation.

    thanks for helping me with mapping controller :)

    You're welcome

  • @halfe
    A long time ago I found this fancy script for Moonlight but I never actually tried it. I can't remember who or where I got it.

    What it is suppose to do is start your PC and then connect to Steam after it has booted up. The caveat being that you'd need to have Wake-on-LAN (WoL) enabled in your PC's BIOS, your Windows set to auto login to your User Account and Steam to auto login as well.

    Here is the script (and I have tweaked it a little bit from the original version I found):

    Well first you need to install wakeonlan on your RPi.
    sudo apt-get install wakeonlan

    I called it /home/pi/RetroPie/roms/moonlight/

    #Start PC
    wakeonlan <MAC address of PC>
    #Wait until Steam is reachable
    echo ************************
    echo Connecting to the PC …
    echo ************************
    while ! nc -z -w25 <ip address> 47989 &>/dev/null; do :;
        echo "***********"
        echo "Please wait"
        echo "***********"
    #Start moonlight
    echo ********************************
    echo PC available, starting moonlight
    echo ********************************
    moonlight stream <ip address> -720 -60fps -mapping /opt/retropie/configs/moonlight/ -app Steam

    And don't forget to make it exactable:
    chmod +x /home/pi/RetroPie/roms/moonlight/

  • Thanks. :)

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.