Skip to content

Commit 9fcc020

Browse files
ZHiderZHider
andauthored
更新 maa-framework 依赖版本,支持 Win32InputMethod.Interception (#318)
Co-authored-by: ZHider <littlehider@gmail.com> Signed-off-by: ZHider <littlehider@gmail.com>
1 parent fe2d7de commit 9fcc020

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
[MXU Releases](https://github.com/MistEO/MXU/releases) 中提供了单可执行文件(Windows 为 `mxu.exe`,Linux/macOS 为 `mxu`),您需要配置以下依赖:
2929

30-
- [MaaFramework](https://github.com/MaaXYZ/MaaFramework/releases) 运行库 ( >= `v5.5.0-beta.1` ) ,将压缩包中的 `bin` 文件夹内容解压到 `maafw` 文件夹中
30+
- [MaaFramework](https://github.com/MaaXYZ/MaaFramework/releases) 运行库 ( >= `v5.12.1` ) ,将压缩包中的 `bin` 文件夹内容解压到 `maafw` 文件夹中
3131
- [interface.json](https://github.com/MaaXYZ/MaaFramework/blob/main/sample/interface.json) 及相关资源文件,请参考 [PI 协议文档](https://github.com/MaaXYZ/MaaFramework/blob/main/docs/zh_cn/3.3-ProjectInterfaceV2%E5%8D%8F%E8%AE%AE.md) 编写
3232

3333
目录结构如下

src-tauri/src/commands/maa_core.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use super::types::{
2424
use super::utils::{emit_callback_event, get_maafw_dir, handle_task_callback, normalize_path};
2525

2626
/// MaaFramework 最小支持版本
27-
const MIN_MAAFW_VERSION: &str = "5.5.0-beta.1";
27+
const MIN_MAAFW_VERSION: &str = "5.12.1";
2828

2929
/// Linux 控制器所需的最小 MaaFramework 版本(libei 输入 / gamescope 发现 / Portal 辅助)
3030
#[cfg(target_os = "linux")]
@@ -502,7 +502,7 @@ pub fn maa_check_version(state: State<Arc<MaaState>>) -> Result<VersionCheckResu
502502
return Err("MaaFramework not initialized".to_string());
503503
}
504504

505-
// 去掉版本号前缀 'v'(如 "v5.5.0-beta.1" -> "5.5.0-beta.1")
505+
// 去掉版本号前缀 'v'(如 "v5.12.1" -> "5.12.1")
506506
let current_clean = current_str.trim_start_matches('v');
507507
let min_clean = MIN_MAAFW_VERSION.trim_start_matches('v');
508508

src/types/maa.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// MaaFramework 类型定义
22

3+
import { loggers } from '@/utils/logger';
4+
35
/** ADB 设备信息 */
46
export interface AdbDevice {
57
name: string;
@@ -159,6 +161,7 @@ export const Win32InputMethod = {
159161
PostMessageWithCursorPos: 1n << 6n,
160162
SendMessageWithWindowPos: 1n << 7n,
161163
PostMessageWithWindowPos: 1n << 8n,
164+
Interception: 1n << 9n,
162165
} as const;
163166

164167
/** Win32 截图方法名称映射 */
@@ -184,6 +187,7 @@ export const Win32InputMethodNames: Record<string, bigint> = {
184187
PostMessageWithCursorPos: Win32InputMethod.PostMessageWithCursorPos,
185188
SendMessageWithWindowPos: Win32InputMethod.SendMessageWithWindowPos,
186189
PostMessageWithWindowPos: Win32InputMethod.PostMessageWithWindowPos,
190+
Interception: Win32InputMethod.Interception,
187191
};
188192

189193
/** macOS 截图方法 */
@@ -233,7 +237,11 @@ export function parseWin32InputMethod(name: string): number {
233237
if (method !== undefined) {
234238
return Number(method);
235239
}
236-
// 默认使用 Seize
240+
// 默认使用 Seize;遇到非合规值时记录警告
241+
loggers.config.warn(
242+
'遇到非合规的 Win32 输入方法名称,已回退到默认值 Seize。',
243+
{ name, fallback: 'Seize' },
244+
);
237245
return Number(Win32InputMethod.Seize);
238246
}
239247

0 commit comments

Comments
 (0)