[codex] fix MuMu Pro detection for generic ADB serials#248
Conversation
* fix(island): 适配商店新布局,拆分商店入口与购买返回检测,典雅之木翻译错误 (wess09#230) * fix(island): 适配商店新布局,拆分商店入口与购买返回检测,典雅之木翻译错误 - 新增 ISLAND_SEED_SHOP_RETURN_CHECK 按钮,page_island_shop 入口改用新检测区域 (125,21,216,46) - ISLAND_SHOP_CHECK 保留原区域,用于 buy_seeds() 购买后返回检测 - 更新 ISLAND_FRY_SHOP_CHECK 检测区域为 (125,21,216,46) - 新增 dev_tools/button_region_editor.py 通用工具,支持按区域裁剪/置黑处理按钮图片 - 修复典雅之木翻译错误显示为优雅之木 * fix 调度器默认值 * fix:道中战斗失败撤退——修复了boss战失败时卡死的bug (wess09#231) --------- Co-authored-by: quankong1551 <96553536+quankong1551@users.noreply.github.com> Co-authored-by: 鄜月 <73020805+moon-dim@users.noreply.github.com>
审阅者指南(在小型 PR 中折叠显示)审阅者指南将在配置中被显式选择的 MuMu Pro 实例视为 MuMu 模拟器家族的一部分,即使它们使用通用的 emulator-* ADB 序列号,这样 DroidCast/DroidCast_raw 也会应用 MuMu 专用的方向(旋转)处理。 更新后的 is_mumu_family 检测流程图flowchart TD
A[Start is_mumu_family] --> B{serial == 127.0.0.1:7555}
B -- yes --> Z[Return true]
B -- no --> C{is_mumu12_family}
C -- yes --> Z
C -- no --> D{config.EmulatorInfo_Emulator == MuMuPro}
D -- yes --> Z
D -- no --> Y[Return false]
文件级变更
提示与命令与 Sourcery 交互
自定义你的体验访问你的 仪表盘 来:
获取帮助Original review guide in EnglishReviewer's guide (collapsed on small PRs)Reviewer's GuideTreat MuMu Pro instances explicitly selected in config as part of the MuMu emulator family even when they use generic emulator-* ADB serials, so DroidCast/DroidCast_raw apply MuMu-specific orientation handling. Flow diagram for updated is_mumu_family detectionflowchart TD
A[Start is_mumu_family] --> B{serial == 127.0.0.1:7555}
B -- yes --> Z[Return true]
B -- no --> C{is_mumu12_family}
C -- yes --> Z
C -- no --> D{config.EmulatorInfo_Emulator == MuMuPro}
D -- yes --> Z
D -- no --> Y[Return false]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Code Review
This pull request updates the is_mumu_family method in module/device/connection_attr.py to recognize MuMu Pro on macOS by checking the emulator configuration. Feedback suggests using getattr when accessing EmulatorInfo_Emulator to prevent potential AttributeError exceptions if the attribute is not defined.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| return ( | ||
| self.serial == '127.0.0.1:7555' | ||
| or self.is_mumu12_family | ||
| or self.config.EmulatorInfo_Emulator == 'MuMuPro' |
There was a problem hiding this comment.
Using direct attribute access self.config.EmulatorInfo_Emulator can raise an AttributeError if the attribute is not bound or defined in the configuration (e.g., in older or minimal config files). Using getattr is safer and prevents potential runtime crashes.
| or self.config.EmulatorInfo_Emulator == 'MuMuPro' | |
| or getattr(self.config, 'EmulatorInfo_Emulator', None) == 'MuMuPro' |
Xuefeng-miao
left a comment
There was a problem hiding this comment.
审查意见
整体评价:✅ 精准修复,建议合并
1. MuMu Pro ADB 串号检测修复
状态: ✅ 通过
- 核心改动在
module/device/connection_attr.py(L6, +5) - 当配置为
MuMuPro且串号以emulator-开头时,也判定为 MuMu 家族 - 确保 DroidCast_raw 对 macOS 上 MuMu Pro 的 orientation 处理正确
2. 逻辑验证
is_mumu_family()加上了self.config.Emulator_Serial == 'MuMuPro'的条件判断,同时保留了原有的端口号判断逻辑,不干扰正常 MuMu 模拟器is_mumu_over_version_356()同理
3. 副作用分析
- 对其他使用
emulator-*串号的设备(如 Android Studio 模拟器)无影响,因为条件同时要求config.Emulator_Serial == 'MuMuPro' - 改动仅 6 行增量代码,风险极低
其他文件变更不影响核心修复
doc/island_feature_plan.md,dev_tools/button_region_editor.py, 图片资源等为非 MuMu 修复的基线提交内容,与本 PR 核心逻辑无关,不做额外评述
总结
改动精准、范围极小、逻辑正确,建议合并。
|
抱歉,之前误操作将该 PR 从 Draft 标记为 Ready for Review 并合并到了 dev,随后已撤销合并并将 dev 回退到合并前的状态。 但 GitHub 不允许 reopen 已合并的外部 fork PR,因此创建了替代 PR #254(Draft 状态,包含完全相同的 commit): 如果你(原作者)希望重新控制这个 PR,可以:
非常抱歉由此造成的不便。 |
What changed
Treat devices explicitly configured as
MuMuProas part of the MuMu family, even when they expose a genericemulator-*ADB serial.Root cause
MuMu Pro on macOS can expose
emulator-5554instead of its usual127.0.0.1:16xxxserial.is_mumu_familypreviously identified MuMu only by serial and port, so this connection was classified as a generic emulator.As a result, DroidCast_raw skipped the MuMu-specific physical resolution and orientation handling. Its
720x1280RGB565 buffer was interpreted without the required rotation, producing a sideways1280x720screenshot and causing repeatedUnknown ui pageerrors.Impact
DroidCast and DroidCast_raw now apply their existing MuMu orientation handling when MuMu Pro is explicitly selected, while other emulators using
emulator-*serials remain unaffected.Validation
MuMuProemulator-5554720x12801is_mumu_familyandis_mumu_over_version_356were both false.1280x720.git diff --checkand compiledmodule/device/connection_attr.py.Summary by Sourcery
Bug Fixes:
emulator-*序列号而非 MuMu 常用回环端口暴露的 MuMu Pro,使用 MuMu 特定的屏幕方向处理逻辑。Original summary in English
Summary by Sourcery
Bug Fixes: