Skip to content

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

Draft
Xuefeng-miao wants to merge 1 commit into
wess09:devfrom
Xuefeng-miao:codex/fix-mumupro-droidcast-rotation
Draft

[codex] fix MuMu Pro detection for generic ADB serials#254
Xuefeng-miao wants to merge 1 commit into
wess09:devfrom
Xuefeng-miao:codex/fix-mumupro-droidcast-rotation

Conversation

@Xuefeng-miao

@Xuefeng-miao Xuefeng-miao commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

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(错误修复):

  • 在使用通用 emulator-* ADB 序列号时,也将显式配置的 MuMu Pro 实例视为 MuMu 家族。
  • 在自动搜索战斗中,通过检测专门的 Boss 撤退按钮来处理 Boss 舰队撤退。
  • 通过更新按钮区域和页面映射,修正岛屿商店和渔场商店的 UI 检测。

Enhancements(功能增强):

  • 为 YukikazeTaskManager 的岛屿相关任务优先级配置扩展更细致的岛屿子任务。
  • 调整岛屿任务配置,使其绕过 Scheduler 封装,直接运行 IslandPlan
  • 优化岛屿 UI 资源,适配新的岛屿商店、农场、牧场、矿山/森林、每日采集、制造和商业据点。
  • 引入按钮区域编辑开发工具,用于帮助重新生成精确的 UI 按钮元数据。

Documentation(文档):

  • 增补一份全面的岛屿功能扩展设计文档,涵盖计划中的 TODO 列表、阈值、顺序、运输、业务逻辑和交互细节。
Original summary in English

Summary by Sourcery

Extend island automation features and improve emulator and combat handling.

Bug Fixes:

  • Treat explicitly configured MuMu Pro instances as MuMu family even when using generic emulator-* ADB serials.
  • Handle boss-fleet withdrawal by detecting a dedicated boss withdraw button during auto search combat.
  • Correct island shop and fishery shop UI detection by updating button regions and page mappings.

Enhancements:

  • Expand YukikazeTaskManager island-related task priority configuration with detailed island sub-tasks.
  • Adjust Island task configuration to run IslandPlan directly without the Scheduler wrapper.
  • Refine island UI assets for new island shop, farm, ranch, mine/forest, daily gather, manufacture, and business locations.
  • Introduce a button-region editing dev tool to assist regenerating accurate UI button metadata.

Documentation:

  • Add a comprehensive island feature extension design document covering planned TODO list, thresholds, orders, transport, business logic, and interactions.
Original summary in English

Summary by Sourcery

扩展岛屿自动化功能,并改进模拟器与战斗处理。

Bug Fixes(错误修复):

  • 在使用通用 emulator-* ADB 序列号时,也将显式配置的 MuMu Pro 实例视为 MuMu 家族。
  • 在自动搜索战斗中,通过检测专门的 Boss 撤退按钮来处理 Boss 舰队撤退。
  • 通过更新按钮区域和页面映射,修正岛屿商店和渔场商店的 UI 检测。

Enhancements(功能增强):

  • 为 YukikazeTaskManager 的岛屿相关任务优先级配置扩展更细致的岛屿子任务。
  • 调整岛屿任务配置,使其绕过 Scheduler 封装,直接运行 IslandPlan
  • 优化岛屿 UI 资源,适配新的岛屿商店、农场、牧场、矿山/森林、每日采集、制造和商业据点。
  • 引入按钮区域编辑开发工具,用于帮助重新生成精确的 UI 按钮元数据。

Documentation(文档):

  • 增补一份全面的岛屿功能扩展设计文档,涵盖计划中的 TODO 列表、阈值、顺序、运输、业务逻辑和交互细节。
Original summary in English

Summary by Sourcery

Extend island automation features and improve emulator and combat handling.

Bug Fixes:

  • Treat explicitly configured MuMu Pro instances as MuMu family even when using generic emulator-* ADB serials.
  • Handle boss-fleet withdrawal by detecting a dedicated boss withdraw button during auto search combat.
  • Correct island shop and fishery shop UI detection by updating button regions and page mappings.

Enhancements:

  • Expand YukikazeTaskManager island-related task priority configuration with detailed island sub-tasks.
  • Adjust Island task configuration to run IslandPlan directly without the Scheduler wrapper.
  • Refine island UI assets for new island shop, farm, ranch, mine/forest, daily gather, manufacture, and business locations.
  • Introduce a button-region editing dev tool to assist regenerating accurate UI button metadata.

Documentation:

  • Add a comprehensive island feature extension design document covering planned TODO list, thresholds, orders, transport, business logic, and interactions.

@sourcery-ai

sourcery-ai Bot commented Jun 7, 2026

Copy link
Copy Markdown

审查者指南

将显式 MuMuPro 配置视为 MuMu 家族(不再依赖 ADB serial),增加 boss 撤退处理,并调整若干与岛屿相关的 UI 素材、任务优先级以及辅助工具,以提升岛屿与地图交互的稳定性。

更新后的 is_mumu_family 检测流程图

flowchart TD
    A[is_mumu_family called] --> 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

auto_search_combat_status 中 boss 撤退处理的流程图

flowchart TD
    A[auto_search_combat_status loop] --> B[device.screenshot]
    B --> C{appear_then_click FLEET_WITHDRAW}
    C -->|Yes| D[break]
    C -->|No| E{appear FLEET_WITHDRAW_BOSS}
    E -->|Yes| F[withdraw]
    F --> D
    E -->|No| G{appear_then_click SWITCH_OVER}
    G -->|Yes| A
    G -->|No| H[fleet_alive_multiple = False<br>exit loop]
Loading

文件级更改

变更 详情 文件
扩展 MuMu 家族检测范围,使暴露为通用 emulator-* serial 的 MuMu Pro 实例也被视为 MuMu 家族,从而基于配置应用 MuMu 专用的横竖屏处理。
  • 扩展 is_mumu_family 断言,使在 EmulatorInfo_Emulator 被配置为 MuMuPro 时无论 serial 值如何都返回 true。
  • 在此基础上保留现有的 serial 检查与 MuMu 12 家族检测逻辑不变,仅添加基于配置的兜底逻辑。
module/device/connection_attr.py
在自动海域搜索战斗中新增对 boss 撤退的显式支持,使用新的 boss 撤退按钮 UI 素材。
  • 新增 FLEET_WITHDRAW_BOSS 按钮素材,并为其定义独立的区域 / 颜色 / 按钮 / 文件配置。
  • 在 auto_search_combat_status 中,优先检测 FLEET_WITHDRAW_BOSS 是否出现,若出现则调用 withdraw,再进行编队切换。
  • 将新的 boss 撤退素材接入地图素材模块。
module/map/assets.py
module/combat/auto_search_combat.py
重新调整岛屿商店和渔场页面检测,使用新的标题栏 / 返回区域,并更新任务优先级配置,以覆盖扩展后的岛屿经营任务。
  • 将 ISLAND_SHOP_CHECK 和 ISLAND_FRY_SHOP_CHECK 按钮改为使用顶栏区域 (125,21,216,46),并更新颜色配置,使其对齐通用标题栏位置。
  • 新增 ISLAND_SEED_SHOP_RETURN_CHECK 按钮,并在 page_island_shop 中用它作为页面级检测条件,替代之前的 ISLAND_SHOP_CHECK。
  • 调整 YukikazeTaskManager_TaskPriorityAdjustment,将 Island 从商店链条中抽离,并在优先级列表中加入一组 IslandJuu* 与 Island* 任务。
  • 收紧任务排序字符串中的空白字符,以保持配置的规范性和一致性。
module/ui/assets.py
module/ui/page.py
module/config/argument/argument.yaml
module/config/config_generated.py
调整岛屿渔场 UI 中炸物店检测逻辑,使其使用标准化的标题栏区域,并文档化规划中的岛屿功能扩展。
  • 更新 ISLAND_FRY_SHOP_CHECK 按钮的区域与颜色,使其与共享的顶栏检测坐标保持一致。
  • 新增设计文档 island_feature_plan.md,描述计划中的岛屿 TODO 列表、基于库存阈值的采矿 / 伐木、每日订单、运输整合、每周珍珠出售、经营波次拆分、基于体力的采集、日常交互,以及相关配置 / i18n 变更。
  • 在各类 config/template/i18n JSON 与 args 文件中添加占位内容,源于重新生成配置模板(从 diff 上看对行为无直接影响)。
module/island_fishery/assets.py
doc/island_feature_plan.md
config/template.json
module/config/argument/args.json
module/config/i18n/zh-CN.json
简化岛屿规划任务的接线方式,并新增用于编辑 button_extract 所用按钮区域的开发辅助工具。
  • 从 task.yaml 中的 IslandPlan 任务序列里移除显式 Scheduler 步骤,使 IslandPlan 直接执行自身的调度逻辑。
  • 新增脚本 dev_tools/button_region_editor.py,可对按钮图片按给定区域做遮罩或裁剪,以便 button_extract.py 重新生成准确的 区域 / 颜色 / 按钮 配置。
  • 为按钮区域编辑器预置一个任务,用于规范化 ISLAND_SEED_SHOP_RETURN_CHECK 的区域。
  • 确保该工具强制使用 1280x720 边界,并引导开发者在编辑后运行 button_extract。
module/config/argument/task.yaml
dev_tools/button_region_editor.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

Treat explicit MuMuPro configuration as MuMu-family regardless of ADB serial, add boss-withdraw handling, and adjust several island-related UI assets, task priorities, and helper tooling for more robust island and map interactions.

Flow diagram for updated is_mumu_family detection

flowchart TD
    A[is_mumu_family called] --> 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

Flow diagram for boss withdraw handling in auto_search_combat_status

flowchart TD
    A[auto_search_combat_status loop] --> B[device.screenshot]
    B --> C{appear_then_click FLEET_WITHDRAW}
    C -->|Yes| D[break]
    C -->|No| E{appear FLEET_WITHDRAW_BOSS}
    E -->|Yes| F[withdraw]
    F --> D
    E -->|No| G{appear_then_click SWITCH_OVER}
    G -->|Yes| A
    G -->|No| H[fleet_alive_multiple = False<br>exit loop]
Loading

File-Level Changes

Change Details Files
Broaden MuMu family detection to cover MuMu Pro instances that expose generic emulator-* serials so MuMu-specific orientation handling is applied based on configuration.
  • Extend is_mumu_family predicate to also return true when EmulatorInfo_Emulator is configured as MuMuPro, regardless of serial value.
  • Keep existing serial and MuMu 12-family checks intact while adding the configuration-based fallback.
module/device/connection_attr.py
Add explicit boss-withdrawal support in auto-search combat using a new UI asset for the boss withdraw button.
  • Introduce FLEET_WITHDRAW_BOSS button asset with its own area/color/button/file definition.
  • In auto_search_combat_status, check for FLEET_WITHDRAW_BOSS appearance and call withdraw when it is present before switching fleet.
  • Wire the new boss-withdraw asset into the map assets module.
module/map/assets.py
module/combat/auto_search_combat.py
Retune island shop and fishery page detection to use new header/return regions and update task priority configuration to cover expanded island business tasks.
  • Change ISLAND_SHOP_CHECK and ISLAND_FRY_SHOP_CHECK buttons to use the top-bar region (125,21,216,46) with updated color profiles, aligning with the common header location.
  • Add ISLAND_SEED_SHOP_RETURN_CHECK button and use it as the page-level check for page_island_shop instead of the prior ISLAND_SHOP_CHECK.
  • Adjust YukikazeTaskManager_TaskPriorityAdjustment to move Island out from the shop chain and add a set of IslandJuu* and Island* tasks in the priority list.
  • Tighten whitespace in task ordering strings to keep config canonical.
module/ui/assets.py
module/ui/page.py
module/config/argument/argument.yaml
module/config/config_generated.py
Adjust island fishery UI detection for the fry shop to use the standardized header region, and document planned island feature extensions.
  • Update ISLAND_FRY_SHOP_CHECK button region and colors to match the shared top-bar check coordinate.
  • Add island_feature_plan.md design document describing planned island TODO list, inventory-threshold mining/forestry, daily orders, transport integration, weekly pearl selling, business wave splitting, stamina-based gathering, daily interactions, and related configuration/i18n changes.
  • Add placeholders in various config/template/i18n JSON and args files as a result of regenerating configuration templates (no direct behavior change visible from the diff).
module/island_fishery/assets.py
doc/island_feature_plan.md
config/template.json
module/config/argument/args.json
module/config/i18n/zh-CN.json
Simplify island plan task wiring and add a development helper for editing button regions used by button_extract.
  • Remove the explicit Scheduler step from the IslandPlan task sequence in task.yaml so IslandPlan runs its own scheduling directly.
  • Introduce dev_tools/button_region_editor.py, a script that masks or crops button images to a given area so that button_extract.py can regenerate accurate area/color/button values.
  • Seed the button region editor with a task to normalize ISLAND_SEED_SHOP_RETURN_CHECK’s region.
  • Ensure the tool enforces 1280x720 bounds and guides the developer to run button_extract afterwards.
module/config/argument/task.yaml
dev_tools/button_region_editor.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 introduces several updates to the Island module, including splitting the general Island task into specific sub-tasks in the task priority configurations, adding a button region editor tool, documenting an island feature expansion plan, and updating UI assets and page mappings. Additionally, it handles boss fleet withdrawals in combat search and adds macOS MuMu Pro support in device connection attributes. A review comment suggests adding a safe guard in module/device/connection_attr.py to prevent a potential AttributeError when self.config is None.

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.

Comment on lines +173 to +177
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

If self.config is None (which can happen when instantiating ConnectionAttr in standalone scripts or tests without a full configuration), accessing self.config.EmulatorInfo_Emulator will raise an AttributeError. We should safely guard this check.

Suggested change
return (
self.serial == '127.0.0.1:7555'
or self.is_mumu12_family
or self.config.EmulatorInfo_Emulator == 'MuMuPro'
)
return (
self.serial == '127.0.0.1:7555'
or self.is_mumu12_family
or (self.config and self.config.EmulatorInfo_Emulator == 'MuMuPro')
)

@Xuefeng-miao

Copy link
Copy Markdown
Collaborator Author

此 PR 是原 #248(swordcry424 提交)的替代品。
#248 被误操作合并后又撤销,但由于 GitHub 限制无法恢复为 Draft,故以此 PR 承载相同的 commit。

原作者 swordcry424 可在此继续推进,或关闭本 PR 后从自己的 fork 重新提交。

@wess09 wess09 deleted the branch wess09:dev June 8, 2026 05:13
@wess09 wess09 closed this Jun 8, 2026
@wess09 wess09 reopened this Jun 8, 2026
@wess09 wess09 deleted the branch wess09:dev June 8, 2026 15:56
@wess09 wess09 closed this Jun 8, 2026
@wess09 wess09 reopened this Jun 9, 2026
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.

2 participants