Title: Turning a 15 years old laptop into a children proof retrogaming
station
Author: Solène
Date: 24 July 2023
Tags: gaming life linux
Description: In this article, I'm sharing how I turned an old laptop
into an emulation platform that could be safely used by children

# Introduction

This article explains a setup I made for our family vacation place, I
wanted to turn an old laptop (a Dell Vostro 1500 from 2008) into a
retrogaming station.  That's actually easy to do, but I wanted to make
it "childproof" so it will always work even if we let children alone
with the laptop for a moment, that part was way harder.

This is not a tutorial explaining everything from A to Z, but mostly
what worked / didn't work from my experimentation.

# Choosing an OS

First step is to pick an operating system.  I wanted to use Alpine,
with the persistent mode I described last week, this would allow having
nothing persistent except the ROMs files.  Unfortunately, the packages
for Retroarch on Alpine were missing the cores I wanted, so I dropped
Alpine.  A retroarch core is the library required to emulate a given
platform/console.

Then, I wanted to give FreeBSD a try before switching to a more
standard Linux system (Alpine uses the libc musl which makes it
"non-standard" for my use case).  The setup was complicated as FreeBSD
barely do anything by itself at install time, but after I got a working
desktop, Retroarch had an issue, I couldn't launch any game even though
the cores were loaded.  I can't explain why this wasn't working,
everything seemed fine.  On top of this issue, game pad support have
been really random, so I gave up.

Finally, I installed Debian 12 using the netinstall ISO, and without
installing any desktop and graphical server like X or Wayland, just a
bare Debian.

# Retroarch on a TTY

To achieve a more children-proof environment, I decided to run
Retroarch directly from a TTY, without a graphical server.

This removes a lot of issues:

* no desktop you could lock
* no desktop you could log out from
* no icons / no menus to move / delete
* nothing fancy, just retroarch in full screen

In addition to all the benefits listed above, this also reduces the
emulation latency, and makes the system lighter by not having to render
through X/Wayland.  I had to install the retroarch package and some GL
/ vulkan / mesa / sdl2 related packages to have it working. 

One major painful issue I had was to figure a way to start retroarch in
tty1 at boot.  Actually, this is really hard, especially since it must
start under a dbus session to have all features enabled.

My solution is a hack, but good enough for the use case.  I overrode
the getty@tty1 service to automatically log in the user, and modified
the user `~/.bashrc` file to exec retroarch.  If retroarch quits, the
tty1 would be reset and retroarch started again, and you can't escape
it.

# Retroarch configuration

I can't describe all the tweaks I did in retroarch, some were for pure
enhancement, some for "hardening".  Here is a list of things I changed:

* pre-configure all the controllers you want to use with the system
* disable all menus except the playlists, they automatically group
games by support which is fine
* set the default core for each playlist, this removes an extra weird
step for non-technical users
* set a special shortcut to access the quick menu from the controller,
something like select+start should be good, this allows to drop/pause a
game from the controller

In addition to all of that, there is a lovely kiosk mode.  This
basically just allow you to password protect all the settings in
Retroarch, once you are done with the configuration, enable the kiosk
mode, nothing can be changed (except putting a ROM in favorite).

# Extra settings

I configured a few more extra things to make the experience more
children proof.

## Grub config

Grub can be a major issue if a children boots up the laptop but press a
key at grub time.  Just set `GRUB_TIMEOUT=0` to disable the menu
prompt, it will directly start into Debian.

## Disabled networking

The computer doesn't need to connect to any network, so I disabled all
the services related to network, this reduced the boot time by a few
seconds, and will prevent anything weird from happening.

## Bios lock

It may be wise to lock the bios, so in case you have children who know
how to boot something on a computer, they wouldn't even be able to do
that.  This also prevent mistakes in the bios, better be careful. 
Don't lose that password.

## Plymouth splash screen

If you want your gaming console to have this extra thing that will turn
the boring and scary boot process text into something cool, you can use
Plymouth. 

I found a nice splash screen featuring Optimus head from Transformers
while the system is booting, this looks pretty cool!  And surely, this
will give the system some charm and persona compared to systemd boot
process.  This delays the boot by a few seconds though.

# Conclusion

Retroarch is a fantastic software for emulation, and you can even run
it from a TTY for lower latency.  Its controller mapping is really
smart, you have to configure each controller against some kind of
"reference" controller, and then each core will have a map from the
reference controller to convert into the console controller you are
emulating.  This mean you don't have to map your controller for each
console, just once.

Doing a children proof kiosk computer wasn't easy, I'm sure there is
room for improvement, but I'm happy that I turned a 15 years old laptop
into something useful that will bring joy for kids, and memories for
adults, without them fearing that the system will be damaged by kids
(except physical damage but hey, I won't put the thing in a box).

Now, I have to do some paint job for the laptop behind-the-screen part
to look bright and shiny :)