MFABD2 icon indicating copy to clipboard operation
MFABD2 copied to clipboard

fix(PC): 鼠标方法根因 + 红点检测器PC参数 + 主页ROI偏移修复(NT-Suport, 真机实测)

Open BebopSpikeSpiegel opened this issue 5 months ago • 5 comments

基于 feat/NT-Suport (cc007ca),针对 PC 原生客户端适配的若干修复与发现。 全部经真机实测:MFA(PC客户端控制器,1080p→short_side 720) + maa-mcp(connect_window 单步/采样)。 非完整移植,主要是地基性发现 + 部分 ROI 重标定,供 review 取舍。

1. 鼠标输入根因(价值最大)

interface.json PC 控制器 mouse/keyboard: PostMessageWithWindowPos 在当前棕2版本上点击无效(API 返回 true 但游戏无反应,窗口前台也不行);纯 PostMessage 同样失效。 改为 PostMessageWithCursorPos 后,MFA 实测可点动(完整跑通 进入邮件→全部领取→关弹窗→返回 多次点击)。 疑为 PC 端长期"仅供探索/输入不稳"的根因。 (keyboard 同步改动,未单独验,如初始化报错可退回 PostMessage)

2. 红点检测器(RedDotDetector)PC 参数 — pc/Dummy.json 的 Agt_RedDot_Preset

逐帧分析 roi_crop 像素定位:

  • 移除 inner_s_max/inner_v_min:binarymatch.py 已弃用,残留被忽略(原 PC 覆盖里是死参)。
  • hsv_ranges S 下限 140→100:PC 红点饱和度偏低(实测 S 中位~148、下限低到 88),S≥140 只框到 ~33px < red_area 下限 35 → 面积阶段漏检。S≥100 框 ~52px,稳过。
  • red_area 下限 50→35:PC 红点像素更小。
  • min_confidence 0.25→0.08:PC 红点 720p 太小,封闭'!'区仅 ~4px(2×2),gap/vert 形状分=0,仅 white+cent 贡献 → conf~0.11<0.25 漏检。detector 自身 hint 即建议降 min_confidence。 ⚠️ 保留项:此为集中式预设,全局降低会增大大 ROI 红点节点(如 Pass_SelectPass [40×478])误检风险。建议大 ROI 节点后续单列高 conf 变体;小图标 ROI(Mail/任务/活动)风险低。

3. PC 主页布局偏移 → ROI 重标定

PC 客户端 UI 布局与安卓不同,base ROI 在 PC 上指错目标:

  • 底部菜单整体左移:'任务'按钮 720p 中心 x≈454,base 的 RewardsDaily OCR roi[520] 恰好框到'成就'。→ pc/QuestList.json 左移 RewardsDaily_DailyReward / InIndex 的 roi。
  • 右上图标右移:Mail 红点 720p x≈1085,base Mail_NewRed roi 止于 1067。→ pc/Mail.json 右移 roi。
  • (已知后续)邮箱页内部(全部领取/商品 tab)、导航复位 仍有"第二层偏移",待逐页标定。

排除项

Rec_HomePage_GA_Clr 主页颜色判定 count 阈值 150,实测 163/159 均命中,主页判定正常,非卡点。

提交

  • fix: 红点预设去死参 + 解锁 Mail/任务页 PC 控制器
  • fix: 鼠标改 PostMessageWithCursorPos + Mail 红点 roi 右移
  • fix: 任务页底部菜单 '任务' 按钮 roi 左移
  • fix: 红点 hsv_ranges S 下限 140→100
  • fix: 红点 min_confidence 0.25→0.08

🔰 小弟此生第一次写 PR,主要由 Claude Draft 出来的,请多多包涵 🙏

🤖 Generated with Claude Code

Summary by Sourcery

调整 PC 客户端的输入处理和 UI 检测,使鼠标交互和红点识别在 PC 控制器配置下能够可靠工作。

Bug 修复:

  • 通过切换到基于光标位置的消息投递方式修复 PC 控制器的鼠标和键盘输入,以便游戏内点击能被正确识别。
  • 修正 PC 主页界面的 ROI(感兴趣区域)定义,使邮件和任务 UI 元素及其红点能够在实际的 PC 屏幕位置被检测到。
  • 更新 PC 红点检测器预设,以更好地匹配 PC 图标的尺寸和颜色特征,减少在主页和邮件/任务页面上的漏检情况。

增强:

  • 清理当前检测流程中已不再使用的旧版红点检测器参数。
Original summary in English

Summary by Sourcery

Adjust PC client input handling and UI detection to make mouse interactions and red dot recognition work reliably on the PC controller profile.

Bug Fixes:

  • Fix PC controller mouse and keyboard input by switching to cursor-position-based message posting so in-game clicks register correctly.
  • Correct PC home screen ROI definitions so mail and quest UI elements and their red dots are detected at their actual PC positions.
  • Update PC red dot detector presets to better match PC icon size and color characteristics, reducing missed detections on the home and mail/quest pages.

Enhancements:

  • Clean up legacy red dot detector parameters that were no longer used by the current detection pipeline.

BebopSpikeSpiegel avatar Jun 15 '26 22:06 BebopSpikeSpiegel

[!IMPORTANT]

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1b091dd5-5eca-4104-bc2f-5ab9bb205e8e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • [ ] 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Jun 15 '26 22:06 coderabbitai[bot]

审阅者指南(在小型 PR 上折叠显示)

审阅者指南

调整 PC 端客户端的输入处理,以使用基于光标的鼠标/键盘消息传递,并重新调优 PC 专用的红点检测和首页 ROI,使得在 720p 下 PC 端 UI 元素(邮件、任务)可以被正确点击和检测到。

文件级改动

变更 详情 文件
将 PC 控制器鼠标/键盘输入切换为基于光标位置的 PostMessage,以修复 PC 客户端中点击无效的问题。
  • 将 PC 控制器的鼠标配置从 PostMessageWithWindowPos/PostMessage 更新为 PostMessageWithCursorPos,以便点击能正确落在游戏窗口上
  • 对键盘配置应用同样的 PostMessageWithCursorPos 变更,以保持输入方式的一致性
assets/interface.json
重新调优 PC 红点检测预设,使其适配在 720p 下更小、饱和度更低的 PC 端红点指示图标。
  • 从 PC 红点预设中移除未使用的 inner_s_max 和 inner_v_min 参数,因为对应的二值匹配逻辑已废弃
  • 降低 hsv_ranges 中 S 通道的下界,使低饱和度的 PC 红点也能包含在掩码内
  • 降低 red_area 的最小阈值,以适配 PC 上更小的红点斑块
  • 降低 min_confidence 阈值,以便带有极小“!”特征的 PC 小红点仍可被接受,同时需要注意在较大 ROI 上误报风险增加
assets/resource/pc/pipeline/Dummy.json
增加 PC 专用的 Mail ROI 配置,以匹配 PC 首页上偏移后的 UI 布局。
  • 定义 PC Mail 页面流水线,并设置右移的 Mail_NewRed ROI,使红点与 PC 客户端图标位置对齐
  • 将 PC Mail 流水线结构设计为独立于基础/移动端布局,以便未来对 PC 端专用 Mail 的调整不会影响其他平台
assets/resource/PC/pipeline/Mail.json
增加 PC 专用的 QuestList ROI 配置,使底部菜单中的“任务”按钮及相关元素与 PC 首页布局对齐。
  • 定义 PC QuestList 流水线,并左移 RewardsDaily_DailyReward 和 InIndex 的 ROI,使其锁定“任务”按钮,而不是相邻的“成就”按钮
  • 将 PC QuestList 流水线预备为一个专用的 PC 布局层,以便后续可以单独校准内部页面的偏移
assets/resource/PC/pipeline/QuestList.json

技巧与指令

与 Sourcery 交互

  • 触发新一轮审查: 在 pull request 中评论 @sourcery-ai review。
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 从审查评论生成 GitHub Issue: 在某条审查评论下回复,要求 Sourcery 从该评论创建 Issue。你也可以直接回复 @sourcery-ai issue,从该评论生成 Issue。
  • 生成 pull request 标题: 在 pull request 标题中任意位置写上 @sourcery-ai,即可随时生成标题。你也可以在 pull request 中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文中任意位置写上 @sourcery-ai summary,即可在指定位置生成 PR 摘要。你也可以在 pull request 中评论 @sourcery-ai summary 来(重新)生成摘要。
  • 生成审阅者指南: 在 pull request 中评论 @sourcery-ai guide,即可在任意时间(重新)生成审阅者指南。
  • 一键解决所有 Sourcery 评论: 在 pull request 中评论 @sourcery-ai resolve,即可将所有 Sourcery 评论标记为已解决。适用于你已经处理完所有评论且不再希望看到它们的情况。
  • 忽略所有 Sourcery 审查: 在 pull request 中评论 @sourcery-ai dismiss,即可忽略所有现有的 Sourcery 审查。特别适用于你想从头开始一次新的审查——别忘了再评论 @sourcery-ai review 来触发新审查!

自定义你的使用体验

访问你的 控制台 以:

  • 启用或禁用诸如 Sourcery 自动生成的 pull request 摘要、审阅者指南等审查功能。
  • 修改审查语言。
  • 添加、删除或编辑自定义审查指令。
  • 调整其他审查设置。

获取帮助

  • 通过 联系支持团队 反馈问题或意见。
  • 访问我们的文档以获取详细指南和信息。
  • 通过关注我们的 X/Twitter、LinkedIn 或 GitHub 与 Sourcery 团队保持联系。
Original review guide in English
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts PC client input handling to use cursor-based mouse/keyboard messaging and retunes PC-specific red dot detection and homepage ROIs so that PC UI elements (mail, quests) are correctly clickable and detectable at 720p.

File-Level Changes

Change Details Files
Switch PC controller mouse/keyboard input to cursor-position based PostMessage to fix non-functional clicks in the PC client.
  • Update PC controller mouse configuration from PostMessageWithWindowPos/PostMessage to PostMessageWithCursorPos so clicks register correctly on the game window
  • Apply the same PostMessageWithCursorPos change to keyboard configuration to keep input methods consistent
assets/interface.json
Retune PC red dot detection preset to match smaller, lower-saturation PC indicators at 720p.
  • Remove unused inner_s_max and inner_v_min parameters from the PC red dot preset since the corresponding binary match logic is deprecated
  • Lower hsv_ranges S-channel lower bound so lower-saturation PC red dots are included in the mask
  • Reduce red_area minimum threshold to account for smaller red dot blobs on PC
  • Lower min_confidence threshold so very small PC red dots with tiny '!' features can still be accepted, noting the increased false-positive risk on large ROIs
assets/resource/pc/pipeline/Dummy.json
Add PC-specific Mail ROI configuration to match the shifted UI layout on the PC homepage.
  • Define PC Mail page pipeline with a right-shifted Mail_NewRed ROI so the red dot aligns with the PC client icon position
  • Structure the PC Mail pipeline to be independent from the base/mobile layout so future PC-only Mail adjustments can be made without affecting other platforms
assets/resource/PC/pipeline/Mail.json
Add PC-specific QuestList ROI configuration so the bottom menu 'Quest' button and related elements align with the PC homepage layout.
  • Define PC QuestList pipeline with left-shifted RewardsDaily_DailyReward and InIndex ROIs so they target the '任务' button instead of the adjacent '成就' button
  • Prepare the PC QuestList pipeline as a dedicated PC layout layer so further internal page offsets can be calibrated separately
assets/resource/PC/pipeline/QuestList.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an issue from a review comment by replying to it. You can also reply to a review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull request title to generate a title at any time. You can also comment @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment @sourcery-ai summary on the pull request to (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

  • Contact our support team for questions or feedback.
  • Visit our documentation for detailed guides and information.
  • Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.

sourcery-ai[bot] avatar Jun 15 '26 22:06 sourcery-ai[bot]

感谢 review!三点都已处理(commits 5d52b3d、d8d1a44):

1. 鼠标改动作用域 该改动其实只在 PC客户端 这个 Win32 控制器块内(interface.json 的 controller 数组里),Adb/模拟器端是独立的控制器定义、未被触碰——所以模拟器环境不受影响。已是平台隔离的。

2. 键盘未验证 → 收回 已把 keyboard 回退到 baseline PostMessageWithWindowPos,只保留经 MFA 实测验证的 mouse: PostMessageWithCursorPos,避免未验证的键盘改动带来回归。

3. 红点阈值过于全局 → 拆分预设

  • 通用 Agt_RedDot_Preset 的 min_confidence 回到 base 默认 0.25,大 ROI 红点节点(如 Pass_SelectPass [40×478])不再受全局降阈值影响;
  • 仅保留低误检风险的 PC 适配(hsv_ranges S 下限 100、red_area 下限 35);
  • 新增 Agt_RedDot_Preset_Soft(min_confidence 0.08),仅供已确认的小图标;
  • Mail_NewRed / RewardsDaily_InIndex 改引用 Soft 预设,把低阈值的误检风险限定在小 ROI 内。

后续其它任务若在 PC 上遇到小红点漏检,按需把对应节点指到 Soft 预设即可。

BebopSpikeSpiegel avatar Jun 15 '26 22:06 BebopSpikeSpiegel

@sunyink 已基于你的大小写统一与 feat/NT-Suport 合并(1b53400)更新本 PR(110ddbd),感谢直接整理了 PC/→pc/ 目录。也读了 #152 的 PC 适配路线图与 MaaOWM,下面据此调整说明。

经受控复验,结论支持你对鼠标的意见:PostMessageWithWindowPos 无法工作系本 PR(Claude draft)的误判,已撤回。

① WindowPos 工作正常。 复刻本仓库 PC 控制器配置(FramePool + PostMessageWithWindowPos + display_short_side:720)、普通权限下,720 空间点击"任务"正常跳转(可见"移动窗口对齐、鼠标不动"机制);MFA 全 GUI 实跑亦确认控制器以 WindowPos(mouse_method=256)正常点击落地。

② 误判根因:测试工具坐标系错配。 此前经 maa-mcp 验证,其按原生 1920×1080 捕获、坐标取自 1920;真实控制器 display_short_side:720 → 1280×720。WindowPos 靠移动窗口对齐固定屏幕坐标,要求捕获分辨率与真实客户区一致,1920↔720 错配仅破坏 WindowPos;CursorPos 直移真实光标对此不敏感,遂呈"仅 CursorPos 可用"的假象。

③ 管理员权限非必需。 游戏进程为普通完整性,WindowPos 普通权限即可点击(UIPI 不拦同级),与你"管理员模式似乎并不必要"一致。

本次更新(110ddbd): interface.json mouse 回退 WindowPos;删除 Agt_RedDot_Preset_Soft,min_confidence 全程保持 0.25(消解"避免全局降阈值"意见),红点预设仅保留 S 下限 140→100(720 空间复刻 RedDotDetector 实测:邮件红点 S140 仅框 32px<red_area 50 漏检,S100 框 58px、conf=0.43 稳过);ROI 偏移在 720 空间经 OCR 重新核准。

关于后续(对齐 #152 路线图): 全 GUI 实跑确认进入 Mail/任务页(本 PR 范围)已正常,但页内"全部领取/每日任务"等按钮因 base 安卓 ROI 在 PC 上切边而未触发领取(Mail_GetAll OCR 读到"全部领"漏"取";RewardsDaily_GetDailyReward 页面确认读到"日任务"漏"每")——正是路线图第 4 步的 PC 按钮偏移。本 PR 不含,我会另起 PR、改用 MaaOWM 挂载工作区做节点级覆盖处理,以贴合你"覆盖包覆盖节点、勿依赖 interface 传参、可复用多条件拆成节点"的约定与分支策略。本 PR 中 RewardsDaily_DailyReward 的 all_of 整段覆盖,正是你所说"嵌套多条件覆盖须全字段填写"的体现,后续会借 MaaOWM 收敛。

BebopSpikeSpiegel avatar Jun 16 '26 11:06 BebopSpikeSpiegel

'生成'了一个邮件红点测试(HDR600),可以通过,余量足够。 返回为:

box=[24, 9, 10, 10] | detail={"box":[24,9,10,10],"conf":0.467,"parts":{"cent":0.9,"gap":0,"vert":1,"white":0.48},"red_area":66,"result":"hit"}

sunyink avatar Jun 16 '26 15:06 sunyink

'生成'了一个邮件红点测试(HDR600),可以通过,余量足够。 返回为:

box=[24, 9, 10, 10] | detail={"box":[24,9,10,10],"conf":0.467,"parts":{"cent":0.9,"gap":0,"vert":1,"white":0.48},"red_area":66,"result":"hit"}

还有什么问题?

BebopSpikeSpiegel avatar Jun 17 '26 01:06 BebopSpikeSpiegel

@BebopSpikeSpiegel 除了直接合并,我向你的注册信箱发送了一份邀请,也许这会让开发小组交流更方便,你随性即可,感谢你的付出,

@sunyink 谢谢你的认可,不过我似乎并没有收到?如果你发送的是[email protected],那个已经弃用了,可以发到我commit用的邮箱[email protected]

BebopSpikeSpiegel avatar Jun 17 '26 08:06 BebopSpikeSpiegel