LowRes NX: Retroarch core installation instructions
-
I will begin explaining how we can make a module-script
Perhaps you know most things already.
But I think it best to explain all.Before we begin, you have to know something about :
1)- bash scripts
2)- bash functions
3)- variables
4)- user rights
5)- using the retropie_packages.sh script of Retropie-Setup1)- bash scripts
When you do a command in the cli or the terminal you already are doing some bash without knowing.
A bash script is just a text file containing one or multiple commands.
This way we can do more without typing all the commands one by one in the cli.
If we have made a script we can simply run it with :
bash filename.sh
By adding next on the first line of the script :
#!/usr/bin/env bash
or this :
#!/bin/bash
And by making the script executable with this :
chmod +x filename.sh
Then the computer knows it's a bash script and we just run the script like a regular executable, with :
./filename.sh
For making a module-script for Retropie-Setup it's not needed to know how you execute a script as this is done by the scripts of Retropie-Setup.
And a module-script doesn't do anything if executed as a standalone script, it depends on the RetroPie-Setup.2)- bash functions
Perhaps you already looked into a module-script before.
Well, I know from experience, at the beginning it doesn't look understandable.
You have to know what "bash functions" are.
On this page it's explained very well :
https://www.digitalocean.com/community/tutorials/an-introduction-to-useful-bash-aliases-and-functions
So now we know a "bash function" is specific library function that runs within a script when it is called upon.Retropie-Setup basically has functions of it's own and collects more functions from the module-scripts and this way we can use the functions in our module-script like
gitPullOrClone
to get the source of an emulator.
In itself a module-script has also functions for :- getting dependencies with depends function
- getting sources with sources function
- building the emulator with build function
- installing the emulator in the appropriate location with install function
- adding the emulator to the configs with the configure function
3)- variables
Variables can be used in bash.
Here is a basic example:pi@raspberrypi:~ $ var=ok pi@raspberrypi:~ $ echo $var ok
It will print the value of the variable.
In Retropie-Setup there are also variables like for the :
- build directory $md_build
- install directory $md_id
- normal user $user
- etc
Variables are also used for adding additional info when running a function or a script.
For example if you run a script with an option like this :
./filename.sh hello
hello becomes variable $1.
Now we can use this variable in our script.
For example we could add this line in the script :
echo $1
The script would then output :
hello
Options can also be used with functions, that way we can pass information from one function to another.4)- user rights
Difficult topic if you have never used it.
But it's much simpler once you understand.We are running the Retropie-Setup scripts always with sudo.
There is a reason for that as we have to put some files in administrator/root locations.
If we didn't usesudo
then we are the "user pi" and we could not save in particular "user root" directories.
Using root has also a dissadvantage.
If we want to do make or move a config file as a command in the module-script. This means that "user root" is the owner of the file.
When we run a game as "user pi" we want to write to this config file.
So we have to make sure that the config file has "user pi" ownership.
An example of making pi the owner is ( $user=pi is already set in Retroie-Setup ) :
chown $user:$user "$romdir/mame/mame.ini"5)- using the retropie_packages.sh script of Retropie-Setup
If we are making a module-script we want to test or execute the functions seperately so we can make the functions one by one.
For example we want to get the sources of the module-scriptlr-81
.
With retropie_packages.sh we can do that like this :
cd RetroPie-Setup
sudo ./retropie_packages.sh lr-81 sources
Now you will see that the files from github will be downloaded to :
/home/pi/RetroPie-Setup/tmp/buildWhen making a new module-script you can basically begin with a similar module-script.
Copy this one to a new name and begin to edit.
For example if you use the lr-81 then change lr-81 into, for example, lowres-nx.
Add the github link into the variable rp_module_repo.
Then the sources function for your lowres-nx could look like this :function sources_lowres-nx() { gitPullOrClone }
Etc.
end
I hope you understand the basics with this explanation.
We can discuss it on the way. -
@folly Thanks.
The part that was throwing me off in making the installer script, was the make file wasn't in the root folder of the Github repo.
Looking at a few other existing scripts, I finally figured out what I needed to do in the function:
function build_lr-lowresnx()
I had to add in the proper "cd" command to where the make file existed.
All good now!
I've updated the first post with the new RetroPie installer script method.
-
Aha, nice to know you have found a way to make it.
Great job !When I have some time for it then I will test the module-script.
There seem to be a lot of open source games.
Perhaps we can even share them here.Btw.
Was my explanation understandable and did it help ? -
-
@folly Awesome! thanks
Here's the PICO-8 one if you wanna test it and possibly add it too.
https://retropie.org.uk/forum/topic/30965/pico-8-retroarch-lr-retro8-core-installation-script
-
Just did one for lowres-nx.
Do you like it ? -
@dmmarti Scriptmodule looks good. I'd like to include this in RetroPie along with a pico-8 module. I've not checked yours but happy for you to submit a PR, but also happy to incorporate myself.
I would probably prefer the module name to be lr-lowres-nx but looks good.
-
@buzz ....awesome!
I think I'd prefer you to do it. In this case, I hard-coded the information within the script modules that are normally within the "platforms.cfg" file.
I think it would be best if you do it since you would probably update the platforms file and make the proper adjustments within the script modules along with the names you'd prefer to use for lowres-nx and pico-8 systems.
-
Great to hear that you want to add these ;-)
Can you let me know when you add these ?
Then I will remove them from my repository, as they are no longer needed there. -
I found that some games require touch or mouse.
I have experimented, but I didn't find a solution.
Can you have a look ?
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.