Skip to content

Android port (arm64): runtime, on-device setup, touch controls, APK; Adreno fixes - #45

Closed
nydal91 wants to merge 22 commits into
rob646464:mainfrom
nydal91:android-port
Closed

nydal91 wants to merge 22 commits into
rob646464:mainfrom
nydal91:android-port

Conversation

@nydal91

@nydal91 nydal91 commented Oct 31, 2026

Copy link
Copy Markdown

Android port of Luigi's Mansion Recompiled (arm64), on top of the 1.1 code (22 commits, 0 behind main). Details in docs/ANDROID.md.

What's in it

  • Runtime and setup on the phone: the game module is recompiled and compiled on the device with a bundled LLVM (libllvm.so). The job limit depends on RAM, and a killed compile is retried serially. Disc images are opened through their content:// URI via SDL.
  • Controls and UI: touch controls; taps reach the setup screen and the F1 menu; finger-sized UI; always fullscreen.
  • Phone defaults:
    • costly GX accuracy features off by default (one-time migration);
    • render resolution capped at 3x;
    • no fused multiply-adds on arm64, as on macOS.
  • Diagnostics:
    • [perf] lines (CPU, busiest threads, thermal state);
    • a Share log button;
    • the previous run's log is copied to Download/LuigisMansionPort on every start.
  • Texture packs: Dolphin-style replacement textures from <data>/textures, with an import option on Android.
  • Runtime fix: in OSSetAlarm, alarm times are signed, so a time in the past fires at once.
  • CI: GitHub Actions builds the APK (compiler cached; release for android-* tags).

Adreno fixes (tested on an Adreno 740)

  • OpenGL ES on Adreno GPUs (c3c33b3): Adreno's Vulkan driver miscompiles the 16-bit unpacking in Aurora's vertex fetch (see Dusklight #750). As a result the title and file-select pictures were drawn as vertical stripes and the file-select text was missing. Adreno now defaults to Dawn's OpenGL ES backend; LM_BACKEND=vulkan overrides it.
  • EFB depth copies in Compatibility mode (34b4364, Aurora patch 0251-compat-depth-copies.patch): on OpenGL ES, Aurora skipped depth copies, so Luigi had no shadow. Compatibility mode forbids both textureLoad and non-comparison sampling on depth textures. The patch instead reads each texel's 24-bit depth with 24 unrolled comparison samples, which gives the same value as the core path. Core devices are unchanged.
    • Verified with AURORA_DAWN_VALIDATION=1: 1186 Z16 copies, no errors, shadow back.

Not changed

Desktop builds: the Android code is behind __ANDROID__, and the Aurora patch only applies in Compatibility mode.

🤖 Generated with Claude Code

eiriknydal and others added 22 commits October 31, 2026 19:41
…ackaging

- android-arm64 CMake preset (NDK r29+); the program is libmain.so for SDL's Java activity
- Game module built on the device with a bundled clang+lld multi-call binary (libllvm.so)
- Disc images from the system file picker (content:// URIs via /proc/self/fd)
- On-screen touch controls merged into controller port 1; Back/MENU open the F1 menu
- Logging to logcat + last_run.log; Android crash reports left to debuggerd
- tools/android: build.sh, build_nod.sh, build_llvm.sh, build_apk.sh, make_icon.py
- docs/ANDROID.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…al retry after a kill)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AE4PtFFPsLrykdjaCrCwzd
Aurora turns off SDL's touch-to-mouse events, so ImGui never saw taps. One finger is now
fed to ImGui as a touchscreen mouse (drags scroll). Menus scaled for phone screens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AE4PtFFPsLrykdjaCrCwzd
…solves /proc/self/fd links); explain archives

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AE4PtFFPsLrykdjaCrCwzd
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AE4PtFFPsLrykdjaCrCwzd
… guest threads

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AE4PtFFPsLrykdjaCrCwzd
…me migration)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AE4PtFFPsLrykdjaCrCwzd
The European frame pacer sets its alarm for a time already past after a long frame. As an
unsigned delay that was ~2^64 ticks; converting it to a host duration overflowed, which x86
turns into INT64_MIN (fires at once) but ARM saturates to INT64_MAX, so on Android the game
stayed at ~7 fps after the first long frame (a room load in a cutscene).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AE4PtFFPsLrykdjaCrCwzd
… every start

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AE4PtFFPsLrykdjaCrCwzd
…ithout a compiler

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AE4PtFFPsLrykdjaCrCwzd
…d fix; drop log env vars

- update.cpp: no startup check on Android; a const reference for libc++'s path iterator
- crash_handler.cpp: the new Linux thread dump uses glibc's backtrace; Android leaves it to debuggerd
- LMActivity: no LM_FPS_LOG / AURORA_GPU_PROFILE by default
- the menu size now comes from ui_scale.cpp (the old Android-only scaling is gone)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AE4PtFFPsLrykdjaCrCwzd
…s; Android import

- texture_pack.cpp: loads tex1_*.png/.dds through Aurora's texture replacement at startup,
  F1 > Visuals > Texture pack (on/off, count, open folder, reload)
- Android: Import .zip / Import folder (LMActivity copies only the texture files into the app),
  Remove texture packs
- Cross builds keep the build machine's pkg-config out also on re-configures
- docs/TEXTURE_PACKS.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AE4PtFFPsLrykdjaCrCwzd
…ndroid-* tags)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AE4PtFFPsLrykdjaCrCwzd
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AE4PtFFPsLrykdjaCrCwzd
…s on macOS

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AE4PtFFPsLrykdjaCrCwzd
… data)

On an Adreno 740 the title backdrop and file-select pictures were drawn as
vertical stripes (every pixel sampled the texture's first row) and the
file-select text was missing. Texture data, texcoords and texcoord scales
were verified correct on the device; the Adreno Vulkan driver miscompiles
the 16-bit unpacking in Aurora's vertex fetch (same bug as Dusklight #750).
Adreno devices now default to Dawn's OpenGL ES backend, which draws them
correctly; LM_BACKEND=vulkan overrides. docs/ANDROID.md "Adreno: OpenGL ES".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…adow)

On OpenGL ES (Dawn compatibility mode, now the default on Adreno) Aurora
skipped depth copies, so the game's Z16 shadow-map copy was never made and
Luigi cast no shadow. Compatibility mode forbids textureLoad on depth
textures and non-comparison sampling of them, so Aurora patch 0251 reads
each texel's 24-bit depth with an unrolled binary search of 24 comparison
samples (same value as the core path). Core devices are unchanged.
Verified on an Adreno 740 with Dawn validation on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rob646464

Copy link
Copy Markdown
Owner

Don't want to maintain an Android version, sorry. Sticking to PC.

@rob646464 rob646464 closed this Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants