android: build.sh installs and syncs the game files when a phone is attached
After building the APK, android/build.sh now picks the attached device (ANDROID_SERIAL for several), installs the APK (reinstalling on a signature mismatch), syncs the zh client into files/Client and, with --launch, wakes the phone and starts the app. Without a device it only builds. push-client.sh is now incremental (android/sync_client.py): the device keeps files/Client/.mt_sync (size, mtime, path of what the last sync wrote), so later syncs send only new and changed files as one tar streamed through `adb shell -T run-as` (no copy in /data/local/tmp) and delete the ones gone locally. Only game resources are synced; settings and logs the app writes there are kept. --locale zh rebuilds build/zh-locale/Client first when its inputs changed. android/adb_env.sh picks adb and falls back to server port 5038 when :5037 cannot bind. Verified against a fake adb device: first sync (1.4 GB, byte-identical), no-op resync, changed files, deletions, locale switch, --full, the install/launch path and the no-device path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f9cd63713f
commit
cd9e5b259d
+13
-5
@@ -5,12 +5,20 @@
|
||||
## 安装和资源
|
||||
|
||||
```sh
|
||||
./android/build.sh Release --install
|
||||
./android/push-client.sh /path/to/40250/Client
|
||||
adb shell am start -n org.metin2port.client/.MainActivity
|
||||
./android/build.sh [Debug|Release] [--launch]
|
||||
```
|
||||
|
||||
`android/push-client.sh` 将 40250 `Client` 目录复制到应用私有目录。APK 本身包含 `libmain.so`、`libSDL3.so`、着色器和 Python 2.7 标准库,不包含约 1.4 GB 的 40250 客户端资源。使用中文资源时运行 `./android/push-client.sh --locale zh`。
|
||||
构建完成后,如果有一台已授权的设备(多台时用 `ANDROID_SERIAL` 指定),脚本会:
|
||||
|
||||
1. `adb install -r` 安装 APK;签名不一致(别的机器的 debug key)时卸载重装,应用数据随之清空。
|
||||
2. 运行 `android/push-client.sh --locale zh`,把资源同步到应用私有目录 `files/Client`。中文资源 `build/zh-locale/Client` 的输入(`data/zh_40250`、`scripts/build_zh_locale.py`、`Client/pack/Index`)有变化时先重新生成。
|
||||
3. 带 `--launch` 时唤醒手机并启动应用;锁屏状态下只提示解锁(锁屏启动会因 Vulkan surface 错误退出)。
|
||||
|
||||
没有设备时只构建 APK。其他选项:`--no-deploy` 只构建,`--no-push` 只安装,`--locale XX` 用 `Client/locale_XX.cfg`,`--full-push` 删除设备上的资源后全量重传。
|
||||
|
||||
资源同步是增量的:设备上的 `files/Client/.mt_sync` 记录上次写入的文件(大小、修改时间),之后只传新增和改动的文件,并删除本地已不存在的文件;第一次同步传完整的约 1.4 GB。只同步游戏资源(`pack/`、`sound/`、`BGM/`、`channel.inf`、`locale*.cfg`),应用自己写的设置和性能日志不会被覆盖或删除。单独同步资源:`./android/push-client.sh [--locale zh] [--full] [--dry-run] [CLIENT_DIR]`。
|
||||
|
||||
APK 本身包含 `libmain.so`、`libSDL3.so`、着色器和 Python 2.7 标准库,不包含 40250 客户端资源。
|
||||
|
||||
## 连服务器
|
||||
|
||||
@@ -19,6 +27,6 @@ adb shell am start -n org.metin2port.client/.MainActivity \
|
||||
--es args "--live-server HOST:AUTH_PORT:GAME_PORT --login-screen"
|
||||
```
|
||||
|
||||
默认不传参数时连接进程内假服。测试真服前确认模拟器/设备能访问相应主机与端口。用 `adb logcat` 查看崩溃和启动错误。`adb devices -l` 没有设备时,先连接模拟器或开启真机 USB 调试。
|
||||
从桌面图标启动(不传参数)时连接 `MainActivity.DEFAULT_ARGS` 里的真服登录界面;显式传入不含 `--live-server` 的参数时运行进程内假服。测试真服前确认模拟器/设备能访问相应主机与端口。用 `adb logcat` 查看崩溃和启动错误。`adb devices -l` 没有设备时,先连接模拟器或开启真机 USB 调试。
|
||||
|
||||
更详细的构建依赖与命令见 [src/host/README.md](../src/host/README.md)。
|
||||
|
||||
+2
-2
@@ -204,8 +204,8 @@ PORT 扩展(40250 没有对应物,只为移动端/平台而加;不能改 4
|
||||
- macOS:`brew install cmake sdl3 vulkan-headers vulkan-loader molten-vk shaderc`;构建见根目录 README
|
||||
(`-DMT_BUILD_NATIVE_RENDER=ON`,目标 `mt_native_render`)。
|
||||
- Android:NDK 27.2(`ANDROID_NDK_HOME` 指向它)、openjdk@21、Android SDK;`adb` 用 `/opt/homebrew/bin/adb`。
|
||||
`./android/build.sh Release --install` 构建安装 APK,`./android/push-client.sh [--locale zh] <Client>` 推送资源
|
||||
(APK 只含代码,资源在应用数据目录)。启动前先唤醒手机。
|
||||
`./android/build.sh [--launch]` 构建 APK,连着手机时自动安装并增量同步中文资源(`android/push-client.sh`;
|
||||
APK 只含代码,资源在应用数据目录)。启动前先唤醒手机。
|
||||
- Python 3:用于 `port_map.py` 和其他审计脚本。Python 2.7.18 只在复核 `py_embed_spike.py` 时需要。
|
||||
- 真服账号、密码不写进仓库或 audit 账本。
|
||||
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ build/native/src/host/mt_native_render \
|
||||
--live-client build/zh-locale/Client --login-screen --width 1024 --height 768
|
||||
```
|
||||
|
||||
Android:`./android/push-client.sh --locale zh`(默认推送 `build/zh-locale/Client`,符号链接按
|
||||
Android:`./android/build.sh` 连着手机时自动执行 `./android/push-client.sh --locale zh`(默认推送 `build/zh-locale/Client`,输入变化时先重新生成,符号链接按
|
||||
目标文件复制,并以 `locale_zh.cfg` 写入设备上的 `locale.cfg`)。
|
||||
|
||||
物品与怪物原型从 40250 原版解压,按线上 40250 服务端 `gb2312name` 的 VNUM 快照
|
||||
|
||||
Reference in New Issue
Block a user