Skip to content

2.4 Control Methods

This document provides detailed explanations of the various Screencap (screenshot) and Input (control) methods in MaaFramework and their configurations.

TIP

  • For APIs, screencap/input uses int type (bitwise OR combination); for ProjectInterface V2, use string type (use the name directly).
  • ProjectInterface V2 only supports configuring screencap/mouse/keyboard methods for Win32 controllers. For Adb controllers, screencap/input uses MaaToolkitAdbDeviceFind to automatically detect and select the optimal method, no manual configuration required.

Adb

Adb Input

Reference: MaaDef.h

Combine the selected methods below using bitwise OR to provide a single value. MaaFramework will try all provided methods in a fixed priority order and select the first available method.

By default, all methods except EmulatorExtras are attempted.

Priority: EmulatorExtras > Maatouch > MinitouchAndAdbKey > AdbShell

NameAPI ValueSpeedCompatibilityDescription
AdbShell1SlowHigh
MinitouchAndAdbKey2FastMediumKey input still uses AdbShell
Maatouch4FastMedium
EmulatorExtras8FastLowOnly supports emulators: MuMu 12

Adb Screencap

Reference: MaaDef.h

Combine the selected methods below using bitwise OR to provide a single value. MaaFramework will try all provided methods and select the fastest available method.

By default, all methods except RawByNetcat, MinicapDirect, and MinicapStream are attempted.

MinicapDirect and MinicapStream encode to jpg (lossy compression), which significantly reduces template matching effectiveness and are not recommended.

NameAPI ValueSpeedCompatibilityEncodingDescription
EncodeToFileAndPull1SlowHighLossless
Encode2SlowHighLossless
RawWithGzip4MediumHighLossless
RawByNetcat8FastLowLossless
MinicapDirect16FastLowLossy
MinicapStream32Very FastLowLossy
EmulatorExtras64Very FastLowLosslessOnly supports emulators: MuMu 12, LDPlayer 9, and AVD

Win32

Win32 Input

Reference: MaaDef.h

Select one of the values below.

No default value. Client can choose one as the default.

Different programs on Win32 handle input differently, so there is no universal method.

NameAPI ValueCompatibilityRequires AdminSeizes CursorBackgroundDescription
Seize1HighNoYesNo
SendMessage2MediumMaybeNoYes
PostMessage4MediumMaybeNoYes
LegacyEvent8LowNoYesNo
PostThreadMessage16LowMaybeNoYesDeprecated
SendMessageWithCursorPos32MediumMaybeBriefYesBriefly moves cursor to target position then restores, for apps that check real cursor position
PostMessageWithCursorPos64MediumMaybeBriefYesBriefly moves cursor to target position then restores, for apps that check real cursor position
SendMessageWithWindowPos128MediumMaybeNoYesBriefly moves window to align target with cursor then restores, does not seize mouse
PostMessageWithWindowPos256MediumMaybeNoYesBriefly moves window to align target with cursor then restores, does not seize mouse

NOTE

  • Admin privileges mainly depend on the target program's permission level. If the target program runs as administrator, running with admin privileges is required for compatibility.
  • The WithCursorPos methods briefly move the cursor to the target position, then restore it after sending the message, hence "Brief" cursor seizure, but it does not block user operations.
  • The WithWindowPos methods briefly move the window so the target position aligns with the current cursor position, then restore the window position after sending the message. The cursor is not moved, so there is no mouse seizure, but the window may briefly flicker.

Win32 Screencap

Reference: MaaDef.h

Combine the selected methods below using bitwise OR to provide a single value. MaaFramework will try all provided methods and select the fastest available method.

No default value. Client can choose one combination as the default.

Different programs on Win32 handle rendering differently, so there is no universal method.

NameAPI ValueSpeedCompatibilityRequires AdminBackgroundDescription
GDI1FastMediumNoNo
FramePool2Very FastMediumNoYesAvailable on Windows 10 1903+
DXGI_DesktopDup4Very FastLowNoNoDesktop duplication (full-screen output copy)
DXGI_DesktopDup_Window8Very FastLowNoNoDesktop duplication cropped to window
PrintWindow16MediumMediumNoYes
ScreenDC32FastHighNoNo

NOTE

Three predefined combination macros are provided:

  • MaaWin32ScreencapMethod_All: all screencap methods
  • MaaWin32ScreencapMethod_Foreground: DXGI_DesktopDup_Window | ScreenDC
  • MaaWin32ScreencapMethod_Background: FramePool | PrintWindow

FramePool and PrintWindow have built-in pseudo-minimize support: when the target window is minimized, they make it transparent and click-through, then restore it without activation, allowing screencap to continue without disturbing the user.
Other screencap methods will fail when the target window is minimized. Please avoid minimizing the window when using those methods.

PlayCover (macOS)

The PlayCover controller is used to control iOS applications running via fork PlayCover on macOS.

PlayCover Prerequisites

  1. Install fork PlayCover on macOS
  2. Target iOS app must have MaaTools feature enabled in PlayCover

Gamepad (Windows)

The Gamepad controller is used to emulate Xbox 360 or DualShock 4 gamepad input on Windows, suitable for games that require gamepad control.

Gamepad Prerequisites

ViGEm Bus Driver must be installed.

Gamepad Types

TypeAPI ValueDescription
Xbox3600Microsoft Xbox 360 Controller (wired)
DualShock41Sony DualShock 4 Controller (wired)

Control Mapping

The Gamepad controller uses the following mapping:

Digital Buttons (click_key/key_down/key_up)

Use MaaGamepadButton_* constants as key values. Xbox button values are used for Xbox360 gamepad, DS4 face buttons automatically map to Xbox equivalents:

ButtonAPI ValueXbox 360DualShock 4 Equivalent
DPAD_UP1D-pad UpD-pad Up
DPAD_DOWN2D-pad DownD-pad Down
DPAD_LEFT4D-pad LeftD-pad Left
DPAD_RIGHT8D-pad RightD-pad Right
START / OPTIONS16StartOptions
BACK / SHARE32BackShare
LEFT_THUMB / L364Left Stick PressL3
RIGHT_THUMB / R3128Right Stick PressR3
LB / L1256LBL1
RB / R1512RBR1
GUIDE1024Xbox Guide-
A / CROSS4096A✗ (Cross)
B / CIRCLE8192B○ (Circle)
X / SQUARE16384X□ (Square)
Y / TRIANGLE32768Y△ (Triangle)
PS65536-PS (DS4 only)
TOUCHPAD131072-Touchpad Press (DS4 only)

Analog Input (touch_down/touch_move/touch_up)

Use the contact parameter to select the control target:

ContactDescriptionx/y Rangepressure Range
0Left Stick-32768 ~ 32767Ignored
1Right Stick-32768 ~ 32767Ignored
2Left Trigger (LT/L2)Ignored0 ~ 255
3Right Trigger (RT/R2)Ignored0 ~ 255

NOTE

  • ViGEm Bus Driver must be installed to use this controller.

WlRoots (Linux)

The WlRoots controller is used to control applications running in a wlroots compositor on Linux.

Compositor Requirements

The wlroots compositor to be controlled must support the following protocols:

  • Wayland Core Protocols
  • virtual-keyboard-unstable-v1
  • wlr-screencopy-unstable-v1
  • wlr-virtual-pointer-unstable-v1

NOTE

It is recommended to start a nested compositor session to use this controller. Controlling the compositor currently used by the desktop is not recommended, as this may lead to unexpected behavior during task execution.