Tuesday 11 June 2019

Netplay? On my RetroPie!?

For the first time yesterday, I tried playing RetroPie games online with a friend. I can say it's totally worth your time! We played a few rounds of NES Tennis in co-op and we couldn't stop laughing from the dumb fun we were having.

We achieved this by following the instructions from this page: https://github.com/RetroPie/RetroPie-Setup/wiki/Netplay

SNES games like Super Mario World were pretty laggy, almost unplayable.

NES games, however, only had few frames of lag, making them absolutely playable.

Try it out, I hope you will have as much fun as we did!

Monday 3 April 2017

Texmaster on RetroPie

Those of you who are familiar with the Tetris Grandmaster (TGM) series probably already know about Texmaster. For those of you who don't, it's a fan-made clone that recreates the feel and rules of these games very closely. Here's a great exhibition from AGDQ 2015 if you're interested in discovering this fantastic series:

Texmaster comes with its own background music and sound effect, so it's not infringing the copyrights of TGM. What's cool is that you can swap backgrounds, sound effects and music to your liking, so you could potentially mimick TGM3 for example (link near the end of this post). This is great because TGM games have been hard to emulate for a very long time, and Texmaster is designed to work on a PC.

To install Texmaster2009 on your RetroPie as a port, download the version here: http://mindflyer.net/tetris/texmaster/Texmaster2009-5.7z

Decompress the main archive, followed by Texmaster2009.rpi1-ARMv6.tar.gz for the Rpi0-1, or Texmaster2009.rpi2-ARMv7.tar.gz for the Rpi2-3.

Next, you can install wiringpi following these instructions. Afterwards you can begin integrating it into RetroPie as a port by doing the following from the command line:

mkdir /opt/retropie/configs/ports/texmaster2009
nano /opt/retropie/configs/ports/texmaster2009/emulators.cfg
The nano text editor will open, where you will now add the following to the text edit field.
texmaster2009 = "/path/to/binary/goes/here/Texmaster2009"
Press 'ctrl+o' to save, 'y' to confirm and 'ctrl+x' to exit out of the nano text editor.
Now, all that is left is to make a script to launch the whole thing. Continuing in the command line, type:
nano /home/pi/RetroPie/roms/ports/Texmaster\ 2009.sh
The nano text editor will open again, where you will now add the following to the text edit field.
"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "texmaster2009" ""
Press 'ctrl+o' to save, 'y' to confirm and 'ctrl+x' to exit out of the nano text editor. Finally, we'll make the script executable by typing:
chmod 0755 /home/pi/RetroPie/roms/ports/Texmaster\ 2009.sh
Once you restart Emulation Station, there will be a new menu listing named 'Texmaster 2009' and it should start right up.

- If you want to setup your controls, you will have to do so by editing Texmaster.ini in your Texmaster folder. Instructions on how to do it (both for keyboard and joystick) are found here: www.hep.physics.mcgill.ca/~legerf/Texmaster In fact, lots of information about config is available there.

- Here is the theme to reproduce the feel of TGM 3 (simply replace the data folder in the Texmaster folder by the one within tgm_theme_texmaster.zip): http://www.mediafire.com/file/p1mt22a9qv26l2l/tgm_theme_texmaster.zip

-Here is the relation between the mode names in texmaster and the real modes in TGM (you can change the names in Texmaster.ini):
NOVICE - Normal mode from TGM2+. Ends at level 300 and never reaches 20G speed during normal gameplay.
NORMAL - Master mode from TGM1. Ends at level 999. More or less normal Tetris gameplay, except faster. A lot faster.
ADVANCE - TGM+ mode from TGM2+. Adds some new features to Normal, most notably the "Sonic Drop", which allows you to instantly drop the piece while still retaining the normal lock delay once it lands. Also periodically adds garbage lines at the bottom of the stack.
SPECIAL - Master mode from TGM2+. The same feature set as Advance, minus the garbage lines. Speeds are even more hair-raising.
SUDDEN - TA Death mode from TGM2+, AKA 20G mode. Pieces drop instantly. Various delays become shorter as you progress.
DOUBLES - Doubles mode from TGM2+. Ends at 300. 2P co-op mode with various options.
SPECIAL TI - Master mode from TGM3. Similar to Special, but it previews three pieces instead of one and adds a "hold piece" feature. Also goes even faster.
SUDDEN TI - The notorious Shirase mode from TGM3. Ends at level 1300. Pieces drop instantly, like in Sudden, but the lock delay has been drastically shortened (and will get even shorter as you progress.) For masters and masochists only.

Happy gaming!

Sunday 4 December 2016

MORE Tinkering with RetroPIe!

The fun never stops! In this entry, I'll show you new things I learned to do in RetroPie over the past month:

  • Splash screens
    • Download user-made splash screens
    • Use video splash screens
  • Menu music
  • Boot games from USB
 Here we go!

Splash screens
-- Downloading user-made splashscreens --
 I recently discovered just how active the RetroPie community was through their amazing collection of splash screens. A splash screen is the image you first see when you boot up RetroPie. This is the current default one:

While it is a good design, you might want to personalize it a bit. Fortunately, you can! It's very simple, in fact. Go to the RetroPie options (where you went to configure your audio and wi-fi) and select "splash screens". You will see this menu:

Select option 9 - Download RetroPie-Extra splashscreens, and they'll all download automatically from github directly on your Raspberry Pi (they are located in ~/RetroPie/splashscreens/retropie-extra). One thing to note: you can put any picture you want in that folder, and it will act as a splashscreen. For example, I made this Neo-Geo mockup, which I think looks great! It's not yet in the official RetroPie github directory, but maybe one day if I figure out how to use github. Feel free to use it if you want, in the meantime!

You can have a look at them by choosing option 7 - Preview splash screens. In the next menu, you can select between viewing a single splash screen, or a slideshow. You also have the option to play a video splash, but more on that later.

The fun begins when you select option 3: Enable splashscreen randomizer. This will show a random splashscreen when you boot RetroPie instead of the usual one. You can select between randomizing official RetroPie splash screens (no fun), or randomizing your own splash screens (fun!!). You can also randomize all splash screens to include both. You can even create a list named /etc/splashscreen.list that contains the filenames of splash screens you selected (by doing option 6 - append splashscreen to list in the menu) and randomize splash screens only from that list!

Alternately, you can select option 1: Choose splashscreen. This will specify which splashscreen you want to use a your default boot screen. I'm not sure what happens if you select this option at the same time as the randomizing option discussed above, so try out the available combinations to make sure it works the way you want.

-- Video Splash Screens --
Now, things get reaaaally fun. What if you want your RetroPie to boot up with the Dreamcast sequence, or maybe even the GameCube? What if you want to boot up with a fatality montage from Mortal Kombat, or the overdrive tech demo from Evoke 2013? What if you just found a fancy video splashscreen on the RetroPie forums (this guy makes very nice splashscreens)? You can do any of these. As long as the video you want to use in the .mp4 format, just copy it to your ~/RetroPie/splashscreens/retropie-extra directory, and it will detected by RetroPie. You can have a look at it by doing "Preview Splashscreens -> Play video splash -> Own/Extra splashscreens" from the splashscreens menu of RetroPie. Even if they're videos, you can randomize them just like the picture splash screens. 

One piece of advice I can give you: I filled my /etc/splashscreen.list file with videos only, and randomize that list. That way, I always get a random video instead of a random picture (most of the time) or a video (rarely), because there's simply much more pictures than videos in the retropie-extra folder.

Menu Music in RetroPie
Quite possibly the most interesting discovery I made by checking out other RetroPie setups online: you can play any music you want in the RetroPie menu while you're selecting your games. This is not a function usually built-in RetroPie. How it works is someone programmed a python script that plays music from a folder you select. All you have to do is follow the instructions in synack's post here (see picture below, in case his post gets lost). Make sure you read and follow each step slowly, and you will be completely fine. It's a 5-10 mins process, well worth it in the end.

I compiled the list of the songs I'm using in my menu right here, so you can have ideas (and hopefully find more music you might like!). The site I download my music from is http://downloads.khinsider.com/ if you're looking for it.

Playing a game from your USB drive (not micro-SD)

This is very helpful if your micro-SD card is 97% full (like me), but you don't want to invest in a bigger micro-SD card (these things are expensive and can corrupt easily if you're not careful). Follow this helpful video!

Monday 28 November 2016

Check out this amazing RetroPie setup!

It takes a lot to impress me, these days, but this RetroPie setup exceeded my wildest expectations. This guy obviously knows very much what he's doing, but I recommend you check it out for inspirational purposes. It shows you how much you can customize your RetroPie. I've got a lot of tinkering to do on my end, that's for sure!

Friday 4 November 2016

Anything else I forgot?

I learn more and more every day. If there's a tip or neat thing worth mentioning that I missed, please let me know and I'll add it to the previous posts. Thanks!

Some More Tinkering with the RetroPie

If you followed my previous post, at this point you should have a working RetroPie setup. However, it can still get better. Here, I will answer many small questions I've had to find the answers for, so that you can conveniently find them all in one place and save some time. I'll present the questions/answers in the same order I solved them:
  • How do you remove the black border around the screen?
  • How do you use speakers with the Raspberry Pi? 
  • How do you display the Sega Genesis logo instead of the Sega Megadrive logo in the main menu? TurboGrafx-16 instead of PC-Engine? Etc.
  • How do you put pictures and info for each games you downloaded?
  • How do you get CD games to work (i.e. Sega CD, PC-Engine CD, PlayStation, etc.)
  • How do you get MAME games to work?
  • How do you play multiplayer games?
  • How do you configure the controller input only for a certain console? 
How do you remove the black border around the screen? 
This might not happen to you, but from what I've seen online, this is a pretty common thing to fix. To fix this, in the RetroPie options menu, select "Raspi-Config" (alternatively, you can access this by exiting RetroPie and type "sudo raspi-config" in the terminal).
Simply go to Advanced options (using the keyboard), and disable the overscan setting.

If you are using a CRT TV to display your games, setting things right can get a little more tricky to make sure the image is not cut off on the sides. I'll give you hints at how to do it, but if that's not enough, just contact me ;)
  • Download the set_overscan script from here: https://github.com/ukscone/set_overscan
  • Do 'sudo nano /boot/config.txt' in your terminal after quitting EmulationStation (by pressing F4) and make sure that there is no '#' symbol before the line that has "overscan_scale" and that there IS a '#' symbol before the line that says "disable_overscan".
  • Get into the set_overscan folder you downloaded and do 'sudo ./set_overscan.sh'. Follow the instructions shown on screen.
  • Reboot your system by doing 'sudo reboot', you should be all set after this.  

How do you use speakers with the Raspberry Pi? 
It is possible that the display you use for your Raspberry Pi has no speakers (e.g. a computer monitor instead of a TV). Therefore, to get sound, you will need to provide speakers. These can be plugged in the 3.5mm plug (next to the HDMI plug) of the Raspberry Pi. You will have to tell your Pi to output sound from this plug (instead of the HDMI) by going to the Audio section in the RetroPie options menu.

Note:  In RetroPie, you have the option to control the volume output (I forgot where to access it, but I'll edit this post when I remember), but I recommend you don't use this option to lower the volume. What I noticed is the Raspberry Pi is not good at outputting low sound: you will start hearing scratching and other noises if you use headphones, for example. If you want to lower the sound, leave the volume at 100% inside RetroPie, and simply adjust the volume on your speakers or headphones (if possible). You can always check out this gadget to control your output volume.

How do you display the Sega Genesis logo instead of the Sega Megadrive logo in the main menu? TurboGrafx-16 instead of PC-Engine? Etc.
Note: This answer is outdated, there is a better way to do this now, which I have not documented yet. See the bottom of this page: https://github.com/RetroPie/RetroPie-Setup/wiki/Mega-Drive-Genesis. The problem with the method shown below is that every time you update your RetroPie, the settings will be reverted to their default values.

Some consoles have different names and logos in different regions of the world. You can change the logo you see for some consoles in RetroPie's menu by doing cd /etc/emulationstation/es_systems.cfg and sudo nano es_systems.cfg and change

    <fullname>Sega Mega Drive / Genesis</fullname>
    <extension>.smd .bin .gen .md .sg .zip .SMD .BIN .GEN .MD .SG .ZIP</extension>
    <command>/opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ megadrive %ROM%</command>


    <fullname>Sega Genesis</fullname>
    <extension>.smd .bin .gen .md .sg .zip .SMD .BIN .GEN .MD .SG .ZIP</extension>
    <command>/opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ megadrive %ROM%</command>
To exit nano, do Ctrl-X and press Y. 
For more info, search the RetroPie guide for the console you want to modify, and look for the "Advanced Configuration" section.

How do you put pictures and info for each games you downloaded?
Note: the following section is outdated. There is now a much easier AND reliable way to get the correct info for your games. It is called sselph's scraper, and can be accessed if you press 'F4' to quit EmulationStation and run 'sudo ~/RetroPie-Setup/retropie_setup.sh'. It does the same thing as what is described in this outdated section, but for some reason reason is much more efficient. For more info, read about it hereor contact me :)

I'm glad you ask! This is one of my favorite features of RetroPie: you can make your game collection look organized and colorful by using RetroPie's Scraper. This tool will fill information fields for your games: cover art, short description, number of players, publisher, developer, release date, rating (!), ... To tell the truth, this is something you could technically do by hand by pressing Select and do "Edit this game's metadata", but it's a time consuming process. You're better off letting the Scraper do the job for you.

To access this tool in RetroPie, simply press Start (controller or keyboard), and select "Scraper". You will find this screen:

You can select from which database you want to scrape your game info (as of right now, TheGamesDB is the one that works best) and select if you want to scrape ratings or not (some of these ratings are pretty bogus, you might as well rate games on your own). When you're done, press Scrape Now.

On this screen, you can filter if you want to scrape games that are missing an image, or all games (I suggest you scrape only missing image, to save time). Select for which system you would like to scrape (initially, all systems for which you provided roms are selected)

The last box lets you decide on conflicts, and I think it deserves discussion. Basically, since some games can have similar names, the Scraper will need help deciding which game is the right one for your rom (this screen, if you selected "ON" to decide on conflict):

You see in this picture, on the third line from the top, the name file of your rom which was used by the Scraper to search the database. Lots of result come up, and it can get stuck (it's pretty dumb). Deciding on conflicts is therefore good to make sure the picture and information you will write about your rom are accurate.

However... This can be a time consuming process, simply because reading the database takes a long time (maybe it's my Internet connection, your mileage may vary). When I download 30 games at once, I set the option "user decides on conflict" to OFF. The Scraper will then do its best to provide accurate results, and I won't have to decide for every game if the results are right or not. This is good because it saves a lot of time (you can take a walk outside while the Scraper works), but can be bad because the Scraper is bound to make a few mistakes from time to time (about 3% of the time for me).  

If you find a game for which the Scraper made a mistake, you can press Select on that game, do "edit this game's metadata" and scrape only this game to fix it. It's not a perfect solution, but it's the best I know so far.

How do you get CD games to work (i.e. Sega CD, PC-Engine CD, PlayStation, etc.)
CD based consoles need BIOS to operate. That's true even outside RetroPie. If you want to play Snatcher on the Sega CD, for example, you will to get the BIOS for the Sega CD before the rom of the game. These BIOS are available on the same websites you can find roms. Usually, the BIOS for a console will be compressed together and all you have to do is extract these files in your ~/RetroPie/BIOS/ folder.

Another thing worth noting is that CD based games need two files to work: a .cue and a .bin/iso file. The .bin or .iso file is always the biggest: it's the game program itself. The .cue file is always small: it mainly contains the timestamps at which the game should play its music and tells where to load the .bin/iso file. Sometimes, even if you have the right BIOS, it is possible that your game will not start. This is typically because the .bin/iso file's name does not match what's written inside the .cue file Here's an example:

I downloaded Nexzr for the PC-Engine CD. I have two files: Nexzr.cue and Nexzr.iso. I already put them in the folder ~/RetroPie/pcengine of my Raspberry Pi. I can open and read the contents of Nexzr.cue by doing cd ~/RetroPie/pcengine and nano Nexzr.cue. I see the following:

    INDEX 01 00:00:00
  TRACK 02 MODE1/2352
    PREGAP 00:03:00
    INDEX 01 00:38:41
    PREGAP 00:02:00
    INDEX 01 01:11:54
......... (etc) 

What I would have to fix in this case is the first line: the file name NEXZR.ISO does not perfectly match Nexzr.iso (Linux is very strict about capitalization), and this is what was causing the problem. By changing the first line in Nexzr.cue to this:

 FILE "Nexzr.iso" BINARY 

Then all my problems are gone. 

Note: Some file names can contain tricky characters, like "[", "]", "_", "!", etc. I suggest you rename your files to remove those characters (with the Linux command mv), so that you maximize your chances of success

How do you get MAME games to work?  
MAME games are tricky to get to work. This is because every MAME game is its own console, essentially. Therefore, even if your RetroPie setup is perfect, it is still possible that you will face a MAME game that will simply refuse to work. This is normal, and there are plenty of MAME databases online keeping track of which games are fully emulated or not. The list of emulated MAME games keeps on growing over the years, so don't lose hope!

A few things you can try before giving up:
  1. I suggest you put your MAME roms in ~/RetroPie/roms/arcade
  2. Make sure you have the right BIOS for the game you downloaded. The most classic example is Neo-Geo games, which all require the same BIOS to startup. Simply extract the Neo Geo bios in the ~/RetroPie/BIOS/ folder. 
  3. Maybe you can try using another MAME emulator. Indeed, when you start a game, you probably noticed that if you press a button right away, this will take you to a configuration screen. In this screen, you can change the emulator you want to use for each rom. Who knows, it can't hurt to try.
How do you play multiplayer games?
RetroPie lets you connect multiple USB controllers at once. As long as you configure every controller to your liking, all you have to do is start the game, and every controller will be assigned to a different controller port in the emulated console. In the bottom-left corner of the screen, when you start the game, you should see the name of every connected controller flash for a brief moment, showing in which controller port of RetroPie it is connected.

It can happen that the player who planned on being Player 1 will end up being another player. I don't fully understand how RetroPie decides which controller goes to which player in the emulator. However, I found a useful tool called Joystick Selection which lets you make that decision manually. It's quite easy to use and well documented for what it is, check it out!

Things get more complicated if you only have one controller and want to use the keyboard as your second controller. It's definitely possible, but despite trying by following these guidelines, I have not been able to do it myself. Try it out and let me know in the comments if you succeeded!
How do you configure the controller input only for a certain console? 
Note: I highly doubt this section will be relevant to you, it's more a way for me to remember steps I did to solve a specific problem I encountered.

This is a Sega Genesis controller. Since the Sega Genesis is my favorite game console of all time, I had to find a way to play games on the RetroPie with a controller that had a similar button layout. The USB controller I ended using is the Hori Fighting Commander 4

The issue I initially faced with it was that RetroPie expects you to use a controller with a button layout similar to that of the Super Nintendo:

I wanted to map the "A B C" buttons of the Sega Genesis to the "X O R2" buttons of my Hori controller, respectively. Instead, because every console controller in RetroPie is built around the SNES controller, the "A B C" buttons were mapped to the "Y B A" buttons, which consequently were the "Square X O" buttons on my Hori. This was a messy problem, and although I doubt many of you will have to face it, I'm putting my solution out there just in case anyone needs it. I don't think it's 100% perfect, but it's the only one that worked for me which didn't involve much tinkering.

First, select a game for the console you want to configure (in my case, it was Sega Genesis). When the game starts, press Select + X (referring to the SNES -type RetroPie controller configuration) to open RetroArch menu. You will then want to go to Settings -> Input  -> Input User 1 Binds -> User 1 Bind All:

This will pop-up a dialog box that will give you 4 seconds to map every button available for this console. This is different than the RetroPie controller config you must be used to right now. In RetroArch, when it writes button "A", for example, it's "A" on the controller of the console you're currently emulating, as opposed to the location of "A" on a Super Nintendo pad. It is therefore entirely possible you'll match a different number of buttons than those found on a Super Nintendo pad. 
 One thing to note is that this will map these buttons only for when your controller is for player 1. If you find that the button mapping does not work anymore when your controller is plugged into another player port, you might need to configure all of the player ports for that controller. Once that is done, go back to the main menu and save your new config:

 A small message in yellow (pictured above) will appear in the lower left of your screen, telling your new config has been saved at ~/.config/retroarch/config/<config name>.cfg. In my case, the emulator name was "picodrive_libretro", so my config file was picodrive_libretro.cfg.

The final step is to tell your RetroPie emulator to use this config when you use this system. Do cd ~/.config/retroarch/config/<console>/ and nano retroarch.cfg. You will have to change the last line to "#include ~/.config/retroarch/config/<config name>.cfg"

Press Ctrl-X to save and exit the text editor, and we're done. Phew!