Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
dd23f06
init vr
komaruworld Sep 12, 2026
b187efb
Full support camera
komaruworld Sep 13, 2026
3d89f12
support alvr and opengl
komaruworld Sep 13, 2026
f5080e8
fixes
komaruworld Sep 13, 2026
7e05723
fixes
komaruworld Sep 13, 2026
a014751
bla bla bla
komaruworld Sep 14, 2026
5e24bee
resolution thing or smth idk (#141)
TheRealUwie Sep 14, 2026
3c20ee3
Bla fix main menu bla
komaruworld Sep 14, 2026
25cfd94
BLA BLA BLA 3
komaruworld Sep 16, 2026
fbf97df
Fix VR crashing is the version is not supported (#158)
justacalico Sep 22, 2026
6362283
fix idle 1fps
komaruworld Sep 29, 2026
ecb80b3
vr: capture the microphone for voice chat on Build 2998 (#181)
nunreasonable Oct 1, 2026
9a1ccbb
add roblox 3092 support
komaruworld Oct 3, 2026
f9fede1
Merge remote-tracking branch 'mocktail/vr' into vr
dim-ghub Oct 12, 2026
d54d20d
audio: align input capture test with shared_ptr atomic store and rest…
dim-ghub Oct 12, 2026
a441fa7
assets: fix shader pack path resolution and root directory normalization
dim-ghub Oct 12, 2026
5098229
vr: Recreate OpenXR instance on guest Vulkan instance recreation
dim-ghub Oct 12, 2026
68f8ec8
vr: fix sRGB double-gamma, home world avatar spawn, and controller ai…
dim-ghub Oct 13, 2026
88bb4c9
vr: align pointer ray pitch with hand orientation and reset world sca…
dim-ghub Oct 13, 2026
33dd776
Merge remote-tracking branch 'upstream/main' into vr
dim-ghub Oct 13, 2026
ddc9852
vr: add separate VR frame-rate limit, render scale and unpaced benchm…
dim-ghub Oct 13, 2026
4cc0e41
vr: add in-headset virtual keyboard for TextBox input
dim-ghub Oct 13, 2026
360ab6a
vr: fix CI failures from the 3092 profile
dim-ghub Oct 13, 2026
3ef81c3
vr: make VR opt-in and build without the OpenXR submodule
dim-ghub Oct 13, 2026
bafbe42
vr: name the build and the supported builds when VR is unavailable
dim-ghub Oct 13, 2026
0b5578d
vr: keep non-VR launches on their original paths
dim-ghub Oct 13, 2026
0603734
vr: recover from XR failures instead of giving up on headset output
dim-ghub Oct 13, 2026
8106203
vr: fix eye colour formats, mirror segment safety and frame-wait locking
dim-ghub Oct 13, 2026
a06c7de
vr: fix bridge hand math and make its shutdown safe for live guest th…
dim-ghub Oct 13, 2026
2281211
vr: drop test hooks and dead code, document every VR variable
dim-ghub Oct 13, 2026
4b67176
fix(scripts): find VR offsets when Roblox moves the pointer fields
CoderDayton Oct 13, 2026
7294a46
fix(vr): turn on Vulkan queue locking when the adapter loads after th…
CoderDayton Oct 13, 2026
f9289d9
fix(vr): read the pointer hand and HeadScale offsets per build and ch…
CoderDayton Oct 13, 2026
7ec8304
fix(vr): stop keyboard click-through, redraw churn and upload leaks; …
CoderDayton Oct 13, 2026
393297a
feat(vr): support Roblox 3222 (2.742.1059)
CoderDayton Oct 13, 2026
123968b
test(assets): pin overlay priority and path safety when the root is t…
CoderDayton Oct 13, 2026
1ff05e4
fix(vr): do not recover an XR session when the restarted runtime uses…
CoderDayton Oct 13, 2026
a30f05f
fix(vr): keep the bridge and backend alive until exit for guest threa…
CoderDayton Oct 13, 2026
9826535
fix(vr): align the IsVRAppBuild hook so unoptimized builds do not cra…
CoderDayton Oct 14, 2026
fcc8b53
fix(vr): turn off the desktop flyout side panel in VR
CoderDayton Oct 14, 2026
87ac6ee
test(vr): cover the keyboard upload and quad layer on a real OpenXR r…
CoderDayton Oct 14, 2026
0b0d806
docs(vr): list supported builds, move VR detail into docs/VR.md and u…
CoderDayton Oct 14, 2026
f3e68fc
feat(vr): implement OpenXR controller haptics and bypass mobile suppr…
dim-ghub Oct 14, 2026
3788026
fix(vr): limit haptics to VR sessions and check flag names before wri…
CoderDayton Oct 14, 2026
6cf641d
feat(vr): find the haptic flags with the offset finder and enable the…
CoderDayton Oct 14, 2026
2be319a
fix(vr): keep the OpenXR runtime loaded so a game join does not deadlock
CoderDayton Oct 14, 2026
a2ffa5c
Merge branch 'vr' of CoderDayton/nightcap into vr
CoderDayton Oct 14, 2026
2eaba90
fix(vr): reload the OpenXR runtime with its own Vulkan loader instead…
CoderDayton Oct 15, 2026
42b5138
fix(vr): deliver hand-motor and HapticEffect haptics the way games ai…
dim-ghub Oct 15, 2026
44ec71f
Merge branch 'main' into vr
CoderDayton Oct 15, 2026
e553db2
fix(vr): point 3092 FixRegisterMotors at the flag Roblox reads
CoderDayton Oct 15, 2026
de0ddf7
feat(update): solve the VR device bridge and compare it with the VR o…
CoderDayton Oct 15, 2026
e094a4c
feat(vr): time the desktop mirror, present prepare and frame interval
dim-ghub Oct 15, 2026
7296520
perf(vr): order eye copies and the desktop mirror on the GPU
dim-ghub Oct 15, 2026
9ae5667
perf(vr): read per-frame settings once and skip the lock for other pa…
dim-ghub Oct 15, 2026
dea1d5f
test(vr): cover handing present dependencies to the GPU
dim-ghub Oct 15, 2026
df025d2
fix(vr): publish the shared-memory mirror a frame later instead of wa…
dim-ghub Oct 15, 2026
3503345
docs(vr): note the frame-stall fix and the new perf stages
dim-ghub Oct 15, 2026
ea248b1
feat(vr): add vr.mode with on, off and auto
dim-ghub Oct 16, 2026
043964a
fix(vr): say why auto found no headset, and document vr.mode
dim-ghub Oct 16, 2026
569df68
fix(vr): stop trapping the desktop cursor in the window during VR
dim-ghub Oct 16, 2026
753a3f8
feat(vr): anti-alias the headset eyes with FXAA
dim-ghub Oct 16, 2026
0221738
Merge remote-tracking branch 'origin/main' into vr
dim-ghub Oct 16, 2026
1854e00
feat(vr): add SMAA as a vr.anti_aliasing choice
dim-ghub Oct 16, 2026
8370850
docs(changelog): merge the two Changed sections under Unreleased
dim-ghub Oct 16, 2026
adccf4e
Merge branch 'main' into vr
CoderDayton Oct 16, 2026
dc8d822
Merge remote-tracking branch 'fork/main' into vr
CoderDayton Oct 17, 2026
ece5479
feat(ui): add a VR page to the settings window
CoderDayton Oct 17, 2026
71b40a4
Merge remote-tracking branch 'origin/main' into vr
dim-ghub Oct 17, 2026
b6892ba
Merge remote-tracking branch 'origin/main' into vr
dim-ghub Oct 18, 2026
f40af08
roblox_libary now gets the same bin as a magned payload (#166)
justacalico Oct 18, 2026
f62403e
Merge branch 'vr' of https://github.com/komaruworld/mocktail into vr
dim-ghub Oct 19, 2026
032edf2
Merge remote-tracking branch 'origin/main' into vr
dim-ghub Oct 19, 2026
d5585ce
feat(vr): enable Quest's spatial in-game toolbar
dim-ghub Oct 19, 2026
b88beb7
feat(vr): add a setting for the floating in-game toolbar
dim-ghub Oct 19, 2026
73462d7
feat(vr): restyle the keyboard like Roblox's in-game menu
dim-ghub Oct 19, 2026
7b24258
feat(vr): keyboard previews, accents, editing keys and a drag bar
dim-ghub Oct 19, 2026
47749ad
feat(vr): emoji picker and a remembered keyboard spot
dim-ghub Oct 19, 2026
08eae86
Merge remote-tracking branch 'fork/main' into vr
CoderDayton Oct 20, 2026
a144321
Merge remote-tracking branch 'origin/main' into vr
dim-ghub Oct 22, 2026
1afad78
Merge remote-tracking branch 'fork/main' into vr
CoderDayton Oct 22, 2026
905c220
Merge remote-tracking branch 'fork/main' into vr
CoderDayton Oct 22, 2026
0ff7643
Merge branch 'main' into vr
CoderDayton Oct 23, 2026
d8f6718
Merge origin/main into vr
dim-ghub Nov 1, 2026
584caa0
fix(window): restore pending_motion declaration dropped in merge
dim-ghub Nov 1, 2026
0b2d4cf
fix(graphics): restore VR Vulkan hooks dropped in merge
dim-ghub Nov 1, 2026
063537c
update(roblox): run and pin Roblox 2.746.1266
CoderDayton Nov 5, 2026
8fec53b
chore(roblox): drop profiles for Roblox 2.736 and older
CoderDayton Nov 5, 2026
a4f2b5d
Merge branch 'main' into update/roblox-2.746
CoderDayton Nov 7, 2026
0c7ad5a
feat(vr): support Roblox 2.746
CoderDayton Nov 7, 2026
d07c26e
fix(solver): decide close matches by data and vtable slot
CoderDayton Nov 7, 2026
2acebd7
Merge branch 'main' into update/vr-roblox-2.746
CoderDayton Nov 7, 2026
689f8b7
fix(abi): validate constructor anchors and selector fallback
CoderDayton Nov 7, 2026
3035c21
fix(vr): reject ambiguous or missing required flag storage
CoderDayton Nov 7, 2026
ae5a8f9
Merge branch 'main' into update/roblox-2.746
CoderDayton Nov 7, 2026
415fd68
Merge branch 'main' into update/vr-roblox-2.746
CoderDayton Nov 7, 2026
570def3
fix(performance): drop the ignored quality level override
CoderDayton Nov 7, 2026
af229a4
Merge branch 'update/roblox-2.746' into update/vr-roblox-2.746
CoderDayton Nov 7, 2026
2579b5f
fix(performance): stop forcing flags Roblox ignores and shadow limits
CoderDayton Nov 7, 2026
bcaa807
Merge branch 'update/roblox-2.746' into update/vr-roblox-2.746
CoderDayton Nov 7, 2026
0844e34
fix(vr): find the SetMotor method in the 2.746 descriptor
CoderDayton Nov 7, 2026
dce657d
Merge pull request #90 from CoderDayton/update/vr-roblox-2.746
CoderDayton Nov 7, 2026
5ebfba6
Merge remote-tracking branch 'fork/main' into HEAD
CoderDayton Nov 7, 2026
0327c6f
Add controler rotation launch options and SRGB override thing (#236)
ruffleess Nov 9, 2026
f5e72d9
Merge origin/main into vr
komaruworld Nov 9, 2026
c17db21
add Roblox 3222 profile and abi support
komaruworld Nov 9, 2026
d0678d0
Merge remote-tracking branch 'origin/main' into vr
dim-ghub Nov 11, 2026
1631eac
Merge remote-tracking branch 'mocktail/vr' into vr
dim-ghub Nov 11, 2026
717ba17
Merge branch 'main' into vr
dim-ghub Nov 12, 2026
6232fc0
Merge branch 'main' into vr
dim-ghub Nov 17, 2026
0cc9414
Merge remote-tracking branch 'fork/main' into vr
CoderDayton Nov 18, 2026
5c89b60
fix(vr): turn Roblox VR back on and default to sRGB eyes off SteamVR …
CoderDayton Nov 18, 2026
5d67973
chore(merge): merge main into vr
CoderDayton Nov 21, 2026
a3d134f
fix(vr): route VR menu buttons to Roblox Select and Start (#121)
CoderDayton Nov 21, 2026
cdfb9c6
chore(merge): merge main into vr
dim-ghub Dec 1, 2026
7a1096f
feat(vr): support Roblox 2.748
dim-ghub Dec 1, 2026
392cce4
chore(merge): merge main into vr
dim-ghub Dec 1, 2026
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
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
bash tests/shared_data_schema_test.sh .

native-build:
name: Native build (${{ matrix.arch }})
name: Native build (${{ matrix.arch }}, VR ${{ matrix.vr }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
strategy:
Expand All @@ -87,8 +87,15 @@ jobs:
include:
- arch: x86_64
runner: ubuntu-26.04
vr: 'ON'
- arch: aarch64
runner: ubuntu-26.04-arm
vr: 'ON'
# Packaging recipes build without the OpenXR submodule; keep the
# non-VR configuration compiling and passing on its own.
- arch: x86_64
runner: ubuntu-26.04
vr: 'OFF'
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand Down Expand Up @@ -144,6 +151,7 @@ jobs:
ccache --zero-stats
cmake -S . -B build-ci -G Ninja \
-DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON \
-DMOCKTAIL_ENABLE_VR=${{ matrix.vr }} \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build build-ci --parallel 4
Expand Down
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[submodule "third_party/Vulkan-Headers"]
path = third_party/Vulkan-Headers
url = https://github.com/KhronosGroup/Vulkan-Headers.git
[submodule "third_party/OpenXR-SDK"]
path = third_party/OpenXR-SDK
url = https://github.com/KhronosGroup/OpenXR-SDK.git
[submodule "third_party/smaa"]
path = third_party/smaa
url = https://github.com/iryoku/smaa.git
27 changes: 24 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Release notes on GitHub are taken from the matching section here.

## [Unreleased]

### Added

- VR works on Roblox 2.748.1527 (build 22294).

### Changed

- On ARM64, Nightcap runs Roblox 2.748.1527, the same version as x86-64, and new installs start on it.
Expand Down Expand Up @@ -99,6 +103,11 @@ Release notes on GitHub are taken from the matching section here.
- The sign-in captcha puzzle no longer gets covered by a load error when one of its answers is rejected.
- Joining a game right after launch no longer freezes for seconds while the BC7 encoder is compiling.
- Session logs no longer include the join ticket from Roblox's teleport log line.
- VR turns Roblox's own VR setting back on, so its VR menus and laser pointer load after a desktop session.
- VR colours with Vulkan are no longer washed out on WiVRn and other runtimes besides SteamVR.
- `MOCKTAIL_VR_RUNTIME=wivrn` now finds WiVRn installed from Flathub.
- The left VR menu button toggles Roblox's VR bar, and the right one opens the in-game menu. Before,
neither reached Roblox, so on Quest controllers the bar could not be opened.
- Closing the window stops the game's sound right away, and quitting no longer stalls for 12 seconds.
- Nintendo Switch Pro Controllers and Joy-Con pairs send A, B, X and Y as printed on the buttons.
- Controller sticks respond from 5% of their travel instead of 20%, so small aim corrections register.
Expand All @@ -118,6 +127,8 @@ Release notes on GitHub are taken from the matching section here.

### Added

- VR works on Roblox 2.746.1266 (build 20836). It no longer supports 2.736.1408 or 2.738.1397, which
Roblox no longer lets join games.
- The AppImage offers to add Nightcap to the app menu the first time it runs, with Settings and Roblox
links. The entry hides once the AppImage is deleted and is removed on the next Nightcap start.
- When Nightcap or Roblox crashes, the session log now shows where: the signal, the thread and a
Expand All @@ -144,7 +155,6 @@ Release notes on GitHub are taken from the matching section here.
## [0.5.2] - 2026-11-12

### Added

- New FFlag editor in Settings → Advanced. Each known flag says what it does, like more FPS.
Flags can be turned off without deleting them, and sets of flags can be saved as presets.
Edit as Text still edits fflags.json by hand.
Expand Down Expand Up @@ -365,8 +375,8 @@ Release notes on GitHub are taken from the matching section here.
not save a value Nightcap could not start with. Changes apply the next time Nightcap starts. If Nightcap
is open when you change something, the window offers to restart it for you, with the same options and
environment it was started with. It opens on the main menu. Every `config.yaml` setting has a row,
including the device, the window size, the proxy, Fleasion and the update source. A setting you changed
from its default gets a button that resets it.
including the device, the window size, the proxy, Fleasion, VR and the update source. A setting you
changed from its default gets a button that resets it.
- An asset overlay folder, `~/.local/share/mocktail/asset_overlay`. A file there replaces the file Roblox
ships at the same path, such as a cursor, a font or a sky texture, and it stays in place when Roblox
updates. The layout matches Sober's `asset_overlay` folder. `MOCKTAIL_ASSET_OVERLAY_DIR` moves it. Thanks to
Expand All @@ -387,6 +397,12 @@ Release notes on GitHub are taken from the matching section here.
- `MOCKTAIL_ASSET_TRACE=1` now also prints the files Roblox asks for and does not get, as `[asset] miss`.
- Arch Linux: `nightcap-git` is on the AUR and builds the current `main` branch. Thanks to @dim-ghub, who
maintains it.
- `vr.mode` in `config.yaml`: `off` starts on the desktop, `on` starts in VR, and `auto` starts in VR only
when SteamVR is already running with a connected headset. `auto` never starts SteamVR. `vr.enabled` still
works.
- Anti-aliasing in VR. Roblox draws the VR eyes without it, so edges were jagged in the headset. Each eye is
now filtered on its way to the headset. `vr.anti_aliasing` picks `fxaa` (the default), `smaa`, which finds
edges more precisely and keeps text sharper for a little more GPU time, or `off`.
- The nightly `continuous` prerelease now has a `.deb`, `.rpm` and pacman package next to the AppImage,
each with a `.sha256`. They are versioned after the last release, such as `0.3.4+r29.g112f5ab`, so they
upgrade over it and over each other. The notes list the commits since the last nightly.
Expand Down Expand Up @@ -422,6 +438,11 @@ Release notes on GitHub are taken from the matching section here.
`FFlagDebugLuauCodegenAll` in `fflags.json` to choose it yourself.
- Nightcap answers Roblox's Java calls with less work per call, and the audio thread no longer allocates
memory for each block of sound it plays.
- VR on Vulkan no longer makes the CPU wait for the GPU each frame. The eye copies, the desktop mirror and
the `MOCKTAIL_VR_MIRROR_SHM` readback are ordered on the GPU, so Roblox prepares the next frame while the
last one renders. On a simulated 120 Hz headset this removed 2 to 5 ms of waiting per frame and steadied
the frame rate. The shared-memory mirror now shows each frame one frame later.
- `MOCKTAIL_VR_PERF` also reports `desktop_mirror`, `present_prepare` and `present_interval`.
- Less hitching while textures load in. Freeing GPU memory no longer waits for texture decodes that do not
read it. In Blade Ball the worst `vkFreeMemory` fell from 31ms to 3ms.
- Nightcap starts about 0.2s faster. It no longer re-hashes an unchanged Roblox library twice on every
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ set(VULKAN_HEADERS_ENABLE_INSTALL OFF CACHE BOOL
"Install vendored Vulkan-Headers" FORCE)
add_subdirectory(third_party/Vulkan-Headers EXCLUDE_FROM_ALL)

include(${CMAKE_SOURCE_DIR}/cmake/MocktailVR.cmake)

include(CTest)
if(BUILD_TESTING)
# Package builds disable tests and do not fetch Google Test.
Expand Down Expand Up @@ -307,6 +309,7 @@ add_library(mocktail_runtime STATIC
src/runtime/roblox_cookie_jar.cc
src/runtime/roblox_message_bus_request_bridge.cc
src/runtime/roblox_call_protocol_bridge.cc
src/runtime/roblox_haptic_protocol_bridge.cc
src/runtime/payload_update_preflight.cc
src/runtime/process_launch_policy.cc
src/runtime/process_diagnostics.cc
Expand Down Expand Up @@ -689,6 +692,7 @@ target_compile_definitions(mocktail PRIVATE
"MOCKTAIL_DEFAULT_COMPATIBILITY_MANIFEST=\"${MOCKTAIL_DEFAULT_COMPATIBILITY_MANIFEST}\""
)
target_link_libraries(mocktail PRIVATE
Mocktail::VR
mocktail_legacy_runtime
mocktail_auth_runtime_composition
mocktail_failure_dialog_runtime
Expand Down
9 changes: 4 additions & 5 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ after Roblox added measures against running multiple clients.
## Can I play in VR?

Yes, as an experiment. VR lives on Nightcap's `vr` branch and is not in the
releases yet. It works on Roblox 2.742.1059 (build 3222), not yet on 2.746.
releases yet. It works on Roblox 2.742.1059 (build 3222), 2.746.1266 (build
20836), and 2.748.1527 (build 22294).
Install the [build dependencies](README.md#building), then switch to that
branch and build:

Expand All @@ -216,7 +217,5 @@ Start WiVRn or SteamVR/ALVR, connect your headset, then run:
./build/mocktail --vr
```

That branch's
[README](https://github.com/CoderDayton/nightcap/blob/vr/README.md#experimental-vr)
and [docs/VR.md](https://github.com/CoderDayton/nightcap/blob/vr/docs/VR.md)
have the details, including how to try it without a headset.
The [README](README.md#experimental-vr) and [docs/VR.md](docs/VR.md) have the
details, including how to try it without a headset.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ You can also edit the file by hand. Useful options:

- `graphics.frame_rate_limit: display` to unlock FPS to your monitor's rate.
- `graphics.vsync: off` for the lowest lag, at the cost of tearing.
- `vr.frame_rate_limit` sets the cap in VR. It defaults to `unlimited`, so the
headset's refresh rate paces frames; use `-1` for Roblox's 60 FPS cap.
- `graphics.backend: opengl` if Vulkan does not work on your GPU.

## Building
Expand Down Expand Up @@ -292,6 +294,59 @@ To run the same checks as CI before each commit and push, install
lefthook install
```

## Experimental VR

Experimental OpenXR VR support on Linux `x86_64` using WiVRn or SteamVR/ALVR.

VR works on these Roblox builds. On any other build, `--vr` stops at start-up
and names them:

| Build | Roblox version |
| --- | --- |
| 3222 | 2.742.1059 |
| 20836 | 2.746.1266 |
| 22294 | 2.748.1527 |

### Build with VR

VR support is compiled in when the OpenXR SDK submodule is checked out
(`MOCKTAIL_ENABLE_VR` defaults to `AUTO`). Without the submodule the build
skips VR. Pass `-DMOCKTAIL_ENABLE_VR=ON` to make a missing submodule an error,
or `OFF` to leave VR out:

```bash
git submodule update --init third_party/OpenXR-SDK
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j4
```

VR stays off at runtime until you pass `--vr` or set `vr.mode: on` in
`config.yaml`. `vr.mode: auto` starts in VR only when SteamVR is running with a
headset connected.

### Run

Start WiVRn or SteamVR/ALVR and connect your headset first:

```bash
./build/mocktail --vr
```

The OpenXR runtime is detected automatically. To pick one manually:

```bash
MOCKTAIL_VR_RUNTIME=wivrn ./build/mocktail --vr
# or
MOCKTAIL_VR_RUNTIME=alvr MOCKTAIL_GRAPHICS_BACKEND=direct-vulkan ./build/mocktail --vr
```

If you previously set `XR_RUNTIME_JSON`, unset it before switching runtimes.
Use `--no-vr` for desktop mode.

A keyboard opens in the headset when a text box takes focus. The rest is in
[docs/VR.md](docs/VR.md): menus and typing, every VR environment variable,
adding a Roblox build, and testing without a headset.

## Known limitations

Nightcap is incompatible with hardened_malloc. With it enabled, Nightcap will fail, either during startup or at runtime. Disable hardened_malloc before running Nightcap.
Expand Down
4 changes: 4 additions & 0 deletions cmake/MocktailInput.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ add_library(mocktail_input_runtime STATIC
${MOCKTAIL_INPUT_ROOT}/src/runtime/roblox_text_font_resolver.cc
${MOCKTAIL_INPUT_ROOT}/src/runtime/roblox_text_surface_overlay.cc
${MOCKTAIL_INPUT_ROOT}/src/runtime/roblox_window_input_runtime.cc
${MOCKTAIL_INPUT_ROOT}/src/runtime/roblox_xr_controller_input.cc
${MOCKTAIL_INPUT_ROOT}/src/runtime/server_info_overlay.cc
)
add_library(Mocktail::InputRuntime ALIAS mocktail_input_runtime)
Expand All @@ -34,12 +35,14 @@ target_include_directories(mocktail_input_runtime PRIVATE
target_link_libraries(mocktail_input_runtime PUBLIC
Mocktail::PlatformSdl
Mocktail::Runtime
Mocktail::VR
mocktail_window
PkgConfig::UTF8PROC
PRIVATE
PkgConfig::FONTCONFIG
SDL3_ttf::SDL3_ttf
nlohmann_json::nlohmann_json
${CMAKE_DL_LIBS}
mocktail_compat
stub_log
)
Expand All @@ -50,6 +53,7 @@ if(BUILD_TESTING AND TARGET GTest::gtest_main)
add_executable(roblox_input_router_test
${MOCKTAIL_INPUT_ROOT}/tests/roblox_gamepad_input_test.cc
${MOCKTAIL_INPUT_ROOT}/tests/roblox_input_router_test.cc
${MOCKTAIL_INPUT_ROOT}/tests/roblox_xr_controller_input_test.cc
)
target_link_libraries(roblox_input_router_test PRIVATE
Mocktail::InputRuntime
Expand Down
117 changes: 117 additions & 0 deletions cmake/MocktailVR.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Copyright 2026 Mocktail Project Authors
# Licensed under the Apache License, Version 2.0.

include_guard(GLOBAL)

# AUTO builds OpenXR support when the third_party/OpenXR-SDK submodule is
# checked out and skips it otherwise, so source packages that do not fetch
# submodules still build. ON requires the submodule; OFF never builds it.
set(MOCKTAIL_ENABLE_VR "AUTO" CACHE STRING
"Build experimental OpenXR support: AUTO, ON or OFF")
set_property(CACHE MOCKTAIL_ENABLE_VR PROPERTY STRINGS AUTO ON OFF)
set(_mocktail_openxr_sdk "${CMAKE_SOURCE_DIR}/third_party/OpenXR-SDK/CMakeLists.txt")
string(TOUPPER "${MOCKTAIL_ENABLE_VR}" _mocktail_vr_request)
if(_mocktail_vr_request STREQUAL "AUTO")
if(EXISTS "${_mocktail_openxr_sdk}" AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(MOCKTAIL_ENABLE_VR ON)
else()
message(STATUS "OpenXR SDK submodule not found; building without VR "
"(git submodule update --init third_party/OpenXR-SDK to enable it)")
set(MOCKTAIL_ENABLE_VR OFF)
endif()
elseif(MOCKTAIL_ENABLE_VR)
set(MOCKTAIL_ENABLE_VR ON)
else()
set(MOCKTAIL_ENABLE_VR OFF)
endif()

add_library(mocktail_vr STATIC
src/vr/diagnostics.cc
src/vr/headset_detection.cc
src/vr/openxr_backend_mode.cc
src/vr/vr_perf.cc
src/vr/vr_mirror.cc
src/vr/xr_controller.cc
src/vr/roblox_vr_device_bridge.cc
src/vr/emoji_catalog.cc
src/vr/virtual_keyboard.cc)
add_library(Mocktail::VR ALIAS mocktail_vr)
target_include_directories(mocktail_vr PUBLIC "${CMAKE_SOURCE_DIR}/include")
target_include_directories(mocktail_vr PRIVATE "${CMAKE_SOURCE_DIR}/src")
target_link_libraries(mocktail_vr PUBLIC Vulkan::Headers PRIVATE nlohmann_json::nlohmann_json)
# shm_open for the desktop eye mirror lives in librt on glibc.
find_library(MOCKTAIL_RT_LIBRARY rt)
if(MOCKTAIL_RT_LIBRARY)
target_link_libraries(mocktail_vr PUBLIC ${MOCKTAIL_RT_LIBRARY})
endif()
mocktail_apply_compile_options(mocktail_vr)

if(MOCKTAIL_ENABLE_VR)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
message(FATAL_ERROR "Mocktail OpenXR support currently targets Linux")
endif()
if(NOT EXISTS "${_mocktail_openxr_sdk}")
message(FATAL_ERROR
"Initialize OpenXR: git submodule update --init third_party/OpenXR-SDK")
endif()

# Scope upstream's generic option names to this dependency. Static linking
# packages the pinned loader without requiring a matching system loader.
function(mocktail_add_openxr_sdk)
set(BUILD_LOADER ON)
set(DYNAMIC_LOADER OFF)
set(BUILD_WITH_SYSTEM_JSONCPP OFF)
set(BUILD_TESTS OFF)
set(BUILD_API_LAYERS OFF)
set(BUILD_CONFORMANCE_TESTS OFF)
set(BUILD_SDK_TESTS OFF)
set(BUILD_FORCE_GENERATION OFF)
add_subdirectory("${CMAKE_SOURCE_DIR}/third_party/OpenXR-SDK"
"${CMAKE_BINARY_DIR}/third_party/OpenXR-SDK" EXCLUDE_FROM_ALL)
endfunction()
mocktail_add_openxr_sdk()
target_sources(mocktail_vr PRIVATE src/vr/openxr_probe.cc src/vr/openxr_preview.cc
src/vr/openxr_backend.cc src/vr/gles_transport.cc src/vr/xr_actions.cc
src/vr/virtual_keyboard_raster.cc)
# The in-headset keyboard draws its labels with the same SDL3_ttf and
# fontconfig stack as the TextBox overlay.
find_package(SDL3 3.4 REQUIRED CONFIG)
find_package(SDL3_ttf REQUIRED CONFIG)
find_package(PkgConfig REQUIRED)
pkg_check_modules(FONTCONFIG REQUIRED IMPORTED_TARGET fontconfig)
target_link_libraries(mocktail_vr PRIVATE SDL3_ttf::SDL3_ttf SDL3::SDL3
PkgConfig::FONTCONFIG)
# Error unwinding is confined to these native session implementations; their
# public entry points catch errors before returning to the guest runtime.
set_source_files_properties(src/vr/openxr_preview.cc src/vr/openxr_backend.cc
src/vr/xr_actions.cc
PROPERTIES COMPILE_OPTIONS -fexceptions)
target_compile_definitions(mocktail_vr PRIVATE XR_USE_GRAPHICS_API_VULKAN)
option(MOCKTAIL_VR_DIAGNOSTICS
"Compile VR diagnostics: scripted head pose, eye evidence dumps" OFF)
if(MOCKTAIL_VR_DIAGNOSTICS)
target_compile_definitions(mocktail_vr PRIVATE MOCKTAIL_VR_DIAGNOSTICS=1)
endif()
set_source_files_properties(src/vr/openxr_backend.cc PROPERTIES COMPILE_DEFINITIONS "XR_USE_GRAPHICS_API_OPENGL_ES;XR_USE_PLATFORM_EGL")
target_include_directories(mocktail_vr PRIVATE ${MOCKTAIL_EGL_INCLUDE_DIR} ${MOCKTAIL_GLES3_INCLUDE_DIR})
# SMAA's area and search lookup textures for vr.anti_aliasing: smaa.
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/third_party/smaa/Textures/AreaTex.h")
message(FATAL_ERROR
"Initialize SMAA: git submodule update --init third_party/smaa")
endif()
target_include_directories(mocktail_vr PRIVATE "${CMAKE_SOURCE_DIR}/third_party/smaa")
target_link_libraries(mocktail_vr PRIVATE OpenXR::openxr_loader Vulkan::Headers ${CMAKE_DL_LIBS})
else()
target_sources(mocktail_vr PRIVATE src/vr/openxr_disabled.cc
src/vr/xr_actions_disabled.cc)
endif()

if(MOCKTAIL_ENABLE_VR)
add_executable(mocktail_vr_probe src/vr/probe_main.cc)
set_target_properties(mocktail_vr_probe PROPERTIES
OUTPUT_NAME mocktail-vr-probe)
target_link_libraries(mocktail_vr_probe PRIVATE Mocktail::VR)
mocktail_apply_compile_options(mocktail_vr_probe)
install(TARGETS mocktail_vr_probe
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif()
Loading