Skip to content

[codex] fix MuMu Pro detection for generic ADB serials#248

Merged
Xuefeng-miao merged 2 commits into
wess09:devfrom
swordcry424:codex/fix-mumupro-droidcast-rotation
Jun 7, 2026
Merged

[codex] fix MuMu Pro detection for generic ADB serials#248
Xuefeng-miao merged 2 commits into
wess09:devfrom
swordcry424:codex/fix-mumupro-droidcast-rotation

Conversation

@swordcry424

@swordcry424 swordcry424 commented Jun 7, 2026

Copy link
Copy Markdown

What changed

Treat devices explicitly configured as MuMuPro as part of the MuMu family, even when they expose a generic emulator-* ADB serial.

Root cause

MuMu Pro on macOS can expose emulator-5554 instead of its usual 127.0.0.1:16xxx serial. is_mumu_family previously 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 720x1280 RGB565 buffer was interpreted without the required rotation, producing a sideways 1280x720 screenshot and causing repeated Unknown ui page errors.

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

  • Confirmed the affected setup reports:
    • configured emulator: MuMuPro
    • serial: emulator-5554
    • physical display: 720x1280
    • orientation: 1
  • Before the change, is_mumu_family and is_mumu_over_version_356 were both false.
  • After the change, both are true.
  • Captured a live DroidCast_raw screenshot after the change and verified it is correctly oriented at 1280x720.
  • Compared it with an ADB screenshot; static UI regions align, with expected RGB565 color precision differences.
  • Ran git diff --check and compiled module/device/connection_attr.py.

Summary by Sourcery

Bug Fixes:

  • 确保 DroidCast 在 macOS 设备上,对于通过通用 emulator-* 序列号而非 MuMu 常用回环端口暴露的 MuMu Pro,使用 MuMu 特定的屏幕方向处理逻辑。
Original summary in English

Summary by Sourcery

Bug Fixes:

  • Ensure DroidCast uses MuMu-specific orientation handling for MuMu Pro on macOS devices exposing generic emulator-* serials instead of MuMu’s usual loopback ports.

wess09 and others added 2 commits June 5, 2026 22:24
* 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>
@sourcery-ai

sourcery-ai Bot commented Jun 7, 2026

Copy link
Copy Markdown
审阅者指南(在小型 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]
Loading

文件级变更

变更 详情 文件
扩展 MuMu 家族检测范围,使其包含显式配置的 MuMuPro 实例,而不再受 ADB 序列号模式限制。
  • 扩展 is_mumu_family,当配置中 EmulatorInfo_Emulator 被设置为 MuMuPro 时返回 true。
  • 说明 MuMu Pro 在 macOS 上可能暴露为通用的 emulator-* 序列号,而不是 127.0.0.1:port。
  • 保留基于 127.0.0.1:7555 和 is_mumu12_family 的现有检测逻辑。
module/device/connection_attr.py

提示与命令

与 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 摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、移除或编辑自定义审阅说明。
  • 调整其他审阅设置。

获取帮助

Original review guide in English
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Treat 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 detection

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]
Loading

File-Level Changes

Change Details Files
Broaden MuMu family detection to include explicitly configured MuMuPro instances regardless of ADB serial pattern.
  • Extend is_mumu_family to return true when EmulatorInfo_Emulator is set to MuMuPro in the config.
  • Document that MuMu Pro on macOS may expose generic emulator-* serials instead of 127.0.0.1:port.
  • Preserve existing detection based on 127.0.0.1:7555 and is_mumu12_family.
module/device/connection_attr.py

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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
or self.config.EmulatorInfo_Emulator == 'MuMuPro'
or getattr(self.config, 'EmulatorInfo_Emulator', None) == 'MuMuPro'

@wess09
wess09 changed the base branch from master to dev June 7, 2026 16:01

@Xuefeng-miao Xuefeng-miao left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

审查意见

整体评价:✅ 精准修复,建议合并

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 核心逻辑无关,不做额外评述

总结

改动精准、范围极小、逻辑正确,建议合并。

@Xuefeng-miao
Xuefeng-miao marked this pull request as ready for review June 7, 2026 16:34
@Xuefeng-miao
Xuefeng-miao merged commit c57c36b into wess09:dev Jun 7, 2026
2 checks passed
Xuefeng-miao added a commit that referenced this pull request Jun 7, 2026
This reverts commit c57c36b, reversing
changes made to 0f78f5a.
@Xuefeng-miao

Copy link
Copy Markdown
Collaborator

抱歉,之前误操作将该 PR 从 Draft 标记为 Ready for Review 并合并到了 dev,随后已撤销合并并将 dev 回退到合并前的状态。

但 GitHub 不允许 reopen 已合并的外部 fork PR,因此创建了替代 PR #254(Draft 状态,包含完全相同的 commit):

#254

如果你(原作者)希望重新控制这个 PR,可以:

非常抱歉由此造成的不便。

@swordcry424
swordcry424 deleted the codex/fix-mumupro-droidcast-rotation branch June 23, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants