注入实现刻意**不用** SendInput(MOUSEEVENTF_MOVE):实测该路径的 dx 不是 像素而是 mickey,会被「指针加速」与「DPI 缩放」双重放大——本机 dx=1 走 0px、 dx=20 走 41px、dx=100 走 309px,且倍率随用户系统设置与机器变化,无法标定。 改为「GetCursorPos + 增量 + clamp + 绝对注入」,实测 1:1 精确(±1/2/3/5/17/100 四次重复全部等于请求值),撞边后回滑立即响应、不积步数债。 同时显式设 PER_MONITOR_AWARE_V2:实测本机 agent.exe 虽是 per-monitor, 但那是注册表 AppCompatFlags\\Layers 里一条**路径绑定**的 HIGHDPIAWARE 覆盖 造成的(同一 exe 复制到 %TEMP% 启动即变 UNAWARE),换机器/换构建路径即失效。 UNAWARE 时 GetCursorPos 返回逻辑坐标(1536x864)而采集是物理像素(1920x1080), clamp 上界与增量尺度都会错。设置失败时区分「已被外部设定」与「真正降级」并分别报日志。
31 lines
1.1 KiB
TOML
31 lines
1.1 KiB
TOML
[package]
|
||
name = "agent"
|
||
version = "0.1.0"
|
||
edition = "2021"
|
||
|
||
[dependencies]
|
||
common = { path = "../common" }
|
||
anyhow.workspace = true
|
||
tokio.workspace = true
|
||
quinn.workspace = true
|
||
rustls.workspace = true
|
||
rcgen.workspace = true
|
||
lz4_flex.workspace = true
|
||
openh264 = { version = "0.9.9", features = ["source"] }
|
||
# 上游 nvenc 0.1.0 的 encode_picture 只设 picture_type=IDR、不置 FORCEIDR 标志,
|
||
# 导致运行期 KeyFrameReq 被编码器静默忽略(实测输出 NAL type=1 而非 5)。
|
||
# vendor 版本补上了该标志,见 vendor/nvenc/src/safe/encoder.rs 的「本项目补丁」注释。
|
||
nvenc = { path = "../vendor/nvenc" }
|
||
windows = { workspace = true, features = [
|
||
"Win32_Foundation",
|
||
"Win32_Graphics_Direct3D",
|
||
"Win32_Graphics_Direct3D11",
|
||
"Win32_Graphics_Dxgi",
|
||
"Win32_Graphics_Dxgi_Common",
|
||
"Win32_UI_Input_KeyboardAndMouse",
|
||
"Win32_UI_WindowsAndMessaging",
|
||
# SetProcessDpiAwarenessContext:相对鼠标的 GetCursorPos 必须与采集同为物理像素,
|
||
# 不能依赖注册表 AppCompat 覆盖(见 3b 开工实测 §4)。
|
||
"Win32_UI_HiDpi",
|
||
] }
|