XINIT and ;
-
@sleve_mcdichael
If my CLI knowledge is on par, theecho
command is stopping at the first;
like it should because that symbol signals the end of one command and the beginning of another, or taking the place of a line break.If you want the whole thing echoed I think you need to use a set of
( )
around everything you want the echo to apply to. -
@YFZdude I tried putting parentheses both around everything, and inside the outermost quotes. Results were different each time but neither was correct.
pi@retropie:~ $ echo -e ("\nExecuting (via xinit): "pushd /home/pi/RetroPie/roms/ports/sorr; cp /dev/shm/retropie_xinitrc ~; /opt/retropie/ports/sorr/bgdi-333 "./SorR.dat"; popd"\n") -bash: syntax error near unexpected token `(' pi@retropie:~ $ echo -e "(\nExecuting (via xinit): "pushd /home/pi/RetroPie/roms/ports/sorr; cp /dev/shm/retropie_xinitrc ~; /opt/retropie/ports/sorr/bgdi-333 "./SorR.dat"; popd"\n)" ( Executing (via xinit): pushd /home/pi/RetroPie/roms/ports/sorr cp: cannot stat '/dev/shm/retropie_xinitrc': No such file or directory ./SorR.dat: doesn't exist or isn't version 7 DCB compatible -bash: popd\n): command not found pi@retropie:~ $
-
@sleve_mcdichael You will need to use a launch script if you need to do that when using XINIT:
-
@sleve_mcdichael
After thinking about it and playing with a test command I remembered the trick.You need to escape the
;
characters with a\
before each one so it will treat them as text instead of the command separator function.echo -e this should\; print as \; one line
-
@YFZdude would that I were merely crafting an
echo
command whole-cloth, that would be great. Unfortunately, it is generated automatically by whatever is inemulators.cfg
; I can't just escape the semicolons in one place but not the other, (I mean, I'm sure someone probably can, but I wouldn't know where to start.)@BuZz so something like
lr-nxengine
does then, yeah? First, I'd do anaddPort
with justXINIT:<command>
, and then overwrite that automatically-generated launch script with a custom one:[...] addPort "bgdi-333" "sorr" "Streets of Rage Remake" "XINIT:$md_inst/bgdi-333 %ROM%" "./SorR.dat" local file="$romdir/ports/Streets of Rage Remake.sh" cat > "$file" << _EOF_ #!/bin/bash pushd "$romdir/ports/sorr" "$rootdir/supplementary/runcommand/runcommand.sh" 0 _PORT_ "sorr" "./SorR.dat" popd _EOF_ chown $user:$user "$file" chmod +x "$file" [...]
Like that?
-
@sleve_mcdichael Don't mix
runcommand
into your launch script. -
@mitu ...er, why? Literally every launch script in my ports folder uses runcommand:
pi@retropie:~/RetroPie/roms/ports $ grep *.sh -e runcommand.sh am2r.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "droidports" "/home/pi/RetroPie/roms/ports/droidports/am2r_155.apk" cavestory.sh: "/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ cavestory "/home/pi/RetroPie/roms/ports/CaveStory/Doukutsu.exe" doom2-htp.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "doom" "/home/pi/RetroPie/roms/ports/doom/htp/DOOM2.WAD" doom2-nerve.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "doom" "/home/pi/RetroPie/roms/ports/doom/nerve/DOOM2.WAD" doom2-pg.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "doom" "/home/pi/RetroPie/roms/ports/doom/pg/DOOM2.WAD" doom2.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "doom" "/home/pi/RetroPie/roms/ports/doom/doom2/DOOM2.WAD" doom-jptr.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "doom" "/home/pi/RetroPie/roms/ports/doom/jptr/DOOM.WAD" doom-sigil.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "doom" "/home/pi/RetroPie/roms/ports/doom/sigil/DOOM.WAD" doom-ultimate.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "doom" "/home/pi/RetroPie/roms/ports/doom/ultimate/DOOM.WAD" duke3d.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "duke3d" "-j /home/pi/RetroPie/roms/ports/duke3d/" duke-dc.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "duke3d" "-j /home/pi/RetroPie/roms/ports/duke3d -g dc/dukedc.grp" duke-nw.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "duke3d" "-j /home/pi/RetroPie/roms/ports/duke3d -g nw/nwinter.grp -x nw/nwinter.con" duke-vacation.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "duke3d" "-j /home/pi/RetroPie/roms/ports/duke3d -g vacation/vacation.grp -x vacation/game.con -j /home/pi/RetroPie/roms/ports/duke3d/vacation" finaldoom1.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "doom" "/home/pi/RetroPie/roms/ports/doom/finaldoom1/TNT.WAD" finaldoom2.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "doom" "/home/pi/RetroPie/roms/ports/doom/finaldoom2/PLUTONIA.WAD" freedoom1.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "doom" "/home/pi/RetroPie/roms/ports/doom//freedoom1/FREEDOOM1.WAD" freedoom2.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "doom" "/home/pi/RetroPie/roms/ports/doom/freedoom2/FREEDOOM2.WAD" hcl.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "hcl" "" hurrican.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "hurrican" "" maldita.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "droidports" "/home/pi/RetroPie/roms/ports/droidports/Maldita_Castilla_ouya.apk" marathon1.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "alephone" "/home/pi/RetroPie/roms/ports/alephone/Marathon/" marathon2.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "alephone" "/home/pi/RetroPie/roms/ports/alephone/Marathon 2/" marathon3.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "alephone" "/home/pi/RetroPie/roms/ports/alephone/Marathon Infinity/" quake-dopa.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "quake" "/home/pi/RetroPie/roms/ports/quake/dopa/pak0.pak" quake-hipnotic.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "quake" "/home/pi/RetroPie/roms/ports/quake/hipnotic/pak0.pak" quake-rogue.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "quake" "/home/pi/RetroPie/roms/ports/quake/rogue/pak0.pak" quake.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "quake" "/home/pi/RetroPie/roms/ports/quake/id1/pak0.pak"sorr.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "sorr" "./SorR.dat" supertux.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "supertux" "" sw-dragon.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "sw" "-gdragon.zip" sw.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "sw" "" sw-wt.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "sw" "-gwt.grp" wolf3d.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "wolf3d" "/home/pi/RetroPie/roms/ports/wolf3d/vswap.wl6"wolf-sd1.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "wolf3d" "/home/pi/RetroPie/roms/ports/wolf3d/vswap.sd1" wolf-sd2.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "wolf3d" "/home/pi/RetroPie/roms/ports/wolf3d/vswap.sd2" wolf-sd3.sh:"/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "wolf3d" "/home/pi/RetroPie/roms/ports/wolf3d/vswap.sd3"
I based it on what
lr-nxengine.sh
does for Cave Story:addPort "$md_id" "cavestory" "Cave Story" "$md_inst/nxengine_libretro.so" local file="$romdir/ports/Cave Story.sh" # custom launch script - if the data files are not found, warn the user cat >"$file" << _EOF_ #!/bin/bash if [[ ! -f "$romdir/ports/CaveStory/Doukutsu.exe" ]]; then dialog --no-cancel --pause "$md_help" 22 76 15 else "$rootdir/supplementary/runcommand/runcommand.sh" 0 _PORT_ cavestory "$romdir/ports/CaveStory/Doukutsu.exe" fi _EOF_ chown $user:$user "$file" chmod +x "$file"
Is this different because of
XINIT:
, or what do you mean?Edit: oh, is that going to "start over" in
~
, essentially "undoing" thepushd
? -
@sleve_mcdichael said in XINIT and ;:
Is this different because of XINIT:, or what do you mean?
Your script is called from
runcommand
, which takes care ofXINIT
handling, callingruncommand
again from your script doesn't makes sense. The script should just start the game. -
@mitu ah, so I'm not overwriting the "launch script" that's in
roms
likelr-nxengine
does, but adding, say, a "buffer" launch script in$md_inst
likewolf4sdl
oreduke32
do?Something like this then, maybe:
[...] addPort "bgdi-333" "sorr" "Streets of Rage Remake" "XINIT:$md_inst/$md_id.sh %ROM%" "./SorR.dat" local file="$md_inst/$md_id.sh" cat > "$file" << _EOF_ #!/bin/bash pushd "$romdir/ports/sorr" "$md_inst/bgdi-333" \$* popd _EOF_ chown $user:$user "$file" chmod +x "$file" [[ -f "$romdir/ports/$md_id/SorMaker.dat" || "$md_mode" == "remove" ]] && addPort "bgdi-333" "sorr" "SorMaker" "XINIT:$md_inst/$md_id.sh %ROM%" "./SorMaker.dat" [...]
Edit: changed the commands a little. Does this work to pass
%ROM%
as additional arguments? And does that last line work like I think it does? -
That looks better.
Edit: changed the commands a little. Does this work to pass %ROM% as additional arguments?
Yes, you'd get it in
$1
(1st arg), but I'm not sure if it help or is useful in this case. You can just passSorR.dat
as argument to the starting game script. -
@mitu sorry I made another edit. I want to pass that as the %ROM% parameter so we can make another menu entry for the level editor.
-
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.