blog:retrogaming

Turning Linux Mint 21.x into a Retrogaming Kiosk

Install Mint 21.x

  1. Select language
  2. Select keyboard
  3. Install multimedia codecs
  4. Erase disk and install Linux mint
  5. Select region

When entering a user, use any normal credentials you want, e.g.

  • username 'user'
  • password 'password'

These will be the account you launch the emulator front end with. Ensure you tick the 'log in automatically' option.

Let the install complete, then restart.

A typical Linux desktop comes with services that are not needed for full-screen gaming. You may (optionally) disable these to save a little bit of memory and gain a speed up in startup time.

Open a terminal and disable these:

# Disable services not needed for gaming
sudo systemctl disable apparmor              
sudo systemctl disable blueman-mechanism
sudo systemctl disable colord
sudo systemctl disable cups
sudo systemctl disable cups-browsed
sudo systemctl disable keyboard-setup
sudo systemctl disable ModemManager
sudo systemctl disable openvpn
sudo systemctl disable ufw
sudo systemctl disable evolution-addressbook-factory
sudo systemctl disable evolution-source-registry

These disable the apparmor security service, bluetooth services, colour profile management, printing, modems, VPN and firewall. None of which should be strictly necessary on a gaming system that is not being actively used to browse the internet or run general purpose software.

If you have 8GB+ of memory, I would also suggest disabling swapfile use:

sudo swapoff -a
sudo systemctl disable swapfile.swap
sudo systemctl disable swap.target

Also ensure you have commented out the /swap line in /etc/fstab:

#/swapfile     none   swap sw 0 0

Linux Mint defaults to the Cinnamon desktop, which whilst nice, does take up more system resources than some of the other options. You can change to a more lightweight desktop, such as MATE, as follows:

sudo apt-get install task-mate-desktop
sudo vi /etc/lightdm/lightdm.conf.d/70-linuxmint.conf

In /etc/lightdm/lightdm.conf.d/70-linuxmint.conf, change the entry user-session=cinnamon to user-session=mate. Reboot, and you should auto-login to the MATE desktop instead of Cinnamon.

We don't need many of the auto-launched applications that start after loading the desktop, so you can disable most of these.

Go to Start menu → Preferences → Startup Applications. You can disable all of them unless you specifically need to use this as a normal desktop machine.

As the kiosk user ('user' in the initial setup), create a ~/bin folder to hold your custom software and download Emulation Station Desktop Edition, and ensure that it runs:

cd
mkdir bin
wget https://gitlab.com/es-de/emulationstation-de/-/package_files/101581937/download -O bin/emulationstation
chmod 700 bin/emulationstation
bin/emulationstation

The first time running EmulationStation DE it will ask for the location of your rom directory. This directory you enter must have sub-directories in it named after the supported platforms detailed here. For example:

  • /data/roms
  • /data/roms/arcade
  • /data/roms/gamegear
  • /data/roms/megadrive

Autostart

In your start menu → Preferences → Startup Applications, add EmulationStation:

  1. Click 'Add'
  2. Name is 'EmulationStation Desktop Edition'
  3. Command is:
    /home/user/bin/emulationstation
  4. Comment 'Starts ES DE'

Logging out of the desktop and back in again should automatically launch the application, fullscreen.

Supports:

  • Most arcade games
  • NeoGeo AES/MVS
  • Capcom CPS

First install all of the required packages:

sudo apt-get install git build-essential python3 libsdl2-dev libsdl2-ttf-dev libfontconfig-dev libpulse-dev qtbase5-dev qtbase5-dev-tools qtchooser qt5-qmake

Now you can build MAME from source:

cd
mkdir src/
cd src/
git clone https://github.com/mamedev/mame.git
cd mame
make
strip -s mame
cp mame ~user/bin

This takes a long time, so if you have multiple cores available, add the suffix -j4, -j6, -j8 or more to the make command, depending on the cores/threads available. It still takes quite a while though. You should end up with a mame binary in the current directory of over 400MB.

There are a few bits and pieces from the mame source tree that you need to put in the correct places:

cd
mkdir bin/mame-data/
mkdir .mame/
cd src/mame
cp -a artwork /path/to/your/mame/artwork/directory
cp -a bgfx /user/bin/mame-data

Customisation

Now create the base MAME config files mame.ini and ui.ini:

cd
cd .mame
mame -createconfig

In the newly created mame.ini edit the following options to the values shown:

rompath /path/to/your/mame/roms/directory
samples /path/to/your/mame/samples/directory
artwork /path/to/your/mame/artwork/directory
bgfx    /home/user/bin/mame-data/bgfx
skip_gameinfo 1
video   bgfx
window  0
maximize 1
gl_glsl 1
gl_glsl_filter 0

These should enable fullscreen mode and use the bgfx screen effects to enable old-style CRT emulation.

Supports:

  • Sega Mastersystem
  • Sega Megadrive/CD/32X
  • Sega Saturn
  • Nintendo NES/Famicom
  • Nintendo SNES/Super Famicom
  • Nintendo Gameboy
  • NEC PC-Engine/Turbografx
  • …. plus a load more

First install all of the required packages:

sudo apt-get install zlib1g-dev libasound2-dev libsdl2-dev libflac-dev

Mednafen does not appear to have a public Github repository, but source releases are available on https://mednafen.github.io/releases/:

cd
cd src
wget https://mednafen.github.io/releases/files/mednafen-1.31.0-UNSTABLE.tar.xz
xz -d mednafen-1.31.0-UNSTABLE.tar.xz
tar xf mednafen-1.31.0-UNSTABLE.tar
cd mednafen
./configure --prefix=/home/user
make
strip -s src/mednafen
make install

Customisation

Enable default fullscreen mode and 25% brightness scanlines to get a more authentic look to the display from Mednafen. Be sure to enable scanlines for any system you are using it for (in my case, PC-Engine, Megadrive, SNES, Saturn.

video.fs 1

# PC-Engine
pce.scanlines 25
pce.shader none
pce.special nn2x
pce.stretch aspect

# Megadrive
md.scanlines 25
md.shader none
md.special nn2x
md.stretch aspect

# SNES
snes.scanlines 25
snes.shader goat
snes.special nn2x
snes.stretch aspect

# Saturn
ss.special none
ss.shader goat
ss.scanlines 25
ss.strech aspect

There are optional OpenGL shader effects available, as described in the Mednafen documentation, but my personal preference for the PC-Engine is no shaders and just basic scanlines, or it starts to look a little artificial. On later systems the 'goat' shader can look quite nice.

Supports:

  • Sega Dreamcast

The Redream project release pre-built binaries that are self-contained and just need to be extracted. They do not have any specific requirements listed other than libSDL.

cd
cd bin
wget https://redream.io/download/redream.x86_64-linux-v1.5.0-1080-g1053967.tar.gz -O redream.tgz
tar xfz redream.tgz
chmod 700 redream

Customisation

We need to make a few edits to the redream config file. First create a blank config inside bin:

cd
rm bin/redream.cfg
touch bin/redream.cfg

Now make the following entries:

mode=exclusive fullscreen
width=1280
height=720
fullmode=exclusive fullscreen
fullwidth=1920
fullheight=1080
aspect=4:3
vsync=1
cable=vga
region=europe
broadcast=pal

Ensure that your fullwidth and fullheight options are the same as your display. Obviously your region and broadcast settings should match the region of the games you wish to play (though in vga mode, it mostly doesn't matter).

If you are using a 360 controller and want the Guide button to work as a quit key, then whilst playing Redream:

Press Escape to bring up the Redream menu and select Input from the top menu:

Click on your 360 controller in Port A and move the cursor down to the 'Exit' function, click on it (it will change to 'Waiting'):

Now press the Guide button (joy8, according to Redream):

Exit Redream to save the new config. The Guide button on the controller will then quit the game from that point onwards.

The typical Xbox 360 controller works fine out of the box on most Linux systems, but we can make better use of it by mapping the normally unused Guide button to the escape key on the keyboard - which most emulators use as a 'quit' option. This means that in 99% of situations, we never even need a keyboard. We've seen that we can remap it directly in Redream, but a lot of emulators just use Escape as the quit key, so if we can get it to replicate that behaviour, then we don't need to remap it in most use cases.

Fortunately the AntiMicroX utility can map USB controller inputs to arbitrary keyboard codes, so we will use that to turn the central Xbox Guide button to an escape key.

First install the requirements to build it:

sudo apt install g++ cmake extra-cmake-modules qttools5-dev qttools5-dev-tools libsdl2-dev libxi-dev libxtst-dev libx11-dev itstool gettext ninja-build

Then download the source version and compile:

cd
cd src
git clone https://github.com/AntiMicroX/antimicrox.git
cd antimicrox
mkdir build
cd build
cmake ..
make
chmod 700 bin/antimicrox

Start up antimicrox (run bin/antimicrox from a terminal) whilst you have your controller plugged in.

Scroll down to the Guide button, click it:

… and then select the Esc key on the virtual keyboard that pops up:

Now, select the Options menu, click the Settings entry, set the the 'close to tray', 'minimize to taskbar', 'autoload last profile' and 'launch in tray' checkboxes:

Save your profile (I called it 'xpad-settings' in my user home directory) and then add antimicrox to your startup applications list:

  • Name: Antimicrox
  • Command:
    /home/user/bin/antimicrox --profile /home/user/xpad-settings.gamecontroller.amgp
  • Comment: Game controller keyboard mapping

Once configured, antimicrox will always start minimised, so you may want to create a desktop shortcut to start the utility again. Here's the content of a desktop shortcut which will do just that:

[Desktop Entry]
Name=AntiMicroX
Exec=/home/user/bin/antimicrox --show
Comment=
Terminal=false
Icon=
Type=Application

Create it as AntiMicroX.desktop on your desktop with a text editor and set it to be executable.

Once you have logged out and back in again, the antimicrox tool will launch in the background to the system tray, EmulationStation DE will launch, and any time you start MAME, Mednafen or any other emulator which treats the Escape key as 'quit', pressing the Guide button on the 360 controller will exit the game for you.

  • blog/retrogaming.txt
  • Last modified: 2023/12/04 19:54
  • by john