#!/bin/sh
# Exit 0 when this game run should open as a SteamVR panel: SteamVR is running and Steam
# lists no VR support for the app, optional or required. Under SteamVR, Steam stacks a flat game's window behind
# its own, so without the panel the game plays unseen.
[ "${1:-}" = waitforexitandrun ] || exit 1
[ -z "${DROIDDECK_STEAMVR_PANEL:-}" ] || exit 1
# Non-Steam shortcuts run with SteamAppId=0 and their CGameID in SteamGameId.
app=${SteamAppId:-}
[ "$app" = 0 ] && app=${SteamGameId:-}
case $app in '' | 0 | *[!0-9]*) exit 1 ;; esac
pgrep -x vrserver >/dev/null 2>&1 || exit 1
/usr/local/bin/droiddeck-agent --steam-supports-vr "$app" >/dev/null 2>&1
[ $? -eq 5 ]
