diff --git a/docs/MOBILE-ARCHITECTURE.md b/docs/MOBILE-ARCHITECTURE.md index b240fad9..a386c249 100644 --- a/docs/MOBILE-ARCHITECTURE.md +++ b/docs/MOBILE-ARCHITECTURE.md @@ -4,12 +4,12 @@ ## 现状 -- Android arm64 `libmain.so`(含嵌入式 Python)可以编译链接;APK 打包和真机验证未完成。 -- `support/android` 只有 `app/build.gradle` 和 `AndroidManifest.xml`:没有 Gradle wrapper 和顶层 Gradle 配置,没有 SDL3 Java 部分(`SDLActivity`)和依赖,清单引用的图标资源不存在。 +- `android/build.sh` 可以编出 arm64 调试 APK(SDL3 + FreeType 自动编译,16 KB 页对齐),连接手机时自动安装启动;真机运行尚未验证。 +- `android/push_assets.py` 把资源(`assets/loose` + python-root + `python27.zip`)推送到应用外部存储目录,客户端启动时切换到该目录。 - 游戏资源为 2.8 GB、约 5 万个散文件(`assets/loose`),17 个源文件中 120 多处通过 `std::filesystem` / `ifstream` 直接读文件,无法读取 APK 内置资源。 - 没有处理前后台切换(`SDL_EVENT_WILL_ENTER_BACKGROUND` / `DID_ENTER_FOREGROUND`)和低内存事件。 - 没有触摸事件处理;SDL 默认把单指触摸模拟成鼠标,只能点按钮。 -- `src/app/main.cpp:366` 启动时全局调用 `SDL_StartTextInput`,在 Android 上软键盘会一直弹出。 +- 软键盘已改为仅在输入框获得焦点(`ime.EnableCaptureInput`)或聊天打开时弹出。 - `src/app/main.cpp` 共 2418 行,启动、主循环、登录和调试参数都在其中。 - Android 默认渲染缩放 0.75。 diff --git a/docs/PORT-PLAN.md b/docs/PORT-PLAN.md index 6b221962..67e7d28b 100644 --- a/docs/PORT-PLAN.md +++ b/docs/PORT-PLAN.md @@ -1114,3 +1114,33 @@ Verified: Debug macOS/Metal build, 50/50 CTests (`render_3d` covers the LOD bands, the 30 FPS far pose rate on `_lod_03` and the `lion2` saddle fallback; `hardware_scene` covers the blended centre sort). Not verified: in-game or device visuals (no server in this session). + +### 2026-10-12 Android step 1: APK packaging and game data + +- `support/android` moved to a top-level `android/` and completed: Gradle 8.12 + wrapper, AGP 8.7.3, compileSdk/targetSdk 35, minSdk 26, arm64-v8a, placeholder + adaptive icon. `android/build.sh` builds SDL3 3.4.16 and FreeType 2.13.3 once + into `build/android-deps` (SDL Java sources copied from the same release), + then the APK (C++ as RelWithDebInfo in debug), and installs/launches it when a + phone is attached. `libmain.so`, `libSDL3.so` and `libc++_shared.so` are + 16 KB page aligned; FreeType is linked statically (`AVA2_HAS_FREETYPE`). +- On Android the client enters `SDL_GetAndroidExternalStoragePath()` + (`/sdcard/Android/data/com.metin2.ava2/files`) at startup. Script-root + discovery also accepts a flattened root (`game.py` beside `uiscript/`). +- `android/push_assets.py` stages `assets/loose` + `upstream/python-root` + (scripts win) + `python27.zip` as hard links in `build/android-data/root` + (55,761 files, 2.86 GiB) and sends them with `adb push --sync`. It remaps the + three `assets/loose` symlinks that point into the old machine's pack_maker + (`bgm`, `sound/ui`, `icon/icon`). +- The on-screen keyboard follows edit focus (`ime.EnableCaptureInput` / + `DisableCaptureInput` from `ui.py`), the in-game chat and the dev login view + where SDL reports screen-keyboard support; desktop keeps text input on. +- Build workaround: this checkout calls SpeedTree SDK APIs that are not yet in + the SDK repository (`LegacyWindController`, `CreateFromSpt` variance, LOD + fields). Until that SDK work is pushed, the APK builds from a local mirror + with shims: `AVA2_SOURCE_DIR= AVA2_SDK_ROOT= android/build.sh`. + +Verified: debug APK builds; the desktop client reaches the login screen inside +`build/android-data/root` (the phone layout) with no missing-effect errors. +Not verified: any run on a device (no phone attached), Vulkan rendering, touch, +lifecycle, frame rate.