mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 21:06:09 +00:00
feat: SteamVR controller types, phone controls on glasses, flat games as VR panels (#1268)
This commit is contained in:
1 parent
2111197bea
commit
e5b54f6248
54 files changed
+908
-86
No files matched your search
@@ -1060,6 +1060,24 @@ def main(argv):
|
||||
return 3
|
||||
print("droiddeck-agent: Steam overview is ready for shortcut app %d" % prepared["appId"])
|
||||
return 0
|
||||
if argv and argv[0] == "--steam-supports-vr":
|
||||
if len(argv) != 2 or not argv[1].isascii() or not argv[1].isdecimal():
|
||||
print("usage: droiddeck-agent --steam-supports-vr <appid>", file=sys.stderr)
|
||||
return 2
|
||||
# Optional-VR games (Thumper, VRChat) carry vr_supported without vr_only.
|
||||
expression = ("(o => o ? (o.vr_supported === true || o.vr_only === true) : null)"
|
||||
"(window.appStore?.GetAppOverviewByGameID?.(%s))" % json.dumps(argv[1]))
|
||||
value = None
|
||||
deadline = time.monotonic() + 12 # Steam's UI is busiest while a game starts.
|
||||
while value is None and time.monotonic() < deadline:
|
||||
try:
|
||||
value = cdp_eval(Path(base) / "agent", expression, await_promise=False, timeout=8).get("value")
|
||||
except (AgentError, OSError, ValueError):
|
||||
pass
|
||||
if value is None:
|
||||
time.sleep(0.5)
|
||||
print({True: "yes", False: "no"}.get(value, "unknown"))
|
||||
return {True: 0, False: 5}.get(value, 1)
|
||||
if argv and argv[0] == "--steam-asleep":
|
||||
expression = """(() => {
|
||||
const store = globalThis.SuspendResumeStore;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/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 ]
|
||||
@@ -6,6 +6,8 @@ pgrep -x vrserver >/dev/null 2>&1 || {
|
||||
echo 'Start SteamVR before launching a game with droiddeck-steamvr-game.' >&2
|
||||
exit 1
|
||||
}
|
||||
# droiddeck-steamvr-flat skips a run that a launch option already wrapped.
|
||||
export DROIDDECK_STEAMVR_PANEL=1
|
||||
vrdir=${DROIDDECK_VR_DIR:-/usr/local/lib/droiddeck-vr}
|
||||
export VK_LAYER_PATH="$vrdir/layer${VK_LAYER_PATH:+:$VK_LAYER_PATH}"
|
||||
export VK_INSTANCE_LAYERS="VK_LAYER_DROIDDECK_vr${VK_INSTANCE_LAYERS:+:$VK_INSTANCE_LAYERS}"
|
||||
|
||||
@@ -74,6 +74,9 @@ bl_store_launch() {
|
||||
}
|
||||
|
||||
bl_run() {
|
||||
if [ -x /usr/local/bin/droiddeck-steamvr-flat ] && /usr/local/bin/droiddeck-steamvr-flat "${verb:-}"; then
|
||||
set -- /usr/local/bin/droiddeck-steamvr-game "$@"
|
||||
fi
|
||||
if [ -n "${BL_STORE_EXIT:-}" ]; then
|
||||
"$@"
|
||||
rc=$?
|
||||
@@ -463,6 +466,9 @@ verb=$1; shift
|
||||
case $verb in
|
||||
getcompatpath | getnativepath) printf '%s\\n' "$1"; exit 0 ;;
|
||||
esac
|
||||
if [ -x /usr/local/bin/droiddeck-steamvr-flat ] && /usr/local/bin/droiddeck-steamvr-flat "$verb"; then
|
||||
exec /usr/local/bin/droiddeck-steamvr-game /usr/local/bin/droiddeck-fex steam "$verb" "$@"
|
||||
fi
|
||||
exec /usr/local/bin/droiddeck-fex steam "$verb" "$@"
|
||||
"""
|
||||
|
||||
|
||||
Reference in new issue
Block a user