Raspberry Pi 2: OpenElec + RetroPie + Steam Streaming


Requirements:

Raspberry Pi 2

8GB or more SD Card with NOOBS

Gaming computer with a Nvidia Graphics Card (GTX 600 or higher required)

Wired network preferred

 

Step 1

Upon first booting the raspberry pi, select OpenElec and Raspbian and install both operating systems (Be sure you are connected to ethernet for install)

noobs

Step 2

Boot into raspbian and make sure your software is up to date by running these commands (This will take a while):

sudo apt-get update
sudo apt-get upgrade
sudo rpi-update sudo reboot
Step 3

Boot into raspbian and download the RetroPie install script by inputting the command:

wget https://github.com/petrockblog/RetroPie-Setup/archive/ver2.1.tar.gz

Then untar it with:

tar xvfz something.tar.gz

Enter the directory where everything was untarred, then run the retropie_setup.sh script. This will take some time.

Step 4

Mount the noobs partition and make a new config, also while we’re making directories, make a new apps folder in the roms directory:

sudo mkdir /mnt
sudo mkdir /mnt/noobs
sudo mkdir ~/RetroPie/roms/apps sudo mount /dev/mmcblk0p3 /mnt/noobs
sudo cp /mnt/noobs/noobs.conf /mnt/noobs/noobsx.conf

Now edit the copy with nano replacing the default_partition_to_boot parameter with 7 Save with ctrl+x then press y

Now create a login script that will launch emulationstation and configure noobs to boot to openelec next boot:

sudo nano login.sh

Enter the code:

#!/bin/bash
echo Setting up next boot...
#below should be mmcblk0p3 if setup properly but your milage may vary
sudo mount /dev/mmcblk0p3 /mnt/noobs
sudo rm /mnt/noobs/noobs.conf
sudo cp /mnt/noobs/noobsx.conf /mnt/noobs/noobs.conf
echo Launching EmulationStation... 
emulationstation

Save the file with ctrl+x then press y

Step 5

Download limelight by entering the commands:

cd ~ 
wget https://github.com/irtimmer/limelight-embedded/releases/download/v1.2.2/libopus.so 
wget https://github.com/irtimmer/limelight-embedded/releases/download/v1.2.2/limelight.jar

Ensure that GeForce experience is installed on your gaming machine and that Nvidia Shield is enabled, then get the IP address for the gaming machine, after that, insert the following command:

java -jar limelight.jar pair 192.168.xxx.xxx #Insert gaming machine's IP​

You will get a pop up on your gaming machine asking for a pairing code, it will show up on your PI’s output after inputting the last command, enter it and accept.

Edit your emulationstation’s systems config:

sudo nano /etc/emulationstation/es_systems.cfg

At the end, insert a new system with the following XML:

<system>
  <name>apps</name>   
  <fullname>Applications</fullname>   
  <path>~/RetroPie/roms/apps</path>   
  <extension>.sh</extension>   
  <command>bash %ROM%</command>   
</system>

Save using ctrl+x then press y

Then enter the following code:

cd ~/RetroPie/roms/apps
sudo nano stream.sh

Enter the following, then save the file:

java -jar ~/limelight.jar stream –app Steam -1080 -30fps 192.168.xxx.xxx #Insert gaming machine's IP

Now when you select the new option in emulationstation, it will launch steam on your computer in big picture mode, and it will stream the video content to your pi’s output, your pi will stream all controller input to your computer.

Next we need to configure OpenElec to automatically reboot to the raspbian partition each reboot.

Boot into OpenElec and during configuration enable ssh. Login to ssh using PuTTY or your client of choice, the credentials are root:openelec

Enter the following commands to prepare for creating the login script:

mkdir /storage/mnt 
mkdir /storage/mnt/noobs 
mount /dev/mmcblk0p3 /storage/mnt/noobs 
cp /storage/mnt/noobs/noobs.cfg /storage/mnt/noobs/noobsr.cfg 
nano /storage/mnt/noobs/noobsr.cfg

 

In the editor find the default_partition_to_boot and change the parameter to 5 save with ctrl+x and press y

Now we will create/edit the autostart.sh file for OpenElec:

nano /storage/.config/autostart.sh

Enter:

mount /dev/mmcblk0p3 /storage/mnt/noobs 
rm /storage/mnt/noobs/noobs.cfg 
cp /storage/mnt/noobs/noobsr.cfg /storage/mnt/noobs/noobs.cfg

Save the file with ctrl+x then press y

Now the configuration is complete, test it with a couple of reboots, it should automatically select the opposite operating system each boot.