Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelog.d/427.feat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Windows 画面弹窗直接绘制共享内存帧,支持 2–30 帧/秒,默认 15 帧/秒。
The Windows screen viewer draws shared-memory frames directly and supports 2–30 fps, with a default of 15 fps.
2 changes: 2 additions & 0 deletions changelog.d/429.change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
管理器的卡片缩略图和画面弹窗统一使用共享内存截图。
Manager thumbnails and the screen viewer use shared-memory capture.
6 changes: 5 additions & 1 deletion internal/i18n/locales/en/ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"实例 %d 截图失败: %s": "Instance %d screenshot failed: %s",
"实例 %d 截图的数据不是 PNG(%d 字节)": "The screenshot data of instance %d is not a PNG (%d bytes)",
"实例 %d 截图超时(%.0f 秒)": "Instance %d screenshot timed out (%.0f s)",
"实例 %d 本来就没开机": "Instance %d was not running",
"实例 %d 共享内存截图失败: %v": "Instance %d shared-memory capture failed: %v",
"实例 %d 正在%s(任务 %s),等它做完再试": "Instance %d is busy (%s, task %s). Try again when it finishes",
"实例 %d 正在%s,一台实例都没关": "Instance %d is busy (%s); no instance was shut down",
"实例 %d 正在%s,等它做完再试": "Instance %d is busy (%s). Try again when it finishes",
Expand Down Expand Up @@ -171,6 +171,10 @@
"当前平台暂不支持打开目录或浏览器": "Opening a folder or browser is not supported on this platform yet",
"当前平台暂不支持窗口操作": "Window operations are not supported on this platform yet",
"当前平台没有托盘图标和老板键": "This platform has no tray icon or boss key",
"取不到画面": "Cannot get the screen",
"实例 %d ADB 截图失败: %v": "Instance %d ADB screenshot failed: %v",
"实例 %d 本来就没开机": "Instance %d was already stopped",
"到顶栏「组件」检查共享内存截图组件和设置": "Open Components in the top bar to check shared-memory screenshots and their settings",
"截图的显示尺寸读不出": "Cannot read the display size of the screenshot",
"打不开管理器窗口: %v": "Cannot open the manager window: %v",
"打开实例文件夹要给 index": "index is required to open an instance folder",
Expand Down
5 changes: 3 additions & 2 deletions internal/i18n/locales/en/web.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"原因未知": "reason unknown",
"去掉几个再保存": "Remove some, then save",
"取不到画面": "Cannot get the screen",
"画面的像素数据不完整": "The screen frame has incomplete pixel data",
"取消": "Cancel",
"取消复制": "Cancel copy",
"取消整理": "Cancel compacting",
Expand Down Expand Up @@ -247,7 +248,8 @@
"实例运行中,内存、CPU、帧率、分辨率、DPI、数据盘和声音在下次开机生效。诊断设置立即生效。": "The instance is running. Memory, CPU, frame rate, resolution, DPI, data disk and sound take effect at the next start; the diagnostics setting takes effect at once.",
"实例里没有装别的应用": "No other apps are installed in the instance",
"实例里的 Google 服务框架联网登记后才有:开着网等一两分钟,再试一次。": "It exists once Google Services Framework in the instance has registered online: stay online for a minute or two, then try again.",
"实时 · 约 2 帧/秒": "Live · about 2 frames/s",
"目标 {fps} 帧/秒": "Target: {fps} fps",
"目标帧率": "Target frame rate",
"实时画面,可以点按": "Live screen, you can tap it",
"实时跟随": "Follow live",
"实验功能,要用的话在实例的「更多操作」菜单里开启": "Experimental. To use it, turn it on from the instance's “More actions” menu",
Expand Down Expand Up @@ -488,7 +490,6 @@
"没有导入:{reason}": "Not imported: {reason}",
"没有成功": "Failed",
"没有找到 MuMu 或雷电实例": "No MuMu or LDPlayer instances found",
"没有画面": "No screen",
"没有移除干净,可以再移除一次": "It was not fully removed; you can remove it again",
"没有第三方应用": "No third-party apps found",
"没能先保存数据就关掉了": "It was stopped without saving the data first",
Expand Down
5 changes: 3 additions & 2 deletions internal/ui/API.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ GET `/api/keymap/vendor-sources?vendor=ldplayer` lists installations. Add `sourc

| Method | Path | Request | Response |
| --- | --- | --- | --- |
| GET | `/api/info` | | `{"version","protocol","root":RootInfo}` |
| GET | `/api/info` | | `{"version","protocol","root":RootInfo,"live_screenshots":bool}` |
| GET | `/api/locale` | | `{"language","preference","system","languages":[{code,name}],"messages"}`: the language the manager shows now (`zh-CN` / `en`), the one chosen in the settings (`auto` follows the system), what `auto` picks, the languages on offer, and the translations of the page's own strings (keyed by the Chinese text; `{}` in Chinese). Text the back end sends to the page (errors, progress, logs, check items) is already translated into `language`; the CLI's `--json`, MCP, logs and problem reports are not translated and stay Chinese |
| PUT | `/api/locale` | `{preference: "auto"\|"zh-CN"\|"en"}` | as above; saved for this Windows user in `%LOCALAPPDATA%\ModAVD\language.json` (the CLI follows it too); the manager switches at once and the page reloads |
| GET | `/api/theme` | | `{"preference","saved"}`: the interface theme (`system` follows the system, `light`, `dark`); `saved` is `false` while none has been saved (it reads as `system`), and the page then moves its browser's old choice over once |
Expand All @@ -70,7 +70,8 @@ GET `/api/keymap/vendor-sources?vendor=ldplayer` lists installations. Add `sourc
| POST | `/api/instances/{i}/gles32-off` | `{}` | 202 `Job` (`kind` is `gles32-off`): removes the line written above; after a cold boot the instance reports 3.1 again (same as `gles32 <i> off`); the result is a `GLES32Result`. The checks are the same as for `gles32-on` |
| GET | `/api/instances/{i}/playstore-gsfid` | | `{"index","decimal","hex"}`: the GSF ID of a running instance (same as `modavd playstore <i> gsfid --json`; the decimal form is what GSF records, the hex form is the same number, with negative numbers in two's complement); takes a few seconds. Used to register at https://www.google.com/android/uncertified/. If the instance is not running (according to the latest list) or a job is running on it, it is 409 `busy`; if there is no ID yet it is 422 `not_ready` with `details.reason` `no_gsf_id` (stay online for a minute or two and try again) |
| POST | `/api/instances/{i}/input` | `{type:"tap", x, y}` (the coordinates are in the pixels this instance displays (1280×720 or 1920×1080, with width and height swapped in portrait)) or `{type:"key", key:"back"\|"home"\|"recents"}` | `{}` |
| GET | `/api/instances/{i}/screenshot` | | `image/png` in the current display orientation (a shared-memory frame is turned by the instance's orientation setting while the guest's rotation is not known yet), `X-Shot-Source: shm` for shared memory or `adb` for `adb exec-out screencap -p`, `Cache-Control: no-store`; 409 if the instance is not running |
| GET | `/api/instances/{i}/screenshot` | Optional query `after` with the previous `X-Shot-Frame` value (empty on the first live request) | On Windows, shared-memory `image/png` in the current display orientation and `X-Shot-Frame` when available. 204 when the requested frame is unchanged, 409 when not booted, or an error when shared memory is unavailable. `Cache-Control: no-store`. Uses the instance orientation setting until the guest rotation is known. macOS uses adb capture. |
| GET | `/api/instances/{i}/screenshot?format=rgba` | Windows screen viewer, with the same optional `after` query | `application/octet-stream` with shared-memory RGBA pixels in their original row order. `X-Shot-Width` and `X-Shot-Height` are the raw pixel dimensions, `X-Shot-Stride` is the row size in bytes, and `X-Shot-Rotation` is the counterclockwise rotation in degrees (0, 90, 180, 270). When available, `X-Shot-Frame` includes rotation. 204 for an unchanged frame, 409 when not booted, or an error when shared memory is unavailable. |
| GET | `/api/instances/{i}/log?kind=emulator\|logcat&lines=300` | | `text/plain; charset=utf-8`, the tail of the newest log; 404 if there is none |
| GET | `/api/instances/{i}/proxy` | | `ProxyView`, see below |
| PUT | `/api/instances/{i}/proxy` | `{enabled?: bool, server?: string, apps?: [string]}` | `ProxyView`: the items given are replaced with the new values, the ones not given stay unchanged; giving no item at all returns 400 `usage`. `server` may omit the protocol (it is detected) or be `auto` (take this computer's proxy settings); when it is turned on for the first time without an address, `auto` is used as well. If the address cannot be probed, 502 `proxy_unavailable`. If the instance is running, it takes effect immediately and returns within a few seconds |
Expand Down
5 changes: 3 additions & 2 deletions internal/ui/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ GET `/api/keymap/vendor-sources?vendor=ldplayer` 列出安装,带 `sourceInsta

| 方法 | 路径 | 请求 | 返回 |
| --- | --- | --- | --- |
| GET | `/api/info` | | `{"version","protocol","root":RootInfo}` |
| GET | `/api/info` | | `{"version","protocol","root":RootInfo,"live_screenshots":bool}` |
| GET | `/api/locale` | | `{"language","preference","system","languages":[{code,name}],"messages"}`:管理器现在用的语言(`zh-CN` / `en`)、设置里选的(`auto` 是跟随系统)、跟随系统时会选哪种、可选的语言,以及页面自己那部分字符串的译文(键是中文原文,中文时是 `{}`)。后端发给页面的文字(错误、进度、日志、检查项)已经按 `language` 翻好;命令行 `--json`、MCP、日志和问题包不翻,照旧是中文 |
| PUT | `/api/locale` | `{preference: "auto"\|"zh-CN"\|"en"}` | 同上;记进这个 Windows 用户的 `%LOCALAPPDATA%\ModAVD\language.json`(命令行也按它选),管理器马上换语言,页面随后重新加载 |
| GET | `/api/theme` | | `{"preference","saved"}`:界面主题(`system` 跟随系统 / `light` / `dark`),`saved` 是 `false` 时还没存过(按 `system`),页面会把自己浏览器里旧的选择搬过来一次 |
Expand All @@ -70,7 +70,8 @@ GET `/api/keymap/vendor-sources?vendor=ldplayer` 列出安装,带 `sourceInsta
| POST | `/api/instances/{i}/gles32-off` | `{}` | 202 `Job`(`kind` 是 `gles32-off`):去掉上面写进去的行,冷启动后实例改回报 3.1(同 `gles32 <i> off`);结果是 `GLES32Result`。检查同 `gles32-on` |
| GET | `/api/instances/{i}/playstore-gsfid` | | `{"index","decimal","hex"}`:开着的实例的 GSF ID(同 `modavd playstore <i> gsfid --json`;十进制是 GSF 记的,十六进制是同一个数,负数按补码),几秒钟。用来到 https://www.google.com/android/uncertified/ 登记。没开机(按最近的列表)或实例上有任务在跑是 409 `busy`;还没有 ID 是 422 `not_ready`,`details.reason` 为 `no_gsf_id`(开着网等一两分钟再试) |
| POST | `/api/instances/{i}/input` | `{type:"tap", x, y}`(坐标是这台实例显示的像素(1280×720 或 1920×1080,竖屏时宽高对调))或 `{type:"key", key:"back"\|"home"\|"recents"}` | `{}` |
| GET | `/api/instances/{i}/screenshot` | | 当前显示方向的 `image/png`(共享内存的帧在客体方向暂时读不到时按实例设置的方向转),`X-Shot-Source` 为 `shm`(共享内存)或 `adb`(`adb exec-out screencap -p`),`Cache-Control: no-store`;没开机回 409 |
| GET | `/api/instances/{i}/screenshot` | 可选查询参数 `after`,填上次返回的 `X-Shot-Frame`,实时取图的首次请求留空 | Windows 上共享内存的当前方向 `image/png` 和帧标识 `X-Shot-Frame`(可用时)。帧没变回 204,没开机回 409,共享内存不可用时报错。`Cache-Control: no-store`。读到客体方向前按实例设置的方向转。macOS 仍使用 adb 截图。 |
| GET | `/api/instances/{i}/screenshot?format=rgba` | Windows 画面弹窗使用,可选 `after` 同上 | `application/octet-stream`,共享内存的 RGBA 像素,按原始行顺序发送。响应头 `X-Shot-Width`、`X-Shot-Height` 是原始像素尺寸,`X-Shot-Stride` 是每行字节数,`X-Shot-Rotation` 是逆时针旋转角度(0、90、180、270)。`X-Shot-Frame`(可用时)包括方向,帧没变回 204。未开机回 409,共享内存不可用时报错。 |
| GET | `/api/instances/{i}/log?kind=emulator\|logcat&lines=300` | | `text/plain; charset=utf-8`,最新那份日志的末尾;没有回 404 |
| GET | `/api/instances/{i}/proxy` | | `ProxyView`,见下 |
| PUT | `/api/instances/{i}/proxy` | `{enabled?: bool, server?: string, apps?: [string]}` | `ProxyView`:给出的项换成新值,没给的不变;一项都没给回 400 `usage`。`server` 可以不写协议(探测出来)或写 `auto`(取这台电脑的代理设置);第一次打开没给地址也按 `auto`。地址探测不到回 502 `proxy_unavailable`。实例开着就马上生效,几秒内回 |
Expand Down
2 changes: 1 addition & 1 deletion internal/ui/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type backend interface {
// GLES32 is `modavd gles32 <i> on|off|status`; GLES32Check what it refuses before touching the instance (no bridge ...).
GLES32(ctx context.Context, i int, action string) (*emu.GLES32Result, error)
GLES32Check(i int, action string) error
// AdbRun is Manager.ADB.Run (the screenshot: exec-out screencap -p with Raw).
// AdbRun supports screenshot capture on hosts without ModAVDExtras.
AdbRun(ctx context.Context, opt adb.RunOptions, args ...string) adb.Result
// Serial is instance i's adb serial in the root's port plan.
Serial(i int) string
Expand Down
Loading
Loading