Skip to content

Android port, piece 2: the app opens the start screen, with Android's folder picker - #612

Merged
peiikai merged 4 commits into
beta_6from
android-storage
Nov 7, 2026
Merged

peiikai merged 4 commits into
beta_6from
android-storage

Conversation

@peiikai

@peiikai peiikai commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Second step of bringing in mamcjr's LASRecompAndroid (MIT), on top of the moving guest window from #611. The Android app now builds and opens the start screen, and the game files can be picked and copied in. It can't play yet: building the game code on the device is the next piece. Nothing changes for the desktop builds.

The app (android/)

  • Gradle + CMake. libmain.so is the runtime, the Vulkan backend and the UI, built with LARECOMP_DYN_BASE.
  • SDL's activity, with our own icon.
  • android/deps/build_deps.sh builds SDL3, shaderc, volk and the Vulkan headers for arm64 from pinned sources.
  • docs/android.md covers building and running it in the emulator.

Platform layer

  • runtime/platform/linux.c now also builds for Android, guarded by __ANDROID__:
    • the log goes to logcat and to lasrecomp.log
    • the data folder and shipped resources come from the app
    • backtraces come from the unwinder
    • there is no re-exec
    • the device name and Android version go in the log
  • runtime/main.c: on Linux the moving window can take a free spot from /proc/self/maps. An app process can't restart itself for another memory layout.

Vulkan on Android

  • Every function is loaded through volk, because Android's loader exports only Vulkan 1.1 before API 33.
  • The swapchain is left unrotated and the compositor turns it, so presents return SUBOPTIMAL by design. That is no longer logged as a failure.
  • The app is always full screen.
  • The window surface is made again after the app was in the background. Before this, coming back from the folder picker or the home screen gave a black screen.

Game files on Android

  • SDL has no folder dialog on Android, so Choose... showed the Linux message about xdg-desktop-portal.
  • Choose... now opens Android's own folder picker. Set Up copies exefs and romfs from the picked folder through the storage framework into the data folder, found the same way find_game finds them, with progress and cancel. It then checks and builds as on the desktop.
  • The Data folder row is fixed to the app's own folder.

Small shared fixes

  • apple_trees.c: kill() renamed, since Bionic's signal.h declares one.
  • Bionic's CPU_SET is a statement, so linux.c no longer uses comma forms of it.
  • FFmpeg is left out on Android for now (the start screen's background frame). It comes with the movies.

CI

  • A new Android job builds the APK and fails if the APK holds anything but the runtime, SDL, shaderc and the shipped fonts and icon.

Tested

  • On an arm64 Android 15 emulator (Vulkan 1.3 on an M3 Max):
    • the start screen opens, and touch works
    • lasrecomp.log is written in the data folder
    • Home and back, and the folder picker, return to a drawn screen
    • picking Download/LASGameFiles copied the 1.0.0 files (all 3,836 romfs files), then the build stopped as expected ("the game code builder is missing")
  • On macOS, the normal build still plays in Mabe Village.
  • Desktop Linux and the new Android CI job get their first full run on this PR.

🤖 Generated with Claude Code

peiikai and others added 4 commits November 7, 2026 15:23
The Android app from mamcjr's LASRecompAndroid (MIT), on top of the moving
guest window: it builds with the NDK and opens the start screen. The game
can't run yet (on-device game code build, movies, game files, touch and
per-GPU Vulkan settings are the next pieces).

- android/: Gradle + CMake app (libmain.so = the runtime, Vulkan backend
  and UI), SDL's activity, our own icon; android/deps/build_deps.sh builds
  SDL3, shaderc, volk and the Vulkan headers for arm64 from pinned sources.
- runtime/platform/linux.c builds for Android: log to logcat and
  lasrecomp.log, data folder and resources from the app, unwinder
  backtraces, no re-exec, device info in the log.
- runtime/main.c: on Linux the moving window can take a free spot from
  /proc/self/maps (an app process can't re-exec for another layout).
- Vulkan on Android through volk (the loader exports 1.1 only before API
  33), the swapchain left unrotated (the compositor turns it), always full
  screen. FFmpeg left out for now (the start screen's background frame).
- apple_trees.c: kill() renamed (Bionic's signal.h declares one); Bionic's
  CPU_SET is a statement, so no comma forms in linux.c.
- CI: an Android job builds the APK and fails if it holds anything but the
  runtime, SDL, shaderc and the shipped fonts and icon.
- docs/android.md.

Tested: the APK on an arm64 Android 15 emulator (Vulkan 1.3 on the Mac's
GPU) opens the start screen, touch works, lasrecomp.log is written in the
data folder; the macOS build plays as before.

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

Android destroys the window's surface when another activity covers the app
(the folder picker, the home screen) and SDL makes a new one on return; the
old VkSurfaceKHR stays lost, so every acquire failed and the screen stayed
black. Each swapchain rebuild there now makes the surface again from SDL's
current window, and a lost surface (acquire or present) triggers it; with no
window yet, the frame is skipped.

Tested on the arm64 Android 15 emulator: Home and back, and the folder
picker, return to a drawn start screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SDL has no folder dialog on Android (Choose... showed the Linux message
about xdg-desktop-portal). Choose... now opens the system folder picker
(the activity, ACTION_OPEN_DOCUMENT_TREE), and Set Up copies exefs and romfs
from the picked folder through the storage framework into the data folder -
found as find_game does, with progress and cancel - then checks and builds
as on the desktop. The Data folder row is fixed to the app's folder there.

Tested on the arm64 Android 15 emulator: picked Download/LASGameFiles, the
copy found version 1.0.0 and all 3,836 romfs files; the build then stops as
expected (the on-device game code builder is the next piece).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@peiikai
peiikai merged commit fde9de4 into beta_6 Nov 7, 2026
6 checks passed
@peiikai
peiikai deleted the android-storage branch November 7, 2026 23:03
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.

1 participant