Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,41 @@

All notable changes to TrailBridge VR are documented here.

## Unreleased

- Every Steam game starts in the headset, not only the verified ones. A profile made by Add Steam
Game for any other game used to run `steam.exe -applaunch APP_ID`: Steam then started the game
without the session's environment, so the OpenXR runtime could not reach the streamer, the
headset stayed black and the session ended at once. TrailBridge now starts the game's own
executable, chosen from Steam's launch options in `appinfo.vdf` or from the game folder, with
`SteamAppId` set. Existing profiles need no change.
- The session log says why a session stays headless: the OpenXR runtime names the missing
environment, DXMT build or connection, and the app adds a hint when the started file ends within
seconds, as a launcher that opens the game separately does.
- Setup checks for GStreamer, which Wine uses to play videos in games, and links to the official
package. Diagnostic reports include its status and version when available. Games can still
start without it, with one warning per game session in the log.
- The session log shows the first occurrence of each known harmless GStreamer warning and totals
its repeats when the output closes. Diagnostic reports include repeat counts during a session,
and recordings keep the full output and final counts.
- Each session keeps an excerpt of the game's own log, where the reason for a black headset often
is: Electrician Simulator VR ran and sent frames while only its `Player.log` said that it could
not decode its video. When the session ends, TrailBridge reads a Unity player's `Player.log`
(`output_log.txt` in older versions) or an Unreal game's `Saved/Logs` and keeps the last 200
lines and every line that reports an error, with personal data replaced. If Wine could not be
stopped, the excerpt is still kept and marked as possibly incomplete. The excerpt opens from the
session in Recent Sessions, is listed on the Diagnostics page and can be included in the
diagnostic report; it stays on the Mac.
- Diagnostic redaction covers more Steam ID formats, hides full names in account fields and shows
a game folder outside the Wine C: drive as `[game folder]`.
- When a session ends, the session log gives a short hint for errors whose cause is known, found
in the game's own log or output or in Wine's output: a video the game could not play, pointing
to Setup when GStreamer is missing; OpenVR that could not start, pointing to the game's OpenVR
Support for OpenComposite; OpenXR the game could not start; and a Wine crash. Each hint is given
once, and the diagnostic report lists the hints of recent sessions. GStreamer's harmless
warnings never give one, nor does Unity's refused first request for OpenXR 1.1 when the game's
runtime connects after it.

## 0.2.1 — 2026-11-15

- Setup recognises Rosetta 2 on every macOS version: the check now runs Intel code, as
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ VR does not promise stable operation on them. Other games may work but are not v
## Requirements

- A Mac with Apple Silicon and macOS 14 or newer, with Rosetta 2. Intel Macs are not supported.
- Games that play videos need [GStreamer 1.28.1](https://gstreamer.freedesktop.org/data/pkg/osx/1.28.1/gstreamer-1.0-1.28.1-universal.pkg),
the package recommended for Wine 11.10. Install it with an administrator account, for all
users of this Mac.
- A Meta Quest headset in developer mode. Only the Quest 3 is tested.
- Your own Steam account and games you bought, or Windows VR games you own in a folder.
- Free space on the disk with the data folder: about 720 MB for Wine, plus Steam and the games.
Expand Down
7 changes: 5 additions & 2 deletions THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ Only when you start that step, and only from the official source:
SDK terms apply: https://developer.android.com/studio/terms
- The BlackHole 2ch 0.7.1 installer from Existential Audio: an optional audio driver that you
install yourself. GPL-3.0; not bundled.
- The GStreamer 1.28.1 installer from gstreamer.freedesktop.org: Wine uses it to play videos in
games. You install it for all users of the Mac. LGPL-2.1-or-later, with other licenses for some
plugins. Not bundled.

## The DMG

Expand Down Expand Up @@ -106,5 +109,5 @@ Inside the app:
are the ones of LLVM 15.0.7; the toolchain's own LLVM is newer and ships only the main
LLVM license.

Not inside: Wine, Steam, ALVR, OpenComposite, BlackHole, Android platform tools, games and store
credentials. The app downloads Wine from Gcenx's releases when you start that step.
Not inside: Wine, Steam, ALVR, OpenComposite, BlackHole, GStreamer, Android platform tools, games
and store credentials. The app downloads Wine from Gcenx's releases when you start that step.
5 changes: 3 additions & 2 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,9 @@ it reuses `BasaltBottleKit`, discovers Basalt/Whisky/CrossOver prefixes, parses
manifests (including additional library folders), turns installed games into editable profiles,
starts and owns wired or Wi-Fi streamer plus Wine game processes, and parses the existing
two-second transport/Quest reports into bounded live chart history. Setup checks cover Apple
Silicon/macOS, Screen Recording, adb, the pinned Wine/DXMT artifacts, the OpenXR runtime, and
optional BlackHole audio. Global and per-profile stream settings persist through `UserDefaults`;
Silicon/macOS, Screen Recording, adb, the pinned Wine/DXMT artifacts, the OpenXR runtime,
GStreamer for video playback in games, and optional BlackHole audio. Global and per-profile
stream settings persist through `UserDefaults`;
audio-enabled launches route output to the loopback for the owned session and restore it afterward.
The Basalt data root is user-selectable. External prefixes remain read-only, with an explicit
APFS-cloned import into an isolated pinned engine when a user wants VR support. An ad-hoc-signed
Expand Down
19 changes: 19 additions & 0 deletions docs/BOTTLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,25 @@ swift run --package-path streamer basaltctl profile show beat-saber-steam
Repeat `--arg VALUE` and `--env KEY=VALUE` as needed. `--cwd HOST_PATH` optionally selects the
Wine process's host working directory.

A `steam` profile whose arguments contain `-applaunch APP_ID` is not started through Steam:
`steam.exe -applaunch` only hands the AppID to the running Steam client, which would start the
game with its own environment, without `BASALT_CONTROL`, so the headset would stay black. At each
launch the profile is resolved to the game's own executable (`SteamDirectLaunch`):

1. the executable TrailBridge verified for the game, for the verified games;
2. else Steam's launch option for the app in `appcache/appinfo.vdf` (versions 39 to 42): the
SteamVR option first, then the default and numbered ones, never options for other systems, beta
branches, servers or editors; its arguments come first;
3. else the game folder from the app's `appmanifest_APP_ID.acf` in any library listed in
`libraryfolders.vdf`: a Unity player (`Game.exe` beside `Game_Data`), the `.exe` named like the
folder, an Unreal `*-Win64-Shipping.exe`, or the only probable game.

An Unreal launcher at the top of the folder is replaced by the game binary it starts, since the
session lasts as long as the started process. Arguments before `-applaunch` are the Steam client's
and are dropped; those after the AppID follow. `SteamAppId` and `SteamGameId` are set, so
Steamworks does not restart the game through Steam. When no file is clearly the game, the launch
fails with a message asking for the executable in Edit Launch Profile….

## OpenComposite

OpenComposite is a separate GPL-3.0 project by its authors and is never bundled with TrailBridge.
Expand Down
69 changes: 60 additions & 9 deletions docs/MANAGEMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ Sections are also on ⌘1–⌘5, ⌘R rescans, ⌘. stops the active session, a
shows the session state with a Stop button.

1. **Setup** checks Apple Silicon and macOS 14, adb, the pinned Wine/DXMT engine, the built OpenXR
runtime, optional Screen Recording permission, and optional BlackHole audio. The adb action
runtime, optional Screen Recording permission, and optional BlackHole audio. **Video in games
(GStreamer)** checks for the system framework and shows its version when available. Its action
opens the download of the official GStreamer 1.28.1 package that Wine 11.10 needs. Install it
with an administrator account, for all users of this Mac, then click **Refresh**. Games can
still launch when the framework is missing. The adb action
opens the Headset page, which downloads Google's platform tools, and the BlackHole action
downloads BlackHole's official installer. Build-related actions open the bottle guide because
compiling the pinned runtime is a developer operation.
Expand All @@ -49,7 +53,11 @@ shows the session state with a Stop button.
with the Steam identity and BSIPA `winhttp` override already set. Toolbar search plus VR-only and tool
filters are included; playable games sort first in each section. Existing profiles and direct Beat Saber detections appear alongside Steam
and BSManager games. Steam games in a managed bottle can become `-applaunch APP_ID` profiles
without re-entering paths. **Add Game…** (toolbar, `plus`) adds any other Windows game, such as
without re-entering paths. Such a profile is never passed to Steam as it is: at each launch
TrailBridge starts the game's own executable, chosen from Steam's launch options in
`appcache/appinfo.vdf` or, without them, from the game folder (see
[Bottles](BOTTLES.md#profiles)), so the game gets the session's OpenXR environment.
**Add Game…** (toolbar, `plus`) adds any other Windows game, such as
one from GOG or itch.io: pick a Basalt bottle and the game's `.exe` inside its `drive_c` (install
it first with Bottles → ⋯ → Run Windows Installer…). The name comes from the game folder,
skipping build folders such as `Binaries/Win64` or `bin/win64`. The source is itch.io when a
Expand Down Expand Up @@ -78,15 +86,55 @@ shows the session state with a Stop button.
duration, outcome (ended, stopped, or the failure reason), and whole-session FPS, latency, and
wire-rate averages, including how often the headset ran below its target. The last 50 sessions
are kept in `SessionHistory.json` in the data folder; a finished game can be replayed from its row.
Once a session has stopped, however it ended, and its Wine processes are gone, the app reads
the log the game wrote itself, which often says why a game that runs shows nothing in the
headset. A Unity player writes `Player.log` (and `Player-prev.log` for a run before it in the
same session) in `AppData/LocalLow/<company>/<product>` of the prefix's Windows user, as named
in `<Game>_Data/app.info` (for a launcher, in the only other `*_Data/app.info` beside it); Unity
2017.2 to 2018 wrote `output_log.txt` there, older versions `output_log.txt` in `<Game>_Data`.
An Unreal game writes `<Project>/Saved/Logs/*.log` in `AppData/Local`, or else in the game's
folder. Only regular files inside the prefix or the game's folder that were written since the
game started count; a binary file is skipped, UTF-16 with a byte order mark is read as such,
and of a log larger than 8 MB only the end is read. The excerpt keeps the last 200 lines and
every line that reports an error, in their order, with personal data replaced in whole lines as
in a copied log; a line is then cut after 1,000 bytes, and one over 16 KB is left out for a
note. All of it, headers and notes included, fits in 64 KB, so a long log loses some of the
last lines or of the errors too; notes say where lines were left out. It is saved as
`<UTC time>-<profile>.game.log` in the data folder's `Diagnostics` folder, beside the session's
recording when there is one; of the others the latest 50 are kept. The session log names the
game's log as the game does (`C:\users\[user]\…`), the session's row in Recent Sessions shows
the excerpt, and the next launch and a diagnostic report wait until it is saved.
Every session, with a game log or without, then gives a hint, once, for each error with a known
cause (`KnownErrorHint.rules`), after the line that names the game's log. What its processes
print is read as it arrives, so a trimmed or cleared session log loses nothing; the app's own
lines, which quote paths, and the excerpt's headers and notes are never read. The hints wait
for the game's log to be read, at most as long as a launch waits for it. A
`WindowsVideoMedia error` in the game's log or output sends to Setup when GStreamer was missing
as the game started, and otherwise says that Media Foundation in Wine could not play the video.
A `DllNotFoundException` for `openvr_api` or a failed OpenVR initialisation sends to the game
card's **OpenVR Support…**, for OpenComposite, and says to restore the game's own
`openvr_api.dll` first, by verifying its files in Steam, when none is found. A failed
`xrCreateInstance`, or the runtime's own reason for refusing one, says that the game could not
start OpenXR, but only when no runtime connected in the session (the streamer's
`OpenXR runtime connected` line, read also when it comes late), so Unity's refused first
request for OpenXR 1.1 gives none. A line of the game's or Steam's output that starts with
`wineserver crashed` asks to start the game again and to attach a diagnostic report if it
happens again. GStreamer's known harmless warnings never give a hint. When another launch or a
utility has taken the log over, the hints are not shown there; the session's record keeps them
either way.
8. **Settings** persists global stream defaults and per-profile overrides, selects audio and
USB/Wi-Fi transport, and allows the managed Basalt data directory to be changed from the UI.
9. **Diagnostic Report** (Settings, or **Help › Diagnostic Report…**) previews a bug-report
snapshot: app version, commit, and control protocol; Mac model, macOS, and power state; setup
checks; engines, bottles, and profiles; stream settings; the current and recent sessions; and,
optionally, the end of the session log. It can be copied as Markdown for a GitHub issue or saved
as Markdown or JSON. The home folder and user name, email addresses, Steam IDs, headset serials
and host names, Mac host names, IP and MAC addresses, and long hex tokens are replaced before
anything is shown, and profile environment values are never included. Nothing is uploaded.
checks; engines, bottles, and profiles; stream settings; the current and recent sessions, with
the hints the session log gave for each; and,
optionally, the end of the session log and the excerpt of the game's own log: read anew from
the running game, else the one saved with the latest session. It can be copied as Markdown for
a GitHub issue or saved as Markdown or JSON. The home folder and user name (also in Wine's
`C:/users/<name>` and `Z:\Users\<name>` paths and an Unreal log's `LogInit: User:` line), email
addresses, Steam IDs, headset serials and host names, Mac host names, IP and MAC addresses, and
long hex tokens are replaced before anything is shown, and profile environment values are never
included. Nothing is uploaded.

OpenComposite is a separate GPL-3.0 project by its authors, never bundled with TrailBridge.
Library → More → OpenVR Support… (also in Edit Launch Profile…) finds game DLLs inside the
Expand Down Expand Up @@ -117,6 +165,9 @@ swift test --package-path streamer
default/configured/explicit-location and managed-bottle launcher/instance discovery, Windows/host
path mapping, Beat Saber scanning and source inference, duplicate resolution, stream argument
generation, live-stat parsing, session history persistence and summaries, stream-health rules,
metric CSV export, diagnostic redaction, and report rendering. `BasaltBottleKitTests` verifies repository/support-root
metric CSV export, diagnostic redaction, report rendering, the game log excerpt, its storage
and its place in the report, and the hints for known errors in both logs. `BasaltBottleKitTests`
verifies repository/support-root
discovery, maintenance and VR launch commands, the BSManager Steam prerequisite, profile deletion,
and a real isolated import whose source remains unchanged.
where Unity and Unreal games write their logs inside a prefix, and a real isolated import whose
source remains unchanged.
7 changes: 7 additions & 0 deletions packaging/ReadMeFirst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ GitHub into the data folder you choose. The data folder can be on this Mac's
disk, an external disk or network storage.


GSTREAMER

Wine uses GStreamer to play videos in games. In Setup, click Get GStreamer
to download the official 1.28.1 package. Install it with an administrator
account, for all users of this Mac, then click Refresh in TrailBridge VR.


CHECK THE DOWNLOAD

To make sure the disk image is the published one, run this in Terminal:
Expand Down
38 changes: 37 additions & 1 deletion runtime/pe/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,24 @@ bool basaltGateEnabled() {
return length == 1 && value[0] == '1';
}

// A session that cannot reach TrailBridge stays headless: xrWaitFrame reports
// shouldRender == XR_FALSE, the game draws nothing and the headset stays
// black. Say why once per process, so the session log names a cause.
void logHeadlessSession(const char* reason) {
static LONG logged = 0;
if (InterlockedCompareExchange(&logged, 1, 0) == 0) {
std::fprintf(stderr,
"Basalt OpenXR: %s; the session runs headless and nothing reaches the "
"headset\n",
reason);
std::fflush(stderr);
}
}

constexpr const char* kNotStartedByTrailBridge =
"TrailBridge VR did not start this game (a launcher such as Steam may have started it "
"without the session's environment)";

XrTime monotonicTime() {
LARGE_INTEGER counter{};
LARGE_INTEGER frequency{};
Expand Down Expand Up @@ -1155,19 +1173,32 @@ uint32_t queryTextureIOSurfaceId(ID3D11Texture2D* texture) {
}

void controlSessionCreated(XrSession session, ID3D11Device* device) {
if (!basaltGateEnabled() || !probeSessionIOSurface(device)) {
if (!basaltGateEnabled()) {
logHeadlessSession(kNotStartedByTrailBridge);
return;
}
if (!probeSessionIOSurface(device)) {
logHeadlessSession(
"the game's Direct3D 11 device cannot share frames with TrailBridge VR (the "
"environment's d3d11.dll is not TrailBridge's DXMT build)");
return;
}

uint16_t port = 0;
char token[BASALT_CONTROL_TOKEN_LENGTH + 1]{};
if (!readControlFile(&port, token, nullptr, nullptr)) {
logHeadlessSession(
GetEnvironmentVariableA("BASALT_CONTROL", nullptr, 0) == 0
? kNotStartedByTrailBridge
: "the BASALT_CONTROL file is missing or invalid (the TrailBridge VR session "
"that started this game has ended)");
return;
}

ID3D11Device5* device5 = nullptr;
if (FAILED(device->QueryInterface(IID_ID3D11Device5,
reinterpret_cast<void**>(&device5)))) {
logHeadlessSession("the game's Direct3D 11 device has no ID3D11Device5 fences");
return;
}
ID3D11DeviceContext* context = nullptr;
Expand All @@ -1178,6 +1209,7 @@ void controlSessionCreated(XrSession session, ID3D11Device* device) {
context->Release();
if (FAILED(contextResult)) {
device5->Release();
logHeadlessSession("the game's Direct3D 11 device has no ID3D11DeviceContext4");
return;
}
ID3D11Fence* fence = nullptr;
Expand All @@ -1186,6 +1218,7 @@ void controlSessionCreated(XrSession session, ID3D11Device* device) {
device5->Release();
if (FAILED(fenceResult)) {
context4->Release();
logHeadlessSession("the game's Direct3D 11 device could not create a fence");
return;
}

Expand Down Expand Up @@ -1276,6 +1309,9 @@ void controlSessionCreated(XrSession session, ID3D11Device* device) {
finishDisconnect(state, false);
release(fence);
release(context4);
logHeadlessSession(
"TrailBridge VR's streamer did not accept the runtime's connection (the session "
"may have ended, or another TrailBridge VR version started it)");
return;
}
ReleaseSRWLockExclusive(&gControlLock);
Expand Down
Loading
Loading