Introduction & Disclaimer
After years of lurking and leeching on these forums I thought it was about time to give something back. I relize there are similar guides available on these forums but most are either outdated or incomplete. What I will attempt to do here is document my own experience in a very n00b friendly step-by-step guide so that others may follow. Advanced XBMC users may find this a little tedious so stick to the bold text to get concise instructions. Please keep in mind that I am not a nix expert. Everything included in this guide has been cobbled together from various forums, blogs and comments across the greater internet and I will do my best to credit everyone at the end of this post. Also if I have made a mistake, please feel free to correct me in the comments. But enough of this, grab a caffeinated beverage (your going to need it) and lets begin...

Contents
What this guide WILL cover:

Installation and configuration of ZSNES

Installation and configuration of Advanced Launcher plugin

Creation of a script to kill ZSNES and return to XBMC using a button on your remote

What this guide WILL NOT cover:

Installation and configuration of XBMCbuntu

Where/How to download ROMs etc

The meaning of life, how to cure cancer and why your wife wont do "that"...

I will also point out common pitfalls and mistakes that I have made along the way in the hope that this will be as painfree as possible.

Assumptions
While I'm writing this for everyone, for the sake of simplicity I'm going to make a few assumptions. Your situation may be different and feel free to post in the comments if something doesn't add up, I'll do my best to help. So, to follow this guide to the letter you will need the following:

A fresh, working install of XBMCbuntu 11 Eden
While a fresh install is not strictly necessary, this is how I did it.

USB Gamepad/Controller
I'm using a basic Logitech Precision controller. Pretty much any generic USB controller will work out of the box, if you want to use XBox360 controllers etc, it can be done but is outside the scope of this guide. We're going to assume that whatever you have is detected by XBMCbuntu and is working. You will also need to plug this in before starting up the system.

Media Centre Remote
Again, while not strictly necessary, this guide will cover setting up a button on your remote to quit ZSNES to make everything as "wife-friendly" as possible so we're going to assume that you have one and it works with XBMC out of the box. For reference: I'm using a cheap generic RC-6 compatible media centre remote.

Internet Connection
Might be stating the obvious, but you will need this connected to follow this guide.

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:

Code:

zip|smc|sfc

Application Arguments:

Code:

-m -s -v 22 %rom%

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:

Code:

cd ~

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!

Code:

nano shutdown.sh

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:

Code:

nano restartIR.sh

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).

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:

Code:

chmod +x *.sh

Finally, we need to make sure our scripts can run without needing a password.

Code:

sudo visudo

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):

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:

Code:

irw

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:

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:

Code:

nano .lircrc

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.

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:

Code:

alsamixer

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:

Code:

zsnes -ad alsa

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:

Code:

zsnes -ad sdl

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.

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:

Code:

cd ~

Now make a copy of the existing file and rename it as .asoundrc1:

Code:

cp .asoundrc .asoundrc1

Remove .asoundrc:

Code:

rm .asoundrc

And open a new, blank one in nano:

Code:

nano .asoundrc

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.

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:

Code:

sudo reboot

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.

Code:

zsnes -ad sdl

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.

Awesome tutorial; haven't tried it yet but i'll definitely post back my experience following it. Since installing Eden, I'd been hesitant to re-figure-out how to get ROMs going - I'd almost given up on the idea. Anyway, thanks again.

(2012-04-19 15:38)bigdog66 Wrote: Great Stuff....now I just need to acquire a gamepad and put this to use.....Thanks!

For what it's worth the Xbox 360 wireless controller (with USB dongle) is on sale on newegg for $38 dollars today with a promo code EMCNFJA38 . Just happened to see it in my mailbox today:

No worries guys. I'd definatly appreciate some feeback when you try it. I'll also update/write new guides when I get a chance to do a few other emulators as well. I'm hoping to get Sega Genesis up and running next (as thats the console that I have the fondest memories of). Sonic at 42".... awwww yeah!

Also, keep in mind that using the Xbox 360 controller may add another layer of complexity to the setup. From what I can tell native support for both wired and wireless 360 controllers is now built into the linux kernel through the "xpad" module. I'm not sure wether XBMCbuntu ships with this module though, you may have to add it manually. This article may help: https://help.ubuntu.com/community/Xbox360Controller

Great work with the tutorial. I will attempt your method to fix my no sound issue. We have almost the same (ion2) setup so I'm hoping it works out for me too.

EDIT:

Wow, I finally got it working. I did get ZSNES with sound working before but on XBMC 10.0 Dharma but since the upgrade I could not for the life of me figure out how to get it to work with Eden. Well thanks to your guide, that little sound driver argument you add when launching ZSNES solved my problem.

Along with the .asoundrc in place, I simply added -ad sdl to the arguments line in Advanced Launcher. Now my sound works flawlessly.

Here's what it looks like now:

Code:

-m -s -v 22 -ad sdl "%rom%"

Again thank you. I've wasted so much time trying to figure this thing out. I had all my other emulators working properly except for ZSNES.

Thanks to you I was able to play Donkey Kong Country on my 42" HDTV (I beat it in just under 3 hours, I'm a bit rusty.) Also, fyi, I have one of those usb snes controllers (possibly the exact one you linked to) and it works perfectly with my xbmcbuntu setup, just plug it in and go. As soon as I get some free time I'm gonna try to get other emulators all set up. I tried to find the terminal commands to install other emulators but I eventually had to install the Ubuntu Software Center to be able to install them. So far I've found FCEUX, visualboyadvance, mupen64plus, and PCSX in the software center, and I found the command to install Dolphin but I doubt my htpc is powerful enough to play wii/gc games. I also downloaded DOSbox, you think it would be possible to play some old DOS games with advanced launcher? Anyway, like I said, as soon as I have some free time I'm gonna try to get all those working. If I get any of these working before you I'll let you know how it went.

Also, what exactly do all these arguments mean?

Code:

-m -s -v 22 %rom%

I just thought of another question, do you know if it would be possible to get Duck Hunt to work with a usb gun? I've always wondered if it would be possible to play a game like Duck Hunt, or any on-rails shooter, like Area 51, with an emulator.

Ok thanks, I'll give that a try. Anyone know if it's possible to play a Windows game with Wine in XBMC? I have Warcraft 2 Battle.net edition (non-DOS) that I'd like to play, but I'm wondering if I could install that or if I'd have to use the DOS version of WC2.

(2012-04-21 20:03)zafiros bonitos Wrote: Also, what exactly do all these arguments mean?

Code:

-m -s -v 22 %rom%

-m Tells zsnes to run without access to the GUI
-s Enables sound
-v 22 Tells zsnes to use the "custom" video mode which we setup towards the start of the tutorial
And the %rom% string gets substituted for the file name of the rom you want to play so that zsnes knows which game to load depending on what you selected in Advanced Launcher.

(2012-04-22 05:17)zafiros bonitos Wrote: Ok thanks, I'll give that a try. Anyone know if it's possible to play a Windows game with Wine in XBMC?

No idea. Although if you're using the XBMCbuntu version (as opposed to running XBMC in a native Ubuntu install), I would hazard a guess that you would need to install and configure a significant number of additional packages. Its not something that I'll personally be trying anyway.

(2012-04-22 05:17)zafiros bonitos Wrote: Ok thanks, I'll give that a try. Anyone know if it's possible to play a Windows game with Wine in XBMC? I have Warcraft 2 Battle.net edition (non-DOS) that I'd like to play, but I'm wondering if I could install that or if I'd have to use the DOS version of WC2.

could not for the life of me figure it out. i knew what it was (standby) build couldnt turn it off tryed MANY many things posted on google.

Also just so everyone knows, i bet lots here have old 36s with RRoD... well take the RF controller board off the front wire a usb cable to the pins where the plug on the board is (to plug into main mobo) (there is a diagram online sonewhere for the soldering my friend told me about this and did it for me) and BINGO bango! you now can use ANY xbox 360 wireless controller with xbmcbuntu OUT OF The box it already works with lirc!

this is what i use, one board connected via usb hidden behind pc, 4 360 controllers at my grasp. now i just need to figure out how to use the board in the 360 while also have it wired to the pc so i just flip a switch to use controls for 360 or htpc

Actually, it is best to simply turn those options off before starting ZSNES and then turn them back on when you leave. That way your PC can still suspend and you don't have to muck with xorg.conf.

Make the script:

Code:

$ vi launchZSNES.sh

Insert:

Code:

#!/bin/bash

# turn off screensaver/screenblank
xset s off

# turn off dpms
xset -dpms

# run ZSNES
/usr/bin/zsnes -m -s -v 22 "$1"

# turn on dpms
xset +dpms

# turn on screensaver/screenblank
xset s on

Make the script executable:

Code:

$ chmod +x launchZSNES.sh

In Advanced Launcher, change the program to "launchZSNES.sh" and change the arguments to "%rom%" (including quotes).

Also, if you are using a MCE Remote, the "Clear" key (equivalent to ESC) will exit ZSNES if you supply the -m option. If you have the GUI on, it will bring up the GUI and you can exit from there with the arrow buttons and select.

(2012-05-04 10:09)Plaguester Wrote: Actually, it is best to simply turn those options off before starting ZSNES and then turn them back on when you leave. That way your PC can still suspend and you don't have to muck with xorg.conf.

Good point. I hadnt considered the ramifications of disabling sleep entirely. I'll test this and if it works, update the guide.

Regarding the "Clear" key on the MCE Remote though, this didnt work for me. As far as I can tell, this was because the LIRC keymap file is actually used by XBMC and not globally so while pressing Clear on the remote was certainly pressing ESC in XBMC in the background, ZSNES was not registering the input at all. (You could go down the route of customizing lirc itself to send keyboard commands for everything but thats a whole other tutorial lol. I did try this but ended up in a world of hurt and although I eventually got it semi-working, I couldnt avoid the known "jumping" issue within xbmc menus, hence why I went the route of a kill script and irxevent.)