Scripting help for replacing retroarch.cfg
-
@flashpc I probably have a script that I can modify to do what you want. I first have a few questions for you:
- (not really a question) Your command appears to be a simple copy command. You are copying a file name retroarch_shader.cfg from
/opt/retropie/configs/3do/
and you are just copying it to the same folder location. The cp command is copy, not an overwrite command. - I assume your intention is to overwrite the retroarch.cfg file? You want to be able to overwrite the file to run 1 of 3 different configurations, correct.
- Are you doing this for only 3DO? OR for all systems?
- (not really a question) Your command appears to be a simple copy command. You are copying a file name retroarch_shader.cfg from
-
Thanks for the reply,
That's right, my intention is overwrite the retroarch.cfg within the same folder with either of the 3 files.
And I'm intending to do this for all the systems that I've been working on (25 so far) -
@flashpc WOW - I have a script that will do what you want, but it would be a massive undertaking to write it for every system. If you want I can create a script for just one of your systems and then you can modify the script to add each of the other systems you want.
-
@tmntturtlguy that would be great, cheers
-
@flashpc here are the instructions - they are also in the script file.
This script lets you switch retroarch config files. v1
TMNTturtlguy - Sept 05 2017place script in /home/pi/RetroPie/retropiemenu/
In order to run the script you must create the following folders:
/opt/retropie/configs/all/emulationstation/retroarch_swap
Then within that folder create a folder for each system:
3do
Then within that folder create the following 3 folders:
overlay
shader
standard
full example path for 3DO =
/opt/retropie/configs/all/emulationstation/retroarch_swap/3do/overlay
Within each folder you have created place a
retroarch.cfg
file. The file needs to be named the same in each folder. Place your current retroarch_shader.cfg in the shader folder. Name the fild retroarch.cfg.
Restart EmulationStation and the script is located in the retropie menu- Take a look a the script and see if you can figure out how to add more systems. i currently have 3DO per your example and NES included. You need to create 3 lines for each system. For example, you need to copy lines A, B, C for both
while true; do
andcase
you then need to create 3 functions for each system. Simply copy them and change out the system names, ie, just copy the first 3 functions, change all 3do to psx for playstation.
here is a download link for the script. mega download link
Let me know if you have any questions.
- Take a look a the script and see if you can figure out how to add more systems. i currently have 3DO per your example and NES included. You need to create 3 lines for each system. For example, you need to copy lines A, B, C for both
-
@tmntturtlguy cheers buddy, its a bit late now, but I will have a go in the morning, thanks for this, it is very in depth, and I would have never have come up with anything like this.
Thank you very much
-
@flashpc You bet.
I have another idea, a cleaner script, but it would change all the systems to the same setup. Meaning you could run the script and it would change all systems to standard, or all systems to overlay. Would you prefer all systems to change at once? or would you like individual control like i have it set up now?
Thanks
-
@flashpc @TMNTturtlguy
I would rather use the User Menu and create three independent bash files.
The system name can be extracted by sytem call $1So the script are easily placed here as the wiki explains...
and would look like
shaders on.sh
#!/bin/bash # Replace retroarch configs in general cp -f "/opt/retropie/configs/$1/retroarch_shader.cfg" "/opt/retropie/configs/$1/retroarch.cfg" # Create file for detecting changes to shader touch "/opt/retropie/configs/$1/shaderchange.tmp"
in runcommand-onstart.sh you write
# Checks for `shaderchange.tmp` and reverts changes back if file is located if [[ -f "/opt/retropie/configs/$1/shaderchange.tmp" ]]; then cp -f "/opt/retropie/configs/$1/retroarch_standard.cfg" "/opt/retropie/configs/$1/retroarch.cfg" rm "/opt/retropie/configs/$1/shaderchange.tmp" fi
The advantage is... you've a general method that only depends on system description of $1 command....
Maybe @meleu gots a much better idea ;) -
@cyperghost can this script also change the overlay image in the retroarch/overlays folder?
-
@flashpc It depends just on the
cp
command
cp -f "/opt/retropie/configs/$1/retroarch_overlay.cfg" "/opt/retropie/configs/$1/retroarch.cfg"
will show your overlay.
So you create three bash files for user menu... I'm pretty sure it will work for all systems as $1 uses system names!
- cp overlays
- cp shaders
- cp standard (here comment out the touch command!)
The nice thing is, that with runcommand-onstart.sh every call will be checked if there was a system change and then the standard file will be changed back (if you don't want then just create the three bash files for User Menu and you are ready ;)
-
cheers guys, I'll have a play around tomorrow and see which option works best for the system I'm putting together.
Thanks again
-
@cyperghost said in Scripting help for replacing retroarch.cfg:
Maybe @meleu gots a much better idea ;)
Hello fellows. I'm little confused about the desired results here.
@FlashPC can you expand what are the results you expect?
EDIT: I've got the file copying/overwriting part, I'm just curious about what do you have in those files and if you want those configs only for some ROMs, etc.
-
@meleu the results I am trying to get is a script that will overwrite the retroarch.cfg file and a PNG file from either attract mode or emulation station without the need of a keyboard.
I have 3 copies of the retroarch.cfg file, one with the details for using custom overlays with additional crt shaders, one with just the crt shaders, and one with neither.
If you want to see the config files they are here
The outcome is to change the settings for the whole system, not just one game.
The person that I am making this build for can then choose whether they want;
All games for that system playable with a basic overlay with crt shaders.
All games for that system playable with a realistic overlay with crt shaders.
All games for that system playable with no overlay with crt shaders.
All games for that system playable with no overlay and no shaders.Once they have made their decision, the games for that system will follow those rules until they decide to change it, even if they reboot the system.
Hopefully that makes sense
Paul
-
@flashpc I think I've got what you want. I would use a different approach if I wanted those results. I would try to create new entries in the
/opt/retropie/configs/SYSTEM/emulators.cfg
, each new entry loading a differentretroarch.cfg
.Here is an example of how my
emulators.cfg
for NES looks like:lr-fceumm = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-fceumm/fceumm_libretro.so --config /opt/retropie/configs/nes/retroarch.cfg %ROM%" default = "lr-fceumm"
I would add these lines:
lr-fceumm-shader = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-fceumm/fceumm_libretro.so --config /opt/retropie/configs/nes/retroarch_shader.cfg %ROM%" lr-fceumm-overlay = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-fceumm/fceumm_libretro.so --config /opt/retropie/configs/nes/retroarch_overlay.cfg %ROM%"
And then your friend could change the behaviour in runcommand menu, changing the "emulator".
-
@meleu I like the idea, apart from the fact that they could potentially change aspects of the emulators, plus I can only seem to access the runcommand menu via a keyboard, and I am trying to change these with a controller only.
@tmntturtlguy I ran the script and it is nice, but is there anyway control could be made with the controller. just like the way retropie_setup.sh does?
-
@flashpc it should work with your controller. Did you follow the instructions and place the script in retropie menu folder? If run from the retropie menu it will run with a properly configured controller that is recognized as the first player.
-
@TMNTturtlguy yeah you are right, it just works in emulationstation, I've manage to get it working within attract mode using joymap, like the old days and KODI.
I really like the script, is there a way in which the first menu has you select the console and then a second menu will ask you to select a config
I've changed the code slightly to match my setup, there is a lot of text, and it does work, I was just thinking once the system has been selected in the first menu can that variable be used to populate the file addresses in the second menu
For example if you select Playstation in the first menu then it knows to look in the 'psx' folder
-
@flashpc said in Scripting help for replacing retroarch.cfg:
@meleu I like the idea, apart from the fact that they could potentially change aspects of the emulators,
Not sure what you mean here.
I can only seem to access the runcommand menu via a keyboard, and I am trying to change these with a controller only.
Every connected controller can invoke runcommand menu. After choosing a game to play press the button you set for A several times until runcommand menu appears.
-
@meleu from the runcommand you can select emulators for the complete system, as well as per game. If this is done and the game is not compatible with the new emulator then it wont load, (arcade for example) so I would like to avoid that as I will not be able to help once he takes the box away with him.
and I don't know about accessing the menu from a controller, I tap the 'X' on my controller which is set to A in emulationstation and it just loads the games, but pressing 'ENTER' on the keyboard works every time.
-
@flashpc Wow, you have done a lot of work on this! As far as adding a second menu, I am sure there is a way to do it. I am not an expert on scripts, i just know enough to be dangerous! So my short answer is, I don't know how to do it off hand. I would have to spend some time researching/playing with it. Maybe @meleu can share some insight on how to modify the main menu and and add a second menu for each console.
My other thought would be to simplify the entire script so that the end user only has 3 choices.
- Standard
- Shaders
- Overlay
When they select any of the options, the script runs and sets all emulators to the same configuration. You would still have a separate retroarch.cfg file for each system as you currently do, so you can control the exact outcome of each system, it is just that when the user wants overlays on NES, then all systems will have overlays. In my opinion this is how I would set it up. It is clean and easy. The end user has 3 choices and running the script is fast and easy, so it isn't like it is that big of an issue to go in and change it.
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.