Files
nfsmw-online/ostream_repro/build.sh
T
megboyzzandClaude 725ffbd8ed arm64: flat guest mapping, audio, crash reporting, self-extracting data
The run of work that took the translated build from "boots" to "playable".

Engine:
- Flat guest mapping replaces the software MMU on aarch64 hosts. A 4 GiB
  PROT_NONE reservation lets a 32-bit guest address zero-extend safely, so
  tcg_out_qemu_ld/st short-circuit before tcg_out_tlb_read and the prologue
  materialises the base into X28. Measured 1.24x (51 vs 41 fps, interleaved
  A/B). Note the base must be set BEFORE UC_INIT - Unicorn inits lazily, and
  setting it after uc_open silently falls back to softmmu.
- num_get<char> facet implemented, which was the real cause of the crash after
  the prologue race; a full race is now playable end to end.
- Thread-stack free list + ReleaseThreadEngine, fixing the arena leak that
  showed up as a black screen when entering a race. kMaxGuestThreads 16 -> 64.
- Real ARM32 FMOD now runs in-engine via the Java FMODAudioDevice bridge, with
  a per-thread JNIEnv. Two of the three blockers were our own single-image-era
  guards.

Host/app:
- Native crash handler: async-signal-safe, decodes the host fault back to a
  guest address, writes a report file and nothing else. CrashReportActivity
  picks it up on the NEXT launch, zips it, and offers to share. No backend, no
  automatic upload.
- Game data ships inside the APK and self-extracts on first launch, so a tester
  installs one file and plays. Copy-to-.part-then-rename, with a free-space
  check up front.
- EGL context preserved across pause, fixing black textures on resume.
- Navigation bar hidden and re-hidden on focus gain; volume keys reported as
  system keys, checked before the loading-state gate.
- x86_64 added to abiFilters: the ARM32 guest runs under tcg/i386 with no
  houdini in the path. The flat mapping is aarch64-only, so that host falls
  back to the software MMU - commented at the abiFilters line.

Ignore rules added for app/translated/ (611 MB of signed release APK, which
also carries the bundled OBB) and ostream_repro/build/.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-22 23:17:47 +03:00

46 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds libostream_repro.so for armeabi-v7a via the NDK's CMake toolchain
# file - standalone, deliberately outside the Gradle build, same pattern as
# ../trace_agent/build.sh. Output: build/libostream_repro.so, ready to push
# to a device for GuestEngine::LoadSecondaryImage to load (see
# mpcore/src/main/cpp/emu/ostream_repro_test.cpp).
set -euo pipefail
cd "$(dirname "$0")"
NDK="${ANDROID_NDK_HOME:-/home/megboyzz/Android/Sdk/ndk/27.0.12077973}"
TOOLCHAIN="$NDK/build/cmake/android.toolchain.cmake"
if [ ! -f "$TOOLCHAIN" ]; then
echo "NDK toolchain file not found at $TOOLCHAIN - set ANDROID_NDK_HOME" >&2
exit 1
fi
# ANDROID_STL=c++_static explicitly - see ostream_repro.cpp's own top
# comment for the full reasoning (tried c++_shared FIRST, actually built
# and inspected both outcomes with llvm-readelf before deciding, not
# guessed): the modern NDK r27 toolchain's libc++ headers extern-template-
# declare basic_stringbuf<char>/basic_ostream<char>/basic_ios<char>/
# basic_ostringstream<char> (their vtables AND ctors/dtors become UNDEFINED
# imports resolved against libc++_shared.so, confirmed via
# `llvm-readelf --dyn-syms` on a real c++_shared build of this exact file),
# which GuestEngine has zero shims for - that combination would make this
# test fail for an uninteresting, unrelated reason (unimplemented vtable
# stub returning 0) instead of actually exercising real, compiled
# std::basic_stringbuf<char>::str()/write() logic. c++_static compiles that
# logic directly into THIS .so's own .text - both a working build AND a
# closer functional match to what libapp.so's own (much older) toolchain
# evidently did for sub_79CD4/sub_27160C (confirmed real, compiled,
# fixed-address code inside libapp.so itself, never external imports -
# see ARM64_TRANSLATION_LAYER.md's 2026-09-16 entries).
cmake -B build -G Ninja \
-DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" \
-DANDROID_ABI=armeabi-v7a \
-DANDROID_PLATFORM=android-27 \
-DANDROID_STL=c++_static \
-DCMAKE_BUILD_TYPE=Debug \
.
cmake --build build
echo "Built: $(pwd)/build/libostream_repro.so"