Whilst the solution overall is relatively straightforward, I’ve gone into some depth in order that this post can serve as a general how-to guide, providing some insights into Bash shell scripts, including: installing scripts using the desktop GUI or command line tools; how the code file is made executable; automatically running a script after login, and after programs are exited by the user; and other related concepts.
Adding Code to Launch the Menu
– updating the .bashrc script to automatically run the menu when the Raspberry Pi first logs in
– preventing the menu from loading when Bash terminal windows are opened in the desktop, or when a remote SSH session is launched
As noted in the post detailing the installation of the Multipurpose Pi system, the RetroPie emulator system cannot be launched from the X-WindowsRaspbian desktop GUI. This restriction forced the requirement that the Pi boot to the text-mode Bash terminal, which in turn required launching of a chosen application suite via typed commands:
startx for the Raspbian desktop, kodi for the Kodi Media Center, and emulationstation for RetroPie.
Whilst this wasn’t a major issue, I wanted a method to launch a given suite without having to type commands at the Bash terminal – ideally via a menu-driven selection system. Whilst this necessarily must be text-based, it is friendlier than facing a blank command prompt upon booting.
Furthermore, I wanted the menu to automatically run when the Pi boots to the terminal, and also to be re-displayed whenever the user closes one of the selected application suites (using Kodi‘s power button, Emulation Station‘s Quit submenu, or Raspbian desktop’s main menu Shutdown option):
In this post I’ll be documenting how I set up a Raspberry Pi 3 (you can also use a Pi 2) as a lightweight PC replacement, combining a fully-fledged desktop GUI (Raspbian), Media Center (Kodi), and video games console and computer emulation suite (RetroPie).
The Pi 3 actually makes for a very capable PC replacement; this, and recent, posts, including graphics work, have been undertaken solely on the machine.
I have a couple of older Raspberry Pi machines, each of which is limited to a single task. The Model 1 Pi has been doing duty for a couple of years as a media center, and is dedicated to running XBMC (named for XBox Media Center, showing the roots of the project which is now known as Kodi).
The Pi 2 is currently used for retro video gaming, running an installation of RetroPie 2; I ill-advisedly used the retropie_setup.sh script option to delete Raspbian files that were not directly needed by RetroPie, thereby removing the option of using the machine as a desktop replacement.
Having taken delivery of a shiny new Raspberry Pi 3 I was keen to take advantage of the increased power of the machine, along with a sizable 64GB SD Card, using it to perform multiple duties: a media center, a retro-gaming system, and PC workstation. I also wanted to avoid the need for swapping SD Cards, which is both a hassle and introduces needless wear and tear on the card port.
Retropie’s PCSX-ReARMed PlayStation emulator supports analogue controls, however enabling support is a little unintuitive, although not difficult. There are a few small limitations and quirks, most of which are easily circumvented, as discussed below.
For the most authentic experience, a genuine PlayStation DualShock analogue controller is recommended, or a functionally equivalent device (for instance I also use a wireless Xbox 360 controller). I am also assuming the use of a USB controller adaptor, such as a Mayflash or Wise unit (see my earlier post entitled What is RetroPie? System overview, software and hardware).
For analogue (and digital) controls a suitable joystick configuration file is required. Unfortunately controller setup can be nontrivial, and is beyond the scope of the current post; I am, however, planning to cover this topic in the near future.
Enabling Analogue Input via the RetroArch/Libretro Menu
With appropriate hardware in place, along with controller mappings, enabling analogue input requires access to the RetroArch/Libretro menu. For a little background, and further details, please see the following related posts:
As stated in the main Emulation Legality page, this is a complex issue (and differs across jurisdictions throughout the world). Anyone wishing to make backups of their own games is urged to conduct their own research before proceeding.
Stances towards the use of emulators and images/roms/iso’s differs from country to country, from hardware manufacturer to manufacturer, and from software developer to developer.
Nintendo, for example, provides detailed information regarding that company’s standpoint with regards to the use of emulators and game images: