Mobile step 7b: iOS packaging (simulator verified to the game scene)

- ios/build.sh builds static SDL3 + FreeType, then the .app (code only,
  embedded Python); signs ad hoc and runs on a simulator, or signs with a
  development profile and installs with devicectl (device path untested).
  Simulator-only SDL patch: accept the simulator Metal device for SDL_GPU.
- ios/Info.plist.in: landscape, full screen, launch screen, file sharing.
- Data dir is Documents on iOS; ios/push_assets.py stages the client root
  lower-cased (iOS is case-sensitive, the client opens lower-cased paths)
  and copies it into the app container.
- EffectData path normalisation folds A-Z like the effect cache key.
- android/push_assets.py: test-rundir base layer + svside/, which the game
  phase needs (also fixes Android); --lowercase (ASCII only).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-13 01:21:07 +09:00
co-authored by Claude Opus 5.5
parent f973b24abc
commit 908838c8f9
11 changed files with 431 additions and 13 deletions
+3 -3
View File
@@ -21,7 +21,7 @@
```
┌──────────────────────────────────────────────────────────────┐
│ 平台打包 android/ (Gradle + SDLActivity + build.sh) │ 新增
│ ios/ (以后) macOS .app (已有脚本) │
│ ios/ (build.sh) macOS .app (已有脚本) │
├──────────────────────────────────────────────────────────────┤
│ 主程序 src/app/ │
│ main.cpp 入口、命令行参数 │ 拆分
@@ -104,7 +104,7 @@ Python 更新(原版脚本 + mobile HUD)
|---|---|---|---|---|
| macOS(开发和测试) | `ava2_client`、.app | Metal | 原版 PC 界面(可开关手机 HUD) | 键盘鼠标 |
| Android(主目标) | APK(`libmain.so`) | Vulkan | 原版界面 + 手机 HUD | 触屏 |
| iOS(以后) | .app | Metal | 同 Android | 触屏 |
| iOS | .app(`ios/build.sh`,资源用 `ios/push_assets.py` 小写拷入 Documents) | Metal | 同 Android | 触屏 |
## 手机 HUD 布局
@@ -144,6 +144,6 @@ Python 更新(原版脚本 + mobile HUD)
3. `input/`:触摸分流、虚拟摇杆、攻击键、镜头手势——可在手机上移动和战斗。
4. `mobile/`:手机 HUD(状态面板、技能圈和快捷栏、右上角入口、小地图、左侧按钮)。
5. 界面缩放和安全区域收尾。
6. 自动战斗等新增功能(自动狩猎已完成,见 PORT-PLAN);iOS 打包与 `app_loop` 拆分。
6. 自动战斗等新增功能(自动狩猎已完成,见 PORT-PLAN);iOS 打包与 `app_loop` 拆分(均已完成,模拟器验证到游戏场景;真机签名安装未测)。
第 3、4 步大部分可在 macOS 上开发(鼠标模拟单指,触控板测双指);多指同时操作和性能需要真机验证。
+50
View File
@@ -1403,3 +1403,53 @@ bad arguments still exit 1.
Outstanding: Android stays on the classic loop until callbacks are tried on
a device; the frame body is still one function (state not yet split into
classes).
### 2026-10-13 Mobile step 7b — iOS packaging
- `ios/build.sh [sim|device] [deps] [--no-run]`: builds static SDL3 3.4.16
and FreeType 2.13.3 once into `build/ios-deps/prefix-<sdk>` (tarballs
shared with `build/android-deps`), then the client as
`build/ios-<sdk>/ava2_client.app` (8.8 MB, code only, Python embedded,
deployment target 15.0, arm64). The simulator build is signed ad hoc,
booted, installed and launched. A device build is signed with
`AVA2_IOS_SIGN_IDENTITY` and the entitlements of `AVA2_IOS_PROFILE`, and
is installed with `xcrun devicectl`.
`ios/Info.plist.in` sets landscape only, full screen, a hidden status bar,
an empty launch screen (native resolution), `UIFileSharingEnabled`
and a local-network usage string.
- Simulator only: SDL_GPU rejects the simulator's Metal device because it
does not report MTLGPUFamilyApple3. `build.sh` patches its private
extracted copy of `SDL_gpu_metal.m` (`|| TARGET_OS_SIMULATOR`). Device
builds use stock SDL.
- Data directory: `platform.cpp` uses the app's Documents folder
(`SDL_FOLDER_DOCUMENTS`). The "game data not found" box names
`ios/push_assets.py`. That script stages the tree with
`android/push_assets.py --stage-only --lowercase` and copies it into the
simulator container as APFS clones (`cp -Rc`), or to a device with
`xcrun devicectl device copy to`.
- iOS file systems are case-sensitive as the app sees them, including the
simulator container. The client opens lower-cased paths
(ResourceManager::NormalizePath), but the data is mixed case
(`Dopador_manual/…`). So the iOS tree is staged with every name
ASCII-lowercased. Only A–Z is folded: legacy CP949 names stored as
Latin-1 code points (`oxà캥æ®.dds`) must keep their bytes.
`EffectData`'s path normalisation now also folds A–Z (scripts spell
`empire_A.mse`), like the effect cache key already did.
- Staging fixes that also apply to Android: `android/push_assets.py` now
uses `build/dev/test-rundir` (tools/make_test_rundir.py) as the base layer
and adds the loose `svside/` folder. Before, `assets/loose` alone lacked
pack files that game.py needs (Dopador_manual/*, the switcher art,
svside/*.jpg), and the game phase ended. The staged tree is now
98,349 files / 3.95 GiB.
Verified: iPhone 17 Pro simulator, `--phase game --preview-data`. The game
scene and the mobile HUD render; the safe area (118/0/118/38) keeps the HUD
clear of the notch on either landscape side. The console has 0 TraceError
or Traceback lines. Without data, the app shows the "game data not found"
box. Desktop 54/54.
Outstanding: the device build, signing and devicectl install/copy are
untested (no device or profile). The network keepalive does not run while
the app is in the background (iOS suspends SDL_AppIterate). Android still
uses the classic loop. Paths the client opens without lower-casing them
would fail on iOS; none showed up in the login screen or the game phase,
but character select and a real-server login have not been run on iOS yet.