#79 made update.sh stop Darling again after the overlays and run
configure-darling-platform.py --replace-known-defaults --write. The
rootless update test still expected the old call list and failed. Stub the
identity tool, expect the stop + identity calls last, and check a failed
install never reaches them.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The issue #75 trace shows recording now runs, but Vivox's playback unit
(mic test loopback, other players' voices) sets interleaved Float32 stereo
at 32 kHz on input scope element 0 and got -10868. Apply the relaxed rule
to both client sides (input scope element 0, output scope element 1); the
playback path already interleaves for the device and PulseAudio resamples.
AudioUnitRender(bus 1) now traces frames and peak level (no samples) so a
log shows whether the client pulls sound or silence. The input check also
sets Vivox's playback format and expects unsigned 16-bit to be refused.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
RenderBus pads missing frames with zeros, which is loud for unsigned PCM
(silence is 0x80 for 8-bit, 0x8000 for 16-bit). Reject unsigned and 8-bit
formats on element 1; voice engines use float or signed 16-bit.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
When install-runtime.sh creates the prefix (first-time setup, regular or
Nix), it now runs configure-darling-platform.py --provision --write once
the runtime is stopped, so each new install gets its own synthetic serial,
MLB, UUID and ROM. A prefix counts as new the same way Darling decides it:
the directory did not exist before the first `darling shell`. Existing
prefixes keep their identity on reinstall and update.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Older setups shipped serial C02ZL0GVMD6N and UUID
6F3B2A1E-8C4D-4E5F-9A7B-1D2C3E4F5A6B to every install. After installing,
update.sh now runs configure-darling-platform.py --replace-known-defaults,
which provisions the prefix only when its saved identity still has one of
those values. Other custom values (imported serials/UUIDs, model, board,
manufacturer, ROM, MLB) are kept; prefixes with no saved identity or only
custom values are not touched.
provision() also drops a standalone system-id or provisioning_UDID derived
from the shared UUID instead of keeping it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Vivox sets interleaved Float32 stereo on output scope element 1 and
AUBase's canonical-only rule rejected it with -10868, so voice chat never
started recording (issue #75 trace: 20 attempts, all failing there).
A real AUHAL converts any linear PCM; element 1 now accepts native-endian
float32 or 8/16/32-bit integers in either layout, which PulseAudio records
and RenderBus copies. Playback (element 0) keeps the canonical rule.
The input check gains a Vivox-style run: interleaved stereo 44.1 kHz with
the device set on element 1.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
last_close started at 0.0 and the cooldown compares it with
time.monotonic(), which counts from boot. For the first 30 s of uptime
every close was refused as "in cooldown". That made the tests flaky on
freshly booted CI runners (seen on PR #76). Use None for "never closed".
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The handler read a flag the caller wrote without synchronization, and
inferred "called inside the request" from whether the call had returned,
which misfires when the handler runs on another thread first. Compare the
handler's thread with the caller's instead and keep the shared results
atomic.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Voice chat (Vivox) saw no capture device and Chromium was told mic
access was denied. Fixes for issue #75:
- AVCaptureDevice: audio is Authorized when CoreAudio has a default
input device; requestAccess answers asynchronously. Video stays Denied.
- PulseAudio input device reports 2 channels on input scope, 0 on output
(was copied from the output device).
- PulseAudio input stream: real sample/host timestamps, one device
buffer per IOProc call, holes as silence, IOProc errors no longer cork
the stream, record buffer attrs sized to the device buffer.
- AUHAL: two elements per scope like macOS, non-blocking
AudioUnitRender on bus 1 with planar support, device records in the
bus 1 format, input-only units route CurrentDevice/BufferFrameSize to
the input device, input start errors handled.
- New offline check tools/riot-audio-input-check.cpp.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A long patch or login can keep the League client closed for more than ten
minutes after launch; the helper then left before the first match.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Mesa derives its shader disk cache from $HOME. Inside the guest that is
/Users/<user>, which does not exist on the host filesystem, so Mesa could not
create the cache and disabled it, once per process:
Failed to create /Users/<user> for shader cache (Permission denied)---disabling
One launcher log contained 212 of those lines, and no shader compiled by one
process was reused by another process or by the next start: the client and the
game recompiled every shader on every launch, spending CPU at startup for no
gain.
Mesa is host code loaded into the guest and reads MESA_SHADER_CACHE_DIR verbatim,
so point it at a host directory; Mesa creates mesa_shader_cache/ (client and game
shaders) and radv_builtin_shaders/ below it. A non-empty value from the caller is
preserved, and a directory that cannot be created leaves the previous behaviour
instead of ending the launch.
Observed on a Radeon RX 550 with radv: no shader-cache failure after the change,
and 434 files / 5.6 MB written during one client start, still growing while the
client ran. The cache is reused from the second start on, which lowers the
client's CPU use while it starts; the startup-time gain itself has not been
measured separately.
The client does not come back properly after a match when its own "Close client
during game" option is enabled. The UI (LeagueClientUx and its helpers) is a
Chromium/CEF instance and, under Darling, the pre-match instance keeps running:
the client the backend starts when the match ends is a second CEF instance on the
same --user-data-dir, and its window never paints. Its DOM and audio work and the
window stays black; closing the client by hand during a match leaves the same
state for the same reason.
RCLOL_CLOSE_CLIENT_IN_GAME=1 opts in to closing that UI from the host, and only
while a match runs, so the client that appears afterwards is the only instance.
The UI also competes with the game for CPU: on a four-core host with a Radeon
RX 550 a practice match reported roughly 120 FPS with the UI running and roughly
180 FPS with it closed. This is not the helper-killing memory optimization the
RAM section warns against, and the Riot client, the League backend and the game
are never touched.
The helper fails closed. It attributes the game and the client to the launcher's
prefix through the loader's __mldr_sockpath, since guest processes do not carry
DPREFIX (checked on a live session). It never closes a client younger than 60
seconds (the one the backend starts after a match), preserves a process of
another installation or owner, acts only when the environment and the stat fields
can be read, gives up after three closes in one match, and leaves after ten
minutes without a client or a match. It is off by default.
Tests use fake /proc entries and mock every signal.
Riot's splash screens draw on a black rectangle: LeagueClient's is a
borderless NSWindow with setOpaque:NO and a pattern-image background, the
Riot Client's an Electron BrowserWindow with transparent: true. X11Window
created every window with a 24-bit visual and -setOpaque: only stored the
flag, so there was no alpha channel.
A non-opaque window whose background can show through (alpha below 1, or a
pattern image) now gets the 32-bit ARGB visual. League's game window is
non-opaque on an opaque background and stays on the opaque visual, which
X11IsLeagueGameWindow also enforces. The X window exists before apps set
opacity and background, so the choice is checked again when the first
subwindow is created (layer subwindows inherit the visual) and before the
first map, and the window recreated while unmapped if it changed. Its
background is transparent instead of None, so no black frame shows before
the first draw. Its surface comes from an alpha EGL config for that visual
(CGLGetWindowWithAlpha) and its compositing context from the surface's
config (CGLCreateContextForWindow): NVIDIA refuses the default config on a
32-bit window, and no driver makes a context from it current on the alpha
surface. Without an alpha config the window falls back to the opaque
visual.
A translucent window above the normal level (Electron's alwaysOnTop
splash) is typed _NET_WM_WINDOW_TYPE_SPLASH with _NET_WM_STATE_ABOVE before
it is mapped: window managers float it and draw no frame around it.
Electron's level never arrived, though: CGWindowLevelForKey returned the
normal level for every key, and the SDK turns NSFloatingWindowLevel into a
call to it. It now returns the levels macOS does; Cocotron only stores
levels, so nothing else changes.
Stage a cross-filesystem copy in a private directory instead of deleting a
pre-existing PATH.partial, reject destinations inside the overlay work
directory, save the new path before deleting the old prefix, and verify that
the target keeps user.* xattrs before and after copying. Add tests.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The prefix holds the installed clients and game (about 40 GB). The Nix
launcher always exported DPREFIX=${DPREFIX:-~/.darling}, so the prefix saved
in build/config.json was never used and the only way to move it was an
environment variable in every launch context.
- The launcher uses DPREFIX if set, then the saved prefix, then ~/.darling.
- darling-lol --set-prefix PATH runs scripts/nix-prefix.py in the namespace,
whose root owns the prefix files, so cp -a keeps their owners and xattrs.
It renames the prefix when possible; across filesystems it copies to
PATH.partial and removes the old prefix and its overlay work directory
only after the copy completes. A PATH that already holds a Darling prefix
is used as it is. It refuses non-empty directories that are not prefixes,
nested paths and paths with commas or colons (overlayfs separators), then
saves the path with configure.py --prefix.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The drag loop runs run loop sources and main queue blocks between moves,
and Chromium can tear down a web view or close a window there. Hold both
until the drag ends, after -draggedImage:endedAt:operation:.
With DARLING_METAL_MAC_GPU_NAME=1, MTLDevice.name is the GPU the
MacBookPro16,1 that IOKit reports shipped with, from the host's vendor:
"AMD Radeon Pro 5500M" (vendor 0x1002) or "Intel UHD Graphics 630"
(0x8086). NVIDIA keeps its own name so the game never takes another
vendor's driver paths. recommendedMaxWorkingSetSize and every other value
stay the host's, which was the risky part of #61's identity.
The Riot launcher turns it on by default (0 or empty turns it off); other
Darling apps keep the host name. DARLING_METAL_GPU_NAME still wins.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
system_profiler now answers SPHardwareDataType and SPSoftwareDataType (and
lists them in -listDataTypes). Model, serial number, platform UUID and
provisioning UDID come from IOKit's IOPlatformExpertDevice via ioreg; CPU,
cache and memory from sysctl; the OS version from sw_vers and uname. A
field the guest does not provide is left out.
#61 instead read a separate darling-smbios.conf written by a new
generator (gen-darling-smbios.py), with hardcoded fallbacks (an Intel Core
i9, macOS 14.7, SIP enabled). iokitd reads darling-platform.plist, so
system_profiler and IOKit could report different serials and models on the
same prefix, and the generator overwrote identities imported with
configure-darling-platform.py. Reading the guest's own APIs keeps a single
source of truth: configure-darling-platform.py remains the only way to set
or provision an identity, and it is still never run by install or launch.
tests/test_system_profiler.py runs the script under sh with stub guest
commands and runs in CI.
Split from #61.
Co-authored-by: DevWebeloper <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
From #61, without the default "AMD Radeon Pro 5500M" / 4 GB identity: the
host GPU's name and Vulkan working set stay the default for every app, and
the existing DARLING_METAL_GPU_NAME and DARLING_METAL_VRAM_MB overrides
remain the opt-in. Reporting 4 GB on a 2 GB card invites allocation
failures, and under-reports larger cards.
Kept from #61:
- registryID returns MTLDeviceInfo::kDefaultRegistryID instead of 0; a
real Mac never reports 0 and apps key devices by it.
- Vertex buffer layout and attribute arrays release the old item after
retiring it; the retire step read the item after the release could free it.
- newDepthStencilState, newSamplerState and the device name return nil (or
the fallback name) when Indium throws, instead of unwinding through
Objective-C.
- MTLDepthStencilGetIndium is declared only with DARLING_METAL_ENABLED.
- The replaceRegion trace probes at most `width` bytes, which stays inside
the first row for every pixel format.
metal.patch is regenerated in its existing file order, so the diff is
these changes only. tests/test_metal_device_info.py compiles the host
check against MTLDeviceInfo.h as shipped in the patch and runs in CI.
Split from #61.
Co-authored-by: DevWebeloper <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
After the clients quit, the session kept Darling running: Riot and League
crash handlers never exit under Darling, and the idle check counted them as
clients. Ctrl+C or closing the terminal killed bubblewrap, whose
--die-with-parent then killed nix-lifecycle.py before it could shut Darling
down, which left a live server marker behind.
- nix-idle.py ignores crash handlers when deciding whether a client still
uses the prefix.
- The launcher starts bubblewrap with INT, QUIT, HUP and TERM ignored, and
env restores them inside. The supervisor turns them into a stop request.
- nix-lifecycle.py polls for a signal or stop request and then shuts Darling
down without waiting for clients. It stops retrying a failed shutdown once
the server is gone, and waits for or kills its own command afterwards.
- darling-lol --stop makes the stop request and waits for the session. If
the session does not exit within 30 seconds, or no session holds the lock,
it kills the prefix's darlingserver and launchd like darling shutdown,
after checking that the marker PID is this user's darlingserver for this
prefix.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
RCLOL_FILTER_HOST_ENV=1 makes exec-guest.py drop host session metadata
(WAYLAND_DISPLAY, XDG_SESSION_*, XDG_CURRENT_DESKTOP, GNOME/KDE/GDM,
systemd, SSH agent, terminal, toolkit, Flatpak/Snap/AppImage, exported
shell functions) and set SHELL to the guest's /bin/zsh. It is off by
default; RCLOL_KEEP_HOST_ENV lists names to keep anyway.
Unlike the denylist in #61, the filter runs after the launcher sets its
GPU tuning, keeps everything Darling and the host graphics and audio
libraries read (DISPLAY, XAUTHORITY, XDG_RUNTIME_DIR and the XDG base
directories, D-Bus, PulseAudio/PipeWire/ALSA, DRI_PRIME, MESA_*, __GL_*,
__NV_*, VK_*, LD_PRELOAD for gamemoderun, LD_LIBRARY_PATH), and lives in
one place instead of three.
tests/test_exec_guest.py runs in CI; the launcher check also verifies
that MESA_NO_ERROR=1 and __GL_THREADED_OPTIMIZATIONS=0 reach the guest
with the filter on.
Split from #61.
Co-authored-by: DevWebeloper <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A terminal, IDE or service manager can leave descriptors open in the
launcher, and the guest inherited all of them. tools/exec-guest.py closes
every descriptor above stderr and then execs the guest command.
A shell loop over /proc/self/fd cannot do this portably: dash only parses
single-digit descriptors in redirections, so "exec 10>&-" runs a command
named 10 and ends the launcher on Debian and Ubuntu.
The launcher offline check now leaks descriptors 3, 4, 12 and 200 into the
launcher and asserts the guest sees only 0, 1 and 2. It runs in CI.
Split from #61.
Co-authored-by: DevWebeloper <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The X11 backend has no NSDraggingManager, so -[NSWindow dragImage:...]
returned at once without calling -draggedImage:endedAt:operation:.
Chromium waits for that callback before the page takes mouse input again,
so any HTML5 drag in a CEF/Electron window (the League client's emote
wheel) left the page ignoring the mouse.
NSWindow now runs the drag itself between the app's own windows, with the
drag image under the pointer, and always ends it with the callback.
X11Pasteboard sends the optional -pasteboardChangedOwner: only to owners
that implement it (Chromium's drag source doesn't; the second drag
crashed). NSView's default -prepareForDragOperation: returns YES, as
AppKit does for destinations that don't implement it.
NixOS keeps the GPU driver's EGL vendor files and external-platform files
under /run/opengl-driver, which glvnd and NVIDIA's driver inside the FHS
environment do not search. glvnd then only knows Mesa, and NVIDIA cannot open
X11 displays because its X11 support is the egl-x11 external platform. The
client fell back to Mesa's software rasterizer: garbled text in the client and
no way to present the game's NVIDIA Vulkan frames.
When /run/opengl-driver provides them, prepend those directories to
__EGL_VENDOR_LIBRARY_DIRS and __EGL_EXTERNAL_PLATFORM_CONFIG_DIRS, keeping the
FHS paths and any caller-provided value after them.
Co-Authored-By: Claude Opus 5.5 <[email protected]>