mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 01:40:46 +08:00
* 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>
134 lines
4.7 KiB
C
134 lines
4.7 KiB
C
#pragma once
|
|
|
|
#include "AsstPort.h"
|
|
#include <stdint.h>
|
|
|
|
struct AsstExtAPI;
|
|
typedef struct AsstExtAPI* AsstHandle;
|
|
|
|
#ifdef _WIN32
|
|
// Win32 截图方式
|
|
typedef enum AsstWin32ScreencapMethodEnum
|
|
{
|
|
AsstWin32ScreencapMethod_None = 0,
|
|
AsstWin32ScreencapMethod_GDI = 1,
|
|
AsstWin32ScreencapMethod_FramePool = 1 << 1,
|
|
AsstWin32ScreencapMethod_DXGI_DesktopDup = 1 << 2,
|
|
AsstWin32ScreencapMethod_DXGI_DesktopDup_Window = 1 << 3,
|
|
AsstWin32ScreencapMethod_PrintWindow = 1 << 4,
|
|
AsstWin32ScreencapMethod_ScreenDC = 1 << 5,
|
|
} AsstWin32ScreencapMethodEnum;
|
|
|
|
// Win32 输入方式
|
|
typedef enum AsstWin32InputMethodEnum
|
|
{
|
|
AsstWin32InputMethod_None = 0,
|
|
AsstWin32InputMethod_Seize = 1,
|
|
AsstWin32InputMethod_SendMessage = 1 << 1,
|
|
AsstWin32InputMethod_PostMessage = 1 << 2,
|
|
AsstWin32InputMethod_LegacyEvent = 1 << 3,
|
|
AsstWin32InputMethod_PostThreadMessage = 1 << 4,
|
|
AsstWin32InputMethod_SendMessageWithCursorPos = 1 << 5,
|
|
AsstWin32InputMethod_PostMessageWithCursorPos = 1 << 6,
|
|
} AsstWin32InputMethodEnum;
|
|
#endif
|
|
|
|
typedef uint8_t AsstBool;
|
|
typedef uint64_t AsstSize;
|
|
|
|
typedef int32_t AsstId;
|
|
typedef AsstId AsstMsgId;
|
|
typedef AsstId AsstTaskId;
|
|
typedef AsstId AsstAsyncCallId;
|
|
|
|
typedef int32_t AsstOptionKey;
|
|
typedef AsstOptionKey AsstStaticOptionKey;
|
|
typedef AsstOptionKey AsstInstanceOptionKey;
|
|
|
|
typedef void(ASST_CALL* AsstApiCallback)(AsstMsgId msg, const char* details_json, void* custom_arg);
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
AsstBool ASSTAPI AsstSetUserDir(const char* path);
|
|
AsstBool ASSTAPI AsstLoadResource(const char* path);
|
|
AsstBool ASSTAPI AsstSetStaticOption(AsstStaticOptionKey key, const char* value);
|
|
|
|
AsstHandle ASSTAPI AsstCreate();
|
|
AsstHandle ASSTAPI AsstCreateEx(AsstApiCallback callback, void* custom_arg);
|
|
void ASSTAPI AsstDestroy(AsstHandle handle);
|
|
|
|
AsstBool ASSTAPI
|
|
AsstSetInstanceOption(AsstHandle handle, AsstInstanceOptionKey key, const char* value);
|
|
|
|
// 同步连接,功能已完全被异步连接取代
|
|
// FIXME: 5.0 版本将废弃此接口
|
|
/* deprecated */ AsstBool ASSTAPI AsstConnect(
|
|
AsstHandle handle,
|
|
const char* adb_path,
|
|
const char* address,
|
|
const char* config);
|
|
|
|
AsstTaskId ASSTAPI AsstAppendTask(AsstHandle handle, const char* type, const char* params);
|
|
AsstBool ASSTAPI AsstSetTaskParams(AsstHandle handle, AsstTaskId id, const char* params);
|
|
|
|
AsstBool ASSTAPI AsstStart(AsstHandle handle);
|
|
AsstBool ASSTAPI AsstStop(AsstHandle handle);
|
|
AsstBool ASSTAPI AsstRunning(AsstHandle handle);
|
|
AsstBool ASSTAPI AsstConnected(AsstHandle handle);
|
|
AsstBool ASSTAPI AsstBackToHome(AsstHandle handle);
|
|
|
|
/* Async with AsstMsg::AsyncCallInfo Callback*/
|
|
AsstAsyncCallId ASSTAPI AsstAsyncConnect(
|
|
AsstHandle handle,
|
|
const char* adb_path,
|
|
const char* address,
|
|
const char* config,
|
|
AsstBool block);
|
|
void ASSTAPI AsstSetConnectionExtras(const char* name, const char* extras);
|
|
|
|
#ifdef _WIN32
|
|
// 同步绑定到 Win32 窗口,功能已完全被异步绑定取代
|
|
// FIXME: 5.0 版本将废弃此接口
|
|
// hwnd: 目标窗口句柄
|
|
// screencap_method: 截图方式,参见 Win32ScreencapMethod
|
|
// mouse_method: 鼠标输入方式,参见 Win32InputMethod
|
|
// keyboard_method: 键盘输入方式,参见 Win32InputMethod
|
|
/* deprecated */ AsstBool ASSTAPI AsstAttachWindow(
|
|
AsstHandle handle,
|
|
void* hwnd,
|
|
uint64_t screencap_method,
|
|
uint64_t mouse_method,
|
|
uint64_t keyboard_method);
|
|
|
|
// 异步绑定到 Win32 窗口(仅 Windows 平台)
|
|
// hwnd: 目标窗口句柄
|
|
// screencap_method: 截图方式,参见 Win32ScreencapMethod
|
|
// mouse_method: 鼠标输入方式,参见 Win32InputMethod
|
|
// keyboard_method: 键盘输入方式,参见 Win32InputMethod
|
|
AsstAsyncCallId ASSTAPI AsstAsyncAttachWindow(
|
|
AsstHandle handle,
|
|
void* hwnd,
|
|
uint64_t screencap_method,
|
|
uint64_t mouse_method,
|
|
uint64_t keyboard_method,
|
|
AsstBool block);
|
|
#endif
|
|
|
|
AsstAsyncCallId ASSTAPI AsstAsyncClick(AsstHandle handle, int32_t x, int32_t y, AsstBool block);
|
|
AsstAsyncCallId ASSTAPI AsstAsyncScreencap(AsstHandle handle, AsstBool block);
|
|
|
|
AsstSize ASSTAPI AsstGetImage(AsstHandle handle, void* buff, AsstSize buff_size);
|
|
AsstSize ASSTAPI AsstGetImageBgr(AsstHandle handle, void* buff, AsstSize buff_size);
|
|
AsstSize ASSTAPI AsstGetUUID(AsstHandle handle, char* buff, AsstSize buff_size);
|
|
AsstSize ASSTAPI AsstGetTasksList(AsstHandle handle, AsstTaskId* buff, AsstSize buff_size);
|
|
AsstSize ASSTAPI AsstGetNullSize();
|
|
|
|
ASSTAPI_PORT const char* ASST_CALL AsstGetVersion();
|
|
void ASSTAPI AsstLog(const char* level, const char* message);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|