• Roelof Pieter's feed

    I started using Movim with this account. <3 it! I strongly believe one should be able to self-host. But coulnd't get that to work yet |-(

  • Me making a concrete Raspberry Pi mediacenter

    Roelof Pieter – Saturday, 18 November - 08:47

A public bookmark #howto #raspberrypi #bookmark

  • Me making a concrete Raspberry Pi mediacenter

    (Pssst, there is an update at the end of this page!) (Pssst 2, I got pisnes running from kodi on OSMC. Theck it out here!) The idea Since two years I have Raspberry Pi running as a media-server, sm…

  • Glow lights festival Eindhoven

    Roelof Pieter – Saturday, 18 November - 00:55 - Saturday, 18 November - 01:00

A projection on the Catharina church. #eindhoven #festival #uit

  • 1 Comments

  • 18 November Timothée Jaussoin


  • Running Super Nintendo (SNES) games on my OSMC equipped Raspberry Pi media center.

    Roelof Pieter – Thursday, 16 November - 20:12 - Friday, 24 November - 20:34

#howto #osmc #snes #games #raspberrypi

Edit: Updated with script to create backup of the save file

I have a Raspberry Pi 2 mediacenter running OSMC. I have spent quite some time in getting the SNES emulator Pisnes to work on it. An "easy" solution to this would be to install Retrosmc. But this installs so much more than needed. When I tried this installing took a few hours on my Raspberry Pi 2. It also makes the whole install much more complex with installing: Retropie, Emulationstation, lots of emulators etc... . Overkill for me. But getting just Pisnes to run wasn't easy (for me). I tried a lot of different combinations of settings but ran in trouble all the time. Pisnes wouldn't start or there was no sound or the buttons of my game controller didn't react (the control-sticks and the d-pad did though. Huh?!). Installing Retrosmc did learn me that it could work. So with new hope I started again and finally got it running.

In the end I managed to get it to work. For this I used some scripts supplied by retrosmc and molded them for my needs. Finally I am able now to start my media center, browse to the game in question and fire it up. It basically works as follows:

  1. I use Advanced Emulator Launcher to start the game. Advanced Emulator Launcher calls the first script.
  2. The first script (pisnes.1.sh) is begins with stopping several services. At least the mediacenter (Kodi) service. And in my case also some services for the web server I am running. This frees up CPU cycles, needed for the emulator.
  3. Then it calls another script (pisnes.watchdog.sh) that keeps checking in the background whether Pisnes ('snes9x' process) is still running. When not (so when I stopped playing) it will start those services again.
  4. After starting the watchdog script it will then launch pisnes in an openvt session. This helps against problems with sound and the controller I believe.
  5. The actual start of pisnes is done through another script: pisnes.2.sh. Combining the first and the second scripts have been fruitless for me, so I'll just keep it this way. This second script starts Pisnes with the requested ROM file, so I can play the game. It also redirects ALSA sound from the 3,5mm-jack output to HDMI output.

I normally use the 3,5mm-jack output to listen to internet radio (Studio Brussel) on my connected stereo through MPD. This can also be done in Kodi alone, but now I don't have to start the TV only to listen to some radio. Just fire up the app on my phone or laptop.

pisnes.1.sh :

This is the script that is first called from Advanced emulator launcher. I am not really sure what everything does exactly or why, but hey: It works. In this and the following scripts I mainly searched and replaced "emulationstation" for "pisnes" in the original scripts. And I cleaned up stuff that didn't seem relevant.

#!/bin/bash
# This scripts starts the pisnes watchdog deamon and
# pisnes itself while stopping KODI mediacenter and some
# other "heavy" services afterwards.
# Script by mcobit, edited by roelofpieter

# clear the virtaul terminal 7 screen
sudo openvt -c 7 -s -f clear

# start the watchdog script
sudo su osmc -c "sh /opt/pisnes/pisnes.watchdog.sh &" &

# start pisnes on virtual terminal 7 and detach it
sudo su osmc -c "nohup openvt -c 7 -f -s /opt/pisnes/pisnes.2.sh $1 >/dev/null 2>&1"

# clear the screen again
sudo openvt -c 7 -s -f clear

# wait a bit to make sure pisnes is running detached from kodi
sleep 0.5

# stop kodi and other "heavy" services to free cpu and input
# devices for pisnes. And mpd because of the sound output
sudo su -c "systemctl stop mediacenter &" &
sudo su -c "systemctl stop nginx &" &
sudo su -c "systemctl stop php5-fpm &" &
sudo su -c "systemctl stop mysql &" &
sudo su -c "systemctl stop mpd &" &

exit

pisnes.watchdog.sh :

This script keeps running in the background and will restart Kodi (and other services in my case) when pisnes is stopped.

#!/bin/bash

# Script by mcobit, edited by roelofpieter

# give pisnes time to start up
sleep 8

# check for pisnes (snes9x) running
while [ true ]; do
    VAR1="$(pgrep snes9x)"

# if pisnes (snes9x) is quit, clear the screen of virtual terminal 7 and show a message
    if [ ! "$VAR1" ]; then
        sudo openvt -c 7 -s -f clear

# restart kodi and other "heavy" services. And mpd...
    sudo su -c "sudo systemctl restart mediacenter &" &
    sudo su -c "sudo systemctl restart mpd &" &
    sudo su -c "sudo systemctl restart mysql &" &
    sudo su -c "sudo systemctl restart php5-fpm &" &
    sudo su -c "sudo systemctl restart nginx &" &

# exit script
    exit
else

# if pisnes is still running, wait 2 seconds and check again (could probably be longer, but doesn't seem to impact performance by much)
    sleep 2

fi
done
exit

pisnes.2.sh :

And this script will start the actual game. Additionally it will create a backup of the save file. Should I accidentally overwrite it (with a single button press, namely the right "shoulder" button) I always have a copy of the file.

#!/bin/sh

# Redirect the sound to the television
amixer cset numid=3 2

# Make a backup copy of the save file. Pisnes runs as root, hence the savefile location.
fullromfile=$(basename "$1")
romfile="${fullromfile%.*}"
sudo cp /root/.snes96_snapshots/$romfile.000  /root/.snes96_snapshots/$romfile.000.$(date  %Y%m%d%H%M%S)


# Start the actual game
sudo /opt/pisnes/snes9x $1

# Redirect the sound back to external output
amixer cset numid=3 1

Advanced emulator launcher

I didn't find the Advanced emulator launcher very intuitive at first. This is how I set it up the basics. First I created a new launcher of the type "ROM launcher (Emulator). Since I installed pisnes and it's roms in /opt/pisnes the launcher application is /opt/pisnes/pisnes.1.sh on the SD card. The roms path is (for me) /opt/pisnes/roms/. The file extension is "smc". I could tell this by looking at the rom files ;-) . Application argument is the default "$ROM$", but I have no idea if this matters. I gave it a name and for platform I obviously choose Nintendo SNES. The scraped artwork goes into /opt/pisnes/roms/artwork. Then I added ROMs by choosing " Add ROMs > Scan for new ROMs". From there on I could select a ROM and launch it.

Phew. And now: Zelda!

Zelda

  • 1 Comments

  • 17 November preptorrent


  • Investors party Davo brewery Deventer

    Roelof Pieter – Tuesday, 14 November - 22:42 - Monday, 27 November - 22:43

A night out at Davo. With a token of gratitude for the crowdfunders. Limited edition baby :-) Cheers! #food #out

  • Roelof Pieter – Saturday, 7 October - 23:32

    Bartolomea restaurant, Sevilla

  • 1 Comments

  • 7 October Timothée Jaussoin


  • Bartolomea restaurant, Sevilla

    Roelof Pieter – Saturday, 7 October - 23:31

Great, absolutely great evening in Bartolomea tapas restaurant #Sevilla. Friendy, welcoming staff. Great food at very reasonable prices (for nothern European standards at least...). Great, great, great!

  • Bartolomea

    Updated August 2017 Almost exactly five years after opening the very popular La Brunilda, husband and wife team Diego & Esperanza opened this second restaurant with a completely new menu, just …

  • 1 Comments

  • 7 October Timothée Jaussoin


  • Refreshing in Spain...

    Roelof Pieter – Saturday, 7 October - 17:53 - Saturday, 7 October - 23:21

Immensly enjoyed this fountain in #Sevilla, #Spain, where a mild wind created a fine spray for me to cool down. And it is not nearly the hottest time of year!

  • 1 Comments

  • 7 October Timothée Jaussoin


  • Roelof Pieter – Friday, 6 October - 23:22 - Friday, 6 October - 23:24

    Patio de los Naranjos, Mezquita Catedral, #Cordoba, #Spain #hdr

  • 1 Comments

  • 7 October Timothée Jaussoin