Tutorial 12: ODROID-XU4 / XU4Q Lakka Gaming Console Build Part 2
-
Author: Brian A. Ree
Sections
0: Tools Needed
- Monitor or TV with HDMI support to test the device.
- USB Keyboard
1: Parts Needed
- ODROID-XU4 / ODROID-XU4Q x1: $49.00 / $49.00 (On Sale normally $59) link / link
- Case x1: $5.40 link
- 64GB Micro SD Card x2: $15.99 link
- HDMI Cable x1: $1.00 link
- Power Supply 5V/4A x1: $5.50 link
- GameSir Wired Controller x1: $17.00 link
2: Introduction and Tutorial Goals
Hello and welcome to our ODROID-XU4 Lakka advanced config tutorial. You'll need a working ODROID-XU4 device with Lakka installed and
running from part 1 of this tutorial. Remember to turn on SSH by navigating to the Settings -> Services
screen in retroarch. You'll also need to navigate to the network information screen to look up the device's IP address.
Go to the Main Menu -> Information -> Network Information. We'll show you how to configure your controller, setup your ROMs, and perform
advanced configurations like emulator BIOS files in this tutorial.
XU4 Features:
- ODROID Goodness!
- Hardware Reset Button
- Support for Atari 2600, Atari 5200, Atari 7800, Atari Jaguar, Atari Lynx, ColecoVision, MSX-1, MSX-2, NES, GameBoy, GameBoy Color, Virtual Boy, SNES, N64, GameBoy Advance, WonderSwan Pocket/Color, NEO GEO Pocket/Color, Sega SG-1000, Sega Mark 3, Sega Master System, Sega Genesis, Sega GameGear, NEC Turbo Graphics 16, NEC Super Graphics, PSP, and PS1 emulators configured and ready to go.
- Lakka and Retroarch with XBM.
Ok let's get to it shall we!
3: Setting Up the Controller and ROMS
There are a few different ways we can get ROMs setup on Lakka. I'll be covering the simplest way to do this, via an external USB drive or a thumb drive.
Once you plug the drive into the device open up Putty on Windows or a terminal program on Mac or Linux.
Then SSH into the device. Make sure you have the IP address and that the SSH service is turned as mentioned above.
Run the following commands.
cd /storage/roms/
Look for a folder that has the same name as the external drive you connected to the device. There should only be one folder in this directory
for each connected external drive. You can copy your ROM folders to the correct location on the device by using the following command.
cp -r ./[Source ROM Folder] /roms/[Target ROM Folder]
For example if the ROM folder was named NES then you would run the following command.
cp -r ./NES /roms/NES
Do this for each ROM folder you want to keep on the local device file system.
It can take a little while for the copy operation to work if you're moving a lot of data.
Next we'll take a look at getting retroarch to recognize all the ROMs we just copied over.
Let's whip retroarch into shape. First let's get the gamepad working in retroarch. In retroarch you can use the keyboard arrow keys, enter,
and backspace to navigate the menu system without the gamepad. Make sure you have a keyboard, and game controller connected to your ODROID device.
Use the arrows on the keyboard to navigate right to the Settings section, then move down to the Input section as shown below.
Adjust the settings on this screen as you see below. I usually set the max number of controllers to 3 since there are only 3 USB ports on this device.
And I like the L1 + R1 + Start + Select Menu Toggle Gamepad Combo setting, let's face it if you're accidentally hitting this combination during game
play something aint right. Depending on your gamepad you may want to toggle the Menu Swap OK & Cancel Buttons option. I do this for certain
gamepads that have green and red buttons to make them match the Ok and Cancel settings for retroarch. Just irks me to click a red button for a Cancel command.
Leave the remaining settings and scroll down to the User 1 Binds. You'll have to setup each user input in this way
it's not too bad only takes a minute.
The next step takes a little while but requires very little work on your part.
You just have to click on a few things and wait for them to complete. Navigate back to the Main Menu which is the first
section retroarch starts on. Make sure your are connected to the internet.
Scroll down to the Content Updater and open that section.
I usually run each option in order. Try the Core Updater option first.
Next go to the Thumbnails Updater, this part can take a while, and select each system you plan to load ROMs
from one at a time. Resist the urge to click a bunch in a row. I've done that and it can crash the app at the worst
and at the least it slows down each individual process as they are all competing for resources. Best to let one blast
through then move on. Tip: There are some one-off games you can get thumbnails for here like DOOM Demo, Cave Story, and Dinothawr.
You'll be able to load those games from the Content Downloader.
Next up you'll want to back out of the Thumbnail Updater section with the backspace key.
Scroll down to the Content Downloader and download any special content you want from the listing.
Tip: If you see a screen that has no options wait a minute back out and go into that section again it just didn't finish downloading
the index of available options. I usually don't install the one-off games but this is the spot for it. Most of the content I think
you can safely ignore but I'll leave that up to you. Run the following list of other updates one at a time, basically everything
remaining on the list.
Update Core Info Files
Update Assets
Update Joypad Profiles
Update Cheats
Update Databases
Update Overlays
Update GLSL Shaders
Update Slang Shaders
Once you have all your ROMs placed in the ROMS folder in their own separate folders for each system, this is the best way to do it,
we can start telling retroarch about the files. Fire up retroarch and scroll to the right until you see the Scan Directory option.
Navigate to the ROMS folder, you should see it in the list. Then select one system at a time for scanning. Scanning large ROM sets can
take a while. Again resist the urge to start multiple scans things will go smoother if you let an operation complete before starting a new one.
That takes care of setting up the controller and the ROMs for your Lakka based ODROID powered device. Next up we'll cover some advanced configuration
topics. Before we exit this section I wanted to mention how to start and stop the retroarch service on Lakka. This is a little bit different than other
retro-console setups. If you have to edit the retroarch config file through SSH, you'll have to stop the retroarch service otherwise your changes will be lost.
Below are commands for stopping and starting the retroarch service.
systemctl stop retroarch
nano /storage/.config/retroarch/retroarch.cfg
systemctl start retroarch
4: Retroarch Advanced Config
Let's take a look at the default emulators I like to use for the systems that run on the Lakka powered, ODROID-XU4, device.
All emulators were tested at 720p (1280x720).
Atari 2600
Atari 5200
Atari 7800
Atari Jaguar
Atari Lynx
ColecoVision
Commodore 64
GameBoy Advance
GameBoy Color
GameBoy
Magnovox-Odyssey2
MAME
MSX-1
MSX-2
NEC: Turbo Grafx 16
NEC: PCE Super Grafx
NEO GEO Pocket
NEO GEO Pocket Color
NES
SNES
N64
PSP
PS1
Sega 32X
Sega Dreamcast
Sega GameGear
Sega Genesis
Sega Master System
Sega SG-1000
Sinclair ZX Spectrum
Virtual Boy
Wonder Swan Color
Wonder Swan
For the most part Lakka is automatically setup to run a specific emulator that will work great.
However, when you run a ROM for the first time, that Lakka isn't sure about, you will be prompted to choose the default emulator for that ROM only.
Fear not if you make a mistake or find that an emulator doesn't run things correctly you can choose to reset the
emulator association from the menu that comes up when you select a ROM. This will reset things to their default and you
can then choose a different emulator the next time you run the ROM.
If you want to exit a game press L1 + Select + Start + R1 and choose to close the current game. Press
L1 + Select + Start + R1 again to cose the menu and return to the game. To adjust emulator specific options
scroll down after pressing L1 + Select + Start + R1 and choose the Options entry. For the most part
you shouldn't have to adjust these settings for the emulators running on the device, but just so you
know where it is.
Now on to the retroarch settings. We'll cover some general settings followed by screen shots of the configuration
I've been using for video, audio, and drivers. Don't adjust settings that aren't listed below, some settings are driven
and you don't need to worry about them.
Video Settings:
Show Window Decorations: OFF
Remember Window Position and Size: OFF
Integer Scale: OFF
Threaded Video: ON
Vertical Sync (Vsync): ON
Max swapchain images: 3
Hard GPU Sync: OFF
Hard GPU Sync Frames: 0
Bilinear Filtering: OFF
A complete listing of the video settings follows in the next screen shot. Take a look.
Again you can safely ignore the window position and size setting as these will be driven by the fullscreen mode
option.
Next up we'll go over the audio setting. I'll list the major ones first then show screen shots of all
the settings.
Audio Settings:
Audio: ON
Mute: OFF
Volume Gain (dB): 0.0
Resample Quality: Lower
Lastly, there is an appearance setting you can adjust to set the device into kiosk mode.
This will turn off a number of configuration options while the setting is on. Might come in handy so I figured I'd mention it.
- MSX - 1/2 BIOS SETUP -
For MSX ROMs in order to get blueMSX running you'll need a copy of two folders from their stand alone installation. The
Databases and Machines folders are found in the blueMSX installation folder. You can get a copy of
blueMSX at this URL, http://bluemsx.msxblue.com/download.html.
Once you've installed blueMSX and found the folders in question copy them onto a USB drive and plug that drive into your
device. Using similar commands that you used to copy the ROMs over from your external drive copy the target folders Databases, Machines,
from the /storage/roms/ directory, this is where your USB key will be mounted, to the /system/ directory. The system directory is where emulators look for most of the BIOS files and folders.
Because blueMSX works really well, and will automatically detect the target system, it can be used for ColecoVision, MSX-1, and MSX-2
ROMS. You'll also want to place a copy of the blueMSX folders in the ROM's local MSX directory. ALERT: In my experience having the Databases and Machines
folders in the MSX directory can mess up the directory scan. Temporarily remove them, perform the scan, then put them back.
- ColecoVision BIOS SETUP -
For ColecoVision ROMs running with blueMSX running you'll need a copy of the same two folders from the MSX config. The
Databases and Machines folders are found in the blueMSX installation folder. You can get a copy of
blueMSX at this URL, http://bluemsx.msxblue.com/download.html.
Once you've installed blueMSX and found the folders in question copy them onto a USB drive and plug that drive into your
device. Using similar commands that you used to copy the ROMs over from your external drive copy the target folders Databases, Machines,
from the /storage/roms/ directory, this is where your USB key will be mounted, to the ColecoVision directory. This will solve any
ColecoVision loading problems.
To setup the fMSX emulator you'll need to find a copy of the following BIOS ROMS on the nets.
DISK.ROM
KANJI.ROM
MSX.ROM
MSX2.ROM
MSX2EXT.ROM
MSX2P.ROM
MSX2PEXT.ROM
MSXDOS2.ROM
PAINTER.ROM
Once you've located those BIOS ROMS place a copy of them in /system/ folder.
- PSP / PS1 BIOS SETUP -
To get PSP and PS1 emulators working you'll need to locate the following bios files on the nets. Listed below are the
bios files you'll need.
scph5500.bin
scph5501.bin
scph5502.bin
scph5552.bin
With your PS1 games you'll need to unzip the contents of the compressed version of the game and place the .cue and .bin files
into the PS1 ROMs folder. You should place a copy of the above BIOS files in the system directory and in the local playstation directory.
For PSP ROMS you'll need to create a folder in the system directory called PPSSPP and copy the same set of BIOS files into that directory.
- MAGNAVOX ODYSSEY BIOS SETUP -
For the Maganvox-Odyssey2 emulator you'll need to get a copy of two bios files from the internet and place them, you guessed it, in the
system folder. Listed below are the bios files you'll need.
o2rom.bin
c52.bin
- COMMODORE64 BIOS SETUP -
Lastly if you plan on using the Commodore64 emulator you'll need to place the following bios files in the root of the C64 roms folder.
I use the following directory setup. NOTE: The Commodore64 emulator can take a few minutes to load a game so don't think it has crashed out if you see
the loading screen for a few minutes.
[Commodore64]
-> 1542.ROM
-> Basic.ROM
-> Char.ROM
-> Kernal.ROM
-> [games]
-> -> 1542.ROM
-> -> Basic.ROM
-> -> Char.ROM
-> -> Kernal.ROM
I place a set of BIOS files in the Commodore64 root directory while the game ROMS reside in a separate folder. I also place a copy of the BIOS files in the
ROMS folder. You may have trouble scanning Commodore64 ROMs and also Dreamcast and Sinclair ZX Spectrum ROMs but I show you how to get around that.
- ZX SPECTRUM BIOS SETUP -
To get your Sinclaire ZX Spectrum ROMs up and running you'll need to create a folder in the system directory called fuse.
Next locate the BIOS files listed below on the internet.
128p-0.rom
128p-1.rom
trdos.rom
That should take care of your ZX Spectrum games. You may have trouble getting Lakka to make a playlist for these ROMs but I'll cover using custom
software to generate a playlist for certain systems that don't seem to work well in Lakka.
- SEGA DREAMCAST BIOS SETUP -
Next up we'll setup the Dreamcast emulator. To do this you'll need to find the following BIOS files on the internet.
The setup I'm detailing here is for the reicast emulator. The redream emulator will require slightly different file names just remove
the dc_ part.
dc_boot.bin
dc_flash.bin
dc_flash_wb.bin
Place the BIOS files listed above in a new folder called dc in the system directory. You should also setup the same folder and files in the root
directory of the Dreamcast ROMs. I found that the emulator, when running Lakka on an XU4, expected the BIOS files to be in the local ROM directory and not in the system
folder as the documentation indicated.
- ATARI 800 / 5200 BIOS SETUP -
Next up we'll setup the Atari 5200 emulator. To do this you'll need to find the following BIOS files on the internet.
Create a directory named BIOS in both the system directory and the atari 5200 ROM folder. Copy and paste the following ROM files
into the directories you just created. You can find them on the internet just do a search for them.
ATARIBAS.ROM
ATARIOSA.ROM
ATARIOSB.ROM
ATARIXL.ROM
5200.rom
Run the atari 800 / 5200 emulator and you should get an error message that the OS could not be found fear not there is one more step yet to do.
Locate the .atari800.cfg file it should have been created in the root of the default user's folder. Search for it if you can't find it.
We're going to edit the file and set the path to the proper BIOS files. The key lines in the file are listed below. The example has the paths
I used for my BIOS files you should use paths specific to your system.
ROM_OS_A_PAL=/storage/system/BIOS/ATARIOSA.ROM
ROM_OS_B_NTSC=/storage/system/BIOS/ATARIOSB.ROM
ROM_OS_BB01R2=/storage/system/BIOS/ATARIXL.ROM
ROM_5200=/storage/system/BIOS/5200.rom
ROM_400/800_CUSTOM=/storage/system/BIOS/ATARIOSB.ROM
Now when you try to load up an atari 5200 ROM you should get the emulator to run perfectly. NOTE: In order to start a game you need to press the F4 key
on the keyboard. You may also need to adjust the emulator options to choose the 5200 system if it doesn't auto detect the required system. You can
adjust this in the Options menu entry after bringing up the menu, L1 + Select + Start + L2, while the emulator is running.
- FAMICOM BIOS SETUP -
Next up we'll setup the Famicom emulator. To do this you'll need to find the following BIOS files on the internet.
disksys.rom
Place a copy of the BIOS file in the system folder, /storage/system/ and also place a copy in the
Famicom ROM folder.
- NEC PCE AND TURBO GRAFX CD BIOS SETUP -
Next up we'll setup the NEC PC Engine and Turbo Grafx CD emulator. To do this you'll need to find the following BIOS files on the internet.
syscard3.pce
syscard2.pce
syscard1.pce
gexpress.pce
Place a copy of the BIOS file in the system folder, /storage/system/ and also place a copy in the
NEC PCE / Turbo Grafx CD ROM folder.
- SEGA CD BIOS SETUP -
Next up we'll setup the Sega CD emulator. To do this you'll need to find the following BIOS files on the internet.
bios_CD_E.bin
bios_CD_U.bin
bios_CD_J.bin
Place a copy of the BIOS file in the system folder, /storage/system/ and also place a copy in the
Sega CD ROM folder.
That wraps up the advanced retroarch configuration part of this tutorial.
The main thing to take away from this section is this. Place a copy of the BIOS files as described online in libretro documentation
in both the system folder and the local rom folder. Avoid subfolders in your rom directories unless they are specifically required for configuration and keep all your
ROMs on the root on said folder along with the BIOS files. If you follow this setup you'll have no problem adding new emulators to your device.
The next little part covers building custom retroarch playlists
for some emulators that Lakka, or retroarch, are a bit stubborn with.
5: Building Custom Retroarch Playlists
For some systems retroarch seems a bit stubborn about creating a playlist. I've had issues with Commodore64, Dreamcast, and ZX Spectrum
on my Lakka powered XU4 ODROID device. I wrote some custom software to generate the playlist automatically but to do so you'll need a few pieces of
information.
1. A files with a list of the ROM names.
2. The full path to the ROMs ending with a '/'.
3. The path to the emulator core.
4. The name of the emulator core.
5. The database name for the given ROM playlist.
Don't worry it's not as crazy as it sounds. I'll go over the different pieces of information now. For the first item, the file list, simply run
the following command in the terminal on your device.
ls -1 > rom_file_list.txt
That will generate a file list for you to use. You'll have to copy it to where you plan to run the software. The program is written in Java and includes the source
code so you can run it anywhere you have Java setup and configured. Search the internet for instructions on how to install the latest JRE if you don't have Java on your system.
Next you'll have to get a copy of the full path to the target ROMs and make sure that is ends with a '/' character. You can type the following command
at the terminal while in the target directory and then copy and paste it to a file until you run the software.
pwd
Next you'll need that path to the target emulator core and the name of the core. You can look at one of your existing playlists
to see what path is used for an entry where the emulator core association has been set. Then if you need to find the name of the emulator
core you can simply list the contents of that directory and find the emulator you want to use in the playlist you're generating.
For instance my ZX Spectrum settings had these values.
Path to Emulator Core: "/tmp/cores/fuse_libretro.so"
Name of Emulator Core: "ZX Spectrum (Fuse)"
The last thing you'll need is the database name for the target ROM playlist. This is usually the same name as the playlist. For the ZX Spectrum
I used Sinclair - ZX Spectrum.lpl, you may need to look this up. The name of the playlist file and possibly the database name entry are used
to associate the little system icon you see in retroaech.
I'll post a link to the software below. Two example runs of the software are as follows.
The jar is ran from the project's dist directory. You'll most likely have to use settings that are specific to your system.
cd ./dist
java -jar RetroArchPlaylistBuilder.jar "../zx_spec_file_list.txt" "/storage/roms/ROMS/ZX_SPECTRUM/" "/tmp/cores/fuse_libretro.so" "ZX Spectrum (Fuse)" "Sinclair - ZX Spectrum.lpl"
java -jar RetroArchPlaylistBuilder.jar "../sega_dreamcast_files.txt" "/storage/roms/ROMS/SEGA_DREAMCAST/" "/tmp/cores/reicast_libretro.so" "Sega Dreamcast (reicast)" "Sega - Dreamcast.lpl"
The software will generate an output.txt file that is the body of the playlist file format. You'll need to add the following test to the
top and bottom of the file if you want to just plug it into the playlists folder.
Header:
{
"version": "1.0",
"items": [
Footer:
]}
Locate the playlist folder your system uses and paste in the new file. Reboot the device or restart retroarch. You should be good to go!
Oh! One last thing, you can grab a copy of the software here.
This wraps up the special configuration steps needed regarding bios files for the emulators that need them. Enjoy!!