Skip to content

BytArch GTA-V for Android 0.1.10-patch (Maximum graphics memory fix)

Choose a tag to compare

@bytarch bytarch released this 20 Oct 22:04
· 6 commits to main since this release

BytArch GTA-V - the GTA V web port running natively on Android, ARM64 / Android 10+ / Vulkan.

BytArch-GTA-V-android-0.1.10-patch-debug.apk - debug build, sideload it over 0.1.9-patch.

This patch follows 0.1.9-patch and targets the crash the 0.1.9-patch test found at
the Maximum graphics setting.

What the 0.1.9-patch test showed

The tester on a RedMagic 11 Pro confirmed the black screen is gone ("everything
ok, game run normally without any checkboxes"), then reported a second problem:
with graphics set to Maximum the game crashes after a few minutes. The same
session at Low stays alive.

His 0.1.9 log shows the memory picture behind the crash:

low :  process RSS about 2.7 GB
max :  process RSS peaks at 4.15 GB, then the log ends
       a 256 MB region is allocated right before the end of the log
       engine malloc arena 2417 MB (in use 2382 MB)
       37982 live buffers, about 10000 textures
       bind groups cached: up to 28565

There is no kill reason in the log, so it is not yet known whether Android killed
the process for low memory or the engine died on its own. Two things were wrong
in any case, and both are fixed here.

What this patch changes

  • Host buffer memory is bounded. The renderer kept a CPU copy ("shadow") of
    every buffer. The copy is now allocated only for the ranges that are really
    uploaded and never grows past the size the engine declared for the buffer,
    instead of following the allocator's capacity.
  • The bind group cache is bounded. It was allowed to grow to 24000 entries
    and kept every entry alive. It now evicts the oldest entry when it is full,
    with a limit of 4096 on Android (24000 elsewhere), and reports the number of
    evictions.
  • The engine's heap limit is enforced. emscripten_get_heap_max returned a
    hardcoded 16 GB, so the engine happily planned allocations the phone cannot
    give it, and the growth request could overshoot the cap. It now reports the
    real limit of the memory type (5 GB on Android by default) and refuses growth
    past it instead of asking for more and failing later.
  • The log says where the memory goes. New lines:
    [host] heap: initial 2108 MB, maximum 5120 MB, page size 65536 bytes
    host buffer memory: shadow data 141312 KiB, allocated 157696 KiB, declared 131072 KiB; uniform staging 4096 KiB; bind group cache 4096/4096 (23847 evictions)
    
  • The exit reason is exported with the logs. The launcher now appends
    Android's own record of how the game process ended:
    [android-exit] Recent game-process exits (system-reported):
    [android-exit] timestamp_ms=... reason=LOW_MEMORY importance=... pss_kb=...
    
    This is the piece that tells low-memory kill apart from a native crash. It
    needs Android 11 or newer; on older systems the log says so.

The 0.1.9-patch fix stays in: the Adreno black screen (software clip distance
emulation) and the compressed texture upload errors.

What to test

  1. Sideload this APK over 0.1.9-patch.
  2. Set graphics to Maximum - the setting that crashed.
  3. Play for at least as long as it took to crash before (a few minutes).
  4. Export the logs and attach them here, also if it crashes. The export now
    contains the [android-exit] section with the system's exit reason, so one
    log is enough to tell us what killed the game.

If Maximum still crashes, the exit reason in the log points straight at the
next step (lower default heap, or the exact allocation that fails).

Getting game data in

The app ships no game content; you supply your own copy of the web port's data,
which must have this layout:

data/manifest.json
b/<build>/shaders/index.json
b/<build>/game.wasm        (native wasm2c engine only)

Two ways to point the app at it:

  • Use a game files folder - pick a folder that already holds data/ and
    b/. Nothing is copied, so it works with no free space, and you can pick the
    parent folder if the data sits in a game/ subfolder.
  • Import game ZIP - pick a .zip of the same tree; it is extracted into app
    storage, which needs free space for both the archive and the extracted data.

Whichever you choose, the folder must be on internal storage (/sdcard/...).
If the launcher says the folder cannot be read, tap Grant file access and
allow "All files access".

Graphics

Every knob the web launcher exposes is in the launcher, under Graphics,
with the same names: texture, reflection, water, particle and grass quality,
scenery/pedestrian/vehicle detail, city density, variety, post FX, motion blur,
depth of field, shadow quality and softness, ambient occlusion, render distance,
fog, particle and long shadows, loading ahead, and distant lights. Low (phone
default)
turns shadows off entirely and pulls the render distance in.

Multiplayer

Multiplayer uses the Grand-V relay - the same transport as the web version, so
you can share a room with browser players. You need a relay address
(ws://host:8012/relay), a room name and the access code from whoever is
hosting. Rooms hold two players and carry pose only: position, rotation and
model. Plain ws:// for now, no TLS.

Known limits

  • ARM64 only, Vulkan required, Android 10+.
  • First launch compiles the game and takes several minutes; early stutter is
    mostly loading from storage.
  • Signed with a debug key. Fine for sideloading, not for any store.
  • This patch covers the Wasmtime engine. The native wasm2c engine button still
    boots and logs but does not render; use the wasmtime engine for gameplay.

Tested

Galaxy A34 5G (8 GB) with the Wasmtime engine.