Skip to content

Instantly share code, notes, and snippets.

@rabejens
Created March 30, 2018 22:09
Show Gist options
  • Save rabejens/3bfd39032bbbbc0cef04385db45dfef5 to your computer and use it in GitHub Desktop.
Save rabejens/3bfd39032bbbbc0cef04385db45dfef5 to your computer and use it in GitHub Desktop.
Extend Amiberry to multiple emulators
First, alter your ~/.profile file.
Look for a line that says:
```bash
bootstartingemulator
```
Replace this with:
```bash
mytty=`tty`
if [ "$mytty" == "/dev/tty1" ]; then
bootstartingemulator
fi
```
If you login via SSH then, it won't attempt to start the emulator.
Now, edit the following three scripts:
- /usr/local/bin/3
- /usr/local/bin/3noconf
- /usr/local/bin/bootstartingemulator
You will see something like this:
```bash
# start the selected emulator
runaberrypi3conf
```
The second line may vary but the first line should be there.
Change this to:
```bash
runemulatorconf
```
And, in `3noconf`, change
```bash
# start the selected emulator
runaberrypi3
```
to:
```bash
# start the selected emulator
runemulator
```
Now, the next thing is a chore.
You have to edit ALL scripts in /usr/local/bin that say runaberryX, runaberryXconf, aberryX, aberryXconf to not change the scripts themselves but set symbolic links. I give `aberrypi3` as an example:
The `aberrypi3` script:
```bash
#!/bin/bash
# Set default to Amiberry SDL1 for Raspberry Pi3 by Dimitris
# Copyright © 2018 Amibian.net
# All rights reserved
# Welcome message
echo -e "\n${bold}This will set default emulator to Amiberry (SDL1) for Raspberry Pi3 by Dimitris"
# Prompt to continue
read -p " Continue? (y/n) " ans
if [[ $ans != "y" ]]; then
echo -e "\nQuitting...\n"
exit
fi
echo
# Change the emulator configurations with symlinks
rm /usr/local/bin/runemulator /usr/local/bin/runemulatorconf
ln -s /usr/local/bin/runaberrypi3 /usr/local/bin/runemulator
ln -s /usr/local/bin/runaberrypi3conf /usr/local/bin/runemulatorconf
# to see what emulator is selected
echo "Selected emulator: amiberry-rpi3-sdl1" >/root/amibian/help_texts/selected_emulator
# confirmation
echo -e "Default emulator is now Amiberry (SDL1) for Raspberry Pi3 by Dimitris.${normal}"
echo -e "Emulator configurations from Chips UAE4ARM do not work with this version.${normal}"
```
You have to adapt the other configuration-changing scripts accordingly. If you know you only use a special version of the Pi, you can omit some of the scripts you never use anyway.
Then, run `aberrypi3` (or the according script you changed for your Pi) and enter "3" and press Enter to verify it is working.
Now, adding more emulators is straightforward.
I used the RetroPie Setup Script at https://github.com/RetroPie/RetroPie-Setup to install additional emulators. Just create a `computertype` and `runcomputertype` script that symlinks the appropriate emulator executable to `/usr/local/bin/runemulator` and `/usr/local/bin/runemulatorconf` (for the Non-Amiga emulators both can point to the same location).
Now you need to copy `/usr/local/bin/7` to `/usr/local/bin/8` (and 9, 10, 11...) and adapt it. The `7` script, for example, contains:
```bash
#!/bin/bash
#to show the emulator selection menu
# Copyright © 2018 Amibian.net
# All rights reserved
# clear the screen
clear
# show the emulator selection menu
cat /root/amibian/.menu_files/copyrights_small
cat /root/amibian/.amibian_version
cat /root/amibian/.menu_files/cli2
cat /root/amibian/.menu_files/header
cat /root/amibian/.menu_files/promotion
cat /root/amibian/help_texts/selected_emulator
cat /root/amibian/.menu_files/emulator_menu
```
The last line is important. Here, you just change the name, like, from `emulator_menu` to `atari800_emulator_menu`.
You have to create this file (a normal text file) that is just the content of the menu. My `atari800_emulator_menu`, for example, contains:
```bash
Type a command and hit enter
Commands What they do
-----------------------------------------------------------------------------------------------
atari8bit Changes default emulator to Atari800
runatari8bit Runs Atari800
-----------------------------------------------------------------------------------------------
menu Bring up main menu again
-----------------------------------------------------------------------------------------------
```
You can continue with a lot more emulators.
Only caveat is that you have to configure the emulators in their own menus, but I am OK with this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment