This month, we’ll add a disc drive to Raspberry Pi 4, connect a TV to make the most of CRT-era graphics, and overclock Raspberry Pi for an emulation performance boost.
We’ll use this hardware to add disc support to the system we made in our DOS emulation tutorial and to emulate early disc-based consoles. We’ll also explore the best legal landscape of disc emulation.
This project works best with Raspberry Pi 4 and a freshly installed Raspberry Pi OS (32-bit).
Images, discs, and the law
In the UK, you’re not allowed to make copies of software, video, or music discs you’ve bought (here's the law); there are no exceptions for backups or transcoding to play on another platform.
Unlike some PC software, permission to make copies for personal use is never granted in console games’ End User License Agreements (EULAs). You have to use the original discs.
More obviously, you can’t download disc images that someone else has made (even if you already own the game) or console operating system BIOS files. This means we’ll be restricting ourselves to emulators that can actually play games from disc and which have a High Level Emulation (HLE) BIOS.
This peculiar combination of laws currently rules out a number of normally viable emulation platforms, such as the Amiga CD32, for which BIOS images are legally available via Cloanto’s Amiga Forever, as the emulators that use them expect you to work with CD ISOs rather than original discs.
Similarly, although the RetroArch Disc Project is doing fine work on introducing disc support to certain Mega CD, Saturn and 3DO emulators, most of the emulators that currently have real disc support require BIOS images that you won’t be able to legally obtain in the UK.
Read on, though, because that still leaves a few disc-based gaming platforms you can bring back to life with Raspberry Pi.
Disc support
USB disc drives and Raspberry Pi can be an awkward combination. Modern bus-powered drives often use dual power/data USB connections that require more power than Raspberry Pi can readily supply, and don’t play nicely with USB hubs or external 5V power adapters.
Emulation adds to these problems, as early consoles often expected the disc to be spinning at all times, which many portable USB disc readers are unhappy with. Similarly, avoid Blu-ray drives: their spin and spin-down speeds frequently don’t mesh well with the expectations of emulated consoles.
A standard internal DVD-ROM drive is perfect: this build used a 2008 Sony NEC Optiarc AD-7203S SATA DVD-RW. Drives in this range are widely available for around £15, and this project is an excellent use for any old PC CD or DVD drives you might have lying around.
To connect it, you’ll need either an external disc drive enclosure or SATA to USB adapter that takes external mains power. The kit photo below shows a StarTech USB2SATAIDE, which also supports IDE CD-ROM drives and hard disks. While this adapter is a little pricey at £42, similar hardware can be bought for about £20.
01 Connect your disc drive
Plug the SATA data and power connectors of your adapter into the back of your DVD-ROM drive, plug the adapter’s USB connector into Raspberry Pi, and its mains adapter into a plug socket or power strip.
This also works with externally powered drive boxes, which look better if you want a tidy and portable final product, but will require a little more assembly to the tune of a few screws.
02 Overclock Raspberry Pi (Optional)
Emulation can be demanding, so GPU and CPU overclocking makes sense, although it’s not absolutely necessary for this project. In a Terminal, type:
sudo mousepad /boot/config.txt
And add the following lines:
over_voltage=6
arm_freq=1750
gpu_freq=700
These were stable during testing, but if Raspberry Pi fails to boot, power-cycle it and hold down SHIFT to boot into recovery mode. Then knock the settings down a bit. Here is further information on overclocking Raspberry Pi 4. If you overclock, you should use a stand or, better still, an active or passive cooling case. A FLIRC Raspberry Pi 4 Case worked well here.
03 Enable OpenGL
We’ll want OpenGL support for some emulators, such as PCSXR, In a Terminal, enter:
sudo raspi-config
Select Advanced Options > GL Driver > GL (Fake KMS), then exit and allow the system to reboot. Open /boot/config.txt and make sure the following option is present and not commented out:
dtoverlay=vc4-fkms-v3d
04 Drop your resolution
Dropping your display resolution is an easy way of improving emulator performance. If you’re using a standard 1920x1080 widescreen monitor, you won’t need that resolution to play older games. Open the menu and go to Preferences > Screen configuration and set your resolution to 720×576 (or 640×480) if you either have a 4:3 display or can live with a bit of screen stretching in exchange for smooth full-screen graphics. Choose 1280×720 if you don’t mind playing in a window on emulators that can’t do aspect ratio correction.
05 Connect an elderly TV (Optional)
A 4:3 aspect ratio display is ideal here, and older display tech has the edge for 1990s console and computer games, too. Using a CRT TV rather than a modern LCD flatscreen can improve graphical quality as sprite and even 3D graphics of the era were optimised to work with the display artefacts of CRT.
Raspberry Pi supports composite video out. Connect a 4-pole 3.5mm AV cable to the 3.5mm port on Raspberry Pi and connect the other end to your TV. Using a composite to SCART adapter can improve picture stability. Note that Raspberry Pi’s 4-pole connector expects video to be connected to the sleeve and ground to ring 2, so ensure that you use a fully compatible cable. The wrong cable selection can result in non-functional sound, misordered cables, or even damage to your hardware.
06 Output composite video (Optional)
If you’re using a typical 4:3 PAL TV, make the following changes to /boot/config.txt to correctly position your display – small alterations may be required for different models. disable_overscan=0 overscan_left=16 overscan_right=16 sdtv_mode=2 In a Terminal, enter:
sudo raspi-config
then go to Advanced Options, Pi 4 Video Output, and Enable analogue TV output. Finish and reboot.
07 Mount a CD in DOSBox
If you’ve been following these tutorials, you may already have DOSBox or DOSBox-X installed. If not, at a Terminal:
sudo apt install dosbox
dosbox
To mount a disc at the DOS prompt, type:
mount D /media/YourDiscName/ -t cdrom -usecd
0 -ioctl
To unmount a disc in DOSBox, type:
mount -u D
By default, each individual disc has to be manually mounted in DOSBox, as mount point names are automatically generated based on the volume name of the disc. This can be a problem if you need to swap DOS CDs during play or installation.
08 Create a fixed mount point
To work around this, we can use the
pmount
command. From the Terminal, let’s first make sure it’s installed and then configure it:
sudo apt install pmount
sudo mousepad /etc/pmount.allow
Add the following line to the file, then save and exit:
/dev/sr0
On the desktop, open File Manager. Go to Edit > Preferences > Volume Management and untick all the Auto-mount options. Reboot Raspberry Pi.
09 Mount and swap CDs
Now, to mount a disc, insert it, open a Terminal window and type:
pmount /dev/sr0
To unmount it:
pumount /dev/sr0
Repeat the first
pmount
command to mount a new disc. Now, every disc will have a fixed mount point of /media/sr0/
This means that, in DOSBox, you’ll just need to mount D/media/sr0/
once.
When you want to swap discs, whether at the DOS prompt or in-application, hop over to a Linux Terminal window, run through the pmount
commands and then, back in DOSBox, press CTRL+F4 to update cached information about your mounted drives.
10 Play original discs
PCSXR – the R stands for either Reloaded or ReARMed, depending on which version you’re using – is an open-source emulator. It also has a genuinely good emulated bios, so you don’t need to download anything dodgy to make it work. The desktop version works best for original discs. Open a Terminal and type:
sudo apt install pcsxr
It can run games including Final Fantasy VII, Silent Hill, GTA, Sheep, and Resident Evil either perfectly or with only minor errors, but you’ll have to adjust some settings first.
11 Configure PCSXR’s graphics
Go to the Configuration menu and select Plugins & BIOS. From the Graphics pull-down. Select OpenGL Driver 1.1.78. Click on the window icon directly to the right of the pull-down.
Starting with the Windows options tab, assuming you’re using the PAL resolution we configured, enter a width of 720, a height of 576, and tick the Fullscreen box. On the Textures tab, set Quality to Don’t care, Filtering to None, and HiRes Tex to None.
In the Framerate tab, ensure that Use FPS limit is ticked and set to auto-detect. Moving to the Compatibility tab, select Standard offscreen drawing, a Black framebuffer, and Emulated Vram for framebuffer access. Make sure the Mask bit and Alpha multipass boxes are ticked.
In the Misc tab, tick Untimed MDECs, Force 15 bit framebuffer updates, and Use OpenGL extensions. The Special game features tab includes game-specific options, such as battle cursors for Final Fantasy VII. Click Okay to save your changes.
12 Configure PCSXR’s sound and CD-ROM
Click on the window icon next to the Sound pulldown in the configuration window. Set Volume to Low, Reverb to Off, and Interpolation to None. Unsick everything except Single channel sound. Click Close, then open the CD-ROM settings. Set read mode to Normal (No Cache), Spindown time to 2 minutes, Cdrom Speed to 2min, and tick Emulated subchannel read. While you may need to adjust these settings for individual games or experiment with higher resolutions, this combination allows the vast majority of titles to run reasonably smoothly from their original discs. To test this, insert a disc into the drive, wait for it to load, then click on the CD icon at top left of the PCSXR window.
Catch KG on Twitter @KGOrphanides