diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c320434..7fb360f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -72,12 +72,38 @@ jobs: with: go-version: 'stable' + - name: Resolve MaaFramework Release + id: resolve_maa_release + uses: actions/github-script@v9 + env: + TARGET_REPOSITORY: MaaXYZ/MaaFramework + with: + result-encoding: string + script: | + const repository = process.env.TARGET_REPOSITORY + const [owner, repo] = repository.split('/') + const releases = await github.paginate(github.rest.repos.listReleases, { + owner, + repo, + per_page: 100, + }) + + const latestRelease = releases.find(release => !release.draft) + if (!latestRelease) { + core.setFailed(`No published release found for ${repository}`) + return '' + } + + core.info( + `Resolved MaaFramework release: ${latestRelease.tag_name} (prerelease=${latestRelease.prerelease})` + ) + return latestRelease.tag_name + - name: Download MaaFramework uses: robinraju/release-downloader@v1 with: repository: MaaXYZ/MaaFramework - latest: true - preRelease: true + tag: ${{ steps.resolve_maa_release.outputs.result }} fileName: "${{ env.MAA_FILE_PREFIX }}-${{ env.ARCH }}*" out-file-path: "deps" extract: true diff --git a/CHANGELOG.md b/CHANGELOG.md index f4f4548..402142f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,7 +63,9 @@ **移除构造函数**:`NewCarouselImageController` 已移除。若仅需空操作控制器,请使用 `NewBlankController()`;若需基于录制数据回放,请使用 `NewReplayController(recordingPath)`,录制入口为 `NewRecordController(inner, recordingPath)`。 **新增**:`SetScreenshot(opts ...ScreenshotOption) error` 与配套选项函数;新增 `WithScreenshotResizeMethod(...)` / `ScreenshotResizeMethod*` 常量,以及 `SetMouseLockFollow(enabled bool) error` **新增控制器构造函数**:`NewMacOSController(...)`、`NewAndroidNativeController(...)`、`NewReplayController(...)`、`NewRecordController(...)` -**接口变更**:`CustomController` 接口新增 `RelativeMove(dx, dy int32) bool`、`Shell(cmd string, timeout int64) (string, bool)`、`GetInfo() (string, bool)` 必须实现方法。已有实现若无需支持,可返回 no-op 成功值 +**接口变更**: +- `CustomController` 接口新增 `RelativeMove(dx, dy int32) bool`、`Shell(cmd string, timeout int64) (string, bool)`、`GetInfo() (string, bool)` 必须实现方法。已有实现若无需支持,可返回 no-op 成功值 +- WlRoots 支持将按键视为 Win32 VK 键码:`NewWlRootsController(wlrSocketPath string, useWin32VkCode bool)` **Win32 InputMethod 命名对齐**: - `InputSendMessageWithCursorPosAndBlockInput` → `InputSendMessageWithWindowPos` - `InputPostMessageWithCursorPosAndBlockInput` → `InputPostMessageWithWindowPos` diff --git a/controller.go b/controller.go index bf9ddb0..7652998 100644 --- a/controller.go +++ b/controller.go @@ -97,8 +97,9 @@ func NewWin32Controller( // NewWlRootsController creates a WlRoots controller instance. func NewWlRootsController( wlrSocketPath string, + useWin32VkCode bool, ) (*Controller, error) { - handle := native.MaaWlRootsControllerCreate(wlrSocketPath) + handle := native.MaaWlRootsControllerCreate(wlrSocketPath, useWin32VkCode) if handle == 0 { return nil, errors.New("failed to create WlRoots controller") } diff --git a/internal/native/framework.go b/internal/native/framework.go index 8ada3ed..a1e80c8 100644 --- a/internal/native/framework.go +++ b/internal/native/framework.go @@ -217,7 +217,7 @@ var ( MaaAdbControllerCreate func(adbPath, address string, screencapMethods uint64, inputMethods uint64, config, agentPath string) uintptr MaaPlayCoverControllerCreate func(address, uuid string) uintptr MaaWin32ControllerCreate func(hWnd unsafe.Pointer, screencapMethods uint64, mouseMethod, keyboardMethod uint64) uintptr - MaaWlRootsControllerCreate func(wlrSocketPath string) uintptr + MaaWlRootsControllerCreate func(wlrSocketPath string, useWin32VkCode bool) uintptr MaaCustomControllerCreate func(controller unsafe.Pointer, controllerArg uintptr) uintptr MaaGamepadControllerCreate func(hWnd unsafe.Pointer, gamepadType MaaGamepadType, screencapMethod uint64) uintptr MaaMacOSControllerCreate func(windowID uint32, screencapMethod MaaMacOSScreencapMethod, inputMethod MaaMacOSInputMethod) uintptr