This commit is contained in:
Jools Wills 2024-05-07 07:58:02 +01:00 committed by GitHub
commit 1bd51275d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 41 additions and 51 deletions

View file

@ -259,6 +259,15 @@ fi
TTY=\$(tty)
export TTY="\${TTY:8:1}"
# exit vlc before launching on kms or ES won't be able to open the display (not required on legacy drivers or fkms)
if [[ -d /sys/module/vc4 ]] && grep -q "okay" /proc/device-tree/soc/hvs@7e400000/status 2>/dev/null; then
vlc_pid="/tmp/vlc.pid"
if [[ -f "\$vlc_pid" ]]; then
kill \$(<\$vlc_pid)
rm "\$vlc_pid"
fi
fi
clear
tput civis
"$md_inst/emulationstation.sh" "\$@"

View file

@ -32,9 +32,7 @@ function _video_exts_splashscreen() {
}
function depends_splashscreen() {
local params=(insserv)
isPlatform "32bit" && params+=(omxplayer)
getDepends "${params[@]}"
getDepends vlc
}
function install_bin_splashscreen() {
@ -48,6 +46,7 @@ ConditionPathExists=$md_inst/asplashscreen.sh
[Service]
Type=oneshot
User=$user
ExecStart=$md_inst/asplashscreen.sh
RemainAfterExit=yes
@ -55,8 +54,6 @@ RemainAfterExit=yes
WantedBy=sysinit.target
_EOF_
rp_installModule "omxiv" "_autoupdate_"
gitPullOrClone "$md_inst"
cp "$md_data/asplashscreen.sh" "$md_inst"
@ -66,6 +63,9 @@ _EOF_
iniSet "DATADIR" "$datadir"
iniSet "REGEX_IMAGE" "$(_image_exts_splashscreen)"
iniSet "REGEX_VIDEO" "$(_video_exts_splashscreen)"
if isPlatform "videocore"; then
iniSet "VLC_OPTS" "--mmal-layer 10001"
fi
if [[ ! -f "$configdir/all/$md_id.cfg" ]]; then
iniConfig "=" '"' "$configdir/all/$md_id.cfg"
@ -107,9 +107,6 @@ function disable_splashscreen() {
function configure_splashscreen() {
[[ "$md_mode" == "remove" ]] && return
# remove legacy service
[[ -f "/etc/init.d/asplashscreen" ]] && insserv -r asplashscreen && rm -f /etc/init.d/asplashscreen
disable_plymouth_splashscreen
enable_splashscreen
[[ ! -f /etc/splashscreen.list ]] && default_splashscreen
@ -229,7 +226,7 @@ function preview_splashscreen() {
local path
local file
local omxiv="/opt/retropie/supplementary/omxiv/omxiv"
local vlc="sudo -u $user vlc --intf dummy --quiet --play-and-exit --image-duration 6"
while true; do
local cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option." 22 86 16)
local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
@ -241,13 +238,13 @@ function preview_splashscreen() {
1)
file=$(choose_splashscreen "$path" "image")
[[ -z "$file" ]] && break
$omxiv -b "$file"
$vlc "$file"
;;
2)
file=$(mktemp)
find "$path" -type f ! -regex ".*/\..*" ! -regex ".*LICENSE" ! -regex ".*README.*" ! -regex ".*\.sh" | sort > "$file"
if [[ -s "$file" ]]; then
$omxiv -t 6 -T blend -b --once -f "$file"
tr "\n" "\0" <"$file" | xargs -0 $vlc
else
printMsgs "dialog" "There are no splashscreens installed in $path"
fi
@ -257,7 +254,7 @@ function preview_splashscreen() {
3)
file=$(choose_splashscreen "$path" "video")
[[ -z "$file" ]] && break
omxplayer --no-osd -b --layer 10000 "$file"
$vlc "$file"
;;
esac
done
@ -270,10 +267,6 @@ function download_extra_splashscreen() {
}
function gui_splashscreen() {
if [[ ! -d "$md_inst" ]]; then
rp_callModule splashscreen depends
rp_callModule splashscreen install
fi
local cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option." 22 86 16)
while true; do
local enabled=0

View file

@ -4,27 +4,17 @@ ROOTDIR=""
DATADIR=""
REGEX_VIDEO=""
REGEX_IMAGE=""
VLC_OPTS=""
# Load user settings
. /opt/retropie/configs/all/splashscreen.cfg
is_fkms() {
if grep -q okay /proc/device-tree/soc/v3d@7ec00000/status 2> /dev/null || grep -q okay /proc/device-tree/soc/firmwarekms@7e600000/status 2> /dev/null ; then
return 0
else
return 1
fi
}
do_start () {
local config="/etc/splashscreen.list"
local line
local re="$REGEX_VIDEO\|$REGEX_IMAGE"
local omxiv="/opt/retropie/supplementary/omxiv/omxiv"
local vlc="vlc --intf dummy --quiet --no-video-title-show --play-and-exit "
case "$RANDOMIZE" in
disabled)
line="$(head -1 "$config")"
;;
retropie)
line="$(find "$ROOTDIR/supplementary/splashscreen" -type f | grep "$re" | shuf -n1)"
;;
@ -38,36 +28,34 @@ do_start () {
line="$(cat "$config" | shuf -n1)"
;;
esac
if $(echo "$line" | grep -q "$REGEX_VIDEO"); then
# wait for dbus
while ! pgrep "dbus" >/dev/null; do
sleep 1
done
omxplayer --no-osd -o both -b --layer 10001 "$line"
elif $(echo "$line" | grep -q "$REGEX_IMAGE"); then
if [ "$RANDOMIZE" = "disabled" ]; then
local count=$(wc -l <"$config")
else
local count=1
fi
[ $count -eq 0 ] && count=1
[ $count -gt 12 ] && count=12
# Default duration is 12 seconds, check if configured otherwise
[ -z "$DURATION" ] && DURATION=12
local delay=$((DURATION/count))
if [ "$RANDOMIZE" = "disabled" ]; then
"$omxiv" --once -t $delay -b --layer 10001 -f "$config" >/dev/null 2>&1
else
"$omxiv" --once -t $delay -b --layer 10001 -r "$line" >/dev/null 2>&1
fi
if [ "$RANDOMIZE" = "disabled" ]; then
local count=$(wc -l <"$config")
else
local count=1
fi
[ $count -eq 0 ] && count=1
[ $count -gt 12 ] && count=12
# Default duration is 12 seconds, check if configured otherwise
[ -z "$DURATION" ] && DURATION=12
local delay=$((DURATION/count))
vlc="$vlc --image-duration $delay"
if [ "$RANDOMIZE" = "disabled" ]; then
tr "\n" "\0" <"$config" | xargs -0 $vlc & 2>/dev/null
else
$vlc "$line" & 2>/dev/null
fi
echo $! >/tmp/vlc.pid
exit 0
}
case "$1" in
start|"")
do_start &
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2