shell scripting topic
-
@lilbud it's possible. But you have to specify where do you want to apply the overlay (specific for a game? specific for a system?).
Expand the use case.
-
-
@meleu The script would apply the overlay to all systems automatically. Individual systems can be modified when launching a game from the system where the user doesn't want an overlay, like GB/GBC/GBA or other hand held systems were aspect ratio is not 4:3
@cyperghost Something like that would be nice for this, having the script and be able to choose which systems you want the overlay to be applied to.
-
@lilbud automatically means to invoke
runcommand-onstart.sh
I think it's doable but we need more input about usecase...I think there is a need of 2 parts....
- Part let you choose overlay for special system
- Invokes seleceted overlay to system on start of emulator run
I think.... you should start coding. And we will help you ;)
You can read the full thread I've posted ... The issue here was solved in an efficient way (imho) -
@lilbud said in shell scripting topic:
@meleu The script would apply the overlay to all systems automatically.
I'm not sure if an overlay for all systems would look good. I think some systems have a different aspect ratio.
As @cyperghost said, we can help you once you start the coding. But maybe the fastest solution is to use rpie-art tool. Learning how to create an
info.txt
file is faster than learning a programing language.Here is the
info.txt
creation doc: https://github.com/meleu/rpie-art/blob/master/INFO.md -
@meleu Yes... therefore the runcommand-onstart. $1 shows current used system. So there is a way to set an overlay for a specfic system ... ;)
-
@meleu @cyperghost I had this to start with:
sed -i 's/01.png/08.png/g' overlay.cfg
Something feels missing, not sure what at the moment.
-
@lilbud where is placed the script with that line of code? maybe you have to use the full path to the
overlay.cfg
. -
@meleu I believe it is placed in the overlay directory.
opt/retropie/configs/all/retroarch/overlay
-
@lilbud Just start coding use echo commands to show results in your bash
You can testsed
commands directly from CLI and results will be marked red.
Don't use-i
parameter for testing... it will directly write to input file and may give unwantend results. If you want create altered files then work with direction> output-file
first.If all works then use
-i
-
@cyperghost Ok, I can get the original command to replace the text, but only if both fields are specified.
sed -i 's/01.png/08.png/g' overlay.cfg
This works fine, 01.png is replaced with 08.png. But what would I put in the first field if the overlay name is not 01.png. Something like this?:
sed -i 's/${FILENAME}.png/08.png/g' overlay.cfg
-
@lilbud You can use a wildcard:
sed -i 's/.*.png/08.png/g' overlay.cfg
Note that this will replace any
<filename>.png
in the file with08.png
. -
@lilbud I'm still not sure what your goal is.
Anwer yourself:- Where is the
overlay.cfg
located? - In which case do you want to alter overlays?
- Is there a "system" in altering names (Maybe $EMU-$ROMNAME-$TAG.png?)
Imho ... here's is a good script that writes several information in /boot/config.txt and checks existance of data before.
For graphics menu layout you can use this it uses arrays for graphics menu and here is a Howto for dialog/whiptail usage.
Here is the RetroPie wiki and how to input paramters into your script.
- Where is the
-
@cyperghost okay
-
Overlay.cfg located in default directory, /opt/retrofit/configs/all/retroarch/overlay
-
The point of the script is to provide a way a to switch and choose the overlay from the retropie menu in ES.
-
So choosing overlay named, '08.png, will do a few things. It will check for an overlay in use. If one is found, then the cfg file will be modified to show the path of the wanted overlay.png, (/my/awesome/overlay/8.png).
-
Once the overlay is selected, the main retroarch.cfg will be modified with the viewport settings and the overlay.
Anything else needing further explanation?
-
-
@lilbud No I understood.
All the links I've provided to you will help you to code this.
Just start over with the selection menu ;) -
@cyperghost If I can find a way to get the script done during class, I'll see if I can work on it.
I think there is bash on my school computer...
-
@lilbud
Bash? School computer?Code on your Pie!
All you need is a SSH terminal andnano
as editorSo you I would do the following.
- You write a selection menu that provides a layout for selected system and save it to config
- You write an "enabler" that sets overlay according to choosen system
;)
-
@cyperghost I don't have access to my pi in school, besides, the schools network is locked to any device that isn't a school issued computer.
-
@cyperghost said in shell scripting topic:
For graphics menu layout you can use this
I'm afraid that a scriptmodule isn't a good example for starters ;-)
@lilbud said in shell scripting topic:
Anything else needing further explanation?
Yes, post your code in ghostbin or something so we can give more effective guidance.
-
@meleu I'll have to redo it today, I'll post a link later.
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.