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

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>"

    Regards
    Halfe



  • @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:
    https://retropie.org.uk/forum/topic/3/read-this-first

    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/gamepad.map

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

      <system>
        <name>Steam</name>
        <fullname>Steam</fullname>
        <path>~/RetroPie/roms/moonlight</path>
        <extension>.sh .SH</extension>
        <command>%ROM%</command>
        <platform>steam</platform>
        <theme>steam</theme>
      </system>
    

    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/720p60fps.sh (if you don't have that "moonlight" directory then make it first):

    #!/bin/bash
    moonlight stream <ip address> -720 -60fps -mapping /opt/retropie/configs/moonlight/gamepad.map
    

    And another one /home/pi//RetroPie/roms/moonlight/1080p30fps.sh

    #!/bin/bash
    moonlight stream <ip address> -1080 -30fps -mapping /opt/retropie/configs/moonlight/gamepad.map
    

    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)

    Troubleshooting
    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/gamepad.map -app Steam

    Try removing the "fps" from the script like this:
    moonlight stream <ip address> -1080 -mapping /opt/retropie/configs/moonlight/gamepad.map -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/Autostart.sh

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

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



  • Thanks. :)


Log in to reply
 

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.