Introduction: EmuDeck "The Library" for Easily Downloading Retro Games
Why did I choose to buy the Steam Deck over other hand-held hardware like the Nintendo Switch, Ayaneo, Rog Ally, etc. in the first place?
It was mainly because the Deck was a versatile Linux machine that can emulate other game consoles which meant that I am not just limited to games on one platform. You can only play Nintendo games on switch. Yes, the Ayaneo and Asus Rog Ally are basically Windows computers, so these can be as versatile as the Deck, but we all know Linux is much more versatile than Windows, overall, as long as you take some time to get acquainted.
Anyways, I installed Emulation Station Desktop Edition (ES-DE) via EmuDeck to play some nostalgic games that we are all fond of. I am a Millennial, so the best consoles like Nintendo, Super Nintendo, Gameboy Color, Playstation, and PS2 were integral parts of my childhood! Oh the joy these games brought to my life back then...
So, now with ES-DE on my Deck, I was ready to play some good old games! Then, I realized, I needed to first download the ROMs. Thankfully, I was able to find some safe links through Google search and downloaded a few games that I wanted to play immediately. I unzipped the files in the corresponding "roms" folder and began playing. Then, after beating those games, I had to go back to the links and download some more and put them in the right "roms" folder to play these. By the way, I had to switch to Desktop mode every time to download and set the ROMs up... ... ... ...
I thought this was a bit annoying. Gamers are highly impatient, and doing this every time nearly pissed me off later on.
So, I started asking myself, would I be able to make this a bit easier on myself? Wouldn't it be great if I can just access some kind of "games archive" directly from the ES, go through the list, download, and then begin playing?
Well, I can program, so I started mapping out how I can write my own script to make it just as I described above. I got some help from ChatGPT to get some clarifications on Python libraries, and eventually, "The Library" came to life!
From now on, no more going into Desktop mode, no more searching in the links, no more manual unzipping into the "roms" folders!
I simply find the games from "The Library", look through the list, and select the game I'd like to download. Once a game is selected, the screen goes blank which means it is downloading, and then, when the screen comes back, I restart ES to reload the roms (ES, by default, only loads the roms when it first launches), and then play away!
Check out all of my projects at www.amikers.com!
Supplies
- Steam Deck Link
Step 1: Install Emulation Station on Steam Deck
Install Emulation Station on Steam Deck. I believe EmuDeck is the most popular one (if not the only one). EmuDeck is what I have installed. You can find guides by searching on Google.
Step 2: Prerequisites to Run the Library Script
Go to Desktop mode, open Konsole, then check that Python is installed:
python -V
Install PIP:
sudo pacman-key --init
sudo pacman-key --populate archlinux
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
Add PIP to PATH:
nano ~/.bashrc
Add at the end of the script
PATH="$HOME/.local/bin:$PATH"
CTRL+X then Y then ENTER (Exiting the .bashrc script)
source ~/.bashrc
Confirm that PIP is correctly added to PATH:
pip -V
Install python libraries:
pip install requests
pip install beautifulsoup4
pip install py7zr
Step 3: Clone the Git Repository
In the $HOME directory (typically /home/deck/), clone the git repository as below:
cd ~
git clone https://github.com/jinzohh/theLibrary.git
Change directory to the cloned folder:
cd theLibrary
Step 4: Modify the Script
By the default, the script is called "theLibrary_githubver.py", but rename this for simplicity. I would rename it to "theLibrary.py", but rename it to whatever you like.
mv theLibrary_githubver.py theLibrary.py
Next, open the script with your editor of choice. I use VS Code, but IDLE or any other code editor will work.
Before you edit the script, you must first gather a list of URLs for each of the game systems in the script. At the bottom of the script, you will see:
# Based on your actual url that you use to download games off of, change the url below to match your urls. I am not able to openly post the links I use due to potential legal issues of downloading roms off the internet.
snes_url = 'XXXXXXX'
nes_url = 'XXXXXXX'
n64_url = 'XXXXXXX'
gbc_url = 'XXXXXXX'
gba_url = 'XXXXXXX'
gb_url = 'XXXXXXX'
psx_url = 'XXXXXXX'
ps2_url = 'XXXXXXX'
psp_url = 'XXXXXXX'
ms_url = 'XXXXXXX'
genesis_url = 'XXXXXXX'
gg_url = 'XXXXXXX'
Make sure to replace all 'XXXXXXX' with the full URL. I won't provide the URL due to potential legal complications, but a simple Google search should route you to the correct links. Some forums provide these links, as well.
After defining the URLs at the bottom of the script, go back to the beginning of the script and replace the 'XXXXXXX' with the same URLs.
# Based on your actual url that you use to download games off of, change the strings below to match your urls. I am not able to openly post the links I use due to potential legal issues of downloading roms off the internet.
if 'XXXXXXX' in url:
consolePath = theLibraryPath + '/snes'
print(consolePath)
elif 'XXXXXXX' in url:
consolePath = theLibraryPath + '/nes'
print(consolePath)
elif 'XXXXXXX' in url:
consolePath = theLibraryPath + '/n64'
print(consolePath)
elif 'XXXXXXX' in url:
consolePath = theLibraryPath + '/gbc'
print(consolePath)
elif 'XXXXXXX' in url:
consolePath = theLibraryPath + '/gba'
print(consolePath)
elif 'XXXXXXX' in url:
consolePath = theLibraryPath + '/gb'
print(consolePath)
elif 'XXXXXXX' in url:
consolePath = theLibraryPath + '/ps2'
print(consolePath)
elif 'XXXXXXX' in url:
consolePath = theLibraryPath + '/psp'
print(consolePath)
elif 'XXXXXXX' in url:
consolePath = theLibraryPath + '/psx'
print(consolePath)
elif 'XXXXXXX' in url:
consolePath = theLibraryPath + '/mastersystem'
print(consolePath)
elif 'XXXXXXX' in url:
consolePath = theLibraryPath + '/gamegear'
print(consolePath)
elif 'XXXXXXX' in url:
consolePath = theLibraryPath + '/genesis'
print(consolePath)
else:
print("URL not recognized. Can't create console path.")
Make sure to do the same to below, as well.
# Based on your actual url that you use to download games off of, change the url below to match your urls. I am not able to openly post the links I use due to potential legal issues of downloading roms off the internet.
for title in cleaned_list:
with open(consolePath + '/' + title + '.py', 'w') as f:
f.write(
'import os\n'
'import subprocess\n'
'import requests\n'
'from bs4 import BeautifulSoup\n'
'import zipfile\n'
'import py7zr\n'
'\n'
'# Based on your actual url that you use to download games off of, change the url below to match your urls. I am not able to openly post the links I use due to potential legal issues of downloading roms off the internet.'
'if \'snes\' in str(os.path.abspath(__file__)):\n'
' url = \'XXXXXXX\'\n'
' file_path = os.path.expanduser(\'~/Emulation/roms/snes\')\n'
'elif \'genesis\' in str(os.path.abspath(__file__)):\n'
' url = \'XXXXXXX\'\n'
' file_path = os.path.expanduser(\'~/Emulation/roms/genesis\')\n'
'elif \'nes\' in str(os.path.abspath(__file__)):\n'
' url = \'XXXXXXX\'\n'
' file_path = os.path.expanduser(\'~/Emulation/roms/nes\')\n'
'elif \'n64\' in str(os.path.abspath(__file__)):\n'
' url = \'XXXXXXX\'\n'
' file_path = os.path.expanduser(\'~/Emulation/roms/n64\')\n'
'elif \'gbc\' in str(os.path.abspath(__file__)):\n'
' url = \'XXXXXXX\'\n'
' file_path = os.path.expanduser(\'~/Emulation/roms/gbc\')\n'
'elif \'gba\' in str(os.path.abspath(__file__)):\n'
' url = \'XXXXXXX\'\n'
' file_path = os.path.expanduser(\'~/Emulation/roms/gba\')\n'
'elif \'gb\' in str(os.path.abspath(__file__)):\n'
' url = \'XXXXXXX\'\n'
' file_path = os.path.expanduser(\'~/Emulation/roms/gb\')\n'
'elif \'psx\' in str(os.path.abspath(__file__)):\n'
' url = \'XXXXXXX\'\n'
' file_path = os.path.expanduser(\'~/Emulation/roms/psx\')\n'
'elif \'ps2\' in str(os.path.abspath(__file__)):\n'
' url = \'XXXXXXX\'\n'
' file_path = os.path.expanduser(\'~/Emulation/roms/ps2\')\n'
'elif \'psp\' in str(os.path.abspath(__file__)):\n'
' url = \'XXXXXXX\'\n'
' file_path = os.path.expanduser(\'~/Emulation/roms/psp\')\n'
'elif \'mastersystem\' in str(os.path.abspath(__file__)):\n'
' url = \'XXXXXXX\'\n'
' file_path = os.path.expanduser(\'~/Emulation/roms/mastersystem\')\n'
'elif \'gamegear\' in str(os.path.abspath(__file__)):\n'
' url = \'XXXXXXX\'\n'
' file_path = os.path.expanduser(\'~/Emulation/roms/gamegear\')\n'
'else:\n'
' print("Current directory not recognized.")\n'
Just make sure you put the correct corresponding URL to each if statement. For example, in
'if \'snes\' in str(os.path.abspath(__file__)):\n'
' url = \'XXXXXXX\'\n'
' file_path = os.path.expanduser(\'~/Emulation/roms/snes\')\n'
since it is 'snes', the URL should be your snes ROMs URL.
Make sure to replace ALL 'XXXXXXX' with the correct URLs that corresponds to each game consoles.
After this is complete, you are ready to the run the script!
Step 5: Run the Script
In Konsole, type:
/usr/bin/python3 /home/deck/theLibrary/theLibrary.py
If you didn't rename the script to "theLibrary.py", make sure to put whatever you named it as at the end.
After the script completes, open Emulation Station either on Desktop mode or Gaming mode. You will see "The Library" in the main menu. Once you go inside it, you will see a list of games for each game console for download. The games will immediately save into the corresponding /roms folder in Emulation Station. After downloading your favorite games, restart Emulation Station to play.
NOTE:Make sure the roms in your URLs are either .zip or .7z. If the roms aren't one of these two, the script will NOT work. Good news is that the roms are usually either one of these formats. You can always modify the script to work with other formats.