#!/usr/bin/env bash set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" MISE_BIN="${MISE_BIN:-$HOME/.local/bin/mise}" # Default to the on-disk BDMV folder, not the ISO. # # When libbluray opens a UDF *image* (.iso), its BD-J stack must first copy # BDMV/JAR/00000.jar out of the image into a temp cache dir. On this setup that # write is refused by libbluray's BD-J SecurityManager (usingUdf=true, no disc # root), so the JAR never mounts, the Xlet class is never found, and VLC falls # back to playing the raw playlist with no menu. Opening the *folder* lets # libbluray read the JAR directly, so the Xlet (menu) loads. Pass an explicit # path to override (folder or .iso). TARGET="${1:-$ROOT_DIR/build/disc}" if [[ -d "$TARGET" && ! -d "$TARGET/BDMV" ]]; then echo "Not a BDMV folder (no BDMV/ inside): $TARGET" >&2 echo "Run: make" >&2 exit 1 fi if [[ ! -e "$TARGET" ]]; then echo "Missing disc target: $TARGET" >&2 echo "Run: make" >&2 exit 1 fi if [[ -x "$MISE_BIN" ]]; then JDK8_HOME="$("$MISE_BIN" where java@temurin-8.0.502+7 2>/dev/null || true)" else JDK8_HOME="" fi if [[ -z "$JDK8_HOME" && -d "$ROOT_DIR/vendor/bdj-sdk/host/jdk8" ]]; then JDK8_HOME="$(cd "$ROOT_DIR/vendor/bdj-sdk/host/jdk8" && pwd)" fi if [[ -n "$JDK8_HOME" ]]; then export JAVA_HOME="$JDK8_HOME/jre" export JDK_HOME="$JDK8_HOME" export LD_LIBRARY_PATH="$JDK8_HOME/jre/lib/amd64/server:${LD_LIBRARY_PATH:-}" fi LOCAL_VLC_PLUGINS="$ROOT_DIR/tools/vlc-plugins/usr/lib/vlc/plugins" if [[ -d "$LOCAL_VLC_PLUGINS" ]]; then export VLC_PLUGIN_PATH="$LOCAL_VLC_PLUGINS:/usr/lib/vlc/plugins${VLC_PLUGIN_PATH:+:$VLC_PLUGIN_PATH}" fi if [[ -d "$TARGET" ]]; then ABS_TARGET="$(cd "$TARGET" && pwd)" else ABS_TARGET="$(cd "$(dirname "$TARGET")" && pwd)/$(basename "$TARGET")" fi exec vlc --reset-plugins-cache --bluray-menu "bluray://$ABS_TARGET"