Difference between revisions of "Configuring MythGame Emulation"

From MythTV Official Wiki
Jump to: navigation, search
m (ePSXe: Added internet archive url for the howto)
Line 377: Line 377:
Homepage: http://www.rcdrummond.net/uae/index.html
Homepage: http://www.rcdrummond.net/uae/index.html
Version: '''0.8.29-WIP3'''
Version: '''0.8.29-WIP4'''
This emulator is a backport to linux from WinUAE.
This emulator is a backport to linux from WinUAE.

Revision as of 22:03, 17 July 2007


See the MythGame overview to answer what is MythGame.


  • These instructions are specific to MythGame v0.19. (MythGame 0.18 instructions may be found here.) This document covers configuration of MythGame after it is installed; compilation and installation are not covered.
  • Note that the term player refers to the emulator software (ie, xmame) and not the human playing the games.

ROM Layout

MythTV categorizes your ROMs by system type (NES, SNES, etc). It also requires a path to provide to each emulator. Thus it's desirable to store your ROMs in separate directories based on the system. An example directory structure is given below. Your structure may differ but separation by system type is key.

/usr/emulators/amiga/chip   (For the Kickstart Image)

ROM Descriptions

MythGame allows you to provide titles, descriptions, screenshots, release year, and other information for your ROMs. This information can be automatically detected by matching CRC values of ROMs to database entries in the romdb table for MythTV. This database based ROM identification method has replaced the catver.ini method used in previous versions of MythGame (earlier than v0.19), which only supported MAME ROMs. Romdb contains metadata for many different types of ROMs such as NES, SNES, Genesis, Atari, etc.

For automatic detection to work, MythTV's romdb database table must be populated. This appears to be done by default in v0.19; however, you can find an SQL load script in the v0.19 (and later) MythGame source package as romdb-20051116-02.tgz. Alternatively, you can grab the script from phaze.org/romdb.

Untar and load:

tar -xzvf romdb-20051116-02.tgz
mysql -D mythconverg -u mythtv -p < romdb-2005-1101-01.sql

If running the above reports errors it's likely because the SQL file includes commands to create romdb table and your system already has the romdb tabe. Try re-running the above mysql command after removing the following lines from the .sql script: CREATE TABLE romdb ( ... ) TYPE=MyISAM;

Once the romdb table has been populated, you will need to re-scan your games within MythTV by navigating to Utilities/Setup > Setup > Media Settings > Game Settings. Once there, select General Settings and ensure that Indepth Game Scan is enabled, otherwise it MythGame will not perform the necessary CRC computations. Then, select Clear Game Data (Warning: This will clear any custom game metadata that you've added). Finally, select Scan for Games. This should take considerably longer than it did if you didn't have Indepth Game Scan enabled. That's it; now you should have a nicely organized ROM collection.


When looking for screenshot files, Mythgame first strips the file extension by chopping off everything after the last . (dot) in the filename (of the game in question). It then cycles through this list of image format extensions to see if appending any of those result in an existing file (in the screenshot directory):


Note that it is stripping the file extension from the filename, which means that the screenshot filename has to be exactly the same (minus the extension). In case of games with multiple disks, this implies the disk number should also be included in the screenshot filename. However, Mythgame currently does not seem to consistently pick the first disk of a game. For more details, see | ticket

Generated Screenshots

A new | ticket provides a patch for MythGame that allows you to generate screenshots for the ROMS automaticaly within MythGame.

It uses the program scrot to generate screenshots of your X display.

It has also a patch included wich delays the loading of the screenshots about 300 msec so that scrolling through the roms goes as fast as without the screenshots.


Each emulator (called player within MythTV) must be setup individually. Setup consists of specifying a name, the type of hardware being emulated, the binary to execute, and the location of the roms.

If the path to the emulator binary is in your PATH there's no need to specify it in the setup. To determine which path a program is installed run which <program>.

Most emulators are included with OS distributions. Consult your package manager (rpm, dselect, emerge, synaptic, etc) before installing from source (unless you have a specific reason to do so).

Note: If your emulator is starting in the background, for example, behind the FrontEnd screen, then you likely have to turn off "Focus Stealing Prevention" under the control panel under "Window Behaviour". You can tell when the emulator is running in the background because the Frontend seems to stop responding in the foreground and if you hit "alt-tab", the emulator shows up. It also helps to follow have the "focus follow mouse"

Nintendo: SNES


Homepage: http://www.zsnes.com/

Version: 1.51

ZNES requires a mouse for configuration in the GUI, keyboard support is not fully implemented. Fortunately the configuration only has to be done once. You might want to take this time to map unused buttons on your controller to common GUI functions, such as exit, save, and load.

Start ZSNES to create the config file. I recommend setting the option 2x Super SAI Engine under Configuration > Video so the picture looks smoother. To map joypad buttons to GUI functions, set the option under Misc -> Game Keys such as exit and press a button on your controller.

After configuring ZSNES and exiting you must copy the configuration (by default ~/.zsnes) to the mythtv user directory (probably ~mythtv/.zsnes).

NOTE: (Current as of 06/20/2006) FC5 users may encounter issues compiling the 1.42 version. Consider getting the CVS version from SourceForge.

NOTE: (Current as of 03/22/2007) If you experience crackly sound when running roms (under Ubuntu 6.10 at least) , make sure that you use the libsdl1.2-oss package, and not libsdl1.2-all. It seens that ZSNES is optimized to use oss and not alsa.

Add a new player in MythGame's setup:

Player Name: SNES 
Type: SNES 
Command: zsnes -k 25 -m 
Rom Path: /usr/emulators/snes/roms


Homepage: http://www.snes9x.com/

Version: 1.43

An alternate SNES emulator is called SNES9x. The quality of this emulator is near to ZSNES, if not better. It has no frontend on Linux but frontends just get in the way on MythTV. Everything can be configured through the command line, and most options work for all games, so once you have it set up you only need to modify command line options when you change hardware, like joysticks.

To view the configuration options run snes9x -h.

On many linux distributions to utilize full screen mode in SNES9x you need to add the SUID bit to your SNES9x binary. This is a security risk, but it makes games much more enjoyable. To add the SUID bit, do this:

 chmod 4750 `which snes9x`

Please adjust group and world permissions as necessary to suit your distribution.

Add a new player in MythGame's setup:

Player Name: SNES 
Type: SNES9X 
Command: snes9x -stereo -r 6 -tr -fs
Rom Path: /usr/emulators/snes/roms

DGA Support On Newer NVIDIA Drivers

SNES9x uses an extension of X called DGA when using full-screen mode. DGA allows applications direct access to the video frame buffer. The latest set of NVIDIA drivers does not support DGA, and if you try to run SNES9x using full-screen mode, it will fail. The README file for the latest NVIDIA drivers explains this.


Homepage: http://www.xe-emulator.com

Xe offers very good SNES/Super Famicom emulation as well as emulating many other platforms (most of which it emulates quite well; some still are in development).

Xe can be configured from within its GUI and, once done so, it should remember the settings. Another way to configure Xe is to pass options through the command line, which is much more convenient for setups with multiple frontends. Modify the command as needed - a description of the flags is provided below.

Player Name:  Xe (SNES)
Type:  SNES
Command:  /usr/local/bin/xe --region 1 --fullscreen --render 1 --joystick1
Rom Path:  /path/to/snes/roms

Many more command-line switches are available, but these should be the only ones really necessary. Again, none are necessary at all if Xe is configured from within the GUI.

  • --region x sets the region of the device. Change as needed. 0=Japan, 1=USA, 2=Europe.
  • --fullscreen, naturally, forces the emulator to use the entire screen with no menu bar.
  • --render 1 uses hardware rendering if available.
  • --joystick1 enables joystick 1 using device /dev/input/js0. To use a different device, add the --joy1 flag (for example, --joy1 /dev/js).
  • --joystick2 would enable a second joystick using device /dev/input/js1.

Some users will need to modify rights to the /dev/input/js* devices in order to use them. Xe will generate an error saying that access is denied to the device if permissions are not set properly.

# chmod a+r /dev/input/js*

Those using EPIA boards will be rather disappointed as Xe does not appear to be able to take advantage of any hardware acceleration that may be available through the Unichrome drivers. The M10000 cannot keep up. EPIA boards with faster CPUs may be able to handle it.

An additional flag that may be helpful to underpowered frontends:

  • --scrmode 0 causes the screen's resolution to change as opposed to scaling the image to fill the screen. Definitely helpful for systems using software rendering.

To exit the emulator, use Ctrl+X. To show or hide the menu bar, use Esc. It does not appear that these are customizable options.

At least on feisty, if you get the error message "Package gtk+-2.0 was not found in the pkg-config search path." Install run the following command:

sudo apt-get install libgtk2.0-dev libasound2-dev libXv-dev libXxf86vm-dev

Then open the readme (from the downloaded file) and follow the instructions under "Manual Install" prepending sudo to all the commands.

Nintendo: NES


Homepage: http://nestopia.sourceforge.net/

Version: 1.37

NEStopia is one of the best Nintendo/Famicom emulators available, it’s an open source emulator and it gets updated frequently. It is designed to emulate the hardware as accurately as possible, without use of any emulation hacks. It's primary development effort is on Windows and OS X, but recently a Linux port using SDL written by Arbee has surfaced. It is in essence a SDL wrapper that utilizes the main Nestopia source. This has support for ALSA audio, NTSC/PAL auto-detection, and accurate emulation of NTSC artifacts to make game play more realistic.

To build NEStopia, you need two things:

  1. The 1.37 core source from the NEStopia web site.
  2. The PR #5 Linux overlay source from Arbee's WIP Emporium.

Unzip the core source, then unzip the Linux overlay source over it, then compile. Make sure you have the SDL and ALSA development sources in your includes path.

Command: nst %s

You will probably want to run nst alone first to configure it via the GTK+ GUI. When you enable controllers, the ~/.nestopia/nstcontrols file will be used to define controller inputs; the default is for a PS/2 controller. (I have a patch submitted that adds a gennstcontrols utility that can interactively generate an nstcontrols file for any SDL-recognized controller, and I have (wired) XBox USB controller settings; the patch also enables quick save and exiting back to MythTV with a controller button, so you don't have to use the mouse to close the window. Also, ALSA locked up for me, so I stuck with OSS.)


Homepage: http://rbelmont.mameworld.info/?page_id=163

Command: mess nes -cart %s


Homepage: http://fceultra.sourceforge.net/

Version: 0.98.13

Start fceu with fceu -inputcfg gamepad1 %romname% to configure your joystick. In XWindows, the executable may be fceu-sdl instead of fceu.

Add a new player in MythGame's setup:

Player Name: NES 
Type: NES 
Command: fceu -fs 1 -joy1 1 -xres 1024 -yres 768 -soundvol 25
Rom Path: /usr/emulators/nes/roms

fceu also supports Game Genie cheats. To load Game Genie, place gg.rom (may need renamed from "Game Genie (Unl).nes") in ~/.fceultra and add "-gg 1" to the player Command line above.

(the fceu executable does not support --options it needs -options instead)


Homepage: http://www.xe-emulator.com

Xe is a very good NES/Famicom emulator. It emulates many other platforms, too. See the SNES entry for a complete write-up, including information on the command-line options. The command is identical to the rest; Xe determines the platform by analyzing the ROM.

Player Name:  Xe (NES)
Type:  NES
Command:  /usr/local/bin/xe --region 1 --fullscreen --render 1 --joystick1
Rom Path:  /path/to/nes/roms

Nintendo DS


Homepage: http://desmume.org/

Version: 0.7.1

Nintendo: Game Boy Advance & Game Boy

Visual Boy Advance

Homepage: http://vba.ngemu.com/

Version: 1.80 SDL

The latest cvs version is recommended though older binaries do work. To get the latest cvs version run cvs -z3 -d:pserver:anonymous@vba.cvs.sourceforge.net:/cvsroot/vba co -P VisualBoyAdvance

Then we need to go into the VisualBoyAdvance directory and run: ./configure

After that we do: make

And then after compilation has completed we can copy the VisualBoyAdvance binary from the source dir to our binary directory (ie /usr/local/bin/).

You then need to edit the VisualBoyAdvance.cfg to edit your Joystick settings. If you want to change it, you can get a program called SDL Configurator from the VisualBoyAdvance downloads page to get the correct settings for your joystick: http://vba.ngemu.com/downloads.shtml

Add a new player in MythGame's setup:

Player Name: GBA
Type: OTHER 
Command: VisualBoyAdvance -F -4 (or -3, or -2 depending on your screen size, whatever works best for you)
Rom Path: /path/to/gba/roms

(The Parameters -F runs the emulator in a full screen and -4, -3, or -2 enlarges the picture x4, x3, or x2 respectively. Experiment to see which one fits your screen the best.)

Note: if you cannot get VisualBoyAdvance to compile, your best bet for Fedora Core 4 is to install this: http://vbaexpress.tuxfamily.org/visualboyadvance-1.7.2-1.FC4.i386.rpm


Homepage: http://mednafen.com/

Version: 0.6.2

Mednafen is available with Debian official, and therefore many of the derived distros using Apt. The official page only has source code available, so check with your distributions repositories if you don't use Debain/Derived or make sure you have up to date SDL libraries if you intend to compile it yourself.

Player Name: Mednafen
Command: mednafen -gba.stretch 1 -fs 1 -vdriver 0 %s  (vdriver 0 is for OpenGL, if you prefer SDL surface blits use 1)
Rom Path: /path/to/gba/roms


Homepage: http://www.xe-emulator.com

Xe is a very good Game Boy and Game Boy Color emulator. It emulates many other platforms, too; though it cannot (yet?) emulate the Game Boy Advance. See the SNES entry for a complete write-up, including information on the command-line options. The command is identical to the rest; Xe determines the platform by analyzing the ROM.

A valid ROM dump needs to be placed in /usr/local/lib/xe/bios/gameboy.rom or ~/.xe/bios/gameboy.rom in order for Xe to emulate a Game Boy or Game Boy Color machine.

Activate the menu bar by pressing Esc if it is not already displayed, and choose Machine -> Options -> Game Boy Color to switch between Game Boy (monochrome) and Game Boy Color modes.

Player Name:  Xe (Game Boy Color)
Type:  OTHER
Command:  /usr/local/bin/xe --region 1 --fullscreen --render 1 --joystick1
Rom Path:  /path/to/gameboy/roms

Nintendo: N64

Mupen 64

Homepage: http://mupen64.emulation64.com/

Version: 0.5

You must compile Mupen from source because the binary versions do not include the nogui version.

Download Mupen source by running wget http://mupen64.emulation64.com/files/0.5/mupen64_src-0.5.tar.bz2. Then extract the source.

Configure Mupen with ./configure

note: you can not remotly do this, due to GTK initialization checking. Make sure you're running this within X.

libSDL-devel is required to compile Mupen. See http://www.libsdl.org/.

Mupen64 0.5 comes with a bug which results in the nogui version not compiling. To fix this, edit main/main.c and insert the following at the beginning of the file:

#include <dirent.h>
#include <sys/stat.h>

Compile the Mupen nogui Version with:

make mupen64_nogui
make install
make install mupen64_nogui
note: install / redundant commands are only needed if you want application/plugins/etc put into a shared area for you.

Now you need the MUPEN Plugins. You can also compile them (the normal "make" command above made them for you) or get them within the binary distribution of the Mupen Webpage (the latter is much easier and recommended). Grab the latest zip of the compiled applicaiton (not the source, linked above) and there is a plugin's directory in that.

Create a config file to use with Mupen. An example file follows:


Gfx Plugin = /usr/emulators/n64/bin/plugins/Glide64.so
Audio Plugin = /usr/emulators/n64/bin/plugins/jttl_audio.so
Input Plugin = /usr/emulators/n64/bin/plugins/blight_input.so
RSP Plugin = /usr/emulators/n64/bin/mupen64_hle_rsp_azimer.so
Fullscreen = true
Emulation Mode = 2
No Ask = true
note: put this file where the mupen64_gui application is executed from.

Add a new player in MythGame's setup:

Player Name: N64
Type: N64
Command: mupen64_nogui
Rom Path: /usr/emulators/n64/roms
(mysql table: gameplayers)

Nintendo: GameCube


Homepage: http://gcube.exemu.net/

Version: 0.4

You must compile gcube from source.

Download gcube source by running wget http://gcube.exemu.net/downloads/gcube-0.4-src.tar.bz2. Then extract the source.

Then you should patch the file config.c and add the Line

	config.texcache_size = DEFAULT_TEXCACHE_SIZE;

on line 170 under the line

	config.buffer_size = DEFAULT_BUFFER_SIZE;

Compile it with:

make install

Add a new player in MythGame's setup:

Player Name: gcube
Command: gcube -f
Rom Path: /usr/emulators/gcube/roms

Commodore: Amiga


Homepage: http://www.rcdrummond.net/uae/index.html

Version: 0.8.29-WIP4

This emulator is a backport to linux from WinUAE.

There is a repository for Ubuntu here http://morgoth.free.fr/ubports/

1. A500+ setup using a config file:

Add a new player in MythGame's setup:

Player Name: Amiga 500+

Command: uae -f /path/to/configfile/a500+.uaerc -s floppy0=%d1
-s floppy1=%d2 -G

(Note: the command is a single line; it is split here so it fits on the screen.)

Rom Path: /path/to/your/amiga/disks/
Span Disks: yes

Place a text file called 'a500+.uaerc' where you like containing the below:

 ## E-UAE config file for the Amiga 500+

2. A1200 setup using a config file:

Add a new player in MythGame's setup:

Player Name: Amiga 500+

Command: uae -f /path/to/configfile/a1200.uaerc -s floppy0=%d1
-s floppy1=%d2 -G

(Note: the command is a single line; it is split here so it fits on the screen.)

Rom Path: /path/to/your/amiga/disks/
Span Disks: yes

Place a text file called 'a1200.uaerc' where you like containing the below:

 ## E-UAE config file for the Amiga 1200

There is good documentation with the source code. You can download that from the E-UAE page.

Spanning disks: MythTV can span up to four disks but at the moment E-UAE only emulates 2 drives. To make spanning work work you just need to rename your disks with a '.1', '.2' etc before the file extension.

GTK permissions error: If E-UAE will not run it might be because you are running MythTV with root privileges and GTK will not allow that. This command will fix it:

sudo chmod -s /usr/bin/mythfrontend


Homepage: http://sourceforge.net/projects/xfellow

Additional details needed.

Original UAE

Homepage: http://sourceforge.net/projects/uaedev/

Version: 0.8.23

Additional details needed.

Atari: VCS/2600


Homepage: http://stella.sourceforge.net

Stella is an excellent emulator of the Atari 2600 Video Computer System (VCS). Any necessary configuration can be performed within the GUI. Press Tab to display the configuration menu. Stella runs just fine on an EPIA M10000.

Player Name:  Stella (Atari 2600)
Type:  ATARI
Command:  /usr/local/bin/stella -fullscreen 1
Rom Path:  /path/to/atari/2600/roms

Atari: Lynx

Handy SDL

Homepage: http://sdlemu.ngemu.com/sdlemu/handysdl.php

Version: 0.82 R1

You also need a BIOS image from the Atari Lynx. Copy this into the directory with the emulator's binary. (Info: You are only allowed to use a BIOS dump of your own Lynx machine!)

Player Name: Atari Lynx
Type: OTHER 
Command: sdyhandy %s -fullscreen -scale 4 -sound -joystick
Rom Path: /usr/emulators/atari/lynx/roms



Homepage: http://rbelmont.mameworld.info/?page_id=163

The future of XMAME is uncertain due to recent changes to the main distribution of MAME. This version is current and maintained frequently.

Download and untar sdlmame, open the makefile in your favorite text editor and configure it to fit your system. here's a small example from the makefile:

# specify build options; see each option below
# for details

# uncomment one of the next lines to build a target-optimized build
# ATHLON = 1
# I686 = 1
# P4 = 1
PM = 1
# AMD64 = 1
# G4 = 1
# G5 = 1
# CELL = 1  

By default PM is defined, which is ok for most machines, I686 should be ok for most configurations as well. When the makefile is all done, compile, install and configure sdlmame. Note that sdlmame does not name your mame bin just "mame" it adds the optimization prefix after mame, with the default makefile it would generate a bin named mamepm. To avoid confusion just throw the compiled mame files into a dir and make a symlink named mame in /usr/bin/ pointing to your optimized bin.

The default sdlmame configuration resides in ~/.mame/mame.ini, here is an example (you might want to change directories, resolution, etc):

# Paths
rompath                   /usr/storage/other/mame/roms
samplepath                /usr/storage/other/mame/samples
artpath                   /usr/storage/other/mame/artwork
ctrlrpath                 /usr/storage/other/mame/ctrlr
inipath                   /usr/storage/other/mame/ini
fontpath                  .
cfg_directory             /usr/storage/other/mame/cfg
nvram_directory           /usr/storage/other/mame/nvram
memcard_directory         /usr/storage/other/mame/mem
input_directory           /usr/storage/other/mame/inp
state_directory           /usr/storage/other/mame/sta
snapshot_directory        /usr/storage/other/mame/snap
diff_directory            /usr/storage/other/mame/diff
comment_directory         /usr/storage/other/mame/comments
cheat_file                /usr/storage/other/mame/cheat.dat

autoframeskip             0
frameskip                 0
seconds_to_run            0
throttle                  1
sleep                     1

sound                     1
samplerate                48000
samples                   1
volume                    0

log                       0
verbose                   0

bios                      default
cheat                     0
skip_gameinfo             1

multithreading            1

video                     opengl
numscreens                1
window                    0
maximize                  1
keepaspect                0
unevenstretch             0
effect                    none

filter                    1
prescale                  0
16bpp_texfmt              auto

screen                    auto
aspect                    16:9
resolution                1920x1080
view                      auto
screen0                   auto
aspect0                   16:9
resolution0               1920x1080

switchres                 0
useallheads               0

audio_latency             1

mouse                     0
joystick                  1
steadykey                 0
a2d_deadzone              0.3
digital                   none

readconfig                1

Put your zipped roms into your rompath (defined above) and add a Mame player in MythGame.

Player Name: SDLMame
Type: MAME 
Command: /usr/bin/mame %s
Rom Path: /usr/storage/other/mame/roms

After everything is done go into your newly created player and let it scan through your files. The presentation of your roms will be a bit boring, just showing filenames and no categories this can be fixed with a little bit of mysql magic, time, dedication and MAWS. The rom information resides in the gamemetadata table in your mythtv database, if you just have a few roms it might be ok to edit it by hand, if you got a full set it might be a good idea to make a script to fetch the info from some db like MAWS. An sql file with sane names, year, genre for the 0.114*something* romset semi-ready for import can be fetched here replace the dirs so it match your systems. Please don't use this if you don't have any experience with mysql, also i cannot be held be responsible for any damage it might do --alt-f4 08:27, 8 June 2007 (UTC). There is another way to get sane names etc with romdb, but it's outdated and the names/genres doesn't reflect the "real" ones in MAWS.

i knocked up this script to insert lines from the mameinfo.sql into the myth database based on the roms you have available. CAUTION, it will delete all existing entries so check it before you run it. (you'll need to fix it up for your local environment anyway). You'll also have to modify the mameinfo.sql script to look more like this (I added the column names to put the data into. not sure if its perfect but it seems to work ok for me):

INSERT INTO gamemetadata (system, romname, gamename, genre, year, gametype, favorite, rompath, country, diskcount, publisher, crc_value, display, version) VALUES ('mame','005.zip','005','Maze / Shooter Small','1981','Sega',NULL,'/usr/lib/games/xmame/roms','MAME','1','Unknown','d123fe67','1','0');

script follows:


# you'll need to put your path in to mame roms, and also change the mysql password to your password

# first clear the table of old rom info
echo "delete from gamemetadata where system='mame'" | mysql --user=mythtv --password=password mythconverg

# for each rom, find its sql in the file and insert the relevant line
for i in /usr/lib/games/xmame/roms/* ;
  romname=`basename "$i"`
  if grep -q "$romname" /home/mythtv/mameinfo.sql
      grep -m 1 "$romname" /home/mythtv/mameinfo.sql | mysql --user=mythtv --password=password mythconverg

To be able to quit out of sdlmame using lirc, you can run the irexec daemon and put the following in ~/.lircrc

#this kills mame - not pretty, but it does the job as SDLMame does not support lirc
    prog = irexec
    button = ESC
    config = killall mame


Homepage: http://x.mame.net/download.html

Version: 0.106

Install xmame from source or your distro's binary installer

All xmame settings can be controlled from the ~/.xmame/xmamerc file. You might have to play around with your xmamerc (or in the case of the SDL version, xmame-SDLrc). See the xmame docs. Run xmame with --showconfig to see your current configuration. At a minimum, set the following:

video-mode              1
fullscreen              1
sound                   1
skip_disclaimer         1
skip_game_info          1

### set the following to the actual paths to your xmame files
rompath                 /usr/emulators/xmame/roms          #zipped rom images from arcade games
cfg_directory           /home/mythtv/.xmame/cfg        #files to store joystick setup per game
nvram_directory         /home/mythtv/.xmame/nvram      #in game setting and highscore data
memcard_directory       /home/mythtv/.xmame/mem        #memory card directory for games that use it
hiscore_directory       /home/mythtv/.xmame/hi         #highscore data per game
snapshot_directory      /usr/emulators/xmame/snap          #directory for screenshots
cheat_file              /usr/emulators/xmame/cheat.dat
hiscore_file            /usr/emulators/xmame/hiscore.dat
history_file            /usr/emulators/xmame/history.dat
mameinfo_file           /usr/emulators/xmame/mameinfo.dat

### if using a joystick
joytype                 1
analogstick             1
### set to the name of your js device
joydevname              /dev/js
### to enable mouse support
mouse                   1

The above paths should be changed to reflect the paths on your system. You can download cheat.dat (unlock some game cheats), hiscore.dat (save game highscores between playing), history.dat (show tips / tricks / and game histroy in the user menu), and mameinfo.dat (shows emulation information in the user menu) files to unlock their features in mame. These files can be downloaded from links at www.mame.net

Remember to place the .zip files for your ROMS into your roms directory. Do not unzip them, MythGame will scan for the game names in your roms folder and add them correctly to MythGame. For your screenshots to appear correctly, make sure they have the same name as the mame rom.

With all your paths setup, test xmame at a prompt:

xmame <romname>

If all goes well, xmame should start fullscreen with the rom you specified. Verify that all the controls work, and you hear sound. If something does not work, review your xmamerc file, the path information above, and read the xmame docs and the Mame FAQ.

When satisified, configure MythGame as follows:

Player Name: XMAME
Type: MAME 
Command: xmame %s
Rom Path: /usr/emulators/xmame/roms

Answers to questions related to how to play mame can be found here: http://www.mame.net/mamefaq.html

Sega: MegaDrive/Genesis


Homepage: http://pknet.com/~joe/dgen-sdl.html

Version: 1.23

Note: compiling of the source from the above website has failed on at least one system. Using your distribution's packaged version is highly recommended.

Player Name: MegaDrive
Type: OTHER 
Command: dgen -f -G 800x600 -j
Rom Path: /usr/emulators/megadrive/roms


Homepage: http://www.xe-emulator.com

Xe is a very good Genesis/MegaDrive emulator. It emulates many other platforms, too. See the SNES entry for a complete write-up, including information on the command-line options. The command is identical for all platforms; Xe determines the platform by analyzing the ROM.

Player Name:  Xe (Genesis/MegaDrive)
Command:  /usr/local/bin/xe --region 1 --fullscreen --render 1 --joystick1
Rom Path:  /path/to/megadrive/roms

Sega: Master System/Mark III


Homepage: http://www.xe-emulator.com

Xe is a very good Master System/Mark III emulator. It emulates many other platforms, too. See the SNES entry for a complete write-up, including information on the command-line options. The command is identical for all platforms; Xe determines the platform by analyzing the ROM.

A valid ROM dump needs to be placed in /usr/local/lib/xe/bios/ or ~/.xe/bios/ in order for Xe to emulate a Master System/Mark III machine. The file needs be named mark3-j.rom for a Japanese ROM, mark3-u.rom for a United States ROM, or mark3-e.rom for a European ROM.

Player Name:  Xe (Master System/Mark III)
Command:  /usr/local/bin/xe --region 1 --fullscreen --render 1 --joystick1
Rom Path:  /path/to/mark3/roms

Sega: Game Gear


Homepage: http://www.xe-emulator.com

Xe also works as a Game Gear emulator. It emulates many other platforms, too. See the SNES entry for a complete write-up, including information on the command-line options. The command is identical for all platforms; Xe determines the platform by analyzing the ROM.

Player Name:  Xe (Game Gear)
Command:  /usr/local/bin/xe --region 1 --fullscreen --render 1 --joystick1
Rom Path:  /path/to/gamegear/roms



Homepage: http://www.epsxe.com/

Version: ?

Install for linux is straightfoward when one follows this howto (link is down, but can be accessed from the internet archive.)

 As the howto link is down, here is what the script (start_epsxe) should look like:
 export EPSXE='/usr/local/games/PS1'
 cd $EPSXE
 ./epsxe -nogui -loadiso $1
 chmod 666 $EPSXE/cfg/*.cfg $EPSXE/sstates/* \
 $EPSXE/memcards/*.mcr $EPSXE/snap/* 2>/dev/null
 Note: the script already has the changes noted below

To make this work with MythGame a few changes have to be made:

The script suggested at step 10 needs a slight modification:

change this line -- ./epsxe to this -- ./epsxe -nogui -loadiso $1

This will allow you to run iso/bin files from within MythGame, however, it won't work for loading cds.

In addition, to get nice fullscreen, I found it better to set the resolution to your screens resolution worked better than choosing fullscreen.

Finally, do look into using the joypad plugin. This is especially true if you will be using a joystick.

Player Name: ePSXe
Type: OTHER 
Command: /usr/local/bin/start_epsxe
Rom Path: /usr/emulators/ps1/roms

NEC: PC-Engine/Turbo Grafx 16


Homepage: http://www.xe-emulator.com

Xe works just fine as a PC-Engine/Turbo Grafx 16 emulator. It emulates many other platforms, too. See the SNES entry for a complete write-up, including information on the command-line options. The command is identical for all platforms; Xe determines the platform by analyzing the ROM.

Player Name:  Xe (PC-Engine/Turbo Grafx 16)
Type:  PCE
Command:  /usr/local/bin/xe --region 1 --fullscreen --render 1 --joystick1
Rom Path:  /path/to/pce/roms

OTHER: LaserDisc Arcade Games


Homepage: http://www.daphne-emu.com

Version: 0.99.7

Daphne emulates a plethora of LaserDisc arcade games (originally Dragon's Lair and Space Ace, but now a great many others). The latest version now emulates Dragon's Lair II.

Because of its complex nature, Daphne's command-line structure will not fit neatly into MythGame's architecture. It looks like the best way to get Daphne to work in MythGame is to create a script for each game, store the scripts in a directory, and point MythGame to that directory.

In order to use Daphne, you will need the following:

  • the Daphne emulator
  • ROM dumps from the game(s) to emulate
  • one of the following:
    • a LaserDisc player with the approriate LaserDisc for the game(s)
    • MPEGs and framefiles for the game(s)

To begin, download Daphne. Then, switch to an appropriate directory and unzip it (switch to root if necessary):

$ cd /path/to/my/games
$ tar xvfz daphne-0.99.7-linux.tar.gz

The tar file contains the Daphne executable, some support libraries, and the required directory structure to make Daphne's execution simpler. The directory structure looks something like this:

  • Daphne root
    • framefile holds the framefiles required for MPEG playback
    • images holds screenshots used in the Windows loader
    • pics holds various bitmaps needed by the emulator
    • roms holds the ROMs required for each emulated game
    • sound holds various sounds needed by the emulator

If using MPEGs and framefiles for Daphne, add an additional directory:

  • Daphne root
    • mpeg to store the MPEGs for the games

For MythGame support, add one more directory:

  • Daphne root
    • scripts to store the scripts to start each game

Visit the Daphne web site for information on creating the MPEG's and framefiles if needed. By storing all of the MPEGs in a common directory, the framefiles can look as follows:

886 dlair.m2v

After placing the files in their appropriate places, create a script for each game. Here is a sample script to run Dragon's Lair:


$DAPHNE $GAME vldp -framefile $FRAMEFILE -fullscreen -useoverlaysb 2

The command-line switches that are used in this script are as follows:

  • vldp tells Daphne to use its Virtual LaserDisc Player to play MPEG files (as opposed to using a real LaserDisc player, which also is possible).
  • -framefile $FRAMEFILE is a required flag when using the VLDP. It tells Daphne which framefile to use (it automatically looks in the framefile directory - no need to include the directory).
  • -fullscreen, of course, tells Daphne to run in fullscreen mode.
  • -useoverlaysb 2 tells Daphne to display the scoreboard as an overlay atop the MPEG video. Change the value to 1 to eliminate the LED shadows in the display.
    • Note: This flag is valid only with Dragon's Lair, Space Ace, and Thayer's Quest. Remove it from scripts for other games! Using it with other games will cause Daphne to fail.

The only values that need to be changed in this script for each game are the GAME variable and the FRAMEFILE variable. For the current version of Daphne, the following values for GAME are valid:

  • astron Astron Belt (Hitachi)
  • astronp Astron Belt (Pioneer)
  • badlands Badlands
  • bega Bega's Battle
  • cliff Cliff Hanger
  • cliffalt Cliff Hanger (alternate ROM set)
  • cobraab Cobra Command (on Astro Belt hardware)
  • cobram3 Cobra Command (on MACH3 hardware)
  • lair Dragon's Lair (U.S. ROM revision F2)
  • lairalt Dragon's Lair (U.S. ROM revisions A through D)
  • dle11 Dragon's Lair (U.S. Enhancement 1.1 L)
  • dle2 Dragon's Lair (U.S. Enhancement 2.x)
  • lair2 Dragon's Lair II: Timewarp
  • esh Esh's Aurunmilla
  • galaxy Galaxy Ranger
  • gtg Goal to Go
  • mach3 MACH 3
  • roadblaster Road Blaster
  • ace Space Ace (U.S. ROM revision A3)
  • sae Space Ace (U.S. Enhancement 1.0)
  • blazer Star Blazer
  • sdq Super Don Quix-ote
  • sdqshort Super Don Quix-ote (short scenes version)
  • tq Thayer's Quest
  • uvt Us vs. Them

Make a copy of the above script for each game to emulate, and name it appropriately (e.g. Dragons_Lair.sh). Be sure to give executable rights to everyone for these files:

$ chmod a+x *.sh

After creating the scripts, test them. For example,

$ cd /path/to/daphne/scripts
$ ./dragons_lair.sh

Once the scripts are ready, add a player to MythGame:

Player Name:  Daphne
Type:  OTHER
Command:  %s
Rom Path:  /path/to/daphne/scripts

Have MythGame scan for games, and each script that exists in the /path/to/daphne/scripts directory will appear as a separate entry in the game list.

In a setup with multiple frontends, all of the files can be placed on a file server (including the executables) and shared via NFS. This setup works just fine.

More Emulators...

Following are alternate emulators. Additional instructions are encouraged so if you get one of these working please update this document.





Multiple Systems

  • Mednafen Atari Lynx, GameBoy, GameBoy Color, GameBoy Advance, NES, PC Engine(TurboGrafx 16), and SuperGrafx
  • Xmess (Many Sytems...)

Remote Control Integration

It's very convenient to use your remote, and not a keyboard, to exit an emulator in MythGame. Most of the emulators do not support lirc natively. They also will not work with lirc's irexec because the emulators use SDL, ignoring all X11 key events. Fortunately through a combination of programs it's possible to have your remote trigger SDL key events the emulators respond to.

The instructions below pertain to specific emulators. The process is easily extended to other emulators though. Two examples are provided to aid understanding.

Note: irexec is used to invoke an external command. Thus you can not use irexec to control MythTV; instead use MythTV's native support for lirc.

Base Requirements

xmacro can send events understood by SDL programs (such as the emulators). It's xmacroplay-keys program is used to send an escape key event. You must install it; check your distribution for a precompiled package (ie, apt-get install xmacro).

lirc's irexec is used to capture remote events and invoke xmacroplay-keys. Add the following to your .lircrc:

   prog = irexec
   button = Exit
   repeat = 0
   config = xmacroplay-keys :0 Escape

Note: change the above Exit button to whatever mapping/button you want to use on your remote to exit the emulator.

irexec can't be running all the time or it and MythTV will respond to remote events causing Escape to be invoked inside MythTV twice. You have three options here.

The first is to start irexec immediately before running an emulator and kill irexec when the emulator exits. The scripts in the next section do exactly this. This will allow you to handle multiple keypress codes in addition to Escape in your emulator

The second option is that you create a script which kills all your emulators when you press Cancel on the remote. This will only allow you to exit the emulators when pressing Cancel.


   killall mupen64_nogui
   killall zsnes
   killall fceu

then you add to your to your .lircrc:

   prog = irexec
   button = Exit
   repeat = 0
   config = emukill.sh

with this option you don't need to create a script for every emu, only one to kill the emu's. But be aware, not every emu can be exited so, but you can try to add a -9 to killall wich exits the emu in every case. Also, killing an emulator instead of exiting it will often result in saved game data not being saved to disk.

The third option, and possibly the most flexible is to write a wrapper script around xmacroplay, which will only send the keypresses from the remote if the emulator is running. When the emulator is not running, the keypresses will be ignored. This allows you to keep irexec running all the time, and use it for other purposes in addition to controlling your emulators.

Code for xmacro-wrap


    # This checks if an emulator is running
    # Insert your emulator commands as well
    if ps ax | egrep -q ' (snes9x|sdlmame|fceu|xe|zsnes|mupen64_nogui)'; then 
       echo "KeyStr $1" | xmacroplay :0

Your .lircrc will now look like

        prog = irexec
        button = Exit
        repeat = 0
        config = xmacro-wrap Escape

        prog = irexec
        button = Enter
        repeat = 0
        config = xmacro-wrap Return


Enter the following script as snes.sh:

   # zsnes path + executable
   # irexec path + executable
   # irexec process name to kill
   $IREXEC &
   $ZSNES -m "$1"
   killall $IREXEC_PS
   exit 0

Adjust the paths and executables along with any arguments to zsnes (-m above). In the MythGame player's setup invoke the above script instead of zsnes directly.


Enter the following script as nes.sh:

   # fceu path + executable
   # irexec path + executable
   # irexec process name to kill
   $IREXEC &
   $FCEU -fs 1 -input1 -gamepad -no8lim 1 "$1"
   killall $IREXEC_PS

Adjust the paths and executables along with any arguments to fceu (-fs 1 -input1 -gamepad -no8lim 1 above). In the MythGame player's setup invoke the above script instead of fceu directly.


The xmame project has supported lirc natively since version 0.90. Unfortunately xmame only understands keymap values. For instance, the Escape key has a keymap value of 1. Entries will need to be added to your .lircrc file as follows:

# Esc - exit
prog = xmame
button = Back-Exit
repeat = 0
config = 1

You can view the keymap values in the xmame source (xmame-<ver>/src/unix/keycodes.h) Some example keys that would be useful to map to a remote key are below

key   keycode  function
ESC   1        Exit Emulator
UP    103      Navigate GUI
DOWN  108
LEFT  105
1     2        Start Player 1
2     3        Start Player 2
5     6        Add Coin Player 1
6     7        Add Coin Player 2
Tab   15       Open in game menu GUI
Enter 28       OK/Enter in menu
P     25       Pause game
F3    61       Reset game
~     41       OSD for Volume, gamma, etc.
F9    67       Increase Frame Skipping
F8    66       Decrease Frame Skipping
F11   87       Show/Hide Frame Skipping info

Note: In practise, a remote is too slow to play arcade games but it is useful for exiting the emulator with the (ESC) or back key.

  • Set "lirc 1" in xmamerc
  • Edit your .lircrc file to add entries for xmame.

Joystick or Gamepad Integration

Linux has support for gamepads and joysticks through the joydev driver which usually comes standard with most distros.

To calibrate a joystick which will fix centering problems, install the joystick package "yum install joystick" and run jstest /dev/js0 to figure out which axes were which; then

jscal -c /dev/js0

to calibrate the axes. You can ignore the output of jscal -t /dev/js0, which may insist that your joystick is not calibrated. After double-checking the calibration, play a few games then run jscal -p /dev/js0 to print out a command line with the current calibration.


  • Your input device may be something other than /dev/js0, for example /dev/input/js0 for FC distros.
  • Check the calibration first, it may not need changing.


QJoyPad takes input from a gamepad or joystick and translates it into key strokes or mouse actions, letting you control any XWindows program with your game controller.

It has a very nice interface for creating layouts for each application. When invoked from the command line with a layout name it starts it with that layout active if it's not already started or makes that layout active if it has been started.

Create a layout for each emulator and one for mythfrontend. In your mythtv user startup set it to the mythfrontend layout. Use wrapper scripts for each emulator setting the QJoyPad active layout to the one for that game and setting it back to the mythfrontend layout afterwards. Change the Game Players in MythGame to use the wrapper scripts instead of starting the emulators directly.

Tested with:
SDLMAME - insert coin, one player start, pause and exit assigned to joystick buttons
ZSNES - save state, load state, pause and exit assigned to joystick buttons
mythfrontend - cursor up, down, left and right, enter and escape assigned to joystick buttons

Can now select games, play games, exit games with only the joystick :-)



There are 5 joystick types for the joytype switch in xmamerc as of version 0.88

  • 0 No joystick
  • 1 Linux i386 joystick (version 1.x.x)
  • 2 Town Pad gamepad
  • 3 BSD USB joystick
  • 4 PS2 joystick
  • 5 SDL joystick interface

you also need to make sure the device is correct. In Ubuntu 6.10, the joysticks appear as /dev/input/js0 etc, however xmame assumes they are in /dev/js. To make it work, add -jdev /dev/input/js to the end of command string.

Nintendo: SNES


If you are interested in using SNES9x with a joystick, please read about the -joydev and -joymap command line options. In addition, if you have the luxury of building snes9x from source, Reboot's joyaxisX patch is an excellent and necessary addition to the program.

Nintendo: Game Boy Advance & Game Boy

Visual Boy Advance

You then need to edit the VisualBoyAdvance.cfg to edit your Joystick settings. If you want to change it, you can get a program called SDL Configurator from the VisualBoyAdvance downloads page to get the correct settings for your joystick: http://vba.ngemu.com/downloads.shtml


Joystick configuration is both easy and confusing at the same time. Once you have the emulator running hit the F3 key, you should get a prompt for button A that looks like this:

pad: A (1)

Simply hit the button on your control pad that you want to be button A. You will then get a prompt for button A on another control pad, this is where it can get confusing. If you don't want to setup another button on your keyboard or another/same control pad wait a couple of seconds and hit your button for A again, it should progress to B, if not wait another second or two and hit your button for A another time. Be patient and you'll get used to the input method. You can program up to four control pads this way. All the buttons (including directional) are accounted for this way, plus two buttons for rapid fire. Mednafen should remember your settings next time you enter the program.

List of Gamepads and Joysticks

Manufacturer Model # Linux Distro drivers required Works with: Comments
Logitech Wireless Rumblepad 2 FC3 & 5, KnoppMyth <=R5C7 usb, joydev xMame, FCEU, Mupen64, ZSNES, VisualBoyAdvance, ePSXe (with plugin), gens Setup was easy, "modprobe joydev", plugin in the gamepad receiver and check to see it was regcognized by a "Rumblepad 2" line in the /var/log/messages file. Then cat /dev/input/js0, move a stick, and see if gibberish (### # 3# #### #) is printed. Then in xmamerc, "joytype 1", "analogstick 1", "joydevname /dev/input/js0" (or /dev/input/js if you have multiple joysticks). Once in xmame, hit TAB to redefine the keys to the joystick keys (hit enter and hold the joystick button until recognized). The rumblepad had two joysticks which can be used by different players. Calibration wasn't needed and xMame doesn't support vibration. I haven't tried other gamepads, but the rumblepad is very responsive with lots of buttons for extras (like pause, etc.) It really helps that it is wireless too.
Logitech Dual Action FC5 joydev xmame Setup was easy, except xmame defaults all the keys/buttons on the pad to nothing that triggers insert coin and start. So I read http://www.mameworld.net/easyemu/mameguide/mamecontrolini.htm - this explained how to make a XML file to override some of the buttons so I could enable coin/start on my controller pad, since my myth box is completely keyboardless. I used basically the same as the wireless rumble pad posted, but I added "ctrlr_directory" to my xmamerc, and then dropped in a Defaults.cfg which did the button remapping I needed to keep my myth box keyboard-free.
Gravis GamePad Pro The Gravis GamePad Pro correctly maps as follows: -joydev1 /dev/js0 -joymap1 2 1 3 0 4 5 9 8 This assumes that your GamePad Pro mounts at /dev/js0.
(Please add your example Hardware stats here!)