Linux Format

Xbox controller gaming

Relive the golden era of gaming by hooking your Pi up to a game controller.

- Mayank Sharma was a contributi­ng editor for www. linux.com and has written for Linux Today, Digg and PC Plus.

Discover how to hook up an Xbox controller to your Pi for some top-notch console gaming of retro and new games.

Video games in the 1980s were quite different from the latest crop of frag-’ em-tillyou’redead pointand-shoot games. They were tastefully crafted 8-bit graphical masterpiec­es, with an intense storylines and gameplay that kept you engrossed for hours. If reading this makes you feel nostalgic, you can emulate the golden era of gaming consoles on your modern hardware and escape back to that golden era.

The new quad-core Raspberry Pi 2 has enough numbercrun­ching power to recreate the video game consoles of yesteryear virtually. Most of the software that creates the defunct platforms is available as open source software, which you can install on top of a Raspbian distributi­on (distro). However, the easiest way to start playing vintage games on the Raspberry Pi is to install the purpose-made RetroPie distro, which packs a bundle of emulators.

You can manually install RetroPie on top of an existing Raspbian distro but it’s more convenient to use the prebaked image. In addition to Raspberry Pi 2, the distro works with the older models as well, so make sure you grab the correct image. You need to transfer this image to at least a 4GB card, either using the dd command in Linux, such as $ dd if=retropie-rpi2.img of=/dev/sdd

You also need a USB keyboard and mouse for some initial setup that you can’t do remotely via SSH. We’ll also hook up a compatible Wi-Fi adaptor to the Raspberry Pi, which won’t work straight out of the box, but we’ll get to that later. Most important of all, make sure you grab some gaming controller­s to enjoy the games to the hilt, and RetroPie can work with various controller­s, from cheap no-names ones to PS3 and Xbox 360 controller­s.

Once you’ve prepared the memory card with the RetroPie image, insert it into the Pi, connect the controller, the Wi-Fi adaptor, the speakers and the USB input devices, hook it up to your HDMI monitor, and power it up. The Pi boots directly into EmulationS­tation, which is the graphical interface it uses to enable you to switch between emulators. The interface asks you to configure the controller. However, before we do that, we have to tweak a couple of settings. Press the F4 key on the keyboard to exit the Emulation Station, then head to XTerminal.

Basic setup

The first order of business is to expand the image to take over the entire card. In order to do this, bring up Raspbian’s configurat­ion utility with $ sudo raspi-config and select the first option to expand the filesystem. Once that’s done, head to the second option to change the default password for the pi user.

Next up, head to the Advanced Options and select the SSH option to enable remote access. To ensure you use the maximum memory for gaming, head to the Memory Split option. If you’re using a Raspberry Pi 2, allocate 512 to the GPU. Users of the older B+ model should earmark 256. Finally, scroll down to the Overclock option, where users of the Raspberry Pi 2 should select the Pi2 option. Once you’ve made all the changes, head back to the main menu and select ‘Finish’ to restart the Raspberry Pi and save changes.

When you’re back up again, press F4 once more to exit out of EmulationS­tation. We’ll now get the Wi-Fi adaptor to work. Open the configurat­ion file with:

$ sudo nano /etc/network/interfaces

and then change its contents to resemble the following: auto lo iface lo inet loopback iface eth0 inet dhcp

allow-hotplug wlan0 auto wlan0 iface wlan0 inet dhcp wpa-ssid “Your Wireless Network Name” wpa-psk “Your Wireless Network Password”

Make sure you replace the text in the wpa-ssid line with the SSID and password for your Wi-Fi network. Press Ctrl+x to save the file and exit the text editor. Now reboot the Pi with sudo reboot . Once it comes back up, your Wi-Fi adaptor connects you to your router. From this point on, you can do the configurat­ion remotely from another computer.

Exit EmulationS­tation yet again and make a note of the IP address RetroPie has been assigned by your router. Assuming it’s 192.168.3.111, you can now log in to it from another computer with sudo ssh pi@192.168.3.111 .

Irrespecti­ve of how you’re accessing the Pi, the next order of business is to tweak some RetroPie-related settings. Change into the RetroPie-Setup directory with

$ cd ~/RetroPie-Setup

and execute the configurat­ion script with

$ sudo ./retropie_setup.sh

The script fetches any required packages that are missing from your installati­on. When it’s ready, the script displays an Ncurses-based menu. First up, scroll down to the second-to-last option, which updates the RetroPie-Setup script itself. Once it’s done, re-launch the script and scroll down to the third option, labelled Setup/Configurat­ion.

In here, scroll down and select ‘323’, which makes the necessary changes to display the RetroPie configurat­ion menu in EmulationS­tation. This helps you make changes to the distro without heading back to the command line. Now, depending on your audio gear and how it’s connected to the Raspberry Pi, you might need to handhold RetroPie before it can send audio output correctly. Select option ‘301’ to configure the audio settings. If the default auto option isn’t playing any sound, scroll down and select the output to which your speakers are connected. The menu also gives you the option to bring up the mixer to adjust the volume.

Configure controller­s

Now reboot the distributi­on one last time and this time continue with EmulationS­tation. If you’ve connected your controller, the distro will pick it up. Press and hold any key on the controller to help the distro correctly identify the controller. You will then be asked to map the keys on the controller. Be aware that this basic mapping is only for navigating around the graphical interface and helping you switch between the emulated system and selecting a game. Once you’ve set up the controller, you’re dropped into the

 ??  ??
 ??  ?? Just to be on the safe side, try playing games with the default clock speeds, before you try to overclock the Pi.
Just to be on the safe side, try playing games with the default clock speeds, before you try to overclock the Pi.
 ??  ??
 ??  ?? Emulation Station displays the number of games inside a particular emulator.
Emulation Station displays the number of games inside a particular emulator.
 ??  ?? If you want to, you can make changes to the splash screen using the RetroPie-Setup script.
If you want to, you can make changes to the splash screen using the RetroPie-Setup script.

Newspapers in English

Newspapers from Australia