Skip to content

添加控制器win32-默认#72

Closed
Hollow-YK wants to merge 16 commits into
1bananachicken:devfrom
Hollow-YK:feat/controller
Closed

添加控制器win32-默认#72
Hollow-YK wants to merge 16 commits into
1bananachicken:devfrom
Hollow-YK:feat/controller

Conversation

@Hollow-YK
Copy link
Copy Markdown
Contributor

先别合,稳定性未知

Hollow-YK and others added 16 commits May 3, 2026 01:39
* perf: 添加管理员权限提示

* feat: 领取奖励部分完成 (1bananachicken#32)

* Claim Rewards 领取奖励
1. 实现 task :“领取奖励”,能够自动领取活跃度奖励以及环期赏令的奖励
2. 在 interface 同文件夹下创建 tasks 文件夹,用于放置任务配置文件,更利于管理和维护
3. 在 interface.json 中添加对 ClaimRewards.json 的 import 引用

* 补充前一次 commit 中忘记提交的文件

* 删除一个逗号,避免pr出现问题

* 修改原本__ScenePrivateBackToWorldAny改为
SceneAnyEnterWorld_,因为这个流程将被作为公共流程被多个场景调用,不再使用私有流程的命名了。

* task: 领取奖励 完成
1. 完成了 [task]领取奖励 的功能,支持桌面端-前台控制器类型。
2. 更新了相关资源文件,包括界面资源和任务资源。
3. 修改了部分文件路径和命名以保持一致性。
4. 修改了 .gitignore 文件以忽略新的文件和目录。
5. interface.json 文件中添加了新的控制器配置,并调整了现有配置以适应新的功能需求。
6. interface.json 文件中将 [task]领取一咖舍收益 改为import引入

* 修改 interface.json , 暂时使用老方法导入任务

* 重构interface下的tasks结构,改用import方式引入

* 删除 interface 中的注释

* 功能基本稳定

* 一个自定义Click接口

* 自动钓鱼添加无限循环 (1bananachicken#37)

* 自动钓鱼添加无限循环

* 优化选项展示逻辑

* Feat: 增添了场景跳转相关的pipeline接口 (1bananachicken#62)

* Claim Rewards 领取奖励
1. 实现 task :“领取奖励”,能够自动领取活跃度奖励以及环期赏令的奖励
2. 在 interface 同文件夹下创建 tasks 文件夹,用于放置任务配置文件,更利于管理和维护
3. 在 interface.json 中添加对 ClaimRewards.json 的 import 引用

* 补充前一次 commit 中忘记提交的文件

* 删除一个逗号,避免pr出现问题

* 修改原本__ScenePrivateBackToWorldAny改为
SceneAnyEnterWorld_,因为这个流程将被作为公共流程被多个场景调用,不再使用私有流程的命名了。

* task: 领取奖励 完成
1. 完成了 [task]领取奖励 的功能,支持桌面端-前台控制器类型。
2. 更新了相关资源文件,包括界面资源和任务资源。
3. 修改了部分文件路径和命名以保持一致性。
4. 修改了 .gitignore 文件以忽略新的文件和目录。
5. interface.json 文件中添加了新的控制器配置,并调整了现有配置以适应新的功能需求。
6. interface.json 文件中将 [task]领取一咖舍收益 改为import引入

* Green mask of icon in world scene

* 修改interface.json

* 修改 interface.json , 暂时使用老方法导入任务

* 重构interface下的tasks结构,改用import方式引入

* 删除 interface 中的注释

* 完成场景相关的通用跳转

* feat: 增加 SceneAnyEnterWorld 处理登录画面
fix: 修改 SceneAnyEnterBattlePass 的一处bug
others: 调整文件结构

* 补充先前提交

* fix: 登录界面能被所有画面异常识别通过

* 解决完conflict了

* 优化自动卖鱼

* feat: 保留原本的钓鱼功能,增加重构的新一个钓鱼功能 (1bananachicken#69)

* 钓鱼重构基本完成

* 退出钓鱼时释放 A and D

* 修改新钓鱼功能相关名称,以合并老钓鱼功能

* 加回原本的钓鱼模块

* 钓鱼重构完成

* interface加回不小心删除的新钓鱼任务

* 补上了一个,

* fix&feat(realtime): 实现实时辅助自定义循环框架、完善剧情跳过“今日不再提示”功能、修复跳过剧情概率不生效问题 (1bananachicken#65)

* 添加鼠标置于跳过按钮上时的图片

* 跳过剧情添加今日不再提示弹窗判定

* 添加自定义节点控制各节点

* 把调试用的鼠标控制方式改回来

* 降低threshold防止部分场景不匹配

* 坏了坏了我CC配置怎么传上去了

* 仅允许前台控制器

* 调整了前台/后台控制器顺序,并为其它需要限定控制器的功能添加限制

* fix: 修复钓鱼循环部分 (1bananachicken#70)

* 钓鱼重构基本完成

* 退出钓鱼时释放 A and D

* 修改新钓鱼功能相关名称,以合并老钓鱼功能

* 加回原本的钓鱼模块

* 钓鱼重构完成

* interface加回不小心删除的新钓鱼任务

* 把抛竿从agent里去掉之后忘记加回去了

* fix/fish_new: 钓鱼循环部分修复

* 又双叒叕修复了自动钓鱼 (1bananachicken#71)

* 又双叒叕修复了自动钓鱼

* 暂时屏蔽新版钓鱼功能

---------

Co-authored-by: overflow65537 <err.overflow@gmail.com>
Co-authored-by: EeeMaoY <132805890+EeeMaoY@users.noreply.github.com>
Co-authored-by: Hollow <116991734+Hollow-YK@users.noreply.github.com>
* perf: 添加管理员权限提示

* feat: 领取奖励部分完成 (1bananachicken#32)

* Claim Rewards 领取奖励
1. 实现 task :“领取奖励”,能够自动领取活跃度奖励以及环期赏令的奖励
2. 在 interface 同文件夹下创建 tasks 文件夹,用于放置任务配置文件,更利于管理和维护
3. 在 interface.json 中添加对 ClaimRewards.json 的 import 引用

* 补充前一次 commit 中忘记提交的文件

* 删除一个逗号,避免pr出现问题

* 修改原本__ScenePrivateBackToWorldAny改为
SceneAnyEnterWorld_,因为这个流程将被作为公共流程被多个场景调用,不再使用私有流程的命名了。

* task: 领取奖励 完成
1. 完成了 [task]领取奖励 的功能,支持桌面端-前台控制器类型。
2. 更新了相关资源文件,包括界面资源和任务资源。
3. 修改了部分文件路径和命名以保持一致性。
4. 修改了 .gitignore 文件以忽略新的文件和目录。
5. interface.json 文件中添加了新的控制器配置,并调整了现有配置以适应新的功能需求。
6. interface.json 文件中将 [task]领取一咖舍收益 改为import引入

* 修改 interface.json , 暂时使用老方法导入任务

* 重构interface下的tasks结构,改用import方式引入

* 删除 interface 中的注释

* 功能基本稳定

* 一个自定义Click接口

* 自动钓鱼添加无限循环 (1bananachicken#37)

* 自动钓鱼添加无限循环

* 优化选项展示逻辑

* Feat: 增添了场景跳转相关的pipeline接口 (1bananachicken#62)

* Claim Rewards 领取奖励
1. 实现 task :“领取奖励”,能够自动领取活跃度奖励以及环期赏令的奖励
2. 在 interface 同文件夹下创建 tasks 文件夹,用于放置任务配置文件,更利于管理和维护
3. 在 interface.json 中添加对 ClaimRewards.json 的 import 引用

* 补充前一次 commit 中忘记提交的文件

* 删除一个逗号,避免pr出现问题

* 修改原本__ScenePrivateBackToWorldAny改为
SceneAnyEnterWorld_,因为这个流程将被作为公共流程被多个场景调用,不再使用私有流程的命名了。

* task: 领取奖励 完成
1. 完成了 [task]领取奖励 的功能,支持桌面端-前台控制器类型。
2. 更新了相关资源文件,包括界面资源和任务资源。
3. 修改了部分文件路径和命名以保持一致性。
4. 修改了 .gitignore 文件以忽略新的文件和目录。
5. interface.json 文件中添加了新的控制器配置,并调整了现有配置以适应新的功能需求。
6. interface.json 文件中将 [task]领取一咖舍收益 改为import引入

* Green mask of icon in world scene

* 修改interface.json

* 修改 interface.json , 暂时使用老方法导入任务

* 重构interface下的tasks结构,改用import方式引入

* 删除 interface 中的注释

* 完成场景相关的通用跳转

* feat: 增加 SceneAnyEnterWorld 处理登录画面
fix: 修改 SceneAnyEnterBattlePass 的一处bug
others: 调整文件结构

* 补充先前提交

* fix: 登录界面能被所有画面异常识别通过

* 解决完conflict了

* 优化自动卖鱼

* feat: 保留原本的钓鱼功能,增加重构的新一个钓鱼功能 (1bananachicken#69)

* 钓鱼重构基本完成

* 退出钓鱼时释放 A and D

* 修改新钓鱼功能相关名称,以合并老钓鱼功能

* 加回原本的钓鱼模块

* 钓鱼重构完成

* interface加回不小心删除的新钓鱼任务

* 补上了一个,

* fix&feat(realtime): 实现实时辅助自定义循环框架、完善剧情跳过“今日不再提示”功能、修复跳过剧情概率不生效问题 (1bananachicken#65)

* 添加鼠标置于跳过按钮上时的图片

* 跳过剧情添加今日不再提示弹窗判定

* 添加自定义节点控制各节点

* 把调试用的鼠标控制方式改回来

* 降低threshold防止部分场景不匹配

* 坏了坏了我CC配置怎么传上去了

* 仅允许前台控制器

* 调整了前台/后台控制器顺序,并为其它需要限定控制器的功能添加限制

* fix: 修复钓鱼循环部分 (1bananachicken#70)

* 钓鱼重构基本完成

* 退出钓鱼时释放 A and D

* 修改新钓鱼功能相关名称,以合并老钓鱼功能

* 加回原本的钓鱼模块

* 钓鱼重构完成

* interface加回不小心删除的新钓鱼任务

* 把抛竿从agent里去掉之后忘记加回去了

* fix/fish_new: 钓鱼循环部分修复

* 又双叒叕修复了自动钓鱼 (1bananachicken#71)

* 又双叒叕修复了自动钓鱼

* 暂时屏蔽新版钓鱼功能

---------

Co-authored-by: overflow65537 <err.overflow@gmail.com>
Co-authored-by: EeeMaoY <132805890+EeeMaoY@users.noreply.github.com>
Co-authored-by: Hollow <116991734+Hollow-YK@users.noreply.github.com>
* 钓鱼重构基本完成

* 退出钓鱼时释放 A and D

* 修改新钓鱼功能相关名称,以合并老钓鱼功能

* 加回原本的钓鱼模块

* 钓鱼重构完成

* interface加回不小心删除的新钓鱼任务

* 把抛竿从agent里去掉之后忘记加回去了

* fix/fish_new: 钓鱼循环部分修复
* 又双叒叕修复了自动钓鱼

* 暂时屏蔽新版钓鱼功能
* 添加功能介绍

* Update 问题排查

* Update
* assets: add auto_rhythm(超强音) temple images

* feat(auto_rhythm): 轨道计算

* feat(rhythm): add __init__.py package aggregator for rhythm module

Exports LaneLayout, build_lane_layout, RhythmDetector, SceneGate,
SongSelector and state constants as the rhythm package's public API.

* feat(rhythm): add assets.py for image resource path resolution

Provides list_scene_templates() and list_song_templates() pointing to
MaaNTE's assets/resource/base/image/auto_rhythm/ directory.
Replaces the original src/assets.py which was tied to the standalone
project layout.

* feat: implement AutoRhythm CustomAction integrating rhythm gameplay

Main entry point registered as MaaFramework custom_action "auto_rhythm".
Includes:
- _KeyDispatcher: async key dispatch with per-lane timing compensation
  (preserving F-lane 0.08s delay from original auto_rhythm)
- _load_rhythm_config(): external JSON config with built-in defaults
- Full game loop: screenshot → scene detection → note detection → key dispatch
- Song selector integration via MaaFramework controller API
- Auto-repeat after results screen with configurable count

* feat(pipeline): add Rhythm.json task pipeline definition

Defines the rhythm task flow: RhythmEntrance → RhythmStart (auto_rhythm
custom action) → RhythmExit (return to world). Error path falls back
to RhythmExit via on_error.

* feat(pipeline): add RhythmScene.json for playing/results/song_select recognition

TemplateMatch-based scene detection nodes for the three rhythm game
interfaces using auto_rhythm scene template images.

* feat(config): add rhythm_config.json with full rhythm detection parameters

JSON-equivalent of the original auto_rhythm configs/default.yaml.
Contains lanes geometry, HSV color ranges for D/F/J/K tracks,
component-mode detection settings, scene gate thresholds, song
selection parameters, auto-repeat config, and key timing settings.

* fix(rhythm): correct import to use relative path in detector.py

- from rhythm.lanes → from .lanes
Fixes ImportError when loaded as a submodule of the rhythm package.
Otherwise no logic changes — HSV detection core preserved from original.

* fix(rhythm): replace absolute src.* imports with relative imports in presence.py

- from src.assets → from .assets
- from src.lanes → from .lanes
Fixes import resolution for the SceneGate class and state constants
when running under MaaNTE's agent module hierarchy.

* refactor(rhythm): adapt SongSelector to MaaFramework controller API

- from src.assets/lanes/mouse → from .assets/.lanes (relative imports)
- Removed MouseClicker dependency; step() now receives controller and
  scroll_func callback
- Click actions use controller.post_click() instead of MouseClicker
- Scroll actions delegated to scroll_func (WM_MOUSEWHEEL via win32api)

* feat: register AutoRhythm in action module exports

- Added from .auto_rhythm import *
- Added "AutoRhythm" to __all__
Ensures the custom action is auto-loaded when MaaNTE agent starts.

* feat(interface): add rhythm task and options to interface.json

Task: "自动演奏" (entry: RhythmStart)
Options:
- 演奏目标歌曲: song_name (string), select song template by name
- 自动连打次数: auto_repeat_count (int), repeat after results screen
- 演奏目标帧率: target_fps (int), detection loop frame rate

All options map to custom_action_param overrides on RhythmStart node.

* docs

* docs: update ignore fields

* feat(auto_drum): add auto drum interface

* fix(ci): use Aliyun mirror for pip installation in embed Python setup

* feat(logger): intercept stdlib logging into loguru

* assets: add templates of drum playing status

* refactor(rhythm): replace HSV pixel detection with template matching

Replace RhythmDetector (HSV color-space pixel counting with connected
component analysis) with DrumDetector (cv2.matchTemplate using drum
face template images). The new detector loads press_d/f/j/k.png from
drum_templates/ and uses TM_CCOEFF_NORMED with per-lane thresholds
and cooldown, matching all four lanes in parallel via ThreadPoolExecutor.

Simplify LaneLayout dataclass by removing unused fields (top/bottom
center_x, judge_center_y, roi_y0/y1) and helper functions
(lane_center_x_at_y, lane_roi_quad, lane_judge_slice,
lane_full_roi_slice). Add _center_x_at_judge for computing lane
center x at the judge line position.

Add drum_templates_dir() and list_drum_templates() to assets module
with module-level template caching. Improve image root discovery by
walking up parent directories instead of hardcoding depth.

* refactor(rhythm): simplify scene detection to template-only voting

Remove Laplacian variance drum-presence detection (_measure_patches)
and the armed/disarmed state machine. Scene identification now uses
pure template matching with a voting mechanism, enabled by default.

Add module-level scene template caching via _load_scene_templates_once().
Optimize PLAYING state by checking for RESULTS templates only every
playing_check_interval frames instead of every frame.

Remove image preprocessing (blur, downscale, ROI cropping) from the
matching pipeline. The step() method no longer requires a LaneLayout
parameter.

* feat(rhythm): improve song selector with caching, retry and no-song mode

Add module-level template caching for start button and song templates
to avoid repeated disk I/O. Implement retry logic for the "start"
button match (max_start_retries) instead of failing immediately.

Support no-song mode: when no song name is specified, skip directly
to matching the "start" button. Remove the "waiting" state; after
clicking start, transition directly to "done".

Add .wait() calls after controller.post_click() to ensure clicks
complete. Convert enabled/song_name to read-only properties. Remove
LaneLayout parameter from step() method signature.

* refactor(rhythm): replace win32 key dispatch with Maa controller, add param action

Remove _KeyDispatcher (threaded key dispatch using win32api) and
_find_game_hwnd/_do_scroll (direct Win32 calls). Replace with Maa
framework controller APIs: post_key_down/up for key input,
post_click_key for ESC, and post_swipe for scrolling.

Add RhythmSetParam custom action that passes pipeline parameters
(song_name, auto_repeat_count, target_fps) via environment variables,
allowing the pipeline to set parameters before AutoRhythm starts.

Update Rhythm.json pipeline: add RhythmSetSong → RhythmSetRepeat →
RhythmSetFPS nodes before RhythmStart. Remove
__ScenePrivateBackToWorldAny from RhythmExit next list.

Update interface.json pipeline_override targets from RhythmStart to
the new RhythmSetSong/RhythmSetRepeat/RhythmSetFPS nodes with the
rhythm_set_param custom action.

Add scene transition logging, frame counting, and layout caching to
the main loop. Improve config file discovery by walking up parent
directories instead of hardcoding path depth.

* refactor(rhythm): relocate rhythm_config.json to resource root

Move rhythm_config.json from assets/resource/base/pipeline/Rhythm/
to assets/resource/base/ for easier discovery by the config loader
that walks up parent directories.

Update config content to match the new template-based detection:
replace hsv_ranges/detection/presence sections with
template_detection, remove judge_band_keep_from_top/roi_top_y_frac,
set match_vote_min to 1, add playing_check_interval, update
scroll_area_x_frac to 0.25, and reset press_delay_sec_by_lane to
all zeros.

* feat(rhythm): add quick results detection and optimize scene check frequency

Add _quick_check_results() that uses the score template to detect
RESULTS state with a lightweight ROI match every 30 frames during
PLAYING, falling back to full scene_gate.step() only when the quick
check hits or every 120 frames. This avoids running the full scene
template matching pipeline on every frame while still detecting
RESULTS promptly.

Replace post_swipe with controller.post_scroll for song list scrolling,
which better matches the scroll wheel semantics.

Fix ESC key re-send on RESULTS: add esc_sent_for_results flag to
ensure ESC is sent only once per results screen. Add playing_frame_count
to track frames within PLAYING state for scene check scheduling.

Change playing_check_interval default from 30 to 1 since the main
loop now controls scene check frequency independently.

* refactor(rhythm): simplify detector ROI width to template-based calculation

Replace the ROI half-width calculation in _match_lane from
max(tw, half_width_px * region_width_multiplier) to tw // 2 + 5,
using the template width directly instead of depending on lane layout
and region_width_multiplier config. This produces a tighter, more
predictable search region centered on the template size.

* fix(rhythm): click default song position before start button in no-song mode

Add clicking_default state between idle and clicking_start when no
specific song is requested. Click the song list at the scroll area
position to select a default song before attempting to match and
click the "start" button. This ensures a song is always selected
before starting, preventing the start button from being unresponsive
due to no song being highlighted.

* feat(song_selector): add default picked song

* feat(interface): switch screencap to DXGI and add foreground warning for rhythm

Change screencap method from PrintWindow to DXGI_DesktopDup for
better capture performance in foreground mode. Add description to
the rhythm task entry warning that it only supports foreground mode
and the game window should not be obscured during operation.

* chore: narrow vscode JSON schema scope to pipeline files only

* tune(rhythm): enlarge detection region, unify F lane judge line, fix scroll

Unify judge_line_y_frac_by_lane to 0.78 for all lanes. Increase
region_extend_up/down_frac and region_width_multiplier for wider
template search area. Fix scrolling by adding post_touch_down before
post_scroll. Raise scene check intervals (quick: 60, full: 300).
Skip frame limiter sleep during PLAYING state.

* refactor(detector): move cooldown check to analyze level, add debug log

Move cooldown check from _match_lane into analyze() to skip
submitting already-cooling lanes to ThreadPoolExecutor. Refine ROI
half-width calc to base_half = max(half_width_px, tw//2) * multiplier.
Add per-lane debug logging for match scores in _match_lane.

* revert(interface): restore PrintWindow screencap, remove rhythm description

* fix(pipeline): add on_error fallback to RhythmEntry and setup nodes

* docs: add local test infos ignore

* refactor(rhythm): replace scroll with touch slide, remove quick-results check

Replace post_scroll with multi-step touch_down/move/up for reliable
scrolling. Remove the dedicated quick-results template check added
earlier; PLAYING state now calls scene_gate.step every frame with
results_roi_frac for accurate RESULTS detection. Tune default config
parameters. Remove unused imports.

* feat(presence): crop results ROI to improve RESULTS detection during PLAYING

Add results_roi_frac to crop the upper portion of the frame before
template matching for RESULTS state, reducing interference from drum
notes in the lower portion of the screen during PLAYING.

* tune(rhythm): adjust cooldown, detection region, and scene check params

Increase cooldown_sec from 0.03 to 0.05 to reduce false triggers.
Widen detection region (region_extend_down_frac 0.10→0.15,
region_width_multiplier 3.5→4.0) for better note coverage.
Reduce state_confirm_frames to 1 for quicker scene transitions.
Set playing_check_interval to 10. Add results_roi_frac config.

* refactor(presence): remove results ROI crop, reduce check interval to 5

* fix(rhythm): replace touch scroll with click+scroll, add scene lock to prevent false RESULTS

* feat(scroll): 通过窗口句柄绕过maa发送滚动事件

* feat(auto_rhythm): 回退, 修改为post_swipe

* fix

* fix

* Co-authored-by: yiqcy

* Co-authored-by: Gloaming02

* asseta

* co: 思路提供, 模板图提供

Co-authored-by: Gloaming02 <Gloaming02@users.noreply.github.com>
Co-authored-by: yiqcy <yiqcy@users.noreply.github.com>

* docs: 修改鼠标模式为Seize

* chore: 内联简单函数

* refactor: 重构超强音相关目录结构

* chore: 修改自动演奏任务相关界面展示

* feat(drum): 优化演奏加锁机制, 提高功能稳定性

* assets: 添加地图内无冲突固定ui, 超强音交互入口ui

* fix: 修复连打时一次性消费歌名变量的问题

* chore: conflict done

* feat

* chore

* merge

* return

* chore

* chore

* script: 一键本地打包!!!!

- 不过由于莫名其妙的问题,得自己把 Lib | Scripts 放到打包 install\python 里

* feat: 连打关闭, 新的冷却锁机制

* feat: 减小滚动距离, 增大滚动时长

* feat: 减小滚动距离, 增大滚动时长

Co-authored-by: Guaaaaaaaan Guaaaaaaaan@users.noreply.github.com

* Revert "feat: 减小滚动距离, 增大滚动时长"

This reverts commit 41e5386.

* feat: 减小滚动距离, 增大滚动时长

Co-authored-by: Guaaaaaaaan <Guaaaaaaaan@users.noreply.github.com>

* refactor: 减小custom action体量,重构为pipeline

* feat: 歌单列表上滚

* chore

* chore

---------

Co-authored-by: yororoA <364817735@qq.com>
Co-authored-by: Gloaming02 <Gloaming02@users.noreply.github.com>
Co-authored-by: yiqcy <yiqcy@users.noreply.github.com>
Co-authored-by: Guaaaaaaaan <Guaaaaaaaan@users.noreply.github.com>
@Hollow-YK Hollow-YK closed this May 3, 2026
@Hollow-YK Hollow-YK deleted the feat/controller branch May 3, 2026 15:27
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.

4 participants