questions about runcommand.sh
-
@meleu And can these include variables (like selected ROM name)? This is fantastic for what I want to do too!
-
@caver01 said in A question about runcommand.sh:
@meleu And can these include variables (like selected ROM name)?
oo oh... I don't think so...
Look how they are invoked:
runcommand-onstart.sh
:
https://github.com/RetroPie/RetroPie-Setup/blob/master/scriptmodules/supplementary/runcommand/runcommand.sh#L763runcommand-onend.sh
:
https://github.com/RetroPie/RetroPie-Setup/blob/master/scriptmodules/supplementary/runcommand/runcommand.sh#L829The ROM name usually is the 4th argument given to the
runcommand.sh
and theruncommand-on[start|end].sh
do not have access to these arguments.I think the function get_params on
runcommand.sh
creates a global variablerom
, as we can see here (this variable isn't declared aslocal
, so it's a global variable). Maybe you can give to @BuZz a good reason toexport
this variable and access it inruncommand-onend.sh
.OR BETTER YET: change the the commands that invoke these scripts adding
$@
in the end so they both can get access to theruncommand.sh
parameters. -
@meleu Yeah, it makes sense to have access to these variables. Looking back a few years, I had a system running the Maximus Arcade front end. Many of us probably remember this one. Anyway, one of the settings you could configure per emulator is a RUN BEFORE and a RUN AFTER command (with variables passed). Not everyone used it, but you could do some really flexible things with it that are very similar to how our runcommand is used to set the display resolution, for example. I used it to do a pre-config by copying a configuration file matching the ROM NAME (or rather, a disk image for MESS using that forwarded parameter) into the working directory for MESS on the pre-execution, then on post, I would save that config back to it's holding folder. This allowed me to load my keyboard map for a given disk image, and more importantly, edit the mapping using the MESS GUI, and when I exited, it would be saved. Later, that saved file would be recalled and copied back into place when that ROM (disk image) was selected.
This required two (three) things. 1. A pre/post execution script. 2. Passing parameters so the script was aware of the ROM selected. (3. a parameter for the emulator chosen).
Looking back, I suppose I could have used the ROM parameter in the emulator launch command to point to the appropriate config. I don't remember if I tried that or not. Maybe I did and it failed when the config didn't exist and this was my workaround.
Anyway, I'd really like to be able to do custom keys on disk images (mostly games) for the Apple II emulator. As far as I know, I can't customize the keys in LinApple via configs, so I am looking at MESS.
-
@caver01
I added it and made a Pull Request:
https://github.com/RetroPie/RetroPie-Setup/pull/1610Let's wait if it'll be merged. Crossing fingers!
-
Ooops! It didn't... :~(
-
@meleu Bummer, but I don't fully understand the reason. Thanks for asking a clarifying question.
-
@caver01 I put some more details on the PR.
-
@caver01 the newest version of linapple does let you configure which controller, buttons and axis. If you download the newest one you need to copy the linapple.conf from the /opt/retropie/emulators/linapple/ to the /opt/retropie/configs/apple2 folder overwriting the old config
-
@BuZz Makes sense. There is a better way obtain the chosen ROM and Emulator then? I'd certainly rather work within the overall vision than branch off on my own, especially if it's something others might be able use.
-
@edmaul69 said in A question about runcommand.sh:
@caver01 the newest version of linapple does let you configure which controller, buttons and axis. If you download the newest one you need to copy the linapple.conf from the /opt/retropie/emulators/linapple/ to the /opt/retropie/configs/apple2 folder overwriting the old config
I want to pick this up on another thread. This sounds promising!
-
There is - processing order needs to change - I will implement it.
-
the PR didn't actually work btw - it would try and launch a script with the parameters as the name of the script. You would need to do
bash "$configdir/all/runcommand-onstart.sh" "$@"
notbash "$configdir/all/runcommand-onstart.sh $@"
-
-
@BuZz Really cool man! Thanks!
-
Another runcommand question:
Why
runcommand.log
went to/dev/shm
? -
ram based.
-
@BuZz
one more question...Premise: thinking in RetroArch only.
I'm using
runcommand-onstart.sh
to change a system specific'sretroarch.cfg
before launching the game. Is the$system
passed toruncommand-onstart.sh
a valid configdir?In other words, can I use
/opt/retropie/configs/$system/retroarch.cfg
?I'm doing this way and it's working fine for the classic consoles (atari2600, nes, snes, megadrive, etc...). But I'm worried if this will work for any libretro emulator.
-
-
@BuZz
(* sigh * here I go bother you again...)would you mind to
export
thelog
variable inruncommand.sh
?reason:
make it accessible inruncommand-on{start,end}.sh
.use case:
Since users can execute custom commands inruncommand-on{start,end}.sh
some bugs can be inserted.
It would be a good practice for those who want to write something in these scripts, to log some info for bug tracking.
Another benefit: It helps us to help inexperienced users with problems because of third-partyon{start,end}
scripts. -
Just write your own log or use the same filename. Actually, I will redirect stderr to the log, so errors will get logged automatically.
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.