android-native: SDL3 APK build for the native client

build-android-native.sh downloads SDL 3.4.16 (sha256-checked), builds
libSDL3.so and libmain.so (native_render + port_platform + embedded
Python) at API 24, and wraps them in the SDLActivity shell under
android-native/ (package org.metin2port.client). push-android-client.sh
copies the 40250 Client directory into the app's files/ with run-as
(--locale XX selects locale_XX.cfg). port_logic links with
--no-dependent-libraries on ELF targets so the verbatim
`#pragma comment(lib, ...)` lines do not break lld.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-28 18:45:58 +09:00
co-authored by Claude Opus 5.5
parent 0b701d88c3
commit fd051cc3ed
15 changed files with 439 additions and 14 deletions
+21 -14
View File
@@ -32,21 +32,28 @@ returned by SDL's `SDL_GetBasePath`). `MT_PYTHON_STDLIB` can override the zip pa
## Android integration
With an Android toolchain and SDL3 Android AAR/Prefab available to CMake, the
same option builds `libmain.so` for SDLActivity. The `mt_native_android_assets`
target prepares `native.vert.spv`, `native.frag.spv`, and `python27.zip` under
`<build>/native_render/android-assets` (`python27.zip` is included when the
embedded Python target is enabled); include that directory in the SDL app's
`assets.srcDirs`. The app must allow network access for login. The 40250 `Client`
directory must be placed at `SDL_GetPrefPath("mtgodot", "native-render")/Client`,
with `pack/Index` present, before live mode starts. The Godot APK is a separate
application and does not launch this SDL renderer.
`./build-android-native.sh [Debug|Release] [--install]` builds the arm64 APK
(`android-native/app/build/outputs/apk/debug/app-debug.apk`, package
`org.metin2port.client`): it downloads SDL 3.4.16 (sha256-checked) into
`build-android-native/_deps`, builds `libSDL3.so`, cross-builds `libmain.so`
(this target + `port_platform` + embedded Python) at API 24, and wraps both in the
SDLActivity shell under `android-native/` (`MainActivity` passes the launch intent's
`args` extra as argv). `mt_native_android_assets` supplies `native.vert.spv`,
`native.frag.spv` and `python27.zip` as APK assets.
The standalone `arm64-v8a` renderer cross-builds at Android API 24. The full
live-client cross-build currently stops in `extension/src/port/common/Win32Crt.cpp`:
the NDK exposes `<iconv.h>` at API 24 but does not declare `iconv` until API 28.
This is a port-runtime prerequisite for an Android live-client APK; raising the
minimum API level is not assumed here.
The 40250 `Client` directory is not packaged. `./push-android-client.sh` copies it
to the app's `files/Client` (`SDL_GetPrefPath`) with `run-as`, so it needs the
debug-signed APK installed first. Without arguments the app runs against the
in-process fake server; for a real server:
```sh
adb shell am start -n org.metin2port.client/.MainActivity \
--es args "--live-server HOST:AUTH_PORT:GAME_PORT --login-screen"
```
Code page conversion does not use iconv: `extension/src/codepage` carries Microsoft's
WindowsBestFit tables for 874/932/936/949/950/1250-1258 (regenerate with
`python3 script/gen_codepage_tables.py`), so Android converts the same as macOS.
The Vulkan portability enumeration extension is selected only when advertised
by the loader. DDS, TGA, and memory textures retain their existing decoders;