Compare commits

...
Author SHA1 Message Date
vii 40698efb7d docs(changelog): release 0.2.0 2026-09-16 03:25:39 -05:00
vii 3d2a2b3d98 docs(changelog): record the input, storage, and packaging changes 2026-09-16 02:56:11 -05:00
vii 78a314b761 ci(packages): reduce to a branded nightly AppImage
The workflow built DEB, RPM and pacman packages on every push to main and
every pull request, then published them as "Mocktail continuous" with
assets named Mocktail-* and a continuous tag pushed as komaruworld.

Nightcap ships the AppImage and the Flatpak, so the three native package
jobs are removed along with the APT and RPM repository step, which could
not work here regardless: it downloads .deb and .rpm from this repository's
latest release, and the release workflow publishes neither.

What remains runs nightly and on demand rather than per commit, skips the
build when the continuous tag already points at HEAD, publishes
Nightcap-nightly-x86_64.AppImage with a checksum beside it, and tags as
github-actions[bot]. A manual run from another branch builds and
smoke-tests without touching the release.
2026-09-16 02:51:20 -05:00
vii 2d1dd3788b ci(release): pass GH_TOKEN to the AppImage dependency installer
install_anylinux_dependencies.sh now queries the GitHub API for the rolling
release's asset IDs and digests. Without a token it uses the unauthenticated
rate limit, which shared Actions runner IPs exhaust. packages.yml already
passes the token; the release workflow runs the same script in the same
container and did not.
2026-09-16 02:42:06 -05:00
vii 56d3160641 Merge upstream komaruworld/mocktail into main
Takes upstream's AnyLinux dependency rework: the checked-in digest list is
replaced by a name list, and the installer snapshots GitHub asset IDs and
SHA256 digests together at build time, verifying each archive before
installation. This removes the manual hash refresh a998754 had to do.

Keeps Nightcap's FAQ.md over the upstream copy; ours is the same document
with Nightcap paths, RPC on by default, and the Discord play time section.

Keeps TextureManager2 enabled rather than upstream's revert to TM1. Their
mip regression is described on the mobile MipPackStream path, and this fork
already reports real host memory and a PC device profile. Hours of play
show no texture problem, so the workaround is not adopted without evidence
it is needed here.
2026-09-16 02:37:08 -05:00
vii 5db99041bc docs: rewrite the input roadmap items and trim the donation list
Discord Rich Presence item 1 is custom presence fields; the private-server
join item is dropped. The profiling item names the Chrome trace format
instead of Perfetto.

Item 2 covered hot-plug and input release on disconnect, which already
work, so it is now only the button glyph gap. Raw mouse and the pointer
fix move to Shipped.

Drops the BCH donation address from the README.
2026-09-16 02:29:07 -05:00
vii 9ec56338c3 test: fix umask, dash, and scheduling assumptions in three suites
native_update_test wrote approval artifacts with the process umask, which
candidate_approval rejects when group writable. The helper now chmods 0600.

webview_helper_launcher_test drove its fake helper with `dd <&198` under
#!/bin/sh. dash rejects multi-digit file descriptors, so the script never
ran and the packet file stayed empty. It now reads the control socket in
python3, as the adjacent tests in the file already do.

audio_foundation_test asserted the poller thread had run before stopping
it, without waiting for it to be scheduled; it failed about one run in two.
It now waits for the first poll under a bounded deadline.
2026-09-16 02:28:09 -05:00
vii 894ebf8eb7 fix(services): create BrowserTracker storage directories private and usable
The service created its own credential directory with create_directories
and then refused it, because IsPrivateDirectory rejects a group-writable
path and mkdir masks its mode with the process umask. On a umask of 002
that failed every first run; a umask carrying owner bits left the
directory unwritable by its owner instead.

CreatePrivateDirectories creates each missing component and tightens it to
0700 through a descriptor opened O_DIRECTORY | O_NOFOLLOW. Components that
already exist keep their mode and are still judged by IsPrivateDirectory.
2026-09-16 02:28:02 -05:00
vii 6bec8a6c5c feat(input): add input.raw_mouse and keep the pointer inside the viewport
Relative-mode motion reports zero absolute coordinates, so the router
accumulates deltas. The accumulator was never clamped, only the copy sent
to the engine, so a long turn pushed it far outside the viewport and every
reversal was swallowed until the pointer travelled all the way back.

input.raw_mouse sends look deltas in host units instead of guest surface
units. Those differ only when the desktop display scale and the window's
pixel density disagree, as under fractional scaling. Default off.
2026-09-16 02:27:56 -05:00
vii b9e7bc761b docs(roadmap): swap RPC join items for custom presence fields
Name the Chrome trace format for --profile instead of Perfetto.
2026-09-15 22:53:19 -05:00
vii f87aaca2fb feat(discord): enable Rich Presence by default under Nightcap's own application
Adds Terms and Privacy pages to the site for the Discord application.
2026-09-15 10:34:50 -05:00
vii 901ba615ab fix(runtime): keep fflags.json values over the performance preset instead of failing launch 2026-09-15 10:34:50 -05:00
vii f098bc1b5d docs(faq): add FAQ from upstream with Nightcap paths and link it
Discord RPC config key, log locations, and the upstream vr branch.
2026-09-15 09:12:38 -05:00
vii e1f7c8c06c docs(changelog): add CHANGELOG.md and use it for GitHub release notes
Release and Flatpak workflows take the release body from the tag's
changelog section and fail early if it is missing.
2026-09-15 08:23:11 -05:00
vii a9987546d5 fix(packaging): refresh AnyLinux debloated package hashes to 2026-09-15
pkgforge rebuilt six of the eight rolling packages, so the AppImage build
failed on the ffmpeg-mini checksum.
2026-09-15 08:10:55 -05:00
vii 6a39887e8f docs(roadmap): add Nightcap roadmap and link it from the README 2026-09-15 08:04:17 -05:00
vii 349e314850 feat(packaging): rename app ID to io.github.CoderDayton.nightcap and publish Flatpak
Rename the desktop entry, metainfo, icons, Flatpak manifest, and SDL app
identity so Nightcap installs side by side with upstream. Build a signed
Flatpak on v* tags, publish the OSTree repo and landing page to GitHub
Pages, and attach the bundle to the release. Release creation tolerates
the AppImage and Flatpak workflows racing on the same tag.
2026-09-15 07:10:26 -05:00
vii b1112d8cdc feat(graphics): default small texture upscale to 4
Unset or non-numeric MOCKTAIL_SMALL_TEXTURE_UPSCALE now means 4, so the
upscale applies on every launch path. Drop the variable from the desktop
entry Exec line.
2026-09-15 03:49:13 -05:00
vii 27c383a5d9 feat(branding): recolor app icon to the Nightcap purple palette
Indigo #2F2A6B, violet #6C4FD1, lavender #A78BFA. PNGs rendered with resvg.
2026-09-14 22:26:10 -05:00
vii 7cf24feef6 feat(branding): rename fork to Nightcap and add AppImage release workflow
Show Nightcap as the app name in the desktop entry, window title,
dialogs, and metainfo. Binary, config paths, and desktop ID keep the
mocktail name. Publish Nightcap-x86_64.AppImage to GitHub Releases on
v* tags. README points at the fork's releases instead of upstream
packages.
2026-09-14 22:19:19 -05:00
vii 4443766d39 chore(hooks): add lefthook config mirroring CI repository checks 2026-09-14 18:19:15 -05:00
vii ea2166b09a docs(license): mark files modified from upstream per Apache 2.0
Add a modified-by notice to every upstream file this fork changes.
Ignore build-test/.
2026-09-14 18:08:12 -05:00
vii 9e4e69be1c docs(readme): describe fork changes and replace dead FAQ link with settings 2026-09-14 16:48:00 -05:00
vii dd0655bfde Merge branch 'pc-improvements' into main
Resolve src/update/host_abi_deriver.cc: keep upstream's FMOD vtable layout
versions and input-method derivation inside the optional output-device
bridge, so a mismatch omits the bridge instead of failing derivation.
2026-09-14 16:09:33 -05:00
vii d2d275706b perf(graphics): present through fifo-latest-ready by default to cut input latency
Roblox requests FIFO with 3 swapchain images, which queues up to two frames
before display. The default vsync policy (auto, unmanaged frame cap) now
resolves to the vsync policy so the lowest-latency synchronized present mode
the host offers is used.
2026-09-14 15:51:35 -05:00
vii b7b63dd30f feat(packaging): launch with MOCKTAIL_SMALL_TEXTURE_UPSCALE=4 from the desktop entry 2026-09-14 10:10:40 -05:00
vii aacab4036c feat(graphics): replace and upscale small ETC2 textures
Level-0 uploads are hashed against the override store; MOCKTAIL_SMALL_TEXTURE_UPSCALE
creates colour images up to 64px N times larger, snaps block-rounded regions to the
host mip, fills every host mip from level 0 and turns image copies touching scaled
images into blits. MOCKTAIL_ADVERTISE_ETC2=0 hides the feature bit.
2026-09-14 10:10:40 -05:00
vii e104b1d936 feat(graphics): add PNG texture override and dump store keyed by upload hash
Adds libpng, MOCKTAIL_TEXTURE_OVERRIDE_DIR (default ~/.config/mocktail/textures)
and MOCKTAIL_TEXTURE_DUMP_DIR.
2026-09-14 10:10:40 -05:00
vii bf6a6b417d fix(packaging): write the install path into the installed desktop entry 2026-09-14 04:53:50 -05:00
vii dfd35b8cc8 feat(packaging): launch on Wayland from the desktop entry 2026-09-14 04:44:25 -05:00
vii 1632681e6c fix(jnivm): answer NativeQuoteInterface.requestResponse so servers stop kicking with 319
The client asks Java for a keystore attestation quote after joining. With no
handler the call returned null, the server never got an answer and dropped
the session with error 319. Reply with the no-keystore form [1, 0, message].
2026-09-14 04:44:25 -05:00
vii 88d10d53f2 perf(graphics): decode ETC2 uploads off mapped memory on worker threads
Compressed bytes are copied to heap scratch, decoded heap to heap across
up to 8 threads in block-row bands, and streamed into the staging buffer.
Decoding straight from uncached Vulkan memory caused 200-460 ms hitches.
The FPS trace now reports the longest frame gap per window.
2026-09-14 04:18:43 -05:00
vii eae9fa7030 feat(graphics): emulate ETC2/EAC textures on Vulkan
Hosts without native ETC2 now report ETC2/EAC support. Uploads into emulated images are decoded to RGBA8/R16 staging buffers at submit. MOCKTAIL_DISABLE_ETC2_EMULATION=1 turns it off.
2026-09-13 11:45:28 -05:00
vii ad76f68224 fix(runtime): report real host memory and display size
DeviceParams now carry host RAM instead of a low-RAM device profile, and screen, window and configuration sizes follow the host display and window with a 1920x1080 fallback.
2026-09-13 11:45:28 -05:00
vii d783793b4e fix(update): make the FMOD output-device bridge optional
Candidate payloads without a matching FMOD output-device signature now derive without the bridge instead of failing activation.
2026-09-13 11:45:28 -05:00
113 changed files with 5678 additions and 949 deletions

No files matched your search

+3 -2
View File
@@ -1,5 +1,6 @@
# Modified by vii from komaruworld/mocktail. See README "About this fork".
name: Bug report
description: Report a reproducible problem in Mocktail
description: Report a reproducible problem in Nightcap
title: "[Bug]: "
labels:
- bug
@@ -75,7 +76,7 @@ body:
value: |
Latest log:
- Flatpak: `~/.var/app/space.bigrat.mocktail/.local/state/mocktail/logs/latest.log`
- Flatpak: `~/.var/app/io.github.CoderDayton.nightcap/.local/state/mocktail/logs/latest.log`
- Other installs: `~/.local/state/mocktail/logs/latest.log`
Older logs are in the `sessions` directory next to `latest.log`.
+67 -68
View File
@@ -1,9 +1,9 @@
# Modified by vii from komaruworld/mocktail. See README "About this fork".
name: Flatpak
on:
workflow_run:
workflows: [Native packages]
types: [completed]
push:
tags: ['v*']
pull_request:
paths:
- '.github/workflows/flatpak.yml'
@@ -15,13 +15,11 @@ on:
- 'config/**'
- 'include/**'
- 'packaging/flatpak/**'
- 'packaging/discord-join.html'
- 'packaging/icons/**'
- 'packaging/space.bigrat.mocktail.desktop'
- 'packaging/space.bigrat.mocktail.metainfo.xml'
- 'packaging/space.bigrat.mocktail.svg'
- 'packaging/io.github.CoderDayton.nightcap.desktop'
- 'packaging/io.github.CoderDayton.nightcap.metainfo.xml'
- 'packaging/io.github.CoderDayton.nightcap.svg'
- 'scripts/assemble_flatpak_pages.sh'
- 'scripts/assemble_native_repositories.sh'
- 'site/**'
- 'src/**'
- 'stubs/**'
@@ -29,61 +27,28 @@ on:
workflow_dispatch:
permissions:
actions: read
contents: read
concurrency:
group: flatpak-${{ github.event.workflow_run.head_sha || github.ref }}
cancel-in-progress: true
group: flatpak-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
flatpak:
name: Flatpak build
if: >-
github.event_name != 'workflow_run' ||
(github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event != 'pull_request' &&
github.event.workflow_run.head_branch == 'main')
runs-on: ubuntu-24.04
timeout-minutes: 120
env:
MOCKTAIL_PUBLISH: ${{ (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event != 'pull_request' && github.event.workflow_run.head_branch == 'main') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') }}
MOCKTAIL_SOURCE_SHA: ${{ github.event.workflow_run.head_sha || github.sha }}
# Publish on release tags and on manual runs from main. Pull requests
# only verify that the manifest still builds.
MOCKTAIL_PUBLISH: ${{ startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') }}
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
submodules: recursive
- name: Download package repositories
if: env.MOCKTAIL_PUBLISH == 'true'
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
set -Eeuo pipefail
run_id="${{ github.event.workflow_run.id }}"
if [[ -z "$run_id" ]]; then
run_id="$(gh run list \
--workflow packages.yml \
--branch main \
--event push \
--status success \
--limit 1 \
--json databaseId \
--jq '.[0].databaseId')"
fi
[[ -n "$run_id" ]]
gh run download "$run_id" \
--name Mocktail-native-repositories \
--dir native-repositories
[[ -d native-repositories/apt && \
-d native-repositories/rpm && \
-d native-repositories/downloads && \
-s native-repositories/mocktail-packages.gpg ]]
- name: Install Flatpak builder
shell: bash
run: |
@@ -99,22 +64,23 @@ jobs:
FLATPAK_GPG_KEY_ID: ${{ secrets.FLATPAK_GPG_KEY_ID }}
run: |
set -Eeuo pipefail
git update-ref refs/heads/main "$MOCKTAIL_SOURCE_SHA"
# The manifest builds the local checkout from refs/heads/main.
git update-ref refs/heads/main "$GITHUB_SHA"
builder_signing=()
bundle_keys=()
if [[ "$MOCKTAIL_PUBLISH" == true ]]; then
[[ -n "$FLATPAK_GPG_PRIVATE_KEY" && \
-n "$FLATPAK_GPG_KEY_ID" ]]
install -d -m 0700 "$RUNNER_TEMP/mocktail-gnupg"
install -d -m 0700 "$RUNNER_TEMP/nightcap-gnupg"
printf '%s' "$FLATPAK_GPG_PRIVATE_KEY" | \
gpg --batch --homedir "$RUNNER_TEMP/mocktail-gnupg" --import
gpg --batch --homedir "$RUNNER_TEMP/mocktail-gnupg" \
--export "$FLATPAK_GPG_KEY_ID" >mocktail-flatpak.gpg
gpg --batch --homedir "$RUNNER_TEMP/nightcap-gnupg" --import
gpg --batch --homedir "$RUNNER_TEMP/nightcap-gnupg" \
--export "$FLATPAK_GPG_KEY_ID" >nightcap-flatpak.gpg
builder_signing=(
"--gpg-sign=$FLATPAK_GPG_KEY_ID"
"--gpg-homedir=$RUNNER_TEMP/mocktail-gnupg"
"--gpg-homedir=$RUNNER_TEMP/nightcap-gnupg"
)
bundle_keys=(--gpg-keys=mocktail-flatpak.gpg)
bundle_keys=(--gpg-keys=nightcap-flatpak.gpg)
fi
flatpak-builder \
--arch=x86_64 \
@@ -127,34 +93,33 @@ jobs:
--repo=repo \
"${builder_signing[@]}" \
build-flatpak-ci \
packaging/flatpak/space.bigrat.mocktail.json
packaging/flatpak/io.github.CoderDayton.nightcap.json
if [[ "$MOCKTAIL_PUBLISH" == true ]]; then
flatpak build-update-repo \
--generate-static-deltas \
--static-delta-jobs=2 \
--prune \
--gpg-sign="$FLATPAK_GPG_KEY_ID" \
--gpg-homedir="$RUNNER_TEMP/mocktail-gnupg" \
--gpg-homedir="$RUNNER_TEMP/nightcap-gnupg" \
repo
fi
flatpak build-bundle \
--arch=x86_64 \
"${bundle_keys[@]}" \
repo \
Mocktail-x86_64.flatpak \
space.bigrat.mocktail \
Nightcap-x86_64.flatpak \
io.github.CoderDayton.nightcap \
stable
if [[ "$MOCKTAIL_PUBLISH" == true ]]; then
./scripts/assemble_flatpak_pages.sh \
repo Mocktail-x86_64.flatpak mocktail-flatpak.gpg \
public native-repositories
repo Nightcap-x86_64.flatpak nightcap-flatpak.gpg public
fi
- name: Upload Flatpak
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Mocktail-x86_64-flatpak
path: Mocktail-x86_64.flatpak
name: Nightcap-x86_64-flatpak
path: Nightcap-x86_64.flatpak
if-no-files-found: error
retention-days: 14
@@ -170,13 +135,7 @@ jobs:
deploy-pages:
name: Publish Flatpak repository
if: >-
(github.event_name == 'workflow_run' &&
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event != 'pull_request' &&
github.event.workflow_run.head_branch == 'main') ||
(github.event_name == 'workflow_dispatch' &&
github.ref == 'refs/heads/main')
if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
needs: flatpak
runs-on: ubuntu-24.04
timeout-minutes: 10
@@ -191,3 +150,43 @@ jobs:
- name: Deploy GitHub Pages
id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
release:
name: Attach bundle to GitHub release
if: startsWith(github.ref, 'refs/tags/v')
needs: flatpak
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
contents: write
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download Flatpak
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: Nightcap-x86_64-flatpak
path: release
- name: Upload to release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
set -Eeuo pipefail
tag="${GITHUB_REF_NAME}"
(cd release && sha256sum Nightcap-x86_64.flatpak > Nightcap-x86_64.flatpak.sha256)
./scripts/release_notes.sh "$tag" > release/notes.md
# The Release workflow creates the same release; whichever job
# arrives second sees "already exists" and continues.
if ! gh release view "$tag" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release create "$tag" --repo "$GITHUB_REPOSITORY" \
--title "Nightcap $tag" --notes-file release/notes.md ||
gh release view "$tag" --repo "$GITHUB_REPOSITORY" >/dev/null
fi
gh release edit "$tag" --repo "$GITHUB_REPOSITORY" \
--title "Nightcap $tag" --notes-file release/notes.md
gh release upload "$tag" --repo "$GITHUB_REPOSITORY" --clobber \
release/Nightcap-x86_64.flatpak \
release/Nightcap-x86_64.flatpak.sha256
+55 -220
View File
@@ -1,39 +1,47 @@
name: Native packages
name: Nightly AppImage
on:
push:
branches: [main]
paths-ignore:
- '.github/workflows/ci.yml'
- '.gitignore'
- 'README.md'
- 'assets/screenshots/**'
- 'docs/**'
- 'packaging/aur/**'
- 'scripts/build_flatpak.sh'
- 'tests/**'
pull_request:
paths-ignore:
- '.github/workflows/ci.yml'
- '.gitignore'
- 'README.md'
- 'assets/screenshots/**'
- 'docs/**'
- 'packaging/aur/**'
- 'scripts/build_flatpak.sh'
- 'tests/**'
schedule:
# 05:00 UTC daily. A run whose commit already carries the continuous tag
# exits without rebuilding, so a quiet day costs one probe job.
- cron: '0 5 * * *'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: packages-${{ github.ref }}
cancel-in-progress: true
group: nightly-appimage
cancel-in-progress: false
jobs:
probe:
name: Check for new commits
runs-on: ubuntu-24.04
timeout-minutes: 5
outputs:
build: ${{ steps.decide.outputs.build }}
steps:
- name: Compare HEAD against the published continuous tag
id: decide
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
set -Eeuo pipefail
published="$(gh api "repos/$GITHUB_REPOSITORY/git/ref/tags/continuous" \
--jq .object.sha 2>/dev/null || true)"
if [[ "$GITHUB_EVENT_NAME" == "schedule" && "$published" == "$GITHUB_SHA" ]]; then
echo 'build=false' >>"$GITHUB_OUTPUT"
echo "continuous already points at $GITHUB_SHA; nothing to build"
else
echo 'build=true' >>"$GITHUB_OUTPUT"
fi
appimage:
name: AppImage (AnyLinux)
needs: probe
if: needs.probe.outputs.build == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 90
steps:
@@ -138,155 +146,17 @@ jobs:
- name: Upload AppImage
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Mocktail-AppImage
name: Nightcap-AppImage
path: dist/Mocktail-x86_64.AppImage
if-no-files-found: error
retention-days: 14
deb:
name: DEB (Ubuntu 26.04)
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
submodules: recursive
- name: Build DEB
shell: bash
run: |
nightly_suffix=".nightly.$(git show -s --format=%cd --date=format:%Y%m%d%H%M%S "$GITHUB_SHA").g${GITHUB_SHA:0:8}"
docker run --rm \
--volume "$GITHUB_WORKSPACE:/workspace" \
--workdir /workspace \
--env MOCKTAIL_PACKAGE_VERSION_SUFFIX="$nightly_suffix" \
ubuntu:26.04 bash -Eeuo pipefail -c '
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install --yes --no-install-recommends \
build-essential cmake git ninja-build pkg-config lld fakeroot \
dpkg-dev file libsdl3-dev libsdl3-ttf-dev \
libcurl4-openssl-dev libssl-dev nlohmann-json3-dev \
libyaml-dev libelf-dev libminizip-dev libcapstone-dev \
libgtk-4-dev libadwaita-1-dev libwebkitgtk-6.0-dev \
libutf8proc-dev libfontconfig1-dev libegl-dev \
libvulkan-dev libplacebo-dev zlib1g-dev
cmake -S . -B build-deb -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DMOCKTAIL_PACKAGE_NAME=mocktail-nightly \
-DMOCKTAIL_PACKAGE_VERSION_SUFFIX="$MOCKTAIL_PACKAGE_VERSION_SUFFIX" \
-DBUILD_TESTING=OFF
cmake --build build-deb --parallel 4
cpack --config build-deb/CPackConfig.cmake \
-G DEB -B dist/deb
dpkg-deb --info dist/deb/*.deb >/dev/null
'
- name: Upload DEB
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Mocktail-DEB
path: dist/deb/*.deb
if-no-files-found: error
retention-days: 14
rpm:
name: RPM (Fedora 44)
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
submodules: recursive
- name: Build RPM
shell: bash
run: |
nightly_suffix=".nightly.$(git show -s --format=%cd --date=format:%Y%m%d%H%M%S "$GITHUB_SHA").g${GITHUB_SHA:0:8}"
docker run --rm \
--volume "$GITHUB_WORKSPACE:/workspace" \
--workdir /workspace \
--env MOCKTAIL_PACKAGE_VERSION_SUFFIX="$nightly_suffix" \
fedora:44 bash -Eeuo pipefail -c '
dnf install --assumeyes \
gcc-c++ cmake git ninja-build pkgconf-pkg-config lld rpm-build \
SDL3-devel SDL3_ttf-devel libcurl-devel openssl-devel \
nlohmann-json-devel libyaml-devel elfutils-libelf-devel \
minizip-ng-compat-devel capstone-devel gtk4-devel libadwaita-devel \
webkitgtk6.0-devel utf8proc-devel fontconfig-devel \
libglvnd-devel vulkan-headers vulkan-loader-devel \
libplacebo-devel zlib-ng-compat-devel
cmake -S . -B build-rpm -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DMOCKTAIL_PACKAGE_NAME=mocktail-nightly \
-DMOCKTAIL_PACKAGE_VERSION_SUFFIX="$MOCKTAIL_PACKAGE_VERSION_SUFFIX" \
-DBUILD_TESTING=OFF
cmake --build build-rpm --parallel 4
cpack --config build-rpm/CPackConfig.cmake \
-G RPM -B dist/rpm
rpm --query --package --info dist/rpm/*.rpm >/dev/null
'
- name: Upload RPM
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Mocktail-RPM
path: dist/rpm/*.rpm
if-no-files-found: error
retention-days: 14
arch:
name: Pacman package (Arch Linux)
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
submodules: recursive
- name: Build pacman package
shell: bash
run: |
docker run --rm \
--volume "$GITHUB_WORKSPACE:/workspace" \
--workdir /workspace \
archlinux:base-devel bash -Eeuo pipefail -c '
pacman -Syu --needed --noconfirm \
cmake git ninja pkgconf lld sdl3 sdl3_ttf curl openssl \
nlohmann-json libyaml libelf minizip capstone gtk4 \
libadwaita webkitgtk-6.0 libutf8proc fontconfig \
libplacebo vulkan-headers vulkan-icd-loader libglvnd zlib
useradd --create-home builder
chown -R builder:builder /workspace
runuser -u builder -- env MOCKTAIL_SOURCE_DIR=/workspace \
makepkg --dir /workspace/packaging/arch \
--noconfirm --cleanbuild --force
install -d dist/arch
cp packaging/arch/*.pkg.tar.zst dist/arch/
pacman -Qp dist/arch/*.pkg.tar.zst >/dev/null
'
- name: Upload pacman package
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Mocktail-Arch
path: dist/arch/*.pkg.tar.zst
if-no-files-found: error
retention-days: 14
publish:
name: Publish continuous packages
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
needs: [appimage, deb, rpm, arch]
name: Publish continuous release
needs: [probe, appimage]
# A manual run from another branch still builds and smoke-tests, but the
# continuous tag and release only ever follow main.
if: needs.probe.outputs.build == 'true' && github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
timeout-minutes: 30
permissions:
@@ -297,84 +167,49 @@ jobs:
with:
fetch-depth: 0
- name: Download packages
- name: Download AppImage
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: Mocktail-*
name: Nightcap-AppImage
path: release
merge-multiple: true
- name: Prepare continuous packages
- name: Name and checksum the nightly build
shell: bash
run: |
set -Eeuo pipefail
mv -- release/*.AppImage release/mocktail-nightly.AppImage
mv -- release/*.deb release/mocktail-nightly.deb
mv -- release/*.rpm release/mocktail-nightly.rpm
mv -- release/*.pkg.tar.zst release/mocktail-nightly.pkg.tar.zst
# The Makefile builds under upstream's artifact name; the published
# asset carries this fork's.
mv -- release/Mocktail-x86_64.AppImage release/Nightcap-nightly-x86_64.AppImage
(cd release && sha256sum Nightcap-nightly-x86_64.AppImage \
> Nightcap-nightly-x86_64.AppImage.sha256)
find release -maxdepth 1 -type f -print
- name: Build package repositories
shell: bash
env:
GH_TOKEN: ${{ github.token }}
FLATPAK_GPG_PRIVATE_KEY: ${{ secrets.FLATPAK_GPG_PRIVATE_KEY }}
FLATPAK_GPG_KEY_ID: ${{ secrets.FLATPAK_GPG_KEY_ID }}
run: |
set -Eeuo pipefail
[[ -n "$FLATPAK_GPG_PRIVATE_KEY" && -n "$FLATPAK_GPG_KEY_ID" ]]
sudo apt-get update
sudo apt-get install --yes --no-install-recommends \
apt-utils createrepo-c gnupg rpm
install -d stable/deb stable/rpm
stable_tag="$(gh api "repos/$GITHUB_REPOSITORY/releases/latest" --jq .tag_name)"
gh release download "$stable_tag" --pattern '*.deb' --dir stable/deb
gh release download "$stable_tag" --pattern '*.rpm' --dir stable/rpm
mapfile -t stable_debs < <(find stable/deb -maxdepth 1 -type f -name '*.deb' -print)
mapfile -t stable_rpms < <(find stable/rpm -maxdepth 1 -type f -name '*.rpm' -print)
[[ "${#stable_debs[@]}" -eq 1 && "${#stable_rpms[@]}" -eq 1 ]]
install -d -m 0700 "$RUNNER_TEMP/mocktail-native-gnupg"
printf '%s' "$FLATPAK_GPG_PRIVATE_KEY" | \
gpg --batch --homedir "$RUNNER_TEMP/mocktail-native-gnupg" --import
gpg --batch --homedir "$RUNNER_TEMP/mocktail-native-gnupg" \
--export "$FLATPAK_GPG_KEY_ID" >mocktail-packages.gpg
./scripts/assemble_native_repositories.sh \
"${stable_debs[0]}" release/mocktail-nightly.deb \
"${stable_rpms[0]}" release/mocktail-nightly.rpm \
mocktail-packages.gpg "$FLATPAK_GPG_KEY_ID" \
"$RUNNER_TEMP/mocktail-native-gnupg" native-repositories
- name: Update continuous release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
set -Eeuo pipefail
git config user.name komaruworld
git config user.email rtysus228@gmail.com
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git tag --force continuous "$GITHUB_SHA"
git push origin refs/tags/continuous --force
notes="Automated build of main at ${GITHUB_SHA:0:8}. Untested and unreleased; use a tagged release for normal play."
if ! gh release view continuous >/dev/null 2>&1; then
gh release create continuous \
--prerelease \
--title "Mocktail continuous" \
--notes "Automated development packages from main."
--title "Nightcap continuous" \
--notes "$notes"
fi
gh release edit continuous --title "Nightcap continuous" --notes "$notes"
gh release upload continuous release/* --clobber
# Drop assets left by earlier runs under other names.
while IFS= read -r asset; do
case "$asset" in
mocktail-nightly.AppImage|mocktail-nightly.deb|mocktail-nightly.rpm|mocktail-nightly.pkg.tar.zst)
Nightcap-nightly-x86_64.AppImage|Nightcap-nightly-x86_64.AppImage.sha256)
;;
Mocktail-*.AppImage|mocktail_*.deb|mocktail-*.deb|mocktail-*.rpm|mocktail-*.pkg.tar.zst)
*)
gh release delete-asset continuous "$asset" --yes
;;
esac
done < <(gh release view continuous --json assets --jq '.assets[].name')
- name: Upload package repositories
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Mocktail-native-repositories
path: native-repositories
if-no-files-found: error
retention-days: 14
+168
View File
@@ -0,0 +1,168 @@
name: Release
on:
push:
tags: ['v*']
workflow_dispatch:
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
appimage:
name: AppImage (AnyLinux)
runs-on: ubuntu-24.04
timeout-minutes: 90
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
submodules: recursive
- name: Check release notes
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: ./scripts/release_notes.sh "$GITHUB_REF_NAME" >/dev/null
- name: Build AppImage
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
docker run --rm \
--volume "$GITHUB_WORKSPACE:/workspace" \
--workdir /workspace \
--env GH_TOKEN \
ghcr.io/archlinux/archlinux:base-devel@sha256:c3953446016873a756fb7814f10087cac1634c127f7302e80c81c512da796d05 bash -Eeuo pipefail -c '
pacman -Syu --noconfirm --needed \
cmake git ninja pkgconf lld sdl3 sdl3_ttf curl openssl \
nlohmann-json libyaml libelf minizip minizip-ng capstone gtk4 \
libadwaita webkitgtk-6.0 libutf8proc fontconfig libglvnd \
vulkan-headers zlib libplacebo bubblewrap xdg-dbus-proxy \
patchelf jq unzip file ca-certificates dbus zsync
./scripts/install_anylinux_dependencies.sh
curl --fail --location --retry 3 \
--output /tmp/quick-sharun \
https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/2a025cef14483c5bc2a75b479071f4d5c58a906f/useful-tools/quick-sharun.sh
echo "fa66d0189e1e87df781c049dfb23cbb1e753786056f693a4483d6d3af61e7ee1 /tmp/quick-sharun" | \
sha256sum --check --strict
chmod 0755 /tmp/quick-sharun
curl --fail --location --retry 3 \
--output /tmp/sharun \
https://github.com/pkgforge-dev/Anylinux-sharun/releases/download/2.2.6/sharun-x86_64
echo "a4d51752f9861b4870ca529fea04087310b28f8943cc55b99a95b777d4db92ec /tmp/sharun" | \
sha256sum --check --strict
chmod 0755 /tmp/sharun
curl --fail --location --retry 3 \
--output /tmp/anylinux.c \
https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/2a025cef14483c5bc2a75b479071f4d5c58a906f/useful-tools/lib/anylinux.c
echo "f50650ad96d177559bdd0737df509fa20bd4af08887631c738fc1f31bfac185f /tmp/anylinux.c" | \
sha256sum --check --strict
curl --fail --location --retry 3 \
--output /tmp/appimagetool \
https://github.com/pkgforge-dev/appimagetool/releases/download/0.3.3/appimagetool-x86_64-linux
echo "0d01a4e2628efc897be9663f0faeed6a171e1851270b4e1ce4c22434a36ecebd /tmp/appimagetool" | \
sha256sum --check --strict
chmod 0755 /tmp/appimagetool
curl --fail --location --retry 3 \
--output /tmp/uruntime \
https://github.com/VHSgunzo/uruntime/releases/download/v0.5.9/uruntime-appimage-dwarfs-lite-x86_64
echo "cef962c299f2fa19b2b3cdf2fa1565ee8541796cc89b9a97a591f94041e8b083 /tmp/uruntime" | \
sha256sum --check --strict
chmod 0755 /tmp/uruntime
curl --fail --location --retry 3 \
--output /tmp/mkdwarfs \
https://github.com/mhx/dwarfs/releases/download/v0.15.6/dwarfs-universal-0.15.6-Linux-x86_64
echo "50891c38ba359db8271819a6cbf6aaa8068681523f0c4f2b8242007a45edaa28 /tmp/mkdwarfs" | \
sha256sum --check --strict
chmod 0755 /tmp/mkdwarfs
git config --global --add safe.directory /workspace
git config --global --add safe.directory /workspace/third_party/Vulkan-Headers
git config --global --add safe.directory /workspace/third_party/libjnivm
export MOCKTAIL_ANYLINUX_SYSTEM_INSTALL=1
export MOCKTAIL_ANYLINUX_SHARUN=/tmp/sharun
export MOCKTAIL_ANYLINUX_C_SOURCE=/tmp/anylinux.c
export RUNTIME=/tmp/uruntime
export DWARFS_CMD=/tmp/mkdwarfs
make appimage BUILD_DIR=build-appimage JOBS=4 \
APPIMAGE=dist/Mocktail-x86_64.AppImage \
PORTABLE_MODE=standalone APPIMAGE_FORMAT=anylinux \
ANYLINUX_PACKAGER=/tmp/quick-sharun \
ANYLINUX_APPIMAGETOOL=/tmp/appimagetool
test -x dist/Mocktail-x86_64.AppImage
'
- name: Smoke-test AppImage without FUSE
shell: bash
run: |
smoke_dir="$(mktemp -d)"
trap 'rm -rf -- "$smoke_dir"' EXIT
export XDG_DATA_HOME="$smoke_dir/data"
export XDG_CONFIG_HOME="$smoke_dir/config"
export XDG_CACHE_HOME="$smoke_dir/cache"
export XDG_STATE_HOME="$smoke_dir/state"
mkdir -p "$XDG_DATA_HOME" "$XDG_CONFIG_HOME" "$XDG_CACHE_HOME" "$XDG_STATE_HOME"
timeout 60s dist/Mocktail-x86_64.AppImage --appimage-extract-and-run --help
timeout 60s dist/Mocktail-x86_64.AppImage --appimage-extract-and-run mocktail_updater status
- name: Upload AppImage
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Mocktail-AppImage
path: dist/Mocktail-x86_64.AppImage
if-no-files-found: error
retention-days: 14
publish:
name: Publish GitHub release
if: startsWith(github.ref, 'refs/tags/v')
needs: [appimage]
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
contents: write
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download AppImage
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: Mocktail-AppImage
path: release
- name: Create release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
set -Eeuo pipefail
tag="${GITHUB_REF_NAME}"
mv release/Mocktail-x86_64.AppImage release/Nightcap-x86_64.AppImage
(cd release && sha256sum Nightcap-x86_64.AppImage > Nightcap-x86_64.AppImage.sha256)
./scripts/release_notes.sh "$tag" > release/notes.md
# The Flatpak workflow creates the same release; whichever job
# arrives second sees "already exists" and continues.
if ! gh release view "$tag" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release create "$tag" --repo "$GITHUB_REPOSITORY" \
--title "Nightcap $tag" --notes-file release/notes.md ||
gh release view "$tag" --repo "$GITHUB_REPOSITORY" >/dev/null
fi
gh release edit "$tag" --repo "$GITHUB_REPOSITORY" \
--title "Nightcap $tag" --notes-file release/notes.md
gh release upload "$tag" --repo "$GITHUB_REPOSITORY" --clobber \
release/Nightcap-x86_64.AppImage \
release/Nightcap-x86_64.AppImage.sha256
+1
View File
@@ -1,5 +1,6 @@
# Build
/build/
/build-test/
/build_*/
/build-flatpak/
/build-anylinux*/
+80
View File
@@ -0,0 +1,80 @@
# Changelog
All notable changes to Nightcap. The format follows
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Release notes on
GitHub are taken from the matching section here.
## [Unreleased]
## [0.2.0] - 2026-09-16
### Added
- FAQ covering Discord RPC, log locations, and VR, adapted from upstream.
- `input.raw_mouse` in `config.yaml` sends mouse look deltas in the host's
own units. Turn it on when first-person aiming feels too slow or too fast
under fractional display scaling. Off by default.
- Nightly AppImage builds, published as the `continuous` prerelease. They are
untested; use a tagged release for normal play.
### Changed
- Values in `fflags.json` now win over the performance preset instead of
stopping the launch. Startup prints each key it kept.
- Discord Rich Presence uses Nightcap's own Discord application, so it shows
as "Playing Nightcap". Terms and privacy pages for it live on the
project site.
- Discord Rich Presence is on by default. Set
`integrations.discord_rpc.enabled: false` to turn it off.
- The AppImage build verifies its reduced dependency packages against digests
taken at build time, rather than a digest list kept in the repository.
### Fixed
- Mouse look keeps responding after a long turn. The tracked pointer position
could drift past the edge of the view, which swallowed every reversal until
the mouse travelled all the way back.
- Nightcap no longer refuses to start with `cannot lock appStorage`. It
created its own credential directory using the process umask, then rejected
that directory for being group writable. Systems with a permissive umask,
such as `002`, failed on first run.
## [0.1.0] - 2026-09-15
First Nightcap release, forked from komaruworld/mocktail.
### Added
- ETC2 and EAC texture emulation on Vulkan, so games that use compressed
mobile textures render correctly on desktop GPUs. Decoding runs on worker
threads to avoid stutter.
- PNG texture overrides in `~/.config/mocktail/textures`, keyed by upload
hash, with a dump mode to find the texture you want to replace.
- Small textures are upscaled 4x by default. Set
`MOCKTAIL_SMALL_TEXTURE_UPSCALE=1` to turn it off.
- AppImage and signed Flatpak builds on every release tag. The Flatpak repo
is published at https://coderdayton.github.io/nightcap/.
- Roadmap in `docs/ROADMAP.md`.
### Changed
- Frames are presented as soon as they are ready instead of waiting in a
queue, which lowers input latency.
- Roblox now sees the real host RAM and display size instead of a low-end
phone profile.
- App ID is `io.github.CoderDayton.nightcap`, so Nightcap installs next to
upstream Mocktail. The binary and config paths keep the `mocktail` name.
- New name, icon, and colors.
- The desktop entry launches on Wayland and points at the installed binary.
### Fixed
- Servers no longer kick with error 319 shortly after joining.
- The FMOD output-device bridge is optional, so the updater no longer fails
without it.
- The AppImage build no longer fails on stale checksums for the slimmed
Arch packages.
[Unreleased]: https://github.com/CoderDayton/nightcap/compare/v0.2.0...HEAD
[0.2.0]: https://github.com/CoderDayton/nightcap/releases/tag/v0.2.0
[0.1.0]: https://github.com/CoderDayton/nightcap/releases/tag/v0.1.0
+20 -7
View File
@@ -1,3 +1,4 @@
# Modified by vii from komaruworld/mocktail. See README "About this fork".
# Copyright 2026 Mocktail Project Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -60,7 +61,7 @@ set(MOCKTAIL_DEFAULT_SIGNING_TRUST_MANIFEST
CACHE FILEPATH
"Fallback signing trust manifest used outside an installed runtime"
)
set(MOCKTAIL_DISCORD_APPLICATION_ID "1537088975720812655" CACHE STRING
set(MOCKTAIL_DISCORD_APPLICATION_ID "1549428231927500843" CACHE STRING
"Discord application ID baked into Mocktail Rich Presence releases"
)
string(LENGTH "${MOCKTAIL_DISCORD_APPLICATION_ID}"
@@ -300,6 +301,7 @@ add_library(mocktail_runtime STATIC
src/runtime/support_bundle.cc
src/runtime/system_proxy.cc
src/runtime/texture_memory_policy.cc
src/runtime/device_memory_profile.cc
)
add_library(Mocktail::Runtime ALIAS mocktail_runtime)
target_include_directories(mocktail_runtime PUBLIC include)
@@ -724,13 +726,24 @@ install(FILES
config/roblox_signing_certificates.json
DESTINATION "${MOCKTAIL_INSTALL_DATA_DIR}/metadata"
)
install(FILES packaging/space.bigrat.mocktail.desktop
DESTINATION "${CMAKE_INSTALL_DATADIR}/applications"
)
install(FILES packaging/space.bigrat.mocktail.metainfo.xml
# The installed desktop entry names the binary by its install path, so it
# launches from sessions whose PATH lacks the install prefix. Uses the prefix
# given at install time, not the configure-time one.
install(CODE "
file(READ \"${CMAKE_SOURCE_DIR}/packaging/io.github.CoderDayton.nightcap.desktop\"
MOCKTAIL_DESKTOP_ENTRY)
string(REPLACE \"Exec=env SDL_VIDEODRIVER=wayland,x11 mocktail %u\"
\"Exec=env SDL_VIDEODRIVER=wayland,x11 \${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/mocktail %u\"
MOCKTAIL_DESKTOP_ENTRY \"\${MOCKTAIL_DESKTOP_ENTRY}\")
file(WRITE \"${CMAKE_BINARY_DIR}/io.github.CoderDayton.nightcap.desktop\"
\"\${MOCKTAIL_DESKTOP_ENTRY}\")
file(INSTALL \"${CMAKE_BINARY_DIR}/io.github.CoderDayton.nightcap.desktop\"
DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/applications\")
")
install(FILES packaging/io.github.CoderDayton.nightcap.metainfo.xml
DESTINATION "${CMAKE_INSTALL_DATADIR}/metainfo"
)
install(FILES packaging/space.bigrat.mocktail.svg
install(FILES packaging/io.github.CoderDayton.nightcap.svg
DESTINATION "${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps"
)
set(MOCKTAIL_HICOLOR_ICON_SIZES
@@ -739,7 +752,7 @@ set(MOCKTAIL_HICOLOR_ICON_SIZES
# Generated icons are committed, so ImageMagick is not a build dependency.
foreach(icon_size IN LISTS MOCKTAIL_HICOLOR_ICON_SIZES)
install(FILES
"packaging/icons/hicolor/${icon_size}x${icon_size}/apps/space.bigrat.mocktail.png"
"packaging/icons/hicolor/${icon_size}x${icon_size}/apps/io.github.CoderDayton.nightcap.png"
DESTINATION
"${CMAKE_INSTALL_DATADIR}/icons/hicolor/${icon_size}x${icon_size}/apps"
)
+27 -14
View File
@@ -1,45 +1,58 @@
<!-- Modified by vii from komaruworld/mocktail. See README "About this fork". -->
# FAQ
## How do I enable Discord RPC?
## How do I turn Discord RPC off?
RPC is disabled by default. Launch Mocktail once to create the config, then
close it. Open `config.yaml`:
RPC is on by default. It never signs in to Discord and never reads an
account token. To turn it off, launch Nightcap once to create the config,
then close it. Open `config.yaml`:
- Native / AppImage: `~/.config/mocktail/config.yaml`
- Flatpak: `~/.var/app/space.bigrat.mocktail/config/mocktail/config.yaml`
- Flatpak: `~/.var/app/io.github.CoderDayton.nightcap/config/mocktail/config.yaml`
For native installs, a custom `$XDG_CONFIG_HOME` replaces `~/.config`.
Set `enabled` to `true` under `integrations.discord_rpc`. If the block is
Set `enabled` to `false` under `integrations.discord_rpc`. If the block is
missing, add it under the existing `integrations` section:
```yaml
integrations:
discord_rpc:
enabled: true
enabled: false
```
Save the file, open Discord Desktop, and restart Mocktail. Set `enabled`
back to `false` to disable RPC.
Save the file and restart Nightcap. Set `enabled` back to `true` to turn
RPC on again.
## Can Discord count Nightcap as Roblox play time or quests?
No. Discord only credits play time and quests to games its own scanner
detects, and Rich Presence never counts. On Linux the scanner only matches
games with a Linux entry in Discord's list. Roblox has none, so no process
name Nightcap could use would be detected. Only Roblox or Discord can change
that.
## Where can I find logs for a bug report?
Mocktail saves logs automatically. Reproduce the issue, close Mocktail, and
Nightcap saves logs automatically. Reproduce the issue, close Nightcap, and
attach `latest.log`:
- Native / AppImage: `~/.local/state/mocktail/logs/latest.log`
- Flatpak: `~/.var/app/space.bigrat.mocktail/.local/state/mocktail/logs/latest.log`
- Flatpak: `~/.var/app/io.github.CoderDayton.nightcap/.local/state/mocktail/logs/latest.log`
For native installs, a custom `$XDG_STATE_HOME` replaces `~/.local/state`.
## Can I play in VR?
VR is experimental. Install the [build dependencies](README.md#building),
then switch to the `vr` branch and build:
VR is experimental and lives on upstream's `vr` branch, which does not
include the Nightcap changes. Install the
[build dependencies](README.md#building), then switch to that branch and
build:
```bash
git fetch origin
git switch vr
git remote add upstream https://github.com/komaruworld/mocktail.git
git fetch upstream
git switch -c vr upstream/vr
git submodule update --init --recursive
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DMOCKTAIL_ENABLE_VR=ON
cmake --build build -j4
+4 -3
View File
@@ -1,3 +1,4 @@
# Modified by vii from komaruworld/mocktail. See README "About this fork".
.DEFAULT_GOAL := all
.PHONY: all build release debug test apk install register-url-handler release-runtime portable portable-test standalone appimage flatpak run-flatpak run run-smoke run-unlimited run-game run-input run-resize run-network auto-run run-gles run-angle update-roblox update-auto update-auto-launch payload-status payload-rollback support-bundle clean submodules help
@@ -19,7 +20,7 @@ ANYLINUX_PACKAGER ?= quick-sharun
ANYLINUX_APPIMAGETOOL ?= appimagetool
PREFIX ?= /usr
FLATPAK_BUILD_DIR ?= build-flatpak
FLATPAK_MANIFEST ?= packaging/flatpak/space.bigrat.mocktail.json
FLATPAK_MANIFEST ?= packaging/flatpak/io.github.CoderDayton.nightcap.json
FLATPAK_JOBS ?= 4
define build_native_runtime
@@ -55,7 +56,7 @@ install: ## Install an already-built dynamic runtime (use: sudo make install)
register-url-handler: build ## Select this build for Roblox website links
@./scripts/register_url_handler.sh --set-default \
--executable "$(abspath $(BINARY))" \
--desktop-file "$(abspath packaging/space.bigrat.mocktail.desktop)"
--desktop-file "$(abspath packaging/io.github.CoderDayton.nightcap.desktop)"
test: ## Build and run all unit tests
$(call build_native_runtime,Debug,ON)
@@ -91,7 +92,7 @@ flatpak: ## Build and install the local x86-64 Flatpak
--jobs "$(FLATPAK_JOBS)"
run-flatpak: ## Run the installed Flatpak
@flatpak run space.bigrat.mocktail
@flatpak run io.github.CoderDayton.nightcap
run: export MOCKTAIL_AUTO_EXIT_AFTER_PRESENT_MS = 0
run: build ## Run the native binary interactively until the window is closed
+99 -91
View File
@@ -1,19 +1,69 @@
# Mocktail
<!-- Modified by vii from komaruworld/mocktail. See "About this fork" below. -->
# Nightcap
[![CI](https://github.com/komaruworld/mocktail/actions/workflows/ci.yml/badge.svg)](https://github.com/komaruworld/mocktail/actions/workflows/ci.yml)
[![Stars](https://img.shields.io/github/stars/komaruworld/mocktail?style=flat&logo=github)](https://github.com/komaruworld/mocktail/stargazers)
[![Downloads](https://img.shields.io/github/downloads/komaruworld/mocktail/total?logo=github)](https://github.com/komaruworld/mocktail/releases/latest)
[![CI](https://github.com/CoderDayton/nightcap/actions/workflows/ci.yml/badge.svg)](https://github.com/CoderDayton/nightcap/actions/workflows/ci.yml)
[![Stars](https://img.shields.io/github/stars/CoderDayton/nightcap?style=flat&logo=github)](https://github.com/CoderDayton/nightcap/stargazers)
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
[![Discord](https://img.shields.io/discord/1543955607869063269?label=discord)](https://discord.gg/rhgpfcmFSD)
Mocktail runs the Android `x86_64` Roblox client on Linux, including a Linux
userspace hosted by FreeBSD's Linuxulator. It provides the Android ABI and JNI
pieces the client expects, then connects them to SDL3 and Vulkan or OpenGL on
the Linux side.
Nightcap is Mocktail, tuned for playing on a real PC. It runs the Android
`x86_64` Roblox client on Linux, including a Linux userspace hosted by
FreeBSD's Linuxulator. It provides the Android ABI and JNI pieces the client
expects, then connects them to SDL3 and Vulkan or OpenGL on the Linux side.
Mocktail is an independent community project. It is not affiliated with Roblox
Nightcap is an independent community project. It is not affiliated with Roblox
Corporation or VinegarHQ and does not distribute the Roblox client.
## About this fork
Nightcap is a fork of [komaruworld/mocktail](https://github.com/komaruworld/mocktail)
with extra fixes for playing on a PC. The program and config paths keep the
`mocktail` name so upstream fixes still apply cleanly. The app ID is
`io.github.CoderDayton.nightcap`, so Nightcap and upstream can be installed
side by side.
- **Lower input lag.** Frames are shown as soon as they are ready instead of
waiting in a queue.
- **Sharper textures.** Small textures are upscaled 4x by default, and you
can replace any texture with your own PNG in `~/.config/mocktail/textures`.
Set `MOCKTAIL_SMALL_TEXTURE_UPSCALE=1` to turn the upscale off.
- **ETC2 textures on any GPU.** Games that use compressed mobile textures now
render correctly on desktop GPUs, without stutter.
- **No more error 319 kicks.** Servers no longer drop you shortly after
joining.
- **Correct device info.** Roblox sees your real RAM and screen size.
- **Better desktop launcher.** Runs on Wayland and always finds the installed
binary.
Everything else works the same as upstream. See the
[roadmap](docs/ROADMAP.md) for what is coming next, the
[changelog](CHANGELOG.md) for what each release changed, and the
[FAQ](FAQ.md) for Discord RPC, logs, and VR.
## Install with Flatpak
```bash
flatpak install --user https://coderdayton.github.io/nightcap/nightcap.flatpakref
flatpak run io.github.CoderDayton.nightcap
```
Updates arrive through `flatpak update`. Nightcap is not on Flathub yet.
## AppImage
Grab the AppImage from the
[latest release](https://github.com/CoderDayton/nightcap/releases/latest),
make it executable, and run it:
```bash
chmod +x Nightcap-x86_64.AppImage
./Nightcap-x86_64.AppImage
```
Or build and install it from source using the steps under
[Building](#building). There are no AUR, DEB, or RPM packages of Nightcap.
Upstream ships those for unmodified Mocktail, see
[komaruworld/mocktail](https://github.com/komaruworld/mocktail#readme).
## How it works
```
@@ -21,91 +71,24 @@ Roblox APK -> signature and ABI checks -> Bionic + JNI -> SDL3 + Vulkan/OpenGL
```
The APK is checked before any native code is loaded. It is downloaded on first
launch and is not bundled with Mocktail. The last working copy is kept in case
launch and is not bundled with Nightcap. The last working copy is kept in case
an update fails.
## Install with Flatpak
Install the stable release from Flathub:
```bash
flatpak install flathub space.bigrat.mocktail
flatpak run space.bigrat.mocktail
```
Nightly builds are produced automatically from the latest `main` branch:
```bash
flatpak install --user https://mocktail.bigrat.space/mocktail.flatpakref
flatpak run space.bigrat.mocktail
```
## Install from the AUR
Arch Linux users can install either the pinned source release (`mocktail`) or
the current development version (`mocktail-git`) with an AUR helper:
```bash
paru -S mocktail-git
# or
yay -S mocktail-git
```
Use `mocktail` instead of `mocktail-git` to build the pinned release from
source, or install the stable prebuilt package with `paru -S mocktail-bin` or
`yay -S mocktail-bin`.
## Install with DNF
Fedora 44 users can install either the stable `mocktail` package or the
`mocktail-nightly` package built from `main`:
```bash
sudo curl -fsSL https://mocktail.bigrat.space/rpm/mocktail.repo \
-o /etc/yum.repos.d/mocktail.repo
sudo dnf install mocktail
# or
sudo dnf install mocktail-nightly
```
## Install with APT
Ubuntu 26.04 users can install either the stable `mocktail` package or the
`mocktail-nightly` package built from `main`:
```bash
sudo install -d -m 0755 /etc/apt/keyrings
sudo curl -fsSL https://mocktail.bigrat.space/mocktail-packages.gpg \
-o /etc/apt/keyrings/mocktail.gpg
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/mocktail.gpg] https://mocktail.bigrat.space/apt mocktail main" | \
sudo tee /etc/apt/sources.list.d/mocktail.list >/dev/null
sudo apt update
sudo apt install mocktail
# or
sudo apt install mocktail-nightly
```
## Direct downloads
Direct AppImage, DEB, and RPM downloads are available from the
[Website](https://mocktail.bigrat.space/) and
[GitHub Releases](https://github.com/komaruworld/mocktail/releases).
<details>
<summary>Screenshots</summary>
![Roblox home in Mocktail](assets/screenshots/flatpak-home.png)
![Roblox home in Nightcap](assets/screenshots/flatpak-home.png)
![Roblox gameplay in Mocktail](assets/screenshots/flatpak-gameplay-tower.png)
![Roblox gameplay in Nightcap](assets/screenshots/flatpak-gameplay-tower.png)
![Roblox experience in Mocktail](assets/screenshots/flatpak-gameplay-lobby.png)
![Roblox experience in Nightcap](assets/screenshots/flatpak-gameplay-lobby.png)
</details>
## FFlag overrides
Put a JSON object in `$XDG_CONFIG_HOME/mocktail/fflags.json` (usually
`~/.config/mocktail/fflags.json`). Mocktail applies it on the next launch.
`~/.config/mocktail/fflags.json`). Nightcap applies it on the next launch.
PC profiles use the legacy Charts page by default to avoid the blank screen
caused by `Color3` errors in the newer SDUI page. An explicit
@@ -117,15 +100,18 @@ caused by `Color3` errors in the newer SDUI page. An explicit
"DFIntExample": "120"
}
```
## FAQ
## Settings
To see the most Frequently Asked Question go check [FAQ.md](FAQ.md)
Edit `~/.config/mocktail/config.yaml`. 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.
- `graphics.backend: opengl` if Vulkan does not work on your GPU.
## Building
Linux `x86_64` is supported. Experimental FreeBSD 15.1 Linuxulator support has
been tested with an `x86_64` Fedora 44 userspace. On FreeBSD, Mocktail runs
been tested with an `x86_64` Fedora 44 userspace. On FreeBSD, Nightcap runs
inside Linuxulator; it is not a native FreeBSD binary. Building requires CMake
3.20+, Git, pkg-config, LLD, binutils, a C++17 compiler, SDL 3.4+, SDL3_ttf,
Vulkan, EGL, libplacebo, fontconfig, libcurl, OpenSSL, libelf, libyaml, minizip,
@@ -172,17 +158,34 @@ sudo dnf install gcc-c++ cmake git ninja-build pkgconf-pkg-config lld \
</details>
```bash
git clone --recurse-submodules https://github.com/komaruworld/mocktail.git
cd mocktail
git clone --recurse-submodules https://github.com/CoderDayton/nightcap.git
cd nightcap
make build
./build/mocktail
```
To install it for your user, with an app menu entry and Roblox link handling:
```bash
make install PREFIX=~/.local
```
Use `sudo make install` instead to install system-wide under `/usr`. To make
Roblox website links open the build tree copy without installing, run
`make register-url-handler`.
To run the same checks as CI before each commit and push, install
[lefthook](https://github.com/evilmartians/lefthook) and run once:
```bash
lefthook install
```
## Known limitations
Mocktail does not currently work with `hardened_malloc`. Using
`hardened_malloc` may cause Mocktail to fail to start or crash during runtime.
Run Mocktail without `hardened_malloc` enabled.
Nightcap does not currently work with `hardened_malloc`. Using
`hardened_malloc` may cause Nightcap to fail to start or crash during runtime.
Run Nightcap without `hardened_malloc` enabled.
## License
@@ -190,7 +193,12 @@ Run Mocktail without `hardened_malloc` enabled.
## Support
You can support the project by giving it a star or with cryptocurrency:
Support this fork by giving it a star or with cryptocurrency:
- LTC: `LdABR2ELRYrUESWZWrEk1uNx38gHHMuHUU`
- SOL: `tjeDnPoWeyW8zfTf8c5CVAm5QTV8vFPaPouaScAdwfT`
Support the upstream project, which does most of the heavy lifting:
- USDT (TON): `UQCi6Yzcc9cOctoij6n_r1K90-OdVxAT0D_xo2UzGKkQaJDY`
- USDT (TRC20): `TNPMG9Vig2xiuo2r1QqnXRChPH7Vu28Jmx`
+2 -1
View File
@@ -1,3 +1,4 @@
# Modified by vii from komaruworld/mocktail. See README "About this fork".
# Copyright 2026 Mocktail Project Authors
# Licensed under the Apache License, Version 2.0.
@@ -12,7 +13,7 @@ find_path(MOCKTAIL_EGL_INCLUDE_DIR EGL/egl.h REQUIRED)
find_path(MOCKTAIL_GLES3_INCLUDE_DIR GLES3/gl3.h REQUIRED)
set(MOCKTAIL_WINDOW_ICON_PNG
"${MOCKTAIL_PLATFORM_GRAPHICS_ROOT}/packaging/icons/hicolor/48x48/apps/space.bigrat.mocktail.png"
"${MOCKTAIL_PLATFORM_GRAPHICS_ROOT}/packaging/icons/hicolor/48x48/apps/io.github.CoderDayton.nightcap.png"
)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
"${MOCKTAIL_WINDOW_ICON_PNG}"
+14 -3
View File
@@ -1,3 +1,4 @@
# Modified by vii from komaruworld/mocktail. See README "About this fork".
# Mocktail configuration.
# The file is created once with mode 0600. Mocktail never replaces your edits.
@@ -46,7 +47,9 @@ graphics:
# display, unlimited, or any positive integer; fixed values are forwarded to
# DFIntTaskSchedulerTargetFps without a whitelist.
# frame_rate_limit: -1
# Optional presentation synchronization override: auto, on, or off.
# Optional presentation synchronization override: auto, on, or off. auto
# presents through the lowest-latency synchronized mode the driver offers
# unless frame_rate_limit is unlimited.
# vsync: off
performance:
@@ -74,6 +77,14 @@ audio:
# between boots; prefer the exact device name when it is unique.
input_device: default
input:
# Boolean (default: false): send mouse look deltas in the host's own units.
# They are otherwise scaled by the window's pixel density divided by the
# desktop display scale, which cancels to 1.0 unless fractional scaling makes
# the two disagree. Turn this on when first-person aiming feels too slow or
# too fast under fractional scaling. The pointer position is unaffected.
raw_mouse: false
integrations:
fleasion:
# Boolean (default: false): trust Fleasion's CA without editing Roblox files.
@@ -86,9 +97,9 @@ integrations:
# or ~/.config/Fleasion/proxy_ca/ca.crt. Never select ca.key.
# ca_certificate: /home/user/.config/Fleasion/proxy_ca/ca.crt
discord_rpc:
# Boolean (default: false): publish Mocktail activity to Discord Desktop.
# Boolean (default: true): publish Nightcap activity to Discord Desktop.
# This never signs in to Discord and never reads an account token.
enabled: false
enabled: true
# Boolean (default: true): show the current Roblox experience name.
show_place_name: true
# Boolean (default: true): show how long the current session has run.
+95
View File
@@ -0,0 +1,95 @@
# Nightcap roadmap
What Nightcap is working toward, in priority order. Items move to
[Shipped](#shipped) when they land on `main`. Open an issue to propose a
change to this list.
## 1. Settings UI
Nightcap is configured by editing `~/.config/mocktail/config.yaml`. Most
people never open it, so they never find the FPS unlock or the vsync switch.
Goal: a small GTK4 settings window, reachable from the app menu and from a
`--settings` flag, that reads and writes the same `config.yaml`.
- Graphics tab: backend, frame rate limit, vsync, small texture upscale.
- Input tab: the `input.raw_mouse` toggle and controller options.
- Advanced tab: FFlag overrides with a plain text editor for `fflags.json`.
- Discord tab: the `discord_rpc` block (see item 3).
- Changes apply on next launch. A restart button restarts Nightcap.
Done when every option in `config/mocktail.example.yaml` that a player would
touch can be set without a text editor.
## 2. Controller button glyphs
Upstream added Xbox and PlayStation gamepad support through SDL. Controllers
already hot-plug and release their held inputs when unplugged. One rough edge
is left.
- Correct button glyphs for the connected pad. `SDL_GetGamepadType` is only
read for Xbox and PlayStation pads, so a Switch Pro, a GameCube pad, or any
generic pad SDL reports as `SDL_GAMEPAD_TYPE_STANDARD` reaches Roblox as
type 0 and draws generic glyphs. `SDL_GetRealGamepadType`, and the vendor
and product IDs, are available and unused.
Done when a plugged-in pad shows its own buttons.
## 3. Discord Rich Presence
Upstream ships Discord RPC. Nightcap turns it on by default; see the
[FAQ](../FAQ.md) to switch it off. It shows the experience name, elapsed
time, the experience icon, and a join button when the server is public.
- Custom presence: set the title, details line, state line, and large and
small icons from `config.yaml`, with placeholders like the experience name
and elapsed time.
- A Discord tab in the settings window to toggle each field.
Done when a friend can see what you are playing and join in one click, and
you can switch it all off in one click.
## 4. Performance profiling
Every performance change should come with numbers. Today they come with a
feeling.
- A frame time overlay, toggled by a key and a config flag, showing CPU time,
GPU time, and present latency.
- Shader compile and pipeline cache tracing, so first-load stutter can be
measured and cut.
- A `--profile` flag that writes a Chrome-format trace file, readable in
`ui.perfetto.dev` and `chrome://tracing`.
- A short benchmark guide in `docs/` with a fixed set of experiences, so
before and after numbers can be compared across machines.
Done when a pull request that claims a speedup can show the trace that
proves it.
## Shipped
- Lower input latency: frames are presented as soon as they are ready.
- Controllers hot-plug without a restart, and a pad that is unplugged mid-game
releases its held buttons and sticks instead of leaving them stuck.
- Mouse look keeps responding after a long turn, instead of going dead until
the pointer travels back from past the screen edge.
- Optional raw mouse input: `input.raw_mouse` in `config.yaml` sends look
deltas in host units, so fractional display scaling no longer changes
first-person sensitivity.
- Small textures upscaled 4x by default, with PNG overrides in
`~/.config/mocktail/textures`.
- ETC2 textures decoded on desktop GPUs without stutter.
- No more error 319 kicks after joining a server.
- Roblox sees the real host RAM and screen size.
- Desktop launcher that works on Wayland and finds the installed binary.
- Discord Rich Presence on by default.
- Own app ID `io.github.CoderDayton.nightcap`, so Nightcap installs next to
upstream.
- AppImage and signed Flatpak releases on every `v*` tag, with the Flatpak
repo on GitHub Pages.
## Not planned
- Replacing the `mocktail` binary and config names. Keeping them makes
upstream merges clean.
- DEB, RPM, and AUR packages. Upstream ships those for unmodified Mocktail.
+71
View File
@@ -0,0 +1,71 @@
#ifndef MOCKTAIL_GRAPHICS_ETC2_DECODER_H_
#define MOCKTAIL_GRAPHICS_ETC2_DECODER_H_
#include <cstddef>
#include <cstdint>
namespace mocktail::graphics {
// ETC2 and EAC block encodings from the OpenGL ES 3.0 / Vulkan core formats.
// sRGB variants share the unorm encoding; the colour space belongs to the
// destination format.
enum class EtcFormat {
kEtc2Rgb8,
kEtc2Rgb8A1,
kEtc2Rgba8,
kEacR11,
kEacR11Signed,
kEacRg11,
kEacRg11Signed,
};
// Compressed bytes per 4x4 block.
std::size_t EtcBlockBytes(EtcFormat format);
// Decoded bytes per texel: 4 (RGBA8) for ETC2 formats, 2 per channel
// (16-bit, little-endian) for EAC formats.
std::size_t EtcDecodedTexelBytes(EtcFormat format);
// Decodes a width x height image stored as ceil(width/4) x ceil(height/4)
// blocks into row-major texels. Returns false, writing nothing, when a buffer
// is smaller than the image requires.
bool DecodeEtcImage(EtcFormat format, const std::uint8_t* source,
std::size_t source_bytes, std::uint32_t width,
std::uint32_t height, std::uint8_t* destination,
std::size_t destination_bytes);
// Decodes block rows [first_block_row, first_block_row + block_row_count) of
// the image DecodeEtcImage describes, writing only the texel rows those blocks
// cover. Bands that together cover every block row produce DecodeEtcImage's
// output. Returns false, writing nothing, when a buffer is too small or the
// rows lie outside the image.
bool DecodeEtcImageBlockRows(EtcFormat format, const std::uint8_t* source,
std::size_t source_bytes, std::uint32_t width,
std::uint32_t height,
std::uint32_t first_block_row,
std::uint32_t block_row_count,
std::uint8_t* destination,
std::size_t destination_bytes);
// One DecodeEtcImage call. Jobs must not share destination bytes.
struct EtcDecodeJob {
EtcFormat format = EtcFormat::kEtc2Rgb8;
const std::uint8_t* source = nullptr;
std::size_t source_bytes = 0;
std::uint32_t width = 0;
std::uint32_t height = 0;
std::uint8_t* destination = nullptr;
std::size_t destination_bytes = 0;
// Set to DecodeEtcImage's result.
bool ok = false;
};
// Decodes every job before returning. Large batches are split into block-row
// bands decoded on up to worker_count threads, the caller included; small
// batches decode on the caller only.
void DecodeEtcJobs(EtcDecodeJob* jobs, std::size_t count,
unsigned worker_count);
} // namespace mocktail::graphics
#endif // MOCKTAIL_GRAPHICS_ETC2_DECODER_H_
@@ -0,0 +1,68 @@
#ifndef MOCKTAIL_GRAPHICS_TEXTURE_OVERRIDE_H_
#define MOCKTAIL_GRAPHICS_TEXTURE_OVERRIDE_H_
#include <cstddef>
#include <cstdint>
#include <memory>
#include <mutex>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
namespace mocktail::graphics {
// Tightly packed RGBA8 pixels, row-major, top row first.
struct RgbaImage {
std::uint32_t width = 0;
std::uint32_t height = 0;
std::vector<std::uint8_t> pixels;
};
// FNV-1a over the bytes; the texture identity used for dump and override
// file names.
std::uint64_t HashBytes(const std::uint8_t* data, std::size_t size);
// 16 lowercase hex digits.
std::string HashName(std::uint64_t hash);
bool ReadPngRgba(const std::string& path, RgbaImage* image);
bool WritePngRgba(const std::string& path, const RgbaImage& image);
// Writes width x height RGBA8 pixels to destination, each destination pixel
// the average of the source box it covers. Growing repeats source pixels.
void ResampleRgba(const RgbaImage& source, std::uint32_t width,
std::uint32_t height, std::uint8_t* destination);
void ResampleRgba(const std::uint8_t* source, std::uint32_t source_width,
std::uint32_t source_height, std::uint32_t width,
std::uint32_t height, std::uint8_t* destination);
// Replacement textures keyed by the hash of a texture's level-0 compressed
// bytes. An override lives at <override_dir>/<hash>.png. With a dump
// directory, every level-0 texture seen is written once as
// <dump_dir>/<hash>_<width>x<height>.png so the hash can be found.
// Thread-safe.
class TextureOverrides {
public:
TextureOverrides(std::string override_dir, std::string dump_dir);
// MOCKTAIL_TEXTURE_OVERRIDE_DIR and MOCKTAIL_TEXTURE_DUMP_DIR.
static TextureOverrides FromEnvironment();
bool enabled() const { return !override_dir_.empty() || !dump_dir_.empty(); }
bool dumping() const { return !dump_dir_.empty(); }
// Null when no override file exists; lookups are cached either way.
std::shared_ptr<const RgbaImage> Lookup(std::uint64_t hash);
void Dump(std::uint64_t hash, std::uint32_t width, std::uint32_t height,
const std::uint8_t* rgba);
private:
std::string override_dir_;
std::string dump_dir_;
std::mutex mutex_;
std::unordered_map<std::uint64_t, std::shared_ptr<const RgbaImage>> cache_;
std::unordered_set<std::uint64_t> dumped_;
};
} // namespace mocktail::graphics
#endif // MOCKTAIL_GRAPHICS_TEXTURE_OVERRIDE_H_
@@ -0,0 +1,131 @@
#ifndef MOCKTAIL_GRAPHICS_VULKAN_ETC2_EMULATION_H_
#define MOCKTAIL_GRAPHICS_VULKAN_ETC2_EMULATION_H_
#include <vulkan/vulkan.h>
#include <cstdint>
#include "mocktail/graphics/etc2_decoder.h"
namespace mocktail::graphics {
// Host format that stores a decoded ETC2/EAC image, with its block encoding.
struct Etc2EmulatedFormat {
VkFormat host_format = VK_FORMAT_UNDEFINED;
EtcFormat etc_format = EtcFormat::kEtc2Rgb8;
};
// Maps an ETC2/EAC Vulkan format to its decoded host format. Returns false for
// every other format.
bool LookupEmulatedEtc2Format(VkFormat format, Etc2EmulatedFormat* out);
// Format features reported for an emulated ETC2/EAC format: the host format's
// sampling and transfer features only, as for a native compressed format.
VkFormatFeatureFlags EmulatedEtc2FormatFeatures(
VkFormatFeatureFlags host_features);
// Staging bytes consumed and decoded bytes produced by one 2D upload region.
// Returns false for an empty extent, a depth other than 1, or no layers.
bool Etc2UploadByteCounts(EtcFormat format, const VkExtent3D& extent,
std::uint32_t layer_count, VkDeviceSize* compressed,
VkDeviceSize* decoded);
// Whether emulated ETC2 is reported to the application as a supported
// feature, from the MOCKTAIL_ADVERTISE_ETC2 value: "0" hides it, anything
// else (or unset) reports it. Hidden ETC2 still decodes ETC2 images the
// application creates; it only steers the application toward other formats.
bool Etc2SupportAdvertised(const char* value);
bool Etc2SupportAdvertised();
// Factor applied to emulated ETC2 colour images no larger than
// kSmallTextureMaxExtent, from the MOCKTAIL_SMALL_TEXTURE_UPSCALE value:
// 1 leaves them alone; 2..8 create them that many times larger and resample
// every upload, so a texture override can carry more detail than the
// original. Unset or non-numeric values use kDefaultSmallTextureUpscale;
// numeric values out of range are clamped.
inline constexpr std::uint32_t kSmallTextureMaxExtent = 64;
inline constexpr std::uint32_t kDefaultSmallTextureUpscale = 4;
std::uint32_t SmallTextureUpscale(const char* value);
// Reports ETC2/EAC support on hosts without native ETC2 (desktop GPUs) and
// stores those textures decoded. Images are created with the host format;
// each staged upload into one is redirected to a host-visible staging buffer
// that is filled by decoding the application's staging bytes when the
// command buffer is submitted. Every submit decodes again, as a native copy
// re-reads its source on each execution.
// Staging buffers live until their command buffer is begun, reset or freed.
// MOCKTAIL_DISABLE_ETC2_EMULATION=1 turns the emulation off.
class VulkanEtc2Emulation final {
public:
VulkanEtc2Emulation();
~VulkanEtc2Emulation();
VulkanEtc2Emulation(const VulkanEtc2Emulation&) = delete;
VulkanEtc2Emulation& operator=(const VulkanEtc2Emulation&) = delete;
// True when this physical device lacks native ETC2 and emulation is on.
bool PhysicalDeviceNeedsEmulation(VkPhysicalDevice physical_device,
PFN_vkGetPhysicalDeviceFeatures host);
void RegisterDevice(VkDevice device, VkPhysicalDevice physical_device,
bool emulated,
const VkPhysicalDeviceMemoryProperties& memory,
PFN_vkGetDeviceProcAddr get_device_proc_addr);
void DestroyDevice(VkDevice device);
VkResult CreateImage(VkDevice device, const VkImageCreateInfo* create_info,
const VkAllocationCallbacks* allocator, VkImage* image);
void DestroyImage(VkDevice device, VkImage image,
const VkAllocationCallbacks* allocator);
VkResult CreateImageView(VkDevice device,
const VkImageViewCreateInfo* create_info,
const VkAllocationCallbacks* allocator,
VkImageView* view);
VkResult BindBufferMemory(VkDevice device, VkBuffer buffer,
VkDeviceMemory memory, VkDeviceSize offset);
VkResult BindBufferMemory2(VkDevice device, std::uint32_t count,
const VkBindBufferMemoryInfo* infos);
VkResult MapMemory(VkDevice device, VkDeviceMemory memory,
VkDeviceSize offset, VkDeviceSize size,
VkMemoryMapFlags flags, void** data);
VkResult MapMemory2(VkDevice device, const VkMemoryMapInfo* info,
void** data);
void UnmapMemory(VkDevice device, VkDeviceMemory memory);
VkResult UnmapMemory2(VkDevice device, const VkMemoryUnmapInfo* info);
void FreeMemory(VkDevice device, VkDeviceMemory memory,
const VkAllocationCallbacks* allocator);
void DestroyBuffer(VkDevice device, VkBuffer buffer,
const VkAllocationCallbacks* allocator);
void CmdCopyBufferToImage(VkDevice device, VkCommandBuffer command_buffer,
VkBuffer source, VkImage destination,
VkImageLayout layout, std::uint32_t region_count,
const VkBufferImageCopy* regions);
void CmdCopyBufferToImage2(VkDevice device, VkCommandBuffer command_buffer,
const VkCopyBufferToImageInfo2* info);
void CmdCopyImage(VkDevice device, VkCommandBuffer command_buffer,
VkImage source, VkImageLayout source_layout,
VkImage destination, VkImageLayout destination_layout,
std::uint32_t region_count, const VkImageCopy* regions);
void CmdCopyImage2(VkDevice device, VkCommandBuffer command_buffer,
const VkCopyImageInfo2* info);
void CmdExecuteCommands(VkDevice device, VkCommandBuffer command_buffer,
std::uint32_t count,
const VkCommandBuffer* secondaries);
// Decodes every upload recorded into these command buffers and the
// secondary command buffers they execute. Large batches decode on worker
// threads; this returns once every upload is decoded.
void PrepareSubmit(const VkCommandBuffer* command_buffers,
std::uint32_t count);
// Destroys the staging buffers owned by a command buffer that is no longer
// pending.
void ReleaseCommandBuffer(VkCommandBuffer command_buffer);
struct State;
private:
State* state_;
};
} // namespace mocktail::graphics
#endif // MOCKTAIL_GRAPHICS_VULKAN_ETC2_EMULATION_H_
@@ -1,3 +1,4 @@
// Modified by vii from komaruworld/mocktail. See README "About this fork".
#ifndef MOCKTAIL_PLATFORM_SDL_APPLICATION_METADATA_H_
#define MOCKTAIL_PLATFORM_SDL_APPLICATION_METADATA_H_
@@ -6,9 +7,9 @@
namespace mocktail {
namespace platform {
inline constexpr char kMocktailApplicationName[] = "Mocktail";
inline constexpr char kMocktailApplicationName[] = "Nightcap";
inline constexpr char kMocktailApplicationIdentifier[] =
"space.bigrat.mocktail";
"io.github.CoderDayton.nightcap";
// Configures the stable compositor identity before SDL initializes. The
// identifier matches the installed desktop file and icon name so Wayland and
+28
View File
@@ -0,0 +1,28 @@
#ifndef MOCKTAIL_RUNTIME_DEVICE_MEMORY_PROFILE_H_
#define MOCKTAIL_RUNTIME_DEVICE_MEMORY_PROFILE_H_
#include <cstdint>
namespace mocktail {
namespace runtime {
// Android ActivityManager memory values published through DeviceParams.
// Roblox derives its device RAM tier, and tiered render budgets, from them.
struct DeviceMemoryProfile {
std::int32_t total_memory_mb = 0;
std::int32_t memory_class_mb = 0;
std::int32_t large_memory_class_mb = 0;
std::int64_t low_memory_killer_background_threshold = 0;
std::int64_t low_memory_killer_foreground_threshold = 0;
bool low_ram_device = false;
};
// Hosts with at least 4 GiB report their real total memory as a normal-RAM
// device. Smaller hosts, or an unreadable total (0), keep the 2 GiB low-RAM
// profile.
DeviceMemoryProfile BuildDeviceMemoryProfile(std::uint64_t host_memory_bytes);
} // namespace runtime
} // namespace mocktail
#endif // MOCKTAIL_RUNTIME_DEVICE_MEMORY_PROFILE_H_
+73
View File
@@ -0,0 +1,73 @@
#ifndef MOCKTAIL_RUNTIME_DISPLAY_SIZE_H_
#define MOCKTAIL_RUNTIME_DISPLAY_SIZE_H_
#include <cstdint>
#include <limits>
namespace mocktail {
namespace runtime {
// Host display or window size in physical pixels, published to the Android
// guest. Header-only so the JNI VM can use it without link dependencies.
struct DisplaySize {
std::int32_t width = 1920;
std::int32_t height = 1080;
};
// Environment handoffs written after the host window exists, as
// "WIDTHxHEIGHT": the window's display mode and the window's initial pixels.
inline constexpr const char* kDisplaySizeEnvironment =
"MOCKTAIL_DISPLAY_SIZE_INTERNAL";
inline constexpr const char* kWindowSizeEnvironment =
"MOCKTAIL_WINDOW_SIZE_INTERNAL";
// Parses "WIDTHxHEIGHT". A null, malformed or non-positive value, or one that
// does not fit a Java int, yields the 1920x1080 fallback.
inline DisplaySize ParseDisplaySize(const char* value) {
const DisplaySize fallback;
if (value == nullptr) {
return fallback;
}
std::int64_t parts[2] = {0, 0};
const char* cursor = value;
for (int index = 0; index < 2; ++index) {
if (*cursor < '0' || *cursor > '9') {
return fallback;
}
std::int64_t parsed = 0;
while (*cursor >= '0' && *cursor <= '9') {
parsed = parsed * 10 + (*cursor - '0');
if (parsed > std::numeric_limits<std::int32_t>::max()) {
return fallback;
}
++cursor;
}
if (parsed == 0) {
return fallback;
}
parts[index] = parsed;
if (index == 0) {
if (*cursor != 'x') {
return fallback;
}
++cursor;
}
}
if (*cursor != '\0') {
return fallback;
}
return {static_cast<std::int32_t>(parts[0]),
static_cast<std::int32_t>(parts[1])};
}
// Physical length of a pixel span at the guest's fixed 160 dpi, rounded down
// to whole millimetres.
inline std::int32_t PixelsToMillimetersAt160Dpi(std::int32_t pixels) {
return static_cast<std::int32_t>(static_cast<std::int64_t>(pixels) * 254 /
1600);
}
} // namespace runtime
} // namespace mocktail
#endif // MOCKTAIL_RUNTIME_DISPLAY_SIZE_H_
+12 -10
View File
@@ -1,9 +1,11 @@
// Modified by vii from komaruworld/mocktail. See README "About this fork".
#ifndef MOCKTAIL_RUNTIME_PERFORMANCE_POLICY_H_
#define MOCKTAIL_RUNTIME_PERFORMANCE_POLICY_H_
#include <cstdint>
#include <string>
#include <string_view>
#include <vector>
#include "runtime/frame_rate_policy.h"
#include "runtime/game_mode.h"
@@ -49,18 +51,18 @@ PerformancePolicy ParsePerformancePolicy(
// Respects CPU affinity and falls back to the available logical count.
int DetectAvailablePhysicalCoreCount();
// Disabled policy preserves overrides; conflicting values fail.
bool MergePerformanceClientSettingsOverrides(const PerformancePolicy& policy,
std::string_view base_json,
std::string* merged_json,
std::string* error);
// Disabled policy preserves overrides. A base_json value that differs from
// the preset is kept as-is and its key is appended to kept_overrides.
bool MergePerformanceClientSettingsOverrides(
const PerformancePolicy& policy, std::string_view base_json,
std::string* merged_json, std::string* error,
std::vector<std::string>* kept_overrides = nullptr);
// Applies mandatory HTTP and crash policies after caller settings.
bool MergeRuntimeClientSettingsOverrides(const FrameRatePolicy& frame_rate,
const PerformancePolicy& performance,
std::string_view base_json,
std::string* merged_json,
std::string* error);
bool MergeRuntimeClientSettingsOverrides(
const FrameRatePolicy& frame_rate, const PerformancePolicy& performance,
std::string_view base_json, std::string* merged_json, std::string* error,
std::vector<std::string>* kept_overrides = nullptr);
// Keeps the legacy test bypass disabled. The host PermissionsProtocol now
// answers microphone authorization from capture configuration. No permission
@@ -123,6 +123,7 @@ class RobloxInputRuntime final {
RobloxInputSnapshot Snapshot() const;
Status GetMainWindowIsMouseLockedCenter(bool* locked_center);
bool SupportsGamepads() const;
void SetRawMouseEnabled(bool enabled);
static void PlatformEventCallback(void* context,
const platform::PlatformEvent& event);
+4
View File
@@ -171,6 +171,9 @@ class RobloxInputRouter final {
const RobloxTextFocusProperties& properties);
RobloxInputDispatchResult HandleEvent(const platform::PlatformEvent& event);
RobloxInputSnapshot Snapshot() const;
// Raw mouse sends look deltas in host units instead of guest surface units.
// The reported pointer position stays in guest units either way.
void SetRawMouseEnabled(bool enabled);
private:
struct ActiveTouch {
@@ -237,6 +240,7 @@ class RobloxInputRouter final {
std::vector<ActiveGamepad> gamepads_;
float mouse_x_ = 0.0f;
float mouse_y_ = 0.0f;
bool raw_mouse_ = false;
};
const char* RobloxInputDispatchStateName(RobloxInputDispatchState state);
@@ -36,6 +36,7 @@ class RobloxWindowInputRuntime final {
Status UpdateTextFocusProperties(uint64_t generation,
const RobloxTextFocusProperties& properties);
RobloxInputSnapshot Snapshot() const;
void SetRawMouseEnabled(bool enabled);
private:
static void PlatformEventCallback(void* context,
+6 -1
View File
@@ -1,3 +1,4 @@
// Modified by vii from komaruworld/mocktail. See README "About this fork".
#ifndef MOCKTAIL_RUNTIME_RUNTIME_CONFIG_H_
#define MOCKTAIL_RUNTIME_RUNTIME_CONFIG_H_
@@ -38,6 +39,10 @@ struct InputCapabilityConfig {
bool touch_enabled = false;
bool mouse_enabled = true;
bool keyboard_enabled = true;
// Mouse look deltas keep their host units instead of being scaled into guest
// surface units. The two differ only when the desktop display scale and the
// window's pixel density disagree, as under fractional scaling.
bool raw_mouse = false;
};
struct NetworkProxyConfig {
@@ -55,7 +60,7 @@ struct DiscordRpcTextConfig {
};
struct DiscordRpcConfig {
bool enabled = false;
bool enabled = true;
bool show_place_name = true;
bool show_elapsed_time = true;
bool join_enabled = true;
+23
View File
@@ -0,0 +1,23 @@
# Local git hooks. Install once with: lefthook install
# Mirrors the "Repository contracts" job in .github/workflows/ci.yml.
pre-commit:
parallel: true
commands:
shell-syntax:
glob: "{scripts,tests,packaging}/**/*.sh"
run: for f in {staged_files}; do bash -n "$f" || exit 1; done
json:
glob: "{config,packaging}/**/*.json"
run: for f in {staged_files}; do jq empty "$f" || exit 1; done
desktop-entry:
glob: "*.desktop"
run: desktop-file-validate {staged_files}
pre-push:
commands:
packaging-contracts:
run: >-
bash tests/managed_payload_build_contract_test.sh . &&
bash tests/flatpak_packaging_test.sh . &&
bash tests/native_packaging_test.sh .
@@ -1,5 +1,5 @@
{
"app-id": "space.bigrat.mocktail",
"app-id": "io.github.CoderDayton.nightcap",
"runtime": "org.gnome.Platform",
"runtime-version": "50",
"sdk": "org.gnome.Sdk",
+8 -8
View File
@@ -1,3 +1,4 @@
<!-- Modified by vii from komaruworld/mocktail. See the top-level README "About this fork". -->
# FreeBSD Linuxulator
FreeBSD Linuxulator support is experimental. I tested it on FreeBSD
@@ -15,7 +16,7 @@ tested source revision is `aadd58dddcbc78f4d5594827b46b5633552b15ce`. Run
the following commands as root.
```sh
fetch -o /root/linuxulator.patch https://raw.githubusercontent.com/komaruworld/mocktail/main/packaging/freebsd/linuxulator.patch
fetch -o /root/linuxulator.patch https://raw.githubusercontent.com/CoderDayton/nightcap/main/packaging/freebsd/linuxulator.patch
cd /usr/src
git apply /root/linuxulator.patch
make -j2 kernel-toolchain
@@ -40,11 +41,10 @@ After reboot, verify the result from the Fedora userspace. It must print
chroot /compat/linux stat -f -c %t /proc
```
## Run Mocktail
## Run Nightcap
You can simply run the Mocktail AppImage from the
[latest release](https://github.com/komaruworld/mocktail/releases/latest) or
[nightly build](https://github.com/komaruworld/mocktail/releases/tag/continuous)
You can simply run the Nightcap AppImage from the
[latest release](https://github.com/CoderDayton/nightcap/releases/latest)
inside the Fedora userspace.
## Audio
@@ -72,11 +72,11 @@ ctl.!default {
EOF
```
Launch Mocktail with the ALSA audio driver.
Launch Nightcap with the ALSA audio driver.
```sh
SDL_AUDIO_DRIVER=alsa ./Mocktail-x86_64.AppImage
SDL_AUDIO_DRIVER=alsa ./Nightcap-x86_64.AppImage
```
Mocktail cannot override this check because Roblox reads `/proc` directly. The
Nightcap cannot override this check because Roblox reads `/proc` directly. The
Linuxulator patch fixes the value before Roblox sees it.
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 903 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 771 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1014 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

@@ -0,0 +1,13 @@
# Modified by vii from komaruworld/mocktail. See README "About this fork".
[Desktop Entry]
Type=Application
Name=Nightcap
GenericName=Roblox Player
Comment=Play Roblox on Linux
Exec=env SDL_VIDEODRIVER=wayland,x11 mocktail %u
Icon=io.github.CoderDayton.nightcap
StartupWMClass=io.github.CoderDayton.nightcap
Categories=Game;
Terminal=false
MimeType=x-scheme-handler/roblox;x-scheme-handler/roblox-player;
X-Mocktail-Managed=true
@@ -1,20 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Modified by vii from komaruworld/mocktail. See README "About this fork". -->
<!-- Copyright 2026 Mocktail Project Authors -->
<!-- SPDX-License-Identifier: CC0-1.0 -->
<component type="desktop-application">
<id>space.bigrat.mocktail</id>
<name>Mocktail</name>
<id>io.github.CoderDayton.nightcap</id>
<name>Nightcap</name>
<summary>Play Roblox on Linux</summary>
<metadata_license>CC0-1.0</metadata_license>
<project_license>Apache-2.0</project_license>
<developer id="space.bigrat">
<name>Mocktail Project Authors</name>
<developer id="io.github.coderdayton">
<name>vii</name>
</developer>
<branding>
<color type="primary" scheme_preference="light">#CEB3EF</color>
<color type="primary" scheme_preference="dark">#2F2A6B</color>
</branding>
<url type="homepage">https://github.com/komaruworld/mocktail</url>
<url type="homepage">https://github.com/CoderDayton/nightcap</url>
<description>
<p>
Sign in to Roblox, browse experiences, and play them on Linux.
@@ -38,7 +39,7 @@
<caption>Play DOORS on Linux</caption>
</screenshot>
</screenshots>
<launchable type="desktop-id">space.bigrat.mocktail.desktop</launchable>
<launchable type="desktop-id">io.github.CoderDayton.nightcap.desktop</launchable>
<content_rating type="oars-1.1">
<content_attribute id="violence-cartoon">moderate</content_attribute>
<content_attribute id="violence-fantasy">moderate</content_attribute>
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Modified by vii from komaruworld/mocktail. See README "About this fork". -->
<!-- Copyright 2026 Mocktail Project Authors -->
<!-- SPDX-License-Identifier: Apache-2.0 -->
<svg xmlns="http://www.w3.org/2000/svg"
@@ -6,7 +7,7 @@
height="512"
viewBox="96 96 320 320"
fill="none">
<title>Mocktail</title>
<title>Nightcap</title>
<mask id="mocktail-mark"
mask-type="alpha"
maskUnits="userSpaceOnUse"
@@ -19,12 +20,12 @@
</mask>
<g mask="url(#mocktail-mark)">
<path d="M461.343 267.246L461.165 265.65L444.708 108.145C444.345 105.047 443.009 102.143 440.894 99.8515C438.769 97.5865 436.001 96.028 432.962 95.3864C429.924 94.7448 426.761 95.051 423.903 96.2637C421.056 97.5364 418.67 99.6554 417.07 102.332L356.5 146L206 108.145L193.521 42.4325C193.5 39.3045 192.493 36.2626 190.644 33.7398C188.774 31.2601 186.189 29.4138 183.237 28.4502C180.285 27.4866 177.108 27.4521 174.135 28.3513C171.161 29.2864 168.555 31.1314 166.685 33.6262L73.5931 161.71L72.6616 163.009C59.2667 181.485 52.2413 203.814 52.6444 226.631C53.0476 249.448 60.8576 271.515 74.8967 289.505L75.0459 289.702L75.453 290.192L142.096 374.97L174.978 417.241L195.02 442.943C197.361 445.962 200.625 448.131 204.315 449.12C208.005 450.109 211.918 449.862 215.455 448.418L245.662 436.181L295.274 416.014L395.981 375.674L396.235 375.562C417.35 366.989 435.112 351.794 446.852 332.262C458.593 312.73 463.678 289.915 461.343 267.246Z"
fill="#E24329"/>
fill="#2F2A6B"/>
<path d="M461.403 267.484L461.225 265.887C433.09 264.216 404.933 268.779 378.766 279.25L234.209 337.935C266.844 379.87 295.27 416.324 295.27 416.324L403.5 418L396.231 375.873C417.371 367.306 435.156 352.105 446.91 332.557C458.664 313.009 463.75 290.172 461.403 267.484Z"
fill="#FC6D26"/>
fill="#6C4FD1"/>
<path d="M142.135 375.279L175.016 417.549L195.058 443.252C197.399 446.271 200.664 448.44 204.354 449.429C208.044 450.418 211.956 450.171 215.493 448.727L245.701 436.489L295.313 416.323C295.313 416.323 266.867 379.774 234.21 337.922C185.002 357.838 142.135 375.279 142.135 375.279Z"
fill="#FCA326"/>
fill="#A78BFA"/>
<path d="M138.341 214.829C120.941 192.647 98.8514 174.589 73.6535 161.948L72.722 163.247C59.3272 181.723 52.3017 204.052 52.7049 226.869C53.1081 249.685 60.918 271.752 74.9572 289.743L75.1064 289.94L41.5 337.851L142.156 375.208C142.156 375.208 184.959 357.839 234.232 337.851L138.341 214.829Z"
fill="#FC6D26"/>
fill="#6C4FD1"/>
</g>
</svg>
-12
View File
@@ -1,12 +0,0 @@
[Desktop Entry]
Type=Application
Name=Mocktail
GenericName=Roblox Player
Comment=Play Roblox on Linux
Exec=mocktail %u
Icon=space.bigrat.mocktail
StartupWMClass=space.bigrat.mocktail
Categories=Game;
Terminal=false
MimeType=x-scheme-handler/roblox;x-scheme-handler/roblox-player;
X-Mocktail-Managed=true
+25 -40
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# Modified by vii from komaruworld/mocktail. See README "About this fork".
# Copyright 2026 Mocktail Project Authors
# SPDX-License-Identifier: Apache-2.0
@@ -9,8 +10,8 @@ readonly REPOSITORY="${1:?Flatpak repository path is required}"
readonly BUNDLE="${2:?Flatpak bundle path is required}"
readonly PUBLIC_KEY="${3:?GPG public key path is required}"
readonly OUTPUT="${4:?Pages output path is required}"
readonly NATIVE_REPOSITORIES="${5:?Native repositories path is required}"
readonly BASE_URL="https://mocktail.bigrat.space"
readonly BASE_URL="https://coderdayton.github.io/nightcap"
readonly APP_ID="io.github.CoderDayton.nightcap"
readonly SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
readonly PROJECT_DIR="$(dirname -- "${SCRIPT_DIR}")"
@@ -26,13 +27,6 @@ readonly PROJECT_DIR="$(dirname -- "${SCRIPT_DIR}")"
printf 'Flatpak public key is missing or unsafe: %s\n' "${PUBLIC_KEY}" >&2
exit 1
}
[[ -d "${NATIVE_REPOSITORIES}/apt" &&
-d "${NATIVE_REPOSITORIES}/rpm" &&
-d "${NATIVE_REPOSITORIES}/downloads" &&
-s "${NATIVE_REPOSITORIES}/mocktail-packages.gpg" ]] || {
printf 'Native repositories are missing: %s\n' "${NATIVE_REPOSITORIES}" >&2
exit 1
}
[[ ! -e "${OUTPUT}" ]] || {
printf 'Pages output already exists: %s\n' "${OUTPUT}" >&2
exit 1
@@ -40,50 +34,41 @@ readonly PROJECT_DIR="$(dirname -- "${SCRIPT_DIR}")"
mkdir -p -- "${OUTPUT}"
cp -a -- "${REPOSITORY}" "${OUTPUT}/repo"
install -m 0644 -- "${BUNDLE}" "${OUTPUT}/Mocktail-x86_64.flatpak"
install -m 0644 -- "${PUBLIC_KEY}" "${OUTPUT}/mocktail-flatpak.gpg"
install -m 0644 -- "${BUNDLE}" "${OUTPUT}/Nightcap-x86_64.flatpak"
install -m 0644 -- "${PUBLIC_KEY}" "${OUTPUT}/nightcap-flatpak.gpg"
install -m 0644 -- \
"${PROJECT_DIR}/packaging/space.bigrat.mocktail.svg" \
"${OUTPUT}/mocktail.svg"
install -m 0644 -- \
"${PROJECT_DIR}/packaging/discord-join.html" \
"${OUTPUT}/join.html"
install -m 0644 -- "${PROJECT_DIR}/site/index.html" "${OUTPUT}/index.html"
install -m 0644 -- "${PROJECT_DIR}/site/styles.css" "${OUTPUT}/styles.css"
install -d -- "${OUTPUT}/packaging"
install -m 0644 -- \
"${PROJECT_DIR}/packaging/space.bigrat.mocktail.svg" \
"${OUTPUT}/packaging/space.bigrat.mocktail.svg"
cp -a -- "${NATIVE_REPOSITORIES}/apt" "${OUTPUT}/apt"
cp -a -- "${NATIVE_REPOSITORIES}/rpm" "${OUTPUT}/rpm"
cp -a -- "${NATIVE_REPOSITORIES}/downloads" "${OUTPUT}/downloads"
install -m 0644 -- \
"${NATIVE_REPOSITORIES}/mocktail-packages.gpg" \
"${OUTPUT}/mocktail-packages.gpg"
"${PROJECT_DIR}/packaging/${APP_ID}.svg" \
"${OUTPUT}/nightcap.svg"
touch -- "${OUTPUT}/.nojekyll"
readonly GPG_KEY="$(base64 --wrap=0 "${PUBLIC_KEY}")"
cat >"${OUTPUT}/mocktail.flatpakrepo" <<EOF
cat >"${OUTPUT}/nightcap.flatpakrepo" <<EOF
[Flatpak Repo]
Title=Mocktail Nightly
Title=Nightcap
Url=${BASE_URL}/repo/
Homepage=https://github.com/komaruworld/mocktail
Comment=Nightly builds of Mocktail
Description=Signed x86_64 nightly builds published from the latest Mocktail main branch
Icon=${BASE_URL}/mocktail.svg
Homepage=https://github.com/CoderDayton/nightcap
Comment=Nightcap releases
Description=Signed x86_64 release builds of Nightcap
Icon=${BASE_URL}/nightcap.svg
GPGKey=${GPG_KEY}
EOF
cat >"${OUTPUT}/mocktail.flatpakref" <<EOF
cat >"${OUTPUT}/nightcap.flatpakref" <<EOF
[Flatpak Ref]
Title=Mocktail Nightly
Name=space.bigrat.mocktail
Title=Nightcap
Name=${APP_ID}
Branch=stable
Url=${BASE_URL}/repo/
RuntimeRepo=https://dl.flathub.org/repo/flathub.flatpakrepo
Homepage=https://github.com/komaruworld/mocktail
Comment=Nightly build from the latest main branch
Icon=${BASE_URL}/mocktail.svg
Homepage=https://github.com/CoderDayton/nightcap
Comment=Roblox on Linux, tuned for a real PC
Icon=${BASE_URL}/nightcap.svg
GPGKey=${GPG_KEY}
IsRuntime=false
EOF
install -m 0644 -- "${PROJECT_DIR}/site/index.html" "${OUTPUT}/index.html"
install -m 0644 -- "${PROJECT_DIR}/site/styles.css" "${OUTPUT}/styles.css"
install -m 0644 -- "${PROJECT_DIR}/site/terms.html" "${OUTPUT}/terms.html"
install -m 0644 -- "${PROJECT_DIR}/site/privacy.html" "${OUTPUT}/privacy.html"
+2 -1
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# Modified by vii from komaruworld/mocktail. See README "About this fork".
# Copyright 2026 Mocktail Project Authors
# SPDX-License-Identifier: Apache-2.0
@@ -8,7 +9,7 @@ readonly SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
readonly PROJECT_ROOT="$(cd -- "${SCRIPT_DIR}/.." && pwd -P)"
BUILD_DIR="${PROJECT_ROOT}/build-flatpak"
MANIFEST="${PROJECT_ROOT}/packaging/flatpak/space.bigrat.mocktail.json"
MANIFEST="${PROJECT_ROOT}/packaging/flatpak/io.github.CoderDayton.nightcap.json"
JOBS="${MOCKTAIL_FLATPAK_JOBS:-4}"
Usage() {
+3 -2
View File
@@ -1,13 +1,14 @@
#!/usr/bin/env bash
# Modified by vii from komaruworld/mocktail. See README "About this fork".
# Copyright 2026 Mocktail Project Authors
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail
readonly project_root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
readonly source_icon="${project_root}/packaging/space.bigrat.mocktail.svg"
readonly source_icon="${project_root}/packaging/io.github.CoderDayton.nightcap.svg"
readonly output_root="${project_root}/packaging/icons/hicolor"
readonly icon_name="space.bigrat.mocktail.png"
readonly icon_name="io.github.CoderDayton.nightcap.png"
readonly icon_sizes=(16 22 24 32 36 48 64 72 96 128 192 256 512)
if ! command -v magick >/dev/null 2>&1; then
+3 -2
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# Modified by vii from komaruworld/mocktail. See README "About this fork".
# Copyright 2026 Mocktail Project Authors
# SPDX-License-Identifier: Apache-2.0
@@ -152,8 +153,8 @@ AnyLinuxDeploy() {
local -a deployment_environment=(
"APPDIR=${app_dir}" "MAIN_BIN=mocktail" "LIB_DIR=/usr/lib"
"TMPDIR=${ANYLINUX_WORK}/tmp"
"DESKTOP=/usr/share/applications/space.bigrat.mocktail.desktop"
"ICON=/usr/share/icons/hicolor/scalable/apps/space.bigrat.mocktail.svg"
"DESKTOP=/usr/share/applications/io.github.CoderDayton.nightcap.desktop"
"ICON=/usr/share/icons/hicolor/scalable/apps/io.github.CoderDayton.nightcap.svg"
"DEPLOY_DATADIR=0" "DEPLOY_LOCALE=0" "DEPLOY_VULKAN=0"
"STRACE_MODE=1" "STRACE_BINARY=mocktail" "STRACE_FLAGS=--help"
"STRACE_TIME=1"
+11 -10
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# Modified by vii from komaruworld/mocktail. See README "About this fork".
# Copyright 2026 Mocktail Project Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -920,25 +921,25 @@ BuildAppImage() {
ln -s "share/mocktail-bundle/run.sh" "${APPDIR}/usr/mocktail"
install -m 0755 -- "${PROJECT_ROOT}/packaging/AppRun" "${APPDIR}/AppRun"
install -m 0644 -- \
"${PROJECT_ROOT}/packaging/space.bigrat.mocktail.desktop" \
"${APPDIR}/space.bigrat.mocktail.desktop"
"${PROJECT_ROOT}/packaging/io.github.CoderDayton.nightcap.desktop" \
"${APPDIR}/io.github.CoderDayton.nightcap.desktop"
install -m 0644 -- \
"${PROJECT_ROOT}/packaging/space.bigrat.mocktail.desktop" \
"${APPDIR}/usr/share/applications/space.bigrat.mocktail.desktop"
"${PROJECT_ROOT}/packaging/io.github.CoderDayton.nightcap.desktop" \
"${APPDIR}/usr/share/applications/io.github.CoderDayton.nightcap.desktop"
install -m 0644 -- \
"${PROJECT_ROOT}/packaging/space.bigrat.mocktail.svg" \
"${APPDIR}/space.bigrat.mocktail.svg"
"${PROJECT_ROOT}/packaging/io.github.CoderDayton.nightcap.svg" \
"${APPDIR}/io.github.CoderDayton.nightcap.svg"
install -m 0644 -- \
"${PROJECT_ROOT}/packaging/space.bigrat.mocktail.svg" \
"${APPDIR}/usr/share/icons/hicolor/scalable/apps/space.bigrat.mocktail.svg"
"${PROJECT_ROOT}/packaging/io.github.CoderDayton.nightcap.svg" \
"${APPDIR}/usr/share/icons/hicolor/scalable/apps/io.github.CoderDayton.nightcap.svg"
for icon_path in \
"${PROJECT_ROOT}"/packaging/icons/hicolor/*x*/apps/space.bigrat.mocktail.png; do
"${PROJECT_ROOT}"/packaging/icons/hicolor/*x*/apps/io.github.CoderDayton.nightcap.png; do
[[ -f "${icon_path}" ]] || Die "hicolor icon set is incomplete"
icon_relative_path="${icon_path#"${PROJECT_ROOT}/packaging/icons/hicolor/"}"
install -D -m 0644 -- "${icon_path}" \
"${APPDIR}/usr/share/icons/hicolor/${icon_relative_path}"
done
ln -s space.bigrat.mocktail.svg "${APPDIR}/.DirIcon"
ln -s io.github.CoderDayton.nightcap.svg "${APPDIR}/.DirIcon"
mkdir -p -- "$(dirname -- "${APPIMAGE_OUTPUT}")"
ARCH=x86_64 appimagetool "${APPDIR}" "${APPIMAGE_OUTPUT}"
rm -rf -- "${APPDIR}"
+7 -4
View File
@@ -1,11 +1,12 @@
#!/usr/bin/env bash
# Modified by vii from komaruworld/mocktail. See README "About this fork".
# Copyright 2026 Mocktail Project Authors
# SPDX-License-Identifier: Apache-2.0
set -Eeuo pipefail
umask 077
readonly DESKTOP_ID="space.bigrat.mocktail.desktop"
readonly DESKTOP_ID="io.github.CoderDayton.nightcap.desktop"
readonly ROBLOX_SCHEME="x-scheme-handler/roblox"
readonly ROBLOX_PLAYER_SCHEME="x-scheme-handler/roblox-player"
@@ -139,8 +140,9 @@ desktop_source="$(ResolveRegularFile "${desktop_source}" "desktop template")"
[[ "$(grep -Fxc '[Desktop Entry]' "${desktop_source}")" == 1 &&
"$(grep -Fxc 'Type=Application' "${desktop_source}")" == 1 &&
"$(grep -Fxc 'Icon=space.bigrat.mocktail' "${desktop_source}")" == 1 &&
"$(grep -Fxc 'Exec=mocktail %u' "${desktop_source}")" == 1 &&
"$(grep -Fxc 'Icon=io.github.CoderDayton.nightcap' "${desktop_source}")" == 1 &&
"$(grep -Fxc 'Exec=env SDL_VIDEODRIVER=wayland,x11 mocktail %u' \
"${desktop_source}")" == 1 &&
"$(grep -Fxc 'MimeType=x-scheme-handler/roblox;x-scheme-handler/roblox-player;' \
"${desktop_source}")" == 1 &&
"$(grep -Fxc 'X-Mocktail-Managed=true' "${desktop_source}")" == 1 &&
@@ -173,7 +175,8 @@ temporary="$(mktemp "${applications_dir}/.${DESKTOP_ID}.XXXXXX.desktop")"
trap 'rm -f -- "${temporary}"' EXIT
while IFS= read -r line || [[ -n "${line}" ]]; do
if [[ "${line}" == Exec=* ]]; then
printf 'Exec=%s %%u\n' "${mocktail_executable}"
printf 'Exec=env SDL_VIDEODRIVER=wayland,x11 %s %%u\n' \
"${mocktail_executable}"
if [[ -n "${launch_working_directory}" ]]; then
printf 'Path=%s\n' "${launch_working_directory}"
fi
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# Print the CHANGELOG.md section for one version, for use as GitHub release
# notes. Usage: scripts/release_notes.sh v0.1.0 [CHANGELOG.md]
# Exits 1 when the version has no section, so a release cannot ship without
# notes.
set -Eeuo pipefail
readonly tag="${1:?tag is required, e.g. v0.1.0}"
readonly changelog="${2:-$(dirname -- "${BASH_SOURCE[0]}")/../CHANGELOG.md}"
readonly version="${tag#v}"
notes="$(awk -v version="${version}" '
/^## \[/ {
if (found) exit
found = ($0 ~ "^## \\[" version "\\]")
next
}
/^\[[^]]+\]: / { if (found) exit }
found { print }
' "${changelog}")"
# Trim leading and trailing blank lines.
notes="$(printf '%s\n' "${notes}" | sed -e '/./,$!d' | sed -e ':a' -e '/^\n*$/{$d;N;ba' -e '}')"
[[ -n "${notes}" ]] || {
printf 'CHANGELOG.md has no section for version %s\n' "${version}" >&2
exit 1
}
printf '%s\n' "${notes}"
+35 -54
View File
@@ -1,70 +1,51 @@
<!doctype html>
<!-- Modified by vii from komaruworld/mocktail. See README "About this fork". -->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark">
<title>Mocktail for Linux</title>
<title>Nightcap for Linux</title>
<link rel="icon" href="nightcap.svg" type="image/svg+xml">
<link rel="stylesheet" href="styles.css">
</head>
<body><main>
<img src="../packaging/space.bigrat.mocktail.svg" alt="Mocktail logo">
<h1>Mocktail</h1>
<p>Play Roblox on Linux. Use the stable Flathub release, or try the latest nightly build from main.</p>
<a class="button" href="https://flathub.org/apps/space.bigrat.mocktail">Stable on Flathub</a>
<a class="button secondary" href="https://mocktail.bigrat.space/mocktail.flatpakref">Nightly build</a>
<img src="nightcap.svg" alt="Nightcap logo">
<h1>Nightcap</h1>
<p>Play Roblox on Linux like it was made for your PC. Nightcap is Mocktail, tuned to feel fast and look sharp.</p>
<a class="button" href="https://github.com/CoderDayton/nightcap/releases/latest/download/Nightcap-x86_64.AppImage">Download AppImage</a>
<a class="button secondary" href="nightcap.flatpakref">Install with Flatpak</a>
<div class="commands">
<p>Stable</p>
<code>flatpak install flathub space.bigrat.mocktail</code>
<p>Nightly</p>
<code>flatpak install --user https://mocktail.bigrat.space/mocktail.flatpakref</code>
</div>
<h2>AUR packages</h2>
<p>Available from the AUR. Choose one package:</p>
<p class="links">
<a href="https://aur.archlinux.org/packages/mocktail">mocktail</a>
<a href="https://aur.archlinux.org/packages/mocktail-bin">mocktail-bin</a>
<a href="https://aur.archlinux.org/packages/mocktail-git">mocktail-git</a>
</p>
<code>yay -S mocktail
yay -S mocktail-bin
yay -S mocktail-git</code>
<h2>DNF repository</h2>
<p>Stable and nightly packages for Fedora 44. Choose one package.</p>
<code>sudo curl -fsSL https://mocktail.bigrat.space/rpm/mocktail.repo -o /etc/yum.repos.d/mocktail.repo</code>
<div class="commands">
<p>Stable</p>
<code>sudo dnf install mocktail</code>
<p>Nightly</p>
<code>sudo dnf install mocktail-nightly</code>
</div>
<h2>APT repository</h2>
<p>Stable and nightly packages for Ubuntu 26.04. Choose one package.</p>
<code>sudo install -d -m 0755 /etc/apt/keyrings
sudo curl -fsSL https://mocktail.bigrat.space/mocktail-packages.gpg -o /etc/apt/keyrings/mocktail.gpg
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/mocktail.gpg] https://mocktail.bigrat.space/apt mocktail main" | sudo tee /etc/apt/sources.list.d/mocktail.list &gt;/dev/null
sudo apt update</code>
<div class="commands">
<p>Stable</p>
<code>sudo apt install mocktail</code>
<p>Nightly</p>
<code>sudo apt install mocktail-nightly</code>
<p>AppImage</p>
<code>chmod +x Nightcap-x86_64.AppImage
./Nightcap-x86_64.AppImage</code>
<p>Flatpak</p>
<code>flatpak install --user https://coderdayton.github.io/nightcap/nightcap.flatpakref
flatpak run io.github.CoderDayton.nightcap</code>
<p>Build from source</p>
<code>git clone --recurse-submodules https://github.com/CoderDayton/nightcap.git
cd nightcap &amp;&amp; make build
./build/mocktail</code>
</div>
<h2>What's different</h2>
<ul>
<li>Lower input lag. Frames are shown as soon as they are ready.</li>
<li>Sharper textures, with your own PNG overrides if you want them.</li>
<li>ETC2 textures render correctly on desktop GPUs.</li>
<li>No more error 319 kicks after joining a server.</li>
<li>Roblox sees your real RAM and screen size.</li>
</ul>
<h2>Direct downloads</h2>
<p>Prebuilt packages for Linux x86_64.</p>
<p class="download-label">Stable</p>
<p>Prebuilt builds for Linux x86_64.</p>
<p class="links">
<a href="https://github.com/komaruworld/mocktail/releases/latest/download/Mocktail-x86_64.AppImage">AppImage</a>
<a href="https://mocktail.bigrat.space/downloads/mocktail.deb">DEB</a>
<a href="https://mocktail.bigrat.space/downloads/mocktail.rpm">RPM</a>
<a href="https://github.com/CoderDayton/nightcap/releases/latest/download/Nightcap-x86_64.AppImage">AppImage</a>
<a href="Nightcap-x86_64.flatpak">Flatpak bundle</a>
<a href="nightcap-flatpak.gpg">Signing key</a>
<a href="terms.html">Terms</a>
<a href="privacy.html">Privacy</a>
</p>
<p class="download-label">Nightly</p>
<p class="links">
<a href="https://github.com/komaruworld/mocktail/releases/download/continuous/mocktail-nightly.AppImage">AppImage</a>
<a href="https://github.com/komaruworld/mocktail/releases/download/continuous/mocktail-nightly.deb">DEB</a>
<a href="https://github.com/komaruworld/mocktail/releases/download/continuous/mocktail-nightly.rpm">RPM</a>
</p>
<p><a class="source" href="https://github.com/komaruworld/mocktail">Source code</a></p>
<p>Mocktail is an independent community project and is not affiliated with Roblox Corporation.</p>
<p><a class="source" href="https://github.com/CoderDayton/nightcap">Source code</a> ·
<a class="source" href="https://github.com/komaruworld/mocktail">Upstream Mocktail</a></p>
<p>Nightcap is an independent community project and is not affiliated with Roblox Corporation.</p>
</main></body>
</html>
+43
View File
@@ -0,0 +1,43 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark">
<title>Nightcap Privacy Policy</title>
<link rel="icon" href="nightcap.svg" type="image/svg+xml">
<link rel="stylesheet" href="styles.css">
</head>
<body><main>
<h1>Privacy Policy</h1>
<p>Nightcap is a Linux runtime for the Roblox Android client. This policy covers Nightcap itself and its Discord application. Roblox and Discord have their own policies for the data they handle.</p>
<h2>What Nightcap collects</h2>
<p>Nothing. Nightcap has no server. It does not collect, store, or send telemetry, analytics, crash reports, or account data to the Nightcap project.</p>
<h2>What stays on your machine</h2>
<ul>
<li>Configuration in <code>~/.config/mocktail/</code></li>
<li>Session logs and support bundles in <code>~/.local/state/mocktail/</code></li>
<li>Roblox login session under <code>~/.local/share/mocktail/</code></li>
<li>Roblox cache, downloaded payloads, and shader cache under <code>~/.cache/mocktail/</code></li>
</ul>
<p>Flatpak installs keep the same layout under <code>~/.var/app/io.github.CoderDayton.nightcap/</code>.</p>
<h2>Discord Rich Presence</h2>
<p>When Rich Presence is on, Nightcap sends the current experience name, its public icon URL, elapsed time, and an optional public server join code to the Discord desktop client on the same machine over a local socket. Discord displays this on your profile under its own privacy settings. Nightcap never signs in to Discord, never reads a Discord token, and never contacts Discord's servers.</p>
<p>Set <code>integrations.discord_rpc.enabled: false</code> in <code>config.yaml</code> to turn it off.</p>
<h2>Roblox</h2>
<p>Nightcap talks to Roblox's services exactly as the Roblox client would. That traffic is covered by the Roblox Privacy Policy.</p>
<h2>Contact</h2>
<p>Open an issue at <a class="source" href="https://github.com/CoderDayton/nightcap/issues">github.com/CoderDayton/nightcap/issues</a>.</p>
<p class="links">
<a href="index.html">Home</a>
<a href="terms.html">Terms of Service</a>
<a href="https://github.com/CoderDayton/nightcap">Source code</a>
</p>
</main></body>
</html>
+17 -11
View File
@@ -1,3 +1,4 @@
/* Modified by vii from komaruworld/mocktail. See README "About this fork". */
:root {
font: 17px/1.55 system-ui, sans-serif;
color-scheme: dark;
@@ -5,8 +6,8 @@
body {
margin: 0;
background: #0d1117;
color: #e6edf3;
background: #14122b;
color: #ece8ff;
}
main {
@@ -30,8 +31,13 @@ h2 {
font-size: 1.15rem;
}
p {
color: #9da7b3;
p,
li {
color: #b3aad6;
}
ul {
padding-left: 1.2rem;
}
a.button {
@@ -39,14 +45,14 @@ a.button {
margin: 16px 8px 16px 0;
padding: 12px 18px;
border-radius: 9px;
background: #238636;
background: #6c4fd1;
color: white;
font-weight: 700;
text-decoration: none;
}
a.secondary {
background: #21262d;
background: #2f2a6b;
}
.commands {
@@ -56,7 +62,7 @@ a.secondary {
.commands p,
.download-label {
margin: 14px 0 5px;
color: #e6edf3;
color: #ece8ff;
font-size: .82rem;
font-weight: 700;
letter-spacing: .04em;
@@ -67,9 +73,9 @@ code {
display: block;
padding: 14px;
overflow-wrap: anywhere;
border: 1px solid #30363d;
border: 1px solid #3a3470;
border-radius: 6px;
background: #161b22;
background: #1d1a3d;
white-space: pre-wrap;
}
@@ -80,9 +86,9 @@ code {
.links a {
display: inline-block;
margin: 0 14px 6px 0;
color: #e6edf3;
color: #a78bfa;
}
a.source {
color: #e6edf3;
color: #a78bfa;
}
+36
View File
@@ -0,0 +1,36 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark">
<title>Nightcap Terms of Service</title>
<link rel="icon" href="nightcap.svg" type="image/svg+xml">
<link rel="stylesheet" href="styles.css">
</head>
<body><main>
<h1>Terms of Service</h1>
<p>Nightcap is free and open-source software licensed under the Apache License, Version 2.0. The license text shipped with the source governs your use of the software.</p>
<h2>No warranty</h2>
<p>Nightcap is provided "as is", without warranty of any kind. The authors are not liable for any loss, damage, or account action that results from using it. See sections 7 and 8 of the Apache License.</p>
<h2>Not affiliated</h2>
<p>Nightcap is an independent community project. It is not affiliated with, endorsed by, or supported by Roblox Corporation or Discord Inc. Roblox and Discord are trademarks of their respective owners.</p>
<h2>Your responsibility</h2>
<p>You are responsible for following the Roblox Terms of Use and the Discord Terms of Service while using Nightcap with those services. Nightcap does not modify Roblox game logic, does not bypass Roblox security, and is not a cheat.</p>
<h2>Discord application</h2>
<p>The Nightcap Discord application only provides Rich Presence for the Nightcap desktop runtime. It requests no permissions, has no bot, and does not access your Discord account.</p>
<h2>Changes</h2>
<p>These terms may change with new releases. The current version always lives at this address.</p>
<p class="links">
<a href="index.html">Home</a>
<a href="privacy.html">Privacy Policy</a>
<a href="https://github.com/CoderDayton/nightcap">Source code</a>
</p>
</main></body>
</html>
+460 -5
View File
@@ -1,3 +1,4 @@
// Modified by vii from komaruworld/mocktail. See README "About this fork".
// Android Vulkan loader ABI -> host Vulkan loader + SDL3 WSI.
#include <dlfcn.h>
@@ -17,6 +18,7 @@
#include "mocktail/graphics/android_vulkan_wsi_adapter.h"
#include "mocktail/graphics/present_mode_policy.h"
#include "mocktail/graphics/vulkan_etc2_emulation.h"
#include "mocktail/graphics/vulkan_text_overlay_compositor.h"
#include "mocktail/platform/platform_runtime.h"
@@ -188,6 +190,7 @@ struct AdapterState {
VkInstance latest_instance = VK_NULL_HANDLE;
size_t active_instance_count = 0;
mocktail::graphics::VulkanTextOverlayCompositor text_overlay;
mocktail::graphics::VulkanEtc2Emulation etc2;
std::atomic<NotePresentFn> note_present{nullptr};
std::atomic<NoteHostPresentBeginFn> note_host_present_begin{nullptr};
std::atomic<NoteHostPresentEndFn> note_host_present_end{nullptr};
@@ -727,12 +730,92 @@ PFN_vkVoidFunction AdapterProc(const char* name) {
MOCKTAIL_VK_PROC(vkQueueWaitIdle)
MOCKTAIL_VK_PROC(vkDeviceWaitIdle)
MOCKTAIL_VK_PROC(vkQueuePresentKHR)
MOCKTAIL_VK_PROC(vkGetPhysicalDeviceFeatures)
MOCKTAIL_VK_PROC(vkGetPhysicalDeviceFeatures2)
MOCKTAIL_VK_PROC(vkGetPhysicalDeviceFormatProperties)
MOCKTAIL_VK_PROC(vkGetPhysicalDeviceFormatProperties2)
MOCKTAIL_VK_PROC(vkGetPhysicalDeviceImageFormatProperties)
MOCKTAIL_VK_PROC(vkGetPhysicalDeviceImageFormatProperties2)
MOCKTAIL_VK_PROC(vkCreateImage)
MOCKTAIL_VK_PROC(vkDestroyImage)
MOCKTAIL_VK_PROC(vkCreateImageView)
MOCKTAIL_VK_PROC(vkBindBufferMemory)
MOCKTAIL_VK_PROC(vkBindBufferMemory2)
MOCKTAIL_VK_PROC(vkMapMemory)
MOCKTAIL_VK_PROC(vkMapMemory2)
MOCKTAIL_VK_PROC(vkUnmapMemory)
MOCKTAIL_VK_PROC(vkUnmapMemory2)
MOCKTAIL_VK_PROC(vkFreeMemory)
MOCKTAIL_VK_PROC(vkDestroyBuffer)
MOCKTAIL_VK_PROC(vkCmdCopyBufferToImage)
MOCKTAIL_VK_PROC(vkCmdCopyImage)
MOCKTAIL_VK_PROC(vkCmdCopyImage2)
MOCKTAIL_VK_PROC(vkCmdCopyBufferToImage2)
MOCKTAIL_VK_PROC(vkCmdExecuteCommands)
#undef MOCKTAIL_VK_PROC
#define MOCKTAIL_VK_ALIAS(alias, function) \
if (std::strcmp(name, #alias) == 0) { \
return reinterpret_cast<PFN_vkVoidFunction>(function); \
}
MOCKTAIL_VK_ALIAS(vkGetPhysicalDeviceFeatures2KHR,
vkGetPhysicalDeviceFeatures2)
MOCKTAIL_VK_ALIAS(vkGetPhysicalDeviceFormatProperties2KHR,
vkGetPhysicalDeviceFormatProperties2)
MOCKTAIL_VK_ALIAS(vkGetPhysicalDeviceImageFormatProperties2KHR,
vkGetPhysicalDeviceImageFormatProperties2)
MOCKTAIL_VK_ALIAS(vkBindBufferMemory2KHR, vkBindBufferMemory2)
MOCKTAIL_VK_ALIAS(vkCmdCopyImage2KHR, vkCmdCopyImage2)
MOCKTAIL_VK_ALIAS(vkMapMemory2KHR, vkMapMemory2)
MOCKTAIL_VK_ALIAS(vkUnmapMemory2KHR, vkUnmapMemory2)
MOCKTAIL_VK_ALIAS(vkCmdCopyBufferToImage2KHR, vkCmdCopyBufferToImage2)
#undef MOCKTAIL_VK_ALIAS
return nullptr;
}
bool NameInList(const char* name, const char* const* names,
std::size_t count) {
return name != nullptr &&
std::any_of(names, names + count, [name](const char* candidate) {
return std::strcmp(name, candidate) == 0;
});
}
// Device commands wrapped for ETC2/EAC emulation.
bool IsEtc2DeviceProc(const char* name) {
static constexpr const char* kNames[] = {
"vkCreateImage", "vkDestroyImage",
"vkCreateImageView", "vkBindBufferMemory",
"vkBindBufferMemory2", "vkBindBufferMemory2KHR",
"vkMapMemory", "vkMapMemory2",
"vkMapMemory2KHR", "vkUnmapMemory",
"vkUnmapMemory2", "vkUnmapMemory2KHR",
"vkFreeMemory", "vkDestroyBuffer",
"vkCmdCopyBufferToImage", "vkCmdCopyBufferToImage2",
"vkCmdCopyImage", "vkCmdCopyImage2",
"vkCmdCopyImage2KHR",
"vkCmdCopyBufferToImage2KHR", "vkCmdExecuteCommands",
};
return NameInList(name, kNames, sizeof(kNames) / sizeof(kNames[0]));
}
// Physical-device queries that report emulated ETC2/EAC support.
bool IsEtc2PhysicalDeviceProc(const char* name) {
static constexpr const char* kNames[] = {
"vkGetPhysicalDeviceFeatures",
"vkGetPhysicalDeviceFeatures2",
"vkGetPhysicalDeviceFeatures2KHR",
"vkGetPhysicalDeviceFormatProperties",
"vkGetPhysicalDeviceFormatProperties2",
"vkGetPhysicalDeviceFormatProperties2KHR",
"vkGetPhysicalDeviceImageFormatProperties",
"vkGetPhysicalDeviceImageFormatProperties2",
"vkGetPhysicalDeviceImageFormatProperties2KHR",
};
return NameInList(name, kNames, sizeof(kNames) / sizeof(kNames[0]));
}
bool IsDeviceAdapterProc(const char* name) {
return name != nullptr && (std::strcmp(name, "vkDestroyDevice") == 0 ||
return name != nullptr && (IsEtc2DeviceProc(name) || std::strcmp(name, "vkDestroyDevice") == 0 ||
std::strcmp(name, "vkGetDeviceQueue") == 0 ||
std::strcmp(name, "vkGetDeviceQueue2") == 0 ||
std::strcmp(name, "vkCreateSwapchainKHR") == 0 ||
@@ -959,11 +1042,24 @@ struct FpsWaitTrace {
std::atomic<std::uint64_t> total_ns{0};
std::atomic<std::uint64_t> max_ns{0};
std::atomic<std::uint64_t> window_start_ns{0};
// Longest time between consecutive call starts; for present, a frame time.
std::atomic<std::uint64_t> max_gap_ns{0};
std::atomic<std::uint64_t> last_start_ns{0};
void Record(std::uint64_t start_ns) {
if (name == nullptr || start_ns == 0) {
return;
}
const std::uint64_t previous_start =
last_start_ns.exchange(start_ns, std::memory_order_relaxed);
if (previous_start != 0 && start_ns > previous_start) {
const std::uint64_t gap_ns = start_ns - previous_start;
std::uint64_t max_gap = max_gap_ns.load(std::memory_order_relaxed);
while (gap_ns > max_gap &&
!max_gap_ns.compare_exchange_weak(max_gap, gap_ns,
std::memory_order_relaxed)) {
}
}
const std::uint64_t wait_ns = MonotonicNanos() - start_ns;
total_ns.fetch_add(wait_ns, std::memory_order_relaxed);
std::uint64_t max_wait = max_ns.load(std::memory_order_relaxed);
@@ -984,14 +1080,18 @@ struct FpsWaitTrace {
const std::uint64_t total = total_ns.exchange(0, std::memory_order_relaxed);
const std::uint64_t peak = max_ns.exchange(0, std::memory_order_relaxed);
const std::uint64_t count = samples.exchange(0, std::memory_order_relaxed);
const std::uint64_t gap_peak =
max_gap_ns.exchange(0, std::memory_order_relaxed);
window_start_ns.store(start_ns, std::memory_order_relaxed);
if (count == 0) {
return;
}
std::fprintf(stderr, " [fps] %s n=%llu avg=%llu us max=%llu us\n", name,
static_cast<unsigned long long>(count),
std::fprintf(stderr,
" [fps] %s n=%llu avg=%llu us max=%llu us gap_max=%llu us\n",
name, static_cast<unsigned long long>(count),
static_cast<unsigned long long>(total / count / 1000ULL),
static_cast<unsigned long long>(peak / 1000ULL));
static_cast<unsigned long long>(peak / 1000ULL),
static_cast<unsigned long long>(gap_peak / 1000ULL));
}
};
@@ -1042,6 +1142,58 @@ ObservedHostQueuePresent(VkQueue queue, const VkPresentInfoKHR* present_info) {
return result;
}
template <typename Function>
Function HostPhysicalDeviceProc(const char* name, const char* alias) {
VkInstance instance = VK_NULL_HANDLE;
{
AdapterState& state = State();
std::lock_guard<std::mutex> lock(state.mutex);
instance = state.latest_instance;
}
PFN_vkVoidFunction proc = HostInstanceProc(instance, name);
if (proc == nullptr && alias != nullptr) {
proc = HostInstanceProc(instance, alias);
}
return reinterpret_cast<Function>(proc);
}
bool Etc2EmulatedPhysicalDevice(VkPhysicalDevice physical_device) {
return State().etc2.PhysicalDeviceNeedsEmulation(
physical_device, HostPhysicalDeviceProc<PFN_vkGetPhysicalDeviceFeatures>(
"vkGetPhysicalDeviceFeatures", nullptr));
}
void ReleaseEtc2PoolCommandBuffers(VkDevice device,
VkCommandPool command_pool) {
std::vector<VkCommandBuffer> command_buffers;
{
AdapterState& state = State();
std::lock_guard<std::mutex> lock(state.mutex);
for (const auto& binding : state.command_buffer_bindings) {
if (binding.device == device && binding.command_pool == command_pool) {
command_buffers.push_back(binding.command_buffer);
}
}
}
for (VkCommandBuffer command_buffer : command_buffers) {
State().etc2.ReleaseCommandBuffer(command_buffer);
}
}
void PrepareEtc2Submit2(std::uint32_t submit_count,
const VkSubmitInfo2* submits) {
if (submits == nullptr) {
return;
}
for (std::uint32_t index = 0; index < submit_count; ++index) {
for (std::uint32_t info = 0; info < submits[index].commandBufferInfoCount;
++info) {
State().etc2.PrepareSubmit(
&submits[index].pCommandBufferInfos[info].commandBuffer, 1);
}
}
}
} // namespace
extern "C" {
@@ -1247,7 +1399,7 @@ vkGetInstanceProcAddr(VkInstance instance, const char* name) {
}
if (const PFN_vkVoidFunction adapter = AdapterProc(name);
adapter != nullptr) {
if (IsDeviceAdapterProc(name) &&
if ((IsDeviceAdapterProc(name) || IsEtc2PhysicalDeviceProc(name)) &&
HostInstanceProc(instance, name) == nullptr) {
return nullptr;
}
@@ -1306,6 +1458,31 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(
VkDeviceCreateInfo host_info = *create_info;
EnabledDeviceFeatures enabled = InspectEnabledFeatures(*create_info);
const bool etc2_emulated = State().etc2.PhysicalDeviceNeedsEmulation(
physical_device, reinterpret_cast<PFN_vkGetPhysicalDeviceFeatures>(
HostInstanceProc(instance,
"vkGetPhysicalDeviceFeatures")));
VkPhysicalDeviceFeatures host_enabled_features{};
VkPhysicalDeviceFeatures2* requested_features2 = nullptr;
VkBool32 requested_features2_etc2 = VK_FALSE;
if (etc2_emulated) {
enabled.root.features.textureCompressionETC2 = VK_FALSE;
if (create_info->pEnabledFeatures != nullptr) {
host_enabled_features = *create_info->pEnabledFeatures;
host_enabled_features.textureCompressionETC2 = VK_FALSE;
host_info.pEnabledFeatures = &host_enabled_features;
}
// The feature chain is caller-owned; clear the emulated bit only for the
// host call and restore it afterwards.
requested_features2 = const_cast<VkPhysicalDeviceFeatures2*>(
reinterpret_cast<const VkPhysicalDeviceFeatures2*>(FindFeature(
create_info->pNext, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2)));
if (requested_features2 != nullptr) {
requested_features2_etc2 =
requested_features2->features.textureCompressionETC2;
requested_features2->features.textureCompressionETC2 = VK_FALSE;
}
}
enabled.root.pNext = &enabled.vulkan11;
enabled.vulkan11.pNext = &enabled.vulkan12;
enabled.vulkan12.pNext = nullptr;
@@ -1341,11 +1518,25 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(
const VkResult result =
host_create(physical_device, &host_info, allocator, device);
if (requested_features2 != nullptr) {
requested_features2->features.textureCompressionETC2 =
requested_features2_etc2;
}
if (result != VK_SUCCESS) {
return result;
}
RegisterHostDeviceDispatch(*device, physical_device,
host_get_device_proc_addr);
VkPhysicalDeviceMemoryProperties memory_properties{};
if (const auto host_memory_properties =
reinterpret_cast<PFN_vkGetPhysicalDeviceMemoryProperties>(
HostInstanceProc(instance,
"vkGetPhysicalDeviceMemoryProperties"));
host_memory_properties != nullptr) {
host_memory_properties(physical_device, &memory_properties);
}
State().etc2.RegisterDevice(*device, physical_device, etc2_emulated,
memory_properties, host_get_device_proc_addr);
std::uint32_t queue_family_count = 0;
const auto host_get_queue_families =
@@ -1403,6 +1594,7 @@ vkDestroyDevice(VkDevice device, const VkAllocationCallbacks* allocator) {
const auto host_destroy = reinterpret_cast<PFN_vkDestroyDevice>(
HostDeviceProc(device, "vkDestroyDevice"));
State().text_overlay.DestroyDevice(device);
State().etc2.DestroyDevice(device);
if (host_destroy != nullptr) {
host_destroy(device, allocator);
}
@@ -1650,6 +1842,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool(
observation.SetResult(VK_ERROR_INITIALIZATION_FAILED);
return VK_ERROR_INITIALIZATION_FAILED;
}
ReleaseEtc2PoolCommandBuffers(device, command_pool);
const VkResult result = host_reset(device, command_pool, flags);
observation.SetResult(result);
return result;
@@ -1706,6 +1899,11 @@ VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers(
observation.SetResult(VK_ERROR_INITIALIZATION_FAILED);
return;
}
if (command_buffers != nullptr) {
for (std::uint32_t index = 0; index < command_buffer_count; ++index) {
State().etc2.ReleaseCommandBuffer(command_buffers[index]);
}
}
host_free(device, command_pool, command_buffer_count, command_buffers);
RemoveHostCommandBuffers(device, command_pool, command_buffer_count,
command_buffers);
@@ -1722,6 +1920,7 @@ VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool(
observation.SetResult(VK_ERROR_INITIALIZATION_FAILED);
return;
}
ReleaseEtc2PoolCommandBuffers(device, command_pool);
host_destroy(device, command_pool, allocator);
RemoveHostCommandPoolBindings(device, command_pool);
observation.SetResult(VK_SUCCESS);
@@ -1737,6 +1936,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer(
observation.SetResult(VK_ERROR_INITIALIZATION_FAILED);
return VK_ERROR_INITIALIZATION_FAILED;
}
State().etc2.ReleaseCommandBuffer(command_buffer);
const VkResult result = host_begin(command_buffer, begin_info);
observation.SetResult(result);
return result;
@@ -1765,6 +1965,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandBuffer(
observation.SetResult(VK_ERROR_INITIALIZATION_FAILED);
return VK_ERROR_INITIALIZATION_FAILED;
}
State().etc2.ReleaseCommandBuffer(command_buffer);
const VkResult result = host_reset(command_buffer, flags);
observation.SetResult(result);
return result;
@@ -1801,6 +2002,12 @@ VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(
observation.SetResult(VK_ERROR_INITIALIZATION_FAILED);
return VK_ERROR_INITIALIZATION_FAILED;
}
if (submits != nullptr) {
for (std::uint32_t index = 0; index < submit_count; ++index) {
State().etc2.PrepareSubmit(submits[index].pCommandBuffers,
submits[index].commandBufferCount);
}
}
const VkResult result = State().text_overlay.QueueSubmit(
queue, submit_count, submits, fence, host_submit);
observation.SetResult(result);
@@ -1817,6 +2024,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit2(
observation.SetResult(VK_ERROR_INITIALIZATION_FAILED);
return VK_ERROR_INITIALIZATION_FAILED;
}
PrepareEtc2Submit2(submit_count, submits);
const VkResult result = State().text_overlay.QueueSubmit2(
queue, submit_count, submits, fence, host_submit);
observation.SetResult(result);
@@ -1833,6 +2041,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit2KHR(
observation.SetResult(VK_ERROR_INITIALIZATION_FAILED);
return VK_ERROR_INITIALIZATION_FAILED;
}
PrepareEtc2Submit2(submit_count, submits);
const VkResult result = State().text_overlay.QueueSubmit2(
queue, submit_count, submits, fence,
reinterpret_cast<PFN_vkQueueSubmit2>(host_submit));
@@ -2025,4 +2234,250 @@ vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* present_info) {
return normalized_result;
}
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures(
VkPhysicalDevice physical_device, VkPhysicalDeviceFeatures* features) {
const auto host = HostPhysicalDeviceProc<PFN_vkGetPhysicalDeviceFeatures>(
"vkGetPhysicalDeviceFeatures", nullptr);
if (host == nullptr || features == nullptr) {
return;
}
host(physical_device, features);
if (Etc2EmulatedPhysicalDevice(physical_device) &&
mocktail::graphics::Etc2SupportAdvertised()) {
features->textureCompressionETC2 = VK_TRUE;
}
}
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2(
VkPhysicalDevice physical_device, VkPhysicalDeviceFeatures2* features) {
const auto host = HostPhysicalDeviceProc<PFN_vkGetPhysicalDeviceFeatures2>(
"vkGetPhysicalDeviceFeatures2", "vkGetPhysicalDeviceFeatures2KHR");
if (host == nullptr || features == nullptr) {
return;
}
host(physical_device, features);
if (Etc2EmulatedPhysicalDevice(physical_device) &&
mocktail::graphics::Etc2SupportAdvertised()) {
features->features.textureCompressionETC2 = VK_TRUE;
}
}
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(
VkPhysicalDevice physical_device, VkFormat format,
VkFormatProperties* properties) {
const auto host =
HostPhysicalDeviceProc<PFN_vkGetPhysicalDeviceFormatProperties>(
"vkGetPhysicalDeviceFormatProperties", nullptr);
if (host == nullptr || properties == nullptr) {
return;
}
mocktail::graphics::Etc2EmulatedFormat mapped;
if (!mocktail::graphics::LookupEmulatedEtc2Format(format, &mapped) ||
!Etc2EmulatedPhysicalDevice(physical_device)) {
host(physical_device, format, properties);
return;
}
host(physical_device, mapped.host_format, properties);
properties->linearTilingFeatures = 0;
properties->optimalTilingFeatures =
mocktail::graphics::EmulatedEtc2FormatFeatures(
properties->optimalTilingFeatures);
properties->bufferFeatures = 0;
}
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2(
VkPhysicalDevice physical_device, VkFormat format,
VkFormatProperties2* properties) {
const auto host =
HostPhysicalDeviceProc<PFN_vkGetPhysicalDeviceFormatProperties2>(
"vkGetPhysicalDeviceFormatProperties2",
"vkGetPhysicalDeviceFormatProperties2KHR");
if (host == nullptr || properties == nullptr) {
return;
}
mocktail::graphics::Etc2EmulatedFormat mapped;
if (!mocktail::graphics::LookupEmulatedEtc2Format(format, &mapped) ||
!Etc2EmulatedPhysicalDevice(physical_device)) {
host(physical_device, format, properties);
return;
}
host(physical_device, mapped.host_format, properties);
VkFormatProperties& base = properties->formatProperties;
base.linearTilingFeatures = 0;
base.optimalTilingFeatures =
mocktail::graphics::EmulatedEtc2FormatFeatures(base.optimalTilingFeatures);
base.bufferFeatures = 0;
if (auto* extended = const_cast<VkFormatProperties3*>(
reinterpret_cast<const VkFormatProperties3*>(FindFeature(
properties->pNext, VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3)));
extended != nullptr) {
extended->linearTilingFeatures = 0;
extended->optimalTilingFeatures =
mocktail::graphics::EmulatedEtc2FormatFeatures(
static_cast<VkFormatFeatureFlags>(
extended->optimalTilingFeatures));
extended->bufferFeatures = 0;
}
}
VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties(
VkPhysicalDevice physical_device, VkFormat format, VkImageType type,
VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
VkImageFormatProperties* properties) {
const auto host =
HostPhysicalDeviceProc<PFN_vkGetPhysicalDeviceImageFormatProperties>(
"vkGetPhysicalDeviceImageFormatProperties", nullptr);
if (host == nullptr) {
return VK_ERROR_INITIALIZATION_FAILED;
}
mocktail::graphics::Etc2EmulatedFormat mapped;
if (!mocktail::graphics::LookupEmulatedEtc2Format(format, &mapped) ||
!Etc2EmulatedPhysicalDevice(physical_device)) {
return host(physical_device, format, type, tiling, usage, flags,
properties);
}
if (tiling != VK_IMAGE_TILING_OPTIMAL || type != VK_IMAGE_TYPE_2D) {
return VK_ERROR_FORMAT_NOT_SUPPORTED;
}
return host(physical_device, mapped.host_format, type, tiling, usage,
flags & ~static_cast<VkImageCreateFlags>(
VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT),
properties);
}
VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties2(
VkPhysicalDevice physical_device,
const VkPhysicalDeviceImageFormatInfo2* info,
VkImageFormatProperties2* properties) {
const auto host =
HostPhysicalDeviceProc<PFN_vkGetPhysicalDeviceImageFormatProperties2>(
"vkGetPhysicalDeviceImageFormatProperties2",
"vkGetPhysicalDeviceImageFormatProperties2KHR");
if (host == nullptr || info == nullptr) {
return VK_ERROR_INITIALIZATION_FAILED;
}
mocktail::graphics::Etc2EmulatedFormat mapped;
if (!mocktail::graphics::LookupEmulatedEtc2Format(info->format, &mapped) ||
!Etc2EmulatedPhysicalDevice(physical_device)) {
return host(physical_device, info, properties);
}
if (info->tiling != VK_IMAGE_TILING_OPTIMAL ||
info->type != VK_IMAGE_TYPE_2D) {
return VK_ERROR_FORMAT_NOT_SUPPORTED;
}
VkPhysicalDeviceImageFormatInfo2 host_info = *info;
host_info.format = mapped.host_format;
host_info.flags &= ~static_cast<VkImageCreateFlags>(
VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT);
return host(physical_device, &host_info, properties);
}
VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(
VkDevice device, const VkImageCreateInfo* create_info,
const VkAllocationCallbacks* allocator, VkImage* image) {
return State().etc2.CreateImage(device, create_info, allocator, image);
}
VKAPI_ATTR void VKAPI_CALL vkDestroyImage(
VkDevice device, VkImage image, const VkAllocationCallbacks* allocator) {
State().etc2.DestroyImage(device, image, allocator);
}
VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(
VkDevice device, const VkImageViewCreateInfo* create_info,
const VkAllocationCallbacks* allocator, VkImageView* view) {
return State().etc2.CreateImageView(device, create_info, allocator, view);
}
VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory(VkDevice device,
VkBuffer buffer,
VkDeviceMemory memory,
VkDeviceSize offset) {
return State().etc2.BindBufferMemory(device, buffer, memory, offset);
}
VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory2(
VkDevice device, std::uint32_t count,
const VkBindBufferMemoryInfo* infos) {
return State().etc2.BindBufferMemory2(device, count, infos);
}
VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory(VkDevice device,
VkDeviceMemory memory,
VkDeviceSize offset,
VkDeviceSize size,
VkMemoryMapFlags flags,
void** data) {
return State().etc2.MapMemory(device, memory, offset, size, flags, data);
}
VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory2(VkDevice device,
const VkMemoryMapInfo* info,
void** data) {
return State().etc2.MapMemory2(device, info, data);
}
VKAPI_ATTR void VKAPI_CALL vkUnmapMemory(VkDevice device,
VkDeviceMemory memory) {
State().etc2.UnmapMemory(device, memory);
}
VKAPI_ATTR VkResult VKAPI_CALL vkUnmapMemory2(VkDevice device,
const VkMemoryUnmapInfo* info) {
return State().etc2.UnmapMemory2(device, info);
}
VKAPI_ATTR void VKAPI_CALL vkFreeMemory(
VkDevice device, VkDeviceMemory memory,
const VkAllocationCallbacks* allocator) {
State().etc2.FreeMemory(device, memory, allocator);
}
VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer(
VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* allocator) {
State().etc2.DestroyBuffer(device, buffer, allocator);
}
VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage(
VkCommandBuffer command_buffer, VkBuffer source, VkImage destination,
VkImageLayout layout, std::uint32_t region_count,
const VkBufferImageCopy* regions) {
State().etc2.CmdCopyBufferToImage(
HostDispatchForCommandBuffer(command_buffer).device, command_buffer,
source, destination, layout, region_count, regions);
}
VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage2(
VkCommandBuffer command_buffer, const VkCopyBufferToImageInfo2* info) {
State().etc2.CmdCopyBufferToImage2(
HostDispatchForCommandBuffer(command_buffer).device, command_buffer,
info);
}
VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage(
VkCommandBuffer command_buffer, VkImage source,
VkImageLayout source_layout, VkImage destination,
VkImageLayout destination_layout, std::uint32_t region_count,
const VkImageCopy* regions) {
State().etc2.CmdCopyImage(
HostDispatchForCommandBuffer(command_buffer).device, command_buffer,
source, source_layout, destination, destination_layout, region_count,
regions);
}
VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage2(VkCommandBuffer command_buffer,
const VkCopyImageInfo2* info) {
State().etc2.CmdCopyImage2(
HostDispatchForCommandBuffer(command_buffer).device, command_buffer,
info);
}
VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands(
VkCommandBuffer command_buffer, std::uint32_t count,
const VkCommandBuffer* secondaries) {
State().etc2.CmdExecuteCommands(
HostDispatchForCommandBuffer(command_buffer).device, command_buffer,
count, secondaries);
}
} // extern "C"
+402
View File
@@ -0,0 +1,402 @@
#include "mocktail/graphics/etc2_decoder.h"
#include <algorithm>
#include <array>
#include <pthread.h>
#include <atomic>
#include <limits>
#include <vector>
namespace mocktail::graphics {
namespace {
constexpr std::array<int, 8> kDistance = {3, 6, 11, 16, 23, 32, 41, 64};
// Indexed by (msb << 1) | lsb.
constexpr int kEtc1Modifiers[8][4] = {
{2, 8, -2, -8}, {5, 17, -5, -17}, {9, 29, -9, -29},
{13, 42, -13, -42}, {18, 60, -18, -60}, {24, 80, -24, -80},
{33, 106, -33, -106}, {47, 183, -47, -183},
};
constexpr int kEacModifiers[16][8] = {
{-3, -6, -9, -15, 2, 5, 8, 14}, {-3, -7, -10, -13, 2, 6, 9, 12},
{-2, -5, -8, -13, 1, 4, 7, 12}, {-2, -4, -6, -13, 1, 3, 5, 12},
{-3, -6, -8, -12, 2, 5, 7, 11}, {-3, -7, -9, -11, 2, 6, 8, 10},
{-4, -7, -8, -11, 3, 6, 7, 10}, {-3, -5, -8, -11, 2, 4, 7, 10},
{-2, -6, -8, -10, 1, 5, 7, 9}, {-2, -5, -8, -10, 1, 4, 7, 9},
{-2, -4, -8, -10, 1, 3, 7, 9}, {-2, -5, -7, -10, 1, 4, 6, 9},
{-3, -4, -7, -10, 2, 3, 6, 9}, {-1, -2, -3, -10, 0, 1, 2, 9},
{-4, -6, -8, -9, 3, 5, 7, 8}, {-3, -5, -7, -9, 2, 4, 6, 8},
};
std::uint8_t Clamp255(int value) {
return static_cast<std::uint8_t>(std::clamp(value, 0, 255));
}
int Expand4(int value) { return (value << 4) | value; }
int Expand5(int value) { return (value << 3) | (value >> 2); }
int Expand6(int value) { return (value << 2) | (value >> 4); }
int Expand7(int value) { return (value << 1) | (value >> 6); }
// Decodes one ETC2 RGB block into 16 column-major RGBA texels (x * 4 + y).
void DecodeRgbBlock(const std::uint8_t* b, bool punchthrough,
std::array<std::uint8_t, 64>* out) {
static constexpr int kDelta[8] = {0, 1, 2, 3, -4, -3, -2, -1};
const bool diff_or_opaque = (b[3] & 2) != 0;
const bool opaque = !punchthrough || diff_or_opaque;
const int msb = (b[4] << 8) | b[5];
const int lsb = (b[6] << 8) | b[7];
auto index_of = [msb, lsb](int texel) {
return (((msb >> texel) & 1) << 1) | ((lsb >> texel) & 1);
};
auto write = [out](int texel, int r, int g, int bl, int a) {
const std::size_t o = static_cast<std::size_t>(texel) * 4;
(*out)[o] = Clamp255(r);
(*out)[o + 1] = Clamp255(g);
(*out)[o + 2] = Clamp255(bl);
(*out)[o + 3] = static_cast<std::uint8_t>(a);
};
const int r_sum = (b[0] >> 3) + kDelta[b[0] & 7];
const int g_sum = (b[1] >> 3) + kDelta[b[1] & 7];
const int b_sum = (b[2] >> 3) + kDelta[b[2] & 7];
const bool individual = !punchthrough && !diff_or_opaque;
if (!individual && (r_sum < 0 || r_sum > 31 || g_sum < 0 || g_sum > 31)) {
std::array<std::array<int, 3>, 4> paint{};
if (r_sum < 0 || r_sum > 31) {
const std::array<int, 3> c1 = {
Expand4((((b[0] >> 3) & 3) << 2) | (b[0] & 3)),
Expand4(b[1] >> 4), Expand4(b[1] & 15)};
const std::array<int, 3> c2 = {Expand4(b[2] >> 4), Expand4(b[2] & 15),
Expand4(b[3] >> 4)};
const int d = kDistance[(((b[3] >> 2) & 3) << 1) | (b[3] & 1)];
for (int c = 0; c < 3; ++c) {
paint[0][c] = c1[c];
paint[1][c] = c2[c] + d;
paint[2][c] = c2[c];
paint[3][c] = c2[c] - d;
}
} else {
const std::array<int, 3> c1 = {
Expand4((b[0] >> 3) & 15),
Expand4(((b[0] & 7) << 1) | ((b[1] >> 4) & 1)),
Expand4((b[1] & 8) | ((b[1] & 3) << 1) | (b[2] >> 7))};
const std::array<int, 3> c2 = {
Expand4((b[2] >> 3) & 15), Expand4(((b[2] & 7) << 1) | (b[3] >> 7)),
Expand4((b[3] >> 3) & 15)};
const int v1 = (c1[0] << 16) | (c1[1] << 8) | c1[2];
const int v2 = (c2[0] << 16) | (c2[1] << 8) | c2[2];
const int d =
kDistance[(b[3] & 4) | ((b[3] & 1) << 1) | (v1 >= v2 ? 1 : 0)];
for (int c = 0; c < 3; ++c) {
paint[0][c] = c1[c] + d;
paint[1][c] = c1[c] - d;
paint[2][c] = c2[c] + d;
paint[3][c] = c2[c] - d;
}
}
for (int texel = 0; texel < 16; ++texel) {
const int index = index_of(texel);
if (!opaque && index == 2) {
write(texel, 0, 0, 0, 0);
} else {
write(texel, paint[index][0], paint[index][1], paint[index][2], 255);
}
}
return;
}
if (!individual && (b_sum < 0 || b_sum > 31)) {
const int ro = Expand6((b[0] >> 1) & 63);
const int go = Expand7(((b[0] & 1) << 6) | ((b[1] >> 1) & 63));
const int bo = Expand6(((b[1] & 1) << 5) | (b[2] & 0x18) |
((b[2] & 3) << 1) | (b[3] >> 7));
const int rh = Expand6(((b[3] & 0x7c) >> 1) | (b[3] & 1));
const int gh = Expand7(b[4] >> 1);
const int bh = Expand6(((b[4] & 1) << 5) | (b[5] >> 3));
const int rv = Expand6(((b[5] & 7) << 3) | (b[6] >> 5));
const int gv = Expand7(((b[6] & 31) << 2) | (b[7] >> 6));
const int bv = Expand6(b[7] & 63);
for (int x = 0; x < 4; ++x) {
for (int y = 0; y < 4; ++y) {
write(x * 4 + y, (x * (rh - ro) + y * (rv - ro) + 4 * ro + 2) >> 2,
(x * (gh - go) + y * (gv - go) + 4 * go + 2) >> 2,
(x * (bh - bo) + y * (bv - bo) + 4 * bo + 2) >> 2, 255);
}
}
return;
}
std::array<std::array<int, 3>, 2> base{};
for (int c = 0; c < 3; ++c) {
if (individual) {
base[0][c] = Expand4(b[c] >> 4);
base[1][c] = Expand4(b[c] & 15);
} else {
base[0][c] = Expand5(b[c] >> 3);
base[1][c] = Expand5((b[c] >> 3) + kDelta[b[c] & 7]);
}
}
const int tables[2] = {b[3] >> 5, (b[3] >> 2) & 7};
const bool flipped = (b[3] & 1) != 0;
for (int x = 0; x < 4; ++x) {
for (int y = 0; y < 4; ++y) {
const int texel = x * 4 + y;
const int index = index_of(texel);
if (!opaque && index == 2) {
write(texel, 0, 0, 0, 0);
continue;
}
const int sub = flipped ? (y >= 2 ? 1 : 0) : (x >= 2 ? 1 : 0);
const int modifier =
(!opaque && index == 0) ? 0 : kEtc1Modifiers[tables[sub]][index];
write(texel, base[sub][0] + modifier, base[sub][1] + modifier,
base[sub][2] + modifier, 255);
}
}
}
// EAC 3-bit index for column-major texel (x * 4 + y).
int EacIndex(const std::uint8_t* b, int texel) {
std::uint64_t bits = 0;
for (int i = 2; i < 8; ++i) {
bits = (bits << 8) | b[i];
}
return static_cast<int>((bits >> (45 - texel * 3)) & 7);
}
int EacModifier(const std::uint8_t* b, int texel) {
return kEacModifiers[b[1] & 15][EacIndex(b, texel)];
}
std::uint16_t DecodeR11(const std::uint8_t* b, int texel, bool is_signed) {
const int multiplier = b[1] >> 4;
const int modifier = EacModifier(b, texel);
const int scaled = multiplier != 0 ? modifier * multiplier * 8 : modifier;
if (!is_signed) {
const int value = std::clamp(b[0] * 8 + 4 + scaled, 0, 2047);
return static_cast<std::uint16_t>((value << 5) | (value >> 6));
}
const int base = std::max(-127, static_cast<int>(static_cast<std::int8_t>(b[0])));
const int value = std::clamp(base * 8 + scaled, -1023, 1023);
const int magnitude = value < 0 ? -value : value;
const int expanded = (magnitude << 5) | (magnitude >> 5);
return static_cast<std::uint16_t>(
static_cast<std::int16_t>(value < 0 ? -expanded : expanded));
}
} // namespace
std::size_t EtcBlockBytes(EtcFormat format) {
switch (format) {
case EtcFormat::kEtc2Rgba8:
case EtcFormat::kEacRg11:
case EtcFormat::kEacRg11Signed:
return 16;
default:
return 8;
}
}
std::size_t EtcDecodedTexelBytes(EtcFormat format) {
switch (format) {
case EtcFormat::kEacR11:
case EtcFormat::kEacR11Signed:
return 2;
default:
return 4;
}
}
namespace {
// Blocks per band handed to one worker: about a 256x256 texel image.
constexpr std::uint64_t kBlocksPerBand = 16384;
// Batches smaller than a 1024x1024 texel image decode on the caller.
constexpr std::uint64_t kParallelMinimumBlocks = 65536;
bool ImageFits(EtcFormat format, const std::uint8_t* source,
std::size_t source_bytes, std::uint32_t width,
std::uint32_t height, const std::uint8_t* destination,
std::size_t destination_bytes) {
if (source == nullptr || destination == nullptr || width == 0 ||
height == 0) {
return false;
}
const std::uint64_t blocks_wide = (static_cast<std::uint64_t>(width) + 3) / 4;
const std::uint64_t blocks_high =
(static_cast<std::uint64_t>(height) + 3) / 4;
return blocks_wide * blocks_high * EtcBlockBytes(format) <= source_bytes &&
static_cast<std::uint64_t>(width) * height *
EtcDecodedTexelBytes(format) <=
destination_bytes;
}
} // namespace
bool DecodeEtcImage(EtcFormat format, const std::uint8_t* source,
std::size_t source_bytes, std::uint32_t width,
std::uint32_t height, std::uint8_t* destination,
std::size_t destination_bytes) {
return DecodeEtcImageBlockRows(format, source, source_bytes, width, height, 0,
(height + 3) / 4, destination,
destination_bytes);
}
namespace {
struct DecodeBand {
EtcDecodeJob* job;
std::uint32_t first_block_row;
std::uint32_t block_row_count;
};
struct DecodeBandQueue {
std::vector<DecodeBand> bands;
std::atomic<std::size_t> next{0};
void Run() {
for (;;) {
const std::size_t index = next.fetch_add(1, std::memory_order_relaxed);
if (index >= bands.size()) {
return;
}
const DecodeBand& band = bands[index];
const EtcDecodeJob& job = *band.job;
DecodeEtcImageBlockRows(job.format, job.source, job.source_bytes,
job.width, job.height, band.first_block_row,
band.block_row_count, job.destination,
job.destination_bytes);
}
}
};
void* RunDecodeBandQueue(void* queue) {
static_cast<DecodeBandQueue*>(queue)->Run();
return nullptr;
}
} // namespace
void DecodeEtcJobs(EtcDecodeJob* jobs, std::size_t count,
unsigned worker_count) {
if (jobs == nullptr) {
return;
}
DecodeBandQueue queue;
std::vector<DecodeBand>& bands = queue.bands;
std::uint64_t total_blocks = 0;
for (std::size_t index = 0; index < count; ++index) {
EtcDecodeJob& job = jobs[index];
job.ok = ImageFits(job.format, job.source, job.source_bytes, job.width,
job.height, job.destination, job.destination_bytes);
if (!job.ok) {
continue;
}
const std::uint32_t blocks_wide = (job.width + 3) / 4;
const std::uint32_t blocks_high = (job.height + 3) / 4;
const std::uint32_t rows_per_band = static_cast<std::uint32_t>(
std::max<std::uint64_t>(1, kBlocksPerBand / blocks_wide));
for (std::uint32_t row = 0; row < blocks_high; row += rows_per_band) {
bands.push_back(
{&job, row, std::min(rows_per_band, blocks_high - row)});
}
total_blocks += static_cast<std::uint64_t>(blocks_wide) * blocks_high;
}
const std::size_t threads =
total_blocks < kParallelMinimumBlocks
? 1
: std::min<std::size_t>(std::max(worker_count, 1U), bands.size());
std::vector<pthread_t> workers;
workers.reserve(threads > 0 ? threads - 1 : 0);
for (std::size_t index = 1; index < threads; ++index) {
pthread_t worker;
// The caller decodes whatever workers that failed to start leave behind.
if (pthread_create(&worker, nullptr, RunDecodeBandQueue, &queue) != 0) {
break;
}
workers.push_back(worker);
}
queue.Run();
for (pthread_t worker : workers) {
pthread_join(worker, nullptr);
}
}
bool DecodeEtcImageBlockRows(EtcFormat format, const std::uint8_t* source,
std::size_t source_bytes, std::uint32_t width,
std::uint32_t height,
std::uint32_t first_block_row,
std::uint32_t block_row_count,
std::uint8_t* destination,
std::size_t destination_bytes) {
if (!ImageFits(format, source, source_bytes, width, height, destination,
destination_bytes)) {
return false;
}
const std::uint64_t blocks_wide = (static_cast<std::uint64_t>(width) + 3) / 4;
const std::uint64_t blocks_high =
(static_cast<std::uint64_t>(height) + 3) / 4;
if (static_cast<std::uint64_t>(first_block_row) + block_row_count >
blocks_high) {
return false;
}
const std::size_t texel_bytes = EtcDecodedTexelBytes(format);
const std::size_t block_bytes = EtcBlockBytes(format);
std::array<std::uint8_t, 64> rgba{};
const std::uint64_t end_block_row =
static_cast<std::uint64_t>(first_block_row) + block_row_count;
for (std::uint64_t by = first_block_row; by < end_block_row; ++by) {
for (std::uint64_t bx = 0; bx < blocks_wide; ++bx) {
const std::uint8_t* block =
source + (by * blocks_wide + bx) * block_bytes;
if (format == EtcFormat::kEtc2Rgb8 || format == EtcFormat::kEtc2Rgb8A1) {
DecodeRgbBlock(block, format == EtcFormat::kEtc2Rgb8A1, &rgba);
} else if (format == EtcFormat::kEtc2Rgba8) {
DecodeRgbBlock(block + 8, false, &rgba);
}
for (std::uint32_t y = 0; y < 4 && by * 4 + y < height; ++y) {
for (std::uint32_t x = 0; x < 4 && bx * 4 + x < width; ++x) {
const int texel = static_cast<int>(x * 4 + y);
std::uint8_t* out =
destination + ((by * 4 + y) * width + bx * 4 + x) * texel_bytes;
switch (format) {
case EtcFormat::kEtc2Rgb8:
case EtcFormat::kEtc2Rgb8A1:
case EtcFormat::kEtc2Rgba8:
std::copy_n(rgba.data() + texel * 4, 4, out);
if (format == EtcFormat::kEtc2Rgba8) {
const int alpha =
block[0] + EacModifier(block, texel) * (block[1] >> 4);
out[3] = Clamp255(alpha);
}
break;
case EtcFormat::kEacR11:
case EtcFormat::kEacR11Signed:
case EtcFormat::kEacRg11:
case EtcFormat::kEacRg11Signed: {
const bool is_signed = format == EtcFormat::kEacR11Signed ||
format == EtcFormat::kEacRg11Signed;
const int channels = texel_bytes / 2;
for (int channel = 0; channel < channels; ++channel) {
const std::uint16_t value =
DecodeR11(block + channel * 8, texel, is_signed);
out[channel * 2] = static_cast<std::uint8_t>(value);
out[channel * 2 + 1] = static_cast<std::uint8_t>(value >> 8);
}
break;
}
}
}
}
}
}
return true;
}
} // namespace mocktail::graphics
+4 -4
View File
@@ -1,3 +1,4 @@
// Modified by vii from komaruworld/mocktail. See README "About this fork".
#include "mocktail/graphics/present_mode_policy.h"
#include <algorithm>
@@ -28,10 +29,9 @@ PresentModePolicy ResolvePresentModePolicy(std::string_view vsync_value,
if (frame_rate_value == "unlimited") {
return PresentModePolicy::kUnthrottled;
}
if (frame_rate_value.empty() || frame_rate_value == "-1") {
return PresentModePolicy::kHostDefault;
}
// Display or any fixed scheduler target keeps synchronized presentation.
// Every synchronized target, including the unmanaged Roblox cap, presents
// through the lowest-latency vsync mode the host offers. Roblox's own FIFO
// request queues up to two rendered frames before they reach the display.
return PresentModePolicy::kVsync;
}
+182
View File
@@ -0,0 +1,182 @@
#include "mocktail/graphics/texture_override.h"
#include <png.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <filesystem>
namespace mocktail::graphics {
std::uint64_t HashBytes(const std::uint8_t* data, std::size_t size) {
std::uint64_t hash = 0xcbf29ce484222325ULL;
for (std::size_t index = 0; index < size; ++index) {
hash ^= data[index];
hash *= 0x100000001b3ULL;
}
return hash;
}
std::string HashName(std::uint64_t hash) {
char text[17];
std::snprintf(text, sizeof(text), "%016llx",
static_cast<unsigned long long>(hash));
return text;
}
bool ReadPngRgba(const std::string& path, RgbaImage* image) {
if (image == nullptr) {
return false;
}
png_image png{};
png.version = PNG_IMAGE_VERSION;
if (png_image_begin_read_from_file(&png, path.c_str()) == 0) {
return false;
}
png.format = PNG_FORMAT_RGBA;
RgbaImage result;
result.width = png.width;
result.height = png.height;
result.pixels.resize(PNG_IMAGE_SIZE(png));
if (png_image_finish_read(&png, nullptr, result.pixels.data(), 0,
nullptr) == 0) {
png_image_free(&png);
return false;
}
*image = std::move(result);
return true;
}
bool WritePngRgba(const std::string& path, const RgbaImage& image) {
if (image.width == 0 || image.height == 0 ||
image.pixels.size() !=
static_cast<std::size_t>(image.width) * image.height * 4) {
return false;
}
png_image png{};
png.version = PNG_IMAGE_VERSION;
png.width = image.width;
png.height = image.height;
png.format = PNG_FORMAT_RGBA;
const int written = png_image_write_to_file(&png, path.c_str(), 0,
image.pixels.data(), 0, nullptr);
png_image_free(&png);
return written != 0;
}
void ResampleRgba(const RgbaImage& source, std::uint32_t width,
std::uint32_t height, std::uint8_t* destination) {
if (source.pixels.size() <
static_cast<std::size_t>(source.width) * source.height * 4) {
return;
}
ResampleRgba(source.pixels.data(), source.width, source.height, width,
height, destination);
}
void ResampleRgba(const std::uint8_t* source, std::uint32_t source_width,
std::uint32_t source_height, std::uint32_t width,
std::uint32_t height, std::uint8_t* destination) {
if (source == nullptr || destination == nullptr || width == 0 ||
height == 0 || source_width == 0 || source_height == 0) {
return;
}
for (std::uint32_t y = 0; y < height; ++y) {
const std::uint64_t y0 = static_cast<std::uint64_t>(y) * source_height / height;
std::uint64_t y1 =
(static_cast<std::uint64_t>(y) + 1) * source_height / height;
if (y1 <= y0) {
y1 = y0 + 1;
}
for (std::uint32_t x = 0; x < width; ++x) {
const std::uint64_t x0 = static_cast<std::uint64_t>(x) * source_width / width;
std::uint64_t x1 =
(static_cast<std::uint64_t>(x) + 1) * source_width / width;
if (x1 <= x0) {
x1 = x0 + 1;
}
std::uint64_t sum[4] = {0, 0, 0, 0};
for (std::uint64_t sy = y0; sy < y1; ++sy) {
for (std::uint64_t sx = x0; sx < x1; ++sx) {
const std::uint8_t* pixel = source + (sy * source_width + sx) * 4;
for (int channel = 0; channel < 4; ++channel) {
sum[channel] += pixel[channel];
}
}
}
const std::uint64_t count = (y1 - y0) * (x1 - x0);
std::uint8_t* out = destination + (static_cast<std::size_t>(y) * width + x) * 4;
for (int channel = 0; channel < 4; ++channel) {
out[channel] =
static_cast<std::uint8_t>((sum[channel] + count / 2) / count);
}
}
}
}
namespace {
std::string EnvironmentString(const char* name) {
const char* value = std::getenv(name);
return value != nullptr ? value : "";
}
} // namespace
TextureOverrides::TextureOverrides(std::string override_dir,
std::string dump_dir)
: override_dir_(std::move(override_dir)), dump_dir_(std::move(dump_dir)) {}
TextureOverrides TextureOverrides::FromEnvironment() {
return TextureOverrides(EnvironmentString("MOCKTAIL_TEXTURE_OVERRIDE_DIR"),
EnvironmentString("MOCKTAIL_TEXTURE_DUMP_DIR"));
}
std::shared_ptr<const RgbaImage> TextureOverrides::Lookup(std::uint64_t hash) {
if (override_dir_.empty()) {
return nullptr;
}
std::lock_guard<std::mutex> lock(mutex_);
const auto cached = cache_.find(hash);
if (cached != cache_.end()) {
return cached->second;
}
std::shared_ptr<const RgbaImage> loaded;
RgbaImage image;
const std::string path = override_dir_ + "/" + HashName(hash) + ".png";
if (ReadPngRgba(path, &image) && image.width > 0 && image.height > 0) {
loaded = std::make_shared<const RgbaImage>(std::move(image));
std::fprintf(stderr, " [vulkan] texture override loaded: %s (%ux%u)\n",
path.c_str(), loaded->width, loaded->height);
}
cache_[hash] = loaded;
return loaded;
}
void TextureOverrides::Dump(std::uint64_t hash, std::uint32_t width,
std::uint32_t height, const std::uint8_t* rgba) {
if (dump_dir_.empty() || rgba == nullptr || width == 0 || height == 0) {
return;
}
{
std::lock_guard<std::mutex> lock(mutex_);
if (!dumped_.insert(hash).second) {
return;
}
}
std::error_code error;
std::filesystem::create_directories(dump_dir_, error);
RgbaImage image;
image.width = width;
image.height = height;
image.pixels.assign(rgba, rgba + static_cast<std::size_t>(width) * height * 4);
const std::string path = dump_dir_ + "/" + HashName(hash) + "_" +
std::to_string(width) + "x" +
std::to_string(height) + ".png";
if (!WritePngRgba(path, image)) {
std::fprintf(stderr, " [vulkan] texture dump failed: %s\n", path.c_str());
}
}
} // namespace mocktail::graphics
File diff suppressed because it is too large. Load diff
+75 -22
View File
@@ -1,3 +1,4 @@
// Modified by vii from komaruworld/mocktail. See README "About this fork".
#include "jnivm/jnivm.h"
#include "mocktail/audio/fmod_thread_floating_point.h"
@@ -23,6 +24,8 @@
#include <unordered_set>
#include <vector>
#include "runtime/display_size.h"
namespace jnivm {
void Class::RegisterMethod(const std::string& method_name,
@@ -562,13 +565,25 @@ bool ResolvedDarkTheme() {
}
jint IntResultForName(const char* name) {
if (std::strcmp(name, "getScreenWidth") == 0 ||
std::strcmp(name, "getWidth") == 0) {
return 1280;
if (std::strcmp(name, "getScreenWidth") == 0) {
return mocktail::runtime::ParseDisplaySize(
std::getenv(mocktail::runtime::kDisplaySizeEnvironment))
.width;
}
if (std::strcmp(name, "getScreenHeight") == 0 ||
std::strcmp(name, "getHeight") == 0) {
return 720;
if (std::strcmp(name, "getScreenHeight") == 0) {
return mocktail::runtime::ParseDisplaySize(
std::getenv(mocktail::runtime::kDisplaySizeEnvironment))
.height;
}
if (std::strcmp(name, "getWidth") == 0) {
return mocktail::runtime::ParseDisplaySize(
std::getenv(mocktail::runtime::kWindowSizeEnvironment))
.width;
}
if (std::strcmp(name, "getHeight") == 0) {
return mocktail::runtime::ParseDisplaySize(
std::getenv(mocktail::runtime::kWindowSizeEnvironment))
.height;
}
if (std::strcmp(name, "getDensityDpi") == 0) {
return 160;
@@ -2275,8 +2290,11 @@ jobject MakeDeviceStaticParamsObject() {
pseudo_object->object_fields["soc_model"] =
MakeString(identity.soc_model.c_str());
pseudo_object->boolean_fields["cpu64Bit"] = JNI_TRUE;
pseudo_object->int_fields["screenWidth"] = 1280;
pseudo_object->int_fields["screenHeight"] = 720;
const mocktail::runtime::DisplaySize host_display =
mocktail::runtime::ParseDisplaySize(
std::getenv(mocktail::runtime::kDisplaySizeEnvironment));
pseudo_object->int_fields["screenWidth"] = host_display.width;
pseudo_object->int_fields["screenHeight"] = host_display.height;
pseudo_object->int_fields["screenDensityDpi"] = 160;
pseudo_object->int_fields["apiVersion"] = 33;
pseudo_object->int_fields["sdkVersion"] = 33;
@@ -2446,14 +2464,17 @@ void EnsureAndroidObjectGraph() {
SetObjectFieldRaw(decor_view, "holder", surface_holder);
SetObjectFieldRaw(decor_view, "surface", surface);
SetObjectFieldRaw(decor_view, "display", display);
SetIntFieldRaw(decor_view, "width", 1280);
SetIntFieldRaw(decor_view, "height", 720);
const mocktail::runtime::DisplaySize host_window =
mocktail::runtime::ParseDisplaySize(
std::getenv(mocktail::runtime::kWindowSizeEnvironment));
SetIntFieldRaw(decor_view, "width", host_window.width);
SetIntFieldRaw(decor_view, "height", host_window.height);
SetObjectFieldRaw(surface_view, "holder", surface_holder);
SetObjectFieldRaw(surface_view, "surface", surface);
SetObjectFieldRaw(surface_view, "rootView", root_view);
SetIntFieldRaw(surface_view, "width", 1280);
SetIntFieldRaw(surface_view, "height", 720);
SetIntFieldRaw(surface_view, "width", host_window.width);
SetIntFieldRaw(surface_view, "height", host_window.height);
SetObjectFieldRaw(surface_holder, "surface", surface);
SetObjectFieldRaw(surface_holder, "surfaceFrame",
@@ -2461,11 +2482,14 @@ void EnsureAndroidObjectGraph() {
SetBooleanFieldRaw(surface, "valid", JNI_TRUE);
SetBooleanFieldRaw(surface, "isValid", JNI_TRUE);
SetIntFieldRaw(display, "width", 1280);
SetIntFieldRaw(display, "height", 720);
const mocktail::runtime::DisplaySize host_display =
mocktail::runtime::ParseDisplaySize(
std::getenv(mocktail::runtime::kDisplaySizeEnvironment));
SetIntFieldRaw(display, "width", host_display.width);
SetIntFieldRaw(display, "height", host_display.height);
SetIntFieldRaw(display, "rotation", 0);
SetIntFieldRaw(display_metrics, "widthPixels", 1280);
SetIntFieldRaw(display_metrics, "heightPixels", 720);
SetIntFieldRaw(display_metrics, "widthPixels", host_display.width);
SetIntFieldRaw(display_metrics, "heightPixels", host_display.height);
SetIntFieldRaw(display_metrics, "densityDpi", 160);
SetFloatFieldRaw(display_metrics, "density", 1.0f);
SetFloatFieldRaw(display_metrics, "scaledDensity", 1.0f);
@@ -2476,9 +2500,11 @@ void EnsureAndroidObjectGraph() {
: PlatformIdentity{};
SetIntFieldRaw(configuration, "orientation", 2);
SetIntFieldRaw(configuration, "densityDpi", 160);
SetIntFieldRaw(configuration, "screenWidthDp", 1280);
SetIntFieldRaw(configuration, "screenHeightDp", 720);
SetIntFieldRaw(configuration, "smallestScreenWidthDp", 720);
// Density is 1.0, so dp equals window pixels.
SetIntFieldRaw(configuration, "screenWidthDp", host_window.width);
SetIntFieldRaw(configuration, "screenHeightDp", host_window.height);
SetIntFieldRaw(configuration, "smallestScreenWidthDp",
std::min(host_window.width, host_window.height));
SetIntFieldRaw(configuration, "touchscreen", identity.touch_enabled ? 3 : 1);
SetIntFieldRaw(configuration, "keyboard", identity.keyboard_enabled ? 2 : 1);
SetIntFieldRaw(configuration, "keyboardHidden",
@@ -3839,8 +3865,30 @@ jobjectArray MakeObjectArray(jsize len, jobject init) {
return ref;
}
// NativeQuoteInterface.requestResponse([B)[B reply when no Android Keystore
// exists: status byte 1, attestation-available byte 0, then the error text.
// A real device with a keystore answers [1, 1, chain] instead.
jbyteArray MakeQuoteUnavailableResponse() {
static const char kMessage[] =
"java.security.KeyStoreException: AndroidKeyStore is not available";
const std::size_t message_length = sizeof(kMessage) - 1;
jbyteArray result = MakeByteArray(static_cast<jsize>(2 + message_length));
PseudoArray* array = ArrayFromRef(result);
if (array == nullptr || array->bytes.size() != 2 + message_length) {
return nullptr;
}
array->bytes[0] = 1;
array->bytes[1] = 0;
std::memcpy(array->bytes.data() + 2, kMessage, message_length);
return result;
}
jobject StaticObjectResultForMethod(jmethodID method_id) {
const char* name = MethodName(method_id);
if (std::strcmp(name, "requestResponse") == 0 &&
std::strcmp(MethodSignature(method_id), "([B)[B") == 0) {
return MakeQuoteUnavailableResponse();
}
const PlatformIdentity identity = CurrentPlatformIdentity();
jobject android_object = AndroidObjectForMethod(name);
if (android_object) {
@@ -4952,10 +5000,15 @@ jobject CreateAndroidConfiguration(JNIEnv* env) {
SetIntFieldRaw(configuration, "navigation", 1);
SetIntFieldRaw(configuration, "navigationHidden", 1);
SetIntFieldRaw(configuration, "orientation", 2);
SetIntFieldRaw(configuration, "screenHeightDp", 720);
// Density is 1.0, so dp equals window pixels.
const mocktail::runtime::DisplaySize config_window =
mocktail::runtime::ParseDisplaySize(
std::getenv(mocktail::runtime::kWindowSizeEnvironment));
SetIntFieldRaw(configuration, "screenHeightDp", config_window.height);
SetIntFieldRaw(configuration, "screenLayout", 0);
SetIntFieldRaw(configuration, "screenWidthDp", 1280);
SetIntFieldRaw(configuration, "smallestScreenWidthDp", 720);
SetIntFieldRaw(configuration, "screenWidthDp", config_window.width);
SetIntFieldRaw(configuration, "smallestScreenWidthDp",
std::min(config_window.width, config_window.height));
SetIntFieldRaw(configuration, "touchscreen", identity.touch_enabled ? 3 : 1);
SetIntFieldRaw(configuration, "uiMode", 0);
return configuration;
+111 -27
View File
@@ -1,8 +1,10 @@
// Modified by vii from komaruworld/mocktail. See README "About this fork".
#include <algorithm>
#include <atomic>
#include <cctype>
#include <cerrno>
#include <chrono>
#include <cmath>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
@@ -56,6 +58,8 @@
#include "libc_shim/libc_shim.h"
#include "linker/linker.h"
#include "mocktail/graphics/bionic_egl_bridge.h"
#include "runtime/device_memory_profile.h"
#include "runtime/display_size.h"
#include "runtime/environment.h"
#include "runtime/discord_rpc.h"
#include "runtime/jnivm_platform_web_callbacks.h"
@@ -70,6 +74,7 @@
#include "runtime/roblox_text_input_jni_bridge.h"
#include "runtime/runtime_config.h"
#include "runtime/runtime_paths.h"
#include "runtime/texture_memory_policy.h"
#include "services/client_settings_service.h"
#include "services/http_client.h"
#include "window/window.h"
@@ -2393,6 +2398,23 @@ void InstallNativeGlJavaImplementation(JNIEnv* env, jclass native_gl_java_class)
jobject BuildPlatformParams(JNIEnv* env, jobject surface, bool is_headless);
mocktail::runtime::DisplaySize HostDisplaySize() {
return mocktail::runtime::ParseDisplaySize(
std::getenv(mocktail::runtime::kDisplaySizeEnvironment));
}
// Live window pixels once the host window exists; the initial window size
// handoff otherwise.
mocktail::runtime::DisplaySize HostWindowPixelSize() {
const mocktail::window::WindowViewportSnapshot viewport =
mocktail::window::GetWindowViewportSnapshot();
if (viewport.valid()) {
return {viewport.pixel_width, viewport.pixel_height};
}
return mocktail::runtime::ParseDisplaySize(
std::getenv(mocktail::runtime::kWindowSizeEnvironment));
}
jobject BuildDeviceParams(JNIEnv* env) {
jobject params = NewObject(env, "com/roblox/engine/jni/model/DeviceParams");
if (!params) {
@@ -2414,27 +2436,42 @@ jobject BuildDeviceParams(JNIEnv* env) {
SetStringField(env, params, "appVersion", app_version.c_str());
SetStringField(env, params, "country", "US");
SetStringField(env, params, "manufacturer", manufacturer.c_str());
SetStringField(env, params, "displayResolution", "1280x720");
const mocktail::runtime::DisplaySize display_size =
mocktail::runtime::ParseDisplaySize(
std::getenv(mocktail::runtime::kDisplaySizeEnvironment));
const std::string display_resolution = std::to_string(display_size.width) +
"x" +
std::to_string(display_size.height);
SetStringField(env, params, "displayResolution", display_resolution.c_str());
SetStringField(env, params, "networkType", "wifi");
SetStringField(env, params, "deviceSku", device_sku.c_str());
SetStringField(env, params, "socModel", soc_model.c_str());
SetStringField(env, params, "appBuildVariant", "googleProdRelease");
SetStringField(env, params, "testDeviceName", device_name.c_str());
const bool is_low_ram = !IsEnabled("MOCKTAIL_DISABLE_LOW_RAM_DEVICE");
SetIntField(env, params, "deviceTotalMemoryMB", is_low_ram ? 2048 : 4096);
SetIntField(env, params, "displayPhysicalWidthPixels", 1280);
SetIntField(env, params, "displayPhysicalHeightPixels", 720);
SetIntField(env, params, "memoryClass", is_low_ram ? 256 : 512);
SetIntField(env, params, "largeMemoryClass", is_low_ram ? 512 : 1024);
// MOCKTAIL_DISABLE_LOW_RAM_DEVICE forces the normal-RAM profile even when
// the host total cannot be read or is below 4 GiB.
std::uint64_t host_memory_bytes = mocktail::runtime::DetectHostMemoryBytes();
if (IsEnabled("MOCKTAIL_DISABLE_LOW_RAM_DEVICE")) {
host_memory_bytes =
std::max<std::uint64_t>(host_memory_bytes, 4096ULL * 1024ULL * 1024ULL);
}
const mocktail::runtime::DeviceMemoryProfile memory =
mocktail::runtime::BuildDeviceMemoryProfile(host_memory_bytes);
SetIntField(env, params, "deviceTotalMemoryMB", memory.total_memory_mb);
SetIntField(env, params, "displayPhysicalWidthPixels", display_size.width);
SetIntField(env, params, "displayPhysicalHeightPixels",
display_size.height);
SetIntField(env, params, "memoryClass", memory.memory_class_mb);
SetIntField(env, params, "largeMemoryClass", memory.large_memory_class_mb);
SetLongField(env, params, "lowMemoryKillerBackgroundAppThreshold",
is_low_ram ? 256 : 0);
memory.low_memory_killer_background_threshold);
SetLongField(env, params, "lowMemoryKillerForegroundAppThreshold",
is_low_ram ? 512 : 0);
memory.low_memory_killer_foreground_threshold);
SetBooleanField(env, params, "cpu64Bit", JNI_TRUE);
SetBooleanField(env, params, "isChrome", JNI_FALSE);
SetBooleanField(env, params, "isLowRamDevice",
is_low_ram ? JNI_TRUE : JNI_FALSE);
memory.low_ram_device ? JNI_TRUE : JNI_FALSE);
return params;
}
@@ -2534,8 +2571,9 @@ jobject BuildAppBridgeInitParams(JNIEnv* env, jstring client_settings,
SetStringField(env, params, "locale", "en_us");
SetRobloxServiceUrlFields(env, params);
SetIntField(env, params, "screenWidth", 1280);
SetIntField(env, params, "screenHeight", 720);
const mocktail::runtime::DisplaySize init_display = HostDisplaySize();
SetIntField(env, params, "screenWidth", init_display.width);
SetIntField(env, params, "screenHeight", init_display.height);
SetIntField(env, params, "densityDpi", 160);
SetIntField(env, params, "sdkVersion", 33);
jboolean headless = is_headless ? JNI_TRUE : JNI_FALSE;
@@ -2569,13 +2607,19 @@ jobject BuildPlatformParams(JNIEnv* env, jobject surface, bool is_headless) {
SetStringField(env, params, "deviceName", platform_device_name.c_str());
SetStringField(env, params, "locale", "en_us");
SetStringField(env, params, "assetFolderPath", DefaultAssetPath().c_str());
SetIntField(env, params, "width", 1280);
SetIntField(env, params, "height", 720);
SetIntField(env, params, "screenWidth", 1280);
SetIntField(env, params, "screenHeight", 720);
const mocktail::runtime::DisplaySize platform_window = HostWindowPixelSize();
const mocktail::runtime::DisplaySize platform_display = HostDisplaySize();
SetIntField(env, params, "width", platform_window.width);
SetIntField(env, params, "height", platform_window.height);
SetIntField(env, params, "screenWidth", platform_display.width);
SetIntField(env, params, "screenHeight", platform_display.height);
SetIntField(env, params, "densityDpi", 160);
SetIntField(env, params, "viewportWidthMm", 203);
SetIntField(env, params, "viewportHeightMm", 114);
SetIntField(env, params, "viewportWidthMm",
mocktail::runtime::PixelsToMillimetersAt160Dpi(
platform_window.width));
SetIntField(env, params, "viewportHeightMm",
mocktail::runtime::PixelsToMillimetersAt160Dpi(
platform_window.height));
const mocktail::window::WindowViewportSnapshot viewport =
mocktail::window::GetWindowViewportSnapshot();
SetFloatField(env, params, "dpiScale", viewport.dpi_scale);
@@ -2684,10 +2728,12 @@ jobject BuildStartAppParams(JNIEnv* env, jstring app_params,
SetStringField(env, params, "deviceName", start_device_name.c_str());
SetStringField(env, params, "locale", "en_us");
SetRobloxServiceUrlFields(env, params);
SetIntField(env, params, "width", 1280);
SetIntField(env, params, "height", 720);
SetIntField(env, params, "screenWidth", 1280);
SetIntField(env, params, "screenHeight", 720);
const mocktail::runtime::DisplaySize start_window = HostWindowPixelSize();
const mocktail::runtime::DisplaySize start_display = HostDisplaySize();
SetIntField(env, params, "width", start_window.width);
SetIntField(env, params, "height", start_window.height);
SetIntField(env, params, "screenWidth", start_display.width);
SetIntField(env, params, "screenHeight", start_display.height);
SetIntField(env, params, "densityDpi", 160);
SetIntField(env, params, "sdkVersion", 33);
SetIntField(env, params, "placeId", 0);
@@ -2815,8 +2861,9 @@ jobject BuildMockSurface(JNIEnv* env) {
if (!surface) {
return nullptr;
}
SetIntField(env, surface, "width", 1280);
SetIntField(env, surface, "height", 720);
const mocktail::runtime::DisplaySize surface_size = HostWindowPixelSize();
SetIntField(env, surface, "width", surface_size.width);
SetIntField(env, surface, "height", surface_size.height);
SetBooleanField(env, surface, "valid", JNI_TRUE);
SetBooleanField(env, surface, "isValid", JNI_TRUE);
return surface;
@@ -3913,7 +3960,10 @@ std::cerr << " [engine] nativeAppBridgeV2InitWithParams recovered\n"
on_surface_created(env, game_activity, handle, surface);
}
if (run_lifecycle_callbacks && on_surface_changed) {
on_surface_changed(env, game_activity, handle, surface, 4, 1280, 720);
const mocktail::runtime::DisplaySize changed_size =
HostWindowPixelSize();
on_surface_changed(env, game_activity, handle, surface, 4,
changed_size.width, changed_size.height);
}
if (run_lifecycle_callbacks && on_surface_redraw_needed) {
on_surface_redraw_needed(env, game_activity, handle, surface);
@@ -4084,8 +4134,9 @@ std::cerr << " [engine] nativeAppBridgeV2InitWithParams recovered\n"
ShouldRunStartupStep("MOCKTAIL_UPDATE_APP_UI_SIZES", false)) {
env = ensure_env();
std::cout << " [engine] updateAppUISizes\n" << std::flush;
context->native_update_app_ui_sizes(env, native_gl_class, 1280, 720, 0, 0,
0);
const mocktail::runtime::DisplaySize ui_size = HostWindowPixelSize();
context->native_update_app_ui_sizes(env, native_gl_class, ui_size.width,
ui_size.height, 0, 0, 0);
std::cout << " [engine] updateAppUISizes returned\n" << std::flush;
}
@@ -4726,6 +4777,38 @@ int mocktail::legacy::Run(const runtime::CommandLineOptions& options,
<< std::flush;
}
}
if (window_initialised) {
auto* sdl_window =
static_cast<SDL_Window*>(mocktail::window::GetBackendWindow());
const SDL_DisplayID display =
sdl_window != nullptr ? SDL_GetDisplayForWindow(sdl_window) : 0;
const SDL_DisplayMode* mode =
display != 0 ? SDL_GetCurrentDisplayMode(display) : nullptr;
if (mode != nullptr && mode->w > 0 && mode->h > 0) {
// SDL display modes are in desktop units; pixel_density maps them to
// physical pixels.
const float density = mode->pixel_density > 0.0f ? mode->pixel_density
: 1.0f;
const std::string display_size =
std::to_string(std::lround(mode->w * density)) + "x" +
std::to_string(std::lround(mode->h * density));
setenv(mocktail::runtime::kDisplaySizeEnvironment, display_size.c_str(),
1);
std::cout << " [window] host display " << display_size << " pixels\n"
<< std::flush;
}
}
if (window_initialised) {
const mocktail::window::WindowViewportSnapshot viewport =
mocktail::window::GetWindowViewportSnapshot();
if (viewport.valid()) {
const std::string window_size = std::to_string(viewport.pixel_width) +
"x" +
std::to_string(viewport.pixel_height);
setenv(mocktail::runtime::kWindowSizeEnvironment, window_size.c_str(),
1);
}
}
const SDL_SystemTheme system_theme =
window_initialised ? SDL_GetSystemTheme() : SDL_SYSTEM_THEME_UNKNOWN;
const bool system_dark_theme = system_theme == SDL_SYSTEM_THEME_DARK;
@@ -6718,6 +6801,7 @@ int mocktail::legacy::Run(const runtime::CommandLineOptions& options,
window_input_runtime =
std::make_shared<mocktail::runtime::RobloxWindowInputRuntime>(
input_environment, roblox_capabilities.input);
window_input_runtime->SetRawMouseEnabled(input_capabilities.raw_mouse);
const mocktail::Status input_status = window_input_runtime->Initialize();
if (!input_status.ok()) {
std::cerr << "[FATAL] Typed production input did not initialize: "
+8 -1
View File
@@ -1,3 +1,4 @@
// Modified by vii from komaruworld/mocktail. See README "About this fork".
#include <algorithm>
#include <chrono>
#include <condition_variable>
@@ -779,14 +780,20 @@ int main(int argc, char* argv[]) {
<< " FFlag overrides from " << fflags_path << '\n';
}
std::string client_settings_overrides;
std::vector<std::string> kept_fflag_overrides;
if (!mocktail::runtime::MergeRuntimeClientSettingsOverrides(
runtime_config.config.frame_rate(),
runtime_config.config.performance(), fflags.json,
&client_settings_overrides, &command_line_error)) {
&client_settings_overrides, &command_line_error,
&kept_fflag_overrides)) {
std::cerr << "[FATAL] Cannot apply runtime client-settings policy: "
<< command_line_error << '\n';
return EXIT_FAILURE;
}
for (const std::string& name : kept_fflag_overrides) {
std::cout << " [runtime] keeping " << name << " from " << fflags_path
<< " over the performance preset\n";
}
std::string audio_capture_overrides;
if (!mocktail::runtime::MergeAudioCaptureClientSettingsOverrides(
runtime_config.config.microphone_enabled(),
+35
View File
@@ -0,0 +1,35 @@
#include "runtime/device_memory_profile.h"
#include <algorithm>
#include <limits>
namespace mocktail {
namespace runtime {
namespace {
constexpr std::uint64_t kMebibyte = 1024U * 1024U;
constexpr std::uint64_t kMinimumNormalRamBytes = 4096U * kMebibyte;
} // namespace
DeviceMemoryProfile BuildDeviceMemoryProfile(std::uint64_t host_memory_bytes) {
DeviceMemoryProfile profile;
if (host_memory_bytes < kMinimumNormalRamBytes) {
profile.total_memory_mb = 2048;
profile.memory_class_mb = 256;
profile.large_memory_class_mb = 512;
profile.low_memory_killer_background_threshold = 256;
profile.low_memory_killer_foreground_threshold = 512;
profile.low_ram_device = true;
return profile;
}
profile.total_memory_mb = static_cast<std::int32_t>(std::min<std::uint64_t>(
host_memory_bytes / kMebibyte,
static_cast<std::uint64_t>(std::numeric_limits<std::int32_t>::max())));
profile.memory_class_mb = 512;
profile.large_memory_class_mb = 1024;
return profile;
}
} // namespace runtime
} // namespace mocktail
+3 -4
View File
@@ -18,11 +18,10 @@ namespace mocktail {
namespace runtime {
namespace {
// TextureManager2 selects its mobile MipPackStream path on Android Vulkan and
// can keep world textures at low-resolution mips. TM1 preserves full texture
// fidelity until that path is compatible with the host Vulkan adapter.
// Keep the Vulkan shader workaround narrowly scoped. TextureManager2 is left
// enabled so the runtime can use its normal texture path and mip selection.
constexpr char kVulkanClientSettingsOverrides[] =
R"({"FStringGraphicsTextureManager2DenyPattern2":".*","FStringGraphicsVulkanShaderMTDenyPattern":"4318:.*"})";
R"({"FStringGraphicsVulkanShaderMTDenyPattern":"4318:.*"})";
constexpr const char* kIcdDirectories[] = {
"/usr/share/vulkan/icd.d",
+28 -41
View File
@@ -1,3 +1,4 @@
// Modified by vii from komaruworld/mocktail. See README "About this fork".
#include "runtime/performance_policy.h"
#include <sched.h>
@@ -27,22 +28,21 @@ struct ClientSetting {
std::string_view value;
};
bool SetCompatibleValue(nlohmann::json* object, const ClientSetting& setting,
std::string* error) {
// A caller-supplied value always wins over the preset; the key is reported
// through kept_overrides so startup can say which preset values were skipped.
void SetCompatibleValue(nlohmann::json* object, const ClientSetting& setting,
std::vector<std::string>* kept_overrides) {
const std::string name(setting.name);
const std::string value(setting.value);
const auto existing = object->find(name);
if (existing != object->end()) {
if (!existing->is_string() || existing->get<std::string>() != value) {
if (error != nullptr) {
*error = std::string("performance policy conflicts with ") + name;
}
return false;
if ((!existing->is_string() || existing->get<std::string>() != value) &&
kept_overrides != nullptr) {
kept_overrides->push_back(name);
}
return true;
return;
}
(*object)[name] = value;
return true;
}
bool ReadTopologyValue(int logical_cpu, std::string_view name, int* value) {
@@ -154,10 +154,10 @@ int DetectAvailablePhysicalCoreCount() {
: static_cast<int>(physical_cores.size());
}
bool MergePerformanceClientSettingsOverrides(const PerformancePolicy& policy,
std::string_view base_json,
std::string* merged_json,
std::string* error) {
bool MergePerformanceClientSettingsOverrides(
const PerformancePolicy& policy, std::string_view base_json,
std::string* merged_json, std::string* error,
std::vector<std::string>* kept_overrides) {
if (merged_json == nullptr) {
if (error != nullptr) {
*error = "performance client-settings output is required";
@@ -184,13 +184,10 @@ bool MergePerformanceClientSettingsOverrides(const PerformancePolicy& policy,
return true;
}
const auto apply_settings = [&overrides,
error](const auto& settings) -> bool {
kept_overrides](const auto& settings) {
for (const ClientSetting& setting : settings) {
if (!SetCompatibleValue(&overrides, setting, error)) {
return false;
}
SetCompatibleValue(&overrides, setting, kept_overrides);
}
return true;
};
const bool throughput_mode =
policy.physics_worker_mode == PhysicsWorkerMode::kThroughput;
@@ -198,9 +195,7 @@ bool MergePerformanceClientSettingsOverrides(const PerformancePolicy& policy,
const std::array<ClientSetting, 1> physics_settings = {{
{"DFIntSimMidPhaseContactPipelineBatchSize", "128"},
}};
if (!apply_settings(physics_settings)) {
return false;
}
apply_settings(physics_settings);
}
int render_worker_count = 0;
if (throughput_mode ||
@@ -223,9 +218,7 @@ bool MergePerformanceClientSettingsOverrides(const PerformancePolicy& policy,
{"FIntTaskSchedulerAutoThreadLimit", workers},
{"DFIntSimMidPhaseContactPipelineBatchSize", "128"},
}};
if (!apply_settings(physics_settings)) {
return false;
}
apply_settings(physics_settings);
} else if (policy.multithreaded_rendering &&
policy.physics_worker_mode != PhysicsWorkerMode::kLatency) {
const std::string workers = std::to_string(render_worker_count);
@@ -233,9 +226,7 @@ bool MergePerformanceClientSettingsOverrides(const PerformancePolicy& policy,
{"FIntTaskSchedulerThreadMin", workers},
{"FIntTaskSchedulerAsyncTasksMinimumThreadCount", workers},
}};
if (!apply_settings(scheduler_settings)) {
return false;
}
apply_settings(scheduler_settings);
}
if ((policy.multithreaded_rendering || throughput_mode) &&
policy.physics_worker_mode != PhysicsWorkerMode::kLatency) {
@@ -322,26 +313,21 @@ bool MergePerformanceClientSettingsOverrides(const PerformancePolicy& policy,
{"FIntDefaultAudioDecodeBufferSizeMs", "50"},
{"FIntMaxAudibleSoundChannels", "32"},
}};
if (!apply_settings(rendering_settings)) {
return false;
}
apply_settings(rendering_settings);
if (!manual_quality) {
if (!SetCompatibleValue(
&overrides, {"FIntDebugFRMQualityLevelOverride", quality_str},
error)) {
return false;
}
SetCompatibleValue(&overrides,
{"FIntDebugFRMQualityLevelOverride", quality_str},
kept_overrides);
}
}
*merged_json = overrides.dump();
return true;
}
bool MergeRuntimeClientSettingsOverrides(const FrameRatePolicy& frame_rate,
const PerformancePolicy& performance,
std::string_view base_json,
std::string* merged_json,
std::string* error) {
bool MergeRuntimeClientSettingsOverrides(
const FrameRatePolicy& frame_rate, const PerformancePolicy& performance,
std::string_view base_json, std::string* merged_json, std::string* error,
std::vector<std::string>* kept_overrides) {
std::string frame_rate_overrides;
if (!MergeFrameRateClientSettingsOverrides(frame_rate, base_json,
&frame_rate_overrides, error)) {
@@ -349,7 +335,8 @@ bool MergeRuntimeClientSettingsOverrides(const FrameRatePolicy& frame_rate,
}
std::string performance_overrides;
if (!MergePerformanceClientSettingsOverrides(
performance, frame_rate_overrides, &performance_overrides, error)) {
performance, frame_rate_overrides, &performance_overrides, error,
kept_overrides)) {
return false;
}
std::string http_client_overrides;
@@ -627,6 +627,10 @@ RobloxInputDispatchResult RobloxInputRuntime::HandleEvent(
return result;
}
void RobloxInputRuntime::SetRawMouseEnabled(bool enabled) {
router_.SetRawMouseEnabled(enabled);
}
RobloxInputSnapshot RobloxInputRuntime::Snapshot() const {
return router_.Snapshot();
}
+26 -11
View File
@@ -532,6 +532,11 @@ RobloxInputSnapshot RobloxInputRouter::Snapshot() const {
return snapshot;
}
void RobloxInputRouter::SetRawMouseEnabled(bool enabled) {
const std::lock_guard<std::mutex> lock(mutex_);
raw_mouse_ = enabled;
}
RobloxInputDispatchResult RobloxInputRouter::HandleMouseMotionLocked(
const platform::MouseMotionEvent& event) {
if (sink_.mouse_move == nullptr) {
@@ -544,21 +549,31 @@ RobloxInputDispatchResult RobloxInputRouter::HandleMouseMotionLocked(
const float delta_x = transform.HostLogicalToGuestX(event.delta_x);
const float delta_y = transform.HostLogicalToGuestY(event.delta_y);
if (event.x == 0.0f && event.y == 0.0f &&
(delta_x != 0.0f || delta_y != 0.0f)) {
mouse_x_ += delta_x;
mouse_y_ += delta_y;
} else {
mouse_x_ = transform.HostLogicalToGuestX(event.x);
mouse_y_ = transform.HostLogicalToGuestY(event.y);
}
const float max_x = std::max(0.0F, transform.guest_width() - 1.0F);
const float max_y = std::max(0.0F, transform.guest_height() - 1.0F);
const float clamped_x = std::clamp(mouse_x_, 0.0f, max_x);
const float clamped_y = std::clamp(mouse_y_, 0.0f, max_y);
// mouse_x_/mouse_y_ stay inside the viewport. Relative-mode motion reports
// zero absolute coordinates, so the accumulated position is the only
// position there; letting it drift past the edge would swallow every
// reversal until the pointer walked all the way back.
if (event.x == 0.0f && event.y == 0.0f &&
(delta_x != 0.0f || delta_y != 0.0f)) {
mouse_x_ = std::clamp(mouse_x_ + delta_x, 0.0f, max_x);
mouse_y_ = std::clamp(mouse_y_ + delta_y, 0.0f, max_y);
} else {
mouse_x_ = std::clamp(transform.HostLogicalToGuestX(event.x), 0.0f, max_x);
mouse_y_ = std::clamp(transform.HostLogicalToGuestY(event.y), 0.0f, max_y);
}
// Raw mouse reports the host's own delta, skipping the guest-surface scale
// that otherwise changes look sensitivity when the desktop display scale and
// the window's pixel density disagree. The position stays in guest units.
const float reported_delta_x = raw_mouse_ ? event.delta_x : delta_x;
const float reported_delta_y = raw_mouse_ ? event.delta_y : delta_y;
return NativeResultLocked(
sink_.mouse_move(sink_.context, clamped_x, clamped_y, delta_x, delta_y),
sink_.mouse_move(sink_.context, mouse_x_, mouse_y_, reported_delta_x,
reported_delta_y),
RobloxInputEventKind::kMouseMotion);
}
@@ -195,6 +195,10 @@ Status RobloxWindowInputRuntime::UpdateTextFocusProperties(
return runtime_.UpdateTextFocusProperties(generation, properties);
}
void RobloxWindowInputRuntime::SetRawMouseEnabled(bool enabled) {
runtime_.SetRawMouseEnabled(enabled);
}
RobloxInputSnapshot RobloxWindowInputRuntime::Snapshot() const {
return runtime_.Snapshot();
}
+7 -1
View File
@@ -1,3 +1,4 @@
// Modified by vii from komaruworld/mocktail. See README "About this fork".
#include "runtime/runtime_config.h"
#include <algorithm>
@@ -229,6 +230,11 @@ RuntimeConfig RuntimeConfig::FromEnvironment(const Environment& environment) {
keyboard.has_value()) {
config.input_capabilities_.keyboard_enabled = *keyboard;
}
if (const std::optional<bool> raw_mouse =
InputEnabled(environment, "MOCKTAIL_RAW_MOUSE");
raw_mouse.has_value()) {
config.input_capabilities_.raw_mouse = *raw_mouse;
}
bool customized_device = false;
config.device_profile_valid_ =
config.device_profile_valid_ &&
@@ -325,7 +331,7 @@ RuntimeConfig RuntimeConfig::FromEnvironment(const Environment& environment) {
}
bool discord_booleans_valid = true;
config.discord_rpc_.enabled = ReadBoolean(
environment, "MOCKTAIL_DISCORD_RPC_ENABLED", false,
environment, "MOCKTAIL_DISCORD_RPC_ENABLED", true,
&discord_booleans_valid);
config.discord_rpc_.show_place_name = ReadBoolean(
environment, "MOCKTAIL_DISCORD_RPC_SHOW_PLACE_NAME", true,
+16 -4
View File
@@ -1,3 +1,4 @@
// Modified by vii from komaruworld/mocktail. See README "About this fork".
#include "runtime/runtime_config_bootstrap.h"
#include <fcntl.h>
@@ -16,7 +17,8 @@ namespace runtime {
namespace {
constexpr std::string_view kDefaultRuntimeConfig =
R"yaml(# Mocktail configuration.
R"yaml(# Modified by vii from komaruworld/mocktail. See README "About this fork".
# Mocktail configuration.
# The file is created once with mode 0600. Mocktail never replaces your edits.
# Integer: configuration schema version. Only version 1 is supported.
@@ -64,7 +66,9 @@ graphics:
# display, unlimited, or any positive integer; fixed values are forwarded to
# DFIntTaskSchedulerTargetFps without a whitelist.
# frame_rate_limit: -1
# Optional presentation synchronization override: auto, on, or off.
# Optional presentation synchronization override: auto, on, or off. auto
# presents through the lowest-latency synchronized mode the driver offers
# unless frame_rate_limit is unlimited.
# vsync: off
performance:
@@ -92,6 +96,14 @@ audio:
# between boots; prefer the exact device name when it is unique.
input_device: default
input:
# Boolean (default: false): send mouse look deltas in the host's own units.
# They are otherwise scaled by the window's pixel density divided by the
# desktop display scale, which cancels to 1.0 unless fractional scaling makes
# the two disagree. Turn this on when first-person aiming feels too slow or
# too fast under fractional scaling. The pointer position is unaffected.
raw_mouse: false
integrations:
fleasion:
# Boolean (default: false): trust Fleasion's CA without editing Roblox files.
@@ -104,9 +116,9 @@ integrations:
# or ~/.config/Fleasion/proxy_ca/ca.crt. Never select ca.key.
# ca_certificate: /home/user/.config/Fleasion/proxy_ca/ca.crt
discord_rpc:
# Boolean (default: false): publish Mocktail activity to Discord Desktop.
# Boolean (default: true): publish Nightcap activity to Discord Desktop.
# This never signs in to Discord and never reads an account token.
enabled: false
enabled: true
# Boolean (default: true): show the current Roblox experience name.
show_place_name: true
# Boolean (default: true): show how long the current session has run.
+12
View File
@@ -183,6 +183,7 @@ bool ValidateAndMap(const ValueMap& yaml, ValueMap* environment,
"window.title",
"window.high_dpi",
"input.touch_enabled",
"input.raw_mouse",
"compatibility.desktop_playability",
"network.use_system_proxy",
"network.proxy_host",
@@ -433,6 +434,14 @@ bool ValidateAndMap(const ValueMap& yaml, ValueMap* environment,
}
(*environment)["MOCKTAIL_TOUCH_MODE"] = parsed ? "on" : "off";
}
if (const auto raw_mouse = value("input.raw_mouse"); raw_mouse.has_value()) {
bool parsed = false;
if (!ParseBoolean(*raw_mouse, &parsed)) {
*error = "input.raw_mouse must be true or false";
return false;
}
(*environment)["MOCKTAIL_RAW_MOUSE"] = parsed ? "on" : "off";
}
if (const auto desktop_playability =
value("compatibility.desktop_playability");
desktop_playability.has_value()) {
@@ -877,6 +886,9 @@ bool ExportRuntimeConfigEnvironment(const RuntimeConfig& config,
SetEnvironmentValue(
"MOCKTAIL_KEYBOARD_MODE",
config.input_capabilities().keyboard_enabled ? "on" : "off", error) &&
SetEnvironmentValue("MOCKTAIL_RAW_MOUSE",
config.input_capabilities().raw_mouse ? "on" : "off",
error) &&
SetEnvironmentValue("MOCKTAIL_DESKTOP_PLAYABILITY",
config.desktop_playability() ? "1" : "0", error) &&
SetEnvironmentValue("MOCKTAIL_FRAME_RATE_LIMIT",
+4 -1
View File
@@ -1,3 +1,4 @@
// Modified by vii from komaruworld/mocktail. See README "About this fork".
#include "runtime/runtime_paths.h"
#define JSON_NOEXCEPTION 1
@@ -603,7 +604,9 @@ bool ExportRuntimePathEnvironment(const RuntimePaths& paths,
SetEnvironmentDefault("MOCKTAIL_ANDROID_CACHE_HOST_ROOT",
paths.android_cache_root(), error) &&
SetEnvironmentDefault("MOCKTAIL_VULKAN_SHADER_CACHE_HOST_PATH",
paths.vulkan_shader_cache_file(), error);
paths.vulkan_shader_cache_file(), error) &&
SetEnvironmentDefault("MOCKTAIL_TEXTURE_OVERRIDE_DIR",
paths.config_root() / "textures", error);
}
bool PrepareManagedPayloadWorkingDirectory(const RuntimePaths& paths,
+47 -4
View File
@@ -13,6 +13,7 @@
#include <nlohmann/json.hpp>
#include <random>
#include <system_error>
#include <vector>
namespace mocktail {
namespace services {
@@ -211,6 +212,48 @@ bool FindExistingDirectoryAncestor(const std::filesystem::path& directory,
}
}
// Creates every component of `directory` below `existing_ancestor` with mode
// 0700, whatever the process umask. mkdir masks its mode argument, so a umask
// of 002 would leave the directory group writable and rejected by the
// IsPrivateDirectory checks that guard this file's credentials, while a umask
// carrying owner bits would leave it unwritable by its own owner. Only
// components this call creates are tightened; one that already exists keeps
// its mode and is judged by IsPrivateDirectory like any other.
bool CreatePrivateDirectories(const std::filesystem::path& directory,
const std::filesystem::path& existing_ancestor) {
std::vector<std::filesystem::path> missing;
for (std::filesystem::path candidate = directory;
candidate != existing_ancestor;) {
if (candidate.empty()) return false;
missing.push_back(candidate);
// Mirror FindExistingDirectoryAncestor's walk, including the implicit "."
// parent of a bare relative name, so the two agree on which components are
// missing.
std::filesystem::path parent = candidate.parent_path();
if (parent.empty() && candidate != ".") parent = ".";
if (parent.empty() || parent == candidate) return false;
candidate = parent;
}
for (auto component = missing.rbegin(); component != missing.rend();
++component) {
if (mkdir(component->c_str(), 0700) != 0) {
if (errno != EEXIST) return false;
continue;
}
const int created = open(component->c_str(),
O_RDONLY | O_DIRECTORY | O_CLOEXEC | O_NOFOLLOW);
if (created < 0) return false;
struct stat metadata = {};
const bool tightened = fstat(created, &metadata) == 0 &&
S_ISDIR(metadata.st_mode) &&
metadata.st_uid == geteuid() &&
fchmod(created, 0700) == 0;
close(created);
if (!tightened) return false;
}
return true;
}
bool FsyncDirectoryChain(const std::filesystem::path& first,
const std::filesystem::path& last) {
std::filesystem::path current = first;
@@ -322,8 +365,7 @@ bool AtomicWriteContents(const std::filesystem::path& path,
return false;
}
const bool parent_existed = existing_ancestor == parent;
std::filesystem::create_directories(parent, filesystem_error);
if (filesystem_error) {
if (!CreatePrivateDirectories(parent, existing_ancestor)) {
error->assign(directory_error);
return false;
}
@@ -449,10 +491,11 @@ BrowserTrackerResult BrowserTrackerService::EnsureInitialized(
return result;
}
const bool lock_parent_existed = existing_lock_ancestor == lock_parent;
std::filesystem::create_directories(lock_parent, filesystem_error);
const bool lock_parent_created =
CreatePrivateDirectories(lock_parent, existing_lock_ancestor);
struct stat lock_parent_status = {};
const bool safe_lock_parent =
!filesystem_error &&
lock_parent_created &&
lstat(lock_parent.c_str(), &lock_parent_status) == 0 &&
IsPrivateDirectory(lock_parent_status);
const int lock = safe_lock_parent
+4 -3
View File
@@ -1,3 +1,4 @@
// Modified by vii from komaruworld/mocktail. See README "About this fork".
#include <adwaita.h>
#include <glib-unix.h>
#include <sys/socket.h>
@@ -153,7 +154,7 @@ void InstallProgressStyle(GdkDisplay* display) {
}
bool InitializeUi(UiStyle style) {
g_set_application_name("Mocktail");
g_set_application_name("Nightcap");
if (!gtk_init_check()) {
return false;
}
@@ -169,7 +170,7 @@ bool InitializeUi(UiStyle style) {
if (display == nullptr) {
return false;
}
gtk_window_set_default_icon_name("space.bigrat.mocktail");
gtk_window_set_default_icon_name("io.github.CoderDayton.nightcap");
adw_style_manager_set_color_scheme(adw_style_manager_get_default(),
ADW_COLOR_SCHEME_FORCE_DARK);
adw_style_manager_set_color_scheme(adw_style_manager_get_for_display(display),
@@ -229,7 +230,7 @@ void PresentProgressWindow(ProgressState* state, std::string_view message) {
GtkWidget* window_widget = adw_window_new();
state->window = GTK_WINDOW(g_object_ref_sink(window_widget));
gtk_widget_add_css_class(window_widget, "mocktail-update-progress");
gtk_window_set_title(state->window, "Mocktail");
gtk_window_set_title(state->window, "Nightcap");
gtk_window_set_default_size(state->window, 470, 640);
GtkWidget* toolbar_widget = adw_toolbar_view_new();
+145 -123
View File
@@ -1,3 +1,4 @@
// Modified by vii from komaruworld/mocktail. See README "About this fork".
#include "update/host_abi_deriver.h"
#define JSON_NOEXCEPTION 1
@@ -14,6 +15,7 @@
#include <array>
#include <cctype>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <filesystem>
#include <iterator>
@@ -1358,132 +1360,152 @@ std::optional<Json> DeriveRuntimeCompatibility(
*error = "reference FMOD string constructor contract changed";
return std::nullopt;
}
const auto string_constructor = FindUniqueSemanticSignatureMatch(
reference, candidate, disassembler,
{"fmod-string-constructor", old.string_constructor, 32, false, 3},
error);
const auto info_method = FindUniqueSemanticSignatureMatch(
reference, candidate, disassembler,
{"fmod-output-info", old.info_method, 18, false, 3}, error);
// A missing legacy selector is expected at the device-list ABI transition.
// The new layout is accepted only with its own complete selector contract.
std::string select_error;
const auto select_method = FindUniqueSemanticSignatureMatch(
reference, candidate, disassembler,
{"fmod-output-select", old.select_method, 18, false, 3}, &select_error);
if (!string_constructor.has_value() || !info_method.has_value()) {
return std::nullopt;
}
const auto count_matches = FindSignatureMatches(
reference, candidate, disassembler,
{"fmod-output-count", old.count_method, 24, false, 3}, true, error);
const auto current_matches = FindSignatureMatches(
reference, candidate, disassembler,
{"fmod-output-current", old.current_method, 24, false, 3}, true,
error);
if (!count_matches.has_value() || !current_matches.has_value()) {
return std::nullopt;
}
std::set<std::uint64_t> count_candidates;
std::set<std::uint64_t> current_candidates;
for (const SignatureMatch& match : *count_matches)
count_candidates.insert(match.rva);
for (const SignatureMatch& match : *current_matches)
current_candidates.insert(match.rva);
if (count_candidates.empty() || current_candidates.empty()) {
*error = "FMOD count/current method signatures have no candidates";
return std::nullopt;
}
const auto relocations = candidate.RelativeRelocations(error);
if (!relocations.has_value()) return std::nullopt;
std::vector<FmodRuntimeAnchors> candidates;
for (const auto& [offset, addend] : *relocations) {
if (addend != info_method->rva || offset < kInfoIndex * 8) continue;
const std::uint64_t vtable = offset - kInfoIndex * 8;
const auto count = relocations->find(vtable + kCountIndex * 8);
for (const int layout : {1, 2}) {
FmodRuntimeAnchors derived;
derived.layout_version = layout;
const auto current = relocations->find(vtable + derived.current_index() * 8);
const auto select = relocations->find(vtable + derived.select_index() * 8);
std::string relro_error;
if (vtable % 8 != 0 || count == relocations->end() ||
current == relocations->end() || select == relocations->end() ||
count_candidates.find(count->second) == count_candidates.end() ||
current_candidates.find(current->second) == current_candidates.end() ||
count->second == current->second ||
!candidate.RequireRelro(vtable, (derived.select_index() + 1) * 8,
&relro_error)) {
continue;
}
if (layout == 1) {
if (old.layout_version != 1 || !select_method.has_value() ||
select->second != select_method->rva) continue;
} else if (!HasFmodDeviceListsSelectContract(candidate, select->second)) {
continue;
}
candidates.push_back({vtable, string_constructor->rva, count->second,
info_method->rva, current->second, select->second,
layout});
// The FMOD output-device bridge is optional at runtime. A candidate whose
// FMOD output methods cannot be matched is derived without the bridge.
std::string fmod_error;
const auto bridge = [&]() -> std::optional<Json> {
const auto string_constructor = FindUniqueSemanticSignatureMatch(
reference, candidate, disassembler,
{"fmod-string-constructor", old.string_constructor, 32, false, 3},
&fmod_error);
const auto info_method = FindUniqueSemanticSignatureMatch(
reference, candidate, disassembler,
{"fmod-output-info", old.info_method, 18, false, 3}, &fmod_error);
// A missing legacy selector is expected at the device-list ABI
// transition. The new layout is accepted only with its own complete
// selector contract.
std::string select_error;
const auto select_method = FindUniqueSemanticSignatureMatch(
reference, candidate, disassembler,
{"fmod-output-select", old.select_method, 18, false, 3},
&select_error);
if (!string_constructor.has_value() || !info_method.has_value()) {
return std::nullopt;
}
}
if (candidates.size() != 1U) {
*error = "FMOD output vtable matched " +
std::to_string(candidates.size()) + " candidate locations";
return std::nullopt;
}
const FmodRuntimeAnchors& derived = candidates.front();
if (!HasFmodStringConstructorContract(candidate,
derived.string_constructor)) {
*error = "candidate FMOD string constructor contract changed";
return std::nullopt;
}
result["fmod_output_device_bridge"] = {
{"vtable_rva", FormatRva(derived.vtable)},
{"string_constructor_rva", FormatRva(derived.string_constructor)},
{"count_method_rva", FormatRva(derived.count_method)},
{"info_method_rva", FormatRva(derived.info_method)},
{"current_method_rva", FormatRva(derived.current_method)},
{"select_method_rva", FormatRva(derived.select_method)},
};
if (old.input_methods[0] != 0) {
constexpr std::array<std::string_view, 4> fields = {
"input_count_method_rva", "input_info_method_rva",
"input_current_method_rva", "input_select_method_rva"};
constexpr std::array<std::size_t, 4> lengths = {4, 16, 12, 16};
const auto old_slots = old.input_indexes();
const auto new_slots = derived.input_indexes();
for (std::size_t i = 0; i < fields.size(); ++i) {
const auto old_method =
reference_relocations->find(old.vtable + old_slots[i] * 8);
const auto new_method =
relocations->find(derived.vtable + new_slots[i] * 8);
if (old_method == reference_relocations->end() ||
old_method->second != old.input_methods[i] ||
new_method == relocations->end()) {
*error = "FMOD input vtable does not match its methods";
return std::nullopt;
}
const auto matches = FindSignatureMatches(
reference, candidate, disassembler,
{std::string(fields[i]), old.input_methods[i], lengths[i], false, 3},
true, error);
if (!matches || !std::any_of(matches->begin(), matches->end(),
[&](const auto &match) {
return match.rva == new_method->second;
})) {
if (error->empty())
*error = "candidate FMOD input contract changed";
return std::nullopt;
}
result["fmod_output_device_bridge"][fields[i]] =
FormatRva(new_method->second);
const auto count_matches = FindSignatureMatches(
reference, candidate, disassembler,
{"fmod-output-count", old.count_method, 24, false, 3}, true,
&fmod_error);
const auto current_matches = FindSignatureMatches(
reference, candidate, disassembler,
{"fmod-output-current", old.current_method, 24, false, 3}, true,
&fmod_error);
if (!count_matches.has_value() || !current_matches.has_value()) {
return std::nullopt;
}
std::set<std::uint64_t> count_candidates;
std::set<std::uint64_t> current_candidates;
for (const SignatureMatch& match : *count_matches)
count_candidates.insert(match.rva);
for (const SignatureMatch& match : *current_matches)
current_candidates.insert(match.rva);
if (count_candidates.empty() || current_candidates.empty()) {
fmod_error = "FMOD count/current method signatures have no candidates";
return std::nullopt;
}
const auto relocations = candidate.RelativeRelocations(&fmod_error);
if (!relocations.has_value()) return std::nullopt;
std::vector<FmodRuntimeAnchors> candidates;
for (const auto& [offset, addend] : *relocations) {
if (addend != info_method->rva || offset < kInfoIndex * 8) continue;
const std::uint64_t vtable = offset - kInfoIndex * 8;
const auto count = relocations->find(vtable + kCountIndex * 8);
for (const int layout : {1, 2}) {
FmodRuntimeAnchors derived;
derived.layout_version = layout;
const auto current =
relocations->find(vtable + derived.current_index() * 8);
const auto select =
relocations->find(vtable + derived.select_index() * 8);
std::string relro_error;
if (vtable % 8 != 0 || count == relocations->end() ||
current == relocations->end() || select == relocations->end() ||
count_candidates.find(count->second) == count_candidates.end() ||
current_candidates.find(current->second) ==
current_candidates.end() ||
count->second == current->second ||
!candidate.RequireRelro(vtable, (derived.select_index() + 1) * 8,
&relro_error)) {
continue;
}
if (layout == 1) {
if (old.layout_version != 1 || !select_method.has_value() ||
select->second != select_method->rva)
continue;
} else if (!HasFmodDeviceListsSelectContract(candidate,
select->second)) {
continue;
}
candidates.push_back({vtable, string_constructor->rva, count->second,
info_method->rva, current->second,
select->second, layout});
}
}
if (candidates.size() != 1U) {
fmod_error = "FMOD output vtable matched " +
std::to_string(candidates.size()) + " candidate locations";
return std::nullopt;
}
const FmodRuntimeAnchors& derived = candidates.front();
if (!HasFmodStringConstructorContract(candidate,
derived.string_constructor)) {
fmod_error = "candidate FMOD string constructor contract changed";
return std::nullopt;
}
Json bridge_json = {
{"vtable_rva", FormatRva(derived.vtable)},
{"string_constructor_rva", FormatRva(derived.string_constructor)},
{"count_method_rva", FormatRva(derived.count_method)},
{"info_method_rva", FormatRva(derived.info_method)},
{"current_method_rva", FormatRva(derived.current_method)},
{"select_method_rva", FormatRva(derived.select_method)},
};
if (old.input_methods[0] != 0) {
constexpr std::array<std::string_view, 4> fields = {
"input_count_method_rva", "input_info_method_rva",
"input_current_method_rva", "input_select_method_rva"};
constexpr std::array<std::size_t, 4> lengths = {4, 16, 12, 16};
const auto old_slots = old.input_indexes();
const auto new_slots = derived.input_indexes();
for (std::size_t i = 0; i < fields.size(); ++i) {
const auto old_method =
reference_relocations->find(old.vtable + old_slots[i] * 8);
const auto new_method =
relocations->find(derived.vtable + new_slots[i] * 8);
if (old_method == reference_relocations->end() ||
old_method->second != old.input_methods[i] ||
new_method == relocations->end()) {
fmod_error = "FMOD input vtable does not match its methods";
return std::nullopt;
}
const auto matches = FindSignatureMatches(
reference, candidate, disassembler,
{std::string(fields[i]), old.input_methods[i], lengths[i], false,
3},
true, &fmod_error);
if (!matches || !std::any_of(matches->begin(), matches->end(),
[&](const auto& match) {
return match.rva == new_method->second;
})) {
if (fmod_error.empty())
fmod_error = "candidate FMOD input contract changed";
return std::nullopt;
}
bridge_json[fields[i]] = FormatRva(new_method->second);
}
}
if (derived.layout_version != 1) {
bridge_json["vtable_layout_version"] = derived.layout_version;
}
return bridge_json;
}();
if (!bridge.has_value()) {
std::fprintf(stderr,
"[native-updater] FMOD output-device bridge omitted: %s\n",
fmod_error.c_str());
return result;
}
if (derived.layout_version != 1) {
result["fmod_output_device_bridge"]["vtable_layout_version"] =
derived.layout_version;
}
result["fmod_output_device_bridge"] = *bridge;
return result;
}
+7
View File
@@ -1,3 +1,4 @@
# Modified by vii from komaruworld/mocktail. See README "About this fork".
# Copyright 2026 Mocktail Project Authors
# Licensed under the Apache License, Version 2.0.
@@ -106,13 +107,19 @@ target_link_libraries(stub_glesv2 PRIVATE dl)
add_library(stub_vulkan SHARED
${CMAKE_SOURCE_DIR}/src/graphics/bionic_vulkan_loader_adapter.cc
${CMAKE_SOURCE_DIR}/src/graphics/vulkan_text_overlay_compositor.cc
${CMAKE_SOURCE_DIR}/src/graphics/vulkan_etc2_emulation.cc
${CMAKE_SOURCE_DIR}/src/graphics/etc2_decoder.cc
${CMAKE_SOURCE_DIR}/src/graphics/texture_override.cc
)
configure_stub(stub_vulkan "libvulkan.so")
target_include_directories(stub_vulkan PRIVATE ${CMAKE_SOURCE_DIR}/include)
pkg_check_modules(LIBPLACEBO REQUIRED IMPORTED_TARGET libplacebo)
pkg_check_modules(LIBPNG REQUIRED IMPORTED_TARGET libpng)
target_link_libraries(stub_vulkan PRIVATE
Mocktail::SdlVulkanWsi
PkgConfig::LIBPLACEBO
PkgConfig::LIBPNG
Threads::Threads
dl
)
+54 -1
View File
@@ -1,3 +1,4 @@
# Modified by vii from komaruworld/mocktail. See README "About this fork".
# Copyright 2026 Mocktail Project Authors
#
# Licensed under the Apache License, Version 2.0 (the "License")
@@ -119,6 +120,18 @@ target_link_libraries(texture_memory_policy_test PRIVATE
GTest::gtest_main
)
add_executable(device_memory_profile_test device_memory_profile_test.cc)
target_link_libraries(device_memory_profile_test PRIVATE
Mocktail::Runtime
GTest::gtest_main
)
add_executable(display_size_test display_size_test.cc)
target_link_libraries(display_size_test PRIVATE
Mocktail::Runtime
GTest::gtest_main
)
add_executable(http_client_policy_test http_client_policy_test.cc)
target_link_libraries(http_client_policy_test PRIVATE
Mocktail::Runtime
@@ -477,6 +490,42 @@ target_link_libraries(vulkan_text_overlay_compositor_test PRIVATE
)
mocktail_apply_compile_options(vulkan_text_overlay_compositor_test)
add_executable(etc2_decoder_test
etc2_decoder_test.cc
${PROJECT_SOURCE_DIR}/src/graphics/etc2_decoder.cc
)
target_include_directories(etc2_decoder_test PRIVATE
${PROJECT_SOURCE_DIR}/include
)
target_link_libraries(etc2_decoder_test PRIVATE GTest::gtest_main Threads::Threads)
mocktail_apply_compile_options(etc2_decoder_test)
pkg_check_modules(LIBPNG REQUIRED IMPORTED_TARGET libpng)
add_executable(texture_override_test
texture_override_test.cc
${PROJECT_SOURCE_DIR}/src/graphics/texture_override.cc
)
target_include_directories(texture_override_test PRIVATE
${PROJECT_SOURCE_DIR}/include
)
target_link_libraries(texture_override_test PRIVATE GTest::gtest_main
PkgConfig::LIBPNG)
mocktail_apply_compile_options(texture_override_test)
add_executable(vulkan_etc2_emulation_test
vulkan_etc2_emulation_test.cc
${PROJECT_SOURCE_DIR}/src/graphics/vulkan_etc2_emulation.cc
${PROJECT_SOURCE_DIR}/src/graphics/etc2_decoder.cc
${PROJECT_SOURCE_DIR}/src/graphics/texture_override.cc
)
target_include_directories(vulkan_etc2_emulation_test PRIVATE
${PROJECT_SOURCE_DIR}/include
)
target_link_libraries(vulkan_etc2_emulation_test PRIVATE GTest::gtest_main
Threads::Threads PkgConfig::LIBPNG)
mocktail_apply_compile_options(vulkan_etc2_emulation_test)
add_executable(video_driver_policy_test
video_driver_policy_test.cc
)
@@ -894,6 +943,8 @@ gtest_discover_tests(failure_dialog_test)
gtest_discover_tests(frame_rate_policy_test)
gtest_discover_tests(performance_policy_test)
gtest_discover_tests(texture_memory_policy_test)
gtest_discover_tests(device_memory_profile_test)
gtest_discover_tests(display_size_test)
gtest_discover_tests(http_client_policy_test)
gtest_discover_tests(http_client_spin_guard_test)
gtest_discover_tests(crash_report_policy_test)
@@ -937,6 +988,8 @@ gtest_discover_tests(input_pump_pacer_test)
gtest_discover_tests(vulkan_surface_recovery_gate_test)
gtest_discover_tests(vulkan_present_progress_gate_test)
gtest_discover_tests(vulkan_text_overlay_compositor_test)
gtest_discover_tests(etc2_decoder_test)
gtest_discover_tests(vulkan_etc2_emulation_test)
gtest_discover_tests(video_driver_policy_test)
gtest_discover_tests(window_surface_lifecycle_test)
gtest_discover_tests(window_creation_policy_test)
@@ -1012,7 +1065,7 @@ add_test(
NAME UrlHandlerRegistrationTest.ExplicitPerUserDefault
COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/url_handler_registration_test.sh
${CMAKE_SOURCE_DIR}/scripts/register_url_handler.sh
${CMAKE_SOURCE_DIR}/packaging/space.bigrat.mocktail.desktop
${CMAKE_SOURCE_DIR}/packaging/io.github.CoderDayton.nightcap.desktop
)
add_test(
+2 -1
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# Modified by vii from komaruworld/mocktail. See README "About this fork".
# Copyright 2026 Mocktail Project Authors
# SPDX-License-Identifier: Apache-2.0
@@ -86,7 +87,7 @@ fi
"$4" == /usr/lib/mocktail/mocktail_updater &&
"$5" == /usr/lib/mocktail && "$6" == /usr/share/mocktail &&
"$7" == /usr/bin/bash ]]
[[ "${DESKTOP}" == /usr/share/applications/space.bigrat.mocktail.desktop ]]
[[ "${DESKTOP}" == /usr/share/applications/io.github.CoderDayton.nightcap.desktop ]]
[[ "${MAIN_BIN}" == mocktail && "${STRACE_MODE}" == 1 ]]
[[ "${STRACE_BINARY}" == mocktail && "${STRACE_FLAGS}" == --help ]]
[[ -z "${NO_STRIP:-}" ]]
+7
View File
@@ -628,6 +628,13 @@ TEST(OpenSlQueueTest, GetStatePollsWhilePlaybackReleasesBuffers) {
probe.cv.wait_for(lock, 2s, [&probe] { return probe.calls == 1; }));
}
// A freshly spawned thread is not guaranteed to have been scheduled yet, so
// wait for the first concurrent poll before asking the poller to stop.
const auto poll_deadline = std::chrono::steady_clock::now() + 2s;
while (polls.load(std::memory_order_relaxed) == 0 &&
std::chrono::steady_clock::now() < poll_deadline) {
std::this_thread::yield();
}
stop_polling.store(true, std::memory_order_relaxed);
poller.join();
EXPECT_GT(polls.load(std::memory_order_relaxed), 0);
+61 -1
View File
@@ -41,18 +41,26 @@ class FakeHttpClient final : public HttpClient {
class BrowserTrackerServiceTest : public testing::Test {
protected:
void SetUp() override {
// The service refuses to hold credentials in a group- or world-writable
// directory, so the directories these tests create must be private
// whatever umask the developer or CI runner happens to use.
previous_umask_ = umask(077);
root_ = std::filesystem::temp_directory_path() /
("mocktail-browser-tracker-" + std::to_string(getpid()) + "-" +
::testing::UnitTest::GetInstance()->current_test_info()->name());
std::filesystem::remove_all(root_);
}
void TearDown() override { std::filesystem::remove_all(root_); }
void TearDown() override {
std::filesystem::remove_all(root_);
umask(previous_umask_);
}
std::filesystem::path Storage() const {
return root_ / "appData/LocalStorage/appStorage.json";
}
std::filesystem::path Cookies() const { return root_ / "roblox.cookie"; }
std::filesystem::path root_;
mode_t previous_umask_ = 0;
};
TEST_F(BrowserTrackerServiceTest, ReusesValidStoredIdentityWithoutNetwork) {
@@ -171,6 +179,58 @@ TEST_F(BrowserTrackerServiceTest,
EXPECT_FALSE(std::filesystem::exists(Storage()));
}
TEST_F(BrowserTrackerServiceTest, CreatesPrivateStorageDirectoryUnderAnyUmask) {
std::filesystem::create_directories(root_);
ASSERT_EQ(chmod(root_.c_str(), 0700), 0);
std::ofstream(Cookies()) << ".ROBLOSECURITY=secret";
FakeHttpClient http;
http.response = {true,
200,
R"({"browserTrackerId":987654321})",
"",
{"Set-Cookie: RBXEventTrackerV2="
"CreateDate=1&rbxid=2&browserid=987654321; Path=/"}};
// A permissive umask must not widen the directories the service creates for
// its own credentials; it refuses to use any that are group or world
// writable.
const mode_t previous_umask = umask(0);
const BrowserTrackerResult result =
BrowserTrackerService(http).EnsureInitialized(Storage(), Cookies(), true);
umask(previous_umask);
ASSERT_TRUE(result) << result.error;
struct stat storage_parent = {};
ASSERT_EQ(stat(Storage().parent_path().c_str(), &storage_parent), 0);
EXPECT_EQ(storage_parent.st_mode & 0777, 0700U);
}
TEST_F(BrowserTrackerServiceTest,
CreatesUsableStorageDirectoryUnderRestrictiveUmask) {
std::filesystem::create_directories(root_);
ASSERT_EQ(chmod(root_.c_str(), 0700), 0);
std::ofstream(Cookies()) << ".ROBLOSECURITY=secret";
FakeHttpClient http;
http.response = {true,
200,
R"({"browserTrackerId":987654321})",
"",
{"Set-Cookie: RBXEventTrackerV2="
"CreateDate=1&rbxid=2&browserid=987654321; Path=/"}};
// mkdir applies the umask to its mode argument, so a umask that strips owner
// bits would otherwise leave the service's own directory unwritable.
const mode_t previous_umask = umask(0200);
const BrowserTrackerResult result =
BrowserTrackerService(http).EnsureInitialized(Storage(), Cookies(), true);
umask(previous_umask);
ASSERT_TRUE(result) << result.error;
struct stat storage_parent = {};
ASSERT_EQ(stat(Storage().parent_path().c_str(), &storage_parent), 0);
EXPECT_EQ(storage_parent.st_mode & 0777, 0700U);
}
TEST_F(BrowserTrackerServiceTest, RejectsCorruptStoredIdentityFailClosed) {
std::filesystem::create_directories(Storage().parent_path());
std::ofstream(Storage()) << R"({"BrowserTrackerId":"0"})";
+56
View File
@@ -0,0 +1,56 @@
#include "runtime/device_memory_profile.h"
#include <gtest/gtest.h>
#include <cstdint>
#include <limits>
namespace mocktail {
namespace runtime {
namespace {
constexpr std::uint64_t kMebibyte = 1024U * 1024U;
void ExpectLowRamProfile(const DeviceMemoryProfile& profile) {
EXPECT_TRUE(profile.low_ram_device);
EXPECT_EQ(profile.total_memory_mb, 2048);
EXPECT_EQ(profile.memory_class_mb, 256);
EXPECT_EQ(profile.large_memory_class_mb, 512);
EXPECT_EQ(profile.low_memory_killer_background_threshold, 256);
EXPECT_EQ(profile.low_memory_killer_foreground_threshold, 512);
}
TEST(DeviceMemoryProfileTest, KeepsTheLowRamProfileOnSmallOrUnknownHosts) {
ExpectLowRamProfile(BuildDeviceMemoryProfile(0));
ExpectLowRamProfile(BuildDeviceMemoryProfile(2048U * kMebibyte));
ExpectLowRamProfile(BuildDeviceMemoryProfile(4095U * kMebibyte));
}
TEST(DeviceMemoryProfileTest, ReportsRealHostMemoryAsANormalRamDevice) {
const DeviceMemoryProfile profile =
BuildDeviceMemoryProfile(62951U * kMebibyte);
EXPECT_FALSE(profile.low_ram_device);
EXPECT_EQ(profile.total_memory_mb, 62951);
EXPECT_EQ(profile.memory_class_mb, 512);
EXPECT_EQ(profile.large_memory_class_mb, 1024);
EXPECT_EQ(profile.low_memory_killer_background_threshold, 0);
EXPECT_EQ(profile.low_memory_killer_foreground_threshold, 0);
}
TEST(DeviceMemoryProfileTest, StartsTheNormalRamProfileAtFourGibibytes) {
const DeviceMemoryProfile profile =
BuildDeviceMemoryProfile(4096U * kMebibyte);
EXPECT_FALSE(profile.low_ram_device);
EXPECT_EQ(profile.total_memory_mb, 4096);
}
TEST(DeviceMemoryProfileTest, ClampsTotalMemoryToTheJavaIntRange) {
const DeviceMemoryProfile profile =
BuildDeviceMemoryProfile(std::numeric_limits<std::uint64_t>::max());
EXPECT_FALSE(profile.low_ram_device);
EXPECT_EQ(profile.total_memory_mb, std::numeric_limits<std::int32_t>::max());
}
} // namespace
} // namespace runtime
} // namespace mocktail
+44
View File
@@ -0,0 +1,44 @@
#include "runtime/display_size.h"
#include <gtest/gtest.h>
namespace mocktail {
namespace runtime {
namespace {
void ExpectSize(const DisplaySize& size, int width, int height) {
EXPECT_EQ(size.width, width);
EXPECT_EQ(size.height, height);
}
TEST(DisplaySizeTest, ParsesHostDisplayPixels) {
ExpectSize(ParseDisplaySize("3440x1440"), 3440, 1440);
ExpectSize(ParseDisplaySize("1280x720"), 1280, 720);
}
TEST(DisplaySizeTest, FallsBackForMissingOrMalformedValues) {
ExpectSize(ParseDisplaySize(nullptr), 1920, 1080);
ExpectSize(ParseDisplaySize(""), 1920, 1080);
ExpectSize(ParseDisplaySize("3440"), 1920, 1080);
ExpectSize(ParseDisplaySize("3440x"), 1920, 1080);
ExpectSize(ParseDisplaySize("x1440"), 1920, 1080);
ExpectSize(ParseDisplaySize("3440x1440junk"), 1920, 1080);
ExpectSize(ParseDisplaySize("-3440x1440"), 1920, 1080);
ExpectSize(ParseDisplaySize("0x1440"), 1920, 1080);
}
TEST(DisplaySizeTest, FallsBackWhenAValueDoesNotFitAJavaInt) {
ExpectSize(ParseDisplaySize("2147483648x1440"), 1920, 1080);
ExpectSize(ParseDisplaySize("99999999999999999999x1440"), 1920, 1080);
}
TEST(DisplaySizeTest, ConvertsPixelsToMillimetersAt160Dpi) {
EXPECT_EQ(PixelsToMillimetersAt160Dpi(1280), 203);
EXPECT_EQ(PixelsToMillimetersAt160Dpi(720), 114);
EXPECT_EQ(PixelsToMillimetersAt160Dpi(3440), 546);
EXPECT_EQ(PixelsToMillimetersAt160Dpi(0), 0);
}
} // namespace
} // namespace runtime
} // namespace mocktail
+271
View File
@@ -0,0 +1,271 @@
#include "mocktail/graphics/etc2_decoder.h"
#include <gtest/gtest.h>
#include <array>
#include <cstdint>
#include <iterator>
#include <random>
#include <vector>
namespace mocktail::graphics {
namespace {
using Block8 = std::array<std::uint8_t, 8>;
struct Rgba {
int r;
int g;
int b;
int a;
};
std::vector<std::uint8_t> Decode(EtcFormat format,
const std::vector<std::uint8_t>& source,
std::uint32_t width, std::uint32_t height) {
std::vector<std::uint8_t> output(
static_cast<std::size_t>(width) * height * EtcDecodedTexelBytes(format),
0xAB);
EXPECT_TRUE(DecodeEtcImage(format, source.data(), source.size(), width,
height, output.data(), output.size()));
return output;
}
std::vector<std::uint8_t> Bytes(const Block8& block) {
return {block.begin(), block.end()};
}
void ExpectRgba(const std::vector<std::uint8_t>& texels, std::uint32_t width,
std::uint32_t x, std::uint32_t y, Rgba expected) {
const std::size_t offset = (static_cast<std::size_t>(y) * width + x) * 4;
ASSERT_LT(offset + 3, texels.size());
EXPECT_EQ(texels[offset], expected.r) << "x=" << x << " y=" << y;
EXPECT_EQ(texels[offset + 1], expected.g) << "x=" << x << " y=" << y;
EXPECT_EQ(texels[offset + 2], expected.b) << "x=" << x << " y=" << y;
EXPECT_EQ(texels[offset + 3], expected.a) << "x=" << x << " y=" << y;
}
std::uint16_t Unsigned16(const std::vector<std::uint8_t>& texels,
std::size_t index) {
return static_cast<std::uint16_t>(texels[index * 2] |
(texels[index * 2 + 1] << 8));
}
std::int16_t Signed16(const std::vector<std::uint8_t>& texels,
std::size_t index) {
return static_cast<std::int16_t>(Unsigned16(texels, index));
}
TEST(Etc2DecoderTest, ReportsBlockAndTexelSizes) {
EXPECT_EQ(EtcBlockBytes(EtcFormat::kEtc2Rgb8), 8U);
EXPECT_EQ(EtcBlockBytes(EtcFormat::kEtc2Rgb8A1), 8U);
EXPECT_EQ(EtcBlockBytes(EtcFormat::kEtc2Rgba8), 16U);
EXPECT_EQ(EtcBlockBytes(EtcFormat::kEacR11), 8U);
EXPECT_EQ(EtcBlockBytes(EtcFormat::kEacR11Signed), 8U);
EXPECT_EQ(EtcBlockBytes(EtcFormat::kEacRg11), 16U);
EXPECT_EQ(EtcBlockBytes(EtcFormat::kEacRg11Signed), 16U);
EXPECT_EQ(EtcDecodedTexelBytes(EtcFormat::kEtc2Rgb8), 4U);
EXPECT_EQ(EtcDecodedTexelBytes(EtcFormat::kEtc2Rgb8A1), 4U);
EXPECT_EQ(EtcDecodedTexelBytes(EtcFormat::kEtc2Rgba8), 4U);
EXPECT_EQ(EtcDecodedTexelBytes(EtcFormat::kEacR11), 2U);
EXPECT_EQ(EtcDecodedTexelBytes(EtcFormat::kEacRg11Signed), 4U);
}
TEST(Etc2DecoderTest, DecodesIndividualMode) {
// Base colours 8 (left sub-block) and 0 (right), codeword 0 (2/8).
// Pixel (0,0) index 1 (+8), pixels in column 1 index 2 (-2).
const Block8 block = {0x80, 0x80, 0x80, 0x00, 0x00, 0xF0, 0x00, 0x01};
const auto texels = Decode(EtcFormat::kEtc2Rgb8, Bytes(block), 4, 4);
ExpectRgba(texels, 4, 0, 0, {144, 144, 144, 255});
ExpectRgba(texels, 4, 0, 1, {138, 138, 138, 255});
ExpectRgba(texels, 4, 1, 0, {134, 134, 134, 255});
ExpectRgba(texels, 4, 2, 0, {2, 2, 2, 255});
}
TEST(Etc2DecoderTest, DecodesDifferentialMode) {
// R/G/B = 16 with delta +1: base colours 132 and 140, modifier +2.
const Block8 block = {0x81, 0x81, 0x81, 0x02, 0x00, 0x00, 0x00, 0x00};
const auto texels = Decode(EtcFormat::kEtc2Rgb8, Bytes(block), 4, 4);
ExpectRgba(texels, 4, 0, 0, {134, 134, 134, 255});
ExpectRgba(texels, 4, 2, 3, {142, 142, 142, 255});
}
TEST(Etc2DecoderTest, DecodesTMode) {
// Red overflows: colour 1 (0,255,0), colour 2 (0,255,136), distance 11.
const Block8 block = {0x04, 0xF0, 0x0F, 0x86, 0x00, 0x12, 0x00, 0x03};
const auto texels = Decode(EtcFormat::kEtc2Rgb8, Bytes(block), 4, 4);
ExpectRgba(texels, 4, 0, 0, {11, 255, 147, 255});
ExpectRgba(texels, 4, 0, 1, {0, 244, 125, 255});
ExpectRgba(texels, 4, 1, 0, {0, 255, 136, 255});
ExpectRgba(texels, 4, 1, 1, {0, 255, 0, 255});
}
TEST(Etc2DecoderTest, DecodesHMode) {
// Green overflows: colour 1 (0,0,0), colour 2 (255,17,255), distance 3.
const Block8 block = {0x00, 0x04, 0x78, 0xFA, 0x80, 0x01, 0x80, 0x00};
const auto texels = Decode(EtcFormat::kEtc2Rgb8, Bytes(block), 4, 4);
ExpectRgba(texels, 4, 0, 0, {255, 20, 255, 255});
ExpectRgba(texels, 4, 3, 3, {252, 14, 252, 255});
ExpectRgba(texels, 4, 1, 0, {3, 3, 3, 255});
}
TEST(Etc2DecoderTest, DecodesPlanarMode) {
// Blue overflows: O=(130,64,0), H=(0,255,0), V=(255,0,255).
const Block8 block = {0x40, 0x40, 0x04, 0x02, 0xFE, 0x07, 0xE0, 0x3F};
const auto texels = Decode(EtcFormat::kEtc2Rgb8, Bytes(block), 4, 4);
ExpectRgba(texels, 4, 0, 0, {130, 64, 0, 255});
ExpectRgba(texels, 4, 3, 0, {33, 207, 0, 255});
ExpectRgba(texels, 4, 0, 3, {224, 16, 191, 255});
ExpectRgba(texels, 4, 3, 3, {126, 159, 191, 255});
}
TEST(Etc2DecoderTest, DecodesPunchthroughAlpha) {
// Opaque bit clear: index 2 is transparent black, index 0 has no modifier.
const Block8 block = {0x81, 0x81, 0x81, 0x00, 0x00, 0x01, 0x00, 0x02};
const auto texels = Decode(EtcFormat::kEtc2Rgb8A1, Bytes(block), 4, 4);
ExpectRgba(texels, 4, 0, 0, {0, 0, 0, 0});
ExpectRgba(texels, 4, 0, 1, {140, 140, 140, 255});
ExpectRgba(texels, 4, 1, 0, {132, 132, 132, 255});
ExpectRgba(texels, 4, 2, 0, {140, 140, 140, 255});
}
TEST(Etc2DecoderTest, DecodesRgba8WithAlphaBlockFirst) {
// Alpha: base 100, multiplier 2, table 0; pixel (0,0) index 7 (+14).
const std::vector<std::uint8_t> block = {
100, 0x20, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const auto texels = Decode(EtcFormat::kEtc2Rgba8, block, 4, 4);
ExpectRgba(texels, 4, 0, 0, {138, 138, 138, 128});
ExpectRgba(texels, 4, 1, 0, {138, 138, 138, 94});
}
TEST(Etc2DecoderTest, DecodesUnsignedR11) {
const Block8 block = {128, 0x10, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00};
const auto texels = Decode(EtcFormat::kEacR11, Bytes(block), 4, 4);
EXPECT_EQ(Unsigned16(texels, 0), 36497);
EXPECT_EQ(Unsigned16(texels, 1), 32143);
const Block8 zero_multiplier = {0, 0x00, 0, 0, 0, 0, 0, 0};
const auto flat = Decode(EtcFormat::kEacR11, Bytes(zero_multiplier), 1, 1);
EXPECT_EQ(Unsigned16(flat, 0), 32);
}
TEST(Etc2DecoderTest, DecodesSignedR11) {
const Block8 block = {0x80, 0x10, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00};
const auto texels = Decode(EtcFormat::kEacR11Signed, Bytes(block), 4, 4);
EXPECT_EQ(Signed16(texels, 0), -28956);
EXPECT_EQ(Signed16(texels, 1), -32767);
}
TEST(Etc2DecoderTest, DecodesRg11AsTwoChannels) {
const std::vector<std::uint8_t> block = {
128, 0x10, 0xE0, 0, 0, 0, 0, 0,
0, 0x00, 0x00, 0, 0, 0, 0, 0,
};
const auto texels = Decode(EtcFormat::kEacRg11, block, 1, 1);
EXPECT_EQ(Unsigned16(texels, 0), 36497);
EXPECT_EQ(Unsigned16(texels, 1), 32);
}
TEST(Etc2DecoderTest, DecodesPartialAndMultipleBlocks) {
const Block8 t_mode = {0x04, 0xF0, 0x0F, 0x86, 0x00, 0x12, 0x00, 0x03};
const Block8 differential = {0x81, 0x81, 0x81, 0x02, 0, 0, 0, 0};
std::vector<std::uint8_t> source = Bytes(t_mode);
source.insert(source.end(), differential.begin(), differential.end());
const auto texels = Decode(EtcFormat::kEtc2Rgb8, source, 5, 1);
ExpectRgba(texels, 5, 0, 0, {11, 255, 147, 255});
ExpectRgba(texels, 5, 1, 0, {0, 255, 136, 255});
ExpectRgba(texels, 5, 4, 0, {134, 134, 134, 255});
}
std::vector<std::uint8_t> RandomBlocks(EtcFormat format, std::uint32_t width,
std::uint32_t height,
std::uint32_t seed) {
std::mt19937 rng(seed);
std::vector<std::uint8_t> source(((width + 3) / 4) * ((height + 3) / 4) *
EtcBlockBytes(format));
for (std::uint8_t& byte : source) {
byte = static_cast<std::uint8_t>(rng());
}
return source;
}
TEST(Etc2DecoderTest, DecodesBlockRowBandsLikeWholeImage) {
const std::uint32_t width = 13;
const std::uint32_t height = 10;
const auto source = RandomBlocks(EtcFormat::kEtc2Rgba8, width, height, 1);
const auto whole = Decode(EtcFormat::kEtc2Rgba8, source, width, height);
std::vector<std::uint8_t> banded(whole.size(), 0xAB);
ASSERT_TRUE(DecodeEtcImageBlockRows(EtcFormat::kEtc2Rgba8, source.data(),
source.size(), width, height, 1, 2,
banded.data(), banded.size()));
ASSERT_TRUE(DecodeEtcImageBlockRows(EtcFormat::kEtc2Rgba8, source.data(),
source.size(), width, height, 0, 1,
banded.data(), banded.size()));
EXPECT_EQ(banded, whole);
EXPECT_FALSE(DecodeEtcImageBlockRows(EtcFormat::kEtc2Rgba8, source.data(),
source.size(), width, height, 2, 2,
banded.data(), banded.size()));
}
TEST(Etc2DecoderTest, DecodesJobsOnWorkersLikeSerialDecode) {
struct Case {
EtcFormat format;
std::uint32_t width;
std::uint32_t height;
};
const Case cases[] = {{EtcFormat::kEtc2Rgb8, 1030, 770},
{EtcFormat::kEtc2Rgba8, 517, 1024},
{EtcFormat::kEacRg11, 300, 301},
{EtcFormat::kEtc2Rgb8A1, 3, 5}};
std::vector<std::vector<std::uint8_t>> sources;
std::vector<std::vector<std::uint8_t>> expected;
std::vector<std::vector<std::uint8_t>> outputs;
std::vector<EtcDecodeJob> jobs;
for (std::size_t index = 0; index < std::size(cases); ++index) {
const Case& c = cases[index];
sources.push_back(RandomBlocks(c.format, c.width, c.height,
static_cast<std::uint32_t>(index + 2)));
expected.push_back(Decode(c.format, sources.back(), c.width, c.height));
outputs.emplace_back(expected.back().size(), 0xAB);
}
for (std::size_t index = 0; index < std::size(cases); ++index) {
const Case& c = cases[index];
jobs.push_back({c.format, sources[index].data(), sources[index].size(),
c.width, c.height, outputs[index].data(),
outputs[index].size()});
}
std::vector<std::uint8_t> short_output(4 * 4 * 4 - 1, 0xAB);
jobs.push_back({EtcFormat::kEtc2Rgb8, sources[0].data(), sources[0].size(),
4, 4, short_output.data(), short_output.size()});
DecodeEtcJobs(jobs.data(), jobs.size(), 4);
for (std::size_t index = 0; index < std::size(cases); ++index) {
EXPECT_TRUE(jobs[index].ok) << index;
EXPECT_EQ(outputs[index], expected[index]) << index;
}
EXPECT_FALSE(jobs.back().ok);
EXPECT_EQ(short_output, std::vector<std::uint8_t>(4 * 4 * 4 - 1, 0xAB));
}
TEST(Etc2DecoderTest, RejectsShortBuffers) {
const std::vector<std::uint8_t> source(8, 0);
std::vector<std::uint8_t> output(4 * 4 * 4, 0);
EXPECT_FALSE(DecodeEtcImage(EtcFormat::kEtc2Rgb8, source.data(), 7, 4, 4,
output.data(), output.size()));
EXPECT_FALSE(DecodeEtcImage(EtcFormat::kEtc2Rgb8, source.data(),
source.size(), 4, 4, output.data(),
output.size() - 1));
EXPECT_FALSE(DecodeEtcImage(EtcFormat::kEtc2Rgb8, source.data(),
source.size(), 5, 4, output.data(),
output.size()));
EXPECT_FALSE(DecodeEtcImage(EtcFormat::kEtc2Rgb8, nullptr, 0, 0, 0,
output.data(), output.size()));
}
} // namespace
} // namespace mocktail::graphics
+21 -38
View File
@@ -1,11 +1,12 @@
#!/usr/bin/env bash
# Modified by vii from komaruworld/mocktail. See README "About this fork".
# Copyright 2026 Mocktail Project Authors
# SPDX-License-Identifier: Apache-2.0
set -Eeuo pipefail
readonly ROOT="${1:?source root is required}"
readonly MANIFEST="${ROOT}/packaging/flatpak/space.bigrat.mocktail.json"
readonly MANIFEST="${ROOT}/packaging/flatpak/io.github.CoderDayton.nightcap.json"
readonly BUILD_HELPER="${ROOT}/scripts/build_flatpak.sh"
readonly PAGES_HELPER="${ROOT}/scripts/assemble_flatpak_pages.sh"
readonly GITHUB_CI="${ROOT}/.github/workflows/flatpak.yml"
@@ -25,7 +26,7 @@ import sys
with open(sys.argv[1], encoding="utf-8") as source:
manifest = json.load(source)
assert manifest["app-id"] == "space.bigrat.mocktail"
assert manifest["app-id"] == "io.github.CoderDayton.nightcap"
assert manifest["runtime"] == "org.gnome.Platform"
assert manifest["runtime-version"] == "50"
assert manifest["sdk"] == "org.gnome.Sdk"
@@ -129,24 +130,14 @@ grep -Fq 'CleanupStaleBuilderMounts' "${BUILD_HELPER}" ||
Fail 'obsolete GitLab CI configuration is still present'
grep -Fq 'name: Flatpak' "${GITHUB_CI}" ||
Fail 'GitHub Actions workflow has no stable display name'
validates_main=false
if grep -Fq 'branches: [main]' "${GITHUB_CI}"; then
validates_main=true
elif grep -Fq 'workflow_run:' "${GITHUB_CI}" &&
grep -Fq 'workflows: [Native packages]' "${GITHUB_CI}" &&
grep -Fq "head_branch == 'main'" "${GITHUB_CI}"; then
validates_main=true
fi
[[ "${validates_main}" == true ]] ||
Fail 'GitHub Actions does not validate the main branch'
grep -Fq "tags: ['v*']" "${GITHUB_CI}" ||
Fail 'GitHub Actions does not publish on release tags'
grep -Fq 'pull_request:' "${GITHUB_CI}" ||
Fail 'GitHub Actions does not validate pull requests'
grep -Fq 'workflow_dispatch:' "${GITHUB_CI}" ||
Fail 'GitHub Actions cannot be started manually'
grep -Fq "'assets/screenshots/**'" "${GITHUB_CI}" ||
Fail 'Flatpak workflow does not react to screenshot changes'
grep -Fq "'packaging/discord-join.html'" "${GITHUB_CI}" ||
Fail 'Flatpak workflow does not publish Discord join-page changes'
grep -Fq 'contents: read' "${GITHUB_CI}" ||
Fail 'GitHub Actions permissions are not read-only'
grep -Fq 'submodules: recursive' "${GITHUB_CI}" ||
@@ -159,7 +150,7 @@ grep -Fq -- '--install-deps-from=flathub' "${GITHUB_CI}" ||
Fail 'GitHub Actions does not install manifest dependencies from Flathub'
grep -Fq -- '--default-branch=stable' "${GITHUB_CI}" ||
Fail 'GitHub Actions does not produce the stable Flatpak branch'
grep -Fq 'Mocktail-x86_64.flatpak' "${GITHUB_CI}" ||
grep -Fq 'Nightcap-x86_64.flatpak' "${GITHUB_CI}" ||
Fail 'GitHub Actions does not build the installable Flatpak bundle'
grep -Fq 'actions/upload-artifact@' "${GITHUB_CI}" ||
Fail 'GitHub Actions does not publish the Flatpak artifact'
@@ -183,7 +174,7 @@ dry_run="$(
)"
grep -Fq './scripts/build_flatpak.sh' <<<"${dry_run}" ||
Fail 'make flatpak does not invoke the guarded Flatpak builder'
grep -Fq -- '--manifest packaging/flatpak/space.bigrat.mocktail.json' \
grep -Fq -- '--manifest packaging/flatpak/io.github.CoderDayton.nightcap.json' \
<<<"${dry_run}" || Fail 'make flatpak lost the canonical manifest'
grep -Fq -- '--jobs 4' <<<"${dry_run}" ||
Fail 'make flatpak does not cap local build parallelism'
@@ -210,33 +201,25 @@ grep -Fq 'flatpak-builder is unavailable' "${TEMP_DIR}/stderr" ||
Fail 'helper did not explain how to install flatpak-builder'
mkdir -p -- "${TEMP_DIR}/repo/objects"
mkdir -p -- \
"${TEMP_DIR}/native-repositories/apt" \
"${TEMP_DIR}/native-repositories/rpm" \
"${TEMP_DIR}/native-repositories/downloads"
printf 'bundle\n' >"${TEMP_DIR}/Mocktail-x86_64.flatpak"
printf 'public-key\n' >"${TEMP_DIR}/mocktail-flatpak.gpg"
printf 'public-key\n' \
>"${TEMP_DIR}/native-repositories/mocktail-packages.gpg"
printf 'bundle\n' >"${TEMP_DIR}/Nightcap-x86_64.flatpak"
printf 'public-key\n' >"${TEMP_DIR}/nightcap-flatpak.gpg"
"${PAGES_HELPER}" \
"${TEMP_DIR}/repo" \
"${TEMP_DIR}/Mocktail-x86_64.flatpak" \
"${TEMP_DIR}/mocktail-flatpak.gpg" \
"${TEMP_DIR}/public" \
"${TEMP_DIR}/native-repositories"
grep -Fq 'Url=https://mocktail.bigrat.space/repo/' \
"${TEMP_DIR}/public/mocktail.flatpakrepo" ||
"${TEMP_DIR}/Nightcap-x86_64.flatpak" \
"${TEMP_DIR}/nightcap-flatpak.gpg" \
"${TEMP_DIR}/public"
grep -Fq 'Url=https://coderdayton.github.io/nightcap/repo/' \
"${TEMP_DIR}/public/nightcap.flatpakrepo" ||
Fail 'published Flatpak repository URL is incorrect'
grep -Fq 'Name=space.bigrat.mocktail' \
"${TEMP_DIR}/public/mocktail.flatpakref" ||
grep -Fq 'Name=io.github.CoderDayton.nightcap' \
"${TEMP_DIR}/public/nightcap.flatpakref" ||
Fail 'published Flatpak ref has the wrong application ID'
grep -Fq 'GPGKey=' "${TEMP_DIR}/public/nightcap.flatpakref" ||
Fail 'published Flatpak ref is not pinned to the signing key'
grep -Fq 'flatpak install --user' "${TEMP_DIR}/public/index.html" ||
Fail 'Pages landing page has no direct installation command'
grep -Fq 'roblox://experiences/start' "${TEMP_DIR}/public/join.html" ||
Fail 'Pages output has no Discord join bridge'
[[ -d "${TEMP_DIR}/public/apt" &&
-d "${TEMP_DIR}/public/rpm" &&
-d "${TEMP_DIR}/public/downloads" ]] ||
Fail 'Pages output has no native package repositories'
[[ -f "${TEMP_DIR}/public/Nightcap-x86_64.flatpak" &&
-f "${TEMP_DIR}/public/.nojekyll" ]] ||
Fail 'Pages output is missing the bundle or the .nojekyll marker'
printf 'Flatpak packaging contract test passed\n'
+26
View File
@@ -1,3 +1,4 @@
// Modified by vii from komaruworld/mocktail. See README "About this fork".
#include "jnivm/jnivm.h"
#include <gtest/gtest.h>
@@ -2675,5 +2676,30 @@ TEST_F(JniVmTest, MainGameActivityReturnsNativeHelperAndTracksCallbacks) {
EXPECT_EQ(env->GetBooleanField(helper, is_engine_initialized), JNI_TRUE);
}
TEST_F(JniVmTest, NativeQuoteInterfaceReportsKeystoreUnavailable) {
JNIEnv* env = vm_->GetJNIEnv();
jclass cls = env->FindClass("com/roblox/engine/jni/NativeQuoteInterface");
ASSERT_NE(cls, nullptr);
jmethodID method =
env->GetStaticMethodID(cls, "requestResponse", "([B)[B");
ASSERT_NE(method, nullptr);
jbyteArray challenge = env->NewByteArray(32);
ASSERT_NE(challenge, nullptr);
auto result = static_cast<jbyteArray>(
env->CallStaticObjectMethod(cls, method, challenge));
ASSERT_NE(result, nullptr);
const jsize length = env->GetArrayLength(result);
ASSERT_GT(length, 2);
std::vector<jbyte> bytes(static_cast<std::size_t>(length));
env->GetByteArrayRegion(result, 0, length, bytes.data());
EXPECT_EQ(bytes[0], 1);
EXPECT_EQ(bytes[1], 0);
const std::string message(reinterpret_cast<const char*>(bytes.data() + 2),
static_cast<std::size_t>(length - 2));
EXPECT_NE(message.find("AndroidKeyStore"), std::string::npos);
}
} // namespace
} // namespace jnivm
+20 -26
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# Modified by vii from komaruworld/mocktail. See README "About this fork".
# Copyright 2026 Mocktail Project Authors
# SPDX-License-Identifier: Apache-2.0
@@ -77,10 +78,6 @@ grep -Fq -- \
Fail 'AUR package embeds a build-tree compatibility manifest path'
grep -Fq 'pkgbase = mocktail-git' "${AUR_SRCINFO}" ||
Fail 'AUR package has no generated .SRCINFO metadata'
grep -Fq 'paru -S mocktail-git' "${README}" ||
Fail 'README has no AUR installation instructions'
grep -Fq 'yay -S mocktail-git' "${README}" ||
Fail 'README has no alternative AUR helper command'
grep -Fq 'LINKER:--no-as-needed' "${STUB_CMAKE}" ||
Fail 'system shims can lose their host libc dependencies'
grep -Fq 'MOCKTAIL_MINIZIP_HAS_STREAM_TELL' "${STUB_CMAKE}" ||
@@ -89,39 +86,36 @@ grep -Fq 'mz_stream_tell(unzGetStream(archive))' "${ANDROID_STUB}" ||
Fail 'Android assets do not support the minizip-ng offset API'
for expected in \
'ubuntu:26.04' \
'fedora:44' \
'archlinux:base-devel' \
'minizip-ng-compat-devel' \
'-G DEB' \
'-G RPM' \
'makepkg --dir' \
'cron:' \
'APPIMAGE_FORMAT=anylinux' \
'quick-sharun' \
'./scripts/install_anylinux_dependencies.sh' \
'--env GH_TOKEN' \
'MOCKTAIL_ANYLINUX_SYSTEM_INSTALL=1' \
'--appimage-extract-and-run mocktail_updater status' \
'Mocktail-x86_64.AppImage' \
'Nightcap-nightly-x86_64.AppImage' \
'github-actions[bot]' \
'gh release upload continuous'; do
grep -Fq -- "${expected}" "${WORKFLOW}" ||
Fail "native package workflow is missing: ${expected}"
Fail "nightly AppImage workflow is missing: ${expected}"
done
grep -Fq 'paths-ignore:' "${WORKFLOW}" ||
Fail 'native package workflow has no path filters'
grep -Fq "'assets/screenshots/**'" "${WORKFLOW}" ||
Fail 'native packages rebuild for screenshot-only changes'
if grep -Fq "'packaging/flatpak/**'" "${WORKFLOW}"; then
Fail 'native packages ignore Flatpak changes required by Pages publication'
fi
if grep -Fq "'site/**'" "${WORKFLOW}"; then
Fail 'native packages ignore website changes required by Pages publication'
fi
# The nightly runs on a schedule and on demand. Per-commit triggers would
# rebuild a full AppImage for every push and pull request. The DEB, RPM and
# pacman packages are built by the Makefile but are not published from here;
# upstream ships those for unmodified Mocktail.
for unexpected in \
'push:' \
'pull_request:' \
'-G DEB' \
'-G RPM' \
'makepkg --dir'; do
if grep -Fq -- "${unexpected}" "${WORKFLOW}"; then
Fail "nightly AppImage workflow should not contain: ${unexpected}"
fi
done
grep -Fq 'sudo dnf install mocktail-nightly' "${README}" ||
Fail 'README has no nightly DNF installation command'
grep -Fq 'sudo apt install mocktail-nightly' "${README}" ||
Fail 'README has no nightly APT installation command'
grep -Fq 'Ubuntu 26.04+' "${README}" ||
Fail 'README has no Ubuntu source dependency guide'
grep -Fq 'Arch Linux' "${README}" ||
Loaded 100 of 113 files, more files were not shown because too many files have changed in this diff. Show more