After having another attempt at a SNES (Super Nintendo Entertainment System) emulator setup, I decided to locate a game controller to make the effort worth it. A few searches of Static Ice and Shop Bot helped me find my AUD$9 Foxconn controller at Computer Alliance. I also decided to buy an S-VIDEO cable to give Linux TV-Out another go as well after failing to get anywhere with my older Toshiba laptop over the last few years. Newer laptop (HP Pavillion dv5129tx) and a newer OS (Ubuntu Gutsy Gibbon) might work out for me..
Side note: If your laptop has a 7-pin S-VIDEO port it will support a 4-pin cable, the 7-pin carries extra component signals
When I got home, I smelt the “new car” smell of the controller, plugged it in and ran a
Here’s what appeared:
Dec 16 12:27:25 freddo kernel: [ 7222.496000] usb 4-2: USB disconnect, address 2
Dec 16 12:27:28 freddo kernel: [ 7225.604000] usb 4-2: new low speed USB device using uhci_hcd and address 3
Dec 16 12:27:28 freddo kernel: [ 7225.784000] usb 4-2: configuration #1 chosen from 1 choice
Dec 16 12:27:28 freddo kernel: [ 7225.808000] input: DragonRise Inc. Generic USB Joystick as /class/input/input7
Dec 16 12:27:28 freddo kernel: [ 7225.808000] input: USB HID v1.10 Joystick [DragonRise Inc. Generic USB Joystick ] on usb-0000:00:1d.2-2
Dec 16 12:27:28 freddo kernel: [ 7225.876000] usbcore: registered new interface driver xpad
Dec 16 12:27:28 freddo kernel: [ 7225.876000] /build/buildd/linux-source-2.6.22-2.6.22/drivers/input/joystick/xpad.c: driver for Xbox controllers v0.1.6
After having a look at System -> Preferences -> Hardware Information, I saw the device was listed in there, however the device file that was listed against the controller wasn’t the right one I needed to put into snes9express - the device path is /dev/input/js0. When I started snes9express and mapped the keys to the right buttons for a SNES controller, snes9x would bomb out because of a dodgy argument that was being passed to the program. The mapping (and the joystick device path) should be set in the snes9x config file - /etc/snes9x/snes9x.conf - here’s some portions of mine:
[Unix]
EnableJoystick = TRUE
Joydev1 = /dev/input/js0
Joydev2 = (null)
Joydev3 = (null)
Joydev4 = (null)
SoundBufferSize = 0
IncFormat = %03d # Use one printf-style integer conversion, optionally with
# the '0' flag and a field width
[Unix/X11]
Interpolate = 0
Scale = FALSE
SetKeyRepeat = FALSE
DGAModeSwitch = FALSE
StartFullscreen = FALSE
[Unix/SVGA Controls]
J00:Axis0 = Joypad1 Axis Left/Right T=50%
J00:Axis1 = Joypad1 Axis Up/Down T=50%
J00:B0 = Joypad1 X
J00:B1 = Joypad1 A
J00:B2 = Joypad1 B
J00:B3 = Joypad1 Y
J00:B6 = Joypad1 L
J00:B7 = Joypad1 R
J00:B8 = Joypad1 Select
J00:B11 = Joypad1 Start
How did I get the right buttons mapped to the right SNES buttons? I apt-getted joystick which contains the useful program called jstest which is the equivalent of xev for joysticks when run as follows:
jstest --event /dev/input/js0
I ran the jstest command whilst looking at a pic of a SNES controller and having vi open /etc/snes9x/snes9x.conf.
The other settings I changed in the config file include:
- SetKeyRepeat = FALSE - I might need a reboot to see if it fixes it, but at time of writing holding down a key has no effect and it’s annoying when you want to backspace out the few words you wrote on your blog
- DGAModeSwitch = FALSE - NVIDIA has dropped driver support of DGA (whatever that is) and this will cause snes9x not to run. I’m not sure if this has an effect, but it’s better to turn it off.
I came across a strange occurrence when I started snes9express for the first time, it kept asking for osnes9x instead of snes9x, a quick ln -s /usr/bin/snes9x ~/temp/osnes9x fixed it by putting “/home/naaman/temp/osnes9x” into the snes9x path in the Preferences -> Paths tab. The problem seemed to go away when I had set the “Start-Up loads …” option to “Last run options” in the Preferences -> Reset tab.
The last issue I had with snes9express was the choppy, jumpy sound. The sound issue was fixed by increasing the Rate to 5 (29300 Hz) instead of the default 4. The sound can be fixed using the “-r 5″ argument on the command line for snes9x as well if a frontend like snes9express isn’t being used.
Moving onto the TV-Out adventure. I am using a relic of the early eighties that my flatmate had “collected” on a kerbside collection day and placed on the back deck. Luckily this beast has a SCART port and stereo sound (better than my “good” TV). I bought a SCART to S-VIDEO/RCA adapter a few weeks ago for a party we hosted so we could watch HDTV on it :). Using nvidia-settings, the very well-written app detected the TV on a rescan and I had a picture that needed some serious V-Hold action (for those not accustomed to V-Hold, the picture was constantly “rolling”).
Thanks to the excellent howto on Ubuntu Forums, I managed to make a backup of my /etc/X11/xorg.conf then edit it to look like this:
Section "Monitor"
# HorizSync source: edid, VertRefresh source: edid
Identifier "Monitor0"
VendorName "Unknown"
ModelName "LPL"
HorizSync 30.0 - 75.0
VertRefresh 60.0
Option "DPMS"
EndSection
Section "Monitor"
# HorizSync source: builtin, VertRefresh source: builtin
Identifier "Monitor1"
VendorName "Unknown"
ModelName "TV-0"
HorizSync 28.0 - 33.0
VertRefresh 43.0 - 72.0
EndSection
Section "Device"
Identifier "Videocard0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "GeForce Go 7400"
BusID "PCI:1:0:0"
Screen 0
EndSection
Section "Device"
Identifier "Videocard1"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "GeForce Go 7400"
Option "TVOutFormat" "SVIDEO"
Option "TVStandard" "PAL-G"
Option "ConnectedMonitor" "Monitor1"
BusID "PCI:1:0:0"
Screen 1
EndSection
Section "Screen"
Identifier "Screen0"
Device "Videocard0"
Monitor "Monitor0"
DefaultDepth 24
Option "TwinView" "0"
Option "metamodes" "DFP: nvidia-auto-select +0+0"
SubSection "Display"
Depth 24
EndSubSection
EndSection
Section "Screen"
# Removed Option "metamodes" "TV: 640x480 +0+0"
Identifier "Screen1"
Device "Videocard1"
Monitor "Monitor1"
DefaultDepth 24
Option "TwinView" "0"
Option "metamodes" "TV: nvidia-auto-select +0+0"
SubSection "Display"
Depth 24
EndSubSection
EndSection
After a few restarts of the X-server and a long hour of testing, I was reliving some good old memories of the SNES on my back deck.. Hmmn, I wonder what I’m going to get Dad for Christmas..