Table of Contents

Namespace MaaFramework.Binding

Namespaces

MaaFramework.Binding.Abstractions
MaaFramework.Binding.Buffers
MaaFramework.Binding.Custom
MaaFramework.Binding.Notification

Classes

ActionDetail

A sealed record providing properties of action detail.

ActionDetailExtensions

A static class providing extension methods for the query of action detail.

MaaToolkit.AdbDeviceClass

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaToolkit.

MaaToolkit.AdbDeviceClass

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaToolkit.

AdbDeviceInfo

A record providing properties of adb device information.

AdbDeviceInfoExtensions

A static class providing extension methods for the creation of MaaAdbController.

MaaToolkit.ConfigClass

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaToolkit.

MaaToolkit.ConfigClass

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaToolkit.

MaaToolkit.DesktopClass

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaToolkit.

MaaToolkit.DesktopClass

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaToolkit.

MaaToolkit.DesktopWindowClass

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaToolkit.

MaaToolkit.DesktopWindowClass

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaToolkit.

DesktopWindowInfo

A record providing properties of window information.

DesktopWindowInfoExtensions

A static class providing extension methods for the creation of MaaWin32Controller.

MaaAdbController

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaController.MaaAdbControllerCreate(System.String,System.String,System.UInt64,System.UInt64,System.String,System.String).

MaaAgentClient

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaAgentClient.

MaaAgentServer

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaAgentServer.

MaaAgentServerExtensions

A static class providing extension methods for MaaFramework.Binding.MaaAgentServer.

MaaAndroidNativeController

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaController.MaaAndroidNativeControllerCreate(System.String).

MaaCallbackEventArgs<T>

A class providing data for the MaaFramework.Binding.Abstractions.IMaaCommon.Callback event.

MaaCallbackEventArgs

A class providing data for the MaaFramework.Binding.Abstractions.IMaaCommon.Callback event.

MaaContext

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaContext.

MaaController

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaController.

MaaCustomController

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaController.MaaCustomControllerCreate(MaaFramework.Binding.Custom.IMaaCustomController,System.IntPtr).

MaaDbgController

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaController.MaaDbgControllerCreate(System.String).

MaaException

The exception that is the base class for custom exceptions in MaaFramework.Binding.

MaaGamepadController

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaController.MaaGamepadControllerCreate(System.IntPtr,System.UInt64,System.UInt64).

MaaGlobal

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaGlobal.

MaaImage

A non-generic sealed class used to wrap MaaFramework.Binding.Buffers.IMaaImageBuffer.

MaaInteroperationException

The exception is thrown when a maa interoperation failed.

MaaJob

A wrapper class providing a reference implementation for return value of Maa Post method.

MaaJobStatusException

The exception is thrown when the MaaFramework.Binding.MaaJobStatus of a MaaFramework.Binding.MaaJob is unexpected.

MaaJobStatusExtensions

A static class providing extension methods for MaaFramework.Binding.MaaJobStatus.

MaaMacOSController

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaController.MaaMacOSControllerCreate(System.UInt32,System.UInt64,System.UInt64).

MaaOptionExtensions

A static class providing extension methods for setting maa option.

MaaPlayCoverController

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaController.MaaPlayCoverControllerCreate(System.String,System.String).

MaaRecordController

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaController.MaaRecordControllerCreate(System.IntPtr,System.String).

MaaReplayController

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaController.MaaReplayControllerCreate(System.String).

MaaResource

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaResource.

MaaTaskJob

A wrapper class providing a reference implementation for return value of Maa Post method.

MaaTasker

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaTasker.

MaaToolkit

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaToolkit.

MaaWin32Controller

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaController.MaaWin32ControllerCreate(System.IntPtr,System.UInt64,System.UInt64,System.UInt64).

MaaWlRootsController

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaController.MaaWlRootsControllerCreate(System.String,System.Boolean).

MaaToolkit.MacOSClass

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaToolkit.

MaaToolkit.MacOSClass

A wrapper class providing a reference implementation for MaaFramework.Binding.Interop.Native.MaaToolkit.

NativeBindingContext

Provides information and configuration for native bindings in the MaaFramework.

NodeDetail

A sealed record providing properties of node detail.

NodeDetailExtensions

A static class providing extension methods for the query of node detail.

RecognitionDetail

A sealed record providing properties of recognition detail.

RecognitionDetailExtensions

A static class providing extension methods for the query of recognition detail.

TaskDetail

A sealed record providing properties of task detail.

TaskDetailExtensions

A static class providing extension methods for the query of task detail.

Structs

ImageInfo

A readonly record struct providing properties of image information.

Interfaces

IMaaAgentClient<T>

An interface defining wrapped members for MaaAgentClient with generic handle.

IMaaAgentClient

An interface defining wrapped members for MaaAgentClient.

IMaaAgentServer

An interface defining wrapped members for MaaAgentServer.

IMaaContext<T>

An interface defining wrapped members for MaaContext with generic handle.

IMaaContext

An interface defining wrapped members for MaaContext.

IMaaController

An interface defining wrapped members for MaaController.

IMaaController<T>

An interface defining wrapped members for MaaController with generic handle.

IMaaGlobal

An interface defining wrapped members for MaaGlobal.

IMaaResource<T>

An interface defining wrapped members for MaaResource with generic handle.

IMaaResource

An interface defining wrapped members for MaaResource.

IMaaTasker<T>

An interface defining wrapped members for MaaTasker with generic handle.

IMaaTasker

An interface defining wrapped members for MaaTasker.

IMaaToolkit

An interface defining wrapped members for MaaToolkit.

IMaaToolkitAdbDevice

An interface defining wrapped members for MaaToolkit Adb Device.

IMaaToolkitConfig

An interface defining wrapped members for MaaToolkit Config.

IMaaToolkitDesktop

An interface defining wrapped members for MaaToolkit Desktop.

IMaaToolkitDesktopWindow

An interface defining wrapped members for MaaToolkit Desktop Window.

IMaaToolkitMacOS

An interface defining wrapped members for MaaToolkit macOS.

Enums

AdbInputMethods
Adb input method flags

Use bitwise OR to set the methods you need.
MaaFramework will select the first available method according to priority.

Priority (high to low): EmulatorExtras > Maatouch > MinitouchAndAdbKey > AdbShell

Default: All methods except EmulatorExtras

| Method               | Speed | Compatibility | Notes                                 |
    |----------------------|-------|---------------|---------------------------------------|
    | AdbShell             | Slow  | High          |                                       |
    | MinitouchAndAdbKey   | Fast  | Medium        | Key press still uses AdbShell         |
    | Maatouch             | Fast  | Medium        |                                       |
    | EmulatorExtras       | Fast  | Low           | Emulators only: MuMu 12               |
AdbScreencapMethods
Adb screencap method flags.

Use bitwise OR to set the methods you need.
MaaFramework will test all provided methods and use the fastest available one.

Default: All methods except RawByNetcat, MinicapDirect, MinicapStream

Note: MinicapDirect and MinicapStream use lossy JPEG encoding, which may
significantly reduce template matching accuracy. Not recommended.

| Method                | Speed      | Compatibility | Encoding | Notes                               |
    |-----------------------|------------|---------------|----------|-------------------------------------|
    | EncodeToFileAndPull   | Slow       | High          | Lossless |                                     |
    | Encode                | Slow       | High          | Lossless |                                     |
    | RawWithGzip           | Medium     | High          | Lossless |                                     |
    | RawByNetcat           | Fast       | Low           | Lossless |                                     |
    | MinicapDirect         | Fast       | Low           | Lossy    |                                     |
    | MinicapStream         | Very Fast  | Low           | Lossy    |                                     |
    | EmulatorExtras        | Very Fast  | Low           | Lossless | Emulators only: MuMu 12, LDPlayer 9 |
ApiInfoFlags

Represents information about binding interoperable API.

CheckStatusOption

Checking MaaFramework.Binding.MaaJobStatus option.

ControllerFeatures

Controller feature flags returned by get_features().

These flags indicate which input methods the controller supports/prefers.

ControllerOption

Option keys for controller instance options. See MaaControllerSetOption().

DbgControllerType
DisposeOptions

MaaFramework.Binding.IMaaTasker dispose options.

GamepadButton
Virtual gamepad button codes for <xref href="MaaFramework.Binding.IMaaController.ClickKey(System.Int32)" data-throw-if-not-resolved="false"></xref> / <xref href="MaaFramework.Binding.IMaaController.KeyDown(System.Int32)" data-throw-if-not-resolved="false"></xref> / <xref href="MaaFramework.Binding.IMaaController.KeyUp(System.Int32)" data-throw-if-not-resolved="false"></xref>

Use these values with MaaControllerPostClickKey, MaaControllerPostKeyDown, MaaControllerPostKeyUp.
Values are based on XUSB (Xbox 360) button flags. DS4 face buttons are mapped to Xbox equivalents.

Xbox 360 buttons:

| Value   | Button              | Description            |
    |---------|---------------------|------------------------|
    | 0x1000  | A                   | A button               |
    | 0x2000  | B                   | B button               |
    | 0x4000  | X                   | X button               |
    | 0x8000  | Y                   | Y button               |
    | 0x0100  | LB (Left Shoulder)  | Left bumper            |
    | 0x0200  | RB (Right Shoulder) | Right bumper           |
    | 0x0040  | L_THUMB             | Left stick click       |
    | 0x0080  | R_THUMB             | Right stick click      |
    | 0x0010  | START               | Start button           |
    | 0x0020  | BACK                | Back button            |
    | 0x0400  | GUIDE               | Guide/Home button      |
    | 0x0001  | DPAD_UP             | D-pad up               |
    | 0x0002  | DPAD_DOWN           | D-pad down             |
    | 0x0004  | DPAD_LEFT           | D-pad left             |
    | 0x0008  | DPAD_RIGHT          | D-pad right            |

DualShock 4 buttons (aliases to Xbox buttons):

| Value   | Button    | Xbox Equivalent | Description               |
    |---------|-----------|-----------------|---------------------------|
    | 0x1000  | CROSS     | A               | Cross (X) button          |
    | 0x2000  | CIRCLE    | B               | Circle button             |
    | 0x4000  | SQUARE    | X               | Square button             |
    | 0x8000  | TRIANGLE  | Y               | Triangle button           |
    | 0x0100  | L1        | LB              | L1 button                 |
    | 0x0200  | R1        | RB              | R1 button                 |
    | 0x0040  | L3        | L_THUMB         | Left stick click          |
    | 0x0080  | R3        | R_THUMB         | Right stick click         |
    | 0x0010  | OPTIONS   | START           | Options button            |
    | 0x0020  | SHARE     | BACK            | Share button              |
    | 0x10000 | PS        | -               | PS button (DS4 special)   |
    | 0x20000 | TOUCHPAD  | -               | Touchpad click (DS4 only) |
GamepadTouch
Virtual gamepad touch contact definitions for <xref href="MaaFramework.Binding.IMaaController.TouchDown(System.Int32%2cSystem.Int32%2cSystem.Int32%2cSystem.Int32)" data-throw-if-not-resolved="false"></xref> / <xref href="MaaFramework.Binding.IMaaController.TouchMove(System.Int32%2cSystem.Int32%2cSystem.Int32%2cSystem.Int32)" data-throw-if-not-resolved="false"></xref> / <xref href="MaaFramework.Binding.IMaaController.TouchUp(System.Int32)" data-throw-if-not-resolved="false"></xref>

For gamepad controller, the touch functions are repurposed for analog inputs:
- x, y: Analog stick position
- pressure: Trigger value (0~255)

Contact mapping:

| Contact       | Input           | x range       | y range       | pressure   | Description                      |
    |---------------|-----------------|---------------|---------------|------------|----------------------------------|
    | LeftStick     | Left Stick      | -32768~32767  | -32768~32767  | ignored    | Left analog stick X/Y position   |
    | RightStick    | Right Stick     | -32768~32767  | -32768~32767  | ignored    | Right analog stick X/Y position  |
    | LeftTrigger   | Left Trigger    | ignored       | ignored       | 0~255      | Left trigger (LT/L2) value       |
    | RightTrigger  | Right Trigger   | ignored       | ignored       | 0~255      | Right trigger (RT/R2) value      |

Usage:
- touch_down(contact, x, y, pressure): Start analog input
- touch_move(contact, x, y, pressure): Update analog input position/value
- touch_up(contact): Release/reset analog input to center/zero

GamepadType
Virtual gamepad type.

Select ONE type only.

| Type          | Description                                    |
    |---------------|------------------------------------------------|
    | Xbox360       | Microsoft Xbox 360 Controller (wired)          |
    | DualShock4    | Sony DualShock 4 Controller (wired)            |
GlobalOption
InferenceCoreMLFlags

InferenceCoreMLFlags are bool options we want to set for CoreML EP.

InferenceDevice
InferenceExecutionProvider
LinkOption

MaaFramework.Binding.IMaaController link option.

LoggingLevel
MaaHandleType

Represents the type of MaaFramework handle.

MaaJobStatus
MacOSInputMethod
MacOS input method.

Select ONE method only.

| Method          | Description                                                                                                        |
     |-----------------|--------------------------------------------------------------------------------------------------------------------|
     | GlobalEvent     | Injects into the global HID event stream via CGEventPost(kCGHIDEventTap), dispatched by the OS to the front window |
     | PostToPid       | Directly send to target process using CGEventPostToPid                                                             |
MacOSPermission

MacOS permission types.

MacOSScreencapMethod
MacOS screencap method.

Select ONE method only.

| Method          | Description                                    |
     |-----------------|------------------------------------------------|
     | ScreenCaptureKit| Modern macOS screencap using ScreenCaptureKit  |
ResourceOption
TaskerOption
Win32InputMethod
Win32 input method

No bitwise OR, select ONE method only.

No default value. Client should choose one as default.

Different applications process input differently, there is no universal solution.

| Method                   | Compatibility | Require Admin | Seize Mouse  | Background Support | Notes                                    |
    |--------------------------|---------------|---------------|--------------|--------------------|------------------------------------------|
    | Seize                    | High          | No            | Yes          | No  |                                                         |
    | SendMessage              | Medium        | Maybe         | No           | Yes |                                                         |
    | PostMessage              | Medium        | Maybe         | No           | Yes |                                                         |
    | LegacyEvent              | Low           | No            | Yes          | No  |                                                         |
    | PostThreadMessage        | Low           | Maybe         | No           | Yes |                                                         |
    | SendMessageWithCursorPos | Medium        | Maybe         | Briefly      | Yes | Moves cursor to target position, then restores          |
    | PostMessageWithCursorPos | Medium        | Maybe         | Briefly      | Yes | Moves cursor to target position, then restores          |
    | SendMessageWithWindowPos | Medium        | Maybe         | No           | Yes | Moves window to align target with cursor, then restores |
    | PostMessageWithWindowPos | Medium        | Maybe         | No           | Yes | Moves window to align target with cursor, then restores |

Note:
- Admin rights mainly depend on the target application's privilege level.
If the target runs as admin, MaaFramework should also run as admin for compatibility.
- "WithCursorPos" methods briefly move the cursor to target position, send message,
then restore cursor position. This "briefly" seizes the mouse but won't block user operations.
- "WithWindowPos" methods briefly move the window so the target aligns with the current cursor
position, send message, then restore the window position. The cursor is not moved.

Win32ScreencapMethods
Win32 screencap method flags

Use bitwise OR to set the methods you need.
MaaFramework will test all provided methods and use the fastest available one.

No default value. Client should choose one as default.

Predefined combinations:
- Foreground: DXGI_DesktopDup_Window | ScreenDC
- Background: FramePool | PrintWindow

Different applications use different rendering methods, there is no universal solution.

| Method                  | Speed     | Compatibility | Require Admin | Background Support | Notes                            |
    |-------------------------|-----------|---------------|---------------|--------------------|----------------------------------|
    | GDI                     | Fast      | Medium        | No            | No                 |                                  |
    | FramePool               | Very Fast | Medium        | No            | Yes                | Requires Windows 10 1903+        |
    | DXGI_DesktopDup         | Very Fast | Low           | No            | No                 | Desktop duplication (full screen)|
    | DXGI_DesktopDup_Window  | Very Fast | Low           | No            | No                 | Desktop duplication then crop    |
    | PrintWindow             | Medium    | Medium        | No            | Yes                |                                  |
    | ScreenDC                | Fast      | High          | No            | No                 |                                  |

Note: FramePool and PrintWindow support pseudo-minimize — 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.

Delegates

IMaaAgentClient.AgentServerStartupMethod

Represents a method that starts the agent server process.

IMaaAgentClient.AgentServerStartupMethod

Represents a method that starts the agent server process.