Running Windows games on my x86 EmulationStation / RetroPie gaming machine running Linux has been a huge desire for me. I have many of great memories of Windows games from the mid 90s through to the late 2000s but need to get these running on Linux based machine. Now, using Wine, a Windows emulator for Linux, I’ve figured out away to play these games from the comfort of my couch and have them launch seamlessly through EmulationStation / RetroPie. This article will show you how to install and setup Wine, mount CD images, and create scripts to auto launch your games thus allowing you to access your Windows games from your EmulationStation setup!!! Follow up articles, “RetroPie: Adding a New System” and RetroPie: Modify ComicBook Theme to Create-Your Own System Text, will show you how to create a new system menu in EmulationStation for your Windows games. (Note: Wine does not work ARM systems such as the Raspberry Pi).
[READ MORE ON DIGIMOOT: RetroPie: Setup on an x86 Machine with Linux Ubuntu or Mint]
This is part of my series of articles on Retro Gaming.
What you Need
To get going, here is what you need:
- an x86 machine with:
- your favourite flavour or Linux installed (this guide is based on Linux Mint 18.3); and
- with a copy of emulation station installed;
- wireless mouse and keyboard; and
- copies of your favourite windows games with images of discs if needed.
Check Game Compatibility
Some games are more compatible with Linux and Wine than others. The first step is that you should check and see the level of compatibility of the game on the Wine AppDB. There may be for specific instructions or steps required to install or run your application beyond what we can cover in this post.
Update Display Drivers
You will need to make sure that you are using the most up to date graphics drivers. Use the search bar on the desktop menu to search for an run either ‘driver manager’ (Ubuntu) or ‘additional drivers’ (Xubuntu). You should also consider updating any other (not display) drivers.
You will need to open a terminal window and run the following commands:
sudo dpkg --add-architecture i386
wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
Based on which installed version of Ubuntu based operating system you are running, you will then need to use one of the following commands:
sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ disco main'
sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main'
Now make sure everything is up to date by running:
sudo apt-get update
And finally install Wine using the following command:
sudo apt-get install --install-recommends winehq-stable
You can now run
winecfg to configure your Wine installation. Set the parameters to your liking. There is one setting that you will need to ensure it not enabled: ensure that the game does not launch in virtual desktop mode as this will screw up display, etc. You can find this on the Graphics tab as shown below.
Install the Game
To install the game, we will have to tell Wine to run the setup / install for the game. Usually you are going to be installing the game from a CD. If you are using an .iso file of your CD, you will need to mount the CD before you can run the game. To mount, first create the directory (i.e. mount point) using mkdir command. The following command will create the /mnt/disk mount point which can be modified based on where you want the mount point:
mkdir -p /mnt/disk
Next we need to mount the CD .iso using the mount command. The following command assumes the .iso file is called disk1.iso – again, modify as needed:
mount -o loop disk1.iso /mnt/disk
Finally we need to tell Wine to run the setup file on the install CD. The command will probably look like the following, but remember to adjust to the specific setup or install file on the disk and the mount point that you’ve used.
Follow the install process as you would typically would when installing in Windows. Once complete the game will be ready to run.
To test the game, there should be a ‘shortcut’ on your Ubuntu desktop. Run it and make sure the game is working that way you want before proceeding to the next step.
Create a Script
You will now need to create a script to run from EmulationStation (RetroPie). To do so, you will need a few things. First, when you installed the game above, likely a link was placed on your Ubuntu desktop. If you open up the properties of that link / file, there should be a command which is used to run the program. It should look something like below:
env WINEPREFIX="/home/yourusername/.wine" wine C:\\windows\\command\\start.exe /Unix /home/yourusername/.wine/dosdevices/c:/users/Public/Desktop/game.lnk
You will need to take this and put it in the script you are creating. You may want to modify it a bit, like I have below, to point to the exact executable of your game, rather than a link on your Wine desktop and also to point to variable home directory rather than an absolute by using “~” or “$HOME”. This is not necessary but increases the flexibility of moving to other systems as needed.
env WINEPREFIX="/home/yourusername/.wine" wine C:\\windows\\command\\start.exe ~/.wine/dosdevices/c:/Oblivion/Oblivion.exe
The script you are creating will have an .sh extension and should be representative of the game you are creating it for e.g. “oblivion.sh”. You can create the file with a text editor such as the one included with Ubuntu or NotePad ++. You can also use the nano editor from the command line.
The second thing you will need to decide is whether or not you want the script to use the traditional
mount command. The plus is it is a bit simpler. The con, is that you will have to enter your sudo password every time you use the script to launch a game. Here is an example of a script that uses the traditional mount method:
sudo mount -o loop ~/Desktop/rld-tes4.iso /media/isomount/
env WINEPREFIX="$HOME/.wine" wine C:\\windows\\command\\start.exe /Unix $HOME/.wine/dosdevices/c:/Oblivion/Oblivion.exe > /dev/null 2>&1
read -n1 -r -p "Press any key to exit..." key
sudo umount /media/isomount/
There may be other ways around the entering the sudo password every time you want to mount a CDROM or DVD in Wine. I’ve seen some suggestions that you could just
sudo visudo and add an exception that the user doesn’t need to use a password with the mount command. However, my understanding is that this comes with serious security risks in that anybody could mount their own image and use it to compromise your system. The good news is I’ve found another solution which seems to work well using cdemu. I came across this information on the AskUbuntu Site from a few years ago.
You will need to add the repository and install the program with the following commands:
sudo add-apt-repository ppa:cdemu/ppa
sudo apt-get update
sudo apt-get install gcdemu cdemu-client
Once, installed, you can then mount the image using the following:
cdemu load 0 ~/game.iso
To check that your image has loaded, run
To see the device allocation, enter
To unmount the image specify the same device number (0) used when initially loading:
cdemu unload 0
Here is a script to use with RetroPie. Of important note is the
/wait switch. I banged my head on the wall for awhile until I found this one. It makes Wine wait until the program in Wine has finished and then exits.
cdemu load 0 ~/Desktop/rld-tes4.iso
env WINEPREFIX="$HOME/.wine" wine C:\\windows\\command\\start.exe /wait /unix "$HOME/.wine/dosdevices/c:/Oblivion/Oblivion.exe" > /dev/null 2>&1
cdemu unload 0
You can run theses scripts by using the following command:
Conclusion and Next Steps
Alright, so this should get your Windows games running under Linux using Wine and have them launching and mounting CDs automatically through a script. The next step is to integrate this script into RetroPie (EmulationStation) by creating a new system. Once this new system is setup, we can pretty up the look of your setup, if you’re using the Comic Book Theme.
PART 2: RetroPie: Adding a New System to EmulationStation