Controller support in NOOBS?
-
My Retropie setup is on a dual boot system with OSMC for Kodi and Raspbian Lite for Retropie. I have my Hori PS4 fighting controllers set up in both systems perfectly.
But I can't use the controller to select my OS at bootup. This may not be the best forum to ask this, but has anyone successfully set up game controllers to work in noobs? Even if it just had to emulate a keyboard, I just need the up and down keys and an enter button.
-
I've been running a dual boot between RetroPie and OSMC using NOOBS for nearly two years and never had any trouble with controllers myself. I just last week switch to using PINN, which is based off of NOOBS and haven't had a problem with any of my controllers yet either. In theory, everything should run the same.
Edit: I just realized you stated OS boot selection. I know how to handle this, but it's a busy day here and it'll take a little time for me to get my thoughts together and post.
-
Outside of adding an external key-mapping solution to to your base NOOBS partition, controller support isn't going to be an option for the boot selection screen. However, you can eliminate the boot selection screen from the equation altogether and have it handled through Emulation Station on the RetroPie side, as well as a custom launcher addon on the OSMC/Kodi side of things. Assuming that your controller is mapped in both environments, you'll have uninterrupted controller support.
First, NOOBS will always ask which partition to boot from at startup unless a text file named
autoboot.txt
is located in NOOBS boot partition that specifies which partition to autoload. However, with a dual boot, that information needs to change so that NOOBS can be told to auto-boot to OSMC when called from RetroPie and RetroPie when called from OSMC. In RetroPie this can be done by creating a script that can be run from the 'Kodi' menu of Emulation Station. You'll need to make sure that.sh .SH
exist as valid file types and 'bash' exists as a valid command for the Kodi system in/opt/retropie/configs/all/emulationstation/es_systems.cfg
as seen below.<system> <name>kodi</name> <fullname>KODI Media Centre</fullname> <path>~/RetroPie/roms/kodi</path> <extension>.sh .SH</extension> <command>bash %ROM%</command> <platform>linux</platform> <theme>kodi</theme> </system>
From there, you'd create a script that would first shut down Emulation Station cleanly, so that metadata is saved and then mount the NOOBS partition, place the
autoboot.txt
file in the required loacation, telling NOOBS to auto-boot to OSMC and finally, reboot the system. Since all this is pretty involved, I'll put a download link below with the files I use. I'll also retain their directory structure, so you'll know where they go. Feel free to look at every file, but you'll only need to change one or two minor things for your own install, which I'll detail at the end.Setting the Auto-boot from OSMC to RetroPie is a little more complicated at face value, but again, I've got all the work done and will put it in the download. Kodi requires that a script be launched through an addon. The one I'll include is pretty nice. It's a modified version of the addon created for the Multi Boot Pi images that are no longer available. It has its own icon with the RetroPie logo, announces with a UI element; 'Now launching RetroPie' and even plays a little video game blast sound before it does its magic. But basically all its doing is calling a script that accomplishes the same thing as above.
The only other thing to note is that I'll also include two scripts that are to be put in
/home/pi/RetroPie/retropiemenu/
. These are optional, but will allow the possibility to always boot to OSMC when RetroPie is rebooted. If selected, the script switches to give you the menu option to reverse your decision.In using the files that I'm including, you should first put them all in their intended locations, which are:
RetroPie Partition:
/home/pi/.ss /home/pi/RetroPie/retropiemenu/boottokodi.sh /home/pi/RetroPie/retropiemenu/boottoretropie.s /home/pi/RetroPie/roms/kodi/killesmbp /home/pi/RetroPie/roms/kodi/Kodi.sh /opt/retropie/configs/all/emulationstation/downloaded_images/kodi/kodi.jpg /opt/retropie/configs/all/emulationstation/gamelists/kodi/gamelist.xml
OSMC Partition:
/home/osmc/.kodi/addons/script.retropie
Next, make sure all the scripts are executable with
chmod +x /path/to/script
After you've moved the files into place, the scripts are located at:RetroPie Partition:
/home/pi/RetroPie/retropiemenu/boottokodi.sh /home/pi/RetroPie/retropiemenu/boottoretropie.s /home/pi/RetroPie/roms/kodi/killesmbp /home/pi/RetroPie/roms/kodi/Kodi.sh
OSMC Partition:
/home/osmc/.kodi/addons/script.retropie/switch.sh
Dropping to the command line in RetroPie from Emulation Station is done with the 'F4' key and in OSMC, you'll invoke the shutdown menu with the 'S' key, specifically select 'Exit' and the press 'ESC' while the system is rebooting. Alternatively, this can all be done over SSH.
The last thing to be done is the most important. You'll need to figure out which partitions are the boot partitions for both RetroPie and OSMC. Making sure all the files were put in place earlier, you can mount the various partitions to examine at them. You can use the
config.txt
file as a clue. First of all, if you don't see that file, it's not the partition you're looking for. Second, RetroPie'sconfig.txt
is heavily annotated and OSMC's is not.NOOBS mounts its OS partitions at and beyond
/dev/mmcblk0p5
, so from RetroPie you can find both by starting with mounting:sudo mount /dev/mmcblk0p5 /home/pi/.ss/noobs
You can then check the partition's contents with
ls /home/pi/.ss/noobs
If it's not the boot partition for either, you can then unmount the partition with:
sudo umount /dev/mmcblk0p5
Rinse, wash and repeat until you've identified the boot partition number for RetroPie and OSMC. Once you have those numbers, the final step is adding them to:
RetroPie Partition: (
Add the OSMC boot partition number
)/home/pi/.ss/autobootkodi.txt
OSMC Partition: (
Add the RetroPie boot partition number
)/home/osmc/.kodi/addons/script.retropie/autoboot.txt
Seeing it all laid out, it's still an involved process, but it's also a set and forget situation that results in a workflow that is not only controller-friendly, but aesthetically pleasing and simple to use when completed.
Here is a link to the files.
-
Thank you so much for this tutorial. I am actually going to try tackling a keymap solution first, and if I'm successful I'll post the process here. If I fail, I'm going with your plan. 😀
-
@lyle_jp adding to the solution @mediamogul gave you, there is an easier way to do it:
https://www.matthuisman.nz/2017/02/kodi-noobs-companion-add-on.html?m=1 -
Very nice! You'd still want to create a script for Emulation Station to be able to boot back into OSMC, but that addon covers anything you might want to do in OSMC/Kodi. Impressive stuff.
Edit: Looking at it more closely. The addon even has an option to add 'Boot-Back' functionality to Emulation Station in RetroPie. That is indeed a one shot solution.
Edit 2: I'm going to install it on mine to make sure it cleanly shuts down Emulation Station to save metadata.
-
@mediamogul I think the addon creates a shortcut within ES as well if you take a closer look at the options of it. At least that's what I remember from when I was using a Dual boot setup. But maybe it was on a pre built multi boot image I've used that had those scripts included to switch between the systems. It's been too long since I actually used a multi boot system.
-
Good call. If you notice in my edit above, I read about it a little further down the article. I'm going to install it later today and see if it's exiting Emulation Station cleanly to save metadata. It really is a fantastic solution. I'm glad I did mine by hand to learn the ins and outs, but I'll likely replace my current arrangement with this, as it'll save me time with future installs.
-
@mediamogul I think I only had issues with the addon because I was running my games from a usb stick and the script to reboot into osmc never showed up because it was obviously created on the SD card. And since I got my second Pi shortly after I found the addon, I never looked if it actually existed and moved it to the stick.
-
I've given 'NOOBS Companion' a try and before I begin, it should be said up front that I believe this is definitely the easiest way to go about multi-booting without using the NOOBS boot screen. However, there are a few caveats that should be mentioned. First of all, the 'Boot-Back' script installed to RetroPie does not exit Emulation Station cleanly and any metadata changes or last played games will not be saved. This can be solved by adding your own routine to exit ES above the boot switch command. Something like the following should work.
ESPID="$(pgrep -f "/opt/retropie/supplementary/.*/emulationstation([^.]|$)")" if [ -n "$ESPID" ]; then kill "$ESPID" while s=$(ps -p "$ESPID" -o s=) && [ "$s" ] && [ "$s" != 'Z' ]; do sleep 1 done fi sleep 1
Another issue is that the NOOBS boot screen will still come up if you happen to reboot by any other means than the Kodi addon or ES script. This is because the
autoboot.txt
file is not being generated by this method. This is somewhat minor, but it should always be remembered for situations such as RetroPie updates.The final issue has already been touched upon by @EctoOne above. If using an external USB drive for ROMs in RetroPie, the Kodi addon will not install the ES script to the external location, but rather the default
~/RetroPie/roms/kodi/
. This can be solved by moving the script yourself to the analogous external location.I want to reiterate that I still like this way despite of it's drawbacks. It's much easier to setup and works well enough without any modifications in most cases. That said, I'm probably going to keep with the manual setup process I've been using, due to the more reliable behavior between reboot methods.
-
Something else that I've just noticed is that NOOBS Companion also alters
/opt/retropie/configs/all/emulationstation/es_systems.cfg
to allow the installed script to launch. The problem is that it seems to alter every system entry contained in the file. In many cases, this would only affect those who have Americanized their system listings (Genesis/MegaDrive etc). However, I have made various changes to this file that I maintain myself and anyone who does likewise would see those changes overwritten. Luckily, I always keep backups and was able to restore. A bigger issue might come in the future when thees_systems.cfg
file is changed by the RetroPie team at a distribution level. At that time, NOOBS Companion would override, but not overwrite those default settings with its own older base settings. -
@mediamogul said in Controller support in NOOBS?:
A bigger issue might come in the future when the es_systems.cfg file is changed by the RetroPie team at a distribution level.
You're referring to the user custom
es_systems.cfg
, the RetroPie scripts usually modify the system wide (you can call it distribution level) configuration file at/etc/emulationstation/es_systems.cfg
, so I don't think there's going to be a conflict here. I wonder though if an user hasn't customized the file, would the installation of said script copy and customize thees_systems.cfg
to the user's folder or just modify the system'ses_systems.cfg
? -
@mitu said in Controller support in NOOBS?:
I don't think there's going to be a conflict here.
Seeing as how niche all this is, it's unlikely to be much of an issue, but for those unaware that the Kodi addon alters this file, it could become a troubleshooting matter for those few later on. For instance, any visible file types added to the system-wide location would be ignored by the older file overriding it.
I wonder though if an user hasn't customized the file, would the installation of said script copy and customize the es_systems.cfg to the user's folder or just modify the system's es_systems.cfg ?
I took a quick look at the install script and it appeared to always copy and alter.
-
Just a quick question, wouldn't it be good to add those informations to the wiki as well?
I personally prefer using PINN on both of my Pis even though I only use one system on each of them. The reason is that they aren't very accessible behind my TV and PINN makes it easy to update/reinstall any OS without me having to remove the SD cards.
The only thing that bugs me a little bit, is that there is no official NOOBS build of Retropie. The one available in PINN is created by the developer of PINN, I'm not saying that there is something fishy about it (I have no clue how to even check that and the dev seems very nice and helpful) but there's always a chance that there might be something unwanted added.
I suggested PINN often here since I found it myself like half a year ago but since english is not my main language, I never dared to edit the wiki. -
@mediamogul I hope I didn‘t do much of a harm on your setup by recommending the addon. For me, it works perfectly, but I don‘t touch the system that much.
I must add that matthuisman is very responsive in his blog and will most likely improve his scripts if he reads this/someone reaches him. -
@ectoone said in Controller support in NOOBS?:
Just a quick question, wouldn't it be good to add those informations to the wiki as well?
It's probably best to leave this information to be fully detailed elsewhere. Officially recommending anything outside of the default image could potentially set a bad precedent and open the doors to support problems for the forum.
I hope I didn‘t do much of a harm on your setup by recommending the addon.
No, not at all. I was very excited to try it and happy to do so. Also, as I said earlier, under most circumstances, NOOBS Companion is still a nice option. Many of the issues I found are lessened by first time installs and with users such as you describe yourself to be, who don't maintain their own system modifications. The only things that would really affect all users is the metadata not being saved and the potential to boot into the NOOBS boot menu outside of the options made available by NOOBS Companion.
I must add that matthuisman is very responsive in his blog and will most likely improve his scripts if he reads this/someone reaches him.
I might try to contact him sometime in the near future, even if it's for nothing more than to incorporate a more appropriate shutdown sequence for Emulation Station.
-
@mediamogul regarding the
autoboot.txt
, I think the option „set to default boot“ does create that, but I don‘t have my pi to check right now. -
@paradadf said in Controller support in NOOBS?:
I think the option „set to default boot“ does create that, but I don‘t have my pi to check right now.
It does and the same option is also noted in the manual method above, but then you're limited to always booting and rebooting statically to the partition you chose, as opposed to booting and rebooting dynamically to the partition you're currently in, which is how the systems would behave normally without a multi-boot setup.
Generating a dynamic
autoboot.txt
could really be added by anyone to NOOBS Companion with very little trouble. All it would take is to add a reliable mount point directory into the addon file structure and then alter the script to mount the partition to that directory, add the file, unmount and reboot. Most Kodi addons are just directories and script files and its very easy to customize their behavior. -
@mediamogul now I got what was meant ;).
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.