From 7b2f8e608cdf9c09a2bf724107ecd3bffa20052c Mon Sep 17 00:00:00 2001 From: qiyinxi Date: Sun, 29 Nov 2026 19:01:35 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=87=E6=A1=A3=E7=AB=99=E8=A1=A5?= =?UTF-8?q?=E4=B8=8A=200.44.0=20=E7=94=A8=E6=88=B7=E7=9C=8B=E5=BE=97?= =?UTF-8?q?=E8=A7=81=E7=9A=84=E5=8F=98=E5=8C=96=EF=BC=9A=E5=9B=BE=E5=BD=A2?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E4=BC=98=E5=8C=96=E5=92=8C=E9=80=80=E8=B7=AF?= =?UTF-8?q?=E3=80=81=E7=AE=A1=E7=90=86=E5=99=A8=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E3=80=81InstallerX-Revived=E3=80=81KernelSU=EF=BC=88=E5=AE=9E?= =?UTF-8?q?=E9=AA=8C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs ModAVD/ModAVD#254 Refs ModAVD/ModAVD#285 Refs ModAVD/ModAVD#294 Refs ModAVD/ModAVD#124 --- docs/components/bridge.md | 11 +++++ docs/components/manager.md | 81 +++++++++++++++++++++++++++++++++-- docs/develop/adapt-game.md | 2 +- docs/en/components/bridge.md | 11 +++++ docs/en/components/manager.md | 81 +++++++++++++++++++++++++++++++++-- docs/en/develop/adapt-game.md | 2 +- docs/en/guide/changes.md | 25 +++++++++-- docs/en/guide/license.md | 10 +++++ docs/en/guide/playstore.md | 1 + docs/en/guide/upgrade.md | 4 +- docs/guide/changes.md | 25 +++++++++-- docs/guide/license.md | 10 +++++ docs/guide/playstore.md | 1 + docs/guide/upgrade.md | 4 +- 14 files changed, 248 insertions(+), 20 deletions(-) diff --git a/docs/components/bridge.md b/docs/components/bridge.md index bf69dee..3e75055 100644 --- a/docs/components/bridge.md +++ b/docs/components/bridge.md @@ -23,6 +23,17 @@ x86_64 镜像靠 Google 的转译层跑 arm64 应用:系统库保持原生 x86 - 装好以后照常开机就行(管理器、命令行或 AUTO-MAS 都可以),桥一直在。 - 只用 AUTO-MAS 开机、从没用管理器开过的实例,这一版还不会自动装:用管理器把它开一次机就行。 - 桥装在实例自己的 system / vendor 覆盖层里,不动 Google 的原始镜像。 +- 升级整包后,桥的文件和新包里的不一样时,下次由管理器或命令行开机时自动更新,多冷启动一次。 +- 0.44.0 修了只有 arm64 版本的游戏起子进程时,子进程偶尔卡死或崩溃的问题。 + +## 系统安装器换成 InstallerX-Revived + +0.44.0 起,有执行桥的实例把安卓自带的应用安装器换成 [InstallerX-Revived](https://github.com/wxxsfxyzm/InstallerX-Revived)(26.09,上游原包,包里是 `components\installerx-revived.apk`),装在执行桥的可写系统覆盖层里。原来的安装器更新完应用时,弹窗只显示类名和默认图标;换了以后正常。 + +- 新建的实例在装桥那次冷启动里一起装上,不多开机。 +- 已有的实例,升级到 0.44.0 后第一次由管理器或命令行开机时装上,多冷启动一次;桥要更新时也在同一次里做。 +- 它是系统里唯一的安装器,安卓「设置」里它的「停用」按钮是灰的:停用了,下次冷启动安卓就起不来。 +- 没有执行桥的实例(`--no-bridge`)照旧用安卓自带的安装器。 ## 不想要桥 diff --git a/docs/components/manager.md b/docs/components/manager.md index 2f31122..e7f68f7 100644 --- a/docs/components/manager.md +++ b/docs/components/manager.md @@ -15,6 +15,10 @@ ModAVD 0.36.0 起包里带两个管理程序,源码在 [ModAVDManager](https:/ - 功能:实例卡片(在线时有画面缩略图)、开关机(带进度)、新建、设置、删除、电脑检查、[组件与问题反馈](#组件与问题反馈)(管理器 0.3.0 起)、活动面板、画面查看(点击即点按,返回 / 主页 / 最近任务)、日志、安装 APK、打开目录;浅色 / 深色 / 跟随系统。管理器 0.4.0 起还有[按应用走代理](./app-proxy)。 - 管理器开机一律带窗口。无头只从命令行开(`start ` 默认无头,MCP 的 `start_instance` 也是),给 AUTO-MAS 这类自动化用;管理器里不提供无头开机。无头运行的实例在卡片上标「无头」,也能在这里关机。 +- **开机画面**(0.44.0 起,只有 Windows):带窗口开机时,模拟器窗口一出来就盖上一层开机画面,显示进度和正在做哪一步,开机后的设置做完才撤。这期间模拟器的画面和工具栏点不到,键盘也进不了;窗口照样能挪、能缩放、能用老板键藏起来。无头开机没有这层画面。 +- **「运行中」**(0.44.0 起):安卓开完、开机后的设置也做完,卡片才显示「运行中」,设置期间是「开机中」。设置最多等 60 秒,到点也算「运行中」,设置接着做完。命令行和 MCP 的状态也是这样(`online` / `starting`)。 +- 装了 [Google Play 商店](../guide/playstore)的实例(0.44.0 起),卡片上名字后面有一个购物袋图标,悬停显示「已装 Google Play 商店」;命令行 `list` 的「备注」一栏也写这一句。 +- 实例默认关掉安卓的通知提示音(0.44.0 起),通知照常显示。每台实例只关一次,之后在安卓设置里改回的不会再被关掉。 - 一个根目录只开一个服务,再双击只是把窗口重新打开;日志在 `<根>\logs\modavd-ui.log`。 - 关掉窗口后,等正在跑的任务做完再退出。管理器 0.8.0 起的 Windows 版改成留在托盘,见下。 @@ -40,6 +44,74 @@ ModAVD 0.36.0 起包里带两个管理程序,源码在 [ModAVDManager](https:/ - 右键菜单有「打开管理器」「退出」。退出前先把藏着的窗口都显示出来,有任务在跑就等它做完。 - 老板键由管理器注册,所以只用 AUTO-MAS、从来不开管理器的,没有老板键。开一次管理器,让它留在托盘就有了。 +### 应用保活 + +0.44.0 起,实例「设置」里有「应用保活」开关,下次开机生效。 + +- 默认关:第三方应用离开前台满 60 秒,ModAVD 就把它结束;中途切回前台就取消计时。桌面、当前输入法、系统应用和谷歌服务不受影响。 +- 打开:后台的应用一直留着。要让游戏在后台接着下载、接着跑,就打开它。 +- 命令行是 `set --app-keepalive on|off`,MCP 的 `update_instance` 用 `app_keepalive`。 + +### 开机时打开应用 + +0.44.0 起,开机可以带一个应用的包名,开完机就打开它,适合做「开机直接进游戏」的桌面快捷方式。 + +- 管理器:`ModAVD.exe --start <编号> --launch <包名>`,带窗口开这台实例,开好后打开应用。管理器已经开着时,交给开着的那个去做。 +- 命令行:`start --launch <包名>`。 +- MCP:`start_instance` 的 `launch` 参数。 +- 也可以写成 `包名/Activity`,直接打开那个 Activity。应用没装或打不开时,实例照常开着,只在结果里报出来。 + +### 从 MuMu 或雷电导入游戏 + +0.44.0 起,只有 Windows。 + +1. 先把要导入到的 ModAVD 实例开机(没有就先新建一台)。 +2. 在这台实例的「更多操作」里点「从模拟器导入游戏…」,选 MuMu 或雷电的源实例和游戏。源实例没开时会按需开起来。 +3. 勾选游戏,会复制安装包(包括所有拆分 APK)和 OBB。要带上已经下好的资源,展开 Android/data,勾资源文件或目录;账号、存档和设置不要勾。 +4. 导入期间两边都别开着这个游戏。做完可以自己关掉源实例。 + +- 游戏可能还要补下一部分资源;登录要在 ModAVD 里的游戏中重新登。 +- 雷电同时装了 14 和 9 时,先读 14。 +- 命令行:`game-sources` 列出 MuMu、雷电实例,`game-apps <类型> <源>`、`game-files <类型> <源> <包名> [路径]` 看应用和资源,`import-game <类型> <源> <目标> <包名> [--data 路径]` 导入。类型是 `mumu` 或 `ldplayer`,`--data` 可以写多次。比如把雷电 1 号实例里《明日方舟》下好的资源导入已开机的 ModAVD 2 号实例:`modavd import-game ldplayer 1 2 com.hypergryph.arknights --data files/Bundles`。 + +### 开着带反作弊的游戏时开不了机 + +Windows 拒绝创建虚拟机时(模拟器日志里是 `WHPX: Failed to setup partition, hr=80070005`),0.44.0 起开机的报错会说明原因:多半是电脑上开着带内核级反作弊的游戏(比如用 EA AntiCheat 的),或者安全软件在拦。 + +- 先退出这个游戏,它的反作弊后台服务还在的话也关掉,再开机,不用重启电脑。 +- 没开这类游戏的,看看安全软件有没有拦着虚拟化。 +- 命令行 `--json` 的错误里,`details.reason` 是 `hypervisor_access_denied`。 + +## KernelSU(实验) {#kernelsu} + +0.44.0 起。KernelSU 让安卓里的应用拿到 root,还能装 KernelSU 模块。ModAVD 只给你选的那一台实例启用:给它单独生成一份带 KernelSU 的启动镜像(ramdisk),不改全局的系统镜像,别的实例不受影响。只支持 Windows x86_64 上的 Android 14(API 34)镜像。 + +### 启用 + +1. 补全组件:在管理器「电脑检查」的「KernelSU 组件(实验)」一项点「下载 KernelSU 组件」,或运行 `tools\modavd.exe components fetch --kernelsu`。 + - 下的是五个文件:内核模块 `kernelsu.ko`,以及 `ksuinit`、`ksud`、`KernelSU.apk`、`meta-overlayfs.zip`,每个都按写死的大小和 SHA-256 核对,放在根目录的 `sdk\kernelsu\`。 + - 已经有这五个文件的,点「导入 KernelSU 文件…」,或运行 `components import-ksu <文件或文件夹>…`。自己编的 `kernelsu.ko` 还要带 `--lkm-sha256 `,并且要和内核版本完全对上。 +2. 在实例的「更多操作」里点「启用 KernelSU(实验)…」。确认后管理器把这台实例冷启动两次,激活模块系统;第一次启用时可能先用原版镜像检查一次客体数据。实例原来关着的,做完再关上。命令行是 `ksu install`,`ksu status` 看状态。 +3. 导入模块:在「更多操作」里点「导入 KernelSU 模块…」,可以一次选几个 `.zip`,按依赖顺序装好,冷启动一次生效。命令行是 `ksu module install … [--no-reboot]`,`ksu modules` 列出已装的,`ksu module remove [--no-reboot]` 移除。 + +### 风险 + +- 模块在安卓里以 root 运行,只用可信来源的。 +- 启用以后,客体原有的 root 痕迹还在,还会多出 KernelSU 管理器应用、内核模块等痕迹。游戏和应用可能检测到,有的游戏会因此拒绝运行或处罚账号。 + +### 已知问题 + +- 启用的实例每次关机会多等几秒(安卓关机时 `/data` 卸载超时),下次开机会多做一遍磁盘检查。验证时没有看到丢数据,原因还在查,见 [ModAVD/ModAVD#309](https://github.com/ModAVD/ModAVD/issues/309)。 +- 启用以后系统调用变慢(每次慢约 12–25%),这台实例的性能比不启用时低一些,对游戏帧率的影响还没量,见 [ModAVD/ModAVD#311](https://github.com/ModAVD/ModAVD/issues/311)。量性能、跑分时用没启用 KernelSU 的实例。 + +### 移除 + +- 在「更多操作」里点「移除 KernelSU…」,或运行 `ksu uninstall`,恢复原版启动。默认留着客体里的应用和数据。 +- 要连 KernelSU 专用的数据和应用一起清掉,勾上「同时清理管理器安装的 KernelSU 数据和应用(保留共享模块目录)」,或运行 `ksu uninstall --purge --yes`。 +- 启用后开不了机时,先关机,再照上面移除。 + +内核模块来自 [ModAVD/ModAVDKernelSU](https://github.com/ModAVD/ModAVDKernelSU/releases) 的正式发布,按 ModAVD 系统镜像的内核编译;另外四个文件取自 KernelSU 和 meta-overlayfs 的正式发布。这五个文件都不在整包里,用到时才下载。许可证见[许可证与源码](../guide/license#third-party-apps)。 + ## 组件与问题反馈 版本号提醒:下面写的「管理器 0.3.0 起」是 ModAVDManager 自己的版本(管理器和命令行共用一个版本号),和 ModAVD 整包的版本(如 0.38.2)是两套编号;整包里带的是哪一版管理器,见整包的发布说明。 @@ -68,14 +140,17 @@ modavd [--root <目录>] [--json] [--quiet] [--verbose] <命令> [参数] | `list` | 全部实例和状态 | | `info ` / `status ` | 一台实例的详细信息 / 状态 | | `create [--index N] [--title T] [--memory 6G] [--cpu N] [--data-gb N] [--fps 30\|60] [--resolution 1080\|720] [--no-bridge]` | 新建。默认带 arm64 执行桥,第一次开机时装上 | -| `set [--title T] [--memory M] [--cpu N] [--fps F] [--resolution 1080\|720] [--data-gb N] [--boss-key 组合\|none]` | 修改,下次开机生效。`--data-gb` 只能改大,游戏数据不动。`--boss-key` 是[老板键](#老板键和托盘),马上生效 | +| `set [--title T] [--memory M] [--cpu N] [--fps F] [--resolution 1080\|720] [--data-gb N] [--app-keepalive on\|off] [--boss-key 组合\|none]` | 修改,下次开机生效。`--data-gb` 只能改大,游戏数据不动。`--app-keepalive`(0.44.0 起)是[应用保活](#应用保活)。`--boss-key` 是[老板键](#老板键和托盘),马上生效 | | `delete --yes` | 删除已关机的实例,连同游戏数据 | -| `start [--window \| --headless] [--timeout 300] [--no-bridge]` | 开机,默认无头;`--window` 带窗口,`--headless` 明确要求无头。等开完并做完开机后的设置 | +| `start [--window \| --headless] [--timeout 300] [--no-bridge] [--launch 包名[/Activity]]` | 开机,默认无头;`--window` 带窗口,`--headless` 明确要求无头。等开完并做完开机后的设置。`--launch`(0.44.0 起)开好后[打开这个应用](#开机时打开应用) | | `stop [--force]`、`stop --all` | 关机:先让安卓正常关机,不成再 sync + kill;`--force` 是 sync + 强杀 | | `bridge install\|uninstall\|verify` | 装、卸、检查 arm64 执行桥 | | `proxy [on\|off\|test] [--server URL\|auto] [--add 包名] [--remove 包名] [--apps 包名]` | 管理器 0.4.0 起:[按应用走代理](./app-proxy),名单里的应用走代理,其余直连 | | `check [--memory M]` | 开机前的电脑检查 | | `components [status]`、`components source [auto\|googledownloads_cn\|tencent\|google]`、`components fetch [--accept-license] [--keep-downloads]` | 管理器 0.3.0 起:查看组件状态、选下载源、补全 Google 组件。`fetch` 先显示许可协议,输入 `y` 才下载;`--json` 时必须带 `--accept-license`。只有 Windows 有组件清单,其他系统返回 `unsupported` | +| `components fetch --kernelsu`、`components import-ksu <文件或文件夹>… [--lkm-sha256 S]` | 0.44.0 起:下载或导入 [KernelSU](#kernelsu) 的五个组件文件 | +| `ksu install\|uninstall [--purge --yes]\|status\|modules`、`ksu module install … [--no-reboot]`、`ksu module remove [--no-reboot]` | 0.44.0 起:给这台实例启用、移除、查看 [KernelSU](#kernelsu),导入、移除模块 | +| `game-sources`、`game-apps <类型> <源>`、`game-files <类型> <源> <包名> [路径]`、`import-game <类型> <源> <目标> <包名> [--data 路径]` | 0.44.0 起:[从 MuMu 或雷电导入游戏](#从-mumu-或雷电导入游戏) | | `collect-info [--out-dir D] [--no-explorer]` | 管理器 0.3.0 起:收集问题信息,生成 zip,默认放桌面并在资源管理器里选中 | | `report-config [--no-clipboard]` | 管理器 0.3.0 起:复制配置信息,默认复制到剪贴板 | | `window show\|hide` | 显示 / 隐藏带窗口开机的实例;无头实例没有窗口。管理器里用[老板键](#老板键和托盘) | @@ -100,7 +175,7 @@ AUTO-MAS 的两档配套见 [AUTO-MAS#1837](https://github.com/AUTO-MAS-Project/ modavd mcp --root D:\ModAVD ``` -工具:`list_instances`、`get_instance`、`check_host`、`create_instance`、`update_instance`、`delete_instance`、`start_instance`(带进度)、`stop_instance`、`set_window_visible`、`shell`、`install_apk`。管理器 0.4.0 起还有 `get_app_proxy`、`set_app_proxy`([按应用走代理](./app-proxy))。 +工具:`list_instances`、`get_instance`、`check_host`、`create_instance`、`update_instance`、`delete_instance`、`start_instance`(带进度)、`stop_instance`、`set_window_visible`、`shell`、`install_apk`。管理器 0.4.0 起还有 `get_app_proxy`、`set_app_proxy`([按应用走代理](./app-proxy))。0.44.0 起 `start_instance` 多了可选参数 `launch`([开机时打开应用](#开机时打开应用)),`update_instance` 多了 `app_keepalive`([应用保活](#应用保活))。 在 Claude Code 里注册(PowerShell 里 `--` 要加引号,否则会被吞掉): diff --git a/docs/develop/adapt-game.md b/docs/develop/adapt-game.md index 9a78e50..4fc9dc0 100644 --- a/docs/develop/adapt-game.md +++ b/docs/develop/adapt-game.md @@ -34,7 +34,7 @@ | 原因 | 先试(不用重新编译) | 真要改的话改哪 | |---|---|---| | 只有 arm64,崩在转译层或刚启动就退 | 让执行桥临时对它生效:先确认实例装好了桥,再 `shell su 0 setprop modavd.gate.target <包名>`,然后冷启动游戏。这个属性会整体替换名单,不持久,客体重启就没了。看 logcat 里有没有 `shim-ctor OK`、游戏能不能过 | 能过:PR 把包名加进 `bridge/companion/jni/native_to_guest_companion.cc` 的 `kDefaultGateTargets`。还是不行:这是转译层和执行桥的深水区,开 issue 附上 tombstone 和启动 logcat | -| 图形:黑屏、花屏、Vulkan 报错、设备丢失 | 两个默认关闭的环境变量开关(`ANDROID_EMU_VK_HIDE_REBAR=1`、`ANDROID_EMU_VK_ASTC_BC3=1`,见[和官方模拟器有什么不同](../guide/changes#graphics));在实例设置里换分辨率(1080p / DPI 280、720p / DPI 240 两档,下次开机生效);排查时可以用 `modavd bridge <编号> uninstall` 卸桥对比,卸桥会把 GL 传输恢复成原来的 | 模拟器本体的 gfxstream 补丁,见[模拟器本体](./emulator) | +| 图形:黑屏、花屏、Vulkan 报错、设备丢失 | 图形的环境变量开关(默认关的 `ANDROID_EMU_VK_HIDE_REBAR=1`;`ANDROID_EMU_VK_ASTC_BC3=0`、`ANDROID_EMU_ASG_AWAKE_SPIN_US=0` 关掉 0.44.0 起默认打开的两项,见[和官方模拟器有什么不同](../guide/changes#graphics));在实例设置里换分辨率(1080p / DPI 280、720p / DPI 240 两档,下次开机生效);排查时可以用 `modavd bridge <编号> uninstall` 卸桥对比,卸桥会把 GL 传输恢复成原来的 | 模拟器本体的 gfxstream 补丁,见[模拟器本体](./emulator) | | 卡顿、掉帧 | 按[卡顿、掉帧怎么查](./performance)先找到瓶颈在哪条线程、哪一段;再对比几个现成的开关:GL 传输 asg / pipe、`ANDROID_EMU_VK_HIDE_REBAR=1`、Vulkan 特性开关 | 瓶颈在图形往返:改本体的 gfxstream;在转译:开 issue 讨论;在游戏主线程本身:先接受,或调低画质 | | 检测到模拟器、root,或进游戏后被踢 | — | 不做。ModAVD 不绕过游戏的保护,也不改游戏文件。记下提示原文,开 issue 说明情况就行 | | 网络请求超时、热更新失败 | 换网络;查游戏数据目录里有没有 0 字节的文件(硬杀留下的) | 一般不在 ModAVD 里改 | diff --git a/docs/en/components/bridge.md b/docs/en/components/bridge.md index 3cadcc3..c92f356 100644 --- a/docs/en/components/bridge.md +++ b/docs/en/components/bridge.md @@ -23,6 +23,17 @@ A game's hardening library redirects the entry points of some functions in the s - Once it is installed, start instances as usual (from the manager, the CLI or AUTO-MAS); the bridge stays in place. - An instance that has only ever been started by AUTO-MAS and never by the manager is not installed automatically in this version: start it once with the manager. - The bridge is installed in the instance's own system / vendor overlay and does not touch Google's original image. +- After a package upgrade, if the bridge files differ from the ones in the new package, the bridge is updated automatically the next time the manager or the CLI starts the instance, with one extra cold boot. +- 0.44.0 fixed the occasional hang or crash of a child process started by a game that only has an arm64 build. + +## The system installer is replaced by InstallerX-Revived + +From 0.44.0, instances with the execution bridge replace Android's own package installer with [InstallerX-Revived](https://github.com/wxxsfxyzm/InstallerX-Revived) (26.09, the unmodified upstream build; `components\installerx-revived.apk` in the package), installed in the bridge's writable system overlay. The stock installer showed only a class name and the default icon in its dialog after an app update; with the replacement this shows correctly. + +- New instances get it in the same cold boot that installs the bridge, with no extra boot. +- Existing instances get it the first time the manager or the CLI starts them after the upgrade to 0.44.0, with one extra cold boot; a bridge update, if needed, happens in that same boot. +- It is the only installer in the system, so its “Disable” button in Android's settings is greyed out: if it were disabled, Android would not start on the next cold boot. +- Instances without the bridge (`--no-bridge`) keep Android's own installer. ## If you do not want the bridge diff --git a/docs/en/components/manager.md b/docs/en/components/manager.md index 50cde59..f850d1d 100644 --- a/docs/en/components/manager.md +++ b/docs/en/components/manager.md @@ -15,6 +15,10 @@ Double-click `ModAVD.exe` in the package root. It starts a local server that lis - Features: instance cards (with a screen thumbnail when the instance is online), start and stop (with progress), create, settings, delete, PC check, [components and feedback](#components-and-feedback) (since manager 0.3.0), activity panel, screen view (a click is a tap; Back / Home / Recents), logs, install APK, open folder; light / dark / follow system. Since manager 0.4.0 there is also the [per-app proxy](./app-proxy). - The manager always starts instances with a window. Headless starts are only on the command line (`start ` is headless by default, and so is MCP's `start_instance`), for automation such as AUTO-MAS; the manager has no headless start. A headless instance is marked “headless” on its card and can also be shut down here. +- **Boot screen** (from 0.44.0, Windows only): on a start with a window, a boot screen covers the emulator window as soon as it appears. It shows the progress and the current step, and stays until the post-boot setup is done. Meanwhile the emulator's screen and toolbar cannot be clicked and keyboard input does not reach it; the window can still be moved, resized and hidden with the boss key. A headless start has no boot screen. +- **“Running”** (from 0.44.0): the card shows “Running” only once Android has booted and the post-boot setup is done; during the setup it shows “Starting”. The setup is waited for at most 60 seconds; after that the instance counts as running and the setup carries on. The status in the CLI and MCP works the same way (`online` / `starting`). +- An instance with the [Google Play Store](../guide/playstore) installed (from 0.44.0) shows a shopping bag icon after its name on the card; hovering shows “Google Play Store installed”. The “Notes” column of `list` on the command line says the same. +- Instances have Android's notification sound off by default (from 0.44.0); notifications still show. It is turned off only once per instance, so if you turn it back on in Android's settings, it stays on. - One server runs per root folder; double-clicking again only reopens the window. The log is at `\logs\modavd-ui.log`. - After you close the window, it waits for the running tasks to finish before it exits. Since manager 0.8.0 the Windows manager stays in the tray instead; see below. @@ -40,6 +44,74 @@ Since manager 0.8.0, Windows only. - The right-click menu has “Open manager” and “Exit”. Exiting first shows the hidden windows, and waits for running tasks to finish. - The manager registers the boss keys, so if you only use AUTO-MAS and never open the manager, there are no boss keys. Open the manager once and leave it in the tray to get them. +### Keep background apps + +From 0.44.0, an instance's settings have a “Keep background apps” switch. It takes effect at the next boot. + +- Off (the default): when a third-party app has been out of the foreground for 60 seconds, ModAVD stops it; bringing the app back to the foreground before then cancels the timer. The launcher, the active keyboard, system apps and Google services are left alone. +- On: background apps stay. Turn it on if a game should keep downloading or running in the background. +- On the command line it is `set --app-keepalive on|off`; MCP's `update_instance` takes `app_keepalive`. + +### Opening an app at start + +From 0.44.0, a start can carry an app's package name and open that app once the instance is ready. This suits a desktop shortcut that starts an instance straight into a game. + +- Manager: `ModAVD.exe --start --launch ` starts that instance with a window and opens the app when it is ready. If the manager is already running, the running one does it. +- CLI: `start --launch `. +- MCP: the `launch` parameter of `start_instance`. +- You can also write `package/Activity` to open that activity directly. If the app is not installed or does not open, the instance stays running and only the result reports it. + +### Importing games from MuMu or LDPlayer + +From 0.44.0, Windows only. + +1. Start the ModAVD instance you want to import into (create one first if needed). +2. In that instance's “More actions”, click “Import games from an emulator…” and pick a MuMu or LDPlayer source instance and the game. A source instance that is not running is started when needed. +3. Ticking a game copies its installer (with all split APKs) and its OBB files. To bring resources it has already downloaded, expand Android/data and tick resource files or folders; do not tick accounts, saves or settings. +4. Keep the game closed on both sides while importing. When it is done you can close the source instance yourself. + +- The game may still have to download some resources; sign in again inside the game on ModAVD. +- When LDPlayer 14 and 9 are both installed, 14 is read first. +- CLI: `game-sources` lists MuMu and LDPlayer instances, `game-apps ` and `game-files [path]` show apps and resources, and `import-game [--data path]` imports. The type is `mumu` or `ldplayer`; `--data` can be given several times. For example, to import the downloaded *Arknights* resources from LDPlayer instance 1 into the running ModAVD instance 2: `modavd import-game ldplayer 1 2 com.hypergryph.arknights --data files/Bundles`. + +### An instance does not start while a game with anti-cheat is open + +When Windows refuses to create the virtual machine (the emulator log says `WHPX: Failed to setup partition, hr=80070005`), from 0.44.0 the start error says why: most likely a game with kernel-level anti-cheat (such as one that uses EA AntiCheat) is open on the computer, or security software is blocking it. + +- Quit that game, and close its anti-cheat background service too if it is still running, then start again. There is no need to restart the computer. +- If no such game is open, check whether security software is blocking virtualization. +- With `--json` on the command line, the error's `details.reason` is `hypervisor_access_denied`. + +## KernelSU (experimental) {#kernelsu} + +From 0.44.0. KernelSU gives apps in Android root access and can install KernelSU modules. ModAVD enables it only on the instance you choose: it builds a separate boot image (ramdisk) with KernelSU for that instance and leaves the shared system image alone, so other instances are not affected. Only the Android 14 (API 34) image on Windows x86_64 is supported. + +### Enabling it + +1. Get the components: in the manager's “System check”, click “Download KernelSU components” in the “KernelSU components (experimental)” item, or run `tools\modavd.exe components fetch --kernelsu`. + - It downloads five files: the kernel module `kernelsu.ko`, plus `ksuinit`, `ksud`, `KernelSU.apk` and `meta-overlayfs.zip`. Each one is checked against a built-in size and SHA-256, and they go into `sdk\kernelsu\` in the root folder. + - If you already have the five files, click “Import KernelSU files…” or run `components import-ksu …`. A `kernelsu.ko` you built yourself also needs `--lkm-sha256 ` and must match the full kernel version. +2. In the instance's “More actions”, click “Enable KernelSU (experimental)…”. After you confirm, the manager cold-boots the instance twice to activate the module system; the first time it may first check the guest data with the stock image. An instance that was shut down is shut down again afterwards. On the command line it is `ksu install`, and `ksu status` shows the state. +3. Import modules: in “More actions”, click “Import KernelSU modules…”. You can pick several `.zip` files at once; they are installed in dependency order and take effect after one cold boot. On the command line, `ksu module install … [--no-reboot]` installs, `ksu modules` lists the installed ones, and `ksu module remove [--no-reboot]` removes one. + +### Risks + +- Modules run as root in Android. Only use modules from sources you trust. +- With it enabled, the guest's existing root traces are still there, and there are more: the KernelSU manager app, the kernel module and so on. Games and apps may detect them, and some games refuse to run or penalize the account because of it. + +### Known issues + +- An instance with it enabled takes a few extra seconds to shut down each time (unmounting `/data` times out during Android's shutdown), and runs an extra disk check at its next start. No data loss was seen in testing; the cause is still being investigated, see [ModAVD/ModAVD#309](https://github.com/ModAVD/ModAVD/issues/309). +- With it enabled, system calls are slower (each about 12–25% slower), so the instance performs somewhat worse than without it. The effect on game frame rates has not been measured yet, see [ModAVD/ModAVD#311](https://github.com/ModAVD/ModAVD/issues/311). For performance measurements and benchmarks, use an instance without KernelSU. + +### Removing it + +- In “More actions”, click “Remove KernelSU…”, or run `ksu uninstall`, to go back to the stock boot. The apps and data in the guest are kept by default. +- To also clear the KernelSU data and app, tick “Remove the KernelSU data and app installed by Manager (keep the shared module directory)”, or run `ksu uninstall --purge --yes`. +- If the instance no longer starts after enabling it, shut it down, then remove it as above. + +The kernel module comes from the official releases of [ModAVD/ModAVDKernelSU](https://github.com/ModAVD/ModAVDKernelSU/releases), built for the kernel of ModAVD's system image; the other four files come from the official releases of KernelSU and meta-overlayfs. None of the five files is in the package; they are downloaded only when you use the feature. For licenses, see [Licenses and source code](../guide/license#third-party-apps). + ## Components and feedback A note on version numbers: "since manager 0.3.0" below is the version of ModAVDManager itself (the manager and the CLI share one version number). It is a different numbering from the ModAVD package version (such as 0.38.2); the package's release notes say which manager version it contains. @@ -68,14 +140,17 @@ modavd [--root ] [--json] [--quiet] [--verbose] [args] | `list` | All instances and their status | | `info ` / `status ` | Detailed information / status of one instance | | `create [--index N] [--title T] [--memory 6G] [--cpu N] [--data-gb N] [--fps 30\|60] [--resolution 1080\|720] [--no-bridge]` | Create an instance. It includes the arm64 execution bridge by default, installed on the first boot | -| `set [--title T] [--memory M] [--cpu N] [--fps F] [--resolution 1080\|720] [--data-gb N] [--boss-key combination\|none]` | Change settings; they take effect on the next start. `--data-gb` can only grow the disk; game data is untouched. `--boss-key` is the [boss key](#boss-keys-and-the-tray) and applies at once | +| `set [--title T] [--memory M] [--cpu N] [--fps F] [--resolution 1080\|720] [--data-gb N] [--app-keepalive on\|off] [--boss-key combination\|none]` | Change settings; they take effect on the next start. `--data-gb` can only grow the disk; game data is untouched. `--app-keepalive` (from 0.44.0) is [Keep background apps](#keep-background-apps). `--boss-key` is the [boss key](#boss-keys-and-the-tray) and applies at once | | `delete --yes` | Delete a shut-down instance together with its game data | -| `start [--window \| --headless] [--timeout 300] [--no-bridge]` | Start headless by default; `--window` starts with a window and `--headless` explicitly requests headless mode. Wait until boot and post-boot setup are complete | +| `start [--window \| --headless] [--timeout 300] [--no-bridge] [--launch package[/Activity]]` | Start headless by default; `--window` starts with a window and `--headless` explicitly requests headless mode. Wait until boot and post-boot setup are complete. `--launch` (from 0.44.0) then [opens that app](#opening-an-app-at-start) | | `stop [--force]`, `stop --all` | Shut down: first ask Android for a clean shutdown; if that fails, sync + kill. `--force` is sync + force-kill | | `bridge install\|uninstall\|verify` | Install, uninstall or check the arm64 execution bridge | | `proxy [on\|off\|test] [--server URL\|auto] [--add pkg] [--remove pkg] [--apps pkg]` | Since manager 0.4.0: the [per-app proxy](./app-proxy); the listed apps use the proxy, the others go direct | | `check [--memory M]` | PC check before starting | | `components [status]`, `components source [auto\|googledownloads_cn\|tencent\|google]`, `components fetch [--accept-license] [--keep-downloads]` | Since manager 0.3.0: show component status, choose the download source, fetch the Google components. `fetch` shows the license first and downloads only after you type `y`; with `--json` it requires `--accept-license`. Only Windows has a component list; other systems return `unsupported` | +| `components fetch --kernelsu`, `components import-ksu … [--lkm-sha256 S]` | From 0.44.0: download or import the five component files of [KernelSU](#kernelsu) | +| `ksu install\|uninstall [--purge --yes]\|status\|modules`, `ksu module install … [--no-reboot]`, `ksu module remove [--no-reboot]` | From 0.44.0: enable, remove or check [KernelSU](#kernelsu) on this instance, and import or remove modules | +| `game-sources`, `game-apps `, `game-files [path]`, `import-game [--data path]` | From 0.44.0: [import games from MuMu or LDPlayer](#importing-games-from-mumu-or-ldplayer) | | `collect-info [--out-dir D] [--no-explorer]` | Since manager 0.3.0: collect a problem report as a zip, placed on the desktop and selected in File Explorer by default | | `report-config [--no-clipboard]` | Since manager 0.3.0: copy the configuration info, to the clipboard by default | | `window show\|hide` | Show or hide the window of an instance started with one; headless instances have no window. In the manager, use the [boss key](#boss-keys-and-the-tray) | @@ -100,7 +175,7 @@ Choose the display preset in the manager’s create or instance settings form, w modavd mcp --root D:\ModAVD ``` -Tools: `list_instances`, `get_instance`, `check_host`, `create_instance`, `update_instance`, `delete_instance`, `start_instance` (with progress), `stop_instance`, `set_window_visible`, `shell`, `install_apk`. Since manager 0.4.0 also `get_app_proxy` and `set_app_proxy` (the [per-app proxy](./app-proxy)). +Tools: `list_instances`, `get_instance`, `check_host`, `create_instance`, `update_instance`, `delete_instance`, `start_instance` (with progress), `stop_instance`, `set_window_visible`, `shell`, `install_apk`. Since manager 0.4.0 also `get_app_proxy` and `set_app_proxy` (the [per-app proxy](./app-proxy)). From 0.44.0, `start_instance` has an optional `launch` parameter ([opening an app at start](#opening-an-app-at-start)) and `update_instance` has `app_keepalive` ([Keep background apps](#keep-background-apps)). To register it in Claude Code (in PowerShell, `--` must be quoted, or it gets swallowed): diff --git a/docs/en/develop/adapt-game.md b/docs/en/develop/adapt-game.md index 314c0ef..93e250c 100644 --- a/docs/en/develop/adapt-game.md +++ b/docs/en/develop/adapt-game.md @@ -34,7 +34,7 @@ Try approaches that need no recompiling first, and settle the direction before y | Cause | Try first (no recompiling) | Where to change it if you really have to | |---|---|---| | arm64-only; crashes in the translation layer or exits right after launch | Make the execution bridge take effect for it temporarily: first make sure the instance has the bridge installed, then run `shell su 0 setprop modavd.gate.target `, then cold-start the game. This property replaces the whole list, is not persistent, and is gone when the guest restarts. Check logcat for `shim-ctor OK` and whether the game gets through | If it gets through: send a PR that adds the package name to `kDefaultGateTargets` in `bridge/companion/jni/native_to_guest_companion.cc`. If it still fails: this is the deep end of the translation layer and the bridge; open an issue with the tombstone and the launch logcat | -| Graphics: black screen, garbled picture, Vulkan errors, device lost | Two environment-variable switches that are off by default (`ANDROID_EMU_VK_HIDE_REBAR=1`, `ANDROID_EMU_VK_ASTC_BC3=1`; see [How ModAVD differs from the official emulator](../guide/changes#graphics)); change the resolution in instance settings (1080p / DPI 280 or 720p / DPI 240, effective at the next boot); while investigating, you can uninstall the bridge with `modavd bridge uninstall` to compare, and uninstalling the bridge restores the GL transport to what it was | The emulator's gfxstream patches; see [the emulator itself](./emulator) | +| Graphics: black screen, garbled picture, Vulkan errors, device lost | The graphics environment-variable switches (`ANDROID_EMU_VK_HIDE_REBAR=1`, off by default; `ANDROID_EMU_VK_ASTC_BC3=0` and `ANDROID_EMU_ASG_AWAKE_SPIN_US=0` turn off the two items that are on by default from 0.44.0; see [How ModAVD differs from the official emulator](../guide/changes#graphics)); change the resolution in instance settings (1080p / DPI 280 or 720p / DPI 240, effective at the next boot); while investigating, you can uninstall the bridge with `modavd bridge uninstall` to compare, and uninstalling the bridge restores the GL transport to what it was | The emulator's gfxstream patches; see [the emulator itself](./emulator) | | Stutter and frame drops | Use [How to investigate stutter and frame drops](./performance) to find out which thread and which stage the bottleneck is in; then compare a few existing switches: GL transport asg / pipe, `ANDROID_EMU_VK_HIDE_REBAR=1`, and the Vulkan feature flags | If the bottleneck is the graphics round trip: change the emulator's gfxstream. If it is in translation: open an issue to discuss it. If it is in the game's own main thread: accept it, or lower the quality | | The game detects the emulator or root, or kicks you out after you enter the game | — | Do not do anything. ModAVD does not bypass the game's protection and does not change game files. Note the exact message text and open an issue describing the situation | | Network request timeout, hot update fails | Switch networks; check the game's data folder for 0-byte files (left behind by a hard kill) | Usually not something to change in ModAVD | diff --git a/docs/en/guide/changes.md b/docs/en/guide/changes.md index d005476..42f84bb 100644 --- a/docs/en/guide/changes.md +++ b/docs/en/guide/changes.md @@ -1,6 +1,6 @@ # How ModAVD differs from the official emulator -Below are the changes that affect users in the current version (`0.36.0`, build mas-36, based on Google's AOSP Android Emulator 37.2.10). For the individual patches, see [`patches/`](https://github.com/ModAVD/ModAVD/tree/main/patches) in the ModAVD repository. For the changes in each version, see the [Release notes](https://github.com/ModAVD/ModAVD/releases). +Below are the changes in ModAVD (based on Google's AOSP Android Emulator 37.2.10) that affect users. For the individual patches, see [`patches/`](https://github.com/ModAVD/ModAVD/tree/main/patches) in the ModAVD repository. For the changes in each version, see the [Release notes](https://github.com/ModAVD/ModAVD/releases). ## Nothing is sent out @@ -48,9 +48,26 @@ For details see [Privacy](./privacy). - Fixed render threads contending for the OpenGL context. Before, when a game switched videos, the YUV conversion shader could fail to compile and the whole emulator would exit. - When a program in Android adds extension structures that the host does not recognize (ray tracing, mesh shaders and so on) to a Vulkan query, the emulator no longer exits. *Arknights: Endfield* used to make the emulator exit as soon as it created a Vulkan device. - Fixed some compatibility problems in Vulkan descriptor template updates and OpenGL ES compute shaders, and a crash and several video memory leaks in the hardware video decoding (CUDA) path. -- Added two environment variable switches, both off by default: - - `ANDROID_EMU_VK_HIDE_REBAR=1`: reports the host's "video memory and host-visible" memory (NVIDIA ReBAR) to Android as video memory only; - - `ANDROID_EMU_VK_ASTC_BC3=1`: when emulating ASTC textures, decompresses them to BC3 (experimental). +- From 0.44.0, the ASTC textures used by Vulkan games (such as *Honkai: Star Rail* and *Arknights: Endfield*) are by default converted on the GPU into BC3, a compressed format the GPU supports directly, instead of all being decoded into uncompressed RGBA8. This saves about 0.2–0.4 GB of memory and video memory. Only the textures that are safe to convert are converted (2D, single-layer, plainly sampled SRGB colour textures); the rest are handled as before. The GPU is checked at startup, and GPUs that do not support it are left on the old path automatically. +- From 0.44.0, the graphics notification optimization for OpenGL ES games (such as *Arknights* and *Onmyoji*) is on by default: when the host thread that reads graphics commands finds none left, it waits a moment (200 microseconds by default) before sleeping, so the graphics thread in Android does not have to keep sending notifications to wake it, and uses less CPU inside Android. +- Environment variable switches: + - `ANDROID_EMU_VK_HIDE_REBAR=1` (off by default): reports the host's "video memory and host-visible" memory (NVIDIA ReBAR) to Android as video memory only; + - `ANDROID_EMU_VK_ASTC_BC3`: unset means the default described above; `0` turns it off, decoding all ASTC textures into RGBA8 (the default in 0.43.0 and earlier); `1` converts every ASTC texture into BC3 (experimental); + - `ANDROID_EMU_ASG_AWAKE_SPIN_US`: unset means 200; `0` turns the graphics notification optimization off. + +### Going back to the old behaviour when graphics or performance look wrong + +The two items above are on by default from 0.44.0. If you suspect one of them (for example, broken textures or wrong colours in a Vulkan game, or an OpenGL ES game that got slower), turn it off to compare: + +1. Shut down all instances and exit the manager (from the tray too). If you start instances with AUTO-MAS, close AUTO-MAS as well. +2. In Windows, open “Edit environment variables for your account” and add a user variable: + - for graphics problems in a Vulkan game: `ANDROID_EMU_VK_ASTC_BC3` with the value `0`; + - for problems in an OpenGL ES game: `ANDROID_EMU_ASG_AWAKE_SPIN_US` with the value `0`. +3. Open the manager (or AUTO-MAS) again, then start the instance. The variable has to be set before the manager starts; programs that are already running do not see the new value. +4. Check that it took effect in `logs\mas_-