Ports and Launch Menu Art
-
I have runcommand launch menu art enabled. This disables the runcommand dialog box that says "press any key to configure...". But when launching "ports," no launch menu art is shown, for whatever reason (even though the images exist, and are used in the ES menu like the other systems), nor is the dialog box shown either. 1) is there a particular reason for this (ports not showing launch art), and 2) would it make sense, and be easily implementable, to have the dialog box still show when art is enabled, if no art is available, or at least always show it for the "ports" system which doesn't honor the "art" setting anyway?
-
I've made some progress on this but I've hit a roadblock. I am looking at this
function show_launch
section of the/opt/retropie/supplementary/runcommand/runcommand.sh
script:function show_launch() { local images=() if [[ "$IS_SYS" -eq 1 && "$USE_ART" -eq 1 ]]; then # if using art look for images in paths for es art. images+=( "$HOME/RetroPie/roms/$SYSTEM/images/${ROM_BN}-image" "$HOME/.emulationstation/downloaded_images/$SYSTEM/${ROM_BN}-image" "$HOME/.emulationstation/downloaded_media/$SYSTEM/screenshots/${ROM_BN}" "$HOME/RetroPie/roms/$SYSTEM/media/screenshots/${ROM_BN}" ) fi # look for custom launching images if [[ "$IS_SYS" -eq 1 ]]; then images+=( "$HOME/RetroPie/roms/$SYSTEM/images/${ROM_BN}-launching" "$CONF_ROOT/launching" ) fi [[ "$IS_PORT" -eq 1 ]] && images+=("$CONFIGDIR/ports/launching") images+=("$CONFIGDIR/all/launching") local image local path local ext for path in "${images[@]}"; do for ext in jpg png; do if [[ -f "$path.$ext" ]]; then image="$path.$ext" break 2 fi done done if [[ -n "$image" ]]; then # if we are running under X use feh otherwise try and use fbi if [[ -n "$DISPLAY" ]]; then feh -F -N -Z -Y -q "$image" & &>/dev/null IMG_PID=$! sleep "$IMAGE_DELAY" else fbi -1 -t "$IMAGE_DELAY" -noverbose -a "$image" </dev/tty &>/dev/null fi elif [[ "$DISABLE_MENU" -ne 1 && "$USE_ART" -ne 1 ]]; then local launch_name if [[ -n "$ROM_BN" ]]; then launch_name="$ROM_BN ($EMULATOR)" else launch_name="$EMULATOR" fi DIALOGRC="$CONFIGDIR/all/runcommand-launch-dialog.cfg" dialog --infobox "\nLaunching $launch_name ...\n\nPress a button to configure\n\nErrors are logged to $LOG" 9 60 fi }
The first part (well, the second part of my question above, I guess), showing the dialog box when there is no image, was easy. Down at the end where it says:
elif [[ "$DISABLE_MENU" -ne 1 && "$USE_ART" -ne 1 ]]; then local launch_name if [[ -n "$ROM_BN" ]]; then launch_name="$ROM_BN ($EMULATOR)" else launch_name="$EMULATOR" fi DIALOGRC="$CONFIGDIR/all/runcommand-launch-dialog.cfg" dialog --infobox "\nLaunching $launch_name ...\n\nPress a button to configure\n\nErrors are logged to $LOG" 9 60 fi
This part that calls the dialog box already only gets called itself if no image was found, so it doesn't really matter at this point whether
$USE_ART
is enabled or not. If it's not enabled, we won't find an image (we didn't define a path for it), and if it is enabled but we still don't find one, then, well, shouldn't we show the dialog box anyway? So that's exactly what I did, I simply removed the&& "$USE_ART" -ne 1
so it just read:elif [[ "$DISABLE_MENU" -ne 1 ]]; then
Now the check is "did we find an image" and not "did we look for one." Now when no image is found (for example, Ports, or if a console game just doesn't have one), the dialog box is still shown instead. This seems to be working as intended.
****
The next part was trickier. Trying to get launch art to show for Ports as well. I see this part here:
if [[ "$IS_SYS" -eq 1 && "$USE_ART" -eq 1 ]]; then # if using art look for images in paths for es art. images+=( "$HOME/RetroPie/roms/$SYSTEM/images/${ROM_BN}-image" "$HOME/.emulationstation/downloaded_images/$SYSTEM/${ROM_BN}-image" "$HOME/.emulationstation/downloaded_media/$SYSTEM/screenshots/${ROM_BN}" "$HOME/RetroPie/roms/$SYSTEM/media/screenshots/${ROM_BN}" ) fi
Seems pretty straightforward, I should just duplicate this rule for
$IS_PORT
and make it look in theports
folder for the art, and put it beforefi
with anelif
statement, right? Like this:if [[ "$IS_SYS" -eq 1 && "$USE_ART" -eq 1 ]]; then # if using art look for images in paths for es art. images+=( "$HOME/RetroPie/roms/$SYSTEM/images/${ROM_BN}-image" "$HOME/.emulationstation/downloaded_images/$SYSTEM/${ROM_BN}-image" "$HOME/.emulationstation/downloaded_media/$SYSTEM/screenshots/${ROM_BN}" "$HOME/RetroPie/roms/$SYSTEM/media/screenshots/${ROM_BN}" ) elif [[ "$IS_PORT" -eq 1 && "$USE_ART" -eq 1 ]]; then # use ports folder for ports system. images+=( "$HOME/RetroPie/roms/ports/images/${ROM_BN}-image" "$HOME/.emulationstation/downloaded_images/ports/${ROM_BN}-image" "$HOME/.emulationstation/downloaded_media/ports/screenshots/${ROM_BN}" "$HOME/RetroPie/roms/ports/media/screenshots/${ROM_BN}" ) fi
...but I'm still seeing the dialog box. I have scraped art at
$HOME/.emulationstation/downloaded_media/ports/screenshots/{ROM_BN}.png
. Why doesn't this work? -
Try creating a duplicate image of each game's launch menu art called "launching.png". Add that file to each individual port's config folder e.g. add art for the Descent portion of DXX-Rebirth to "/opt/retropie/configs/ports/descent1". Hope this helps.
-
@ts-x I'd like to make it work with the images I already have, though. E.g. each DOOM expansion has its own image with screenshot and logo art from the scraper. I could put a launching.png in the
ports/doom
folder but they would all use the same image. Plus, I'd have to do this individually for each (group of) ports I have, and repeat it in the future any time I add a new one. The images indownloaded_media/ports/
are already there, I want to make it use them. Just can't figure out why"$IS_PORT"
and pointing at theports/
folder directly doesn't work the same way that"$IS_SYS"
and$SYSTEM/
does. -
I've done some more digging on this and I've come up with a solution that works for me. Though it's not exactly plug-and-play, it's pretty simple to implement on a case-by-case basis.
What I tried above was never going to work, for a couple reasons. For starters,
$IS_SYS
and$IS_PORT
are not, as I had assumed, mutually exclusive. "SYS" is anything that's not a special+Start system.sh
script, and "PORT" is a subset of that. So, when I tried to make it "if IS_SYS, else if IS_PORT", that was never going to do anything. They're all SYS and when they're not, they're not PORT either, so the "else" part would never happen, in any case.So with that out of the way, I can just rewrite the test. If IS_SYS (that's basically everything), it checks the default paths. Doesn't find anything for ports, because their images are in the "ports" folder, not the individual "system." So instead of "else," I just added another "if IS PORT," then check for art in paths with
ports
instead of$SYSTEM
dir: "If SYS, check $SYSTEM path; fi; if PORT, check 'ports' path, fi."But that still didn't work. Okay, so...why doesn't it work. Well. Runcommand is the part that displays the image. It looks for an image that's named the same as the game, right? But how does it know. It's looking at the
%ROM%
parameter that's passed to it by EmulationStation. Only for ports it doesn't work that way.With regular console systems, EmulationStation says (simplified):
runcommand SYS [system] %ROM%
...and the "ROM" is the rom file. If Runcommand can find a picture in the "[system]" folder with the same basename then it's got a match.
For ports, that doesn't happen. For ports, EmulationStation goes:
bash %ROM%
where "ROM" is the launch script. The launch script then calls up Runcommand with
runcommand PORT [system] %FOO%
...where "FOO" is whatever weird stuff is used in the launch command for that particular port. It might be the path to a file or directory that may or may not share a basename with the launch script and image file, or it might be a long string of command-line flags that aren't even legal filenames. It's different for every "system." And this is what Runcommand is looking for when it tries to match a filename for the image to display. This is never going to work either. That's why they don't do it that way. That's why they have
launching.png
.So what do I do about it. As mentioned above, I can place a
launching.png
in theconfigs/ports
orconfigs/ports/[system]
dirs. Which works fine when a "system" only has one game on it, but for times when different games can all be launched with a shared system setup (like all the Doom expansions all using the samelr-prboom
core), it means I would have to use the same image for all of them.Or would I? And in fact no, I would not. If it's looking for a
launching.png
I will let it find alaunching.png
. But I can decide what that looks like when it finds it.In my launch script, example (simplified):
#! /bin/bash runcommand.sh PORT "[system]" "[%FOO%]"
...before the run-command, I add a line that symlinks (at first I copied, but symlink will shuffle less data around) the desired image to the expected location:
ln -sf "/home/pi/.emulationstation/downloaded_media/ports/screenshots/$(basename ${0%.*}).png" /opt/retropie/configs/ports/launching.png
:#! /bin/bash ln -sf "/home/pi/.emulationstation/downloaded_media/ports/screenshots/$(basename ${0%.*}).png" /opt/retropie/configs/ports/launching.png runcommand.sh PORT "[system]" "[%FOO%]"
Using
$(basename ${0%.*})
substitutes the name of the launch script (the one that this command is inside of) without path or extension, so I can just copy-paste this same line into every one of my scripts and they'll all link their own, individual launch art before calling Runcommand. It means that if I rename the script I'll have to rename the image, but this is just like how all the other systems work anyway, with the rom name being linked to the image name, and this way I didn't have to type out a different filename in each of my scripts.If you wish to use this method, you will need to substitute the path to your images based on your own configuration. Which is why it's not exactly plug-and-play, since it seems everyone has these in a different place.
Here is an actual, non-simplified example of one in action:
pi@retropie:~/RetroPie/roms/ports $ cat doom-sigil.sh #!/bin/bash ln -sf "/home/pi/.emulationstation/downloaded_media/ports/screenshots/$(basename ${0%.*}).png" /opt/retropie/configs/ports/launching.png "/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "doom" "/home/pi/RetroPie/roms/ports/doom/sigil/DOOM.WAD"
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.