#!/bin/sh # Select explicitly after RKMPP decode + real stream validation. Does not replace # the distribution Moonlight or add a second cursor. set -eu task_root="${VDI_RKMPP_BUILD_ROOT:-$HOME/vdi-build/rkmpp-experiment}" client="${VDI_RKMPP_CLIENT:-$task_root/build/moonlight/app/moonlight}" if [ ! -x "$client" ] || [ ! -r /dev/mpp_service ] || [ ! -w /dev/mpp_service ]; then echo 'RKMPP client or device access unavailable' >&2 exit 78 fi export LD_LIBRARY_PATH="$task_root/runtime/lib:$task_root/deps/usr/lib/aarch64-linux-gnu${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" export QML2_IMPORT_PATH="$task_root/deps/usr/lib/aarch64-linux-gnu/qt5/qml${QML2_IMPORT_PATH:+:$QML2_IMPORT_PATH}" export QT_PLUGIN_PATH="$task_root/deps/usr/lib/aarch64-linux-gnu/qt5/plugins${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}" export GL_IS_SLOW="${GL_IS_SLOW:-0}" export H264_DECODER_HINT=h264_rkmpp export HEVC_DECODER_HINT=hevc_rkmpp # Only affects unpaced rendering in the patched client. Leave the last presented # frame and decoder references intact; replace only waiting decoded frames. export VDI_LATEST_FRAME="${VDI_LATEST_FRAME:-1}" # A host can negotiate limited range to avoid Sunshine's software full-range # conversion. The decoder still expands the negotiated range for display. # Keep this per host: hardware-encoded desktops need no override. if [ "${1:-}" = stream ] && [ -z "${COLOR_RANGE_OVERRIDE+x}" ]; then case "${2:-}" in ''|*[!a-zA-Z0-9._-]*) ;; *) range_file="${XDG_CONFIG_HOME:-$HOME/.config}/vdi-terminal/host-color-range/$2" if [ -f "$range_file" ]; then color_range=$(cat "$range_file") case "$color_range" in 0|1) export COLOR_RANGE_OVERRIDE="$color_range" ;; *) echo 'Invalid host color range (expected 0 or 1)' >&2; exit 78 ;; esac fi ;; esac fi if [ -f "$HOME/vdi-terminal/bin/vdi-native-cursor" ]; then exec /usr/bin/python3 "$HOME/vdi-terminal/bin/vdi-native-cursor" "$client" "$@" fi exec "$client" "$@"