mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 05:46:03 +00:00
chore: consistent code branding (#2800)
* chore: consistent code branding * fix: carry legacy overrides, queues and live sync rows across the rename * fix: keep queued legacy overrides on a failed rename and separate merged queue entries
This commit is contained in:
1 parent
ad9348879d
commit
eabcfc7b74
229 files changed
+2584
-2468
No files matched your search
@@ -8,12 +8,12 @@ for arch in x86_64 i386; do
|
||||
esac
|
||||
mkdir -p "$out/$arch"
|
||||
gcc $bits -shared -fPIC -O2 -Wall -pthread \
|
||||
-o "$out/$arch/libblsession.so" tools/linuxfs/preload/*.c -ldl
|
||||
-o "$out/$arch/libddsession.so" tools/linuxfs/preload/*.c -ldl
|
||||
g++ $bits -shared -fPIC -O2 -Wall -Wno-attributes -Wno-nonnull-compare \
|
||||
-pthread -std=c++17 -static-libstdc++ -static-libgcc -Wl,--exclude-libs,ALL \
|
||||
-o "$out/$arch/libfakeinput.so" app/src/main/cpp/fakeinput_steam.cpp -ldl
|
||||
strip --strip-unneeded "$out/$arch/libblsession.so" "$out/$arch/libfakeinput.so"
|
||||
for lib in "$out/$arch/libblsession.so" "$out/$arch/libfakeinput.so"; do
|
||||
strip --strip-unneeded "$out/$arch/libddsession.so" "$out/$arch/libfakeinput.so"
|
||||
for lib in "$out/$arch/libddsession.so" "$out/$arch/libfakeinput.so"; do
|
||||
newest=$(objdump -T "$lib" | grep -o 'GLIBC_2\.[0-9]*' | sort -u -t. -k2,2n | tail -1)
|
||||
minor=${newest#GLIBC_2.}
|
||||
if [ "$minor" -gt 31 ]; then
|
||||
|
||||
@@ -15,12 +15,12 @@ done
|
||||
if grep -qxE '__gxx_personality_v0|__cxa_throw|_Unwind_Resume' <<<"$FAKE"; then
|
||||
echo "::error::libfakeinput.so exports the C++ runtime"; exit 1
|
||||
fi
|
||||
SESSION=$(syms "$D/libblsession.so")
|
||||
SESSION=$(syms "$D/libddsession.so")
|
||||
for sym in socket bind getsockname setsockopt statfs statvfs syscall shm_open shm_unlink mmap mmap64 munmap mprotect drmPrimeFDToHandle drmCloseBufferHandle; do
|
||||
grep -qx "$sym" <<<"$SESSION" || { echo "::error::libblsession.so does not export $sym"; exit 1; }
|
||||
grep -qx "$sym" <<<"$SESSION" || { echo "::error::libddsession.so does not export $sym"; exit 1; }
|
||||
done
|
||||
if grep -qx drmIoctl <<<"$SESSION"; then
|
||||
echo "::error::libblsession.so exports drmIoctl"; exit 1
|
||||
echo "::error::libddsession.so exports drmIoctl"; exit 1
|
||||
fi
|
||||
SSBS=$(syms "$D/libssbs.so")
|
||||
for sym in sigaction signal bsd_signal sysv_signal; do
|
||||
|
||||
@@ -19,15 +19,15 @@ done 2>/dev/null
|
||||
export DROIDDECK_NESTED_SCALE=1
|
||||
export DROIDDECK_GLTHREAD=${mesa_glthread:-}
|
||||
unset MESA_LOADER_DRIVER_OVERRIDE LIBGL_KOPPER_DRI2 mesa_glthread
|
||||
if [ -n "${BL_DEBUG_DIR:-}" ]; then
|
||||
mkdir -p "$BL_DEBUG_DIR" 2>/dev/null || true
|
||||
exec >>"$BL_DEBUG_DIR/desktop.log" 2>&1
|
||||
echo "== droiddeck-desktop $(date -u '+%Y-%m-%d %H:%M:%S UTC') ${BL_WIDTH:-1280}x${BL_HEIGHT:-720}"
|
||||
if [ -n "${DD_DEBUG_DIR:-}" ]; then
|
||||
mkdir -p "$DD_DEBUG_DIR" 2>/dev/null || true
|
||||
exec >>"$DD_DEBUG_DIR/desktop.log" 2>&1
|
||||
echo "== droiddeck-desktop $(date -u '+%Y-%m-%d %H:%M:%S UTC') ${DD_WIDTH:-1280}x${DD_HEIGHT:-720}"
|
||||
fi
|
||||
find "$XDG_RUNTIME_DIR" -mindepth 1 -maxdepth 1 ! -name 'wayland-0*' ! -name 'keymap.xkb' -exec rm -rf {} + 2>/dev/null
|
||||
chmod 700 "$XDG_RUNTIME_DIR" 2>/dev/null
|
||||
mkdir -p /tmp/.X11-unix /tmp/.ICE-unix && chmod 1777 /tmp/.X11-unix /tmp/.ICE-unix 2>/dev/null
|
||||
export BL_DESKTOP=1
|
||||
export DD_DESKTOP=1
|
||||
ln -sf /usr/local/bin/droiddeck-steam-launch /usr/local/bin/steamdeck-steam 2>/dev/null
|
||||
ln -sf /usr/local/bin/droiddeck-steam-shim /usr/local/bin/steam 2>/dev/null
|
||||
python3 /usr/local/bin/droiddeck-desktop-games 2>&1 | sed 's/^/[games] /'
|
||||
@@ -134,7 +134,7 @@ dbus-run-session -- startplasma-wayland
|
||||
rc=$?
|
||||
/usr/local/bin/droiddeck-pipewire stop
|
||||
echo "== droiddeck-desktop: Plasma ended ($rc)"
|
||||
if [ "$rc" -eq 0 ] && [ -z "${BL_BOTTOM_DESKTOP:-}" ]; then
|
||||
if [ "$rc" -eq 0 ] && [ -z "${DD_BOTTOM_DESKTOP:-}" ]; then
|
||||
/usr/local/bin/droiddeck-steam-launch bigpicture
|
||||
sleep 30
|
||||
fi
|
||||
|
||||
@@ -15,7 +15,7 @@ CHROMIUM_FLAGS = " --no-sandbox --ozone-platform=x11"
|
||||
|
||||
|
||||
def enabled():
|
||||
return os.environ.get("BL_DESKTOP_GPU", "on").strip().lower() not in ("off", "0", "no", "false")
|
||||
return os.environ.get("DD_DESKTOP_GPU", "on").strip().lower() not in ("off", "0", "no", "false")
|
||||
|
||||
|
||||
def main_group(text):
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
#!/bin/bash
|
||||
set -u
|
||||
[ $# -gt 0 ] || { echo "usage: droiddeck-gpu <program> [args...]" >&2; exit 64; }
|
||||
if [ -n "${BL_DEBUG_DIR:-}" ]; then
|
||||
exec >>"$BL_DEBUG_DIR/desktop.log" 2>&1
|
||||
if [ -n "${DD_DEBUG_DIR:-}" ]; then
|
||||
exec >>"$DD_DEBUG_DIR/desktop.log" 2>&1
|
||||
fi
|
||||
width=${BL_WIDTH:-1280}
|
||||
height=${BL_HEIGHT:-720}
|
||||
backend=${BL_GAMESCOPE_BACKEND:-wayland}
|
||||
width=${DD_WIDTH:-1280}
|
||||
height=${DD_HEIGHT:-720}
|
||||
backend=${DD_GAMESCOPE_BACKEND:-wayland}
|
||||
case "$backend" in
|
||||
wayland|sdl) ;;
|
||||
*) echo "== unsupported gamescope backend: $backend" >&2; exit 64 ;;
|
||||
esac
|
||||
window=0
|
||||
if [ "$backend" = wayland ] && [ "${BL_DESKTOP_GPU_WINDOW:-1}" != 0 ] && [ -n "${WAYLAND_DISPLAY:-}" ] && [ "$WAYLAND_DISPLAY" != wayland-0 ]; then
|
||||
if [ "$backend" = wayland ] && [ "${DD_DESKTOP_GPU_WINDOW:-1}" != 0 ] && [ -n "${WAYLAND_DISPLAY:-}" ] && [ "$WAYLAND_DISPLAY" != wayland-0 ]; then
|
||||
window=1
|
||||
parent=$WAYLAND_DISPLAY
|
||||
args=(--backend sdl --expose-wayland --follow-game-window-mode -W "$width" -H "$height" -w "$width" -h "$height")
|
||||
else
|
||||
args=(--backend "$backend" --expose-wayland -f -W "$width" -H "$height" -w "$width" -h "$height")
|
||||
fi
|
||||
if [ "${BL_FPS:-0}" -gt 0 ]; then
|
||||
args+=(-r "$BL_FPS")
|
||||
elif [ "${BL_REFRESH:-0}" -gt 0 ]; then
|
||||
args+=(-r "$BL_REFRESH")
|
||||
if [ "${DD_FPS:-0}" -gt 0 ]; then
|
||||
args+=(-r "$DD_FPS")
|
||||
elif [ "${DD_REFRESH:-0}" -gt 0 ]; then
|
||||
args+=(-r "$DD_REFRESH")
|
||||
fi
|
||||
[ "${BL_HDR:-0}" = 1 ] && args+=(--hdr-enabled)
|
||||
[ "${DD_HDR:-0}" = 1 ] && args+=(--hdr-enabled)
|
||||
if [ "$window" = 1 ]; then
|
||||
echo "== droiddeck-gpu $(date -u +%H:%M:%S): $* (gamescope ${width}x${height} in a window on $parent)"
|
||||
else
|
||||
@@ -38,7 +38,7 @@ wsi=",${MESA_VK_WSI_DEBUG:-},"
|
||||
while [[ $wsi == *,sw,* ]]; do wsi=${wsi//,sw,/,}; done
|
||||
wsi=${wsi#,}; wsi=${wsi%,}
|
||||
if [ -n "$wsi" ]; then export MESA_VK_WSI_DEBUG=$wsi; else unset MESA_VK_WSI_DEBUG; fi
|
||||
export BL_DESKTOP_GPU_CHILD=1
|
||||
export DD_DESKTOP_GPU_CHILD=1
|
||||
export MESA_LOADER_DRIVER_OVERRIDE=zink GALLIUM_DRIVER=zink LIBGL_KOPPER_DRI2=true
|
||||
[ -n "${DROIDDECK_GLTHREAD:-}" ] && export mesa_glthread=$DROIDDECK_GLTHREAD
|
||||
export APPIMAGE_EXTRACT_AND_RUN=1
|
||||
@@ -51,7 +51,7 @@ if ! command -v gamescopereaper >/dev/null 2>&1; then
|
||||
done
|
||||
fi
|
||||
if [ "$window" = 1 ]; then
|
||||
export BL_GPU_CHILD_WSI=${MESA_VK_WSI_DEBUG:-}
|
||||
export DD_GPU_CHILD_WSI=${MESA_VK_WSI_DEBUG:-}
|
||||
SDL_VIDEODRIVER=wayland MESA_VK_WSI_DEBUG=sw gamescope "${args[@]}" -- /usr/local/bin/droiddeck-gpu-window "$@"
|
||||
else
|
||||
gamescope "${args[@]}" -- env SDL_VIDEODRIVER=x11 /usr/local/bin/droiddeck-gpu-window "$@"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
if [ "${BL_DESKTOP:-}" = 1 ]; then
|
||||
set -- --wayland-display wayland-0 --socket wayland-1 --width "${BL_WIDTH:-1280}" --height "${BL_HEIGHT:-720}" --no-lockscreen "$@"
|
||||
if [ "${DD_DESKTOP:-}" = 1 ]; then
|
||||
set -- --wayland-display wayland-0 --socket wayland-1 --width "${DD_WIDTH:-1280}" --height "${DD_HEIGHT:-720}" --no-lockscreen "$@"
|
||||
fi
|
||||
exec /usr/bin/kwin_wayland_wrapper "$@"
|
||||
@@ -3,9 +3,9 @@ echo "steamos-session-select: $*" >&2
|
||||
case "${1:-}" in
|
||||
""|gamescope) exit 0 ;;
|
||||
esac
|
||||
dir=${BL_LAUNCH_DIR:-}
|
||||
dir=${DD_LAUNCH_DIR:-}
|
||||
if [ -z "$dir" ] || [ ! -d "$dir" ]; then
|
||||
echo "steamos-session-select: not inside a DroidDeck session (BL_LAUNCH_DIR unset)" >&2
|
||||
echo "steamos-session-select: not inside a DroidDeck session (DD_LAUNCH_DIR unset)" >&2
|
||||
exit 1
|
||||
fi
|
||||
printf 'session=desktop\nui=desktop\nurl=\n' > "$dir/steam-launch.tmp" && mv -f "$dir/steam-launch.tmp" "$dir/steam-launch"
|
||||
|
||||
@@ -283,7 +283,7 @@ def sandboxed_apps(proc=Path("/proc")):
|
||||
def window_steam_app(win, flatpaks, proc=Path("/proc")):
|
||||
match = STEAM_APP_CLASS.match(win.get("class") or "")
|
||||
if match:
|
||||
return match.group(1) if os.environ.get("BL_STEAM_CLIENT_ARCH") == "x86_64" else None
|
||||
return match.group(1) if os.environ.get("DD_STEAM_CLIENT_ARCH") == "x86_64" else None
|
||||
pid = win.get("pid")
|
||||
if pid:
|
||||
if under_reaper(pid, proc):
|
||||
@@ -529,7 +529,7 @@ def cdp_port(agent_dir):
|
||||
try:
|
||||
port = (agent_dir / "cdp-port").read_text().strip()
|
||||
except OSError:
|
||||
port = os.environ.get("BL_CDP_PORT", "")
|
||||
port = os.environ.get("DD_CDP_PORT", "")
|
||||
if not port.isdigit():
|
||||
raise AgentError("NO_DEVTOOLS", "The Steam client's DevTools port is not known (no Steam client in this session yet)")
|
||||
return int(port)
|
||||
@@ -1218,9 +1218,9 @@ def serve(agent_dir, focus=True, poll=0.1):
|
||||
|
||||
|
||||
def main(argv):
|
||||
base = os.environ.get("BL_LAUNCH_DIR")
|
||||
base = os.environ.get("DD_LAUNCH_DIR")
|
||||
if not base:
|
||||
print("BL_LAUNCH_DIR is not set", file=sys.stderr)
|
||||
print("DD_LAUNCH_DIR is not set", file=sys.stderr)
|
||||
return 2
|
||||
if argv and argv[0] == "--wait-steam-shortcut-overview":
|
||||
if len(argv) not in (2, 3):
|
||||
|
||||
@@ -467,7 +467,7 @@ def still_pages(root):
|
||||
|
||||
|
||||
def desktop_size():
|
||||
width, height = os.environ.get("BL_WIDTH", ""), os.environ.get("BL_HEIGHT", "")
|
||||
width, height = os.environ.get("DD_WIDTH", ""), os.environ.get("DD_HEIGHT", "")
|
||||
if width.isdigit() and height.isdigit() and 0 < int(width) <= 7680 and 0 < int(height) <= 4320:
|
||||
return int(width), int(height)
|
||||
return 1280, 720
|
||||
@@ -900,18 +900,18 @@ class Tidy:
|
||||
|
||||
|
||||
def desktop_gpu():
|
||||
if os.environ.get("BL_DESKTOP") != "1" or os.environ.get("BL_DESKTOP_GPU_CHILD"):
|
||||
if os.environ.get("DD_DESKTOP") != "1" or os.environ.get("DD_DESKTOP_GPU_CHILD"):
|
||||
return None
|
||||
if os.environ.get("BL_DESKTOP_GPU", "on").strip().lower() in ("off", "0", "no", "false"):
|
||||
if os.environ.get("DD_DESKTOP_GPU", "on").strip().lower() in ("off", "0", "no", "false"):
|
||||
return None
|
||||
gpu = os.path.join(BIN, "droiddeck-gpu")
|
||||
return gpu if os.access(gpu, os.X_OK) else None
|
||||
|
||||
|
||||
def proton_options():
|
||||
if os.environ.get("BL_DESKTOP") == "1" and not os.environ.get("BL_DESKTOP_GPU_CHILD"):
|
||||
if os.environ.get("DD_DESKTOP") == "1" and not os.environ.get("DD_DESKTOP_GPU_CHILD"):
|
||||
return ["--window"]
|
||||
width, height = os.environ.get("BL_WIDTH", ""), os.environ.get("BL_HEIGHT", "")
|
||||
width, height = os.environ.get("DD_WIDTH", ""), os.environ.get("DD_HEIGHT", "")
|
||||
options = ["--desktop", "%sx%s" % (width, height)] if width.isdigit() and height.isdigit() else []
|
||||
game = os.environ.get("SteamGameId", "")
|
||||
return options + (["--game-id", game] if game.isdigit() and game != "0" else [])
|
||||
@@ -942,7 +942,7 @@ def queued_requests(launch_dir):
|
||||
|
||||
|
||||
def serve_requests(pfx, processes=None, launch_dir=None):
|
||||
launch_dir = launch_dir or os.environ.get("BL_LAUNCH_DIR")
|
||||
launch_dir = launch_dir or os.environ.get("DD_LAUNCH_DIR")
|
||||
names = queued_requests(launch_dir) if launch_dir else []
|
||||
if not names or not agent_up(wine_processes(pfx) if processes is None else processes):
|
||||
return False
|
||||
@@ -1136,7 +1136,7 @@ def stop_leftovers(pfx):
|
||||
def open_client(root, reinstall=False):
|
||||
pfx = os.path.join(prefix(root), "pfx")
|
||||
write_menu()
|
||||
answer = ask_fex(os.environ.get("BL_LAUNCH_DIR"))
|
||||
answer = ask_fex(os.environ.get("DD_LAUNCH_DIR"))
|
||||
say("FEX: %s" % (answer or "no answer from the app; Components' choice stays"))
|
||||
if running(pfx):
|
||||
say("Battle.net is already running in its prefix; waiting for it to close")
|
||||
@@ -1226,7 +1226,7 @@ def launch(root, code):
|
||||
try:
|
||||
own = None
|
||||
if lock is not None and not running(pfx):
|
||||
answer = ask_fex(os.environ.get("BL_LAUNCH_DIR"))
|
||||
answer = ask_fex(os.environ.get("DD_LAUNCH_DIR"))
|
||||
say("FEX: %s" % (answer or "no answer from the app; Components' choice stays"))
|
||||
verb = None if stop_leftovers(pfx) else "run"
|
||||
configure(root, LIBRARY)
|
||||
@@ -1560,7 +1560,7 @@ def main(argv):
|
||||
if gpu:
|
||||
say("the desktop starts Battle.net on the GPU")
|
||||
os.execv(gpu, [gpu, os.path.abspath(sys.argv[0])] + list(sys.argv[1:]))
|
||||
os.environ["BL_BATTLENET"] = "1"
|
||||
os.environ["DD_BATTLENET"] = "1"
|
||||
if launching:
|
||||
say("launch %s" % argv[1])
|
||||
return launch(root, argv[1])
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
# KDE Plasma on a dual-screen handheld's bottom screen, next to the session on the top one.
|
||||
set -u
|
||||
export HOME=${HOME:-/root}
|
||||
if [ -n "${BL_DEBUG_DIR:-}" ]; then
|
||||
mkdir -p "$BL_DEBUG_DIR" 2>/dev/null || true
|
||||
exec >>"$BL_DEBUG_DIR/bottom-desktop.log" 2>&1
|
||||
if [ -n "${DD_DEBUG_DIR:-}" ]; then
|
||||
mkdir -p "$DD_DEBUG_DIR" 2>/dev/null || true
|
||||
exec >>"$DD_DEBUG_DIR/bottom-desktop.log" 2>&1
|
||||
fi
|
||||
echo "== droiddeck-bottom-desktop $(date -u '+%Y-%m-%d %H:%M:%S UTC') ${BL_WIDTH:-?}x${BL_HEIGHT:-?} beside a ${BL_TOP_SESSION:-?} session"
|
||||
echo "== droiddeck-bottom-desktop $(date -u '+%Y-%m-%d %H:%M:%S UTC') ${DD_WIDTH:-?}x${DD_HEIGHT:-?} beside a ${DD_TOP_SESSION:-?} session"
|
||||
[ -x /usr/local/bin/droiddeck-desktop ] || { echo "== the desktop package is not installed"; exit 66; }
|
||||
|
||||
# Launch requests would reach the top session's watcher and could replace it.
|
||||
unset BL_LAUNCH_DIR BL_LOG
|
||||
export BL_BOTTOM_DESKTOP=1
|
||||
unset DD_LAUNCH_DIR BL_LAUNCH_DIR DD_LOG
|
||||
export DD_BOTTOM_DESKTOP=1
|
||||
|
||||
for _ in $(seq 1 100); do
|
||||
wayland-info >/dev/null 2>&1 && break
|
||||
|
||||
@@ -23,7 +23,7 @@ ET.register_namespace("bookmark", ICON_NS)
|
||||
def steam_libraries(home, data):
|
||||
steam = data / "Steam"
|
||||
libraries = {steam: "Internal Storage"}
|
||||
listing = os.environ.get("BL_STEAM_LIBRARIES")
|
||||
listing = os.environ.get("DD_STEAM_LIBRARIES")
|
||||
selected = None
|
||||
if listing:
|
||||
try:
|
||||
@@ -46,15 +46,15 @@ def steam_libraries(home, data):
|
||||
managed = path == LIBRARY or path.is_relative_to(home / "Games") or path.is_relative_to(ADDED)
|
||||
if selected is not None and managed and path not in selected:
|
||||
continue
|
||||
if path == LIBRARY and selected is None and not os.environ.get("BL_LIBRARY_LABEL"):
|
||||
if path == LIBRARY and selected is None and not os.environ.get("DD_LIBRARY_LABEL"):
|
||||
continue
|
||||
label = entry.get("label")
|
||||
label = re.sub(r'\\(["\\])', r'\1', label) if isinstance(label, str) else ""
|
||||
libraries[path] = label or path.name
|
||||
if selected is not None:
|
||||
libraries.update(selected)
|
||||
elif os.environ.get("BL_LIBRARY_LABEL"):
|
||||
libraries[LIBRARY] = os.environ["BL_LIBRARY_LABEL"]
|
||||
elif os.environ.get("DD_LIBRARY_LABEL"):
|
||||
libraries[LIBRARY] = os.environ["DD_LIBRARY_LABEL"]
|
||||
libraries[steam] = "Internal Storage"
|
||||
return {path.as_uri(): "Steam (" + (" ".join(label.split()) or path.name) + ")"
|
||||
for path, label in libraries.items() if path.is_absolute() and (path / "steamapps").is_dir()}
|
||||
@@ -68,7 +68,7 @@ def place_uri(uri):
|
||||
|
||||
|
||||
def removable_volumes():
|
||||
listing = os.environ.get("BL_DESKTOP_VOLUMES")
|
||||
listing = os.environ.get("DD_DESKTOP_VOLUMES")
|
||||
if not listing:
|
||||
return {}
|
||||
volumes = {}
|
||||
@@ -168,7 +168,7 @@ def atomic_write(path, content):
|
||||
def main():
|
||||
home = Path.home()
|
||||
config = Path(os.environ.get("XDG_CONFIG_HOME") or home / ".config")
|
||||
label = os.environ.get("BL_LIBRARY_LABEL")
|
||||
label = os.environ.get("DD_LIBRARY_LABEL")
|
||||
available = bool(label) and (LIBRARY / "steamapps").is_dir()
|
||||
update_bookmark(bookmarks_file(home, config), label if available else None)
|
||||
data = Path(os.environ.get("XDG_DATA_HOME") or home / ".local/share")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
[ -n "${BL_ANDROID_CLIPBOARD:-}" ] && [ -n "${DISPLAY:-}" ] || exit 0
|
||||
/usr/local/bin/droiddeck-clipboard "$BL_ANDROID_CLIPBOARD" &
|
||||
[ -n "${DD_ANDROID_CLIPBOARD:-}" ] && [ -n "${DISPLAY:-}" ] || exit 0
|
||||
/usr/local/bin/droiddeck-clipboard "$DD_ANDROID_CLIPBOARD" &
|
||||
child=$!
|
||||
trap 'kill "$child" 2>/dev/null' EXIT
|
||||
trap 'exit 0' TERM INT
|
||||
|
||||
@@ -4,8 +4,8 @@ import re
|
||||
import sys
|
||||
|
||||
HOME = os.environ.get("HOME", "/root")
|
||||
X64 = os.environ.get("BL_STEAM_CLIENT_ARCH") == "x86_64"
|
||||
CLIENT_HOME = (os.environ.get("BL_X64_HOME") or os.path.join(HOME, ".droiddeck-x64")) if X64 else HOME
|
||||
X64 = os.environ.get("DD_STEAM_CLIENT_ARCH") == "x86_64"
|
||||
CLIENT_HOME = (os.environ.get("DD_X64_HOME") or os.path.join(HOME, ".droiddeck-x64")) if X64 else HOME
|
||||
STEAM_ROOT = sys.argv[1] if len(sys.argv) > 1 else os.path.join(CLIENT_HOME, ".local/share/Steam")
|
||||
LIBRARIES = ((STEAM_ROOT, "Steam Games"), ("/mnt/droiddeck-sd/x86-64" if X64 else "/mnt/droiddeck-sd", "SD Games"))
|
||||
NOT_GAMES = {228980, 1070560, 1161040, 1391110, 1493710, 1628350, 1826330, 3127680, 4183110, 4185400, 4427310, 4628740}
|
||||
|
||||
@@ -112,7 +112,7 @@ HIDDEN_ENV = {
|
||||
"DROIDDECK_EPIC_HIDDEN": "1",
|
||||
"EGL_DISABLE_STORE_PREWARM": "1",
|
||||
}
|
||||
KEPT_ENV = ("HOME", "USER", "LOGNAME", "LANG", "LANGUAGE", "LC_ALL", "LC_MESSAGES", "TZ", "XDG_RUNTIME_DIR", "BL_LAUNCH_DIR")
|
||||
KEPT_ENV = ("HOME", "USER", "LOGNAME", "LANG", "LANGUAGE", "LC_ALL", "LC_MESSAGES", "TZ", "XDG_RUNTIME_DIR", "DD_LAUNCH_DIR", "BL_LAUNCH_DIR")
|
||||
LAUNCH_VERBS = ("waitforexitandrun", "run", "runinprefix")
|
||||
EPIC_ARGS = ("-auth_", "-epic")
|
||||
CMD_SPECIAL = "&|<>^"
|
||||
@@ -720,7 +720,7 @@ def clear_playing():
|
||||
|
||||
|
||||
def launch_dir():
|
||||
found = os.environ.get("BL_LAUNCH_DIR", "")
|
||||
found = os.environ.get("DD_LAUNCH_DIR", "")
|
||||
if not found:
|
||||
try:
|
||||
with open(LAUNCH_DIR_FILE, encoding="utf-8") as f:
|
||||
|
||||
@@ -39,7 +39,7 @@ MIN_NOFILE = 8192
|
||||
LOG_LINES = 200
|
||||
LIVE_FILE = "prefixes.json"
|
||||
LIVE_ROWS = 200
|
||||
LIVE_KEYS = ("WINESERVER", "BL_SYNC_PACK", "WINEESYNC", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC", "BL_SYNC", "BL_FSYNC", "WINEFSYNC")
|
||||
LIVE_KEYS = ("WINESERVER", "DD_SYNC_PACK", "WINEESYNC", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC", "DD_SYNC", "DD_FSYNC", "WINEFSYNC")
|
||||
CACHE_ROWS = 512
|
||||
TEMP_AGE = 3600
|
||||
GC_GRACE = 600
|
||||
@@ -637,7 +637,7 @@ def app_id(env):
|
||||
|
||||
def minimum_nofile(env):
|
||||
try:
|
||||
return int(env.get("BL_SYNC_MIN_NOFILE") or MIN_NOFILE)
|
||||
return int(env.get("DD_SYNC_MIN_NOFILE") or MIN_NOFILE)
|
||||
except ValueError:
|
||||
return MIN_NOFILE
|
||||
|
||||
@@ -650,8 +650,8 @@ def log_launch(root, command, env, tool, pack_id):
|
||||
try:
|
||||
soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE)
|
||||
line = tsv([[int(time.time()), app_id(env) or "-", command[1] if len(command) > 1 else "-", tool, pack_id or "-",
|
||||
env.get("WINEESYNC") or "-", env.get("BL_SYNC") or "-", "%s/%s" % (limit(soft), limit(hard)),
|
||||
env.get("BL_FSYNC") or "-"]])
|
||||
env.get("WINEESYNC") or "-", env.get("DD_SYNC") or "-", "%s/%s" % (limit(soft), limit(hard)),
|
||||
env.get("DD_FSYNC") or "-"]])
|
||||
|
||||
def append(text):
|
||||
lines = [entry for entry in text.split("\n") if entry]
|
||||
@@ -704,7 +704,7 @@ def select(command, env):
|
||||
if not prefix or last == "0" or last.startswith("0-"):
|
||||
return result
|
||||
if truthy(env.get("PROTON_NO_NTSYNC")):
|
||||
env["BL_SYNC"] = "0"
|
||||
env["DD_SYNC"] = "0"
|
||||
result = (list(command), dict(env))
|
||||
root = store_root(env)
|
||||
if root is None:
|
||||
@@ -796,7 +796,7 @@ def keep_live(root, command, env, tool):
|
||||
return None
|
||||
if not os.path.isfile(kept_command) or not server_running(prefix):
|
||||
return None
|
||||
kept_pack = row["env"].get("BL_SYNC_PACK")
|
||||
kept_pack = row["env"].get("DD_SYNC_PACK", row["env"].get("BL_SYNC_PACK"))
|
||||
if isinstance(kept_pack, str) and kept_pack and command[1:2] == ["waitforexitandrun"]:
|
||||
try:
|
||||
cache = HashCache(root)
|
||||
@@ -808,25 +808,28 @@ def keep_live(root, command, env, tool):
|
||||
pack = {"id": kept_pack}
|
||||
if pack is None or pack["id"] != kept_pack:
|
||||
return None
|
||||
kept = {("DD_" + name[3:] if name.startswith("BL_") else name): value
|
||||
for name, value in row["env"].items() if name.startswith("BL_")}
|
||||
kept.update((name, value) for name, value in row["env"].items() if not name.startswith("BL_"))
|
||||
command, env = list(command), dict(env)
|
||||
command[0] = kept_command
|
||||
for name in LIVE_KEYS:
|
||||
value = row["env"].get(name)
|
||||
value = kept.get(name)
|
||||
if isinstance(value, str):
|
||||
env[name] = value
|
||||
else:
|
||||
env.pop(name, None)
|
||||
say("droiddeck-esync: Wine is still running in this prefix; keeping its sync choice (%s)" % describe(env))
|
||||
log_launch(root, command, env, tool, env.get("BL_SYNC_PACK"))
|
||||
log_launch(root, command, env, tool, env.get("DD_SYNC_PACK"))
|
||||
return command, env
|
||||
|
||||
|
||||
def describe(env):
|
||||
if env.get("BL_SYNC") == "1":
|
||||
if env.get("DD_SYNC") == "1":
|
||||
return "droiddeck-ntsync"
|
||||
if env.get("BL_FSYNC") == "1":
|
||||
if env.get("DD_FSYNC") == "1":
|
||||
return "droiddeck-fsync"
|
||||
if env.get("BL_SYNC_PACK") and truthy(env.get("WINEESYNC")):
|
||||
if env.get("DD_SYNC_PACK") and truthy(env.get("WINEESYNC")):
|
||||
return "droiddeck-esync"
|
||||
if all(truthy(env.get(name)) for name in WINESERVER_ONLY):
|
||||
return "wineserver"
|
||||
@@ -835,13 +838,13 @@ def describe(env):
|
||||
|
||||
def fsync_ready(env, measured):
|
||||
listed = "PROTON_NO_FSYNC" not in env and app_id(env) in NOSYNC_APPS
|
||||
return measured["fsync"] and env.get("BL_SYNC") != "1" and not truthy(env.get("PROTON_NO_FSYNC")) and not listed
|
||||
return measured["fsync"] and env.get("DD_SYNC") != "1" and not truthy(env.get("PROTON_NO_FSYNC")) and not listed
|
||||
|
||||
|
||||
def with_fsync(root, command, env, tool, reason):
|
||||
command, env = list(command), dict(env)
|
||||
env["BL_FSYNC"] = "1"
|
||||
env["BL_SYNC"] = "0"
|
||||
env["DD_FSYNC"] = "1"
|
||||
env["DD_SYNC"] = "0"
|
||||
env["WINEFSYNC"] = "1"
|
||||
say("droiddeck-fsync: %s; stock binaries with Proton's fsync" % reason)
|
||||
log_launch(root, command, env, tool, None)
|
||||
@@ -855,10 +858,10 @@ def stand_in(root, command, env, tool, reason, measured=None):
|
||||
if truthy(env.get("PROTON_NO_NTSYNC")):
|
||||
say("droiddeck-esync: %s; stock binaries" % reason)
|
||||
elif measured is not None and not measured["ntsync"]:
|
||||
env["BL_SYNC"] = "0"
|
||||
env["DD_SYNC"] = "0"
|
||||
say("droiddeck-esync: %s; stock binaries (this Wine has no ntsync)" % reason)
|
||||
else:
|
||||
env["BL_SYNC"] = "1"
|
||||
env["DD_SYNC"] = "1"
|
||||
say("droiddeck-esync: %s; stock binaries with droiddeck-ntsync" % reason)
|
||||
log_launch(root, command, env, tool, None)
|
||||
return command, env
|
||||
@@ -880,17 +883,17 @@ def wineserver_only(env):
|
||||
if truthy(env["PROTON_NO_FSYNC"]):
|
||||
env["WINEFSYNC"] = "0"
|
||||
if truthy(env["PROTON_NO_NTSYNC"]):
|
||||
env["BL_SYNC"] = "0"
|
||||
env["DD_SYNC"] = "0"
|
||||
return env
|
||||
|
||||
|
||||
def choose(root, command, env, tool, stock):
|
||||
name = os.path.basename(tool.rstrip("/")) or tool
|
||||
wants_fsync = env.get("BL_FSYNC_FIRST") == "1"
|
||||
if "BL_FSYNC" in env:
|
||||
env["BL_FSYNC"] = "0"
|
||||
stock = (stock[0], dict(stock[1], BL_FSYNC="0"))
|
||||
if env.get("BL_SYNC_FALLBACK") != "1" and not wants_fsync and env.get("BL_SYNC") != "1":
|
||||
wants_fsync = env.get("DD_FSYNC_FIRST") == "1"
|
||||
if "DD_FSYNC" in env:
|
||||
env["DD_FSYNC"] = "0"
|
||||
stock = (stock[0], dict(stock[1], DD_FSYNC="0"))
|
||||
if env.get("DD_SYNC_FALLBACK") != "1" and not wants_fsync and env.get("DD_SYNC") != "1":
|
||||
stock = (stock[0], wineserver_only(stock[1]))
|
||||
say("droiddeck-esync: off; wineserver sync only")
|
||||
log_launch(root, stock[0], stock[1], tool, None)
|
||||
@@ -898,14 +901,14 @@ def choose(root, command, env, tool, stock):
|
||||
cache = HashCache(root)
|
||||
try:
|
||||
measured = measure(tool, cache)
|
||||
if env.get("BL_SYNC") == "1" and not measured["ntsync"]:
|
||||
env["BL_SYNC"] = "0"
|
||||
stock = (stock[0], dict(stock[1], BL_SYNC="0"))
|
||||
if env.get("DD_SYNC") == "1" and not measured["ntsync"]:
|
||||
env["DD_SYNC"] = "0"
|
||||
stock = (stock[0], dict(stock[1], DD_SYNC="0"))
|
||||
wants_fsync = True
|
||||
say("droiddeck-ntsync: %s has no ntsync; trying droiddeck-fsync" % name)
|
||||
if wants_fsync and fsync_ready(env, measured):
|
||||
return with_fsync(root, command, env, tool, "chosen for %s" % name)
|
||||
if env.get("BL_SYNC_FALLBACK") != "1":
|
||||
if env.get("DD_SYNC_FALLBACK") != "1":
|
||||
say("droiddeck-esync: off")
|
||||
log_launch(root, command, env, tool, None)
|
||||
return stock
|
||||
@@ -936,16 +939,16 @@ def choose(root, command, env, tool, stock):
|
||||
env["WINEESYNC"] = "0"
|
||||
env["PROTON_NO_ESYNC"] = "1"
|
||||
if not truthy(env.get("PROTON_NO_NTSYNC")) and measured["ntsync"]:
|
||||
env["BL_SYNC"] = "1"
|
||||
env["DD_SYNC"] = "1"
|
||||
elif not env.get("WINEESYNC"):
|
||||
env["WINEESYNC"] = "1"
|
||||
if truthy(env["WINEESYNC"]) and "PROTON_NO_FSYNC" not in env:
|
||||
env["PROTON_NO_FSYNC"] = "1"
|
||||
env["WINESERVER"] = os.path.join(dist, WINESERVER)
|
||||
env["BL_SYNC_PACK"] = pack["id"]
|
||||
env["DD_SYNC_PACK"] = pack["id"]
|
||||
command[0] = os.path.join(dist, os.path.basename(command[0]))
|
||||
say("droiddeck-esync: pack %s for %s (%s, %s match); droiddeck-ntsync %s, droiddeck-esync %s, fds %s/%s"
|
||||
% (pack["id"], name, measured["version_line"], match_kind(pack, measured), "on" if env.get("BL_SYNC") == "1" else "off",
|
||||
% (pack["id"], name, measured["version_line"], match_kind(pack, measured), "on" if env.get("DD_SYNC") == "1" else "off",
|
||||
"on" if truthy(env["WINEESYNC"]) else "off", limit(soft), limit(hard)))
|
||||
log_launch(root, command, env, tool, pack["id"])
|
||||
return command, env
|
||||
@@ -1005,7 +1008,7 @@ def update_wanted(root, fresh, scanned, packs, cache):
|
||||
def reconcile_store(root, steam_root, env):
|
||||
cache = HashCache(root)
|
||||
packs = load_packs(root)
|
||||
enabled = env.get("BL_SYNC_FALLBACK") == "1"
|
||||
enabled = env.get("DD_SYNC_FALLBACK") == "1"
|
||||
rows = []
|
||||
fresh = {}
|
||||
scanned = set()
|
||||
|
||||
@@ -60,7 +60,7 @@ PROVIDED_NEEDS = {
|
||||
}
|
||||
GLIBC_BUILD = re.compile(r"^(?:ld|lib[A-Za-z_]+)-2\.[0-9]+\.so$|^libSegFault\.so$")
|
||||
GUEST_LIBDIRS = (("x86_64", "lib/x86_64-linux-gnu"), ("i386", "lib/i386-linux-gnu"))
|
||||
PRELOAD_NAMES = ("libblsession.so", "libfakeinput.so")
|
||||
PRELOAD_NAMES = ("libddsession.so", "libfakeinput.so")
|
||||
FAULT_REPORT = "libfaultreport.so"
|
||||
VULKAN_PIN = "libvulkan-thunk.so"
|
||||
VULKAN_PIN_DIR = "lib/x86_64-linux-gnu/droiddeck/vulkan"
|
||||
@@ -182,7 +182,7 @@ def own_fex_loads():
|
||||
|
||||
|
||||
def update_own_fex():
|
||||
wanted = os.environ.get("BL_FEX_TAG")
|
||||
wanted = os.environ.get("DD_FEX_TAG")
|
||||
if not wanted:
|
||||
return
|
||||
if (read_text(OWN_FEX_TAG) or "").strip() == wanted and own_fex_loads():
|
||||
|
||||
@@ -55,11 +55,11 @@ fex_ready() {
|
||||
local have ok=
|
||||
have=$(cat /usr/local/share/fex-emu/.droiddeck-tag 2>/dev/null || true)
|
||||
[ -x /usr/local/bin/FEX ] && fex_loads / && ok=1
|
||||
if [ -n "${BL_FEX_TAG:-}" ]; then
|
||||
if [ -n "$ok" ] && [ "$have" = "$BL_FEX_TAG" ]; then FEX_NOW=$have FEX_FROM=catalog; return 0; fi
|
||||
step "downloading FEX ($BL_FEX_TAG)"
|
||||
if fex_install "$BL_FEX_TAG" "${BL_FEX_SHA256:-}" "${BL_FEX_URLS:-}"; then FEX_NOW=$BL_FEX_TAG FEX_FROM=catalog; return 0; fi
|
||||
if [ -n "$ok" ]; then FEX_NOW=$have FEX_FROM="kept; $BL_FEX_TAG did not install"; return 0; fi
|
||||
if [ -n "${DD_FEX_TAG:-}" ]; then
|
||||
if [ -n "$ok" ] && [ "$have" = "$DD_FEX_TAG" ]; then FEX_NOW=$have FEX_FROM=catalog; return 0; fi
|
||||
step "downloading FEX ($DD_FEX_TAG)"
|
||||
if fex_install "$DD_FEX_TAG" "${DD_FEX_SHA256:-}" "${DD_FEX_URLS:-}"; then FEX_NOW=$DD_FEX_TAG FEX_FROM=catalog; return 0; fi
|
||||
if [ -n "$ok" ]; then FEX_NOW=$have FEX_FROM="kept; $DD_FEX_TAG did not install"; return 0; fi
|
||||
fi
|
||||
if [ -n "$ok" ] && [ "$have" = "$FEX_TAG" ]; then FEX_NOW=$have FEX_FROM=built-in; return 0; fi
|
||||
step "downloading FEX ($FEX_TAG)"
|
||||
|
||||
@@ -7,7 +7,7 @@ case ":${XDG_DATA_DIRS:-}:" in
|
||||
*) export XDG_DATA_DIRS=$HOME/.local/share/flatpak/exports/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share} ;;
|
||||
esac
|
||||
socket=()
|
||||
if [ -n "${BL_INSIDE:-}" ] || [ -n "${GAMESCOPE_WAYLAND_DISPLAY:-}" ]; then
|
||||
if [ -n "${DD_INSIDE:-}" ] || [ -n "${GAMESCOPE_WAYLAND_DISPLAY:-}" ]; then
|
||||
unset WAYLAND_DISPLAY
|
||||
export XDG_SESSION_TYPE=x11
|
||||
socket=(--nosocket=wayland --socket=x11)
|
||||
|
||||
@@ -47,7 +47,7 @@ def load_config():
|
||||
|
||||
|
||||
def session_debug_dir(env):
|
||||
return env.get("BL_DEBUG_DIR", "")
|
||||
return env.get("DD_DEBUG_DIR", "")
|
||||
|
||||
|
||||
def apply_game_debug_logs(env, config=None, debug_dir=None):
|
||||
|
||||
@@ -15,9 +15,9 @@ GAME_PREFIX = "DROIDDECK_GAME_"
|
||||
GAME_SPLIT_KEYS = ("TU_DEBUG", "MESA_NO_ERROR")
|
||||
CHROMIUM_FILES = {"chrome-sandbox", "chrome_100_percent.pak", "v8_context_snapshot.bin"}
|
||||
D3D9_DEFAULT_MEMORY_MB = 4096
|
||||
SYNC_KEYS = ("BL_SYNC", "BL_SYNC_FALLBACK", "BL_FSYNC_FIRST", "BL_SYNC_MIN_NOFILE", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC", "PROTON_NO_NTSYNC", "WINEESYNC")
|
||||
SYNC_KEYS = ("DD_SYNC", "DD_SYNC_FALLBACK", "DD_FSYNC_FIRST", "DD_SYNC_MIN_NOFILE", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC", "PROTON_NO_NTSYNC", "WINEESYNC")
|
||||
SEED_REDISTS = "/usr/local/bin/droiddeck-seed-redists"
|
||||
PACK_KEYS = ("WINESERVER", "BL_SYNC_PACK", "WINEESYNC", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC")
|
||||
PACK_KEYS = ("WINESERVER", "DD_SYNC_PACK", "WINEESYNC", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC")
|
||||
GAME_DEBUG = runpy.run_path(str(Path(__file__).with_name("droiddeck-game-debug")))
|
||||
game_debug_channels = GAME_DEBUG["game_debug_channels"]
|
||||
apply_game_debug_logs = GAME_DEBUG["apply_game_debug_logs"]
|
||||
@@ -454,7 +454,7 @@ def game_gpu(env, keep=False):
|
||||
|
||||
|
||||
def vram_cap(env):
|
||||
value = env.get("BL_VRAM_MB", "")
|
||||
value = env.get("DD_VRAM_MB", "")
|
||||
if not re.fullmatch(r"[1-9][0-9]{0,6}", value):
|
||||
return env
|
||||
result = env.copy()
|
||||
@@ -552,7 +552,7 @@ def cpu_topology(env, command=()):
|
||||
if env["WINE_CPU_TOPOLOGY"]:
|
||||
env["PROTON_CPU_TOPOLOGY"] = env["WINE_CPU_TOPOLOGY"]
|
||||
return
|
||||
picked = bool(env.get("DROIDDECK_GAME_CORES", "").strip() or env.get("BL_GAME_CPUS", "").strip())
|
||||
picked = bool(env.get("DROIDDECK_GAME_CORES", "").strip() or env.get("DD_GAME_CPUS", "").strip())
|
||||
fastest = env.get("DROIDDECK_FASTEST_CORES", "").strip() != "0" and game_id(env) is not None
|
||||
if not (picked or fastest):
|
||||
return
|
||||
@@ -633,7 +633,7 @@ def apply_config(env, config, app_id, fixes=None):
|
||||
# An open driver pair (PanVK, RADV) on a GPU that is not an Adreno: vkd3d-proton reports the
|
||||
# driver's own feature level and shader model. The app-wide 12_2 / 6_9 over-promised what PanVK
|
||||
# has, and an Unreal DX12 game took paths that crashed. A game's own setting still wins.
|
||||
if env.get("BL_OPEN_DRIVER") == "1":
|
||||
if env.get("DD_OPEN_DRIVER") == "1":
|
||||
game = config.get("games", {}).get(app_id, {}) or {}
|
||||
for name in ("VKD3D_FEATURE_LEVEL", "VKD3D_SHADER_MODEL"):
|
||||
if name not in game and name in result:
|
||||
@@ -668,7 +668,7 @@ def render_path_defaults(command, env):
|
||||
|
||||
|
||||
def bridge_feature_level(env):
|
||||
if env.get("BL_VKBRIDGE") != "1" or env.get("VKD3D_FEATURE_LEVEL") not in ("12_1", "12_2"):
|
||||
if env.get("DD_VKBRIDGE") != "1" or env.get("VKD3D_FEATURE_LEVEL") not in ("12_1", "12_2"):
|
||||
return None
|
||||
was = env["VKD3D_FEATURE_LEVEL"]
|
||||
env["VKD3D_FEATURE_LEVEL"] = "12_0"
|
||||
@@ -749,7 +749,7 @@ EVALUATOR_SCRIPT = re.compile(r"(?:^|[\\/])evaluatorscript_[0-9]+\.vdf$", re.IGN
|
||||
def mark_install_scripts(command, env):
|
||||
if not any(arg.lower().replace("\\", "/").endswith("iscriptevaluator.exe") for arg in command):
|
||||
return []
|
||||
root = env.get("BL_X64_STEAM_ROOT") or env.get("STEAM_COMPAT_CLIENT_INSTALL_PATH") or str(Path.home() / ".local/share/Steam")
|
||||
root = env.get("DD_X64_STEAM_ROOT") or env.get("STEAM_COMPAT_CLIENT_INSTALL_PATH") or str(Path.home() / ".local/share/Steam")
|
||||
scripts = [str(Path(root) / arg.replace("\\", "/")) for arg in command if EVALUATOR_SCRIPT.search(arg)]
|
||||
scripts = [path for path in scripts if os.path.isfile(path)]
|
||||
if not scripts:
|
||||
@@ -1001,7 +1001,7 @@ def repair_foreign_system_dlls(prefix, proton, env=None):
|
||||
machine = pe_machine(path)
|
||||
if machine is None or PE["machine_compatible"](path, machines, machine, builtins):
|
||||
continue
|
||||
link = path.parent / (name + ".bl-new")
|
||||
link = path.parent / (name + ".dd-new")
|
||||
backup = path.parent / (name + FOREIGN_SUFFIX)
|
||||
if backups:
|
||||
backup = path.parent / (name + FOREIGN_SUFFIX + ".%d" % (backups[-1][0] + 1))
|
||||
@@ -1270,14 +1270,14 @@ def system_graphics_launch(command, env):
|
||||
def game_logs(command, env, app_id, now=None):
|
||||
"""Detailed graphics logs for one game launch, in the session's log folder: Proton's own log,
|
||||
DXVK's and vkd3d-proton's, and the Vulkan driver's startup messages. The app turns this on
|
||||
(BL_GAME_LOGS=1) on a GPU that is not an Adreno, or with Setup's "Detailed graphics logs"."""
|
||||
if env.get("BL_GAME_LOGS") != "1" or not env.get("BL_DEBUG_DIR") or len(command) < 3 \
|
||||
(DD_GAME_LOGS=1) on a GPU that is not an Adreno, or with Setup's "Detailed graphics logs"."""
|
||||
if env.get("DD_GAME_LOGS") != "1" or not env.get("DD_DEBUG_DIR") or len(command) < 3 \
|
||||
or command[1] != "waitforexitandrun":
|
||||
return env
|
||||
import time
|
||||
stamp = time.strftime("%Y%m%d-%H%M%S", time.localtime(now))
|
||||
name = app_id or re.sub(r"[^A-Za-z0-9._-]+", "_", Path(command[2]).stem)[:40] or "game"
|
||||
parent = Path(env["BL_DEBUG_DIR"]) / "games"
|
||||
parent = Path(env["DD_DEBUG_DIR"]) / "games"
|
||||
try:
|
||||
parent.mkdir(parents=True, exist_ok=True)
|
||||
folder = Path(tempfile.mkdtemp(prefix=stamp + "-", suffix="-" + name, dir=parent))
|
||||
@@ -1303,7 +1303,7 @@ def game_logs(command, env, app_id, now=None):
|
||||
"proton: %s" % command[0],
|
||||
"started: %s" % time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(now)),
|
||||
] + ["%s=%s" % (key, env[key]) for key in sorted(env)
|
||||
if key.startswith(("VK_", "BL_VK", "BL_DRM", "BL_OPEN", "MESA_", "PANVK", "DXVK_", "VKD3D", "ZINK", "TU_", "DROIDDECK_VKD3D"))]) + "\n")
|
||||
if key.startswith(("VK_", "DD_VK", "DD_DRM", "DD_OPEN", "MESA_", "PANVK", "DXVK_", "VKD3D", "ZINK", "TU_", "DROIDDECK_VKD3D"))]) + "\n")
|
||||
except OSError:
|
||||
pass
|
||||
# Whether the game's sound reaches PulseAudio: the streams 20 s and 60 s in, without waiting.
|
||||
@@ -1328,7 +1328,7 @@ def main():
|
||||
if not command:
|
||||
return 2
|
||||
env = game_gpu(os.environ.copy())
|
||||
mic_enabled = env.get("BL_MIC_ENABLED")
|
||||
mic_enabled = env.get("DD_MIC_ENABLED")
|
||||
debug_dir = session_debug_dir(env)
|
||||
prefix_path = env.get("STEAM_COMPAT_DATA_PATH", "").rstrip("/")
|
||||
app_id = game_id(env)
|
||||
|
||||
@@ -99,11 +99,11 @@ def desktop_environment(base, proc=Path("/proc")):
|
||||
if command != b"/usr/bin/plasmashell":
|
||||
continue
|
||||
values = dict(os.fsdecode(item).split("=", 1) for item in (entry / "environ").read_bytes().split(b"\0") if b"=" in item)
|
||||
if values.get("BL_DESKTOP") != "1" or values.get("XDG_RUNTIME_DIR") != env.get("XDG_RUNTIME_DIR"):
|
||||
if values.get("DD_DESKTOP") != "1" or values.get("XDG_RUNTIME_DIR") != env.get("XDG_RUNTIME_DIR"):
|
||||
continue
|
||||
if not values.get("DISPLAY") or values.get("WAYLAND_DISPLAY") == env.get("WAYLAND_DISPLAY"):
|
||||
continue
|
||||
for key in ("DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "DBUS_SESSION_BUS_ADDRESS", "BL_DESKTOP"):
|
||||
for key in ("DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "DBUS_SESSION_BUS_ADDRESS", "DD_DESKTOP"):
|
||||
if key in values:
|
||||
env[key] = values[key]
|
||||
return env
|
||||
@@ -130,10 +130,10 @@ def runner(folder, appid, game, graphical=False):
|
||||
raise ValueError("No Proton tool is installed for this game")
|
||||
tool, command = available[name]
|
||||
base = desktop_environment(os.environ) if graphical else dict(os.environ)
|
||||
env = run["environment"](base, target, tool, root, window=base.get("BL_DESKTOP") == "1")
|
||||
env = run["environment"](base, target, tool, root, window=base.get("DD_DESKTOP") == "1")
|
||||
env["DROIDDECK_GOG_MAINTENANCE"] = "1"
|
||||
env["FEX_X87REDUCEDPRECISION"] = "0"
|
||||
env.pop("BL_STORE_EXIT", None)
|
||||
env.pop("DD_STORE_EXIT", None)
|
||||
return str(Path(tool) / command), env, target.compatdata
|
||||
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ def advertise_compositing():
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 2:
|
||||
raise SystemExit('usage: droiddeck-gpu-window <program> [args...]')
|
||||
if 'BL_GPU_CHILD_WSI' in os.environ:
|
||||
wsi = os.environ.pop('BL_GPU_CHILD_WSI')
|
||||
if 'DD_GPU_CHILD_WSI' in os.environ:
|
||||
wsi = os.environ.pop('DD_GPU_CHILD_WSI')
|
||||
if wsi:
|
||||
os.environ['MESA_VK_WSI_DEBUG'] = wsi
|
||||
else:
|
||||
|
||||
@@ -84,8 +84,8 @@ def connect():
|
||||
|
||||
|
||||
def main():
|
||||
launch = os.environ.get("BL_LAUNCH_DIR", "")
|
||||
report = Report(os.environ.get("BL_IME_DIR") or (os.path.join(launch, "agent") if launch else ""))
|
||||
launch = os.environ.get("DD_LAUNCH_DIR", "")
|
||||
report = Report(os.environ.get("DD_IME_DIR") or (os.path.join(launch, "agent") if launch else ""))
|
||||
conn = Connection(connect())
|
||||
conn.send(DISPLAY_ID, 1, struct.pack("<I", REGISTRY_ID))
|
||||
contexts = {}
|
||||
|
||||
@@ -323,7 +323,7 @@ def load_netmanager():
|
||||
|
||||
|
||||
def main():
|
||||
directory = os.environ.get("BL_LAUNCH_DIR")
|
||||
directory = os.environ.get("DD_LAUNCH_DIR")
|
||||
if not directory or not Path(directory).is_dir():
|
||||
sys.exit("droiddeck-login1: no DroidDeck session directory")
|
||||
ready = Path(directory) / "steam-sleep-ready"
|
||||
|
||||
@@ -187,7 +187,7 @@ def import_of(key, what):
|
||||
|
||||
|
||||
def imported(what, real, key, name):
|
||||
launch = os.environ.get("BL_LAUNCH_DIR")
|
||||
launch = os.environ.get("DD_LAUNCH_DIR")
|
||||
if not launch or not os.path.isdir(launch):
|
||||
raise RuntimeError("%s cannot run from here; add it in DroidDeck with Add an app." % name)
|
||||
result = os.path.join(launch, "desktop-import-%s.result" % key)
|
||||
@@ -311,7 +311,7 @@ def command(path, args, what, window=False, appid=None):
|
||||
|
||||
|
||||
def on_desktop(env):
|
||||
return env.get("BL_DESKTOP") == "1" and not env.get("GAMESCOPE_WAYLAND_DISPLAY") and os.access(GPU, os.X_OK)
|
||||
return env.get("DD_DESKTOP") == "1" and not env.get("GAMESCOPE_WAYLAND_DISPLAY") and os.access(GPU, os.X_OK)
|
||||
|
||||
|
||||
def unattended(env):
|
||||
@@ -321,7 +321,7 @@ def unattended(env):
|
||||
return True
|
||||
if stat.S_ISCHR(out.st_mode):
|
||||
return not os.isatty(1)
|
||||
folder = env.get("BL_DEBUG_DIR")
|
||||
folder = env.get("DD_DEBUG_DIR")
|
||||
try:
|
||||
log = os.stat(os.path.join(folder, "desktop.log")) if folder else None
|
||||
except OSError:
|
||||
|
||||
@@ -30,7 +30,7 @@ def main(argv):
|
||||
url = argv[0] if argv else ""
|
||||
if url.startswith("steam://openurl/"):
|
||||
url = url[len("steam://openurl/"):]
|
||||
launch_dir = os.environ.get("BL_LAUNCH_DIR", "")
|
||||
launch_dir = os.environ.get("DD_LAUNCH_DIR", "")
|
||||
if not launch_dir:
|
||||
try:
|
||||
launch_dir = open(LAUNCH_DIR_FILE).read().strip()
|
||||
|
||||
@@ -693,7 +693,7 @@ def melonds_geometry():
|
||||
import base64, struct
|
||||
w, h = 512, 288
|
||||
try:
|
||||
screen_w = int(os.environ.get("BL_WIDTH", "1920"))
|
||||
screen_w = int(os.environ.get("DD_WIDTH", "1920"))
|
||||
except ValueError:
|
||||
screen_w = 1920
|
||||
rect = (0, 0, w - 1, h - 1)
|
||||
|
||||
@@ -227,7 +227,7 @@ def shortcut_entries(root):
|
||||
except (OSError, ValueError, IndexError, KeyError, struct.error):
|
||||
pass
|
||||
try:
|
||||
with open(os.environ.get("BL_ADDED_GAMES", ""), encoding="utf-8") as f:
|
||||
with open(os.environ.get("DD_ADDED_GAMES", ""), encoding="utf-8") as f:
|
||||
for game in json.load(f):
|
||||
if isinstance(game, dict) and game.get("exe") and str(game.get("appid", "")).isdigit():
|
||||
entries.append((int(game["appid"]) & 0xFFFFFFFF, game["exe"], game.get("dir") or ""))
|
||||
|
||||
@@ -16,7 +16,7 @@ run=("${interp[@]}" "./$entry")
|
||||
if [ -x /usr/local/bin/droiddeck-fex ]; then
|
||||
run=(/usr/local/bin/droiddeck-fex run --mode "$fex" --for "$folder" -- "${interp[@]}" "./$entry")
|
||||
fi
|
||||
if [ "$fex" = off ]; then unset BL_BINFMT; else export BL_BINFMT=1; fi
|
||||
if [ "$fex" = off ]; then unset DD_BINFMT; else export DD_BINFMT=1; fi
|
||||
echo "== script $entry in $folder (${interp[*]:-a program}, FEX $fex)"
|
||||
case ${DBUS_SESSION_BUS_ADDRESS:-} in
|
||||
unix:*) "${run[@]}" "$@" ;;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1315,7 +1315,7 @@ def main():
|
||||
files_only = sys.argv[1:2] == ["--files-only"]
|
||||
steam_root = sys.argv[2 if files_only else 1]
|
||||
try:
|
||||
port = int(os.environ.get("BL_CDP_PORT", ""))
|
||||
port = int(os.environ.get("DD_CDP_PORT", ""))
|
||||
except ValueError:
|
||||
say("no devtools port for this session; the client's mapping is kept through config.vdf")
|
||||
return 0
|
||||
@@ -1339,7 +1339,7 @@ def main():
|
||||
watcher = Watcher([COMPAT["state_path"]("request.json"), COMPAT["state_path"]("games.json"),
|
||||
os.path.join(steam_root, "appcache", "appinfo.vdf")] +
|
||||
[os.path.join(lib, "steamapps", "libraryfolders.vdf") for lib in (steam_root, COMPAT["LIBRARY"] + "-sd")])
|
||||
steamos = os.environ.get("BL_STEAMDECK") == "1" and os.environ.get("BL_STEAM_UI") != "desktop"
|
||||
steamos = os.environ.get("DD_STEAMDECK") == "1" and os.environ.get("DD_STEAM_UI") != "desktop"
|
||||
helper = Helper(steam_root, port, steamos)
|
||||
failures = 0
|
||||
last = None
|
||||
|
||||
@@ -21,9 +21,9 @@ def select_desktop(evaluate, timeout=90):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
base = os.environ.get('BL_LAUNCH_DIR')
|
||||
base = os.environ.get('DD_LAUNCH_DIR')
|
||||
if not base:
|
||||
raise SystemExit('BL_LAUNCH_DIR is not set')
|
||||
raise SystemExit('DD_LAUNCH_DIR is not set')
|
||||
agent = runpy.run_path('/usr/local/bin/droiddeck-agent')
|
||||
selected = select_desktop(lambda expression: agent['cdp_eval'](
|
||||
Path(base) / 'agent', expression, timeout=2))
|
||||
|
||||
@@ -134,7 +134,7 @@ def method(obj, slot, result, *args):
|
||||
|
||||
|
||||
def probe(steam_root, ids):
|
||||
library = C.CDLL(os.environ.get("BL_STEAMCLIENT") or str(Path(steam_root) / "steamrtarm64/steamclient.so"))
|
||||
library = C.CDLL(os.environ.get("DD_STEAMCLIENT") or str(Path(steam_root) / "steamrtarm64/steamclient.so"))
|
||||
library.CreateInterface.argtypes = [C.c_char_p, C.c_void_p]
|
||||
library.CreateInterface.restype = C.c_void_p
|
||||
client = library.CreateInterface(b"SteamClient020", None)
|
||||
@@ -184,8 +184,8 @@ def downloads_idle(steam_root):
|
||||
|
||||
|
||||
def request_restart(steam_root):
|
||||
Path(os.environ.get("HOME", "/root"), ".bl-restart-once").touch()
|
||||
command = shlex.split(os.environ.get("BL_STEAM_SHUTDOWN", "")) or [str(Path(steam_root) / "steamrtarm64/steam"), "-shutdown"]
|
||||
Path(os.environ.get("HOME", "/root"), ".dd-restart-once").touch()
|
||||
command = shlex.split(os.environ.get("DD_STEAM_SHUTDOWN", "")) or [str(Path(steam_root) / "steamrtarm64/steam"), "-shutdown"]
|
||||
subprocess.run(command,
|
||||
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=30)
|
||||
|
||||
@@ -231,7 +231,7 @@ def remember_tried(steam_root, account, appids):
|
||||
|
||||
def watch(steam_root, listing):
|
||||
games = [game for game in read_json(listing, []) if not store_game(game) and not game.get("native")]
|
||||
if os.environ.get("BL_STEAM_OFFLINE") == "1" or not games:
|
||||
if os.environ.get("DD_STEAM_OFFLINE") == "1" or not games:
|
||||
return
|
||||
candidates, sources = {}, {}
|
||||
next_lookup = 0
|
||||
@@ -259,7 +259,7 @@ def watch(steam_root, listing):
|
||||
elif candidates and (key != probed or now >= next_probe):
|
||||
probed, next_probe = key, now + 300
|
||||
try:
|
||||
probe_env = dict(os.environ, HOME=os.environ["BL_STEAM_IPC_HOME"]) if os.environ.get("BL_STEAM_IPC_HOME") else None
|
||||
probe_env = dict(os.environ, HOME=os.environ["DD_STEAM_IPC_HOME"]) if os.environ.get("DD_STEAM_IPC_HOME") else None
|
||||
result = subprocess.run([sys.executable, __file__, "probe", steam_root,
|
||||
*map(str, sorted(set(candidates.values())))],
|
||||
capture_output=True, text=True, timeout=15, env=probe_env)
|
||||
|
||||
@@ -6,7 +6,7 @@ stable_channel=steamdeck_stable
|
||||
steam_root=${XDG_DATA_HOME:-$HOME/.local/share}/Steam
|
||||
channel_state=$steam_root/package/droiddeck-channel
|
||||
pinned=1
|
||||
wanted=${BL_STEAM_CHANNEL:-$(cat "$HOME/.config/droiddeck/steam-channel" 2>/dev/null || true)}
|
||||
wanted=${DD_STEAM_CHANNEL:-$(cat "$HOME/.config/droiddeck/steam-channel" 2>/dev/null || true)}
|
||||
case $wanted in
|
||||
stable|"$stable_channel") steam_channel=$stable_channel ;;
|
||||
beta|"$beta_channel") steam_channel=$beta_channel ;;
|
||||
@@ -24,7 +24,7 @@ manifest=steam_client_${steam_channel}_linuxarm64
|
||||
stamp=$steam_root/package/droiddeck-installed
|
||||
legacy_stamp=$steam_root/package/bannerlator-installed
|
||||
unconfirmed=$steam_root/package/droiddeck-unconfirmed
|
||||
repair_request=$HOME/.bl-steam-repair
|
||||
repair_request=$HOME/.dd-steam-repair
|
||||
parts=$steam_root/package/droiddeck-download
|
||||
if [ -f "$legacy_stamp" ] && [ ! -f "$stamp" ]; then
|
||||
mv -f "$legacy_stamp" "$stamp" || true
|
||||
@@ -85,7 +85,7 @@ size_of() {
|
||||
echo $((n))
|
||||
}
|
||||
limits=(--connect-timeout 30 --speed-limit 4096 --speed-time 60)
|
||||
read -r -a delays <<< "${BL_STEAM_RETRY_DELAYS:-5 10 20 30 30}"
|
||||
read -r -a delays <<< "${DD_STEAM_RETRY_DELAYS:-5 10 20 30 30}"
|
||||
|
||||
step() { echo "== STEP $(date -u +%H:%M:%S) $*"; }
|
||||
progress() {
|
||||
|
||||
@@ -11,13 +11,13 @@ case $target in
|
||||
*) url=steam://rungameid/$target ;;
|
||||
esac
|
||||
|
||||
if [ "$ui" = desktop ] && [ "${BL_DESKTOP:-}" = 1 ]; then
|
||||
if [ "$ui" = desktop ] && [ "${DD_DESKTOP:-}" = 1 ]; then
|
||||
case ",${MESA_VK_WSI_DEBUG:-}," in
|
||||
*,sw,*) ;;
|
||||
*) export MESA_VK_WSI_DEBUG=${MESA_VK_WSI_DEBUG:+$MESA_VK_WSI_DEBUG,}sw ;;
|
||||
esac
|
||||
if [ "${BL_STEAM_CLIENT_ARCH:-}" = x86_64 ]; then
|
||||
client_home=${BL_X64_HOME:-${HOME:-/root}/.droiddeck-x64}
|
||||
if [ "${DD_STEAM_CLIENT_ARCH:-}" = x86_64 ]; then
|
||||
client_home=${DD_X64_HOME:-${HOME:-/root}/.droiddeck-x64}
|
||||
client=(/usr/local/bin/droiddeck-steam-x64 --exec)
|
||||
else
|
||||
steam_root=${XDG_DATA_HOME:-${HOME:-/root}/.local/share}/Steam
|
||||
@@ -25,7 +25,7 @@ if [ "$ui" = desktop ] && [ "${BL_DESKTOP:-}" = 1 ]; then
|
||||
client_home=$HOME
|
||||
client=("$steam_root/steamrtarm64/steam")
|
||||
fi
|
||||
if [ "${BL_BOTTOM_DESKTOP:-}" = 1 ]; then
|
||||
if [ "${DD_BOTTOM_DESKTOP:-}" = 1 ]; then
|
||||
pid=$(cat "$client_home/.steam/steam.pid" 2>/dev/null || true)
|
||||
if [ -p "$client_home/.steam/steam.pipe" ] && [[ "$pid" =~ ^[0-9]+$ ]] && kill -0 "$pid" 2>/dev/null; then
|
||||
# The top screen's client takes the request, so games open there.
|
||||
@@ -48,13 +48,13 @@ if [ "$ui" = desktop ] && [ "${BL_DESKTOP:-}" = 1 ]; then
|
||||
exit 69
|
||||
fi
|
||||
[ "$url" = steam://exit ] && exit 0
|
||||
export BL_INSIDE=1 BL_STEAM_UI=desktop
|
||||
export DD_INSIDE=1 DD_STEAM_UI=desktop
|
||||
exec /usr/local/bin/droiddeck-session steam "${url:-steam://open/library}"
|
||||
fi
|
||||
|
||||
dir=${BL_LAUNCH_DIR:-}
|
||||
dir=${DD_LAUNCH_DIR:-}
|
||||
if [ -z "$dir" ] || [ ! -d "$dir" ]; then
|
||||
echo "droiddeck-steam-launch: not inside a DroidDeck session (BL_LAUNCH_DIR unset)" >&2
|
||||
echo "droiddeck-steam-launch: not inside a DroidDeck session (DD_LAUNCH_DIR unset)" >&2
|
||||
exit 69
|
||||
fi
|
||||
printf 'ui=%s\nurl=%s\n' "$ui" "$url" > "$dir/steam-launch.tmp" && mv -f "$dir/steam-launch.tmp" "$dir/steam-launch"
|
||||
|
||||
@@ -6,7 +6,7 @@ import runpy
|
||||
import sys
|
||||
|
||||
BIN_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
LIBRARIES = (("/mnt/droiddeck-sd", os.environ.get("BL_LIBRARY_LABEL", "SD Card")),)
|
||||
LIBRARIES = (("/mnt/droiddeck-sd", os.environ.get("DD_LIBRARY_LABEL", "SD Card")),)
|
||||
MAIN_LABEL = "Internal Storage"
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ ADDED_DIR = "/mnt/droiddeck-lib/"
|
||||
|
||||
|
||||
def wanted():
|
||||
listing = os.environ.get("BL_STEAM_LIBRARIES")
|
||||
listing = os.environ.get("DD_STEAM_LIBRARIES")
|
||||
if not listing:
|
||||
return None
|
||||
try:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -u
|
||||
if [ "${BL_DESKTOP:-}" = 1 ]; then
|
||||
if [ "${DD_DESKTOP:-}" = 1 ]; then
|
||||
url=
|
||||
ui=desktop
|
||||
for arg in "$@"; do
|
||||
@@ -12,5 +12,5 @@ if [ "${BL_DESKTOP:-}" = 1 ]; then
|
||||
done
|
||||
exec /usr/local/bin/droiddeck-steam-launch "$ui" ${url:+"$url"}
|
||||
fi
|
||||
[ "${BL_STEAM_CLIENT_ARCH:-}" = x86_64 ] && exec /usr/local/bin/droiddeck-steam-x64 --exec "$@"
|
||||
[ "${DD_STEAM_CLIENT_ARCH:-}" = x86_64 ] && exec /usr/local/bin/droiddeck-steam-x64 --exec "$@"
|
||||
exec "${HOME:-/root}/.local/share/Steam/steamrtarm64/steam" "$@"
|
||||
@@ -345,7 +345,7 @@ def main():
|
||||
cfg = os.path.join(steam_root, "config", "config.vdf")
|
||||
if os.path.isfile(cfg) and (ours or routes):
|
||||
tools = os.path.join(steam_root, "compatibilitytools.d")
|
||||
x64_tool = os.environ.get("BL_COMPAT_TOOL")
|
||||
x64_tool = os.environ.get("DD_COMPAT_TOOL")
|
||||
own = {}
|
||||
if x64_tool:
|
||||
protect = {compat.first_key(os.path.join(tools, e, "compatibilitytool.vdf"), ["compatibilitytools", "compat_tools"]) or e: e
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# before starting the browser when Android denies sched_setaffinity.
|
||||
set -u
|
||||
if [ "$#" -ge 2 ] && [[ "$1" =~ ^(0[xX])?[0-9a-fA-F]+$ ]] &&
|
||||
[ -n "${BL_STEAM_WEBHELPER:-}" ] && [ "$2" -ef "$BL_STEAM_WEBHELPER" ]; then
|
||||
[ -n "${DD_STEAM_WEBHELPER:-}" ] && [ "$2" -ef "$DD_STEAM_WEBHELPER" ]; then
|
||||
mask=$1
|
||||
shift
|
||||
# Pin this wrapper before exec; never retry a helper that has already run.
|
||||
|
||||
@@ -7,7 +7,7 @@ X64_CHANNEL=steamdeck_publicbeta
|
||||
MANIFEST=steam_client_${X64_CHANNEL}_steamrt64
|
||||
|
||||
REAL_HOME=${HOME:-/root}
|
||||
X64_HOME=${BL_X64_HOME:-$REAL_HOME/.droiddeck-x64}
|
||||
X64_HOME=${DD_X64_HOME:-$REAL_HOME/.droiddeck-x64}
|
||||
ROOTFS=$X64_HOME/rootfs
|
||||
STEAM_X64=$X64_HOME/.local/share/Steam
|
||||
ARM_STEAM=${XDG_DATA_HOME:-$REAL_HOME/.local/share}/Steam
|
||||
@@ -88,7 +88,7 @@ x64_map_direct() {
|
||||
done
|
||||
python3 - "$mode" "$STEAM_X64/config/config.vdf" "$STEAM_X64/appcache/appinfo.vdf" "$X64_HOME/direct-auto.json" \
|
||||
"$X64_HOME/direct-sniper" "$libraries" "$(x64_default_tool)" \
|
||||
"$REAL_HOME/.bl-compat-pending" ${BL_X64_DIRECT_APPS:-550} \
|
||||
"$REAL_HOME/.dd-compat-pending" ${DD_X64_DIRECT_APPS:-550} \
|
||||
<<'PY' || { [ "$mode" = live ] || step "could not map titles to DroidDeck direct"; }
|
||||
# Steam does not swap an installed build when the tool changes: a title installed for Windows stays on Proton.
|
||||
import json, os, re, struct, sys
|
||||
@@ -356,7 +356,7 @@ if [ ! -f "$ROOTFS/.droiddeck-complete" ]; then
|
||||
fi
|
||||
echo "== x86-64 rootfs: $(sed -n 's|.*/download/\([^/]*\)/.*|\1|p' <<<"$ROOTFS_URL") (sha256 ${ROOTFS_SHA256:0:12})" >&2
|
||||
: > "$ROOTFS/etc/ld.so.preload"
|
||||
for lib in libblsession libfakeinput; do
|
||||
for lib in libddsession libfakeinput; do
|
||||
have=0
|
||||
arches="x86_64 i386"; [ "$lib" = libfakeinput ] && arches=x86_64
|
||||
rm -f "$ROOTFS/usr/local/lib/i386-linux-gnu/libfakeinput.so"
|
||||
@@ -371,11 +371,11 @@ for lib in libblsession libfakeinput; do
|
||||
elif [ "$have" = 1 ]; then echo "/usr/local/\$LIB/$lib.so" >> "$ROOTFS/etc/ld.so.preload"
|
||||
else step "warning: no x86 build of $lib (/usr/local/lib/droiddeck-fex/x86_64/$lib.so)"; fi
|
||||
done
|
||||
rm -f "$ROOTFS/usr/local/lib/libblsession-x86_64.so" "$ROOTFS/usr/local/lib/libfakeinput-x86_64.so"
|
||||
rm -f "$ROOTFS/usr/local/lib/libddsession-x86_64.so" "$ROOTFS/usr/local/lib/libfakeinput-x86_64.so"
|
||||
unconfirmed=$STEAM_X64/package/droiddeck-unconfirmed
|
||||
if [ -d "${unconfirmed%/*}" ] && ! grep -qx tracked "$unconfirmed" 2>/dev/null; then echo tracked > "$unconfirmed"; fi
|
||||
x64_repair=
|
||||
if [ "${BL_X64_REPAIR:-0}" = 1 ]; then
|
||||
if [ "${DD_X64_REPAIR:-0}" = 1 ]; then
|
||||
x64_repair=requested
|
||||
elif [ -f "$unconfirmed" ] && ! grep -qx repaired "$unconfirmed" && [ "$(grep -cx start "$unconfirmed")" -ge 2 ]; then
|
||||
x64_repair="the client was started $(grep -cx start "$unconfirmed") times without showing anything"
|
||||
@@ -502,7 +502,7 @@ marker=$(cat "${0%/*}/vac-marker" 2>/dev/null)
|
||||
case "$*" in *hl2.sh*|*hl2_linux*|*srcds*) [ -n "$marker" ] && [ -f "$marker" ] && set -- "$@" -condebug ;; esac
|
||||
# game-gpu.env is rewritten whenever the launcher runs; game-gpu.local is the user's and is read after it.
|
||||
gpu=$HOME/game-gpu.env
|
||||
if [ -f "$gpu" ] && [ "${BL_X64_GAME_SOFTWARE:-0}" != 1 ]; then
|
||||
if [ -f "$gpu" ] && [ "${DD_X64_GAME_SOFTWARE:-0}" != 1 ]; then
|
||||
. "$gpu"
|
||||
[ -f "$HOME/game-gpu.local" ] && . "$HOME/game-gpu.local"
|
||||
else
|
||||
@@ -580,9 +580,9 @@ VDF
|
||||
x64_sync_login
|
||||
if ! pgrep -f 'steamrt64/steam( |$)' >/dev/null 2>&1; then
|
||||
listing_ok=0
|
||||
if BL_X64_SHARED=$X64_HOME/shared/arm64 python3 - "$STEAM_X64" "${BL_X64_STEAM_LIBRARIES:-}" "$STEAM_X64/config/libraryfolders.vdf" "$STEAM_X64/steamapps/libraryfolders.vdf" <<'PY'; then
|
||||
if DD_X64_SHARED=$X64_HOME/shared/arm64 python3 - "$STEAM_X64" "${DD_X64_STEAM_LIBRARIES:-}" "$STEAM_X64/config/libraryfolders.vdf" "$STEAM_X64/steamapps/libraryfolders.vdf" <<'PY'; then
|
||||
import json, os, re, sys
|
||||
keep = {os.path.realpath(sys.argv[1]), os.path.realpath(os.environ["BL_X64_SHARED"])}
|
||||
keep = {os.path.realpath(sys.argv[1]), os.path.realpath(os.environ["DD_X64_SHARED"])}
|
||||
# Without the session's list nothing is known about the card: leave the folders as they are.
|
||||
if not sys.argv[2]:
|
||||
sys.exit(3)
|
||||
@@ -622,7 +622,7 @@ PY
|
||||
step "could not check the x86-64 client's library folders"
|
||||
fi
|
||||
if [ "$listing_ok" = 1 ]; then
|
||||
BL_STEAM_LIBRARIES=$BL_X64_STEAM_LIBRARIES droiddeck-steam-library "$STEAM_X64" ||
|
||||
DD_STEAM_LIBRARIES=$DD_X64_STEAM_LIBRARIES droiddeck-steam-library "$STEAM_X64" ||
|
||||
step "could not add the card to the x86-64 client's library folders"
|
||||
fi
|
||||
fi
|
||||
@@ -706,11 +706,11 @@ PY
|
||||
}
|
||||
|
||||
x64_gpu() {
|
||||
[ "${BL_X64_SOFTWARE:-0}" != 1 ] && [ -d /usr/local/share/fex-emu/GuestThunks ] && [ -d /usr/local/lib/fex-emu/HostThunks ]
|
||||
[ "${DD_X64_SOFTWARE:-0}" != 1 ] && [ -d /usr/local/share/fex-emu/GuestThunks ] && [ -d /usr/local/lib/fex-emu/HostThunks ]
|
||||
}
|
||||
|
||||
x64_webhelper_gpu() {
|
||||
x64_gpu && [ "${BL_X64_CLIENT_SOFTWARE:-0}" != 1 ] && [ "${BL_X64_CEF_GPU:-1}" != 0 ]
|
||||
x64_gpu && [ "${DD_X64_CLIENT_SOFTWARE:-0}" != 1 ] && [ "${DD_X64_CEF_GPU:-1}" != 0 ]
|
||||
}
|
||||
|
||||
x64_env() {
|
||||
@@ -729,7 +729,7 @@ if x64_gpu; then
|
||||
done
|
||||
} > "$X64_HOME/game-gpu.env"
|
||||
fi
|
||||
if x64_gpu && [ "${BL_X64_CLIENT_SOFTWARE:-0}" != 1 ]; then
|
||||
if x64_gpu && [ "${DD_X64_CLIENT_SOFTWARE:-0}" != 1 ]; then
|
||||
export FEX_THUNKCONFIG=$X64_HOME/thunks.json
|
||||
unset LIBGL_ALWAYS_SOFTWARE LIBGL_DRI3_DISABLE
|
||||
else
|
||||
@@ -737,7 +737,7 @@ unset FEX_THUNKCONFIG $gpu_vars
|
||||
export LIBGL_ALWAYS_SOFTWARE=1 GALLIUM_DRIVER=llvmpipe
|
||||
export LIBGL_DRI3_DISABLE=1
|
||||
fi
|
||||
[ "${BL_X64_FP_OFF:-0}" = 1 ] && export PROOT_FP_OFF=1
|
||||
[ "${DD_X64_FP_OFF:-0}" = 1 ] && export PROOT_FP_OFF=1
|
||||
export FEX_TSOENABLED=${FEX_TSOENABLED:-1} FEX_VECTORTSOENABLED=${FEX_VECTORTSOENABLED:-0} \
|
||||
FEX_MEMCPYSETTSOENABLED=${FEX_MEMCPYSETTSOENABLED:-0} FEX_HALFBARRIERTSOENABLED=${FEX_HALFBARRIERTSOENABLED:-0} \
|
||||
FEX_X87REDUCEDPRECISION=${FEX_X87REDUCEDPRECISION:-1} FEX_MULTIBLOCK=${FEX_MULTIBLOCK:-1}
|
||||
@@ -750,7 +750,7 @@ export STEAM_RUNTIME=1
|
||||
[ -d "$X64_HOME/steamrt-shim/bin" ] && export PATH=$X64_HOME/steamrt-shim/bin:$PATH
|
||||
export LD_LIBRARY_PATH=$STEAM_X64/steamrt64:$STEAM_X64/steamrt64/panorama:$X64_HOME/steamrt-libs
|
||||
export STEAM_STEAMRT_RECURSION_GUARD=1
|
||||
export BL_WEBHELPER_HIDE_TRACER=1
|
||||
export DD_WEBHELPER_HIDE_TRACER=1
|
||||
}
|
||||
|
||||
x64_manifest_version() {
|
||||
@@ -760,7 +760,7 @@ x64_manifest_version() {
|
||||
}
|
||||
|
||||
x64_gpu_probe() {
|
||||
local fex=${BL_FEX:-/usr/local/bin/FEX}
|
||||
local fex=${DD_FEX:-/usr/local/bin/FEX}
|
||||
echo "== x86-64 GPU probe (x86 glxinfo and vulkaninfo through FEX):"
|
||||
(
|
||||
unset LD_LIBRARY_PATH
|
||||
@@ -795,23 +795,23 @@ x64_arm_webhelper_cpu_supported() {
|
||||
x64_exec() {
|
||||
x64_env
|
||||
cd "$STEAM_X64"
|
||||
if [ "${BL_X64_X86_WEBHELPER:-0}" != 1 ] && [ -x /usr/local/bin/droiddeck-x64-arm-webhelper ] &&
|
||||
if [ "${DD_X64_X86_WEBHELPER:-0}" != 1 ] && [ -x /usr/local/bin/droiddeck-x64-arm-webhelper ] &&
|
||||
[ -x "$ARM_STEAM/steamrtarm64/steamwebhelper" ] && x64_arm_webhelper_cpu_supported; then
|
||||
local chan x86_build arm_build
|
||||
chan=$(cat "$STEAM_X64/package/beta" 2>/dev/null || echo "$X64_CHANNEL")
|
||||
x86_build=$(awk -F'"' '$2 == "version" { print $4; exit }' "$STEAM_X64/package/steam_client_${chan}_steamrt64.manifest" 2>/dev/null || true)
|
||||
arm_build=$(awk -F'"' '$2 == "version" { print $4; exit }' "$ARM_STEAM/package/steam_client_${chan}_linuxarm64.manifest" 2>/dev/null || true)
|
||||
if [ -n "$x86_build" ] && [ "$x86_build" = "$arm_build" ]; then
|
||||
export BL_X64_ARM_WEBHELPER=/usr/local/bin/droiddeck-x64-arm-webhelper
|
||||
export DD_X64_ARM_WEBHELPER=/usr/local/bin/droiddeck-x64-arm-webhelper
|
||||
else
|
||||
echo "== x86-64 client build ${x86_build:-?}, arm64 web helper's ${arm_build:-?}: keeping the x86 web helper" >&2
|
||||
fi
|
||||
fi
|
||||
if [ -z "${BL_X64_ARM_WEBHELPER:-}" ] && x64_webhelper_gpu; then
|
||||
export BL_WEBHELPER_ARGS="--ignore-gpu-blocklist --use-gl=angle --use-angle=gl --ozone-platform=x11"
|
||||
[ -x /usr/local/bin/droiddeck-x64-webhelper ] && export BL_X64_ARM_WEBHELPER=/usr/local/bin/droiddeck-x64-webhelper
|
||||
elif [ -z "${BL_X64_ARM_WEBHELPER:-}" ]; then
|
||||
export BL_WEBHELPER_ARGS=stock
|
||||
if [ -z "${DD_X64_ARM_WEBHELPER:-}" ] && x64_webhelper_gpu; then
|
||||
export DD_WEBHELPER_ARGS="--ignore-gpu-blocklist --use-gl=angle --use-angle=gl --ozone-platform=x11"
|
||||
[ -x /usr/local/bin/droiddeck-x64-webhelper ] && export DD_X64_ARM_WEBHELPER=/usr/local/bin/droiddeck-x64-webhelper
|
||||
elif [ -z "${DD_X64_ARM_WEBHELPER:-}" ]; then
|
||||
export DD_WEBHELPER_ARGS=stock
|
||||
local a args=() soft=0
|
||||
for a in "$@"; do
|
||||
case $a in
|
||||
@@ -827,7 +827,7 @@ x64_exec() {
|
||||
grep --line-buffered -oE 'Downloading update \([0-9,]+ of [0-9,]+ KB\)|^[[:space:]]*(\[[^]]+\][[:space:]]*)*(Extracting package|Installing update)\.\.\.[[:space:]]*$' | sed -u 's/,//g' >&2 ) &
|
||||
echo "== x86-64 client: steamrt64 $(x64_manifest_version steamrt64) (the client may update itself)" >&2
|
||||
x64_webhelper_gpu && { x64_gpu_watch >&2 & }
|
||||
exec "${BL_FEX:-/usr/local/bin/FEX}" "$STEAM_X64/steamrt64/steam" "$@"
|
||||
exec "${DD_FEX:-/usr/local/bin/FEX}" "$STEAM_X64/steamrt64/steam" "$@"
|
||||
}
|
||||
|
||||
x64_share() {
|
||||
@@ -969,8 +969,8 @@ if pgrep -f 'steamrtarm64/steam( |$)' >/dev/null 2>&1; then
|
||||
fi
|
||||
x64_prepare
|
||||
step "FEX, rootfs and client ready"
|
||||
if [ -n "${BL_FEXSERVER_LOG:-}" ]; then
|
||||
FEX_ROOTFS=$ROOTFS "$(dirname "${BL_FEX:-/usr/local/bin/FEX}")/FEXServer" -f -p 600 >"$BL_FEXSERVER_LOG" 2>&1 &
|
||||
if [ -n "${DD_FEXSERVER_LOG:-}" ]; then
|
||||
FEX_ROOTFS=$ROOTFS "$(dirname "${DD_FEX:-/usr/local/bin/FEX}")/FEXServer" -f -p 600 >"$DD_FEXSERVER_LOG" 2>&1 &
|
||||
sleep 1
|
||||
fi
|
||||
x64_bus= x64_nm= x64_pin=
|
||||
@@ -1017,11 +1017,11 @@ if ! pgrep -f 'steamrt64/steam( |$)' >/dev/null 2>&1; then
|
||||
{ [ -e "$f" ] || [ -L "$f" ]; } && rm -f "$f"
|
||||
done
|
||||
fi
|
||||
if [ -n "${BL_CLIENT_CPUS:-}" ] && command -v taskset >/dev/null 2>&1; then
|
||||
if [ -n "${DD_CLIENT_CPUS:-}" ] && command -v taskset >/dev/null 2>&1; then
|
||||
(
|
||||
while sleep 5; do
|
||||
for pid in $(ps -A -o PID,ARGS | awk '($2 ~ /^(.*\/)?FEX(Interpreter)?$/) && ($3 ~ /steamrt64\/steam$/ || $3 ~ /steamwebhelper$/) {print $1} $2 ~ /steamrtarm64\/steamwebhelper$/ {print $1}'); do
|
||||
taskset -a -p -c "$BL_CLIENT_CPUS" "$pid" >/dev/null 2>&1
|
||||
taskset -a -p -c "$DD_CLIENT_CPUS" "$pid" >/dev/null 2>&1
|
||||
done
|
||||
done
|
||||
) &
|
||||
@@ -1031,7 +1031,7 @@ for attempt in 1 2 3 4 5; do
|
||||
echo "$X64_CHANNEL" > "$STEAM_X64/package/beta"
|
||||
step "starting the x86-64 SteamRT3 client under FEX (attempt $attempt): $*"
|
||||
rc=0
|
||||
if [ "${BL_X64_X86_WEBHELPER:-0}" != 1 ] || x64_webhelper_gpu; then cef=(-cef-force-gpu -cef-ozone-platform=x11 -cef-use-gl=angle -cef-use-angle=vulkan); else cef=(-cef-disable-gpu); fi
|
||||
if [ "${DD_X64_X86_WEBHELPER:-0}" != 1 ] || x64_webhelper_gpu; then cef=(-cef-force-gpu -cef-ozone-platform=x11 -cef-use-gl=angle -cef-use-angle=vulkan); else cef=(-cef-disable-gpu); fi
|
||||
( x64_exec -clientbeta "$X64_CHANNEL" -no-cef-sandbox "${cef[@]}" "$@" ) >>"$LOG" 2>&1 || rc=$?
|
||||
step "client exited rc=$rc"
|
||||
[ "$rc" = 42 ] || break
|
||||
|
||||
@@ -193,7 +193,7 @@ def server_socket(pfx):
|
||||
st = os.stat(pfx)
|
||||
except OSError:
|
||||
return None
|
||||
base = os.environ.get("BL_WINE_SERVER_BASE") or "/tmp/.wine-%d" % os.getuid()
|
||||
base = os.environ.get("DD_WINE_SERVER_BASE") or "/tmp/.wine-%d" % os.getuid()
|
||||
return Path(base) / ("server-%x-%x" % (st.st_dev, st.st_ino)) / "socket"
|
||||
|
||||
|
||||
@@ -265,7 +265,7 @@ BATTLENET_LAUNCH = re.compile(r'(?i)^--exec=\s*"?launch\s+([A-Za-z0-9_]{1,16})"?
|
||||
|
||||
|
||||
def battlenet(argv, env=os.environ):
|
||||
if env.get("BL_BATTLENET"):
|
||||
if env.get("DD_BATTLENET"):
|
||||
return None
|
||||
exe, code = False, None
|
||||
for raw in argv:
|
||||
@@ -286,7 +286,7 @@ def cloud_on(sidecar):
|
||||
|
||||
def exited(argv, code=0):
|
||||
found = find_store_game(argv)
|
||||
launch_dir = os.environ.get("BL_LAUNCH_DIR", "")
|
||||
launch_dir = os.environ.get("DD_LAUNCH_DIR", "")
|
||||
if found is not None and launch_dir and str(found[1].get("store")) == "rockstar":
|
||||
ask(Path(launch_dir) / "stores", {"op": "rockstar-exited", "store": "rockstar", "id": str(found[1].get("id"))}, timeout=1.0)
|
||||
compat_data = os.environ.get("STEAM_COMPAT_DATA_PATH")
|
||||
@@ -825,7 +825,7 @@ def provision_galaxy(compat_data, proton, timeout=90):
|
||||
':existing', 'echo ready>"%s"' % answer, 'exit /b 0']
|
||||
bat.write_bytes(("\r\n".join(lines) + "\r\n").encode())
|
||||
env = os.environ.copy()
|
||||
env["BL_COMET_BOOTSTRAP"] = "1"
|
||||
env["DD_COMET_BOOTSTRAP"] = "1"
|
||||
run = subprocess.run([proton, "run", "cmd.exe", "/d", "/c", windows_path(str(bat))],
|
||||
env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=timeout)
|
||||
if run.returncode or not result.is_file() or result.read_text().strip() != "ready":
|
||||
@@ -846,7 +846,7 @@ def prepare_gog(sidecar, compat_data, launch_dir):
|
||||
if not isinstance(answer, dict) or not answer.get("ready"):
|
||||
log("gog achievements: " + (str(answer.get("reason", "unavailable")) if isinstance(answer, dict) else "timeout"))
|
||||
return False
|
||||
state = provision_galaxy(compat_data, os.environ.get("BL_STORE_PROTON", ""))
|
||||
state = provision_galaxy(compat_data, os.environ.get("DD_STORE_PROTON", ""))
|
||||
log("gog achievements prefix: " + state)
|
||||
return state == "ready"
|
||||
|
||||
@@ -1432,7 +1432,7 @@ def write_licenses(compat_data, licenses):
|
||||
|
||||
def prepare_ea(folder, sidecar, compat_data, launch_dir):
|
||||
game = str(sidecar.get("id"))
|
||||
proton = os.environ.get("BL_STORE_PROTON", "")
|
||||
proton = os.environ.get("DD_STORE_PROTON", "")
|
||||
made = create_prefix(compat_data, proton)
|
||||
ready = made in ("present", "created") or (compat_data and (Path(compat_data) / "pfx/user.reg").is_file())
|
||||
stub = install_origin_stub(compat_data) if ready else "no-prefix"
|
||||
@@ -1600,22 +1600,22 @@ def main(argv):
|
||||
return RAN_FAILED
|
||||
compat_data = os.environ.get("STEAM_COMPAT_DATA_PATH", "").rstrip("/")
|
||||
prefix_id = os.path.basename(compat_data) if compat_data else ""
|
||||
launch_dir = os.environ.get("BL_LAUNCH_DIR", "")
|
||||
launch_dir = os.environ.get("DD_LAUNCH_DIR", "")
|
||||
if launch_dir and cloud_on(sidecar):
|
||||
made = create_prefix(compat_data, os.environ.get("BL_STORE_PROTON", ""))
|
||||
made = create_prefix(compat_data, os.environ.get("DD_STORE_PROTON", ""))
|
||||
if made != "present":
|
||||
log("cloud %s %s prefix=%s" % (store, game, made))
|
||||
if store == "gog":
|
||||
prepare_gog(sidecar, compat_data, launch_dir)
|
||||
log("gog registry: " + apply_gog_registry(folder, compat_data, os.environ.get("BL_STORE_PROTON", "")))
|
||||
log("gog support data: " + gog_support_data(folder, compat_data, os.environ.get("BL_STORE_PROTON", "")))
|
||||
log("gog registry: " + apply_gog_registry(folder, compat_data, os.environ.get("DD_STORE_PROTON", "")))
|
||||
log("gog support data: " + gog_support_data(folder, compat_data, os.environ.get("DD_STORE_PROTON", "")))
|
||||
if store == "rockstar":
|
||||
if game not in ROCKSTAR_TITLES and not rockstar_sdk(folder, sidecar):
|
||||
if compat_data:
|
||||
(Path(compat_data) / "pfx" / ROCKSTAR_FOLDER / "launch.json").unlink(missing_ok=True)
|
||||
return STORE_GAME
|
||||
try:
|
||||
state = prepare_rockstar(folder, sidecar, compat_data, launch_dir, os.environ.get("BL_STORE_PROTON", ""))
|
||||
state = prepare_rockstar(folder, sidecar, compat_data, launch_dir, os.environ.get("DD_STORE_PROTON", ""))
|
||||
except (OSError, ValueError, subprocess.TimeoutExpired):
|
||||
state = "preparation-failed"
|
||||
log("rockstar %s: %s" % (game, state))
|
||||
@@ -1624,7 +1624,7 @@ def main(argv):
|
||||
return STORE_GAME if state == "ready" else RAN_FAILED
|
||||
if store == "ubisoft":
|
||||
try:
|
||||
log("ubisoft %s: %s" % (game, prepare_ubisoft(folder, sidecar, compat_data, launch_dir, os.environ.get("BL_STORE_PROTON", ""))))
|
||||
log("ubisoft %s: %s" % (game, prepare_ubisoft(folder, sidecar, compat_data, launch_dir, os.environ.get("DD_STORE_PROTON", ""))))
|
||||
except OSError as e:
|
||||
try:
|
||||
(folder / UBISOFT_LAUNCH).unlink()
|
||||
|
||||
@@ -9,7 +9,7 @@ for v in $(compgen -e); do
|
||||
case $v in FEX_*) unset "$v" ;; esac
|
||||
done
|
||||
unset LD_LIBRARY_PATH LD_PRELOAD STEAM_RUNTIME_STEAMRT STEAM_STEAMRT_RECURSION_GUARD \
|
||||
LIBGL_ALWAYS_SOFTWARE LIBGL_DRI3_DISABLE GALLIUM_DRIVER BL_WEBHELPER_HIDE_TRACER PROOT_FP_OFF
|
||||
LIBGL_ALWAYS_SOFTWARE LIBGL_DRI3_DISABLE GALLIUM_DRIVER DD_WEBHELPER_HIDE_TRACER PROOT_FP_OFF
|
||||
|
||||
game_display=${DISPLAY:-}
|
||||
if [ -f "$x64_home/arm-session.env" ]; then
|
||||
@@ -18,7 +18,7 @@ else
|
||||
export HOME=/root
|
||||
fi
|
||||
[ -z "$game_display" ] || export DISPLAY=$game_display
|
||||
export BL_X64_STEAM_ROOT=${STEAM_COMPAT_CLIENT_INSTALL_PATH:-}
|
||||
export DD_X64_STEAM_ROOT=${STEAM_COMPAT_CLIENT_INSTALL_PATH:-}
|
||||
export STEAM_COMPAT_CLIENT_INSTALL_PATH=$HOME/.local/share/Steam
|
||||
arm_overlay=$STEAM_COMPAT_CLIENT_INSTALL_PATH/steamrtarm64/gameoverlayrenderer.so
|
||||
if [ "$overlay" = 1 ] && [ -f "$arm_overlay" ]; then
|
||||
|
||||
@@ -5,7 +5,7 @@ arm=/root/.local/share/Steam/steamrtarm64
|
||||
for v in $(compgen -e); do
|
||||
case $v in FEX_*) unset "$v" ;; esac
|
||||
done
|
||||
unset LD_PRELOAD LIBGL_ALWAYS_SOFTWARE LIBGL_DRI3_DISABLE BL_WEBHELPER_HIDE_TRACER BL_X64_ARM_WEBHELPER
|
||||
unset LD_PRELOAD LIBGL_ALWAYS_SOFTWARE LIBGL_DRI3_DISABLE DD_WEBHELPER_HIDE_TRACER DD_X64_ARM_WEBHELPER
|
||||
if [ -f "$x64_home/arm-session.env" ]; then
|
||||
eval "$(grep -E '^declare -x (VK_ICD_FILENAMES|VK_DRIVER_FILES|GALLIUM_DRIVER|MESA_LOADER_DRIVER_OVERRIDE|LIBGL_KOPPER_DRI2|TU_DEBUG|ZINK_DEBUG|ZINK_DESCRIPTORS|MESA_NO_ERROR|MESA_DISK_CACHE_DATABASE)=' "$x64_home/arm-session.env")"
|
||||
fi
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
unset BL_X64_ARM_WEBHELPER
|
||||
export BL_WEBHELPER_ARGS=stock DISABLE_GAMESCOPE_WSI=1 vk_xwayland_wait_ready=true LIBGL_KOPPER_DISABLE=true
|
||||
unset DD_X64_ARM_WEBHELPER
|
||||
export DD_WEBHELPER_ARGS=stock DISABLE_GAMESCOPE_WSI=1 vk_xwayland_wait_ready=true LIBGL_KOPPER_DISABLE=true
|
||||
if [ -x ./steamwebhelper ]; then
|
||||
exec ./steamwebhelper "$@"
|
||||
fi
|
||||
|
||||
@@ -385,7 +385,7 @@ def launch(command, env):
|
||||
for name in DLLS:
|
||||
if not (RUNTIME / 'windows' / name).is_file():
|
||||
raise RuntimeError('Xbox Windows runtime is missing; update the Linux runtime')
|
||||
launch_dir = env.get('BL_LAUNCH_DIR')
|
||||
launch_dir = env.get('DD_LAUNCH_DIR')
|
||||
if not launch_dir:
|
||||
raise RuntimeError('No Xbox account channel; start the game from DroidDeck')
|
||||
reply = store['ask'](Path(launch_dir) / 'stores', {'op': 'xbox-prepare', 'id': sidecar['id']}, timeout=190)
|
||||
|
||||
@@ -59,73 +59,73 @@ TOOL_MANIFEST_VDF = """"manifest"
|
||||
""" % LAUNCHER
|
||||
|
||||
|
||||
BL_STORE_SETUP = """
|
||||
bl_store_launch() {
|
||||
DD_STORE_SETUP = """
|
||||
dd_store_launch() {
|
||||
[ "${verb:-}" = waitforexitandrun ] || return 0
|
||||
if [ -x /usr/local/bin/droiddeck-open-url ]; then
|
||||
mkdir -p /tmp/droiddeck-browser
|
||||
ln -sfn /usr/local/bin/droiddeck-open-url /tmp/droiddeck-browser/xdg-open
|
||||
[ -n "${BL_LAUNCH_DIR:-}" ] && printf '%s
|
||||
' "$BL_LAUNCH_DIR" > /tmp/droiddeck-browser/launch-dir
|
||||
[ -n "${DD_LAUNCH_DIR:-}" ] && printf '%s
|
||||
' "$DD_LAUNCH_DIR" > /tmp/droiddeck-browser/launch-dir
|
||||
PATH="/tmp/droiddeck-browser:$PATH"; export PATH
|
||||
fi
|
||||
if [ "${BL_DEBUG_BROWSER:-}" = 1 ]; then
|
||||
if [ "${DD_DEBUG_BROWSER:-}" = 1 ]; then
|
||||
WINEDEBUG="${WINEDEBUG:+$WINEDEBUG,}+shell,+winebrowser"; export WINEDEBUG
|
||||
fi
|
||||
[ -x /usr/local/bin/droiddeck-store-launch ] || return 0
|
||||
/usr/local/bin/droiddeck-store-launch "$@"
|
||||
rc=$?
|
||||
[ $rc -eq 10 ] && BL_STORE_EXIT=1
|
||||
[ $rc -eq 10 ] && DD_STORE_EXIT=1
|
||||
[ $rc -eq 11 ] && exit 0
|
||||
[ $rc -eq 12 ] && exit 1
|
||||
return 0
|
||||
}
|
||||
|
||||
bl_run() {
|
||||
dd_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
|
||||
if [ -n "${DD_STORE_EXIT:-}" ]; then
|
||||
trap : INT TERM HUP
|
||||
"$@"
|
||||
rc=$?
|
||||
/usr/local/bin/droiddeck-store-launch --exited --code "$rc" "${BL_STORE_ARGS[@]}" || true
|
||||
/usr/local/bin/droiddeck-store-launch --exited --code "$rc" "${DD_STORE_ARGS[@]}" || true
|
||||
exit $rc
|
||||
fi
|
||||
exec "$@"
|
||||
}
|
||||
"""
|
||||
|
||||
BL_DESKTOP_GPU_SETUP = """
|
||||
bl_desktop_gpu() {
|
||||
DD_DESKTOP_GPU_SETUP = """
|
||||
dd_desktop_gpu() {
|
||||
local name saved gpu=/usr/local/bin/droiddeck-gpu
|
||||
local names=(LD_PRELOAD LD_LIBRARY_PATH ENABLE_VK_LAYER_VALVE_steam_overlay_1 ENABLE_VK_LAYER_VALVE_steam_fossilize_1)
|
||||
if [ -n "${BL_DESKTOP_GPU_CHILD:-}" ]; then
|
||||
if [ -n "${DD_DESKTOP_GPU_CHILD:-}" ]; then
|
||||
for name in "${names[@]}"; do
|
||||
saved=BL_GPU_SAVED_$name
|
||||
saved=DD_GPU_SAVED_$name
|
||||
[ -n "${!saved+x}" ] || continue
|
||||
export "$name=${!saved}"
|
||||
unset "$saved"
|
||||
done
|
||||
return 0
|
||||
fi
|
||||
[ "${BL_DESKTOP:-}" = 1 ] && [ "${verb:-}" = waitforexitandrun ] && [ -x "$gpu" ] || return 0
|
||||
local choice=${BL_DESKTOP_GPU:-on}
|
||||
[ "${DD_DESKTOP:-}" = 1 ] && [ "${verb:-}" = waitforexitandrun ] && [ -x "$gpu" ] || return 0
|
||||
local choice=${DD_DESKTOP_GPU:-on}
|
||||
case "${choice,,}" in off | 0 | no | false) return 0 ;; esac
|
||||
case " $* " in *iscriptevaluator*) return 0 ;; esac
|
||||
local clear=()
|
||||
for name in "${names[@]}"; do
|
||||
[ -n "${!name+x}" ] || continue
|
||||
export "BL_GPU_SAVED_$name=${!name}"
|
||||
export "DD_GPU_SAVED_$name=${!name}"
|
||||
clear+=(-u "$name")
|
||||
done
|
||||
echo "droiddeck-gpu: the desktop starts this game on the GPU" >&2
|
||||
exec env "${clear[@]}" "$gpu" "$0" "$verb" "$@"
|
||||
}
|
||||
bl_desktop_gpu "$@"
|
||||
dd_desktop_gpu "$@"
|
||||
"""
|
||||
BL_COMPONENTS_SETUP = """
|
||||
bl_components() {
|
||||
DD_COMPONENTS_SETUP = """
|
||||
dd_components() {
|
||||
base=$1
|
||||
cm_dir="${HOME:-/root}/.local/share/droiddeck-components"
|
||||
cm_list="$cm_dir/desired.tsv"
|
||||
@@ -207,7 +207,7 @@ bl_components() {
|
||||
continue
|
||||
fi
|
||||
mkdir -p "$(dirname "$f")"
|
||||
cp -f "$src" "$f.bl-new" && mv -f "$f.bl-new" "$f" || continue
|
||||
cp -f "$src" "$f.dd-new" && mv -f "$f.dd-new" "$f" || continue
|
||||
case "$rel" in *.so) chmod 755 "$f" ;; *) chmod 644 "$f" ;; esac
|
||||
cm_fixed=$((cm_fixed + 1))
|
||||
done
|
||||
@@ -219,17 +219,17 @@ bl_components() {
|
||||
}
|
||||
"""
|
||||
|
||||
BL_GAME_CPUS_SETUP = """
|
||||
bl_game_cpus() {
|
||||
[ -n "${BL_GAME_CPUS:-}" ] || return 0
|
||||
DD_GAME_CPUS_SETUP = """
|
||||
dd_game_cpus() {
|
||||
[ -n "${DD_GAME_CPUS:-}" ] || return 0
|
||||
command -v taskset >/dev/null 2>&1 || return 0
|
||||
BL_TASKSET="taskset -c $BL_GAME_CPUS"
|
||||
echo "droiddeck-proton: game cores $BL_GAME_CPUS" >&2
|
||||
DD_TASKSET="taskset -c $DD_GAME_CPUS"
|
||||
echo "droiddeck-proton: game cores $DD_GAME_CPUS" >&2
|
||||
}
|
||||
"""
|
||||
|
||||
BL_LIBPATH_SETUP = """
|
||||
bl_libpath() {
|
||||
DD_LIBPATH_SETUP = """
|
||||
dd_libpath() {
|
||||
export PROTON_USE_PIPEWIRE=${PROTON_USE_PIPEWIRE:-0}
|
||||
[ -n "${LD_LIBRARY_PATH:-}" ] || return 0
|
||||
local kept= dir old_ifs=$IFS
|
||||
@@ -245,9 +245,9 @@ bl_libpath() {
|
||||
}
|
||||
"""
|
||||
|
||||
BL_IDTECH3_SETUP = """
|
||||
bl_idtech3() {
|
||||
BL_EXTRA_ARGS=()
|
||||
DD_IDTECH3_SETUP = """
|
||||
dd_idtech3() {
|
||||
DD_EXTRA_ARGS=()
|
||||
case "${SteamAppId:-${STEAM_COMPAT_APP_ID:-}}" in
|
||||
2200|2350|9010|6020) ;;
|
||||
*) return 0 ;;
|
||||
@@ -257,15 +257,15 @@ bl_idtech3() {
|
||||
echo "droiddeck-proton: Quake-engine title; its launch options set the video mode, left as they are" >&2
|
||||
return 0 ;;
|
||||
esac
|
||||
w=${BL_WIDTH:-1280}
|
||||
h=${BL_HEIGHT:-720}
|
||||
BL_EXTRA_ARGS=(+set r_fullscreen 0 +set r_mode -1 +set r_customwidth "$w" +set r_customheight "$h")
|
||||
w=${DD_WIDTH:-1280}
|
||||
h=${DD_HEIGHT:-720}
|
||||
DD_EXTRA_ARGS=(+set r_fullscreen 0 +set r_mode -1 +set r_customwidth "$w" +set r_customheight "$h")
|
||||
echo "droiddeck-proton: Quake-engine title: windowed at ${w}x${h}" >&2
|
||||
}
|
||||
"""
|
||||
|
||||
BL_VACDIAG_SETUP = """
|
||||
bl_vacdiag() {
|
||||
DD_VACDIAG_SETUP = """
|
||||
dd_vacdiag() {
|
||||
[ -f /root/.droiddeck-vac-diagnostics ] || return 0
|
||||
[ "${verb:-}" = waitforexitandrun ] || return 0
|
||||
local exe= a dir added=no app=${SteamAppId:-${STEAM_COMPAT_APP_ID:-0}}
|
||||
@@ -276,7 +276,7 @@ bl_vacdiag() {
|
||||
if ls "$dir"/*/gameinfo.txt >/dev/null 2>&1 || ls "$dir"/../../*/gameinfo.gi >/dev/null 2>&1; then
|
||||
case " $* " in
|
||||
*" -condebug "*) echo "droiddeck-proton: vac-diag: app $app already has -condebug" >&2 ;;
|
||||
*) BL_EXTRA_ARGS+=(-condebug); added=yes
|
||||
*) DD_EXTRA_ARGS+=(-condebug); added=yes
|
||||
echo "droiddeck-proton: vac-diag: app $app is a Source title; launched with -condebug" >&2 ;;
|
||||
esac
|
||||
else
|
||||
@@ -290,7 +290,7 @@ bl_vacdiag() {
|
||||
}
|
||||
"""
|
||||
|
||||
BL_DRIVER_QUERY_SKIP = """
|
||||
DD_DRIVER_QUERY_SKIP = """
|
||||
case "$verb:${1##*/}:${STEAM_COMPAT_DATA_PATH%/}" in
|
||||
run:d3ddriverquery64.exe:*/compatdata/0 | run:d3ddriverquery.exe:*/compatdata/0)
|
||||
echo "droiddeck-proton: Steam's D3D driver query is not run (it fails here and would start Wine in compatdata/0)" >&2
|
||||
@@ -298,23 +298,23 @@ case "$verb:${1##*/}:${STEAM_COMPAT_DATA_PATH%/}" in
|
||||
esac
|
||||
"""
|
||||
|
||||
BL_DIRECTAUDIO_SETUP = """
|
||||
bl_is_steam_installscript_target() {
|
||||
DD_DIRECTAUDIO_SETUP = """
|
||||
dd_is_steam_installscript_target() {
|
||||
local target=${1:-}
|
||||
local steam_root=${STEAM_COMPAT_CLIENT_INSTALL_PATH:-${XDG_DATA_HOME:-$HOME/.local/share}/Steam}
|
||||
local helper="$steam_root/legacycompat/iscriptevaluator.exe"
|
||||
[ -f "$helper" ] && [[ -n "$target" && "$target" -ef "$helper" ]]
|
||||
}
|
||||
|
||||
bl_directaudio() {
|
||||
dd_directaudio() {
|
||||
case "${verb:-}" in
|
||||
run|waitforexitandrun|runinprefix) ;;
|
||||
*) return 0 ;;
|
||||
esac
|
||||
base=$1
|
||||
[ -n "${BL_DIRECTAUDIO:-}" ] || return 0
|
||||
[ -d "$BL_DIRECTAUDIO" ] || return 0
|
||||
if bl_is_steam_installscript_target "${2:-}"; then
|
||||
[ -n "${DD_DIRECTAUDIO:-}" ] || return 0
|
||||
[ -d "$DD_DIRECTAUDIO" ] || return 0
|
||||
if dd_is_steam_installscript_target "${2:-}"; then
|
||||
echo "droiddeck-proton: DirectAudio skipped for Steam's install-script evaluator" >&2
|
||||
return 0
|
||||
fi
|
||||
@@ -338,7 +338,7 @@ bl_directaudio() {
|
||||
return 0
|
||||
fi
|
||||
if grep -aq PsCreateSystemThread "$winepulse"; then set=linux-wine11-systhread; else set=linux-wine11; fi
|
||||
da="$BL_DIRECTAUDIO/$set"
|
||||
da="$DD_DIRECTAUDIO/$set"
|
||||
if [ ! -d "$da/lib/wine" ]; then
|
||||
echo "droiddeck-proton: DirectAudio left off - no driver set for the $set interface is staged" >&2
|
||||
return 0
|
||||
@@ -359,16 +359,16 @@ bl_directaudio() {
|
||||
dir="$pfx/drive_c/windows/${pair%%:*}"
|
||||
src="$da/lib/wine/${pair#*:}/winedirectaudio.drv"
|
||||
if [ -d "$dir" ] && [ -f "$src" ] && [ "$(readlink "$dir/winedirectaudio.drv" 2>/dev/null)" != "$src" ]; then
|
||||
ln -sfn "$src" "$dir/winedirectaudio.drv.bl-new" && mv -f "$dir/winedirectaudio.drv.bl-new" "$dir/winedirectaudio.drv"
|
||||
ln -sfn "$src" "$dir/winedirectaudio.drv.dd-new" && mv -f "$dir/winedirectaudio.drv.dd-new" "$dir/winedirectaudio.drv"
|
||||
fi
|
||||
done
|
||||
key='[Software\\\\Wine\\\\Drivers]'
|
||||
if [ "$(readlink "$pfx/drive_c/windows/system32/winedirectaudio.drv" 2>/dev/null)" != "$da/lib/wine/aarch64-windows/winedirectaudio.drv" ]; then
|
||||
echo "droiddeck-proton: DirectAudio could not be placed in the prefix; Proton's own audio stays" >&2
|
||||
elif ! BL_KEY="$key" awk 'index($0, "[") == 1 { inside = index($0, ENVIRON["BL_KEY"] " ") == 1 } inside && index($0, "\\"Audio\\"=") == 1 { last = $0 } END { exit last != "\\"Audio\\"=\\"directaudio,pulse\\"" }' "$reg" 2>/dev/null; then
|
||||
elif ! DD_KEY="$key" awk 'index($0, "[") == 1 { inside = index($0, ENVIRON["DD_KEY"] " ") == 1 } inside && index($0, "\\"Audio\\"=") == 1 { last = $0 } END { exit last != "\\"Audio\\"=\\"directaudio,pulse\\"" }' "$reg" 2>/dev/null; then
|
||||
printf '\\n%s %s\\n"Audio"="directaudio,pulse"\\n' "$key" "$(date +%s)" >> "$reg"
|
||||
echo "droiddeck-proton: DirectAudio selected in the prefix" >&2
|
||||
srv="${BL_WINE_SERVER_BASE:-/tmp/.wine-$(id -u)}/server-$(printf '%x-%x' $(stat -c '%d %i' "$pfx" 2>/dev/null || echo 0 0))/socket"
|
||||
srv="${DD_WINE_SERVER_BASE:-/tmp/.wine-$(id -u)}/server-$(printf '%x-%x' $(stat -c '%d %i' "$pfx" 2>/dev/null || echo 0 0))/socket"
|
||||
if [ -S "$srv" ]; then
|
||||
echo "droiddeck-proton: a wineserver is already running for this prefix; DirectAudio may only engage on the next launch" >&2
|
||||
fi
|
||||
@@ -383,7 +383,7 @@ bl_directaudio() {
|
||||
LAUNCHER_SH = """#!/bin/bash
|
||||
verb=$1; shift
|
||||
steam_root=${STEAM_COMPAT_CLIENT_INSTALL_PATH:-${XDG_DATA_HOME:-$HOME/.local/share}/Steam}
|
||||
for fake in /usr/local/lib/libfakeinput.so /usr/local/lib/libblsession.so; do
|
||||
for fake in /usr/local/lib/libfakeinput.so /usr/local/lib/libddsession.so; do
|
||||
if [ -f "$fake" ]; then
|
||||
case ":${LD_PRELOAD:-}:" in
|
||||
*":$fake:"*) ;;
|
||||
@@ -391,7 +391,7 @@ for fake in /usr/local/lib/libfakeinput.so /usr/local/lib/libblsession.so; do
|
||||
esac
|
||||
fi
|
||||
done
|
||||
audit=/usr/local/lib/libblaudit.so
|
||||
audit=/usr/local/lib/libddaudit.so
|
||||
if [ -n "${PROOT_FP_KEY:-}" ] && [ -f "$audit" ]; then
|
||||
case ":${LD_AUDIT:-}:" in
|
||||
*":$audit:"*) ;;
|
||||
@@ -416,16 +416,16 @@ for name in %s; do
|
||||
[ -n "$depot" ] && break
|
||||
done
|
||||
if [ -n "$depot" ]; then
|
||||
bl_components "$depot"
|
||||
bl_directaudio "$depot" "$@"
|
||||
bl_game_cpus
|
||||
bl_idtech3 "$@"
|
||||
bl_vacdiag "$@"
|
||||
bl_libpath
|
||||
BL_STORE_PROTON="$depot/proton"; export BL_STORE_PROTON
|
||||
bl_store_launch "$@"
|
||||
BL_STORE_ARGS=("$@")
|
||||
bl_run ${BL_TASKSET:-} /usr/local/bin/droiddeck-game-env "$depot/proton" "$verb" "$@" "${BL_EXTRA_ARGS[@]}"
|
||||
dd_components "$depot"
|
||||
dd_directaudio "$depot" "$@"
|
||||
dd_game_cpus
|
||||
dd_idtech3 "$@"
|
||||
dd_vacdiag "$@"
|
||||
dd_libpath
|
||||
DD_STORE_PROTON="$depot/proton"; export DD_STORE_PROTON
|
||||
dd_store_launch "$@"
|
||||
DD_STORE_ARGS=("$@")
|
||||
dd_run ${DD_TASKSET:-} /usr/local/bin/droiddeck-game-env "$depot/proton" "$verb" "$@" "${DD_EXTRA_ARGS[@]}"
|
||||
fi
|
||||
echo "droiddeck-proton: no ARM64 Proton depot yet - the client downloads one as this tool's dependency; retry the launch once it has" >&2
|
||||
exit 1
|
||||
@@ -435,8 +435,8 @@ LAUNCHER_TEMPLATE = LAUNCHER_SH
|
||||
|
||||
def launcher_sh(sources=SOURCES):
|
||||
return (LAUNCHER_TEMPLATE % " ".join('"%s"' % n for n in sources)).replace(
|
||||
"verb=$1; shift", "verb=$1; shift\n" + BL_DRIVER_QUERY_SKIP + BL_DESKTOP_GPU_SETUP + BL_DIRECTAUDIO_SETUP + BL_GAME_CPUS_SETUP + BL_IDTECH3_SETUP
|
||||
+ BL_VACDIAG_SETUP + BL_COMPONENTS_SETUP + BL_LIBPATH_SETUP + BL_STORE_SETUP, 1)
|
||||
"verb=$1; shift", "verb=$1; shift\n" + DD_DRIVER_QUERY_SKIP + DD_DESKTOP_GPU_SETUP + DD_DIRECTAUDIO_SETUP + DD_GAME_CPUS_SETUP + DD_IDTECH3_SETUP
|
||||
+ DD_VACDIAG_SETUP + DD_COMPONENTS_SETUP + DD_LIBPATH_SETUP + DD_STORE_SETUP, 1)
|
||||
|
||||
|
||||
LAUNCHER_SH = launcher_sh()
|
||||
@@ -456,7 +456,7 @@ EXTRA_MANIFEST_VDF = """"manifest"
|
||||
EXTRA_WRAPPER_SH = """#!/bin/bash
|
||||
verb=$1; shift
|
||||
here=$(dirname "$0")
|
||||
for fake in /usr/local/lib/libfakeinput.so /usr/local/lib/libblsession.so; do
|
||||
for fake in /usr/local/lib/libfakeinput.so /usr/local/lib/libddsession.so; do
|
||||
if [ -f "$fake" ]; then
|
||||
case ":${LD_PRELOAD:-}:" in
|
||||
*":$fake:"*) ;;
|
||||
@@ -464,31 +464,31 @@ for fake in /usr/local/lib/libfakeinput.so /usr/local/lib/libblsession.so; do
|
||||
esac
|
||||
fi
|
||||
done
|
||||
audit=/usr/local/lib/libblaudit.so
|
||||
audit=/usr/local/lib/libddaudit.so
|
||||
if [ -n "${PROOT_FP_KEY:-}" ] && [ -f "$audit" ]; then
|
||||
case ":${LD_AUDIT:-}:" in
|
||||
*":$audit:"*) ;;
|
||||
*) LD_AUDIT="$audit${LD_AUDIT:+:$LD_AUDIT}"; export LD_AUDIT ;;
|
||||
esac
|
||||
fi
|
||||
bl_components "$here"
|
||||
bl_directaudio "$here" "$@"
|
||||
bl_game_cpus
|
||||
bl_idtech3 "$@"
|
||||
bl_vacdiag "$@"
|
||||
bl_libpath
|
||||
BL_STORE_PROTON="$here/%s"; export BL_STORE_PROTON
|
||||
bl_store_launch "$@"
|
||||
BL_STORE_ARGS=("$@")
|
||||
bl_run ${BL_TASKSET:-} /usr/local/bin/droiddeck-game-env "$BL_STORE_PROTON" "$verb" "$@" "${BL_EXTRA_ARGS[@]}"
|
||||
dd_components "$here"
|
||||
dd_directaudio "$here" "$@"
|
||||
dd_game_cpus
|
||||
dd_idtech3 "$@"
|
||||
dd_vacdiag "$@"
|
||||
dd_libpath
|
||||
DD_STORE_PROTON="$here/%s"; export DD_STORE_PROTON
|
||||
dd_store_launch "$@"
|
||||
DD_STORE_ARGS=("$@")
|
||||
dd_run ${DD_TASKSET:-} /usr/local/bin/droiddeck-game-env "$DD_STORE_PROTON" "$verb" "$@" "${DD_EXTRA_ARGS[@]}"
|
||||
"""
|
||||
|
||||
|
||||
def extra_wrapper_sh(entry_point):
|
||||
return (EXTRA_WRAPPER_SH % entry_point).replace(
|
||||
'here=$(dirname "$0")',
|
||||
'here=$(dirname "$0")\n' + BL_DRIVER_QUERY_SKIP + BL_DESKTOP_GPU_SETUP + BL_DIRECTAUDIO_SETUP + BL_GAME_CPUS_SETUP
|
||||
+ BL_IDTECH3_SETUP + BL_VACDIAG_SETUP + BL_COMPONENTS_SETUP + BL_LIBPATH_SETUP + BL_STORE_SETUP, 1)
|
||||
'here=$(dirname "$0")\n' + DD_DRIVER_QUERY_SKIP + DD_DESKTOP_GPU_SETUP + DD_DIRECTAUDIO_SETUP + DD_GAME_CPUS_SETUP
|
||||
+ DD_IDTECH3_SETUP + DD_VACDIAG_SETUP + DD_COMPONENTS_SETUP + DD_LIBPATH_SETUP + DD_STORE_SETUP, 1)
|
||||
|
||||
|
||||
EXTRA_COMPAT_TOOL_VDF = """"compatibilitytools"
|
||||
@@ -533,12 +533,12 @@ verb=$1; shift
|
||||
case $verb in
|
||||
getcompatpath | getnativepath) printf '%s\\n' "$1"; exit 0 ;;
|
||||
esac
|
||||
""" + BL_DESKTOP_GPU_SETUP + BL_GAME_CPUS_SETUP + """
|
||||
bl_game_cpus
|
||||
""" + DD_DESKTOP_GPU_SETUP + DD_GAME_CPUS_SETUP + """
|
||||
dd_game_cpus
|
||||
if [ -x /usr/local/bin/droiddeck-steamvr-flat ] && /usr/local/bin/droiddeck-steamvr-flat "$verb"; then
|
||||
exec /usr/local/bin/droiddeck-steamvr-game ${BL_TASKSET:-} /usr/local/bin/droiddeck-fex steam "$verb" "$@"
|
||||
exec /usr/local/bin/droiddeck-steamvr-game ${DD_TASKSET:-} /usr/local/bin/droiddeck-fex steam "$verb" "$@"
|
||||
fi
|
||||
exec ${BL_TASKSET:-} /usr/local/bin/droiddeck-fex steam "$verb" "$@"
|
||||
exec ${DD_TASKSET:-} /usr/local/bin/droiddeck-fex steam "$verb" "$@"
|
||||
"""
|
||||
|
||||
|
||||
@@ -1701,7 +1701,7 @@ def x64_repoint(steam_root, tool, live=False):
|
||||
write_changed(config, text)
|
||||
print("steam-compatibility: x86-64 client's Proton entries point at %s" % tool)
|
||||
if moved and live:
|
||||
with open(os.path.join(os.path.expanduser("~"), ".bl-compat-pending"), "a") as f:
|
||||
with open(os.path.join(os.path.expanduser("~"), ".dd-compat-pending"), "a") as f:
|
||||
f.write("".join("%s\n" % a for a in moved))
|
||||
print("steam-compatibility: repointed while the client runs: %s" % " ".join(moved))
|
||||
return moved
|
||||
@@ -1710,7 +1710,7 @@ def x64_repoint(steam_root, tool, live=False):
|
||||
def main():
|
||||
steam_root = sys.argv[1]
|
||||
if "--x64" in sys.argv[2:]:
|
||||
x64_repoint(steam_root, os.environ.get("BL_COMPAT_TOOL"), "--live" in sys.argv[2:])
|
||||
x64_repoint(steam_root, os.environ.get("DD_COMPAT_TOOL"), "--live" in sys.argv[2:])
|
||||
return
|
||||
tools = os.path.join(steam_root, "compatibilitytools.d")
|
||||
os.makedirs(tools, exist_ok=True)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
typedef int (*spawn_fn)(pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *,
|
||||
char *const[], char *const[]);
|
||||
__attribute__((visibility("hidden")))
|
||||
char *const *bl_webhelper_argv(const char *path, char *const argv[], char *const envp[]);
|
||||
char *const *dd_webhelper_argv(const char *path, char *const argv[], char *const envp[]);
|
||||
|
||||
#if defined(__aarch64__) || defined(BINFMT_TEST)
|
||||
|
||||
@@ -29,7 +29,7 @@ static int flag(const char *name) {
|
||||
}
|
||||
|
||||
static int handing_off(void) {
|
||||
return flag("BL_DESKTOP") || flag("BL_BINFMT");
|
||||
return flag("DD_DESKTOP") || flag("DD_BINFMT");
|
||||
}
|
||||
|
||||
static int foreign(const char *path, int error) {
|
||||
@@ -105,36 +105,36 @@ static int spawn_handler(pid_t *pid, const char *path, const posix_spawn_file_ac
|
||||
return real(pid, BINFMT_HANDLER, fa, attr, args, envp);
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) void bl_binfmt_before(const char *path, char *const argv[], char *const envp[]) {
|
||||
__attribute__((visibility("hidden"))) void dd_binfmt_before(const char *path, char *const argv[], char *const envp[]) {
|
||||
if (handing_off() && foreign(path, ENOEXEC)) hand_off(path, argv, envp);
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_binfmt_retry(const char *path, char *const argv[], char *const envp[], int error) {
|
||||
__attribute__((visibility("hidden"))) int dd_binfmt_retry(const char *path, char *const argv[], char *const envp[], int error) {
|
||||
if (wanted(path, error)) hand_off(path, argv, envp);
|
||||
errno = error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) void bl_binfmt_before_search(const char *file, char *const argv[], char *const envp[]) {
|
||||
__attribute__((visibility("hidden"))) void dd_binfmt_before_search(const char *file, char *const argv[], char *const envp[]) {
|
||||
char path[PATH_MAX];
|
||||
if (handing_off() && lookup(file, path, sizeof path)) bl_binfmt_before(path, argv, envp);
|
||||
if (handing_off() && lookup(file, path, sizeof path)) dd_binfmt_before(path, argv, envp);
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_binfmt_after_search(const char *file, char *const argv[], char *const envp[], int error) {
|
||||
__attribute__((visibility("hidden"))) int dd_binfmt_after_search(const char *file, char *const argv[], char *const envp[], int error) {
|
||||
char path[PATH_MAX];
|
||||
if (handing_off() && lookup(file, path, sizeof path)) return bl_binfmt_retry(path, argv, envp, error);
|
||||
if (handing_off() && lookup(file, path, sizeof path)) return dd_binfmt_retry(path, argv, envp, error);
|
||||
errno = error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_binfmt_runnable(const char *path, int mode) {
|
||||
__attribute__((visibility("hidden"))) int dd_binfmt_runnable(const char *path, int mode) {
|
||||
if (mode != X_OK || !handing_off()) return 0;
|
||||
int runs = foreign(path, EACCES) != 0;
|
||||
errno = EACCES;
|
||||
return runs;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_binfmt_spawn(pid_t *pid, const char *path, const posix_spawn_file_actions_t *fa,
|
||||
__attribute__((visibility("hidden"))) int dd_binfmt_spawn(pid_t *pid, const char *path, const posix_spawn_file_actions_t *fa,
|
||||
const posix_spawnattr_t *attr, char *const argv[], char *const envp[],
|
||||
spawn_fn real) {
|
||||
if (handing_off() && foreign(path, ENOEXEC)) return spawn_handler(pid, path, fa, attr, argv, envp, real);
|
||||
@@ -145,54 +145,54 @@ __attribute__((visibility("hidden"))) int bl_binfmt_spawn(pid_t *pid, const char
|
||||
int execvpe(const char *file, char *const argv[], char *const envp[]) {
|
||||
char resolved[PATH_MAX];
|
||||
const char *path = lookup(file, resolved, sizeof resolved) ? resolved : file;
|
||||
char *const *adjusted = bl_webhelper_argv(path, argv, envp);
|
||||
char *const *adjusted = dd_webhelper_argv(path, argv, envp);
|
||||
static int (*real)(const char *, char *const[], char *const[]);
|
||||
if (!real) real = (int (*)(const char *, char *const[], char *const[]))dlsym(RTLD_NEXT, "execvpe");
|
||||
bl_binfmt_before_search(file, (char *const *)adjusted, envp);
|
||||
dd_binfmt_before_search(file, (char *const *)adjusted, envp);
|
||||
real(file, (char *const *)adjusted, envp);
|
||||
return bl_binfmt_after_search(file, (char *const *)adjusted, envp, errno);
|
||||
return dd_binfmt_after_search(file, (char *const *)adjusted, envp, errno);
|
||||
}
|
||||
|
||||
int posix_spawnp(pid_t *pid, const char *file, const posix_spawn_file_actions_t *fa, const posix_spawnattr_t *attr,
|
||||
char *const argv[], char *const envp[]) {
|
||||
char path[PATH_MAX];
|
||||
int found = lookup(file, path, sizeof path);
|
||||
char *const *adjusted = bl_webhelper_argv(found ? path : file, argv, envp);
|
||||
char *const *adjusted = dd_webhelper_argv(found ? path : file, argv, envp);
|
||||
static spawn_fn real, spawn;
|
||||
if (!real) real = (spawn_fn)dlsym(RTLD_NEXT, "posix_spawnp");
|
||||
if (!spawn) spawn = (spawn_fn)dlsym(RTLD_NEXT, "posix_spawn");
|
||||
if (!handing_off() || !found) return real(pid, file, fa, attr, (char *const *)adjusted, envp);
|
||||
return bl_binfmt_spawn(pid, path, fa, attr, (char *const *)adjusted, envp, spawn);
|
||||
return dd_binfmt_spawn(pid, path, fa, attr, (char *const *)adjusted, envp, spawn);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_binfmt_runnable(const char *path, int mode) {
|
||||
__attribute__((visibility("hidden"))) int dd_binfmt_runnable(const char *path, int mode) {
|
||||
(void)path, (void)mode;
|
||||
return 0;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) void bl_binfmt_before(const char *path, char *const argv[], char *const envp[]) {
|
||||
__attribute__((visibility("hidden"))) void dd_binfmt_before(const char *path, char *const argv[], char *const envp[]) {
|
||||
(void)path, (void)argv, (void)envp;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_binfmt_retry(const char *path, char *const argv[], char *const envp[], int error) {
|
||||
__attribute__((visibility("hidden"))) int dd_binfmt_retry(const char *path, char *const argv[], char *const envp[], int error) {
|
||||
(void)path, (void)argv, (void)envp;
|
||||
errno = error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) void bl_binfmt_before_search(const char *file, char *const argv[], char *const envp[]) {
|
||||
__attribute__((visibility("hidden"))) void dd_binfmt_before_search(const char *file, char *const argv[], char *const envp[]) {
|
||||
(void)file, (void)argv, (void)envp;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_binfmt_after_search(const char *file, char *const argv[], char *const envp[], int error) {
|
||||
__attribute__((visibility("hidden"))) int dd_binfmt_after_search(const char *file, char *const argv[], char *const envp[], int error) {
|
||||
(void)file, (void)argv, (void)envp;
|
||||
errno = error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_binfmt_spawn(pid_t *pid, const char *path, const posix_spawn_file_actions_t *fa,
|
||||
__attribute__((visibility("hidden"))) int dd_binfmt_spawn(pid_t *pid, const char *path, const posix_spawn_file_actions_t *fa,
|
||||
const posix_spawnattr_t *attr, char *const argv[], char *const envp[],
|
||||
spawn_fn real) {
|
||||
return real(pid, path, fa, attr, argv, envp);
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(__aarch64__) || defined(BL_CLOCK_ANY_ARCH)
|
||||
#if defined(__aarch64__) || defined(DD_CLOCK_ANY_ARCH)
|
||||
|
||||
#ifndef CP_CTL
|
||||
#define CP_CTL "/tmp/.bl-clock"
|
||||
#define CP_CTL "/tmp/.dd-clock"
|
||||
#endif
|
||||
#ifndef FUTEX_LOCK_PI2
|
||||
#define FUTEX_LOCK_PI2 13
|
||||
@@ -255,7 +255,7 @@ int timerfd_settime(int fd, int flags, const struct itimerspec *value, struct it
|
||||
return cp_tfd_settime(fd, flags, cp_timer(fd, flags, value, &moved), old);
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_clock_syscall(long number, const long *args, long (*real)(long, ...), long *ret) {
|
||||
__attribute__((visibility("hidden"))) int dd_clock_syscall(long number, const long *args, long (*real)(long, ...), long *ret) {
|
||||
struct timespec moved;
|
||||
struct itimerspec timer;
|
||||
int64_t shift;
|
||||
@@ -302,7 +302,7 @@ __attribute__((visibility("hidden"))) int bl_clock_syscall(long number, const lo
|
||||
|
||||
#else
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_clock_syscall(long number, const long *args, long (*real)(long, ...), long *ret) {
|
||||
__attribute__((visibility("hidden"))) int dd_clock_syscall(long number, const long *args, long (*real)(long, ...), long *ret) {
|
||||
(void)number;
|
||||
(void)args;
|
||||
(void)real;
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
#define STORE "/.droiddeck-descriptors"
|
||||
#define ENTRY_MAX (PATH_MAX * 2)
|
||||
|
||||
int bl_is_wineserver(void) __attribute__((visibility("hidden")));
|
||||
int dd_is_wineserver(void) __attribute__((visibility("hidden")));
|
||||
|
||||
static int store_seen;
|
||||
|
||||
static int kept(const char *name) {
|
||||
return name != NULL && strcmp(name, DESCRIPTOR) == 0 && bl_is_wineserver();
|
||||
return name != NULL && strcmp(name, DESCRIPTOR) == 0 && dd_is_wineserver();
|
||||
}
|
||||
|
||||
static int store_root(char *out, size_t size) {
|
||||
@@ -226,7 +226,7 @@ int fremovexattr(int fd, const char *name) {
|
||||
static int tracked(const char *path, char *out, size_t size) {
|
||||
int saved = errno, found;
|
||||
|
||||
found = bl_is_wineserver() && store_exists() && resolved(path, out, size) == 0;
|
||||
found = dd_is_wineserver() && store_exists() && resolved(path, out, size) == 0;
|
||||
errno = saved;
|
||||
return found;
|
||||
}
|
||||
@@ -259,7 +259,7 @@ static void follow(const char *from, const char *to) {
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden")))
|
||||
int bl_descriptor_unlink(const char *path, int (*real)(const char *)) {
|
||||
int dd_descriptor_unlink(const char *path, int (*real)(const char *)) {
|
||||
char target[PATH_MAX];
|
||||
int known = tracked(path, target, sizeof(target)), result = real(path);
|
||||
|
||||
@@ -268,7 +268,7 @@ int bl_descriptor_unlink(const char *path, int (*real)(const char *)) {
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden")))
|
||||
int bl_descriptor_rmdir(const char *path, int (*real)(const char *)) {
|
||||
int dd_descriptor_rmdir(const char *path, int (*real)(const char *)) {
|
||||
char target[PATH_MAX];
|
||||
int known = tracked(path, target, sizeof(target)), result = real(path);
|
||||
|
||||
@@ -277,12 +277,12 @@ int bl_descriptor_rmdir(const char *path, int (*real)(const char *)) {
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden")))
|
||||
int bl_descriptor_remove(const char *path, int (*real)(const char *)) {
|
||||
return bl_descriptor_rmdir(path, real);
|
||||
int dd_descriptor_remove(const char *path, int (*real)(const char *)) {
|
||||
return dd_descriptor_rmdir(path, real);
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden")))
|
||||
int bl_descriptor_rename(const char *from, const char *to, int (*real)(const char *, const char *)) {
|
||||
int dd_descriptor_rename(const char *from, const char *to, int (*real)(const char *, const char *)) {
|
||||
char old[PATH_MAX], new[PATH_MAX];
|
||||
int known = tracked(from, old, sizeof(old)), result = real(from, to);
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ static void after_fork(void) {
|
||||
static int enabled(void) {
|
||||
static int cached = -1;
|
||||
if (cached < 0) {
|
||||
const char *off = getenv("BL_NO_DIR_CACHE");
|
||||
const char *off = getenv("DD_NO_DIR_CACHE");
|
||||
cached = strcmp(program_invocation_short_name, "steam") == 0 &&
|
||||
(strstr(program_invocation_name, "steamrtarm64") != NULL ||
|
||||
strstr(program_invocation_name, "steamrt64") != NULL) && !(off && strcmp(off, "1") == 0);
|
||||
@@ -816,9 +816,9 @@ static void end(struct expect *x, int nx) {
|
||||
give(&lock);
|
||||
}
|
||||
|
||||
int bl_dircache_create(int dirfd, const char *path, int flags, mode_t mode,
|
||||
int dd_dircache_create(int dirfd, const char *path, int flags, mode_t mode,
|
||||
int (*real)(int, const char *, int, mode_t)) __attribute__((visibility("hidden")));
|
||||
int bl_dircache_create(int dirfd, const char *path, int flags, mode_t mode,
|
||||
int dd_dircache_create(int dirfd, const char *path, int flags, mode_t mode,
|
||||
int (*real)(int, const char *, int, mode_t)) {
|
||||
struct side s;
|
||||
if (!(flags & O_CREAT) || (dirfd != AT_FDCWD && (path == NULL || path[0] != '/')) || !watching(path) || !split(path, &s))
|
||||
@@ -860,17 +860,17 @@ int bl_dircache_create(int dirfd, const char *path, int flags, mode_t mode,
|
||||
}
|
||||
|
||||
ONE_PATH(mkdir, ADDED, IN_CREATE, next_mkdir(path, mode), mode_t mode)
|
||||
int bl_descriptor_unlink(const char *path, int (*real)(const char *)) __attribute__((visibility("hidden")));
|
||||
int bl_descriptor_rmdir(const char *path, int (*real)(const char *)) __attribute__((visibility("hidden")));
|
||||
int bl_descriptor_remove(const char *path, int (*real)(const char *)) __attribute__((visibility("hidden")));
|
||||
int bl_descriptor_rename(const char *from, const char *to, int (*real)(const char *, const char *))
|
||||
int dd_descriptor_unlink(const char *path, int (*real)(const char *)) __attribute__((visibility("hidden")));
|
||||
int dd_descriptor_rmdir(const char *path, int (*real)(const char *)) __attribute__((visibility("hidden")));
|
||||
int dd_descriptor_remove(const char *path, int (*real)(const char *)) __attribute__((visibility("hidden")));
|
||||
int dd_descriptor_rename(const char *from, const char *to, int (*real)(const char *, const char *))
|
||||
__attribute__((visibility("hidden")));
|
||||
|
||||
static int moved(const char *from, const char *to) { return bl_descriptor_rename(from, to, next_rename); }
|
||||
static int moved(const char *from, const char *to) { return dd_descriptor_rename(from, to, next_rename); }
|
||||
|
||||
ONE_PATH(rmdir, REMOVED, IN_DELETE, bl_descriptor_rmdir(path, next_rmdir))
|
||||
ONE_PATH(unlink, REMOVED, IN_DELETE, bl_descriptor_unlink(path, next_unlink))
|
||||
ONE_PATH(remove, REMOVED, IN_DELETE, bl_descriptor_remove(path, next_remove))
|
||||
ONE_PATH(rmdir, REMOVED, IN_DELETE, dd_descriptor_rmdir(path, next_rmdir))
|
||||
ONE_PATH(unlink, REMOVED, IN_DELETE, dd_descriptor_unlink(path, next_unlink))
|
||||
ONE_PATH(remove, REMOVED, IN_DELETE, dd_descriptor_remove(path, next_remove))
|
||||
|
||||
#define TWO_PATHS(name, gone, event, call) \
|
||||
int name(const char *from, const char *to) { \
|
||||
@@ -900,8 +900,8 @@ ONE_PATH(remove, REMOVED, IN_DELETE, bl_descriptor_remove(path, next_remove))
|
||||
return r; \
|
||||
}
|
||||
|
||||
int bl_link_lock(const char *oldpath, const char *newpath, int result) __attribute__((visibility("hidden")));
|
||||
static int link_or_lock(const char *from, const char *to) { return bl_link_lock(from, to, next_link(from, to)); }
|
||||
int dd_link_lock(const char *oldpath, const char *newpath, int result) __attribute__((visibility("hidden")));
|
||||
static int link_or_lock(const char *from, const char *to) { return dd_link_lock(from, to, next_link(from, to)); }
|
||||
|
||||
TWO_PATHS(rename, 1, IN_MOVED_TO, moved)
|
||||
TWO_PATHS(link, 0, IN_CREATE, link_or_lock)
|
||||
@@ -938,8 +938,8 @@ static int listed_absent(const char *dir, const char *name, long long now) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bl_dircache_absent(const char *path) __attribute__((visibility("hidden")));
|
||||
int bl_dircache_absent(const char *path) {
|
||||
int dd_dircache_absent(const char *path) __attribute__((visibility("hidden")));
|
||||
int dd_dircache_absent(const char *path) {
|
||||
struct side s;
|
||||
if (!watching(path) || !split(path, &s)) return 0;
|
||||
for (const char *c = s.name; *c; c++)
|
||||
@@ -957,15 +957,15 @@ int bl_dircache_absent(const char *path) {
|
||||
|
||||
#else
|
||||
|
||||
int bl_dircache_absent(const char *path) __attribute__((visibility("hidden")));
|
||||
int bl_dircache_absent(const char *path) {
|
||||
int dd_dircache_absent(const char *path) __attribute__((visibility("hidden")));
|
||||
int dd_dircache_absent(const char *path) {
|
||||
(void)path;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bl_dircache_create(int dirfd, const char *path, int flags, mode_t mode,
|
||||
int dd_dircache_create(int dirfd, const char *path, int flags, mode_t mode,
|
||||
int (*real)(int, const char *, int, mode_t)) __attribute__((visibility("hidden")));
|
||||
int bl_dircache_create(int dirfd, const char *path, int flags, mode_t mode,
|
||||
int dd_dircache_create(int dirfd, const char *path, int flags, mode_t mode,
|
||||
int (*real)(int, const char *, int, mode_t)) {
|
||||
return real(dirfd, path, flags, mode);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ static int is_kgsl(int fd) {
|
||||
struct stat st;
|
||||
pthread_mutex_lock(&lock);
|
||||
if (kgsl_state == 0) {
|
||||
const char *standin = getenv("BL_DRM_STANDIN");
|
||||
const char *standin = getenv("DD_DRM_STANDIN");
|
||||
kgsl_state = stat("/dev/kgsl-3d0", &st) == 0 || (standin && *standin && stat(standin, &st) == 0) ? 1 : -1;
|
||||
if (kgsl_state > 0) kgsl_dev = st.st_rdev;
|
||||
}
|
||||
@@ -52,7 +52,7 @@ static int is_kgsl(int fd) {
|
||||
}
|
||||
|
||||
/* Keep the opt-in separate from GPU detection: manual ICDs must retain native DRM behavior. */
|
||||
struct bl_drm_version {
|
||||
struct dd_drm_version {
|
||||
int major, minor, patch;
|
||||
size_t name_len;
|
||||
char *name;
|
||||
@@ -61,21 +61,21 @@ struct bl_drm_version {
|
||||
size_t desc_len;
|
||||
char *desc;
|
||||
};
|
||||
#define BL_DRM_VERSION _IOWR('d', 0x00, struct bl_drm_version)
|
||||
#define DD_DRM_VERSION _IOWR('d', 0x00, struct dd_drm_version)
|
||||
|
||||
static int is_powervr(int fd) {
|
||||
const char *enabled = getenv("BL_POWERVR_DRM_HANDLES");
|
||||
const char *enabled = getenv("DD_POWERVR_DRM_HANDLES");
|
||||
if (!enabled || strcmp(enabled, "1")) return 0;
|
||||
const char *path = getenv("BL_POWERVR_RENDER_NODE");
|
||||
const char *path = getenv("DD_POWERVR_RENDER_NODE");
|
||||
if (!path || !*path) return 0;
|
||||
struct stat node, candidate;
|
||||
if (stat(path, &node) || fstat(fd, &candidate) ||
|
||||
!S_ISCHR(candidate.st_mode) || !S_ISCHR(node.st_mode) ||
|
||||
candidate.st_rdev != node.st_rdev) return 0;
|
||||
char name[16] = {0};
|
||||
struct bl_drm_version version = {.name_len = sizeof(name) - 1, .name = name};
|
||||
struct dd_drm_version version = {.name_len = sizeof(name) - 1, .name = name};
|
||||
/* Bypass the preload's ioctl dispatcher to avoid recursively entering this hook. */
|
||||
return syscall(SYS_ioctl, fd, BL_DRM_VERSION, &version) == 0 &&
|
||||
return syscall(SYS_ioctl, fd, DD_DRM_VERSION, &version) == 0 &&
|
||||
version.name_len == 3 && !memcmp(name, "pvr", 3);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ static int same_file_description(int a, int b) {
|
||||
}
|
||||
#endif
|
||||
if (ret < 0) {
|
||||
const char *standin = getenv("BL_DRM_STANDIN");
|
||||
const char *standin = getenv("DD_DRM_STANDIN");
|
||||
ret = standin && *standin ? same_by_flock(a, b) : 0;
|
||||
}
|
||||
errno = saved_errno;
|
||||
@@ -324,7 +324,7 @@ int drmCloseBufferHandle(int fd, uint32_t handle) {
|
||||
return fn ? fn(fd, handle) : -ENOSYS;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_drm_gem_close(int fd, unsigned long request, void *arg, int *rc) {
|
||||
__attribute__((visibility("hidden"))) int dd_drm_gem_close(int fd, unsigned long request, void *arg, int *rc) {
|
||||
if (request != GEM_CLOSE || !arg) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -98,11 +98,11 @@ static int (*fs_real_shm_unlink)(const char *);
|
||||
static void *(*fs_real_mmap)(void *, size_t, int, int, int, off_t);
|
||||
static void *(*fs_real_mmap64)(void *, size_t, int, int, int, off64_t);
|
||||
static int (*fs_real_munmap)(void *, size_t);
|
||||
__attribute__((visibility("hidden"))) int bl_noexec_retry(int prot, int flags, int fd);
|
||||
__attribute__((visibility("hidden"))) int dd_noexec_retry(int prot, int flags, int fd);
|
||||
|
||||
static int fs_on(void) {
|
||||
if (fs_state < 0) {
|
||||
const char *e = getenv("BL_FSYNC");
|
||||
const char *e = getenv("DD_FSYNC");
|
||||
fs_state = e && e[0] == '1';
|
||||
}
|
||||
return fs_state;
|
||||
@@ -511,14 +511,14 @@ static long fs_wake(uint32_t key, int n) {
|
||||
return woken;
|
||||
}
|
||||
|
||||
void bl_fsync_fds_closed(unsigned int first, unsigned int last) __attribute__((visibility("hidden")));
|
||||
void bl_fsync_fds_closed(unsigned int first, unsigned int last) {
|
||||
void dd_fsync_fds_closed(unsigned int first, unsigned int last) __attribute__((visibility("hidden")));
|
||||
void dd_fsync_fds_closed(unsigned int first, unsigned int last) {
|
||||
int fd = __atomic_load_n(&fs_fd, __ATOMIC_ACQUIRE);
|
||||
if (fd >= 0 && (unsigned int)fd >= first && (unsigned int)fd <= last) __atomic_store_n(&fs_fd, -1, __ATOMIC_RELEASE);
|
||||
}
|
||||
|
||||
int bl_fsync_syscall(long number, const long *args, long *ret) __attribute__((visibility("hidden")));
|
||||
int bl_fsync_syscall(long number, const long *args, long *ret) {
|
||||
int dd_fsync_syscall(long number, const long *args, long *ret) __attribute__((visibility("hidden")));
|
||||
int dd_fsync_syscall(long number, const long *args, long *ret) {
|
||||
if (number == SYS_futex_waitv) {
|
||||
if (!fs_on()) return 0;
|
||||
if (!args[0] && !args[1]) {
|
||||
@@ -617,15 +617,15 @@ int shm_unlink(const char *name) {
|
||||
return r;
|
||||
}
|
||||
|
||||
int bl_venc_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off,
|
||||
int dd_venc_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off,
|
||||
void *(*real)(void *, size_t, int, int, int, off_t), void **out) __attribute__((weak, visibility("hidden")));
|
||||
|
||||
void *mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off) {
|
||||
void *p;
|
||||
if (!fs_real_mmap) fs_real_mmap = (void *(*)(void *, size_t, int, int, int, off_t))dlsym(RTLD_NEXT, "mmap");
|
||||
if (bl_venc_mmap && bl_venc_mmap(addr, len, prot, flags, fd, off, fs_real_mmap, &p)) return p;
|
||||
if (dd_venc_mmap && dd_venc_mmap(addr, len, prot, flags, fd, off, fs_real_mmap, &p)) return p;
|
||||
p = fs_real_mmap(addr, len, prot, flags, fd, off);
|
||||
if (p == MAP_FAILED && bl_noexec_retry(prot, flags, fd)) p = fs_real_mmap(addr, len, prot & ~PROT_EXEC, flags, fd, off);
|
||||
if (p == MAP_FAILED && dd_noexec_retry(prot, flags, fd)) p = fs_real_mmap(addr, len, prot & ~PROT_EXEC, flags, fd, off);
|
||||
if (p != MAP_FAILED && __builtin_expect(fs_fd >= 0, 0)) fs_track(p, len, flags, fd, off);
|
||||
return p;
|
||||
}
|
||||
@@ -633,10 +633,10 @@ void *mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off) {
|
||||
void *mmap64(void *addr, size_t len, int prot, int flags, int fd, off64_t off) {
|
||||
void *p;
|
||||
if (!fs_real_mmap64) fs_real_mmap64 = (void *(*)(void *, size_t, int, int, int, off64_t))dlsym(RTLD_NEXT, "mmap64");
|
||||
if (bl_venc_mmap && bl_venc_mmap(addr, len, prot, flags, fd, off, (void *(*)(void *, size_t, int, int, int, off_t))fs_real_mmap64, &p))
|
||||
if (dd_venc_mmap && dd_venc_mmap(addr, len, prot, flags, fd, off, (void *(*)(void *, size_t, int, int, int, off_t))fs_real_mmap64, &p))
|
||||
return p;
|
||||
p = fs_real_mmap64(addr, len, prot, flags, fd, off);
|
||||
if (p == MAP_FAILED && bl_noexec_retry(prot, flags, fd)) p = fs_real_mmap64(addr, len, prot & ~PROT_EXEC, flags, fd, off);
|
||||
if (p == MAP_FAILED && dd_noexec_retry(prot, flags, fd)) p = fs_real_mmap64(addr, len, prot & ~PROT_EXEC, flags, fd, off);
|
||||
if (p != MAP_FAILED && __builtin_expect(fs_fd >= 0, 0)) fs_track(p, len, flags, fd, off);
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ static struct pad *pad_for_syslink(const char *path) {
|
||||
|
||||
static void *next_symbol(const char *name) { return dlsym(RTLD_NEXT, name); }
|
||||
|
||||
char *bl_cached_realpath(const char *path, char *resolved, char *(*real)(const char *, char *))
|
||||
char *dd_cached_realpath(const char *path, char *resolved, char *(*real)(const char *, char *))
|
||||
__attribute__((visibility("hidden")));
|
||||
|
||||
static int caller_is_winebus(void *caller) {
|
||||
@@ -178,7 +178,7 @@ static int caller_is_winebus(void *caller) {
|
||||
return strstr(info.dli_fname, "winebus.so") != NULL;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_winebus_rumble_ioctl(int (*real)(int, unsigned long, void *), int fd,
|
||||
__attribute__((visibility("hidden"))) int dd_winebus_rumble_ioctl(int (*real)(int, unsigned long, void *), int fd,
|
||||
unsigned long request, void *arg, void *caller,
|
||||
int *rc) {
|
||||
struct ff_effect *effect = arg;
|
||||
@@ -204,7 +204,7 @@ char *realpath(const char *path, char *resolved) {
|
||||
}
|
||||
if (real_realpath == NULL) real_realpath = next_symbol("realpath");
|
||||
if (real_realpath == NULL) return NULL;
|
||||
return bl_cached_realpath(path, resolved, real_realpath);
|
||||
return dd_cached_realpath(path, resolved, real_realpath);
|
||||
}
|
||||
|
||||
void *udev_device_new_from_syspath(void *udev, const char *syspath) {
|
||||
|
||||
@@ -28,7 +28,7 @@ static const struct {
|
||||
{0x44050A21, 0x44050A31},
|
||||
};
|
||||
|
||||
void bl_kgsl_chip_id_fixup(unsigned long request, void *arg, int rc) {
|
||||
void dd_kgsl_chip_id_fixup(unsigned long request, void *arg, int rc) {
|
||||
if (rc != 0 || request != IOCTL_KGSL_DEVICE_GETPROPERTY || arg == NULL) return;
|
||||
struct kgsl_device_getproperty *prop = arg;
|
||||
if (prop->type != KGSL_PROP_DEVICE_INFO || prop->value == NULL
|
||||
|
||||
@@ -69,7 +69,7 @@ static int read_retired(int (*real)(int, unsigned long, void *), int fd,
|
||||
}
|
||||
|
||||
/* Quest refuses some KGSL ioctls, and Mesa 27 turns a failed timestamp read into VK_ERROR_UNKNOWN. */
|
||||
__attribute__((visibility("hidden"))) void bl_kgsl_track(int (*real)(int, unsigned long, void *),
|
||||
__attribute__((visibility("hidden"))) void dd_kgsl_track(int (*real)(int, unsigned long, void *),
|
||||
int fd, unsigned long request, void *arg,
|
||||
int *rc) {
|
||||
int saved = errno;
|
||||
@@ -113,12 +113,12 @@ static int enabled(void) {
|
||||
const char *off;
|
||||
|
||||
if (cached >= 0) return cached;
|
||||
off = getenv("BL_NO_KGSL_POLL_FIX");
|
||||
off = getenv("DD_NO_KGSL_POLL_FIX");
|
||||
cached = !(off != NULL && off[0] == '1');
|
||||
return cached;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_kgsl_poll(int (*real)(int, unsigned long, void *),
|
||||
__attribute__((visibility("hidden"))) int dd_kgsl_poll(int (*real)(int, unsigned long, void *),
|
||||
int fd, unsigned long request, void *arg,
|
||||
int *rc) {
|
||||
const struct kgsl_device_waittimestamp_ctxtid *wait = arg;
|
||||
|
||||
@@ -19,7 +19,7 @@ static int lock_name(const char *path) {
|
||||
return n > 2 && strcmp(path + n - 2, "-l") == 0;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_link_lock(const char *oldpath, const char *newpath, int result) {
|
||||
__attribute__((visibility("hidden"))) int dd_link_lock(const char *oldpath, const char *newpath, int result) {
|
||||
static int (*real_symlink)(const char *, const char *);
|
||||
if (result == 0 || !refused(errno)) return result;
|
||||
if (moves_instead()) return renameat2(AT_FDCWD, oldpath, AT_FDCWD, newpath, RENAME_NOREPLACE);
|
||||
@@ -32,7 +32,7 @@ __attribute__((visibility("hidden"))) int bl_link_lock(const char *oldpath, cons
|
||||
int link(const char *oldpath, const char *newpath) {
|
||||
static int (*real_link)(const char *, const char *);
|
||||
if (real_link == NULL) real_link = dlsym(RTLD_NEXT, "link");
|
||||
return bl_link_lock(oldpath, newpath, real_link(oldpath, newpath));
|
||||
return dd_link_lock(oldpath, newpath, real_link(oldpath, newpath));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -61,8 +61,8 @@ static int is_lock_query(int cmd) {
|
||||
}
|
||||
}
|
||||
|
||||
int bl_nl_before_dup(int fd, void **state) __attribute__((visibility("hidden")));
|
||||
void bl_nl_after_dup(void *state, int fd) __attribute__((visibility("hidden")));
|
||||
int dd_nl_before_dup(int fd, void **state) __attribute__((visibility("hidden")));
|
||||
void dd_nl_after_dup(void *state, int fd) __attribute__((visibility("hidden")));
|
||||
|
||||
static int fcntl_with(int (**real_fcntl)(int, int, ...), const char *name, int fd, int cmd, void *arg) {
|
||||
int result;
|
||||
@@ -74,9 +74,9 @@ static int fcntl_with(int (**real_fcntl)(int, int, ...), const char *name, int f
|
||||
}
|
||||
void *nl_state = NULL;
|
||||
int duplicate = cmd == F_DUPFD || cmd == F_DUPFD_CLOEXEC;
|
||||
if (duplicate && bl_nl_before_dup(fd, &nl_state) != 0) return -1;
|
||||
if (duplicate && dd_nl_before_dup(fd, &nl_state) != 0) return -1;
|
||||
result = (*real_fcntl)(fd, cmd, arg);
|
||||
if (duplicate) bl_nl_after_dup(nl_state, result);
|
||||
if (duplicate) dd_nl_after_dup(nl_state, result);
|
||||
if (result >= 0 || !unsupported(errno)) return result;
|
||||
if (is_lock_command(cmd)) return 0;
|
||||
if (is_lock_query(cmd) && arg != NULL) {
|
||||
|
||||
+26
-26
@@ -20,7 +20,7 @@
|
||||
static const char *net_dir(void) {
|
||||
static char dir[256];
|
||||
if (!dir[0]) {
|
||||
const char *base = getenv("BL_SYSV_DIR");
|
||||
const char *base = getenv("DD_SYSV_DIR");
|
||||
snprintf(dir, sizeof(dir), "%s/net", base && *base ? base : "/dev/shm/wnsysv");
|
||||
char parent[256];
|
||||
snprintf(parent, sizeof(parent), "%s", dir);
|
||||
@@ -110,18 +110,18 @@ typedef int (*connect_fn)(int, const struct sockaddr *, socklen_t);
|
||||
typedef int (*accept4_fn)(int, struct sockaddr *, socklen_t *, int);
|
||||
static unsigned guarded_port(void);
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_udevmon_stand_in(int fd);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_bind(int fd, const struct sockaddr *addr,
|
||||
__attribute__((visibility("hidden"))) int dd_udevmon_stand_in(int fd);
|
||||
__attribute__((visibility("hidden"))) int dd_nl_bind(int fd, const struct sockaddr *addr,
|
||||
socklen_t len, int *rc);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_connect(int fd, const struct sockaddr *addr,
|
||||
__attribute__((visibility("hidden"))) int dd_nl_connect(int fd, const struct sockaddr *addr,
|
||||
socklen_t len, int *rc);
|
||||
|
||||
int bind(int fd, const struct sockaddr *addr, socklen_t len) {
|
||||
static bind_fn real;
|
||||
int nl_rc;
|
||||
if (!real) real = (bind_fn)dlsym(RTLD_NEXT, "bind");
|
||||
if (bl_nl_bind(fd, addr, len, &nl_rc)) return nl_rc;
|
||||
if (bl_udevmon_stand_in(fd)) {
|
||||
if (dd_nl_bind(fd, addr, len, &nl_rc)) return nl_rc;
|
||||
if (dd_udevmon_stand_in(fd)) {
|
||||
if (addr == NULL || len < sizeof(struct sockaddr_nl) || addr->sa_family != AF_NETLINK) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
@@ -183,7 +183,7 @@ static void bind_before_loopback_connect(int fd, const struct sockaddr *addr, so
|
||||
static unsigned guarded_port(void) {
|
||||
static int port = -1;
|
||||
if (port < 0) {
|
||||
const char *value = getenv("BL_CDP_GUARD");
|
||||
const char *value = getenv("DD_CDP_GUARD");
|
||||
port = value && *value ? atoi(value) : 0;
|
||||
if (port < 0 || port > 65535) port = 0;
|
||||
}
|
||||
@@ -230,7 +230,7 @@ static int guest_peer(int fd) {
|
||||
int connect(int fd, const struct sockaddr *addr, socklen_t len) {
|
||||
static connect_fn real;
|
||||
int nl_rc;
|
||||
if (bl_nl_connect(fd, addr, len, &nl_rc)) return nl_rc;
|
||||
if (dd_nl_connect(fd, addr, len, &nl_rc)) return nl_rc;
|
||||
if (!real) real = (connect_fn)dlsym(RTLD_NEXT, "connect");
|
||||
bind_before_loopback_connect(fd, addr, len);
|
||||
unsigned peer = loopback_family(addr, len) ? addr_port(addr, len) : 0;
|
||||
@@ -267,13 +267,13 @@ int accept(int fd, struct sockaddr *addr, socklen_t *len) {
|
||||
extern char **environ;
|
||||
typedef int (*spawn_fn)(pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *,
|
||||
char *const[], char *const[]);
|
||||
__attribute__((visibility("hidden"))) void bl_binfmt_before(const char *path, char *const argv[], char *const envp[]);
|
||||
__attribute__((visibility("hidden"))) int bl_binfmt_retry(const char *path, char *const argv[], char *const envp[], int error);
|
||||
__attribute__((visibility("hidden"))) void bl_binfmt_before_search(const char *file, char *const argv[], char *const envp[]);
|
||||
__attribute__((visibility("hidden"))) int bl_binfmt_after_search(const char *file, char *const argv[], char *const envp[], int error);
|
||||
__attribute__((visibility("hidden"))) void dd_binfmt_before(const char *path, char *const argv[], char *const envp[]);
|
||||
__attribute__((visibility("hidden"))) int dd_binfmt_retry(const char *path, char *const argv[], char *const envp[], int error);
|
||||
__attribute__((visibility("hidden"))) void dd_binfmt_before_search(const char *file, char *const argv[], char *const envp[]);
|
||||
__attribute__((visibility("hidden"))) int dd_binfmt_after_search(const char *file, char *const argv[], char *const envp[], int error);
|
||||
__attribute__((visibility("hidden")))
|
||||
char *const *bl_webhelper_argv(const char *path, char *const argv[], char *const envp[]);
|
||||
__attribute__((visibility("hidden"))) int bl_binfmt_spawn(pid_t *pid, const char *path, const posix_spawn_file_actions_t *fa,
|
||||
char *const *dd_webhelper_argv(const char *path, char *const argv[], char *const envp[]);
|
||||
__attribute__((visibility("hidden"))) int dd_binfmt_spawn(pid_t *pid, const char *path, const posix_spawn_file_actions_t *fa,
|
||||
const posix_spawnattr_t *attr, char *const argv[], char *const envp[],
|
||||
spawn_fn real);
|
||||
|
||||
@@ -320,7 +320,7 @@ static int maybe_answer_lsof(const char *path, char *const argv[]) {
|
||||
}
|
||||
|
||||
static char **web_helper_redirect(const char *path, char *const argv[], const char **launcher) {
|
||||
const char *want = getenv("BL_X64_ARM_WEBHELPER");
|
||||
const char *want = getenv("DD_X64_ARM_WEBHELPER");
|
||||
if (!want || !*want || !path) return NULL;
|
||||
const char *base = strrchr(path, '/');
|
||||
if (strcmp(base ? base + 1 : path, "steamwebhelper") != 0) return NULL;
|
||||
@@ -342,7 +342,7 @@ static char **web_helper_redirect(const char *path, char *const argv[], const ch
|
||||
}
|
||||
|
||||
int execve(const char *path, char *const argv_in[], char *const envp[]) {
|
||||
char *const *argv = bl_webhelper_argv(path, argv_in, envp);
|
||||
char *const *argv = dd_webhelper_argv(path, argv_in, envp);
|
||||
static int (*real)(const char *, char *const[], char *const[]);
|
||||
if (!real) real = (int (*)(const char *, char *const[], char *const[]))dlsym(RTLD_NEXT, "execve");
|
||||
maybe_answer_lsof(path, argv);
|
||||
@@ -352,9 +352,9 @@ int execve(const char *path, char *const argv_in[], char *const envp[]) {
|
||||
real(launcher, redirected, envp);
|
||||
free(redirected);
|
||||
}
|
||||
bl_binfmt_before(path, argv, envp);
|
||||
dd_binfmt_before(path, argv, envp);
|
||||
real(path, argv, envp);
|
||||
return bl_binfmt_retry(path, argv, envp, errno);
|
||||
return dd_binfmt_retry(path, argv, envp, errno);
|
||||
}
|
||||
|
||||
static int answer_lsof_via_spawn(const char *path, char *const argv[], pid_t *pid) {
|
||||
@@ -373,17 +373,17 @@ static int answer_lsof_via_spawn(const char *path, char *const argv[], pid_t *pi
|
||||
}
|
||||
|
||||
int execvp(const char *file, char *const argv_in[]) {
|
||||
char *const *argv = bl_webhelper_argv(file, argv_in, environ);
|
||||
char *const *argv = dd_webhelper_argv(file, argv_in, environ);
|
||||
static int (*real)(const char *, char *const[]);
|
||||
if (!real) real = (int (*)(const char *, char *const[]))dlsym(RTLD_NEXT, "execvp");
|
||||
maybe_answer_lsof(file, argv);
|
||||
bl_binfmt_before_search(file, argv, environ);
|
||||
dd_binfmt_before_search(file, argv, environ);
|
||||
real(file, argv);
|
||||
return bl_binfmt_after_search(file, argv, environ, errno);
|
||||
return dd_binfmt_after_search(file, argv, environ, errno);
|
||||
}
|
||||
|
||||
int execv(const char *path, char *const argv_in[]) {
|
||||
char *const *argv = bl_webhelper_argv(path, argv_in, environ);
|
||||
char *const *argv = dd_webhelper_argv(path, argv_in, environ);
|
||||
static int (*real)(const char *, char *const[]);
|
||||
if (!real) real = (int (*)(const char *, char *const[]))dlsym(RTLD_NEXT, "execv");
|
||||
maybe_answer_lsof(path, argv);
|
||||
@@ -393,9 +393,9 @@ int execv(const char *path, char *const argv_in[]) {
|
||||
real(launcher, redirected);
|
||||
free(redirected);
|
||||
}
|
||||
bl_binfmt_before(path, argv, environ);
|
||||
dd_binfmt_before(path, argv, environ);
|
||||
real(path, argv);
|
||||
return bl_binfmt_retry(path, argv, environ, errno);
|
||||
return dd_binfmt_retry(path, argv, environ, errno);
|
||||
}
|
||||
|
||||
int posix_spawn(pid_t *pid, const char *path, const posix_spawn_file_actions_t *fa,
|
||||
@@ -407,6 +407,6 @@ int posix_spawn(pid_t *pid, const char *path, const posix_spawn_file_actions_t *
|
||||
}
|
||||
static spawn_fn real;
|
||||
if (!real) real = (spawn_fn)dlsym(RTLD_NEXT, "posix_spawn");
|
||||
char *const *adjusted = bl_webhelper_argv(path, argv, envp);
|
||||
return bl_binfmt_spawn(pid, path, fa, attr, (char *const *)adjusted, envp, real);
|
||||
char *const *adjusted = dd_webhelper_argv(path, argv, envp);
|
||||
return dd_binfmt_spawn(pid, path, fa, attr, (char *const *)adjusted, envp, real);
|
||||
}
|
||||
@@ -411,19 +411,19 @@ static int is_link_query(unsigned long request) {
|
||||
|| request == SIOCGIFBRDADDR;
|
||||
}
|
||||
|
||||
void bl_kgsl_chip_id_fixup(unsigned long request, void *arg, int rc);
|
||||
void dd_kgsl_chip_id_fixup(unsigned long request, void *arg, int rc);
|
||||
#include "../../quest/kgsl_compat.h"
|
||||
int bl_kgsl_poll(int (*real)(int, unsigned long, void *), int fd, unsigned long request,
|
||||
int dd_kgsl_poll(int (*real)(int, unsigned long, void *), int fd, unsigned long request,
|
||||
void *arg, int *rc) __attribute__((visibility("hidden")));
|
||||
void bl_kgsl_track(int (*real)(int, unsigned long, void *), int fd, unsigned long request,
|
||||
void dd_kgsl_track(int (*real)(int, unsigned long, void *), int fd, unsigned long request,
|
||||
void *arg, int *rc) __attribute__((visibility("hidden")));
|
||||
int bl_ntsync_ioctl(int fd, unsigned long request, void *arg, int *rc) __attribute__((visibility("hidden")));
|
||||
int bl_drm_gem_close(int fd, unsigned long request, void *arg, int *rc) __attribute__((visibility("hidden")));
|
||||
int bl_venc_ioctl(int fd, unsigned long request, void *arg, int *rc) __attribute__((visibility("hidden")));
|
||||
int bl_vdec_ioctl(int fd, unsigned long request, void *arg, int *rc) __attribute__((visibility("hidden")));
|
||||
int bl_winebus_rumble_ioctl(int (*real)(int, unsigned long, void *), int fd, unsigned long request,
|
||||
int dd_ntsync_ioctl(int fd, unsigned long request, void *arg, int *rc) __attribute__((visibility("hidden")));
|
||||
int dd_drm_gem_close(int fd, unsigned long request, void *arg, int *rc) __attribute__((visibility("hidden")));
|
||||
int dd_venc_ioctl(int fd, unsigned long request, void *arg, int *rc) __attribute__((visibility("hidden")));
|
||||
int dd_vdec_ioctl(int fd, unsigned long request, void *arg, int *rc) __attribute__((visibility("hidden")));
|
||||
int dd_winebus_rumble_ioctl(int (*real)(int, unsigned long, void *), int fd, unsigned long request,
|
||||
void *arg, void *caller, int *rc) __attribute__((visibility("hidden")));
|
||||
int bl_writewatch_ioctl(int (*real)(int, unsigned long, void *), int fd, unsigned long request, void *arg,
|
||||
int dd_writewatch_ioctl(int (*real)(int, unsigned long, void *), int fd, unsigned long request, void *arg,
|
||||
int *rc) __attribute__((visibility("hidden")));
|
||||
|
||||
int ioctl(int fd, unsigned long request, ...) {
|
||||
@@ -435,16 +435,16 @@ int ioctl(int fd, unsigned long request, ...) {
|
||||
va_end(ap);
|
||||
|
||||
int rc;
|
||||
if (bl_ntsync_ioctl(fd, request, arg, &rc)) return rc;
|
||||
if (bl_venc_ioctl(fd, request, arg, &rc)) return rc;
|
||||
if (bl_vdec_ioctl(fd, request, arg, &rc)) return rc;
|
||||
if (bl_drm_gem_close(fd, request, arg, &rc)) return rc;
|
||||
if (dd_ntsync_ioctl(fd, request, arg, &rc)) return rc;
|
||||
if (dd_venc_ioctl(fd, request, arg, &rc)) return rc;
|
||||
if (dd_vdec_ioctl(fd, request, arg, &rc)) return rc;
|
||||
if (dd_drm_gem_close(fd, request, arg, &rc)) return rc;
|
||||
if (real == NULL) real = (ioctl_fn) dlsym(RTLD_NEXT, "ioctl");
|
||||
if (bl_winebus_rumble_ioctl(real, fd, request, arg, __builtin_return_address(0), &rc)) return rc;
|
||||
if (bl_writewatch_ioctl(real, fd, request, arg, &rc)) return rc;
|
||||
if (!bl_kgsl_poll(real, fd, request, arg, &rc)) rc = quest_kgsl_ioctl(real, fd, request, arg);
|
||||
bl_kgsl_track(real, fd, request, arg, &rc);
|
||||
bl_kgsl_chip_id_fixup(request, arg, rc);
|
||||
if (dd_winebus_rumble_ioctl(real, fd, request, arg, __builtin_return_address(0), &rc)) return rc;
|
||||
if (dd_writewatch_ioctl(real, fd, request, arg, &rc)) return rc;
|
||||
if (!dd_kgsl_poll(real, fd, request, arg, &rc)) rc = quest_kgsl_ioctl(real, fd, request, arg);
|
||||
dd_kgsl_track(real, fd, request, arg, &rc);
|
||||
dd_kgsl_chip_id_fixup(request, arg, rc);
|
||||
if (arg == NULL || !is_link_query(request)) return rc;
|
||||
int saved = errno;
|
||||
if (answer_ifreq(request, (struct ifreq *) arg, rc)) return 0;
|
||||
@@ -595,19 +595,19 @@ static FILE *synthesize(const char *table) {
|
||||
return out;
|
||||
}
|
||||
|
||||
int bl_status_without_tracer(const char *path, int flags, const void *caller) __attribute__((visibility("hidden")));
|
||||
int dd_status_without_tracer(const char *path, int flags, const void *caller) __attribute__((visibility("hidden")));
|
||||
|
||||
const char *bl_oom_adj_redirect(const char *path, int writing) __attribute__((visibility("hidden")));
|
||||
const char *dd_oom_adj_redirect(const char *path, int writing) __attribute__((visibility("hidden")));
|
||||
|
||||
static FILE *open_stream(fopen_fn real, const char *path, const char *mode, const void *caller) {
|
||||
int status = mode && mode[0] == 'r' && !strchr(mode, '+')
|
||||
? bl_status_without_tracer(path, O_RDONLY | O_CLOEXEC, caller) : -1;
|
||||
? dd_status_without_tracer(path, O_RDONLY | O_CLOEXEC, caller) : -1;
|
||||
if (status >= 0) {
|
||||
FILE *copy = fdopen(status, "r");
|
||||
if (copy == NULL) close(status);
|
||||
return copy;
|
||||
}
|
||||
path = bl_oom_adj_redirect(path, mode && (mode[0] == 'w' || mode[0] == 'a' || strchr(mode, '+')));
|
||||
path = dd_oom_adj_redirect(path, mode && (mode[0] == 'w' || mode[0] == 'a' || strchr(mode, '+')));
|
||||
int table = path && mode && mode[0] == 'r' ? denied_table(path) : -1;
|
||||
FILE *f;
|
||||
if (table >= 0 && denied_recently(table, path) && (f = synthesize(net_tables[table])) != NULL) return f;
|
||||
@@ -705,9 +705,9 @@ struct nl_reply {
|
||||
int overflow;
|
||||
};
|
||||
|
||||
static const char nl_client_magic[12] = "bl-nl-c-v1";
|
||||
static const char nl_peer_magic[12] = "bl-nl-p-v1";
|
||||
static const char nl_reservation_magic[12] = "bl-nl-r-v1";
|
||||
static const char nl_client_magic[12] = "dd-nl-c-v1";
|
||||
static const char nl_peer_magic[12] = "dd-nl-p-v1";
|
||||
static const char nl_reservation_magic[12] = "dd-nl-r-v1";
|
||||
static struct nl_socket *nl_sockets;
|
||||
static struct nl_fd *nl_fds;
|
||||
static struct nl_fd_page *nl_fd_pages[NL_FD_BUCKETS];
|
||||
@@ -1206,36 +1206,36 @@ static unsigned nl_port_of(int fd) {
|
||||
return port;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_nl_socket(int type, int *fd);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_bind(int fd, const struct sockaddr *addr,
|
||||
__attribute__((visibility("hidden"))) int dd_nl_socket(int type, int *fd);
|
||||
__attribute__((visibility("hidden"))) int dd_nl_bind(int fd, const struct sockaddr *addr,
|
||||
socklen_t len, int *rc);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_getsockname(int fd, struct sockaddr *addr,
|
||||
__attribute__((visibility("hidden"))) int dd_nl_getsockname(int fd, struct sockaddr *addr,
|
||||
socklen_t *len, int *rc);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_owns(int fd);
|
||||
__attribute__((visibility("hidden"))) void bl_nl_closed(int fd);
|
||||
__attribute__((visibility("hidden"))) void bl_nl_range_closed(unsigned int first, unsigned int last);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_before_dup(int fd, void **state);
|
||||
__attribute__((visibility("hidden"))) void bl_nl_after_dup(void *state, int fd);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_connect(int fd, const struct sockaddr *addr,
|
||||
__attribute__((visibility("hidden"))) int dd_nl_owns(int fd);
|
||||
__attribute__((visibility("hidden"))) void dd_nl_closed(int fd);
|
||||
__attribute__((visibility("hidden"))) void dd_nl_range_closed(unsigned int first, unsigned int last);
|
||||
__attribute__((visibility("hidden"))) int dd_nl_before_dup(int fd, void **state);
|
||||
__attribute__((visibility("hidden"))) void dd_nl_after_dup(void *state, int fd);
|
||||
__attribute__((visibility("hidden"))) int dd_nl_connect(int fd, const struct sockaddr *addr,
|
||||
socklen_t len, int *rc);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_getpeername(int fd, struct sockaddr *addr,
|
||||
__attribute__((visibility("hidden"))) int dd_nl_getpeername(int fd, struct sockaddr *addr,
|
||||
socklen_t *len, int *rc);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_setsockopt(int fd, int level, int option,
|
||||
__attribute__((visibility("hidden"))) int dd_nl_setsockopt(int fd, int level, int option,
|
||||
const void *value, socklen_t len,
|
||||
int (*real)(int, int, int, const void *, socklen_t),
|
||||
int *rc);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_getsockopt(int fd, int level, int option,
|
||||
__attribute__((visibility("hidden"))) int dd_nl_getsockopt(int fd, int level, int option,
|
||||
void *value, socklen_t *len,
|
||||
int (*real)(int, int, int, void *, socklen_t *),
|
||||
int *rc);
|
||||
__attribute__((visibility("hidden"))) void bl_nl_received(struct msghdr *msg);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_recvmsg(int fd, struct msghdr *msg, int flags,
|
||||
__attribute__((visibility("hidden"))) void dd_nl_received(struct msghdr *msg);
|
||||
__attribute__((visibility("hidden"))) int dd_nl_recvmsg(int fd, struct msghdr *msg, int flags,
|
||||
ssize_t (*real)(int, struct msghdr *, int),
|
||||
ssize_t *rc);
|
||||
|
||||
int bl_nl_owns(int fd) { return nl_peer_of(fd) >= 0; }
|
||||
int dd_nl_owns(int fd) { return nl_peer_of(fd) >= 0; }
|
||||
|
||||
int bl_nl_socket(int type, int *fd) {
|
||||
int dd_nl_socket(int type, int *fd) {
|
||||
int kind = type & 0xf;
|
||||
*fd = -1;
|
||||
if (type & ~(0xf | SOCK_CLOEXEC | SOCK_NONBLOCK)) {
|
||||
@@ -1342,10 +1342,10 @@ static int nl_autobind(int fd) {
|
||||
return nl_bind_port(fd, 0, 1);
|
||||
}
|
||||
|
||||
int bl_nl_bind(int fd, const struct sockaddr *addr, socklen_t len, int *rc) {
|
||||
int dd_nl_bind(int fd, const struct sockaddr *addr, socklen_t len, int *rc) {
|
||||
const struct sockaddr_nl *nl;
|
||||
if (addr && len >= sizeof(sa_family_t) && addr->sa_family == AF_NETLINK) nl_discover(fd);
|
||||
if (!bl_nl_owns(fd)) return 0;
|
||||
if (!dd_nl_owns(fd)) return 0;
|
||||
if (addr == NULL || len < sizeof(struct sockaddr_nl) || addr->sa_family != AF_NETLINK) {
|
||||
errno = EINVAL;
|
||||
*rc = -1;
|
||||
@@ -1361,10 +1361,10 @@ int bl_nl_bind(int fd, const struct sockaddr *addr, socklen_t len, int *rc) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int bl_nl_getsockname(int fd, struct sockaddr *addr, socklen_t *len, int *rc) {
|
||||
int dd_nl_getsockname(int fd, struct sockaddr *addr, socklen_t *len, int *rc) {
|
||||
struct sockaddr_nl nl;
|
||||
socklen_t size;
|
||||
if (!bl_nl_owns(fd)) return 0;
|
||||
if (!dd_nl_owns(fd)) return 0;
|
||||
if (addr == NULL || len == NULL) {
|
||||
errno = EFAULT;
|
||||
*rc = -1;
|
||||
@@ -1380,13 +1380,13 @@ int bl_nl_getsockname(int fd, struct sockaddr *addr, socklen_t *len, int *rc) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void bl_nl_closed(int fd) {
|
||||
void dd_nl_closed(int fd) {
|
||||
if (!nl_tracked(fd)) return;
|
||||
if (nl_foreign()) return;
|
||||
bl_nl_range_closed((unsigned int) fd, (unsigned int) fd);
|
||||
dd_nl_range_closed((unsigned int) fd, (unsigned int) fd);
|
||||
}
|
||||
|
||||
void bl_nl_range_closed(unsigned int first, unsigned int last) {
|
||||
void dd_nl_range_closed(unsigned int first, unsigned int last) {
|
||||
if (__atomic_load_n(&nl_fd_count, __ATOMIC_ACQUIRE) == 0) return;
|
||||
if (nl_foreign()) return;
|
||||
pthread_mutex_lock(&nl_sockets_lock);
|
||||
@@ -1400,7 +1400,7 @@ void bl_nl_range_closed(unsigned int first, unsigned int last) {
|
||||
pthread_mutex_unlock(&nl_sockets_lock);
|
||||
}
|
||||
|
||||
int bl_nl_before_dup(int fd, void **state) {
|
||||
int dd_nl_before_dup(int fd, void **state) {
|
||||
*state = NULL;
|
||||
if (!nl_tracked(fd)) return 0;
|
||||
if (nl_foreign()) return 0;
|
||||
@@ -1421,7 +1421,7 @@ int bl_nl_before_dup(int fd, void **state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void bl_nl_after_dup(void *state, int fd) {
|
||||
void dd_nl_after_dup(void *state, int fd) {
|
||||
int saved = errno;
|
||||
struct nl_fd *reserved = state;
|
||||
if (reserved == NULL && !nl_tracked(fd)) {
|
||||
@@ -1456,9 +1456,9 @@ int dup(int fd) {
|
||||
static int (*real)(int);
|
||||
void *state;
|
||||
if (real == NULL) real = (int (*)(int)) dlsym(RTLD_NEXT, "dup");
|
||||
if (bl_nl_before_dup(fd, &state) != 0) return -1;
|
||||
if (dd_nl_before_dup(fd, &state) != 0) return -1;
|
||||
int result = real(fd);
|
||||
bl_nl_after_dup(state, result);
|
||||
dd_nl_after_dup(state, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1470,9 +1470,9 @@ static int nl_destination(const struct sockaddr *addr, socklen_t len) {
|
||||
return destination->nl_pid == 0 ? 0 : -ECONNREFUSED;
|
||||
}
|
||||
|
||||
int bl_nl_connect(int fd, const struct sockaddr *addr, socklen_t len, int *rc) {
|
||||
int dd_nl_connect(int fd, const struct sockaddr *addr, socklen_t len, int *rc) {
|
||||
if (addr && len >= sizeof(sa_family_t) && addr->sa_family == AF_NETLINK) nl_discover(fd);
|
||||
if (!bl_nl_owns(fd)) return 0;
|
||||
if (!dd_nl_owns(fd)) return 0;
|
||||
int disconnect = addr && len >= sizeof(sa_family_t) && addr->sa_family == AF_UNSPEC;
|
||||
int error = disconnect ? 0 : nl_destination(addr, len);
|
||||
if (error) {
|
||||
@@ -1493,8 +1493,8 @@ static void nl_source_name(struct sockaddr *addr, socklen_t *len) {
|
||||
*len = sizeof(source);
|
||||
}
|
||||
|
||||
int bl_nl_getpeername(int fd, struct sockaddr *addr, socklen_t *len, int *rc) {
|
||||
if (!bl_nl_owns(fd)) return 0;
|
||||
int dd_nl_getpeername(int fd, struct sockaddr *addr, socklen_t *len, int *rc) {
|
||||
if (!dd_nl_owns(fd)) return 0;
|
||||
if (addr == NULL || len == NULL) {
|
||||
errno = EFAULT;
|
||||
*rc = -1;
|
||||
@@ -1505,7 +1505,7 @@ int bl_nl_getpeername(int fd, struct sockaddr *addr, socklen_t *len, int *rc) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int bl_nl_setsockopt(int fd, int level, int option, const void *value, socklen_t len,
|
||||
int dd_nl_setsockopt(int fd, int level, int option, const void *value, socklen_t len,
|
||||
int (*real)(int, int, int, const void *, socklen_t), int *rc) {
|
||||
if (level == SOL_NETLINK) nl_discover(fd);
|
||||
int peer = nl_peer_of(fd);
|
||||
@@ -1542,7 +1542,7 @@ int bl_nl_setsockopt(int fd, int level, int option, const void *value, socklen_t
|
||||
return 1;
|
||||
}
|
||||
|
||||
int bl_nl_getsockopt(int fd, int level, int option, void *value, socklen_t *len,
|
||||
int dd_nl_getsockopt(int fd, int level, int option, void *value, socklen_t *len,
|
||||
int (*real)(int, int, int, void *, socklen_t *), int *rc) {
|
||||
if (level != SOL_SOCKET || (option != SO_TYPE && option != SO_DOMAIN && option != SO_PROTOCOL))
|
||||
return 0;
|
||||
@@ -1580,7 +1580,7 @@ int bl_nl_getsockopt(int fd, int level, int option, void *value, socklen_t *len,
|
||||
return 1;
|
||||
}
|
||||
|
||||
void bl_nl_received(struct msghdr *msg) {
|
||||
void dd_nl_received(struct msghdr *msg) {
|
||||
for (struct cmsghdr *control = CMSG_FIRSTHDR(msg); control; control = CMSG_NXTHDR(msg, control)) {
|
||||
if (control->cmsg_len < CMSG_LEN(0)) break;
|
||||
if (control->cmsg_level != SOL_SOCKET || control->cmsg_type != SCM_RIGHTS) continue;
|
||||
@@ -1593,11 +1593,11 @@ void bl_nl_received(struct msghdr *msg) {
|
||||
}
|
||||
}
|
||||
|
||||
int bl_nl_recvmsg(int fd, struct msghdr *msg, int flags,
|
||||
int dd_nl_recvmsg(int fd, struct msghdr *msg, int flags,
|
||||
ssize_t (*real)(int, struct msghdr *, int), ssize_t *rc) {
|
||||
ssize_t result;
|
||||
socklen_t capacity = 0;
|
||||
if (!bl_nl_owns(fd)) return 0;
|
||||
if (!dd_nl_owns(fd)) return 0;
|
||||
if (msg && msg->msg_name) capacity = msg->msg_namelen;
|
||||
result = real(fd, msg, flags);
|
||||
if (result >= 0 && msg && msg->msg_name) {
|
||||
@@ -1614,7 +1614,7 @@ ssize_t recvfrom(int fd, void *buffer, size_t length, int flags,
|
||||
if (real == NULL)
|
||||
real = (ssize_t (*)(int, void *, size_t, int, struct sockaddr *, socklen_t *))
|
||||
dlsym(RTLD_NEXT, "recvfrom");
|
||||
int owned = bl_nl_owns(fd);
|
||||
int owned = dd_nl_owns(fd);
|
||||
socklen_t capacity = owned && addr && addrlen ? *addrlen : 0;
|
||||
ssize_t result = real(fd, buffer, length, flags, addr, addrlen);
|
||||
if (result >= 0 && owned && addr && addrlen) {
|
||||
@@ -2108,7 +2108,7 @@ static ssize_t sendmsg_request(int fd, const struct msghdr *msg, int flags) {
|
||||
|
||||
ssize_t sendmsg(int fd, const struct msghdr *msg, int flags) {
|
||||
static ssize_t (*real)(int, const struct msghdr *, int);
|
||||
if (bl_nl_owns(fd)) {
|
||||
if (dd_nl_owns(fd)) {
|
||||
int error = msg && msg->msg_name ? nl_destination(msg->msg_name, msg->msg_namelen) : 0;
|
||||
if (error) {
|
||||
errno = -error;
|
||||
@@ -2128,7 +2128,7 @@ ssize_t sendto(int fd, const void *buffer, size_t length, int flags,
|
||||
const struct sockaddr *addr, socklen_t addrlen) {
|
||||
static ssize_t (*real)(int, const void *, size_t, int, const struct sockaddr *, socklen_t);
|
||||
ssize_t rc;
|
||||
if (bl_nl_owns(fd)) {
|
||||
if (dd_nl_owns(fd)) {
|
||||
int error = addr ? nl_destination(addr, addrlen) : 0;
|
||||
if (error) {
|
||||
errno = -error;
|
||||
@@ -2149,7 +2149,7 @@ ssize_t sendto(int fd, const void *buffer, size_t length, int flags,
|
||||
ssize_t send(int fd, const void *buffer, size_t length, int flags) {
|
||||
static ssize_t (*real)(int, const void *, size_t, int);
|
||||
ssize_t rc;
|
||||
if (bl_nl_owns(fd) && deliver(fd, buffer, length, flags, &rc)) return rc;
|
||||
if (dd_nl_owns(fd) && deliver(fd, buffer, length, flags, &rc)) return rc;
|
||||
if (real == NULL) real = (ssize_t (*)(int, const void *, size_t, int)) dlsym(RTLD_NEXT, "send");
|
||||
if (real == NULL) {
|
||||
errno = ENOSYS;
|
||||
@@ -2161,7 +2161,7 @@ ssize_t send(int fd, const void *buffer, size_t length, int flags) {
|
||||
ssize_t write(int fd, const void *buffer, size_t length) {
|
||||
static ssize_t (*real)(int, const void *, size_t);
|
||||
ssize_t rc;
|
||||
if (bl_nl_owns(fd) && deliver(fd, buffer, length, 0, &rc)) return rc;
|
||||
if (dd_nl_owns(fd) && deliver(fd, buffer, length, 0, &rc)) return rc;
|
||||
if (real == NULL) real = (ssize_t (*)(int, const void *, size_t)) dlsym(RTLD_NEXT, "write");
|
||||
if (real == NULL) {
|
||||
errno = ENOSYS;
|
||||
@@ -2172,7 +2172,7 @@ ssize_t write(int fd, const void *buffer, size_t length) {
|
||||
|
||||
ssize_t writev(int fd, const struct iovec *iov, int iovcnt) {
|
||||
static ssize_t (*real)(int, const struct iovec *, int);
|
||||
if (iovcnt >= 0 && bl_nl_owns(fd)) {
|
||||
if (iovcnt >= 0 && dd_nl_owns(fd)) {
|
||||
struct msghdr msg = { .msg_iov = (struct iovec *) iov, .msg_iovlen = (size_t) iovcnt };
|
||||
return sendmsg_request(fd, &msg, 0);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ static int in_fex(void) {
|
||||
return known;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_noexec_retry(int prot, int flags, int fd) {
|
||||
__attribute__((visibility("hidden"))) int dd_noexec_retry(int prot, int flags, int fd) {
|
||||
int error = errno;
|
||||
struct statvfs vfs;
|
||||
int retry = (error == EACCES || error == EPERM) && (prot & PROT_EXEC) && fd >= 0 && !(flags & MAP_ANONYMOUS) &&
|
||||
@@ -146,7 +146,7 @@ int mprotect(void *addr, size_t len, int prot) {
|
||||
|
||||
#else
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_noexec_retry(int prot, int flags, int fd) {
|
||||
__attribute__((visibility("hidden"))) int dd_noexec_retry(int prot, int flags, int fd) {
|
||||
(void)prot, (void)flags, (void)fd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ static int (*ns_real_close)(int);
|
||||
|
||||
static int ns_on(void) {
|
||||
if (ns_state < 0) {
|
||||
const char *e = getenv("BL_SYNC");
|
||||
const char *e = getenv("DD_SYNC");
|
||||
ns_state = e && e[0] == '1';
|
||||
}
|
||||
return ns_state;
|
||||
@@ -276,7 +276,7 @@ static __thread struct ns_cs ns_cs;
|
||||
static uintptr_t ns_handlers[_NSIG];
|
||||
static uint8_t ns_siginfo[_NSIG];
|
||||
|
||||
int bl_from_ntdll(const void *caller) __attribute__((visibility("hidden")));
|
||||
int dd_from_ntdll(const void *caller) __attribute__((visibility("hidden")));
|
||||
|
||||
static int ns_deferrable(int sig) {
|
||||
return sig > 0 && sig < _NSIG && sig != SIGKILL && sig != SIGSTOP && sig != SIGSEGV && sig != SIGBUS && sig != SIGILL
|
||||
@@ -383,7 +383,7 @@ int sigaction(int sig, const struct sigaction *act, struct sigaction *old) {
|
||||
struct sigaction mine;
|
||||
const struct sigaction *use = act;
|
||||
if (act && act->sa_handler != SIG_DFL && act->sa_handler != SIG_IGN && !(act->sa_flags & SA_RESETHAND) &&
|
||||
bl_from_ntdll(__builtin_return_address(0))) {
|
||||
dd_from_ntdll(__builtin_return_address(0))) {
|
||||
mine = *act;
|
||||
mine.sa_sigaction = ns_trampoline;
|
||||
mine.sa_flags |= SA_SIGINFO;
|
||||
@@ -1373,8 +1373,8 @@ static int ns_dev_ioctl(struct ns_dev *d, unsigned long req, void *arg, int *fd)
|
||||
return ENOTTY;
|
||||
}
|
||||
|
||||
int bl_ntsync_ioctl(int fd, unsigned long req, void *arg, int *rc) __attribute__((visibility("hidden")));
|
||||
int bl_ntsync_ioctl(int fd, unsigned long req, void *arg, int *rc) {
|
||||
int dd_ntsync_ioctl(int fd, unsigned long req, void *arg, int *rc) __attribute__((visibility("hidden")));
|
||||
int dd_ntsync_ioctl(int fd, unsigned long req, void *arg, int *rc) {
|
||||
if (_IOC_TYPE(req) != 'N' || _IOC_NR(req) < 0x80 || _IOC_NR(req) > 0x8d) return 0;
|
||||
if (!__atomic_load_n(&ns_ndev, __ATOMIC_ACQUIRE) && !ns_on()) return 0;
|
||||
uint64_t e = ns_lookup(fd);
|
||||
@@ -1393,8 +1393,8 @@ int bl_ntsync_ioctl(int fd, unsigned long req, void *arg, int *rc) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int bl_ntsync_open(const char *path, int flags) __attribute__((visibility("hidden")));
|
||||
int bl_ntsync_open(const char *path, int flags) {
|
||||
int dd_ntsync_open(const char *path, int flags) __attribute__((visibility("hidden")));
|
||||
int dd_ntsync_open(const char *path, int flags) {
|
||||
if (!path || strcmp(path, "/dev/ntsync") != 0 || !ns_on()) return -2;
|
||||
int fd = (int)syscall(SYS_openat, AT_FDCWD, path, flags, 0);
|
||||
if (fd >= 0) return fd;
|
||||
@@ -1440,41 +1440,41 @@ static void ns_received(struct msghdr *msg) {
|
||||
}
|
||||
}
|
||||
|
||||
int bl_udevmon_recvmsg(int fd, struct msghdr *msg, int flags, ssize_t (*real_recvmsg)(int, struct msghdr *, int),
|
||||
int dd_udevmon_recvmsg(int fd, struct msghdr *msg, int flags, ssize_t (*real_recvmsg)(int, struct msghdr *, int),
|
||||
ssize_t *result) __attribute__((visibility("hidden")));
|
||||
int bl_nl_recvmsg(int fd, struct msghdr *msg, int flags, ssize_t (*real_recvmsg)(int, struct msghdr *, int),
|
||||
int dd_nl_recvmsg(int fd, struct msghdr *msg, int flags, ssize_t (*real_recvmsg)(int, struct msghdr *, int),
|
||||
ssize_t *result) __attribute__((visibility("hidden")));
|
||||
void bl_nl_received(struct msghdr *msg) __attribute__((visibility("hidden")));
|
||||
void bl_nl_closed(int fd) __attribute__((visibility("hidden")));
|
||||
void bl_nl_range_closed(unsigned int first, unsigned int last) __attribute__((visibility("hidden")));
|
||||
int bl_nl_before_dup(int fd, void **state) __attribute__((visibility("hidden")));
|
||||
void bl_nl_after_dup(void *state, int fd) __attribute__((visibility("hidden")));
|
||||
void dd_nl_received(struct msghdr *msg) __attribute__((visibility("hidden")));
|
||||
void dd_nl_closed(int fd) __attribute__((visibility("hidden")));
|
||||
void dd_nl_range_closed(unsigned int first, unsigned int last) __attribute__((visibility("hidden")));
|
||||
int dd_nl_before_dup(int fd, void **state) __attribute__((visibility("hidden")));
|
||||
void dd_nl_after_dup(void *state, int fd) __attribute__((visibility("hidden")));
|
||||
|
||||
ssize_t recvmsg(int fd, struct msghdr *msg, int flags) {
|
||||
static ssize_t (*real)(int, struct msghdr *, int);
|
||||
if (!real) real = (ssize_t (*)(int, struct msghdr *, int))dlsym(RTLD_NEXT, "recvmsg");
|
||||
ssize_t answered;
|
||||
if (msg && bl_nl_recvmsg(fd, msg, flags, real, &answered)) return answered;
|
||||
if (msg && bl_udevmon_recvmsg(fd, msg, flags, real, &answered)) return answered;
|
||||
if (msg && dd_nl_recvmsg(fd, msg, flags, real, &answered)) return answered;
|
||||
if (msg && dd_udevmon_recvmsg(fd, msg, flags, real, &answered)) return answered;
|
||||
ssize_t r = real(fd, msg, flags);
|
||||
if (r >= 0 && msg && msg->msg_control && msg->msg_controllen) {
|
||||
int saved = errno;
|
||||
bl_nl_received(msg);
|
||||
dd_nl_received(msg);
|
||||
if (ns_on()) ns_received(msg);
|
||||
errno = saved;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
void bl_fsync_fds_closed(unsigned int first, unsigned int last) __attribute__((visibility("hidden")));
|
||||
void bl_venc_closed(int fd) __attribute__((visibility("hidden")));
|
||||
void bl_vdec_closed(int fd) __attribute__((visibility("hidden")));
|
||||
void dd_fsync_fds_closed(unsigned int first, unsigned int last) __attribute__((visibility("hidden")));
|
||||
void dd_venc_closed(int fd) __attribute__((visibility("hidden")));
|
||||
void dd_vdec_closed(int fd) __attribute__((visibility("hidden")));
|
||||
|
||||
int close(int fd) {
|
||||
if (fd >= 0) bl_fsync_fds_closed((unsigned int)fd, (unsigned int)fd);
|
||||
bl_venc_closed(fd);
|
||||
bl_vdec_closed(fd);
|
||||
bl_nl_closed(fd);
|
||||
if (fd >= 0) dd_fsync_fds_closed((unsigned int)fd, (unsigned int)fd);
|
||||
dd_venc_closed(fd);
|
||||
dd_vdec_closed(fd);
|
||||
dd_nl_closed(fd);
|
||||
uint64_t *t = __atomic_load_n(&ns_fdt, __ATOMIC_ACQUIRE);
|
||||
if (t && fd >= 0 && fd < NS_FDS && __atomic_load_n(&t[fd], __ATOMIC_ACQUIRE)) ns_forget(fd);
|
||||
int saved = errno;
|
||||
@@ -1492,12 +1492,12 @@ int dup2(int oldfd, int newfd) {
|
||||
if (!real) real = (int (*)(int, int))dlsym(RTLD_NEXT, "dup2");
|
||||
if (oldfd == newfd) return real(oldfd, newfd);
|
||||
void *nl_state;
|
||||
if (bl_nl_before_dup(oldfd, &nl_state) != 0) return -1;
|
||||
if (oldfd != newfd && newfd >= 0) bl_fsync_fds_closed((unsigned int)newfd, (unsigned int)newfd);
|
||||
if (dd_nl_before_dup(oldfd, &nl_state) != 0) return -1;
|
||||
if (oldfd != newfd && newfd >= 0) dd_fsync_fds_closed((unsigned int)newfd, (unsigned int)newfd);
|
||||
uint64_t *t = __atomic_load_n(&ns_fdt, __ATOMIC_ACQUIRE);
|
||||
if (t && oldfd != newfd && newfd >= 0 && newfd < NS_FDS && __atomic_load_n(&t[newfd], __ATOMIC_ACQUIRE)) ns_forget(newfd);
|
||||
int result = real(oldfd, newfd);
|
||||
bl_nl_after_dup(nl_state, result);
|
||||
dd_nl_after_dup(nl_state, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1506,12 +1506,12 @@ int dup3(int oldfd, int newfd, int flags) {
|
||||
if (!real) real = (int (*)(int, int, int))dlsym(RTLD_NEXT, "dup3");
|
||||
if (oldfd == newfd) return real(oldfd, newfd, flags);
|
||||
void *nl_state;
|
||||
if (bl_nl_before_dup(oldfd, &nl_state) != 0) return -1;
|
||||
if (oldfd != newfd && newfd >= 0) bl_fsync_fds_closed((unsigned int)newfd, (unsigned int)newfd);
|
||||
if (dd_nl_before_dup(oldfd, &nl_state) != 0) return -1;
|
||||
if (oldfd != newfd && newfd >= 0) dd_fsync_fds_closed((unsigned int)newfd, (unsigned int)newfd);
|
||||
uint64_t *t = __atomic_load_n(&ns_fdt, __ATOMIC_ACQUIRE);
|
||||
if (t && oldfd != newfd && newfd >= 0 && newfd < NS_FDS && __atomic_load_n(&t[newfd], __ATOMIC_ACQUIRE)) ns_forget(newfd);
|
||||
int result = real(oldfd, newfd, flags);
|
||||
bl_nl_after_dup(nl_state, result);
|
||||
dd_nl_after_dup(nl_state, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1526,7 +1526,7 @@ int close_range(unsigned int first, unsigned int last, int flags) {
|
||||
static int (*real)(unsigned int, unsigned int, int);
|
||||
if (!real) real = (int (*)(unsigned int, unsigned int, int))dlsym(RTLD_NEXT, "close_range");
|
||||
if (!(flags & CLOSE_RANGE_CLOEXEC)) {
|
||||
bl_fsync_fds_closed(first, last);
|
||||
dd_fsync_fds_closed(first, last);
|
||||
ns_forget_range(first, last);
|
||||
}
|
||||
if (!real) {
|
||||
@@ -1534,7 +1534,7 @@ int close_range(unsigned int first, unsigned int last, int flags) {
|
||||
return -1;
|
||||
}
|
||||
int result = real(first, last, flags);
|
||||
if (result == 0 && !(flags & CLOSE_RANGE_CLOEXEC)) bl_nl_range_closed(first, last);
|
||||
if (result == 0 && !(flags & CLOSE_RANGE_CLOEXEC)) dd_nl_range_closed(first, last);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1542,12 +1542,12 @@ void closefrom(int lowfd) {
|
||||
static void (*real)(int);
|
||||
if (!real) real = (void (*)(int))dlsym(RTLD_NEXT, "closefrom");
|
||||
if (lowfd >= 0) {
|
||||
bl_fsync_fds_closed((unsigned int)lowfd, ~0u);
|
||||
dd_fsync_fds_closed((unsigned int)lowfd, ~0u);
|
||||
ns_forget_range((unsigned int)lowfd, ~0u);
|
||||
}
|
||||
if (real) {
|
||||
real(lowfd);
|
||||
if (lowfd >= 0) bl_nl_range_closed((unsigned int)lowfd, ~0u);
|
||||
if (lowfd >= 0) dd_nl_range_closed((unsigned int)lowfd, ~0u);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ static int is_oom_score_adj(const char *path) {
|
||||
return strcmp(p, "oom_score_adj") == 0 || strcmp(p, "oom_adj") == 0;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) const char *bl_oom_adj_redirect(const char *path, int writing) {
|
||||
__attribute__((visibility("hidden"))) const char *dd_oom_adj_redirect(const char *path, int writing) {
|
||||
static int logged;
|
||||
if (!writing || !is_oom_score_adj(path)) return path;
|
||||
if (!__atomic_exchange_n(&logged, 1, __ATOMIC_RELAXED)) {
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
int bl_status_without_tracer(const char *path, int flags, const void *caller) __attribute__((visibility("hidden")));
|
||||
int bl_writable_retry(int dirfd, const char *path, int flags) __attribute__((visibility("hidden")));
|
||||
int bl_ntsync_open(const char *path, int flags) __attribute__((visibility("hidden")));
|
||||
const char *bl_oom_adj_redirect(const char *path, int writing) __attribute__((visibility("hidden")));
|
||||
int bl_venc_open(const char *path, int flags) __attribute__((visibility("hidden")));
|
||||
int bl_vdec_open(const char *path, int flags) __attribute__((visibility("hidden")));
|
||||
int bl_dircache_create(int dirfd, const char *path, int flags, mode_t mode,
|
||||
int dd_status_without_tracer(const char *path, int flags, const void *caller) __attribute__((visibility("hidden")));
|
||||
int dd_writable_retry(int dirfd, const char *path, int flags) __attribute__((visibility("hidden")));
|
||||
int dd_ntsync_open(const char *path, int flags) __attribute__((visibility("hidden")));
|
||||
const char *dd_oom_adj_redirect(const char *path, int writing) __attribute__((visibility("hidden")));
|
||||
int dd_venc_open(const char *path, int flags) __attribute__((visibility("hidden")));
|
||||
int dd_vdec_open(const char *path, int flags) __attribute__((visibility("hidden")));
|
||||
int dd_dircache_create(int dirfd, const char *path, int flags, mode_t mode,
|
||||
int (*real)(int, const char *, int, mode_t)) __attribute__((visibility("hidden")));
|
||||
|
||||
static int (*real_open)(const char *, int, ...);
|
||||
@@ -49,19 +49,19 @@ static int open_from(const char *path, int flags, mode_t mode, const void *calle
|
||||
errno = EACCES;
|
||||
return -1;
|
||||
}
|
||||
path = bl_oom_adj_redirect(path, (flags & O_ACCMODE) != O_RDONLY);
|
||||
if ((fd = bl_status_without_tracer(path, flags, caller)) >= 0) return fd;
|
||||
if ((fd = bl_ntsync_open(path, flags)) != -2) return fd;
|
||||
if ((fd = bl_venc_open(path, flags)) != -2) return fd;
|
||||
if ((fd = bl_vdec_open(path, flags)) != -2) return fd;
|
||||
path = dd_oom_adj_redirect(path, (flags & O_ACCMODE) != O_RDONLY);
|
||||
if ((fd = dd_status_without_tracer(path, flags, caller)) >= 0) return fd;
|
||||
if ((fd = dd_ntsync_open(path, flags)) != -2) return fd;
|
||||
if ((fd = dd_venc_open(path, flags)) != -2) return fd;
|
||||
if ((fd = dd_vdec_open(path, flags)) != -2) return fd;
|
||||
if (real_open == NULL) real_open = dlsym(RTLD_NEXT, "open");
|
||||
if (real_open == NULL) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
fd = bl_dircache_create(AT_FDCWD, path, flags, mode, via_open);
|
||||
fd = dd_dircache_create(AT_FDCWD, path, flags, mode, via_open);
|
||||
if (retry_without_noatime(fd, flags)) fd = real_open(path, flags & ~O_NOATIME, mode);
|
||||
if (fd < 0 && bl_writable_retry(AT_FDCWD, path, flags)) fd = real_open(path, flags & ~O_NOATIME, mode);
|
||||
if (fd < 0 && dd_writable_retry(AT_FDCWD, path, flags)) fd = real_open(path, flags & ~O_NOATIME, mode);
|
||||
return fd;
|
||||
}
|
||||
|
||||
@@ -72,19 +72,19 @@ static int openat_from(int dirfd, const char *path, int flags, mode_t mode, cons
|
||||
errno = EACCES;
|
||||
return -1;
|
||||
}
|
||||
path = bl_oom_adj_redirect(path, (flags & O_ACCMODE) != O_RDONLY);
|
||||
if ((fd = bl_status_without_tracer(path, flags, caller)) >= 0) return fd;
|
||||
if ((fd = bl_ntsync_open(path, flags)) != -2) return fd;
|
||||
if ((fd = bl_venc_open(path, flags)) != -2) return fd;
|
||||
if ((fd = bl_vdec_open(path, flags)) != -2) return fd;
|
||||
path = dd_oom_adj_redirect(path, (flags & O_ACCMODE) != O_RDONLY);
|
||||
if ((fd = dd_status_without_tracer(path, flags, caller)) >= 0) return fd;
|
||||
if ((fd = dd_ntsync_open(path, flags)) != -2) return fd;
|
||||
if ((fd = dd_venc_open(path, flags)) != -2) return fd;
|
||||
if ((fd = dd_vdec_open(path, flags)) != -2) return fd;
|
||||
if (real_openat == NULL) real_openat = dlsym(RTLD_NEXT, "openat");
|
||||
if (real_openat == NULL) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
fd = bl_dircache_create(dirfd, path, flags, mode, via_openat);
|
||||
fd = dd_dircache_create(dirfd, path, flags, mode, via_openat);
|
||||
if (retry_without_noatime(fd, flags)) fd = real_openat(dirfd, path, flags & ~O_NOATIME, mode);
|
||||
if (fd < 0 && bl_writable_retry(dirfd, path, flags)) fd = real_openat(dirfd, path, flags & ~O_NOATIME, mode);
|
||||
if (fd < 0 && dd_writable_retry(dirfd, path, flags)) fd = real_openat(dirfd, path, flags & ~O_NOATIME, mode);
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#define EXFAT_MAGIC 0x2011bab0
|
||||
|
||||
__attribute__((visibility("hidden")))
|
||||
int bl_is_wineserver(void) {
|
||||
int dd_is_wineserver(void) {
|
||||
static int cached = -1;
|
||||
char exe[PATH_MAX];
|
||||
const char *base;
|
||||
@@ -40,11 +40,11 @@ static int has_no_unix_owner(int fd) {
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden")))
|
||||
void bl_storage_owner(int fd, struct stat *st) {
|
||||
void dd_storage_owner(int fd, struct stat *st) {
|
||||
int saved = errno;
|
||||
uid_t uid;
|
||||
|
||||
if (st != NULL && bl_is_wineserver()) {
|
||||
if (st != NULL && dd_is_wineserver()) {
|
||||
uid = getuid();
|
||||
if (st->st_uid != uid && has_no_unix_owner(fd)) st->st_uid = uid;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ int fchmod(int fd, mode_t mode) {
|
||||
return -1;
|
||||
}
|
||||
result = next_fchmod(fd, mode);
|
||||
if (result != 0 && errno == EPERM && bl_is_wineserver()) {
|
||||
if (result != 0 && errno == EPERM && dd_is_wineserver()) {
|
||||
if (has_no_unix_owner(fd)) {
|
||||
errno = saved;
|
||||
return 0;
|
||||
|
||||
@@ -40,7 +40,7 @@ static int enabled(void) {
|
||||
const char *off;
|
||||
|
||||
if (cached >= 0) return cached;
|
||||
off = getenv("BL_NO_PATH_CACHE");
|
||||
off = getenv("DD_NO_PATH_CACHE");
|
||||
cached = strcmp(program_invocation_short_name, "steam") == 0 &&
|
||||
(strstr(program_invocation_name, "steamrtarm64") != NULL ||
|
||||
strstr(program_invocation_name, "steamrt64") != NULL) &&
|
||||
@@ -83,7 +83,7 @@ static void store(const char *path, int kind, int mode, int flags, unsigned h, c
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden")))
|
||||
char *bl_cached_realpath(const char *path, char *resolved, char *(*real)(const char *, char *)) {
|
||||
char *dd_cached_realpath(const char *path, char *resolved, char *(*real)(const char *, char *)) {
|
||||
char out[PATH_MAX];
|
||||
unsigned h;
|
||||
struct entry *e;
|
||||
@@ -111,7 +111,7 @@ char *bl_cached_realpath(const char *path, char *resolved, char *(*real)(const c
|
||||
return strdup(out);
|
||||
}
|
||||
|
||||
int bl_dircache_absent(const char *path) __attribute__((weak, visibility("hidden")));
|
||||
int dd_dircache_absent(const char *path) __attribute__((weak, visibility("hidden")));
|
||||
|
||||
static int cached_access(const char *path, int mode, int flags, int (*check)(const char *, int, int)) {
|
||||
unsigned h;
|
||||
@@ -124,7 +124,7 @@ static int cached_access(const char *path, int mode, int flags, int (*check)(con
|
||||
hit = find(path, KIND_ACCESS, mode, flags, h) != NULL;
|
||||
pthread_mutex_unlock(&lock);
|
||||
if (hit) return 0;
|
||||
if (bl_dircache_absent && bl_dircache_absent(path)) {
|
||||
if (dd_dircache_absent && dd_dircache_absent(path)) {
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
@@ -144,11 +144,11 @@ static int (*next_faccessat(void))(int, const char *, int, int) {
|
||||
return real;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_binfmt_runnable(const char *path, int mode);
|
||||
__attribute__((visibility("hidden"))) int bl_writable_access(int dirfd, const char *path, int mode, int flags);
|
||||
__attribute__((visibility("hidden"))) int dd_binfmt_runnable(const char *path, int mode);
|
||||
__attribute__((visibility("hidden"))) int dd_writable_access(int dirfd, const char *path, int mode, int flags);
|
||||
|
||||
static int writable_as_owner(int (*real)(int, const char *, int, int), int dirfd, const char *path, int mode, int flags) {
|
||||
if (!bl_writable_access(dirfd, path, mode, flags)) return -1;
|
||||
if (!dd_writable_access(dirfd, path, mode, flags)) return -1;
|
||||
if ((mode & ~W_OK) == 0 || real(dirfd, path, mode & ~W_OK, flags) == 0) return 0;
|
||||
return -1;
|
||||
}
|
||||
@@ -165,7 +165,7 @@ static int check_cwd(const char *path, int mode, int flags) {
|
||||
result = real(AT_FDCWD, path, mode, flags);
|
||||
if (result == 0) return 0;
|
||||
err = errno;
|
||||
if (err == EACCES && bl_binfmt_runnable(path, mode)) return 0;
|
||||
if (err == EACCES && dd_binfmt_runnable(path, mode)) return 0;
|
||||
errno = err;
|
||||
if (writable_as_owner(real, AT_FDCWD, path, mode, flags) == 0) return 0;
|
||||
errno = err;
|
||||
|
||||
@@ -60,7 +60,7 @@ static int grant_owner_write(int dirfd, const char *path) {
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden")))
|
||||
int bl_writable_retry(int dirfd, const char *path, int flags) {
|
||||
int dd_writable_retry(int dirfd, const char *path, int flags) {
|
||||
int saved = errno;
|
||||
int granted = 0;
|
||||
char parent[PATH_MAX];
|
||||
@@ -84,7 +84,7 @@ int bl_writable_retry(int dirfd, const char *path, int flags) {
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden")))
|
||||
int bl_writable_access(int dirfd, const char *path, int mode, int flags) {
|
||||
int dd_writable_access(int dirfd, const char *path, int mode, int flags) {
|
||||
int saved = errno;
|
||||
struct stat st;
|
||||
int owned;
|
||||
|
||||
@@ -21,22 +21,22 @@
|
||||
#define SYS_openat2 437
|
||||
#endif
|
||||
|
||||
#define BL_RESOLVE_BENEATH 0x08
|
||||
#define BL_RESOLVE_IN_ROOT 0x10
|
||||
#define BL_MAX_SYMLINKS 40
|
||||
#define BL_PROC_ROOT_INO 1
|
||||
#define DD_RESOLVE_BENEATH 0x08
|
||||
#define DD_RESOLVE_IN_ROOT 0x10
|
||||
#define DD_MAX_SYMLINKS 40
|
||||
#define DD_PROC_ROOT_INO 1
|
||||
|
||||
#ifdef SYS_newfstatat
|
||||
#define BL_SYS_FSTATAT SYS_newfstatat
|
||||
#define BL_FSTATAT_NAME "fstatat"
|
||||
typedef struct stat bl_stat;
|
||||
#define DD_SYS_FSTATAT SYS_newfstatat
|
||||
#define DD_FSTATAT_NAME "fstatat"
|
||||
typedef struct stat dd_stat;
|
||||
#else
|
||||
#define BL_SYS_FSTATAT SYS_fstatat64
|
||||
#define BL_FSTATAT_NAME "fstatat64"
|
||||
typedef struct stat64 bl_stat;
|
||||
#define DD_SYS_FSTATAT SYS_fstatat64
|
||||
#define DD_FSTATAT_NAME "fstatat64"
|
||||
typedef struct stat64 dd_stat;
|
||||
#endif
|
||||
|
||||
struct bl_open_how {
|
||||
struct dd_open_how {
|
||||
uint64_t flags;
|
||||
uint64_t mode;
|
||||
uint64_t resolve;
|
||||
@@ -45,7 +45,7 @@ struct bl_open_how {
|
||||
static long (*real_syscall)(long, ...);
|
||||
static void *(*real_dlopen)(const char *, int);
|
||||
static int openat2_missing;
|
||||
static int (*next_fstatat)(int, const char *, bl_stat *, int);
|
||||
static int (*next_fstatat)(int, const char *, dd_stat *, int);
|
||||
static int (*next_openat)(int, const char *, int, ...);
|
||||
static ssize_t (*next_readlinkat)(int, const char *, char *, size_t);
|
||||
static int (*next_statx)(int, const char *, int, unsigned int, struct statx *);
|
||||
@@ -53,7 +53,7 @@ static int (*next_statx)(int, const char *, int, unsigned int, struct statx *);
|
||||
static int find_fastpath(struct dl_phdr_info *info, size_t size, void *name) {
|
||||
(void)size;
|
||||
const char *slash = strrchr(info->dlpi_name, '/');
|
||||
if (!slash || strcmp(slash + 1, "libblfastpath.so") != 0 || strlen(info->dlpi_name) >= PATH_MAX) {
|
||||
if (!slash || strcmp(slash + 1, "libddfastpath.so") != 0 || strlen(info->dlpi_name) >= PATH_MAX) {
|
||||
return 0;
|
||||
}
|
||||
strcpy(name, info->dlpi_name);
|
||||
@@ -65,16 +65,16 @@ __attribute__((constructor)) static void find_fastpath_calls(void) {
|
||||
dl_iterate_phdr(find_fastpath, name);
|
||||
void *fastpath = *name ? dlopen(name, RTLD_NOLOAD | RTLD_LAZY) : NULL;
|
||||
if (fastpath) {
|
||||
next_fstatat = (int (*)(int, const char *, bl_stat *, int))dlsym(fastpath, BL_FSTATAT_NAME);
|
||||
next_fstatat = (int (*)(int, const char *, dd_stat *, int))dlsym(fastpath, DD_FSTATAT_NAME);
|
||||
next_openat = (int (*)(int, const char *, int, ...))dlsym(fastpath, "openat");
|
||||
next_readlinkat = (ssize_t (*)(int, const char *, char *, size_t))dlsym(fastpath, "readlinkat");
|
||||
next_statx = (int (*)(int, const char *, int, unsigned int, struct statx *))dlsym(fastpath, "statx");
|
||||
}
|
||||
}
|
||||
|
||||
static long path_stat(int dirfd, const char *path, bl_stat *st, int flags) {
|
||||
static long path_stat(int dirfd, const char *path, dd_stat *st, int flags) {
|
||||
if (!next_fstatat) {
|
||||
return real_syscall(BL_SYS_FSTATAT, (long)dirfd, (long)path, (long)st, (long)flags);
|
||||
return real_syscall(DD_SYS_FSTATAT, (long)dirfd, (long)path, (long)st, (long)flags);
|
||||
}
|
||||
return next_fstatat(dirfd, path, st, flags);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ void *dlopen(const char *filename, int flags) {
|
||||
return real_dlopen(filename, flags);
|
||||
}
|
||||
|
||||
int bl_fsync_syscall(long number, const long *args, long *ret) __attribute__((visibility("hidden")));
|
||||
int dd_fsync_syscall(long number, const long *args, long *ret) __attribute__((visibility("hidden")));
|
||||
|
||||
static struct robust_list_head *thread_robust_head(void) {
|
||||
pthread_mutexattr_t attr;
|
||||
@@ -159,10 +159,10 @@ static int is_magic_link(int dirfd, char *link, size_t parent_len) {
|
||||
}
|
||||
char saved = link[parent_len];
|
||||
link[parent_len] = 0;
|
||||
bl_stat parent;
|
||||
dd_stat parent;
|
||||
long result = path_stat(dirfd, (parent_len ? link : "."), &parent, 0);
|
||||
link[parent_len] = saved;
|
||||
return result != 0 || parent.st_ino != BL_PROC_ROOT_INO;
|
||||
return result != 0 || parent.st_ino != DD_PROC_ROOT_INO;
|
||||
}
|
||||
|
||||
static long openat_in_root(int dirfd, const char *path, int flags, long mode) {
|
||||
@@ -217,16 +217,16 @@ static long openat_in_root(int dirfd, const char *path, int flags, long mode) {
|
||||
}
|
||||
memcpy(resolved + resolved_len + separator, name, len);
|
||||
resolved[candidate_len] = 0;
|
||||
bl_stat st;
|
||||
dd_stat st;
|
||||
int follow = !last || trailing_slash || !nofollow;
|
||||
long stat_result = follow ? path_stat(dirfd, resolved, &st, AT_SYMLINK_NOFOLLOW) : -1;
|
||||
if (stat_result == 0 && S_ISLNK(st.st_mode)) {
|
||||
if (++symlinks > BL_MAX_SYMLINKS) {
|
||||
if (++symlinks > DD_MAX_SYMLINKS) {
|
||||
errno = ELOOP;
|
||||
return -1;
|
||||
}
|
||||
if (!have_root) {
|
||||
bl_stat root;
|
||||
dd_stat root;
|
||||
struct statfs root_fs;
|
||||
if (path_stat(dirfd, ".", &root, 0) != 0) {
|
||||
return -1;
|
||||
@@ -265,7 +265,7 @@ static long openat_in_root(int dirfd, const char *path, int flags, long mode) {
|
||||
while (*inside == '/') {
|
||||
inside++;
|
||||
}
|
||||
bl_stat probe;
|
||||
dd_stat probe;
|
||||
int host = *inside && path_stat(dirfd, inside, &probe, AT_SYMLINK_NOFOLLOW) != 0 &&
|
||||
errno == ENOENT && path_stat(AT_FDCWD, pending, &probe, 0) == 0;
|
||||
pending[target_len] = saved;
|
||||
@@ -302,22 +302,22 @@ static long openat_in_root(int dirfd, const char *path, int flags, long mode) {
|
||||
|
||||
static long openat2_via_openat(const long *args) {
|
||||
const char *path = (const char *)args[1];
|
||||
const struct bl_open_how *how = (const struct bl_open_how *)args[2];
|
||||
const struct dd_open_how *how = (const struct dd_open_how *)args[2];
|
||||
if (!path || !how || (size_t)args[3] < sizeof(*how)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if ((how->resolve & BL_RESOLVE_IN_ROOT) && (int)args[0] != AT_FDCWD) {
|
||||
if ((how->resolve & DD_RESOLVE_IN_ROOT) && (int)args[0] != AT_FDCWD) {
|
||||
return openat_in_root((int)args[0], path, (int)how->flags, (long)how->mode);
|
||||
}
|
||||
if (how->resolve & BL_RESOLVE_IN_ROOT) {
|
||||
if (how->resolve & DD_RESOLVE_IN_ROOT) {
|
||||
while (*path == '/') {
|
||||
path++;
|
||||
}
|
||||
if (!*path) {
|
||||
path = ".";
|
||||
}
|
||||
} else if ((how->resolve & BL_RESOLVE_BENEATH) && *path == '/') {
|
||||
} else if ((how->resolve & DD_RESOLVE_BENEATH) && *path == '/') {
|
||||
errno = EXDEV;
|
||||
return -1;
|
||||
}
|
||||
@@ -346,14 +346,14 @@ static long openat2_call(const long *args) {
|
||||
return openat2_via_openat(args);
|
||||
}
|
||||
|
||||
int bl_openat2(int dirfd, const char *path, void *how, size_t size) __asm__("openat2");
|
||||
int bl_openat2(int dirfd, const char *path, void *how, size_t size) {
|
||||
int dd_openat2(int dirfd, const char *path, void *how, size_t size) __asm__("openat2");
|
||||
int dd_openat2(int dirfd, const char *path, void *how, size_t size) {
|
||||
long args[6] = {dirfd, (long)path, (long)how, (long)size, 0, 0};
|
||||
return (int)openat2_call(args);
|
||||
}
|
||||
|
||||
int bl_writewatch_syscall(long number, const long *args, long (*real)(long, ...), long *rc) __attribute__((visibility("hidden")));
|
||||
int bl_clock_syscall(long number, const long *args, long (*real)(long, ...), long *ret) __attribute__((visibility("hidden")));
|
||||
int dd_writewatch_syscall(long number, const long *args, long (*real)(long, ...), long *rc) __attribute__((visibility("hidden")));
|
||||
int dd_clock_syscall(long number, const long *args, long (*real)(long, ...), long *ret) __attribute__((visibility("hidden")));
|
||||
|
||||
long syscall(long number, ...) {
|
||||
va_list ap;
|
||||
@@ -374,16 +374,16 @@ long syscall(long number, ...) {
|
||||
return 0;
|
||||
}
|
||||
long handled;
|
||||
if (bl_fsync_syscall(number, args, &handled)) {
|
||||
if (dd_fsync_syscall(number, args, &handled)) {
|
||||
return handled;
|
||||
}
|
||||
if (!real_syscall) {
|
||||
real_syscall = (long (*)(long, ...)) dlsym(RTLD_NEXT, "syscall");
|
||||
}
|
||||
if (bl_clock_syscall(number, args, real_syscall, &handled)) {
|
||||
if (dd_clock_syscall(number, args, real_syscall, &handled)) {
|
||||
return handled;
|
||||
}
|
||||
if (bl_writewatch_syscall(number, args, real_syscall, &handled)) {
|
||||
if (dd_writewatch_syscall(number, args, real_syscall, &handled)) {
|
||||
return handled;
|
||||
}
|
||||
if (number == SYS_openat2) {
|
||||
@@ -392,8 +392,8 @@ long syscall(long number, ...) {
|
||||
if (number == SYS_openat) {
|
||||
return path_open((int)args[0], (const char *)args[1], (int)args[2], args[3]);
|
||||
}
|
||||
if (number == BL_SYS_FSTATAT) {
|
||||
return path_stat((int)args[0], (const char *)args[1], (bl_stat *)args[2], (int)args[3]);
|
||||
if (number == DD_SYS_FSTATAT) {
|
||||
return path_stat((int)args[0], (const char *)args[1], (dd_stat *)args[2], (int)args[3]);
|
||||
}
|
||||
if (number == SYS_readlinkat) {
|
||||
return path_readlink((int)args[0], (const char *)args[1], (char *)args[2], (size_t)args[3]);
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
#include "../../../app/src/main/cpp/venc/venc_proto.h"
|
||||
|
||||
int bl_venc_streaming(void) __attribute__((visibility("hidden")));
|
||||
int bl_venc_connect(void) __attribute__((visibility("hidden")));
|
||||
int dd_venc_streaming(void) __attribute__((visibility("hidden")));
|
||||
int dd_venc_connect(void) __attribute__((visibility("hidden")));
|
||||
|
||||
static pthread_mutex_t rt_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static int rt_fd = -1, rt_down, rt_x, rt_y, rt_screen;
|
||||
@@ -18,10 +18,10 @@ static int rt_fd = -1, rt_down, rt_x, rt_y, rt_screen;
|
||||
static int rt_enabled(void) {
|
||||
static int enabled = -1;
|
||||
if (enabled < 0) {
|
||||
const char *v = getenv("BL_REMOTE_TOUCH");
|
||||
const char *v = getenv("DD_REMOTE_TOUCH");
|
||||
enabled = v == NULL || strcmp(v, "0") != 0;
|
||||
}
|
||||
return enabled && bl_venc_streaming();
|
||||
return enabled && dd_venc_streaming();
|
||||
}
|
||||
|
||||
static uint32_t rt_fraction(int value, int extent) {
|
||||
@@ -40,7 +40,7 @@ static void rt_send(void *dpy, uint32_t action) {
|
||||
.x = rt_fraction(rt_x, width(dpy, rt_screen)), .y = rt_fraction(rt_y, height(dpy, rt_screen)),
|
||||
};
|
||||
for (int attempt = 0; attempt < 2; attempt++) {
|
||||
if (rt_fd < 0) rt_fd = bl_venc_connect();
|
||||
if (rt_fd < 0) rt_fd = dd_venc_connect();
|
||||
if (rt_fd < 0) return;
|
||||
if (send(rt_fd, &m, sizeof m, MSG_NOSIGNAL) == (ssize_t)sizeof m) return;
|
||||
close(rt_fd);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <sys/statvfs.h>
|
||||
|
||||
static const char *content_of(const char *path, char *buf, size_t len) {
|
||||
const char *roots = getenv("BL_LIBRARY_SPACE");
|
||||
const char *roots = getenv("DD_LIBRARY_SPACE");
|
||||
if (!path || !roots || !*roots)
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
static int (*next_fstat)(int, struct stat *);
|
||||
void bl_storage_owner(int fd, struct stat *st) __attribute__((visibility("hidden")));
|
||||
void dd_storage_owner(int fd, struct stat *st) __attribute__((visibility("hidden")));
|
||||
static int (*next_fallocate)(int, int, off_t, off_t);
|
||||
static int (*next_posix_fallocate)(int, off_t, off_t);
|
||||
static ssize_t (*next_pwrite)(int, const void *, size_t, off_t);
|
||||
@@ -59,8 +59,8 @@ static void initialize(void) {
|
||||
while (__atomic_load_n(&init_state, __ATOMIC_ACQUIRE) != 2) { }
|
||||
return;
|
||||
}
|
||||
const char *on = getenv("BL_STORAGE_DIAGNOSTICS");
|
||||
const char *device = getenv("BL_STORAGE_DEVICE");
|
||||
const char *on = getenv("DD_STORAGE_DIAGNOSTICS");
|
||||
const char *device = getenv("DD_STORAGE_DEVICE");
|
||||
if (on != NULL && strcmp(on, "1") == 0 && device != NULL && *device != '\0') {
|
||||
char *end = NULL;
|
||||
errno = 0;
|
||||
@@ -105,7 +105,7 @@ static void comm_name(char *out, size_t size) {
|
||||
}
|
||||
|
||||
static void append_line(const char *line, size_t length) {
|
||||
const char *path = getenv("BL_STORAGE_LOG");
|
||||
const char *path = getenv("DD_STORAGE_LOG");
|
||||
struct stat st;
|
||||
int saved = errno;
|
||||
if (path == NULL || *path == '\0' || length == 0 || length > 2048) goto done;
|
||||
@@ -288,7 +288,7 @@ int fstat(int fd, struct stat *out) {
|
||||
errno = entry_errno;
|
||||
if (!enabled) {
|
||||
int result = next_fstat(fd, out);
|
||||
if (result == 0) bl_storage_owner(fd, out);
|
||||
if (result == 0) dd_storage_owner(fd, out);
|
||||
return result;
|
||||
}
|
||||
uint64_t start = now_ns();
|
||||
@@ -296,7 +296,7 @@ int fstat(int fd, struct stat *out) {
|
||||
int result = next_fstat(fd, out);
|
||||
int call_errno = errno;
|
||||
uint64_t elapsed = now_ns() - start;
|
||||
if (result == 0) bl_storage_owner(fd, out);
|
||||
if (result == 0) dd_storage_owner(fd, out);
|
||||
if (result == 0 && on_selected_device(fd, out)) {
|
||||
add(&stats.fstat_calls, 1);
|
||||
add(&stats.fstat_elapsed_ns, elapsed);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* tools/linuxfs/preload/subreaper.c
|
||||
*
|
||||
* Mark every process that loads libblsession.so as a child subreaper.
|
||||
* Mark every process that loads libddsession.so as a child subreaper.
|
||||
*
|
||||
* wlroots starts Xwayland with a double fork: gamescope -> middle process
|
||||
* (exits immediately) -> Xwayland. With no subreaper in the tree, Xwayland
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <sys/prctl.h>
|
||||
|
||||
__attribute__((constructor))
|
||||
static void bl_session_set_subreaper(void)
|
||||
static void dd_session_set_subreaper(void)
|
||||
{
|
||||
(void)prctl(PR_SET_CHILD_SUBREAPER, 1);
|
||||
}
|
||||
@@ -48,7 +48,7 @@ static char g_dir[PATH_MAX - NAME_MAX - 2];
|
||||
|
||||
static const char *object_dir(void) {
|
||||
if (!g_dir[0]) {
|
||||
const char *d = getenv("BL_SYSV_DIR");
|
||||
const char *d = getenv("DD_SYSV_DIR");
|
||||
snprintf(g_dir, sizeof(g_dir), "%s", d && *d ? d : DIR_DEFAULT);
|
||||
mkdir(g_dir, 0700);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#define STATUS_MAX 16384
|
||||
#define TRACER_FIELD "\nTracerPid:\t"
|
||||
|
||||
int bl_from_ntdll(const void *caller) __attribute__((visibility("hidden")));
|
||||
int dd_from_ntdll(const void *caller) __attribute__((visibility("hidden")));
|
||||
|
||||
static const char *skip_digits(const char *s) {
|
||||
const char *end = s;
|
||||
@@ -41,7 +41,7 @@ static int is_web_helper(const void *caller) {
|
||||
if (strcmp(program_invocation_short_name, "steamwebhelper") != 0 &&
|
||||
strcmp(program_invocation_short_name, "vrwebhelper") != 0)
|
||||
return 0;
|
||||
const char *hide = getenv("BL_WEBHELPER_HIDE_TRACER");
|
||||
const char *hide = getenv("DD_WEBHELPER_HIDE_TRACER");
|
||||
Dl_info info;
|
||||
if (hide && hide[0] == '1' && caller && dladdr(caller, &info) && info.dli_fname
|
||||
&& strstr(info.dli_fname, "libtier0_s.so"))
|
||||
@@ -72,14 +72,14 @@ static int read_only_copy(const char *data, size_t len, int flags) {
|
||||
return ro;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_status_without_tracer(const char *path, int flags, const void *caller) {
|
||||
__attribute__((visibility("hidden"))) int dd_status_without_tracer(const char *path, int flags, const void *caller) {
|
||||
char text[STATUS_MAX];
|
||||
size_t len = 0;
|
||||
int saved = errno;
|
||||
int out = -1;
|
||||
|
||||
long pid;
|
||||
if ((flags & O_ACCMODE) != O_RDONLY || (pid = status_pid(path)) < 0 || is_web_helper(caller) || bl_from_ntdll(caller))
|
||||
if ((flags & O_ACCMODE) != O_RDONLY || (pid = status_pid(path)) < 0 || is_web_helper(caller) || dd_from_ntdll(caller))
|
||||
return -1;
|
||||
// through the next open(): the native userland's hook gives the app's ids as root's there
|
||||
static int (*next_open)(const char *, int, ...) = NULL;
|
||||
|
||||
@@ -102,17 +102,17 @@ static int make_stand_in(int type) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_nl_socket(int type, int *fd);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_owns(int fd);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_getsockname(int fd, struct sockaddr *addr,
|
||||
__attribute__((visibility("hidden"))) int dd_nl_socket(int type, int *fd);
|
||||
__attribute__((visibility("hidden"))) int dd_nl_owns(int fd);
|
||||
__attribute__((visibility("hidden"))) int dd_nl_getsockname(int fd, struct sockaddr *addr,
|
||||
socklen_t *len, int *rc);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_getpeername(int fd, struct sockaddr *addr,
|
||||
__attribute__((visibility("hidden"))) int dd_nl_getpeername(int fd, struct sockaddr *addr,
|
||||
socklen_t *len, int *rc);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_setsockopt(int fd, int level, int option,
|
||||
__attribute__((visibility("hidden"))) int dd_nl_setsockopt(int fd, int level, int option,
|
||||
const void *value, socklen_t len,
|
||||
int (*real)(int, int, int, const void *, socklen_t),
|
||||
int *rc);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_getsockopt(int fd, int level, int option,
|
||||
__attribute__((visibility("hidden"))) int dd_nl_getsockopt(int fd, int level, int option,
|
||||
void *value, socklen_t *len,
|
||||
int (*real)(int, int, int, void *, socklen_t *),
|
||||
int *rc);
|
||||
@@ -128,7 +128,7 @@ int socket(int domain, int type, int protocol) {
|
||||
}
|
||||
if (domain == AF_NETLINK && protocol == NETLINK_ROUTE) {
|
||||
int route_fd;
|
||||
bl_nl_socket(type, &route_fd);
|
||||
dd_nl_socket(type, &route_fd);
|
||||
return route_fd;
|
||||
}
|
||||
fd = real_socket(domain, type, protocol);
|
||||
@@ -142,7 +142,7 @@ int socket(int domain, int type, int protocol) {
|
||||
return make_stand_in(type);
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_udevmon_stand_in(int fd) {
|
||||
__attribute__((visibility("hidden"))) int dd_udevmon_stand_in(int fd) {
|
||||
return is_stand_in(fd);
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ int getsockname(int fd, struct sockaddr *addr, socklen_t *len) {
|
||||
struct sockaddr_nl nl;
|
||||
int route_rc;
|
||||
|
||||
if (bl_nl_getsockname(fd, addr, len, &route_rc)) return route_rc;
|
||||
if (dd_nl_getsockname(fd, addr, len, &route_rc)) return route_rc;
|
||||
if (is_stand_in(fd)) {
|
||||
if (addr == NULL || len == NULL) {
|
||||
errno = EFAULT;
|
||||
@@ -175,7 +175,7 @@ int getsockname(int fd, struct sockaddr *addr, socklen_t *len) {
|
||||
int getpeername(int fd, struct sockaddr *addr, socklen_t *len) {
|
||||
static int (*real)(int, struct sockaddr *, socklen_t *);
|
||||
int route_rc;
|
||||
if (bl_nl_getpeername(fd, addr, len, &route_rc)) return route_rc;
|
||||
if (dd_nl_getpeername(fd, addr, len, &route_rc)) return route_rc;
|
||||
if (real == NULL) real = dlsym(RTLD_NEXT, "getpeername");
|
||||
return real(fd, addr, len);
|
||||
}
|
||||
@@ -189,7 +189,7 @@ int setsockopt(int fd, int level, int optname, const void *optval, socklen_t opt
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
if (bl_nl_setsockopt(fd, level, optname, optval, optlen, real_setsockopt, &route_rc)) return route_rc;
|
||||
if (dd_nl_setsockopt(fd, level, optname, optval, optlen, real_setsockopt, &route_rc)) return route_rc;
|
||||
if (is_stand_in(fd)) {
|
||||
if (level == SOL_NETLINK)
|
||||
return 0;
|
||||
@@ -207,7 +207,7 @@ int getsockopt(int fd, int level, int option, void *value, socklen_t *len) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
if (bl_nl_getsockopt(fd, level, option, value, len, real, &route_rc)) return route_rc;
|
||||
if (dd_nl_getsockopt(fd, level, option, value, len, real, &route_rc)) return route_rc;
|
||||
return real(fd, level, option, value, len);
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ static unsigned murmur_hash2(const char *key, size_t len) {
|
||||
return h;
|
||||
}
|
||||
|
||||
__attribute__((visibility("default"))) int bl_udevmon_inject(const char *action, const char *devpath,
|
||||
__attribute__((visibility("default"))) int dd_udevmon_inject(const char *action, const char *devpath,
|
||||
const char *subsystem, const char *devname,
|
||||
unsigned major, unsigned minor) {
|
||||
static unsigned long long seqnum = 900000;
|
||||
@@ -280,7 +280,7 @@ __attribute__((visibility("default"))) int bl_udevmon_inject(const char *action,
|
||||
return sent;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_udevmon_recvmsg(int fd, struct msghdr *msg, int flags,
|
||||
__attribute__((visibility("hidden"))) int dd_udevmon_recvmsg(int fd, struct msghdr *msg, int flags,
|
||||
ssize_t (*real_recvmsg)(int, struct msghdr *, int),
|
||||
ssize_t *result) {
|
||||
if (!is_stand_in(fd)) return 0;
|
||||
|
||||
@@ -28,7 +28,7 @@ static int find_ntdll(struct dl_phdr_info *info, size_t size, void *data) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_from_ntdll(const void *caller) {
|
||||
__attribute__((visibility("hidden"))) int dd_from_ntdll(const void *caller) {
|
||||
uintptr_t pc = (uintptr_t)caller, lo = __atomic_load_n(&ntdll_lo, __ATOMIC_ACQUIRE);
|
||||
if (!lo) {
|
||||
dl_iterate_phdr(find_ntdll, NULL);
|
||||
@@ -42,53 +42,53 @@ __attribute__((visibility("hidden"))) int bl_from_ntdll(const void *caller) {
|
||||
#include <asm/hwcap.h>
|
||||
#include <asm/sigcontext.h>
|
||||
|
||||
#define BL_STR2(x) #x
|
||||
#define BL_STR(x) BL_STR2(x)
|
||||
#define DD_STR2(x) #x
|
||||
#define DD_STR(x) DD_STR2(x)
|
||||
|
||||
#define BL_HWCAP_GCS (1UL << 32)
|
||||
#define BL_FRAME_SIZE 4688
|
||||
#define BL_REGS 312
|
||||
#define BL_SP 560
|
||||
#define BL_PC 568
|
||||
#define BL_PSTATE 576
|
||||
#define BL_FPSIMD 592
|
||||
#define DD_HWCAP_GCS (1UL << 32)
|
||||
#define DD_FRAME_SIZE 4688
|
||||
#define DD_REGS 312
|
||||
#define DD_SP 560
|
||||
#define DD_PC 568
|
||||
#define DD_PSTATE 576
|
||||
#define DD_FPSIMD 592
|
||||
|
||||
struct bl_sigframe {
|
||||
struct dd_sigframe {
|
||||
siginfo_t info;
|
||||
ucontext_t uc;
|
||||
};
|
||||
|
||||
struct bl_kernel_sigaction {
|
||||
struct dd_kernel_sigaction {
|
||||
void (*handler)(int, siginfo_t *, void *);
|
||||
unsigned long flags;
|
||||
void *restorer;
|
||||
uint64_t mask;
|
||||
};
|
||||
|
||||
struct bl_usr2_call {
|
||||
struct dd_usr2_call {
|
||||
void (*handler)(int, siginfo_t *, void *);
|
||||
uint64_t old_mask;
|
||||
};
|
||||
|
||||
_Static_assert(sizeof(struct bl_sigframe) == BL_FRAME_SIZE, "rt_sigframe size");
|
||||
_Static_assert(offsetof(struct bl_sigframe, uc.uc_mcontext.regs) == BL_REGS, "regs offset");
|
||||
_Static_assert(offsetof(struct bl_sigframe, uc.uc_mcontext.sp) == BL_SP, "sp offset");
|
||||
_Static_assert(offsetof(struct bl_sigframe, uc.uc_mcontext.pc) == BL_PC, "pc offset");
|
||||
_Static_assert(offsetof(struct bl_sigframe, uc.uc_mcontext.pstate) == BL_PSTATE, "pstate offset");
|
||||
_Static_assert(offsetof(struct bl_sigframe, uc.uc_mcontext.__reserved) == BL_FPSIMD, "reserved offset");
|
||||
_Static_assert(sizeof(struct dd_sigframe) == DD_FRAME_SIZE, "rt_sigframe size");
|
||||
_Static_assert(offsetof(struct dd_sigframe, uc.uc_mcontext.regs) == DD_REGS, "regs offset");
|
||||
_Static_assert(offsetof(struct dd_sigframe, uc.uc_mcontext.sp) == DD_SP, "sp offset");
|
||||
_Static_assert(offsetof(struct dd_sigframe, uc.uc_mcontext.pc) == DD_PC, "pc offset");
|
||||
_Static_assert(offsetof(struct dd_sigframe, uc.uc_mcontext.pstate) == DD_PSTATE, "pstate offset");
|
||||
_Static_assert(offsetof(struct dd_sigframe, uc.uc_mcontext.__reserved) == DD_FPSIMD, "reserved offset");
|
||||
_Static_assert(sizeof(struct fpsimd_context) + sizeof(struct _aarch64_ctx) <=
|
||||
sizeof(((mcontext_t *)0)->__reserved), "reserved space");
|
||||
|
||||
__attribute__((visibility("hidden"))) void bl_usr2_frame(struct bl_usr2_call *call);
|
||||
__attribute__((visibility("hidden"), used)) void bl_usr2_run(struct bl_usr2_call *call, struct bl_sigframe *frame);
|
||||
__attribute__((visibility("hidden"))) void dd_usr2_frame(struct dd_usr2_call *call);
|
||||
__attribute__((visibility("hidden"), used)) void dd_usr2_run(struct dd_usr2_call *call, struct dd_sigframe *frame);
|
||||
|
||||
__asm__(".text\n"
|
||||
".p2align 2\n"
|
||||
".type bl_usr2_frame, %function\n"
|
||||
"bl_usr2_frame:\n"
|
||||
" mov x16, #" BL_STR(BL_FRAME_SIZE) "\n"
|
||||
".type dd_usr2_frame, %function\n"
|
||||
"dd_usr2_frame:\n"
|
||||
" mov x16, #" DD_STR(DD_FRAME_SIZE) "\n"
|
||||
" sub sp, sp, x16\n"
|
||||
" add x17, sp, #" BL_STR(BL_REGS) "\n"
|
||||
" add x17, sp, #" DD_STR(DD_REGS) "\n"
|
||||
" stp x0, x1, [x17, #0]\n"
|
||||
" stp x2, x3, [x17, #16]\n"
|
||||
" stp x4, x5, [x17, #32]\n"
|
||||
@@ -107,12 +107,12 @@ __asm__(".text\n"
|
||||
" str x30, [x17, #240]\n"
|
||||
" str xzr, [x17, #0]\n"
|
||||
" add x16, sp, x16\n"
|
||||
" str x16, [sp, #" BL_STR(BL_SP) "]\n"
|
||||
" str x16, [sp, #" DD_STR(DD_SP) "]\n"
|
||||
" adr x16, 1f\n"
|
||||
" str x16, [sp, #" BL_STR(BL_PC) "]\n"
|
||||
" str x16, [sp, #" DD_STR(DD_PC) "]\n"
|
||||
" mrs x16, nzcv\n"
|
||||
" str x16, [sp, #" BL_STR(BL_PSTATE) "]\n"
|
||||
" add x17, sp, #" BL_STR(BL_FPSIMD) "\n"
|
||||
" str x16, [sp, #" DD_STR(DD_PSTATE) "]\n"
|
||||
" add x17, sp, #" DD_STR(DD_FPSIMD) "\n"
|
||||
" mrs x16, fpsr\n"
|
||||
" str w16, [x17, #8]\n"
|
||||
" mrs x16, fpcr\n"
|
||||
@@ -134,13 +134,13 @@ __asm__(".text\n"
|
||||
" stp q28, q29, [x17, #464]\n"
|
||||
" stp q30, q31, [x17, #496]\n"
|
||||
" mov x1, sp\n"
|
||||
" bl bl_usr2_run\n"
|
||||
" mov x8, #" BL_STR(__NR_rt_sigreturn) "\n"
|
||||
" bl dd_usr2_run\n"
|
||||
" mov x8, #" DD_STR(__NR_rt_sigreturn) "\n"
|
||||
" svc #0\n"
|
||||
" brk #0\n"
|
||||
"1:\n"
|
||||
" ret\n"
|
||||
".size bl_usr2_frame, .-bl_usr2_frame\n");
|
||||
".size dd_usr2_frame, .-dd_usr2_frame\n");
|
||||
|
||||
static int (*usr2_real_raise)(int);
|
||||
|
||||
@@ -160,7 +160,7 @@ static uint64_t usr2_ssbs(void) {
|
||||
return value & (1UL << 12);
|
||||
}
|
||||
|
||||
void bl_usr2_run(struct bl_usr2_call *call, struct bl_sigframe *frame) {
|
||||
void dd_usr2_run(struct dd_usr2_call *call, struct dd_sigframe *frame) {
|
||||
struct fpsimd_context *fp = (struct fpsimd_context *)frame->uc.uc_mcontext.__reserved;
|
||||
struct _aarch64_ctx *end = (struct _aarch64_ctx *)(fp + 1);
|
||||
|
||||
@@ -192,11 +192,11 @@ int raise(int sig) {
|
||||
real = (int (*)(int))dlsym(RTLD_NEXT, "raise");
|
||||
__atomic_store_n(&usr2_real_raise, real, __ATOMIC_RELEASE);
|
||||
}
|
||||
if (sig != SIGUSR2 || (getauxval(AT_HWCAP) & BL_HWCAP_GCS) || !bl_from_ntdll(__builtin_return_address(0))) {
|
||||
if (sig != SIGUSR2 || (getauxval(AT_HWCAP) & DD_HWCAP_GCS) || !dd_from_ntdll(__builtin_return_address(0))) {
|
||||
return real(sig);
|
||||
}
|
||||
|
||||
struct bl_kernel_sigaction action;
|
||||
struct dd_kernel_sigaction action;
|
||||
if (usr2_sys(__NR_rt_sigaction, SIGUSR2, 0, (long)&action, sizeof(action.mask)) != 0) return real(sig);
|
||||
if (!(action.flags & SA_SIGINFO) || (action.flags & SA_RESETHAND) || (uintptr_t)action.handler <= 1) {
|
||||
return real(sig);
|
||||
@@ -204,7 +204,7 @@ int raise(int sig) {
|
||||
|
||||
uint64_t bit = 1ULL << (SIGUSR2 - 1);
|
||||
uint64_t block = action.mask | ((action.flags & SA_NODEFER) ? 0 : bit);
|
||||
struct bl_usr2_call call = {action.handler, 0};
|
||||
struct dd_usr2_call call = {action.handler, 0};
|
||||
if (usr2_sys(__NR_rt_sigprocmask, SIG_BLOCK, (long)&block, (long)&call.old_mask, sizeof(block)) != 0) {
|
||||
return real(sig);
|
||||
}
|
||||
@@ -212,7 +212,7 @@ int raise(int sig) {
|
||||
usr2_sys(__NR_rt_sigprocmask, SIG_SETMASK, (long)&call.old_mask, 0, sizeof(call.old_mask));
|
||||
return real(sig);
|
||||
}
|
||||
bl_usr2_frame(&call);
|
||||
dd_usr2_frame(&call);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <poll.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined(__aarch64__) || defined(BL_VDEC_ANY_ARCH)
|
||||
#if defined(__aarch64__) || defined(DD_VDEC_ANY_ARCH)
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <linux/videodev2.h>
|
||||
@@ -220,12 +220,12 @@ static int vd_have_ffmpeg(void) {
|
||||
return vd_ffmpeg > 0;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_venc_connect(void);
|
||||
__attribute__((visibility("hidden"))) int dd_venc_connect(void);
|
||||
|
||||
static int vd_enabled(void) {
|
||||
pthread_mutex_lock(&vd_lock);
|
||||
if (vd_state == 0) {
|
||||
const char *flag = getenv("BL_REMOTE_PLAY_DECODE"), *socket = getenv("BL_VENC_SOCKET");
|
||||
const char *flag = getenv("DD_REMOTE_PLAY_DECODE"), *socket = getenv("DD_VENC_SOCKET");
|
||||
vd_state = -1;
|
||||
if (strcmp(program_invocation_short_name, "streaming_client") == 0 && (flag == NULL || strcmp(flag, "0") != 0)) {
|
||||
vd_heap = open("/dev/dma_heap/system", O_RDONLY | O_CLOEXEC);
|
||||
@@ -245,7 +245,7 @@ static struct vdec *vd_find(int fd) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_vdec_open(const char *path, int flags) {
|
||||
__attribute__((visibility("hidden"))) int dd_vdec_open(const char *path, int flags) {
|
||||
(void)flags;
|
||||
if (path == NULL || strcmp(path, VDEC_DEVICE) != 0 || !vd_enabled()) return -2;
|
||||
int fd = memfd_create("droiddeck-vdec", 0);
|
||||
@@ -314,7 +314,7 @@ static void vd_send_capture(struct vdec *v, uint32_t index) {
|
||||
|
||||
static int vd_open_hardware(struct vdec *v) {
|
||||
if (v->hw_failed) return -1;
|
||||
int sock = bl_venc_connect();
|
||||
int sock = dd_venc_connect();
|
||||
if (sock < 0) return -1;
|
||||
struct vdec_config c = {
|
||||
.type = VDEC_CONFIG, .codec = v->fourcc == V4L2_PIX_FMT_HEVC ? VENC_HEVC : VENC_H264,
|
||||
@@ -740,7 +740,7 @@ static int vd_ioctl(struct vdec *v, unsigned long req, void *arg) {
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_vdec_ioctl(int fd, unsigned long req, void *arg, int *rc) {
|
||||
__attribute__((visibility("hidden"))) int dd_vdec_ioctl(int fd, unsigned long req, void *arg, int *rc) {
|
||||
struct vdec *v = vd_find(fd);
|
||||
if (v == NULL) return 0;
|
||||
pthread_mutex_lock(&vd_lock);
|
||||
@@ -755,7 +755,7 @@ __attribute__((visibility("hidden"))) int bl_vdec_ioctl(int fd, unsigned long re
|
||||
return 1;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) void bl_vdec_closed(int fd) {
|
||||
__attribute__((visibility("hidden"))) void dd_vdec_closed(int fd) {
|
||||
struct vdec *v = vd_find(fd);
|
||||
if (v == NULL) return;
|
||||
pthread_mutex_lock(&vd_lock);
|
||||
@@ -768,7 +768,7 @@ __attribute__((visibility("hidden"))) void bl_vdec_closed(int fd) {
|
||||
pthread_mutex_unlock(&vd_lock);
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_vdec_poll(struct pollfd *fds, nfds_t n, int timeout_ms,
|
||||
__attribute__((visibility("hidden"))) int dd_vdec_poll(struct pollfd *fds, nfds_t n, int timeout_ms,
|
||||
int (*real)(struct pollfd *, nfds_t, int), int *ret) {
|
||||
if (n != 1 || vd_find(fds[0].fd) == NULL) return 0;
|
||||
struct vdec *v = vd_find(fds[0].fd);
|
||||
@@ -949,13 +949,13 @@ void SDL_UnloadObject(void *handle) {
|
||||
|
||||
#else
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_vdec_open(const char *path, int flags) {
|
||||
__attribute__((visibility("hidden"))) int dd_vdec_open(const char *path, int flags) {
|
||||
(void)path;
|
||||
(void)flags;
|
||||
return -2;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_vdec_ioctl(int fd, unsigned long req, void *arg, int *rc) {
|
||||
__attribute__((visibility("hidden"))) int dd_vdec_ioctl(int fd, unsigned long req, void *arg, int *rc) {
|
||||
(void)fd;
|
||||
(void)req;
|
||||
(void)arg;
|
||||
@@ -963,9 +963,9 @@ __attribute__((visibility("hidden"))) int bl_vdec_ioctl(int fd, unsigned long re
|
||||
return 0;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) void bl_vdec_closed(int fd) { (void)fd; }
|
||||
__attribute__((visibility("hidden"))) void dd_vdec_closed(int fd) { (void)fd; }
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_vdec_poll(struct pollfd *fds, nfds_t n, int timeout_ms,
|
||||
__attribute__((visibility("hidden"))) int dd_vdec_poll(struct pollfd *fds, nfds_t n, int timeout_ms,
|
||||
int (*real)(struct pollfd *, nfds_t, int), int *ret) {
|
||||
(void)fds;
|
||||
(void)n;
|
||||
|
||||
@@ -115,14 +115,14 @@ static void vn_free_queue(struct vq *q) {
|
||||
memset(q, 0, sizeof *q);
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_venc_streaming(void) {
|
||||
__attribute__((visibility("hidden"))) int dd_venc_streaming(void) {
|
||||
return __atomic_load_n(&vn_open_count, __ATOMIC_ACQUIRE) > 0;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_venc_connect(void);
|
||||
__attribute__((visibility("hidden"))) int dd_venc_connect(void);
|
||||
|
||||
int bl_venc_connect(void) {
|
||||
const char *path = getenv("BL_VENC_SOCKET");
|
||||
int dd_venc_connect(void) {
|
||||
const char *path = getenv("DD_VENC_SOCKET");
|
||||
if (path == NULL || *path == '\0') return -1;
|
||||
struct sockaddr_un addr = { .sun_family = AF_UNIX };
|
||||
if (strlen(path) >= sizeof addr.sun_path) return -1;
|
||||
@@ -138,10 +138,10 @@ int bl_venc_connect(void) {
|
||||
return fd;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_venc_open(const char *path, int flags) {
|
||||
__attribute__((visibility("hidden"))) int dd_venc_open(const char *path, int flags) {
|
||||
(void)flags;
|
||||
if (path == NULL || strcmp(path, VENC_DEVICE) != 0) return -2;
|
||||
int fd = bl_venc_connect();
|
||||
int fd = dd_venc_connect();
|
||||
if (fd < 0) return -2;
|
||||
pthread_mutex_lock(&vn_lock);
|
||||
struct venc *v = NULL;
|
||||
@@ -546,7 +546,7 @@ static int vn_ioctl(struct venc *v, unsigned long req, void *arg) {
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_venc_ioctl(int fd, unsigned long req, void *arg, int *rc) {
|
||||
__attribute__((visibility("hidden"))) int dd_venc_ioctl(int fd, unsigned long req, void *arg, int *rc) {
|
||||
struct venc *v = vn_find(fd);
|
||||
if (v == NULL) return 0;
|
||||
pthread_mutex_lock(&vn_lock);
|
||||
@@ -561,7 +561,7 @@ __attribute__((visibility("hidden"))) int bl_venc_ioctl(int fd, unsigned long re
|
||||
return 1;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_venc_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off,
|
||||
__attribute__((visibility("hidden"))) int dd_venc_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off,
|
||||
void *(*real)(void *, size_t, int, int, int, off_t), void **out) {
|
||||
struct venc *v = vn_find(fd);
|
||||
if (v == NULL) return 0;
|
||||
@@ -579,7 +579,7 @@ __attribute__((visibility("hidden"))) int bl_venc_mmap(void *addr, size_t len, i
|
||||
return 1;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) void bl_venc_closed(int fd) {
|
||||
__attribute__((visibility("hidden"))) void dd_venc_closed(int fd) {
|
||||
struct venc *v = vn_find(fd);
|
||||
if (v == NULL) return;
|
||||
pthread_mutex_lock(&vn_lock);
|
||||
@@ -623,14 +623,14 @@ static int vn_poll(struct pollfd *fds, nfds_t n, int timeout_ms, int (*real)(str
|
||||
return r + ready;
|
||||
}
|
||||
|
||||
__attribute__((weak, visibility("hidden"))) int bl_vdec_poll(struct pollfd *fds, nfds_t n, int timeout_ms,
|
||||
__attribute__((weak, visibility("hidden"))) int dd_vdec_poll(struct pollfd *fds, nfds_t n, int timeout_ms,
|
||||
int (*real)(struct pollfd *, nfds_t, int), int *ret);
|
||||
|
||||
int poll(struct pollfd *fds, nfds_t n, int timeout_ms) {
|
||||
static int (*real)(struct pollfd *, nfds_t, int);
|
||||
if (!real) real = (int (*)(struct pollfd *, nfds_t, int))dlsym(RTLD_NEXT, "poll");
|
||||
int ret;
|
||||
if (bl_vdec_poll && bl_vdec_poll(fds, n, timeout_ms, real, &ret)) return ret;
|
||||
if (dd_vdec_poll && dd_vdec_poll(fds, n, timeout_ms, real, &ret)) return ret;
|
||||
if (__atomic_load_n(&vn_open_count, __ATOMIC_ACQUIRE) == 0) return real(fds, n, timeout_ms);
|
||||
return vn_poll(fds, n, timeout_ms, real);
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
extern char **environ;
|
||||
|
||||
__attribute__((constructor)) static void bl_venus_keep_kopper(void) {
|
||||
__attribute__((constructor)) static void dd_venus_keep_kopper(void) {
|
||||
static const char name[] = "LIBGL_KOPPER_DISABLE=";
|
||||
const char *debug = getenv("VN_DEBUG");
|
||||
if (!debug || !strstr(debug, "vtest") || !environ) return;
|
||||
|
||||
@@ -57,10 +57,10 @@ static char *const *chromium_argv(const char *path, char *const argv[]) {
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden")))
|
||||
char *const *bl_webhelper_argv(const char *path, char *const argv[], char *const envp[]) {
|
||||
char *const *dd_webhelper_argv(const char *path, char *const argv[], char *const envp[]) {
|
||||
if (electron_node_mode(envp)) return argv;
|
||||
if (!is_webhelper_browser(path, argv)) return chromium_argv(path, argv);
|
||||
const char *spec = getenv("BL_WEBHELPER_ARGS");
|
||||
const char *spec = getenv("DD_WEBHELPER_ARGS");
|
||||
if (!spec || !*spec) spec = WEBHELPER_DEFAULT;
|
||||
if (!strcmp(spec, "stock")) return argv;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ static int ww_uffd = -1;
|
||||
static int scan_blocked;
|
||||
#endif
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_writewatch_syscall(long number, const long *args, long (*real)(long, ...), long *rc) {
|
||||
__attribute__((visibility("hidden"))) int dd_writewatch_syscall(long number, const long *args, long (*real)(long, ...), long *rc) {
|
||||
#if defined(__aarch64__) && defined(PAGEMAP_SCAN) && defined(UFFD_USER_MODE_ONLY)
|
||||
if (number != WINE_ARM64_USERFAULTFD || (args[0] & ~(long)(O_CLOEXEC | O_NONBLOCK | UFFD_USER_MODE_ONLY))) return 0;
|
||||
*rc = real(SYS_userfaultfd, args[0]);
|
||||
@@ -89,7 +89,7 @@ done:
|
||||
}
|
||||
#endif
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_writewatch_ioctl(int (*real)(int, unsigned long, void *), int fd, unsigned long request,
|
||||
__attribute__((visibility("hidden"))) int dd_writewatch_ioctl(int (*real)(int, unsigned long, void *), int fd, unsigned long request,
|
||||
void *arg, int *rc) {
|
||||
#if defined(PAGEMAP_SCAN) && defined(UFFD_USER_MODE_ONLY)
|
||||
if (request != PAGEMAP_SCAN) return 0;
|
||||
|
||||
@@ -15,7 +15,7 @@ typedef Atom (*intern_atom_fn)(Display *, const char *, Bool);
|
||||
static int following(void) {
|
||||
static int cached = -1;
|
||||
if (cached < 0) {
|
||||
const char *v = getenv("BL_FOLLOW_OUTPUT");
|
||||
const char *v = getenv("DD_FOLLOW_OUTPUT");
|
||||
cached = v && v[0] == '1';
|
||||
}
|
||||
return cached;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#define MADV_PAGEOUT 21
|
||||
#endif
|
||||
#ifndef ZR_CTL
|
||||
#define ZR_CTL "/tmp/.bl-zram"
|
||||
#define ZR_CTL "/tmp/.dd-zram"
|
||||
#endif
|
||||
#define ZR_SWAPPED (1ULL << 62)
|
||||
#define ZR_BATCH 512
|
||||
|
||||
Reference in new issue
Block a user