diff --git a/package/batocera/core/batocera-desktopapps/batocera-desktopapps.mk b/package/batocera/core/batocera-desktopapps/batocera-desktopapps.mk index d238149ab17..25789503d49 100644 --- a/package/batocera/core/batocera-desktopapps/batocera-desktopapps.mk +++ b/package/batocera/core/batocera-desktopapps/batocera-desktopapps.mk @@ -216,6 +216,12 @@ ifeq ($(BR2_PACKAGE_DOSBOX),y) BATOCERA_DESKTOPAPPS_ACTIONS += dos.toolbox.extract.desktop endif +ifeq ($(BR2_PACKAGE_SCUMMVM),y) + BATOCERA_DESKTOPAPPS_TOOLBOX += scummvm.toolbox + BATOCERA_DESKTOPAPPS_ACTIONS += scummvm.toolbox.squashfs.desktop + BATOCERA_DESKTOPAPPS_ACTIONS += scummvm.toolbox.extract.desktop +endif + define BATOCERA_DESKTOPAPPS_INSTALL_TARGET_CMDS # scripts (Install as executable 0755) diff --git a/package/batocera/core/batocera-desktopapps/contextactions/scummvm.toolbox.extract.desktop b/package/batocera/core/batocera-desktopapps/contextactions/scummvm.toolbox.extract.desktop new file mode 100644 index 00000000000..dfb8663b615 --- /dev/null +++ b/package/batocera/core/batocera-desktopapps/contextactions/scummvm.toolbox.extract.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Type=Action +Name=ScummVM: Extract Game +Folders=*/scummvm*; +Basenames=*.squashfs; +Profiles=Batocera +SelectionCount==1 + +[X-Action-Profile Batocera] +MimeTypes=all/allfiles +Exec=/usr/share/file-manager/actions/toolbox/scummvm.toolbox --extract-game %d %b diff --git a/package/batocera/core/batocera-desktopapps/contextactions/scummvm.toolbox.squashfs.desktop b/package/batocera/core/batocera-desktopapps/contextactions/scummvm.toolbox.squashfs.desktop new file mode 100644 index 00000000000..3ebc6a45a12 --- /dev/null +++ b/package/batocera/core/batocera-desktopapps/contextactions/scummvm.toolbox.squashfs.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Type=Action +Name=ScummVM: Squash Game +Folders=*/scummvm*; +Profiles=Batocera +SelectionCount==1 + +[X-Action-Profile Batocera] +MimeTypes=inode/directory +Exec=/usr/share/file-manager/actions/toolbox/scummvm.toolbox --squash-game %d %b diff --git a/package/batocera/core/batocera-desktopapps/toolbox/scummvm.toolbox b/package/batocera/core/batocera-desktopapps/toolbox/scummvm.toolbox new file mode 100644 index 00000000000..f9ca9f62d01 --- /dev/null +++ b/package/batocera/core/batocera-desktopapps/toolbox/scummvm.toolbox @@ -0,0 +1,73 @@ +#!/bin/bash + +# +# This file is part of the batocera distribution (https://batocera.org). +# Copyright (c) 2026+. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, version 3. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# YOU MUST KEEP THIS HEADER AS IT IS +# + +# ScummVM Toolbox is a script integration for PCManFM +# 23.02.2026 cyperghost aka crcerror +# + +# Works only if PCManFM process is detected and if an argument is setted +pgrep -x pcmanfm >/dev/null && [[ -n "$1" ]] || { echo "error: No instance of PCManFM found... exit now!"; exit 1; } + +# todo - fonts setup +# - select correct scummvm title + +Squash_Game() { + local gname="${2%.*}.squashfs" + cd "$1" + [[ -e "$gname" ]] && gname="$(printf '%x' $(date +%s))_$gname" + mksquashfs "${2}" "${gname}" -comp zstd -percentage | yad --progress --text="Creating $gname${fx}" --auto-close +} + +Extract_Game() { + local gname="${2%.*}.scummvm" + cd "$1" + [[ -e "$gname" ]] && gname="$(printf '%x' $(date +%s))_$gname" # some unique name + unsquashfs -li -d "$gname" "$2" | yad --text-info --tail --fontname="${f[0]}" +} + +#### MAIN #### + +# TODO: set fonts and type, by yad --font dialog +# yad --text-info --fontname="FAMILY STYLE SIZE" is better as using --text -tag +CONF_FILE=/userdata/system/.config/pcmanfm/toolbox.conf +CONF_KEY=$(basename $0).font +CONF_VALS=3 + +# init font: read from conf, or check if dejavu-font is available or fallback to default + +#### Currently use dejavu-font or if not found fallback to defaults + +ft="DejaVu Sans Mono" +if grep -q "^${CONF_KEY}" "${CONF_FILE}"; then + readarray -t -d "|" f < <(batocera-settings-get -f "${CONF_FILE}" "${CONF_KEY}") + [[ ${#f[@]} -ge ${CONF_VALS} ]] && fx="" || { unset f; sed -i "s/^[^#]*${CONF_KEY}/#&/" "${CONF_FILE}"; } +elif fc-list -q "${ft}"; then + f=("${ft} Bold 12" "${ft} Book 16" "${ft} Book 20") + fx="" +fi + +case ${1} in + --extract-game) + #use %d for basedir, %b for basename + [[ ${#@} -eq 3 ]] || exit 1 + Extract_Game "$2" "$3" + ;; + --squash-game) + #use %d for basedir and %b for basename (gamename) + [[ ${#@} -eq 3 ]] || exit 1 + Squash_Game "$2" "$3" + ;; +esac