feat(PC): 支持 PC 端明日方舟 (#15407)

* feat(controller): 集成 MaaWin32ControlUnit 支持 Win32 窗口截图与控制

- 提取公共滑动插值逻辑到 SwipeHelper.hpp,重构 Minitouch/PlayTools 控制器
- 新增 Win32ControlUnitLoader 动态加载 MaaWin32ControlUnit.dll
- 新增 Win32Controller 实现 ControllerAPI,适配 touch_down/move/up 接口
- 添加 AsstAsyncAttachWindow 公开 API 用于绑定 Win32 窗口
- 添加 Win32 截图/输入方式的类型定义和枚举常量

* feat(api): 增加同步版本的 AsstAttachWindow 接口

模仿 AsstConnect 实现同步绑定 Win32 窗口的接口,方便简单场景下直接调用。
该接口标记为 deprecated,建议使用异步版本 AsstAsyncAttachWindow。

* fix: can build MaaCore

* feat: 完成整体适配

* feat(ci): 添加 MaaFramework Win32ControlUnit 下载步骤

使用 robinraju/release-downloader 从 MaaFramework 最新 release 下载
win-x64 版本并提取 MaaWin32ControlUnit 到构建产物中

* docs: 添加 Win32Controller 调试所需 MaaWin32ControlUnit 的说明

在开发文档的环境配置步骤中说明调试 Win32Controller 需要手动下载
MaaWin32ControlUnit.dll,并欢迎社区贡献自动下载脚本

* fix(i18n): 修改 UseAttachWindowWarning 措辞为"仅供尝鲜"

* fix: 小细节修复

* ci: fix maafw filename

* feat: PC 移至连接配置

* feat: 调整描述

* chore: 调整 PC 在连接配置中的顺序

* feat: 设置指引和开始唤醒界面 PC 选项绑定

---------

Co-authored-by: uye <99072975+ABA2396@users.noreply.github.com>
This commit is contained in:
MistEO
2026-01-18 21:17:59 +08:00
committed by GitHub
parent 99bde4818e
commit a11660cbac
34 changed files with 2042 additions and 353 deletions

View File

@@ -193,6 +193,34 @@ bool asst::Assistant::ctrl_connect(const std::string& adb_path, const std::strin
return ret;
}
#ifdef _WIN32
bool asst::Assistant::ctrl_attach_window(
void* hwnd,
Win32ScreencapMethod screencap_method,
Win32InputMethod mouse_method,
Win32InputMethod keyboard_method)
{
LogTraceFunction;
std::unique_lock<std::mutex> lock(m_mutex);
// 仍有任务进行attach 前需要 stop
if (!m_thread_idle) {
return false;
}
m_thread_idle = false;
bool ret = m_ctrler->attach_window(hwnd, screencap_method, mouse_method, keyboard_method);
if (ret) {
m_uuid = m_ctrler->get_uuid();
}
m_thread_idle = true;
return ret;
}
#endif
bool asst::Assistant::ctrl_click(int x, int y)
{
return m_ctrler->click(Point(x, y));
@@ -346,6 +374,38 @@ asst::Assistant::AsyncCallId asst::Assistant::async_connect(
block);
}
#ifdef _WIN32
bool asst::Assistant::attach_window(
void* hwnd,
Win32ScreencapMethod screencap_method,
Win32InputMethod mouse_method,
Win32InputMethod keyboard_method)
{
LogTraceFunction;
return ctrl_attach_window(hwnd, screencap_method, mouse_method, keyboard_method);
}
asst::Assistant::AsyncCallId asst::Assistant::async_attach_window(
void* hwnd,
Win32ScreencapMethod screencap_method,
Win32InputMethod mouse_method,
Win32InputMethod keyboard_method,
bool block)
{
LogTraceFunction;
return append_async_call(
AsyncCallItem::Type::AttachWindow,
AsyncCallItem::AttachWindowParams {
.hwnd = hwnd,
.screencap_method = screencap_method,
.mouse_method = mouse_method,
.keyboard_method = keyboard_method },
block);
}
#endif
asst::Assistant::AsyncCallId asst::Assistant::async_click(int x, int y, bool block)
{
LogTraceFunction;
@@ -580,6 +640,14 @@ void asst::Assistant::call_proc()
const auto& [adb_path, address, config] = std::get<AsyncCallItem::ConnectParams>(call_item.params);
ret = ctrl_connect(adb_path, address, config);
} break;
#ifdef _WIN32
case AsyncCallItem::Type::AttachWindow: {
what = "AttachWindow";
const auto& [hwnd, screencap_method, mouse_method, keyboard_method] =
std::get<AsyncCallItem::AttachWindowParams>(call_item.params);
ret = ctrl_attach_window(hwnd, screencap_method, mouse_method, keyboard_method);
} break;
#endif
case AsyncCallItem::Type::Click: {
what = "Click";
const auto& [x, y] = std::get<AsyncCallItem::ClickParams>(call_item.params);