Step 1 - Install & Configure ZSNES
1.1 Switch to XBMCbuntu desktop GUI
OK lets get started. First things first, we need to get to the desktop interface included with XBMCbuntu. Fire up your XBMCbuntu machine and then quit XBMC by going to the shutdown menu and then selecting "Exit". This will take you back to the XBMCbuntu login screen. From the drop-down menu at the bottom of the login screen you will see three options: OpenBox, XBMC and XBMCbuntu. Loging into XBMC will take you straight back to the XBMC program. This is obvioulsy counter-productive so lets choose XBMCbuntu and then enter your password (the one you picked when installing XBMCbuntu) and then click "Login".
1.2 Create a folder in your home directory for your ROMs and artwork
Opening the File Manager app from wihin the Applications menu in your "start menu" in the bottom left corner will take you to your home folder by default. Lets create a new folder (right-click > create new > folder) and call it "ROMs". Inside this folder we'll create another folder called "SNES" and inside the SNES folder we'll create a final folder called "ART". Now would be a great time to plug in a usb drive and
copy your roms to the SNES folder so lets do that as well. For now, we'll leave the ART folder empty.
1.3 Update & Install ZSNES from terminal
First off, fire up "XTerm" from the System Tools menu in your start menu. Enter the following into the terminal emulator, one line at a time.
Code:
sudo apt-get update
sudo apt-get install zsnes
You will need to enter your password for this and also you may need to press "Y" to confirm the installation of zsnes.
1.4 Configure ZSNES control and graphics options
Now that ZSNES is installed, we can close terminal and run ZSNES from the new Games menu in your start menu. Select Config > Input to open the controller options. The quickest way to set this up is to select "Keyboard/Gamepad" from the Device list and then hit the "Set Keys" button on the right. One by one ZSNES will ask you to press each button on your game controller. If you have additional game controllers, you can go ahead and set these up the same way using the numbered tabs across the top of the window.
Next hop over to Config > Video. Scroll to the bottom of the list of display modes and select "Custom". You will also need to enter your display resolution for fullscreen on the right. Mine is a standard 1920x1080. Make sure to hit the "Set" button above where you have typed the resolution. Flip over to the "Filters" tab and you can see there are various filters and options to try and make your SNES games look a little smoother on large screens. This is really a personal preference thing but I have found that setting the HQ Filter x2 and the High-Res Mode 7 together yields nice results for me.
I'm not going to touch on the rest of the settings as they aren't really relevant to this guide so feel free to explore them yourself. However I would recommend doing any major changes now, as we will be disabling the ZSNES gui once we get back into XBMC. Now would also be a great time to
test your install by loading one of your roms from the File > Load menu.
NOTE: If you have no sound when testing,
STOP! Scroll down to the bottom of this guide and read the "
What if I have no sound?" section now.
1.5 Switch back to XBMC
Log out of XBMCbuntu by selecing Logout > Logout from the start menu. Be sure to select "XBMC" from the drop down again before pressing login!
Step 2 - Installing & Configuring Advanced Launcher
2.1 Install Advanced Launcher from the add-on repository.
Once back inside XBMC, go to "System" and then "Settings" from the main menu. You will need to go to the Addons section. From there: Get Addons > XBMC.org Addons > Program Addons > Advanced Launcher.
Select "Install" from the addon info and then return to the main menu.
2.2 Configure Advanced Launcher
From the main menu, select "Programs" then open the context menu for Advanced Launcher and select "
Addon settings". (How you do this will be system specific but by default, try the "Guide" or "List" key on your MCE remote or use the "C" key on your keyboard).
Change the "Scan settings" on the Data & Infos, Thumbs and Fanarts tabs to all be:
Collecting Method: Scrapers and
Import Mode: Semi-automatic. Press OK to return to the Programs list.
2.3 Create a new File Launcher in Advanced Launcher
Selecting Advanced Launcher will give you the option of creating a "Standalone" or "File Launcher" type. We want "
File Launcher".
You will then need to browse to the ZSNES install:
Root Filesystem / usr / bin / zsnes
and the ROM files path:
Home Folder / ROMs / SNES
The next two options will be already filled out for you and the default options will be fine for most users:
File types:
Application Arguments:
Select a name for your new launcher. I chose "SNES". Finally, you are asked to "Select The Platform". Be sure select "
Super Nintendo Entertainment System" from near the bottom of the list. Next, you will be asked where you would like to store the thumbnails and fanart for your games. Browse to the ART folder inside the ROMs > SNES folders that we created in your home directory earlier.
2.3 Scan your ROMs from the context menu of the new launcher
Highlight your newly created launcher and open its context menu. Select "Add Items" and "Scan For New Items". One by one, you will need to confirm the title, and select fanarts for each ROM. This may be tedious for large collections but it ensures accuracy, especially where rare games or games from other regions are concerned.
Deep breath! Pat yourself on the back, the bulk of the work is done. Feel free to go ahead and test out your new launcher. Just remember to have the USB keyboard plugged in as you will need to use the "ESC" key to quit ZSNES and return to XBMC. Next up, programing that quit action to a spare button on your remote!
Step 3 - Killing ZSNES & returning to XBMC from a button on your remote
OK, very quickly, a word of warning. This stage of the guide gets a little more technical than the previous steps. Leave your fear of the terminal at the door. In a nutshell, we are going to install a daemon called irxevent which will watch the input from your remote waiting for you to press the kill button. When you do, it will execute a script to kill ZSNES and return you to XBMC. We will need to write scripts to: start irxevent, tell it what to look for, and to kill ZSNES. But dont freak out, I'll try to keep this as simple as possible.
NOTE: All of the scripts in this step have been written assuming your username is "xbmc". If its not, be sure to look out for where I have said you need to change them and be sure to do so! OK, Here we go...
3.1 Install lirc-x (irxevent)
Follow steps 1.1 & 1.2 again to get back to the XBMCbuntu desktop. We are going to fire up XTerm again and I would strongly recomend opening this guide in Chromium (Start Menu > Internet) so that you can copy and paste directly into XTerm. Use "middle-click" or "Shift+Insert" to paste into Xterm.
Install lirc-x:
Code:
sudo apt-get install lirc-x
3.2 Create shutdown.sh script
Now we will need to create the script to kill ZSNES. We are going to start by making sure that we are in our home folder:
This next command will open a very basic text editor within the terminal. We will be using nano to write a few scripts now. It's a bit fidly, but just remember to use your arrow keys to navigate around and dont press anything unecessarily!
Copy this script into nano:
Code:
#!/bin/bash
killall zsnes
Then exit by pressing "CTRL+X", pressing "Y" to save and pretting "Enter" to confirm the filename shutdown.sh. OK one down, four to go.
3.2 Create restartIR.sh script
Next, create a script to start irxevent:
Copy this script into nano.
BUT WAIT theres a catch! If your username is anything other than "xbmc", you will need to make a few quick modifications. You will need to change all mentions of "xbmc" in this script to match your username or it wont work. There are four in total (not including the first .xbmc mention in line 2 which doesn't matter).
Code:
#!/bin/bash
#filename /home/username/.xbmc/userdata/scripts/restartIR.sh
# Test to see if irxevent is running first, if so kill it, then restart
if ps -ef|grep -v grep|grep -i irxevent
then
ps aux|grep -i xbmc|grep -i irxevent |awk '{print $2}'|xargs kill
else
# Do nothing
echo "irxevent already dead!"
fi
# Test to see if irexec is running first, if so kill it, then restart
if ps -ef|grep -v grep|grep -vi start|grep -i irexec
then
ps aux|grep -i xbmc|grep -i irexec |grep -vi start|awk '{print $2}'|xargs kill
else
# Do nothing
echo "irexec already dead!"
fi
#test to see if an instance of irxevent is already running
if ps -ef|grep -v grep|grep irxevent
then
# do nothing
echo "irxevent already running"
else
# start irxevent
irxevent /home/xbmc/.lircrc &
fi
#test to see if an instance of irexec is already running
if ps -ef|grep -v grep|grep irexec
then
# do nothing
echo "irexec already running"
else
# start irexec
irexec -d /home/xbmc/.lircrc &
fi
exit
NOTE TO MOD: If there is a way to highlight text within a code box, please let me know and I'll fix this to be easier to read/understand.
Again, exit by using "CTRL+X", pressing "Y" to save and pretting "Enter" to confirm the filename restartIR.sh.
Next, we want to make sure that our scripts are executable:
Finally, we need to make sure our scripts can run without needing a password.
Scroll to the bottom of the file using your arrow keys and add the following lines to the very bottom of the file. Again, you will need to change the "xbmc" part of these lines to your username beforehand (four entries in total):
Code:
xbmc ALL=(ALL) NOPASSWD:/home/xbmc/shutdown.sh
xbmc ALL=(ALL) NOPASSWD:/home/xbmc/restartIR.sh
Save and quit as usual.
3.3 Create .lircrc so that irxevent knows what to watch for
We're going to create a little file so that irxevent knows what button to watch out for and then what to do when it sees it. First we need to work out the correct "code" for the button that you want to use.
First enter into Xterm:
The cursor will drop down and wait for input. Point your MCE remote at the receiver and press the button you would like to use to close ZSNES. Its a good idea to try and pick something that XBMC doesnt already use. In my case, I decided to use the "Clear" button. You should get an ouput like this:
Code:
000000037ff07bf5 00 KEY_CLEAR mceusb
000000037ff07bf5 01 KEY_CLEAR mceusb
What we are interested in is the part right before the "mceusb" at the end. In my case "KEY_CLEAR" Write this down somewhere and move on to the next step. You can press "CTRL+C" to stop irw and return to prompt.
Next:
You want to enter this into nano, substituting my "KEY_CLEAR" for whatever code you wrote down in the last step. Be careful: it's CaSe SeNsItIvE! You will also need to change the "xbmc" in the config line to your username.
Code:
begin
prog = irexec
button = KEY_CLEAR
config = /home/xbmc/shutdown.sh &
end
Save and quit. We can now test our button action. This will start irxevent and then start zsnes:
Code:
bash restartIR.sh
zsnes
If everything is right, pressing your "kill" button on the remote should close zsnes immediatly and return you to desktop. If not, return to the start of this section and double check to make sure you haven't made any typos.
3.4 Start irxevent on boot
Great! We've made it this far, and we're almost done. Last thing to do is to make sure that irxevent starts on bootup. Obviously we dont want to do these steps everytime we start the system. Fortunatly theres a very easy way to do this. First lets open the rc.local file. Think of this as your startup file.
Code:
sudo nano /etc/rc.local
Now we want to add this line to the rc.local file, right above the "exit 0" line:
Code:
sudo -u root irexec -d /home/xbmc/.lircrc &
Save and quit and thats it! We need to reboot, but first, log out from the start menu and log back in to XBMC and selecting "Reboot" from the XBMC Shutdown menu. This ensures that when the system reboots its loads directly back into XBMC not the XBMCbuntu desktop. Run ZSNES from the Programs > Advanced launcher section and try out your new "kill" button!
Congratulations! If you have any dramas or questions, be sure to post a comment and I'll do my best to help out.
Other Issues I Encountered
What if I have no sound in ZSNES?
Sound seems to be the biggest problem people have when troubleshooting ZSNES and XBMC in general. There are a million threads and millions more comments suggesting all sorts of craziness and its very easy to get confused and overwhelmed. I'm going to post my experience with this and how I sorted it. Keep in mind that these instructions are specific to MY system. They may not work verbatim for you and you may have to experiment a bit yourself. But, this should at least point you in the right direction.
The first time I tried installing ZSNES using the method I have described, I had perfect sound in XMBC but no sound at all in ZSNES. My system is a Zotac nVidia ION based board using the nVidia HDMI for audio. My HDMI is connected directly to my TV. This seems to be a very common setup around the XBMC forums and if this sounds like you, this should solve your problems.
First and foremost, lets get the dumb stuff out of the way. Assuming you popped down here to read this in the correct part of the guide, you will already be at the XBMCbuntu desktop. If not, Exit XBMC and login to XBMCbuntu now. Open up XTerm and follow along:
First, lets make sure that all your volumes are unmuted and turned up:
This opens a basic volume mixer within terminal. First, check the top right hand corner to make sure the correct audio card is selected. In my case: "HDA Nvidia". If not, press "F6" and choose the correct card from the menu. Then press "F5". This shows ALL the channels in the one view. Now, use your left and right arrow keys to move around and use the "M" key to mute/unmute. Blue "MM" is mute, Green infinity symbol is unmute. Make sure everythng its unmuted. If so, move on. If not, unmute, press ESC to exit and try ZSNES again.
Still no sound? Next lets try running ZSNES with a different audio driver. From the terminal type:
This will change ZSNES config to use the default alsa drivers built into XBMCbuntu. This change is permanant until changed again, so you do not need to enter the "-ad alsa" switch everytime you run ZSNES in the future. If this makes no difference, try this one:
If this fixes your problem, great. Leave everything as is and return the the next step of the guide above. If not, as was my case, we are going to have get get a little more technical. We are going to use a custom .asoundrc file to try and sort out our audio once and for all. There's a lot of conflicting information on the forums regarding these files and if they are necessary. I can only speak for myself in saying that, while XBMC worked beautifully sans-asoundrc, nothing would get ZSNES working until I configured this properly. So here we go.
First, in terminal:
You should get something like this back:
Code:
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 1: ALC662 rev1 Digital [ALC662 rev1 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
What we are interested in the the "card" and "device" numbers for the correct audio output. In my case: 0 and 3 because I am using the nVidia HDMI. Write these down somewhere. Next we are going to create our new .asoundrc file. Now by default, XBMCbuntu has a generic .asoundrc in your home directory. We're going to make a backup copy of this (just in case) and then remove it and replace it with our own.
First, lets make sure we are in our home directory:
Now make a copy of the existing file and rename it as .asoundrc1:
Code:
cp .asoundrc .asoundrc1
Remove .asoundrc:
And open a new, blank one in nano:
Next, we're going to copy the new code below into our blank file, BUT FIRST check line 7 (pcm "hw:0,3) and adjust the 0,3 part with the numbers we wrote down earlier.
Code:
pcm.dmixer {
type dmix
ipc_key 1024
ipc_key_add_uid false
ipc_perm 0660
slave {
pcm "hw:0,3"
rate 48000
channels 2
format S32_LE
period_time 0
period_size 1024
buffer_time 0
buffer_size 4096
}
}
pcm.!default {
type plug
slave.pcm "dmixer"
}
OK, now exit using "CTRL+X", save by pressing "Y" and confirm the new filename with "Enter".
We want to reboot now so that our changes can take effect so:
By default, the sytem will reboot directly to the XBMCbuntu desktop. Now, try ZSNES again. You may need to run it from XTerm with the "-ad sdl" switch the first time.
If all goes well, you now have sound! *FISTPUMP* OK, but before we get too carried away, our changes to .asoundrc may have messed up our audio in XBMC so we need to quickly check that out. Logout using the start menu and log back into XBMC. Head over to the System > Settings > System > Audio Output page and make sure your Audio Output is still set to "HDMI" and change both your Audio Output Device and your Passthrough Output Device to "Custom" and manually enter "plughw:0,3" for both. (Substitute your numbers if theyre not 0,3). As my HDMI cable runs directly to my TV, I have also set Speaker Configuration to 2.0 and disabled Dolby and DTS.
Hopefully this fixes audio for you. Remember, this is system specific and may not work exactly for you. If you have any dramas, post in the comments and I'll try and help.
If you stuff it up and need to revert back to the original .asoundrc file, try this:
Code:
cd ~
rm .asoundrc
cp .asoundrc1 .asoundrc
What if I get a seemingly random black-screen while playing my ROMs?
Haha this is a doozy. Took me three re-formats and more hours than I care to admit to get it and when I found out, my god did I facepalm. OK, so you're twenty mins in, gleefully huming along to the theme music from A Link The The Past when it happens. Black screen. No input. No sound. Nothing. Before you curse the gods and the day you ever followed a guide from TehCrucible, try this out.
Turns out, its X (the underlying "windows" framework) going to sleep. Yep. Thats it. Go ahead, plug in a USB keyboard and press a key. Oh, look we're back. ... *facepalm*
Fixing this is relatively simple. First login to XBMCbuntu and fire up XTerm. Then:
Code:
sudo nano /etc/X11/xorg.conf
Next scroll to the very bottom of the file and add this code:
Code:
Section "ServerFlags"
Option "BlankTime" "0"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"
EndSection
Save and quit with: CTRL+X then Y and ENTER
Thats it, problem solved. Happy gaming and a thousand thank you's to douglasdouglasj here on the XBMC forums!