mirror of
https://github.com/bearstonem/openmohaa-vr.git
synced 2026-10-17 18:00:20 +02:00
Builds an APK for arm64-v8a, brought up on a Meta Quest 3 but not specific to it. The engine reaches the main menu with retail data side-loaded and renders through renderergl2 on an OpenGL ES 3.2 context. Build system: a new cmake/platforms/android.cmake, driven by the NDK's android.toolchain.cmake. renderergl1 is not built (it is fixed function and would need a GL-over-GLES translation layer), the renderer is linked into the client rather than dlopen'd, and SDL2 and OpenAL Soft are built from source since neither ships an Android binary. OpenAL is not optional here: it is the engine's only sound driver, so USE_OPENAL=OFF does not build. Native libraries are staged per-ABI for gradle, which packages them in misc/android. Portability fixes for bionic: - pthread_cancel does not exist; GameSpy's async DNS thread detaches instead. - <execinfo.h> does not exist. sys_android_new.c walks the stack with _Unwind_Backtrace and resolves it through dladdr, writing straight to logcat. This matters because tombstoned does not reliably report a backtrace, leaving no account of where the engine died. - librt does not exist; those symbols live in libc. - libmumblelink.c needs shm_open and was being compiled even with USE_MUMBLE off. It now builds only when Mumble is enabled. con_android.c sends the console to logcat and pumps stdout and stderr there too, so output from the C library and from third party code is not silently discarded. The fatal signal handlers move ahead of Com_Init. Startup is exactly when renderer and filesystem bring-up crash on a new platform, and a fault there previously died with no backtrace at all. Game modules ship inside the APK as libgame.so and libcgame.so and are loaded off the linker's search path. Static linking is not an option: cgame and fgame both compile q_shared, q_math and the script system, so linking them into one binary collides. Android extracts only lib*.so from an APK, hence DLL_PREFIX in q_platform.h. Paths point at the app's external files directory, which is where the user side-loads the game data and the only place the engine can write. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>