Configuring MythGame Emulation

From MythTV Official Wiki
Revision as of 21:31, 19 April 2008 by Slayer722 (talk | contribs) (added pSX playstation emulator)

Jump to: navigation, search

Important.png Note: These instructions were originally written specifically for MythGame v0.19, but have been verified to work for MythGame v0.20.2.

(MythGame 0.18 instructions may be found here.)

This document covers configuration of MythGame after it is installed; compilation and installation are not covered.


Important.png Note: Note that the term player refers to the emulator software (ie, xmame) and not the human playing the games.


Introduction

See the MythGame overview to answer what is MythGame.


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/nes/roms
/usr/emulators/snes/roms
/usr/emulators/gba/roms
/usr/emulators/n64/roms
/usr/emulators/gcube/roms
/usr/emulators/amiga/roms
/usr/emulators/amiga/chip   (For the Kickstart Image)
/usr/emulators/atari_lynx/roms
/usr/emulators/megadrive/roms
/usr/emulators/xmame/roms

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.

Screenshots

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

  png
  gif
  jpg
  jpeg
  xpm
  bmp
  pnm
  tif
  tiff

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.

Single-System Emulators

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"

Atari: VCS/2600

Stella

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: /path/to/atari/lynx/roms

Mednafen

Homepage: http://mednafen.sourceforge.net/

Version: 0.8.5

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
Type: OTHER
Command: mednafen -lynx.stretch 1 -fs 1 -vdriver 0 %s  (vdriver 0 is for OpenGL, if you prefer SDL surface blits use 1)
Rom Path: /path/to/atari/lynx/roms


Bandai: Wonderswan (Color)

Mednafen

Homepage: http://mednafen.sourceforge.net/

Version: 0.8.5

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
Type: OTHER
Command: mednafen -wswan.stretch 1 -fs 1 -vdriver 0 %s  (vdriver 0 is for OpenGL, if you prefer SDL surface blits use 1)
Rom Path: /path/to/wswan/roms


Commodore: Amiga

E-UAE

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+
Type: AMIGA

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+
 chipset=ecs
 kickstart_rom_file=/path/to/your/kickstart_roms/kickstart2.0.rom
 chipmem_size=2
 bogomem_size=0
 gfx_width_windowed=720
 gfx_height_windowed=576
 gfx_width_fullscreen=720
 gfx_height_fullscreen=576
 gfx_fullscreen_amiga=true
 joyport1=joy1
 #sdl.use_gl=true


2. A1200 setup using a config file:


Add a new player in MythGame's setup:

Player Name: Amiga 500+
Type: AMIGA

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
 cpu_type=68020
 cpu_speed=max
 cachesize=8192
 chipset=aga
 kickstart_rom_file=/path/to/your/kickstart_roms/kickstart3.1.rom
 chipmem_size=4
 bogomem_size=0
 gfx_width_windowed=720
 gfx_height_windowed=576
 gfx_width_fullscreen=720
 gfx_height_fullscreen=576
 gfx_fullscreen_amiga=true
 sound_output=normal
 joyport1=joy1
 #sdl.use_gl=true

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

X-Fellow

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

Additional details needed.

Original UAE

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

Version: 0.8.23

Additional details needed.


Commodore: C64

VICE

Homepage: http://www.viceteam.org

Version: 1.22

VICE emulates many (if not all) of the Commodore 8-bit computers. VICE is not an ideal MythGame player due to necessary keyboard usage, but for those who are comfortable with "38911 BASIC BYTES FREE" it as welcome as any other emulator.

C64 setup:

Add a new player in MythGame's setup:

Player Name: C64
Type: OTHER 
Command: x64
Rom Path: /path/to/your/c64/disks/
Span Disks: no
File Extensions (optional): d64,zip


LaserDisc Arcade Games

Daphne

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:

..\mpeg
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:

#!/bin/bash
DAPHNE=/path/to/daphne
GAME=lair
FRAMEFILE=dlair.txt

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


NEC: PC-Engine/Turbo Grafx 16

Xe

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

Nintendo DS

DeSmuME

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


Mednafen

Homepage: http://mednafen.sourceforge.net/

Version: 0.8.5

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
Type: OTHER
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

Xe

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

Gcube

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

NOTE: gcube is no longer being developed and as of Jan-2008 it is not even available for download on its own web site.

Version: 0.4

You must compile gcube from source.

Download gcube source here http://www.mirrorservice.org/sites/ftp.freebsd.org/pub/FreeBSD/distfiles/gcube-0.4-src.tar.bz2. Then extract the source.


Then you should patch the file config.c by adding the Line

	config.texcache_size = DEFAULT_TEXCACHE_SIZE;

on line 172 under the line

	config.buffer_size = DEFAULT_BUFFER_SIZE;

Compile it with:

make

Move gcube to /usr/local/bin/gcube/

Then just copy gcube into your $PATH

export PATH="/usr/local/bin/gcube/:$PATH  

Add a new player in MythGame's setup:

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

TuxCube

Homepage: http://www.tuxemu.se.nu/

NOTE: They try to continue the canceled gcube Project.

Version: pre1 (I think it's based on gcube 0.4)

Add a new player in MythGame's setup:

Player Name: TuxCube
Type: OTHER
Command: tuxcube
Rom Path: /usr/emulators/gcube/roms

Nintendo: NES

NEStopia

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

Hopefully this patch will be included in the PR #6 release, but until then, to apply this patch, download it, cd to the NEStopia source directory and apply the patch via this command:

$ patch p1 < /path/to/patchfile/Nestopia137.linux.controls.patch

Compile, then copy the nst and gennstcontrols executables to /usr/local/bin (or whereever you want). Run the following to generate an nstcontrols file:

$ gennstcontrols > ~/.nestopia/nstcontrols

Warning: This will overwrite your current nstcontrols file so you may want to back it up first

fce-ultra

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)

Mednafen

Homepage: http://mednafen.sourceforge.net/

Version: 0.8.5

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
Type: OTHER
Command: mednafen -nes.stretch 1 -fs 1 -vdriver 0 %s  (vdriver 0 is for OpenGL, if you prefer SDL surface blits use 1)
Rom Path: /path/to/nes/roms

Xe

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

Other

  • SDLMESS. See section under Multi-System Emulators.
command: mess nes -cart %s

Nintendo: N64

Mupen64Plus

Homepage: http://code.google.com/p/mupen64plus

Version: 1.3

Mupen64Plus is a plugin-based N64 emulator for Linux which is capable of accurately playing many games. Included are four MIPS R4300 CPU emulators, with dynamic recompilers for 32-bit x86 and 64-bit amd64 systems, and necessary plugins for audio, graphical rendering (RDP), signal co-processor (RSP), and input. There are 3 OpenGL video plugins included: glN64, RiceVideoLinux, and Glide64.

Mupen64Plus was originally started by NMN, and is based on Mupen64. While Mupen64 has not had a release since 2005, development on Mupen64Plus is active with releases every few months and support provided for all included plugins. Also, at least one of the developers is a MythTV user, so it has some MythTV-friendly features that Mupen64 does not, e.g. LIRC support, --nogui option, etc.

To install Mupen64Plus from binary, download either the 32-bit or 64-bit binary zip file from the project homepage. The following example shows installing the 32-bit binary:

$ wget http://mupen64plus.googlecode.com/files/Mupen64Plus-1-3-bin-32.zip
$ unzip Mupen64Plus-1-3-bin-32.zip
$ cd Mupen64Plus-1-3-bin-32
$ su
# ./install.sh
# exit
$

To build mupen64plus from source:

$ wget http://mupen64plus.googlecode.com/files/Mupen64Plus-1-3-src.zip
$ unzip Mupen64Plus-1-3-src.zip
$ cd Mupen64Plus-1-3-src
$ make all
$ su
# make install
# exit
$

Note: The binary version of Mupen64Plus does not come with LIRC support built-in. To get LIRC support, you must build from source and pass "LIRC=1" to make. For details, see this wiki page:

http://code.google.com/p/mupen64plus/wiki/LIRC

Run mupen64plus and use the configuration menu to setup graphics and audio plugins and configure controllers.

Add a new player in MythGame's setup:

Player Name: N64
Type: N64
Command: mupen64plus --nogui --fullscreen --noask
Rom Path: /path/to/n64/roms

Mupen64

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.

Then edit configure in line 148(remove \\n)

From: echo "int main(void) { if (SDL_Init( 0 ) < 0) { printf( \"SDL_Init(): %s\\n\", SDL_GetError() ); return 1; } return 0; }" >> "$FILE"
TO echo "int main(void) { if (SDL_Init( 0 ) < 0) { printf( \"SDL_Init(): %s\", SDL_GetError() ); return 1; } return 0; }" >> "$FILE"


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

mupen64.conf

[Default]
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)

note: You can also try using the guide for the amd64, even if you are using a x86 platform.

Nintendo: SNES

ZSNES

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


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

(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

SNES9x

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

I don't believe there is a -fs or -tr option for snes9x. If there is... I couldn't find via google so please state a source.

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.

Xe

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.



Sega: Master System/Mark III

Xe

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)
Type:  SEGA/MASTER SYSTEM
Command:  /usr/local/bin/xe --region 1 --fullscreen --render 1 --joystick1
Rom Path:  /path/to/mark3/roms


Sega: MegaDrive/Genesis

DGENS/SDL

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

Xe

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)
Type:  GENESIS/MEGADRIVE
Command:  /usr/local/bin/xe --region 1 --fullscreen --render 1 --joystick1
Rom Path:  /path/to/megadrive/roms


Sega: Game Gear

Xe

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)
Type:  GAMEGEAR
Command:  /usr/local/bin/xe --region 1 --fullscreen --render 1 --joystick1
Rom Path:  /path/to/gamegear/roms


Sega: Saturn

Yabause

Homepage: http://yabause.org/

Yabause is a Sega Saturn emulator under GNU GPL. It currently runs on FreeBSD, GNU/Linux, Mac OS X and Windows. It is also ported to the Sega Dreamcast as a separate project : Yabause-dc.

Yabause support booting games using Saturn cds or iso files.

Player Name:  Yabause
Type:  OTHER
Command:  yabause -f -i %s -a
Rom Path:  /path/to/sega/saturn/roms


Sony: Playstation

ePSXe

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:
 ----
 #!/bin/bash
 export EPSXE='/usr/local/games/PS1'
 export LD_LIBRARY_PATH=$EPSXE
 cd $EPSXE
 ./epsxe -nogui -loadiso $1
 chmod 666 $EPSXE/cfg/*.cfg $EPSXE/sstates/* \
 $EPSXE/memcards/*.mcr $EPSXE/snap/* 2>/dev/null
 ----


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:  /path/to/sony/playstation/roms

pSX

Homepage: http://psxemulator.gazaxian.com/

This emulator fully emulates the Sony Playstation. Compatibility is fairly high, most games I've tried work well.

pSX support booting games using Playstation cds or iso files.

Player Name:  pSX
Type:  OTHER
Command:  pSX -f %s
Rom Path:  /path/to/sony/playstation/roms


StepMania (DDR)

Homepage: http://www.stepmania.com

The following assumes StepMania is installed in /storage/games/PC/StepMania. Mythgame will scan for "ROMs" in a subdir we'll create, but the only ROM in there will be a small script to launch StepMania.

Player Name:  StepMania
Type:  OTHER
Command:  <blank>
Rom Path: /storage/games/PC/StepMania/mythtv
Working Directory: /storage/games/PC/StepMania/

Then place the following script in a file called /storage/games/PC/Stepmania/mythtv/StepMania:

#!/bin/bash
/storage/games/PC/StepMania/stepmania 

Then scan for games. Alternatively you can create the same file above and place the following in mainmenu.xml:

<button>
       <type>GAME</type>
       <text>Stepmania</text>
       <action>EXEC /storage/games/PC/StepMania/stepmania</action>
</button>


More Emulators...

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

PSX:

PS2

GameBoy:

DreamCast


Multiple-System Emulators

Mednafen

Homepage: Mednafen

Systems: Atari Lynx, GameBoy, GameBoy Color, GameBoy Advance, NES, PC Engine(TurboGrafx 16), and SuperGrafx

SDLMAME

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

Systems: (Many Arcade Systems...)

SDLMAME is a current, maintained implementation of the XMAME project which has an uncertain future.

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

# CORE PERFORMANCE OPTIONS
autoframeskip             0
frameskip                 0
seconds_to_run            0
throttle                  1
sleep                     1

# CORE SOUND OPTIONS
sound                     1
samplerate                48000
samples                   1
volume                    0

# CORE DEBUGGING OPTIONS
log                       0
verbose                   0

# CORE MISC OPTIONS
bios                      default
cheat                     0
skip_gameinfo             1

# PERFORMANCE OPTIONS
multithreading            1

# VIDEO OPTIONS
video                     opengl
numscreens                1
window                    0
maximize                  1
keepaspect                0
unevenstretch             0
effect                    none

# OpenGL-SPECIFIC OPTIONS
filter                    1
prescale                  0
16bpp_texfmt              auto

# PER-WINDOW VIDEO OPTIONS
screen                    auto
aspect                    16:9
resolution                1920x1080
view                      auto
screen0                   auto
aspect0                   16:9
resolution0               1920x1080

# FULL SCREEN OPTIONS
switchres                 0
useallheads               0

# SOUND OPTIONS
audio_latency             1

# INPUT DEVICE OPTIONS
mouse                     0
joystick                  1
steadykey                 0
a2d_deadzone              0.3
digital                   none

# CONFIGURATION OPTIONS
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.

One such script is available at http://www.csc.kth.se/~ol/mame2myth.py. It also supports some basic filtering. Usage:

  1. Let MythTV scan for available roms.
  2. Follow the instructions in the script file.
  3. Execute the resulting SQL code on the mythtv database.

--Oskar 15:25, 20 July 2007 (UTC)

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:

#!/bin/bash

# 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/* ;
do
  romname=`basename "$i"`
  if grep -q "$romname" /home/mythtv/mameinfo.sql
  then
      grep -m 1 "$romname" /home/mythtv/mameinfo.sql | mysql --user=mythtv --password=password mythconverg
  fi
done

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
begin
    prog = irexec
    button = ESC
    config = killall mame
end


SDLMESS

Systems: (Many Console Systems...)

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

Version: 0.119

  • Download sdlmess119.zip
  • Create destination directory:
$ sudo mkdir /usr/share/games/sdlmess
  • Extract zip to the above dir
  • Compile to produce executable called "mess"
$ cd /usr/share/games/sdlmess
$ sudo make -f makefile.sdl
  • For 64-bit architectures substitute the above make command for the one below.
$ sudo make -f makefile.sdl PTR64=1 //64-bit architectures only.
  • Generate a config file:
$ mess -createconfig
  • Copy the config file to your user directory
$ mkdir ~/.mess
$ cp mess.ini ~/.mess
  • Edit the config file
$ sudo apt-get install leafpad  // lightweight GUI text editor great for mythtv installations
$ leafpad ~/.mess/mess.ini
  • Modify the following paths in the file to point to the sdlmess directory:
rompath    /usr/local/share/games/sdlmess/roms
hashpath   /usr/local/share/games/sdlmess/hash
samplepath /usr/local/share/games/sdlmess/samples
artpath    /usr/local/share/games/sdlmess/artwork
ctrlrpath  /usr/local/share/games/sdlmess/ctrlr
inipath    /usr/local/share/games/sdlmess
fontpath   /usr/local/share/games/sdlmess
  • Create a symbolic link within your path (lets you run it from anywhere)
$ cd /usr/games
$ sudo ln /usr/share/games/sdlmess/mess mess --symbolic
  • Create a directory structure for your ROMs (cpc464 is an example console)
$ sudo mkdir /usr/local/share/games/sdlmess/
$ sudo mkdir /usr/local/share/games/sdlmess/roms/
$ sudo mkdir /usr/local/share/games/sdlmess/roms/cpc464
  • Place BIOS roms straight into the roms dir:
$ mv cpc464.zip /usr/local/share/games/sdlmess/roms/
  • Place game roms in a suitable sub-directory:
$ mv game.dsk /usr/local/share/games/sdlmess/roms/cpc464
  • test by executing mess using the appropriate parameters:
$ cd /usr/local/share/games/sdlmess
$ mess cpc464 -flop1 "roms/cpc464/game.dsk"
  • In MythGame settings, add a Game Player:
Player Name:  cpc464
Type:  MAME
Command:  mess cpc464 -flop1
Rom Path:  /usr/local/share/games/sdlmess/roms/
  • In MythGame settings, Scan for Games.

You should now be able to launch your console games from within MythTV.

Important: To exit back to MythTV, press SCROLL LOCK then ESC

XMAME

NOTE: The XMAME project is falling out of date. See SDLMAME for an up-to-date replacement.

Homepage: http://x.mame.net

Systems: (Many Arcade Systems...)

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

XMESS

NOTE: The XMESS project is falling out of date. See SDLMESS for an up-to-date replacement.

Systems: (Many Console Systems...)

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:

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

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.

emukill.sh

   #!/bin/sh
   
   killall mupen64_nogui
   killall zsnes
   killall fceu

then you add to your to your .lircrc:

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

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

    #!/bin/bash

    # 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.0"
    fi

Your .lircrc will now look like

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

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

ZSNES

Enter the following script as snes.sh:

   # zsnes path + executable
   ZSNES=/usr/bin/zsnes
   
   # irexec path + executable
   IREXEC=/usr/local/bin/irexec
   # irexec process name to kill
   IREXEC_PS=irexec
   $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.


NES

Enter the following script as nes.sh:

   # fceu path + executable
   FCEU=/usr/games/fceu
   # irexec path + executable
   IREXEC=/usr/local/bin/irexec
   # irexec process name to kill
   IREXEC_PS=irexec
   $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.

Xmame

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
begin
prog = xmame
button = Back-Exit
repeat = 0
config = 1
end

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
RIGHT 106
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.

Note:

  • 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.
  • You may need to add the mythtv user to the plugdev group for the USB devices to work under MythGame.


QJoyPad

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

http://qjoypad.sourceforge.net/


xMame

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

SNES9x

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

Mednafen

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, openSUSE 10.2, Ubuntu 7.04 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 openSUSE 10.0, openSUSE 10.1, openSUSE 10.2, Ubuntu 7.04 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!)