maa_framework/build/
pregenerated_bindings.rs

1/* automatically generated by rust-bindgen 0.69.4 */
2
3pub const MaaTaskParam_Empty: &[u8; 3] = b"{}\0";
4pub const MaaAdbControllerType_Touch_Mask: u32 = 255;
5pub const MaaAdbControllerType_Key_Mask: u32 = 65280;
6pub const MaaAdbControllerType_Screencap_Mask: u32 = 16711680;
7pub const MaaWin32ControllerType_Touch_Mask: u32 = 255;
8pub const MaaWin32ControllerType_Key_Mask: u32 = 65280;
9pub const MaaWin32ControllerType_Screencap_Mask: u32 = 16711680;
10pub type int_least64_t = i64;
11pub type uint_least64_t = u64;
12pub type int_fast64_t = i64;
13pub type uint_fast64_t = u64;
14pub type int_least32_t = i32;
15pub type uint_least32_t = u32;
16pub type int_fast32_t = i32;
17pub type uint_fast32_t = u32;
18pub type int_least16_t = i16;
19pub type uint_least16_t = u16;
20pub type int_fast16_t = i16;
21pub type uint_fast16_t = u16;
22pub type int_least8_t = i8;
23pub type uint_least8_t = u8;
24pub type int_fast8_t = i8;
25pub type uint_fast8_t = u8;
26pub type intmax_t = ::std::os::raw::c_longlong;
27pub type uintmax_t = ::std::os::raw::c_ulonglong;
28#[repr(C)]
29#[derive(Debug, Copy, Clone)]
30pub struct MaaStringBuffer {
31    _unused: [u8; 0],
32}
33pub type MaaStringBufferHandle = *mut MaaStringBuffer;
34#[repr(C)]
35#[derive(Debug, Copy, Clone)]
36pub struct MaaImageBuffer {
37    _unused: [u8; 0],
38}
39pub type MaaImageBufferHandle = *mut MaaImageBuffer;
40#[repr(C)]
41#[derive(Debug, Copy, Clone)]
42pub struct MaaStringListBuffer {
43    _unused: [u8; 0],
44}
45pub type MaaStringListBufferHandle = *mut MaaStringListBuffer;
46#[repr(C)]
47#[derive(Debug, Copy, Clone)]
48pub struct MaaImageListBuffer {
49    _unused: [u8; 0],
50}
51pub type MaaImageListBufferHandle = *mut MaaImageListBuffer;
52#[repr(C)]
53#[derive(Debug, Copy, Clone)]
54pub struct MaaResourceAPI {
55    _unused: [u8; 0],
56}
57pub type MaaResourceHandle = *mut MaaResourceAPI;
58#[repr(C)]
59#[derive(Debug, Copy, Clone)]
60pub struct MaaControllerAPI {
61    _unused: [u8; 0],
62}
63pub type MaaControllerHandle = *mut MaaControllerAPI;
64#[repr(C)]
65#[derive(Debug, Copy, Clone)]
66pub struct MaaInstanceAPI {
67    _unused: [u8; 0],
68}
69pub type MaaInstanceHandle = *mut MaaInstanceAPI;
70pub type MaaBool = u8;
71pub type MaaSize = u64;
72pub type MaaStringView = *const ::std::os::raw::c_char;
73pub type MaaStatus = i32;
74pub const MaaStatusEnum_MaaStatus_Invalid: MaaStatusEnum = 0;
75pub const MaaStatusEnum_MaaStatus_Pending: MaaStatusEnum = 1000;
76pub const MaaStatusEnum_MaaStatus_Running: MaaStatusEnum = 2000;
77pub const MaaStatusEnum_MaaStatus_Success: MaaStatusEnum = 3000;
78pub const MaaStatusEnum_MaaStatus_Failed: MaaStatusEnum = 4000;
79pub type MaaStatusEnum = ::std::os::raw::c_int;
80pub type MaaLoggingLevel = i32;
81pub const MaaLoggingLevelEunm_MaaLoggingLevel_Off: MaaLoggingLevelEunm = 0;
82pub const MaaLoggingLevelEunm_MaaLoggingLevel_Fatal: MaaLoggingLevelEunm = 1;
83pub const MaaLoggingLevelEunm_MaaLoggingLevel_Error: MaaLoggingLevelEunm = 2;
84pub const MaaLoggingLevelEunm_MaaLoggingLevel_Warn: MaaLoggingLevelEunm = 3;
85pub const MaaLoggingLevelEunm_MaaLoggingLevel_Info: MaaLoggingLevelEunm = 4;
86pub const MaaLoggingLevelEunm_MaaLoggingLevel_Debug: MaaLoggingLevelEunm = 5;
87pub const MaaLoggingLevelEunm_MaaLoggingLevel_Trace: MaaLoggingLevelEunm = 6;
88pub const MaaLoggingLevelEunm_MaaLoggingLevel_All: MaaLoggingLevelEunm = 7;
89pub type MaaLoggingLevelEunm = ::std::os::raw::c_int;
90pub type MaaId = i64;
91pub type MaaCtrlId = MaaId;
92pub type MaaResId = MaaId;
93pub type MaaTaskId = MaaId;
94pub type MaaRecoId = MaaId;
95pub type MaaRunningId = MaaId;
96pub type MaaOption = i32;
97pub type MaaOptionValue = *mut ::std::os::raw::c_void;
98pub type MaaOptionValueSize = u64;
99pub type MaaGlobalOption = MaaOption;
100pub const MaaGlobalOptionEnum_MaaGlobalOption_Invalid: MaaGlobalOptionEnum = 0;
101#[doc = " Log dir\n\n value: string, eg: \"C:\\\\Users\\\\Administrator\\\\Desktop\\\\log\"; val_size: string length"]
102pub const MaaGlobalOptionEnum_MaaGlobalOption_LogDir: MaaGlobalOptionEnum = 1;
103#[doc = " Whether to save draw\n\n value: bool, eg: true; val_size: sizeof(bool)"]
104pub const MaaGlobalOptionEnum_MaaGlobalOption_SaveDraw: MaaGlobalOptionEnum = 2;
105#[doc = " Dump all screenshots and actions\n\n Recording will evaluate to true if any of this or MaaCtrlOptionEnum::MaaCtrlOption_Recording\n is true. value: bool, eg: true; val_size: sizeof(bool)"]
106pub const MaaGlobalOptionEnum_MaaGlobalOption_Recording: MaaGlobalOptionEnum = 3;
107#[doc = " The level of log output to stdout\n\n value: MaaLoggingLevel, val_size: sizeof(MaaLoggingLevel)\n default value is MaaLoggingLevel_Error"]
108pub const MaaGlobalOptionEnum_MaaGlobalOption_StdoutLevel: MaaGlobalOptionEnum = 4;
109#[doc = " Whether to show hit draw\n\n value: bool, eg: true; val_size: sizeof(bool)"]
110pub const MaaGlobalOptionEnum_MaaGlobalOption_ShowHitDraw: MaaGlobalOptionEnum = 5;
111#[doc = " Whether to callback debug message\n\n value: bool, eg: true; val_size: sizeof(bool)"]
112pub const MaaGlobalOptionEnum_MaaGlobalOption_DebugMessage: MaaGlobalOptionEnum = 6;
113pub type MaaGlobalOptionEnum = ::std::os::raw::c_int;
114pub type MaaResOption = MaaOption;
115pub const MaaResOptionEnum_MaaResOption_Invalid: MaaResOptionEnum = 0;
116pub type MaaResOptionEnum = ::std::os::raw::c_int;
117pub type MaaCtrlOption = MaaOption;
118pub const MaaCtrlOptionEnum_MaaCtrlOption_Invalid: MaaCtrlOptionEnum = 0;
119#[doc = " Only one of long and short side can be set, and the other is automatically scaled according\n to the aspect ratio.\n\n value: int, eg: 1920; val_size: sizeof(int)"]
120pub const MaaCtrlOptionEnum_MaaCtrlOption_ScreenshotTargetLongSide: MaaCtrlOptionEnum = 1;
121#[doc = " Only one of long and short side can be set, and the other is automatically scaled according\n to the aspect ratio.\n\n value: int, eg: 1080; val_size: sizeof(int)"]
122pub const MaaCtrlOptionEnum_MaaCtrlOption_ScreenshotTargetShortSide: MaaCtrlOptionEnum = 2;
123#[doc = " For StartApp\n\n value: string, eg: \"com.hypergryph.arknights/com.u8.sdk.U8UnityContext\"; val_size: string\n length"]
124pub const MaaCtrlOptionEnum_MaaCtrlOption_DefaultAppPackageEntry: MaaCtrlOptionEnum = 3;
125#[doc = " For StopApp\n\n value: string, eg: \"com.hypergryph.arknights\"; val_size: string length"]
126pub const MaaCtrlOptionEnum_MaaCtrlOption_DefaultAppPackage: MaaCtrlOptionEnum = 4;
127#[doc = " Dump all screenshots and actions\n\n Recording will evaluate to true if any of this or\n MaaGlobalOptionEnum::MaaGlobalOption_Recording is true.\n\n value: bool, eg: true; val_size: sizeof(bool)"]
128pub const MaaCtrlOptionEnum_MaaCtrlOption_Recording: MaaCtrlOptionEnum = 5;
129#[doc = " @brief Option keys for controller instance options. See MaaControllerSetOption().\n"]
130pub type MaaCtrlOptionEnum = ::std::os::raw::c_int;
131pub type MaaInstOption = MaaOption;
132pub const MaaInstOptionEnum_MaaInstOption_Invalid: MaaInstOptionEnum = 0;
133pub type MaaInstOptionEnum = ::std::os::raw::c_int;
134pub type MaaAdbControllerType = i32;
135pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Invalid: MaaAdbControllerTypeEnum = 0;
136pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Touch_Adb: MaaAdbControllerTypeEnum = 1;
137pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Touch_MiniTouch: MaaAdbControllerTypeEnum =
138    2;
139pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Touch_MaaTouch: MaaAdbControllerTypeEnum =
140    3;
141pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Touch_EmulatorExtras:
142    MaaAdbControllerTypeEnum = 4;
143pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Touch_AutoDetect: MaaAdbControllerTypeEnum =
144    254;
145pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Key_Adb: MaaAdbControllerTypeEnum = 256;
146pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Key_MaaTouch: MaaAdbControllerTypeEnum =
147    512;
148pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Key_EmulatorExtras:
149    MaaAdbControllerTypeEnum = 768;
150pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Key_AutoDetect: MaaAdbControllerTypeEnum =
151    65024;
152pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Input_Preset_Adb: MaaAdbControllerTypeEnum =
153    257;
154pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Input_Preset_Minitouch:
155    MaaAdbControllerTypeEnum = 258;
156pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Input_Preset_Maatouch:
157    MaaAdbControllerTypeEnum = 515;
158pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Input_Preset_AutoDetect:
159    MaaAdbControllerTypeEnum = 65278;
160pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Input_Preset_EmulatorExtras:
161    MaaAdbControllerTypeEnum = 772;
162#[doc = " \\deprecated"]
163pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Screencap_FastestWay_Compatible:
164    MaaAdbControllerTypeEnum = 65536;
165#[doc = " \\deprecated"]
166pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Screencap_RawByNetcat:
167    MaaAdbControllerTypeEnum = 131072;
168#[doc = " \\deprecated"]
169pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Screencap_RawWithGzip:
170    MaaAdbControllerTypeEnum = 196608;
171#[doc = " \\deprecated"]
172pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Screencap_Encode: MaaAdbControllerTypeEnum =
173    262144;
174#[doc = " \\deprecated"]
175pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Screencap_EncodeToFile:
176    MaaAdbControllerTypeEnum = 327680;
177#[doc = " \\deprecated"]
178pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Screencap_MinicapDirect:
179    MaaAdbControllerTypeEnum = 393216;
180#[doc = " \\deprecated"]
181pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Screencap_MinicapStream:
182    MaaAdbControllerTypeEnum = 458752;
183#[doc = " \\deprecated"]
184pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Screencap_EmulatorExtras:
185    MaaAdbControllerTypeEnum = 524288;
186#[doc = " \\deprecated"]
187pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Screencap_FastestLosslessWay:
188    MaaAdbControllerTypeEnum = 16580608;
189#[doc = " \\deprecated"]
190pub const MaaAdbControllerTypeEnum_MaaAdbControllerType_Screencap_FastestWay:
191    MaaAdbControllerTypeEnum = 16646144;
192#[doc = " @brief ADB controller type\n\n The ADB controller type consists of three parts: touch, key, and screencap.\n The touch part is used to control the touch events on the device.\n The key part is used to control the key events on the device.\n The screencap part is used to capture the screen of the device.\n The final value is the combination of the three parts as follows:\n\n touch_type | key_type | screencap_type\n"]
193pub type MaaAdbControllerTypeEnum = ::std::os::raw::c_int;
194pub type MaaDbgControllerType = i32;
195pub const MaaDbgControllerTypeEnum_MaaDbgController_Invalid: MaaDbgControllerTypeEnum = 0;
196pub const MaaDbgControllerTypeEnum_MaaDbgControllerType_CarouselImage: MaaDbgControllerTypeEnum = 1;
197pub const MaaDbgControllerTypeEnum_MaaDbgControllerType_ReplayRecording: MaaDbgControllerTypeEnum =
198    2;
199pub type MaaDbgControllerTypeEnum = ::std::os::raw::c_int;
200pub type MaaThriftControllerType = i32;
201pub const MaaThriftControllerTypeEnum_MaaThriftController_Invalid: MaaThriftControllerTypeEnum = 0;
202pub const MaaThriftControllerTypeEnum_MaaThriftControllerType_Socket: MaaThriftControllerTypeEnum =
203    1;
204pub const MaaThriftControllerTypeEnum_MaaThriftControllerType_UnixDomainSocket:
205    MaaThriftControllerTypeEnum = 2;
206pub type MaaThriftControllerTypeEnum = ::std::os::raw::c_int;
207pub type MaaWin32ControllerType = i32;
208pub const MaaWin32ControllerTypeEnum_MaaWin32Controller_Invalid: MaaWin32ControllerTypeEnum = 0;
209pub const MaaWin32ControllerTypeEnum_MaaWin32ControllerType_Touch_SendMessage:
210    MaaWin32ControllerTypeEnum = 1;
211pub const MaaWin32ControllerTypeEnum_MaaWin32ControllerType_Touch_Seize:
212    MaaWin32ControllerTypeEnum = 2;
213pub const MaaWin32ControllerTypeEnum_MaaWin32ControllerType_Key_SendMessage:
214    MaaWin32ControllerTypeEnum = 256;
215pub const MaaWin32ControllerTypeEnum_MaaWin32ControllerType_Key_Seize: MaaWin32ControllerTypeEnum =
216    512;
217pub const MaaWin32ControllerTypeEnum_MaaWin32ControllerType_Screencap_GDI:
218    MaaWin32ControllerTypeEnum = 65536;
219pub const MaaWin32ControllerTypeEnum_MaaWin32ControllerType_Screencap_DXGI_DesktopDup:
220    MaaWin32ControllerTypeEnum = 131072;
221pub const MaaWin32ControllerTypeEnum_MaaWin32ControllerType_Screencap_DXGI_FramePool:
222    MaaWin32ControllerTypeEnum = 262144;
223#[doc = " @brief Win32 controller type\n\n See AdbControllerTypeEnum to know how the value is composed.\n"]
224pub type MaaWin32ControllerTypeEnum = ::std::os::raw::c_int;
225pub type MaaWin32Hwnd = *mut ::std::os::raw::c_void;
226pub type MaaTransparentArg = *mut ::std::os::raw::c_void;
227pub type MaaCallbackTransparentArg = MaaTransparentArg;
228#[doc = " @brief The callback function type.\n\n @param msg The message. See MaaMsg.h\n @param details_json The details in JSON format. See doc in MaaMsg.h"]
229pub type MaaAPICallback = ::std::option::Option<
230    unsafe extern "C" fn(
231        msg: MaaStringView,
232        details_json: MaaStringView,
233        callback_arg: MaaTransparentArg,
234    ),
235>;
236pub type MaaResourceCallback = MaaAPICallback;
237pub type MaaControllerCallback = MaaAPICallback;
238pub type MaaInstanceCallback = MaaAPICallback;
239pub type MaaCustomControllerHandle = *mut MaaCustomControllerAPI;
240pub type MaaCustomRecognizerHandle = *mut MaaCustomRecognizerAPI;
241pub type MaaCustomActionHandle = *mut MaaCustomActionAPI;
242#[repr(C)]
243#[derive(Debug, Copy, Clone)]
244pub struct MaaSyncContextAPI {
245    _unused: [u8; 0],
246}
247pub type MaaSyncContextHandle = *mut MaaSyncContextAPI;
248#[repr(C)]
249#[derive(Debug, Copy, Clone)]
250pub struct MaaRect {
251    pub x: i32,
252    pub y: i32,
253    pub width: i32,
254    pub height: i32,
255}
256#[test]
257fn bindgen_test_layout_MaaRect() {
258    const UNINIT: ::std::mem::MaybeUninit<MaaRect> = ::std::mem::MaybeUninit::uninit();
259    let ptr = UNINIT.as_ptr();
260    assert_eq!(
261        ::std::mem::size_of::<MaaRect>(),
262        16usize,
263        concat!("Size of: ", stringify!(MaaRect))
264    );
265    assert_eq!(
266        ::std::mem::align_of::<MaaRect>(),
267        4usize,
268        concat!("Alignment of ", stringify!(MaaRect))
269    );
270    assert_eq!(
271        unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize },
272        0usize,
273        concat!(
274            "Offset of field: ",
275            stringify!(MaaRect),
276            "::",
277            stringify!(x)
278        )
279    );
280    assert_eq!(
281        unsafe { ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize },
282        4usize,
283        concat!(
284            "Offset of field: ",
285            stringify!(MaaRect),
286            "::",
287            stringify!(y)
288        )
289    );
290    assert_eq!(
291        unsafe { ::std::ptr::addr_of!((*ptr).width) as usize - ptr as usize },
292        8usize,
293        concat!(
294            "Offset of field: ",
295            stringify!(MaaRect),
296            "::",
297            stringify!(width)
298        )
299    );
300    assert_eq!(
301        unsafe { ::std::ptr::addr_of!((*ptr).height) as usize - ptr as usize },
302        12usize,
303        concat!(
304            "Offset of field: ",
305            stringify!(MaaRect),
306            "::",
307            stringify!(height)
308        )
309    );
310}
311pub type MaaRectHandle = *mut MaaRect;
312extern "C" {
313    #[doc = " \\deprecated Use MaaAdbControllerCreateV2() instead."]
314    pub fn MaaAdbControllerCreate(
315        adb_path: MaaStringView,
316        address: MaaStringView,
317        type_: MaaAdbControllerType,
318        config: MaaStringView,
319        callback: MaaControllerCallback,
320        callback_arg: MaaCallbackTransparentArg,
321    ) -> MaaControllerHandle;
322}
323extern "C" {
324    #[doc = " @brief Create a ADB controller instance.\n\n @param adb_path The path of ADB executable.\n @param address The ADB serial of the target device.\n @param type The type of the ADB controller. See #MaaAdbControllerTypeEnum.\n @param config The config of the ADB controller.\n @param agent_path The path of the agent executable.\n @param callback The callback function. See ::MaaAPICallback.\n @param callback_arg The callback arg that will be passed to the callback function.\n @return MaaControllerHandle The handle of the created controller instance."]
325    pub fn MaaAdbControllerCreateV2(
326        adb_path: MaaStringView,
327        address: MaaStringView,
328        type_: MaaAdbControllerType,
329        config: MaaStringView,
330        agent_path: MaaStringView,
331        callback: MaaControllerCallback,
332        callback_arg: MaaCallbackTransparentArg,
333    ) -> MaaControllerHandle;
334}
335extern "C" {
336    #[doc = " @brief Create a win32 controller instance.\n\n @param hWnd The win32 window handle to control. This can be retrieved by helpers provided in\n MaaToolkitWin32Window.h.\n @param type The type of the win32 controller. See #MaaWin32ControllerTypeEnum.\n @param callback The callback function. See ::MaaAPICallback.\n @param callback_arg The callback arg that will be passed to the callback function.\n @return MaaControllerHandle The handle of the created controller instance."]
337    pub fn MaaWin32ControllerCreate(
338        hWnd: MaaWin32Hwnd,
339        type_: MaaWin32ControllerType,
340        callback: MaaControllerCallback,
341        callback_arg: MaaCallbackTransparentArg,
342    ) -> MaaControllerHandle;
343}
344extern "C" {
345    #[doc = " @brief Create a custom controller instance.\n\n @param handle The handle to your instance of custom controller. See MaaCustomControllerAPI.\n @param handle_arg The arg that will be passed to the custom controller API.\n @param callback The callback function. See ::MaaAPICallback.\n @param callback_arg The callback arg that will be passed to the callback function.\n @return MaaControllerHandle The handle of the created controller instance."]
346    pub fn MaaCustomControllerCreate(
347        handle: MaaCustomControllerHandle,
348        handle_arg: MaaTransparentArg,
349        callback: MaaControllerCallback,
350        callback_arg: MaaCallbackTransparentArg,
351    ) -> MaaControllerHandle;
352}
353extern "C" {
354    pub fn MaaThriftControllerCreate(
355        type_: MaaThriftControllerType,
356        host: MaaStringView,
357        port: i32,
358        config: MaaStringView,
359        callback: MaaControllerCallback,
360        callback_arg: MaaCallbackTransparentArg,
361    ) -> MaaControllerHandle;
362}
363extern "C" {
364    pub fn MaaDbgControllerCreate(
365        read_path: MaaStringView,
366        write_path: MaaStringView,
367        type_: MaaDbgControllerType,
368        config: MaaStringView,
369        callback: MaaControllerCallback,
370        callback_arg: MaaCallbackTransparentArg,
371    ) -> MaaControllerHandle;
372}
373extern "C" {
374    #[doc = " @brief Free the controller instance.\n\n @param ctrl"]
375    pub fn MaaControllerDestroy(ctrl: MaaControllerHandle);
376}
377extern "C" {
378    #[doc = " @brief Set options for a given controller instance.\n\n This function requires a given set of option keys and value types, otherwise this will fail.\n See #MaaCtrlOptionEnum for details.\n\n @param ctrl The handle of the controller instance to set options for.\n @param key The option key.\n @param value The option value.\n @param val_size The size of the option value.\n @return MaaBool Whether the option is set successfully."]
379    pub fn MaaControllerSetOption(
380        ctrl: MaaControllerHandle,
381        key: MaaCtrlOption,
382        value: MaaOptionValue,
383        val_size: MaaOptionValueSize,
384    ) -> MaaBool;
385}
386extern "C" {
387    #[doc = " @defgroup MaaControllerPostRequest Controller Requests\n\n The following functions post their corresponding requests to the controller and return the id\n of the request.\n @{"]
388    pub fn MaaControllerPostConnection(ctrl: MaaControllerHandle) -> MaaCtrlId;
389}
390extern "C" {
391    pub fn MaaControllerPostClick(ctrl: MaaControllerHandle, x: i32, y: i32) -> MaaCtrlId;
392}
393extern "C" {
394    pub fn MaaControllerPostSwipe(
395        ctrl: MaaControllerHandle,
396        x1: i32,
397        y1: i32,
398        x2: i32,
399        y2: i32,
400        duration: i32,
401    ) -> MaaCtrlId;
402}
403extern "C" {
404    pub fn MaaControllerPostPressKey(ctrl: MaaControllerHandle, keycode: i32) -> MaaCtrlId;
405}
406extern "C" {
407    pub fn MaaControllerPostInputText(ctrl: MaaControllerHandle, text: MaaStringView) -> MaaCtrlId;
408}
409extern "C" {
410    pub fn MaaControllerPostStartApp(ctrl: MaaControllerHandle, intent: MaaStringView)
411        -> MaaCtrlId;
412}
413extern "C" {
414    pub fn MaaControllerPostStopApp(ctrl: MaaControllerHandle, intent: MaaStringView) -> MaaCtrlId;
415}
416extern "C" {
417    pub fn MaaControllerPostTouchDown(
418        ctrl: MaaControllerHandle,
419        contact: i32,
420        x: i32,
421        y: i32,
422        pressure: i32,
423    ) -> MaaCtrlId;
424}
425extern "C" {
426    pub fn MaaControllerPostTouchMove(
427        ctrl: MaaControllerHandle,
428        contact: i32,
429        x: i32,
430        y: i32,
431        pressure: i32,
432    ) -> MaaCtrlId;
433}
434extern "C" {
435    pub fn MaaControllerPostTouchUp(ctrl: MaaControllerHandle, contact: i32) -> MaaCtrlId;
436}
437extern "C" {
438    pub fn MaaControllerPostScreencap(ctrl: MaaControllerHandle) -> MaaCtrlId;
439}
440extern "C" {
441    #[doc = " @brief Get the status of a request identified by the given id.\n\n @param ctrl\n @param id\n @return MaaStatus The status of the request."]
442    pub fn MaaControllerStatus(ctrl: MaaControllerHandle, id: MaaCtrlId) -> MaaStatus;
443}
444extern "C" {
445    #[doc = " @brief Wait for the request identified by the given id to complete.\n\n @param ctrl\n @param id\n @return MaaStatus The status of the request."]
446    pub fn MaaControllerWait(ctrl: MaaControllerHandle, id: MaaCtrlId) -> MaaStatus;
447}
448extern "C" {
449    #[doc = " @brief Check if the controller is connected.\n\n @param ctrl\n @return MaaBool"]
450    pub fn MaaControllerConnected(ctrl: MaaControllerHandle) -> MaaBool;
451}
452extern "C" {
453    #[doc = " @brief Get the image buffer of the last screencap request.\n\n @param ctrl\n @param[out] buffer The buffer that the image data will be stored in.\n\n @return MaaBool Whether the image buffer is retrieved successfully."]
454    pub fn MaaControllerGetImage(
455        ctrl: MaaControllerHandle,
456        buffer: MaaImageBufferHandle,
457    ) -> MaaBool;
458}
459extern "C" {
460    #[doc = " @brief Get the UUID of the controller.\n\n @param ctrl\n @param[out] buffer The buffer that the UUID will be stored in.\n\n @return MaaBool Whether the resolution is retrieved successfully."]
461    pub fn MaaControllerGetUUID(
462        ctrl: MaaControllerHandle,
463        buffer: MaaStringBufferHandle,
464    ) -> MaaBool;
465}
466#[doc = " @brief The custom controller API.\n\n To create a custom controller, you need to implement this API.\n\n You do not have to implement all the functions in this API. Instead, just implement the\n functions you need. Do note that if an unimplemented function is called, the framework will\n likely crash."]
467#[repr(C)]
468#[derive(Debug, Copy, Clone)]
469pub struct MaaCustomControllerAPI {
470    pub connect:
471        ::std::option::Option<unsafe extern "C" fn(handle_arg: MaaTransparentArg) -> MaaBool>,
472    #[doc = " Write result to buffer."]
473    pub request_uuid: ::std::option::Option<
474        unsafe extern "C" fn(
475            handle_arg: MaaTransparentArg,
476            buffer: MaaStringBufferHandle,
477        ) -> MaaBool,
478    >,
479    #[doc = " Write result to width and height."]
480    pub request_resolution: ::std::option::Option<
481        unsafe extern "C" fn(
482            handle_arg: MaaTransparentArg,
483            width: *mut i32,
484            height: *mut i32,
485        ) -> MaaBool,
486    >,
487    pub start_app: ::std::option::Option<
488        unsafe extern "C" fn(intent: MaaStringView, handle_arg: MaaTransparentArg) -> MaaBool,
489    >,
490    pub stop_app: ::std::option::Option<
491        unsafe extern "C" fn(intent: MaaStringView, handle_arg: MaaTransparentArg) -> MaaBool,
492    >,
493    #[doc = " Write result to buffer."]
494    pub screencap: ::std::option::Option<
495        unsafe extern "C" fn(
496            handle_arg: MaaTransparentArg,
497            buffer: MaaImageBufferHandle,
498        ) -> MaaBool,
499    >,
500    pub click: ::std::option::Option<
501        unsafe extern "C" fn(x: i32, y: i32, handle_arg: MaaTransparentArg) -> MaaBool,
502    >,
503    pub swipe: ::std::option::Option<
504        unsafe extern "C" fn(
505            x1: i32,
506            y1: i32,
507            x2: i32,
508            y2: i32,
509            duration: i32,
510            handle_arg: MaaTransparentArg,
511        ) -> MaaBool,
512    >,
513    pub touch_down: ::std::option::Option<
514        unsafe extern "C" fn(
515            contact: i32,
516            x: i32,
517            y: i32,
518            pressure: i32,
519            handle_arg: MaaTransparentArg,
520        ) -> MaaBool,
521    >,
522    pub touch_move: ::std::option::Option<
523        unsafe extern "C" fn(
524            contact: i32,
525            x: i32,
526            y: i32,
527            pressure: i32,
528            handle_arg: MaaTransparentArg,
529        ) -> MaaBool,
530    >,
531    pub touch_up: ::std::option::Option<
532        unsafe extern "C" fn(contact: i32, handle_arg: MaaTransparentArg) -> MaaBool,
533    >,
534    pub press_key: ::std::option::Option<
535        unsafe extern "C" fn(keycode: i32, handle_arg: MaaTransparentArg) -> MaaBool,
536    >,
537    pub input_text: ::std::option::Option<
538        unsafe extern "C" fn(text: MaaStringView, handle_arg: MaaTransparentArg) -> MaaBool,
539    >,
540}
541#[test]
542fn bindgen_test_layout_MaaCustomControllerAPI() {
543    const UNINIT: ::std::mem::MaybeUninit<MaaCustomControllerAPI> =
544        ::std::mem::MaybeUninit::uninit();
545    let ptr = UNINIT.as_ptr();
546    assert_eq!(
547        ::std::mem::size_of::<MaaCustomControllerAPI>(),
548        104usize,
549        concat!("Size of: ", stringify!(MaaCustomControllerAPI))
550    );
551    assert_eq!(
552        ::std::mem::align_of::<MaaCustomControllerAPI>(),
553        8usize,
554        concat!("Alignment of ", stringify!(MaaCustomControllerAPI))
555    );
556    assert_eq!(
557        unsafe { ::std::ptr::addr_of!((*ptr).connect) as usize - ptr as usize },
558        0usize,
559        concat!(
560            "Offset of field: ",
561            stringify!(MaaCustomControllerAPI),
562            "::",
563            stringify!(connect)
564        )
565    );
566    assert_eq!(
567        unsafe { ::std::ptr::addr_of!((*ptr).request_uuid) as usize - ptr as usize },
568        8usize,
569        concat!(
570            "Offset of field: ",
571            stringify!(MaaCustomControllerAPI),
572            "::",
573            stringify!(request_uuid)
574        )
575    );
576    assert_eq!(
577        unsafe { ::std::ptr::addr_of!((*ptr).request_resolution) as usize - ptr as usize },
578        16usize,
579        concat!(
580            "Offset of field: ",
581            stringify!(MaaCustomControllerAPI),
582            "::",
583            stringify!(request_resolution)
584        )
585    );
586    assert_eq!(
587        unsafe { ::std::ptr::addr_of!((*ptr).start_app) as usize - ptr as usize },
588        24usize,
589        concat!(
590            "Offset of field: ",
591            stringify!(MaaCustomControllerAPI),
592            "::",
593            stringify!(start_app)
594        )
595    );
596    assert_eq!(
597        unsafe { ::std::ptr::addr_of!((*ptr).stop_app) as usize - ptr as usize },
598        32usize,
599        concat!(
600            "Offset of field: ",
601            stringify!(MaaCustomControllerAPI),
602            "::",
603            stringify!(stop_app)
604        )
605    );
606    assert_eq!(
607        unsafe { ::std::ptr::addr_of!((*ptr).screencap) as usize - ptr as usize },
608        40usize,
609        concat!(
610            "Offset of field: ",
611            stringify!(MaaCustomControllerAPI),
612            "::",
613            stringify!(screencap)
614        )
615    );
616    assert_eq!(
617        unsafe { ::std::ptr::addr_of!((*ptr).click) as usize - ptr as usize },
618        48usize,
619        concat!(
620            "Offset of field: ",
621            stringify!(MaaCustomControllerAPI),
622            "::",
623            stringify!(click)
624        )
625    );
626    assert_eq!(
627        unsafe { ::std::ptr::addr_of!((*ptr).swipe) as usize - ptr as usize },
628        56usize,
629        concat!(
630            "Offset of field: ",
631            stringify!(MaaCustomControllerAPI),
632            "::",
633            stringify!(swipe)
634        )
635    );
636    assert_eq!(
637        unsafe { ::std::ptr::addr_of!((*ptr).touch_down) as usize - ptr as usize },
638        64usize,
639        concat!(
640            "Offset of field: ",
641            stringify!(MaaCustomControllerAPI),
642            "::",
643            stringify!(touch_down)
644        )
645    );
646    assert_eq!(
647        unsafe { ::std::ptr::addr_of!((*ptr).touch_move) as usize - ptr as usize },
648        72usize,
649        concat!(
650            "Offset of field: ",
651            stringify!(MaaCustomControllerAPI),
652            "::",
653            stringify!(touch_move)
654        )
655    );
656    assert_eq!(
657        unsafe { ::std::ptr::addr_of!((*ptr).touch_up) as usize - ptr as usize },
658        80usize,
659        concat!(
660            "Offset of field: ",
661            stringify!(MaaCustomControllerAPI),
662            "::",
663            stringify!(touch_up)
664        )
665    );
666    assert_eq!(
667        unsafe { ::std::ptr::addr_of!((*ptr).press_key) as usize - ptr as usize },
668        88usize,
669        concat!(
670            "Offset of field: ",
671            stringify!(MaaCustomControllerAPI),
672            "::",
673            stringify!(press_key)
674        )
675    );
676    assert_eq!(
677        unsafe { ::std::ptr::addr_of!((*ptr).input_text) as usize - ptr as usize },
678        96usize,
679        concat!(
680            "Offset of field: ",
681            stringify!(MaaCustomControllerAPI),
682            "::",
683            stringify!(input_text)
684        )
685    );
686}
687extern "C" {
688    #[doc = " @brief Create an instance.\n\n @param callback The callback function. See MaaAPICallback\n @param callback_arg The callback arg that will be passed to the callback function.\n @return MaaInstanceHandle"]
689    pub fn MaaCreate(
690        callback: MaaInstanceCallback,
691        callback_arg: MaaCallbackTransparentArg,
692    ) -> MaaInstanceHandle;
693}
694extern "C" {
695    #[doc = " @brief Free the instance.\n\n @param inst"]
696    pub fn MaaDestroy(inst: MaaInstanceHandle);
697}
698extern "C" {
699    #[doc = " @brief Set options for a given instance.\n\n This function requires a given set of option keys and value types, otherwise this will fail.\n See #MaaInstOptionEnum for details.\n\n @param inst The handle of the instance to set options for.\n @param key The option key.\n @param value The option value.\n @param val_size The size of the option value.\n @return MaaBool Whether the option is set successfully."]
700    pub fn MaaSetOption(
701        inst: MaaInstanceHandle,
702        key: MaaInstOption,
703        value: MaaOptionValue,
704        val_size: MaaOptionValueSize,
705    ) -> MaaBool;
706}
707extern "C" {
708    #[doc = " @brief Bind the instance to an initialized resource.\n\n See functions in MaaResource.h about how to create a resource.\n\n @param inst\n @param res\n @return MaaBool"]
709    pub fn MaaBindResource(inst: MaaInstanceHandle, res: MaaResourceHandle) -> MaaBool;
710}
711extern "C" {
712    #[doc = " @brief Bind the instance to an initialized controller.\n\n See functions in MaaController.h about how to create a controller.\n\n @param inst\n @param ctrl\n @return MaaBool"]
713    pub fn MaaBindController(inst: MaaInstanceHandle, ctrl: MaaControllerHandle) -> MaaBool;
714}
715extern "C" {
716    #[doc = " @brief Check if the instance is initialized.\n\n @param inst\n @return MaaBool"]
717    pub fn MaaInited(inst: MaaInstanceHandle) -> MaaBool;
718}
719extern "C" {
720    #[doc = " @brief Register a custom recognizer to the instance.\n\n See MaaCustomRecognizer.h for details about how to create a custom recognizer.\n\n @param inst\n @param name The name of the recognizer that will be used to reference it.\n @param recognizer\n @param recognizer_arg\n @return MaaBool"]
721    pub fn MaaRegisterCustomRecognizer(
722        inst: MaaInstanceHandle,
723        name: MaaStringView,
724        recognizer: MaaCustomRecognizerHandle,
725        recognizer_arg: MaaTransparentArg,
726    ) -> MaaBool;
727}
728extern "C" {
729    #[doc = " @brief Unregister a custom recognizer from the instance.\n\n @param inst\n @param name The name of the recognizer when it was registered.\n @return MaaBool"]
730    pub fn MaaUnregisterCustomRecognizer(inst: MaaInstanceHandle, name: MaaStringView) -> MaaBool;
731}
732extern "C" {
733    #[doc = " @brief Clear all custom recognizers registered to the instance.\n\n @param inst\n @return MaaBool"]
734    pub fn MaaClearCustomRecognizer(inst: MaaInstanceHandle) -> MaaBool;
735}
736extern "C" {
737    #[doc = " @brief Register a custom action to the instance.\n\n See MaaCustomAction.h for details about how to create a custom action.\n\n @param inst\n @param name The name of the action that will be used to reference it.\n @param action\n @param action_arg\n @return MaaBool"]
738    pub fn MaaRegisterCustomAction(
739        inst: MaaInstanceHandle,
740        name: MaaStringView,
741        action: MaaCustomActionHandle,
742        action_arg: MaaTransparentArg,
743    ) -> MaaBool;
744}
745extern "C" {
746    #[doc = " @brief Unregister a custom action from the instance.\n\n @param inst\n @param name The name of the action when it was registered.\n @return MaaBool"]
747    pub fn MaaUnregisterCustomAction(inst: MaaInstanceHandle, name: MaaStringView) -> MaaBool;
748}
749extern "C" {
750    #[doc = " @brief Clear all custom actions registered to the instance.\n\n @param inst\n @return MaaBool"]
751    pub fn MaaClearCustomAction(inst: MaaInstanceHandle) -> MaaBool;
752}
753extern "C" {
754    #[doc = " @brief Post a task to the instance.\n\n The entry should be a task specified in the instance's resources.\n The param takes the same form as the pipeline json and will override the set parameters in\n the json file.\n\n @param inst\n @param entry The entry of the task.\n @param param The parameter of the task.\n @return MaaTaskId The id of the task."]
755    pub fn MaaPostTask(
756        inst: MaaInstanceHandle,
757        entry: MaaStringView,
758        param: MaaStringView,
759    ) -> MaaTaskId;
760}
761extern "C" {
762    #[doc = " @brief Set the parameter of a task.\n\n See MaaPostTask() for details about the parameter.\n\n @param inst\n @param id The id of the task.\n @param param The parameter of the task.\n @return MaaBool"]
763    pub fn MaaSetTaskParam(inst: MaaInstanceHandle, id: MaaTaskId, param: MaaStringView)
764        -> MaaBool;
765}
766extern "C" {
767    #[doc = " @brief Get the status of a task identified by the id.\n\n @param inst\n @param id\n @return MaaStatus"]
768    pub fn MaaTaskStatus(inst: MaaInstanceHandle, id: MaaTaskId) -> MaaStatus;
769}
770extern "C" {
771    #[doc = " @brief Wait for a task to finish.\n\n @param inst\n @param id\n @return MaaStatus"]
772    pub fn MaaWaitTask(inst: MaaInstanceHandle, id: MaaTaskId) -> MaaStatus;
773}
774extern "C" {
775    #[doc = " \\deprecated Use !MaaRunning() instead."]
776    pub fn MaaTaskAllFinished(inst: MaaInstanceHandle) -> MaaBool;
777}
778extern "C" {
779    #[doc = " @brief Is maa running?\n\n @param inst\n @return MaaBool"]
780    pub fn MaaRunning(inst: MaaInstanceHandle) -> MaaBool;
781}
782extern "C" {
783    #[doc = " @brief Post a stop signal to the instance.\n\n This immediately stops the instance and all its tasks.\n\n @param inst\n @return MaaBool"]
784    pub fn MaaPostStop(inst: MaaInstanceHandle) -> MaaBool;
785}
786extern "C" {
787    #[doc = " \\deprecated Use MaaPostStop() instead."]
788    pub fn MaaStop(inst: MaaInstanceHandle) -> MaaBool;
789}
790extern "C" {
791    #[doc = " @brief Get the resource handle of the instance.\n\n @param inst\n @return MaaResourceHandle"]
792    pub fn MaaGetResource(inst: MaaInstanceHandle) -> MaaResourceHandle;
793}
794extern "C" {
795    #[doc = " @brief Get the controller handle of the instance.\n\n @param inst\n @return MaaControllerHandle"]
796    pub fn MaaGetController(inst: MaaInstanceHandle) -> MaaControllerHandle;
797}
798extern "C" {
799    #[doc = " @brief Create a resource.\n\n @param callback The callback function. See MaaAPICallback\n @param callback_arg\n @return MaaResourceHandle"]
800    pub fn MaaResourceCreate(
801        callback: MaaResourceCallback,
802        callback_arg: MaaCallbackTransparentArg,
803    ) -> MaaResourceHandle;
804}
805extern "C" {
806    #[doc = " @brief Free the resource.\n\n @param res"]
807    pub fn MaaResourceDestroy(res: MaaResourceHandle);
808}
809extern "C" {
810    #[doc = " @brief Add a path to the resource loading paths\n\n @param res\n @param path\n @return MaaResId The id of the resource"]
811    pub fn MaaResourcePostPath(res: MaaResourceHandle, path: MaaStringView) -> MaaResId;
812}
813extern "C" {
814    #[doc = " @brief Clear the resource loading paths\n\n @param res\n @return MaaBool Whether the resource is cleared successfully."]
815    pub fn MaaResourceClear(res: MaaResourceHandle) -> MaaBool;
816}
817extern "C" {
818    #[doc = " @brief Get the loading status of a resource identified by id.\n\n @param res\n @param id\n @return MaaStatus"]
819    pub fn MaaResourceStatus(res: MaaResourceHandle, id: MaaResId) -> MaaStatus;
820}
821extern "C" {
822    #[doc = " @brief Wait for a resource to be loaded.\n\n @param res\n @param id\n @return MaaStatus"]
823    pub fn MaaResourceWait(res: MaaResourceHandle, id: MaaResId) -> MaaStatus;
824}
825extern "C" {
826    #[doc = " @brief Check if resources are loaded.\n\n @param res\n @return MaaBool"]
827    pub fn MaaResourceLoaded(res: MaaResourceHandle) -> MaaBool;
828}
829extern "C" {
830    #[doc = " @brief Set options for a given resource.\n\n This function requires a given set of option keys and value types, otherwise this will fail.\n See #MaaResOptionEnum for details.\n\n @param res The handle of the resource to set options for.\n @param key The option key.\n @param value The option value.\n @param val_size The size of the option value.\n @return MaaBool Whether the option is set successfully."]
831    pub fn MaaResourceSetOption(
832        res: MaaResourceHandle,
833        key: MaaResOption,
834        value: MaaOptionValue,
835        val_size: MaaOptionValueSize,
836    ) -> MaaBool;
837}
838extern "C" {
839    #[doc = " @brief Get the hash of the resource.\n\n @param res\n @param[out] buffer The buffer where the hash will be written to.\n\n @return MaaBool"]
840    pub fn MaaResourceGetHash(res: MaaResourceHandle, buffer: MaaStringBufferHandle) -> MaaBool;
841}
842extern "C" {
843    #[doc = " @brief Get the task list of the resource.\n\n @param res\n @param[out] buffer The buffer where the task list will be written to.\n\n @return MaaBool"]
844    pub fn MaaResourceGetTaskList(res: MaaResourceHandle, buffer: MaaStringBufferHandle)
845        -> MaaBool;
846}
847#[doc = " @brief The custom action API.\n\n To create a custom action, you need to implement this API.\n\n You do not have to implement all the functions in this API. Instead, just implement the\n functions you need. Do note that if an unimplemented function is called, the framework will\n likely crash."]
848#[repr(C)]
849#[derive(Debug, Copy, Clone)]
850pub struct MaaCustomActionAPI {
851    pub run: ::std::option::Option<
852        unsafe extern "C" fn(
853            sync_context: MaaSyncContextHandle,
854            task_name: MaaStringView,
855            custom_action_param: MaaStringView,
856            cur_box: MaaRectHandle,
857            cur_rec_detail: MaaStringView,
858            action_arg: MaaTransparentArg,
859        ) -> MaaBool,
860    >,
861    pub stop: ::std::option::Option<unsafe extern "C" fn(action_arg: MaaTransparentArg)>,
862}
863#[test]
864fn bindgen_test_layout_MaaCustomActionAPI() {
865    const UNINIT: ::std::mem::MaybeUninit<MaaCustomActionAPI> = ::std::mem::MaybeUninit::uninit();
866    let ptr = UNINIT.as_ptr();
867    assert_eq!(
868        ::std::mem::size_of::<MaaCustomActionAPI>(),
869        16usize,
870        concat!("Size of: ", stringify!(MaaCustomActionAPI))
871    );
872    assert_eq!(
873        ::std::mem::align_of::<MaaCustomActionAPI>(),
874        8usize,
875        concat!("Alignment of ", stringify!(MaaCustomActionAPI))
876    );
877    assert_eq!(
878        unsafe { ::std::ptr::addr_of!((*ptr).run) as usize - ptr as usize },
879        0usize,
880        concat!(
881            "Offset of field: ",
882            stringify!(MaaCustomActionAPI),
883            "::",
884            stringify!(run)
885        )
886    );
887    assert_eq!(
888        unsafe { ::std::ptr::addr_of!((*ptr).stop) as usize - ptr as usize },
889        8usize,
890        concat!(
891            "Offset of field: ",
892            stringify!(MaaCustomActionAPI),
893            "::",
894            stringify!(stop)
895        )
896    );
897}
898#[doc = " @brief The custom recognizer API.\n\n To create a custom recognizer, you need to implement this API.\n\n You do not have to implement all the functions in this API. Instead, just implement the\n functions you need. Do note that if an unimplemented function is called, the framework will\n likely crash."]
899#[repr(C)]
900#[derive(Debug, Copy, Clone)]
901pub struct MaaCustomRecognizerAPI {
902    #[doc = " Write the recognition result to the out_box and return true if the recognition is\n successful. If the recognition fails, return false. You can also write details to the\n out_detail buffer."]
903    pub analyze: ::std::option::Option<
904        unsafe extern "C" fn(
905            sync_context: MaaSyncContextHandle,
906            image: MaaImageBufferHandle,
907            task_name: MaaStringView,
908            custom_recognition_param: MaaStringView,
909            recognizer_arg: MaaTransparentArg,
910            out_box: MaaRectHandle,
911            out_detail: MaaStringBufferHandle,
912        ) -> MaaBool,
913    >,
914}
915#[test]
916fn bindgen_test_layout_MaaCustomRecognizerAPI() {
917    const UNINIT: ::std::mem::MaybeUninit<MaaCustomRecognizerAPI> =
918        ::std::mem::MaybeUninit::uninit();
919    let ptr = UNINIT.as_ptr();
920    assert_eq!(
921        ::std::mem::size_of::<MaaCustomRecognizerAPI>(),
922        8usize,
923        concat!("Size of: ", stringify!(MaaCustomRecognizerAPI))
924    );
925    assert_eq!(
926        ::std::mem::align_of::<MaaCustomRecognizerAPI>(),
927        8usize,
928        concat!("Alignment of ", stringify!(MaaCustomRecognizerAPI))
929    );
930    assert_eq!(
931        unsafe { ::std::ptr::addr_of!((*ptr).analyze) as usize - ptr as usize },
932        0usize,
933        concat!(
934            "Offset of field: ",
935            stringify!(MaaCustomRecognizerAPI),
936            "::",
937            stringify!(analyze)
938        )
939    );
940}
941extern "C" {
942    pub fn MaaSyncContextRunTask(
943        sync_context: MaaSyncContextHandle,
944        task_name: MaaStringView,
945        param: MaaStringView,
946    ) -> MaaBool;
947}
948extern "C" {
949    pub fn MaaSyncContextRunRecognition(
950        sync_context: MaaSyncContextHandle,
951        image: MaaImageBufferHandle,
952        task_name: MaaStringView,
953        task_param: MaaStringView,
954        out_box: MaaRectHandle,
955        out_detail: MaaStringBufferHandle,
956    ) -> MaaBool;
957}
958extern "C" {
959    pub fn MaaSyncContextRunAction(
960        sync_context: MaaSyncContextHandle,
961        task_name: MaaStringView,
962        task_param: MaaStringView,
963        cur_box: MaaRectHandle,
964        cur_rec_detail: MaaStringView,
965    ) -> MaaBool;
966}
967extern "C" {
968    pub fn MaaSyncContextClick(sync_context: MaaSyncContextHandle, x: i32, y: i32) -> MaaBool;
969}
970extern "C" {
971    pub fn MaaSyncContextSwipe(
972        sync_context: MaaSyncContextHandle,
973        x1: i32,
974        y1: i32,
975        x2: i32,
976        y2: i32,
977        duration: i32,
978    ) -> MaaBool;
979}
980extern "C" {
981    pub fn MaaSyncContextPressKey(sync_context: MaaSyncContextHandle, keycode: i32) -> MaaBool;
982}
983extern "C" {
984    pub fn MaaSyncContextInputText(
985        sync_context: MaaSyncContextHandle,
986        text: MaaStringView,
987    ) -> MaaBool;
988}
989extern "C" {
990    pub fn MaaSyncContextTouchDown(
991        sync_context: MaaSyncContextHandle,
992        contact: i32,
993        x: i32,
994        y: i32,
995        pressure: i32,
996    ) -> MaaBool;
997}
998extern "C" {
999    pub fn MaaSyncContextTouchMove(
1000        sync_context: MaaSyncContextHandle,
1001        contact: i32,
1002        x: i32,
1003        y: i32,
1004        pressure: i32,
1005    ) -> MaaBool;
1006}
1007extern "C" {
1008    pub fn MaaSyncContextTouchUp(sync_context: MaaSyncContextHandle, contact: i32) -> MaaBool;
1009}
1010extern "C" {
1011    pub fn MaaSyncContextScreencap(
1012        sync_context: MaaSyncContextHandle,
1013        out_image: MaaImageBufferHandle,
1014    ) -> MaaBool;
1015}
1016extern "C" {
1017    pub fn MaaSyncContextCachedImage(
1018        sync_context: MaaSyncContextHandle,
1019        out_image: MaaImageBufferHandle,
1020    ) -> MaaBool;
1021}
1022extern "C" {
1023    pub fn MaaCreateStringBuffer() -> MaaStringBufferHandle;
1024}
1025extern "C" {
1026    pub fn MaaDestroyStringBuffer(handle: MaaStringBufferHandle);
1027}
1028extern "C" {
1029    pub fn MaaIsStringEmpty(handle: MaaStringBufferHandle) -> MaaBool;
1030}
1031extern "C" {
1032    pub fn MaaClearString(handle: MaaStringBufferHandle) -> MaaBool;
1033}
1034extern "C" {
1035    pub fn MaaGetString(handle: MaaStringBufferHandle) -> MaaStringView;
1036}
1037extern "C" {
1038    pub fn MaaGetStringSize(handle: MaaStringBufferHandle) -> MaaSize;
1039}
1040extern "C" {
1041    pub fn MaaSetString(handle: MaaStringBufferHandle, str_: MaaStringView) -> MaaBool;
1042}
1043extern "C" {
1044    pub fn MaaSetStringEx(
1045        handle: MaaStringBufferHandle,
1046        str_: MaaStringView,
1047        size: MaaSize,
1048    ) -> MaaBool;
1049}
1050extern "C" {
1051    pub fn MaaCreateStringListBuffer() -> MaaStringListBufferHandle;
1052}
1053extern "C" {
1054    pub fn MaaDestroyStringListBuffer(handle: MaaStringListBufferHandle);
1055}
1056extern "C" {
1057    pub fn MaaIsStringListEmpty(handle: MaaStringListBufferHandle) -> MaaBool;
1058}
1059extern "C" {
1060    pub fn MaaClearStringList(handle: MaaStringListBufferHandle) -> MaaBool;
1061}
1062extern "C" {
1063    pub fn MaaGetStringListSize(handle: MaaStringListBufferHandle) -> MaaSize;
1064}
1065extern "C" {
1066    pub fn MaaGetStringListAt(
1067        handle: MaaStringListBufferHandle,
1068        index: MaaSize,
1069    ) -> MaaStringBufferHandle;
1070}
1071extern "C" {
1072    pub fn MaaStringListAppend(
1073        handle: MaaStringListBufferHandle,
1074        value: MaaStringBufferHandle,
1075    ) -> MaaBool;
1076}
1077extern "C" {
1078    pub fn MaaStringListRemove(handle: MaaStringListBufferHandle, index: MaaSize) -> MaaBool;
1079}
1080extern "C" {
1081    pub fn MaaCreateImageBuffer() -> MaaImageBufferHandle;
1082}
1083extern "C" {
1084    pub fn MaaDestroyImageBuffer(handle: MaaImageBufferHandle);
1085}
1086extern "C" {
1087    pub fn MaaIsImageEmpty(handle: MaaImageBufferHandle) -> MaaBool;
1088}
1089extern "C" {
1090    pub fn MaaClearImage(handle: MaaImageBufferHandle) -> MaaBool;
1091}
1092pub type MaaImageRawData = *mut ::std::os::raw::c_void;
1093extern "C" {
1094    pub fn MaaGetImageRawData(handle: MaaImageBufferHandle) -> MaaImageRawData;
1095}
1096extern "C" {
1097    pub fn MaaGetImageWidth(handle: MaaImageBufferHandle) -> i32;
1098}
1099extern "C" {
1100    pub fn MaaGetImageHeight(handle: MaaImageBufferHandle) -> i32;
1101}
1102extern "C" {
1103    pub fn MaaGetImageType(handle: MaaImageBufferHandle) -> i32;
1104}
1105extern "C" {
1106    pub fn MaaSetImageRawData(
1107        handle: MaaImageBufferHandle,
1108        data: MaaImageRawData,
1109        width: i32,
1110        height: i32,
1111        type_: i32,
1112    ) -> MaaBool;
1113}
1114pub type MaaImageEncodedData = *mut u8;
1115extern "C" {
1116    pub fn MaaGetImageEncoded(handle: MaaImageBufferHandle) -> MaaImageEncodedData;
1117}
1118extern "C" {
1119    pub fn MaaGetImageEncodedSize(handle: MaaImageBufferHandle) -> MaaSize;
1120}
1121extern "C" {
1122    pub fn MaaSetImageEncoded(
1123        handle: MaaImageBufferHandle,
1124        data: MaaImageEncodedData,
1125        size: MaaSize,
1126    ) -> MaaBool;
1127}
1128extern "C" {
1129    pub fn MaaCreateImageListBuffer() -> MaaImageListBufferHandle;
1130}
1131extern "C" {
1132    pub fn MaaDestroyImageListBuffer(handle: MaaImageListBufferHandle);
1133}
1134extern "C" {
1135    pub fn MaaIsImageListEmpty(handle: MaaImageListBufferHandle) -> MaaBool;
1136}
1137extern "C" {
1138    pub fn MaaClearImageList(handle: MaaImageListBufferHandle) -> MaaBool;
1139}
1140extern "C" {
1141    pub fn MaaGetImageListSize(handle: MaaImageListBufferHandle) -> MaaSize;
1142}
1143extern "C" {
1144    pub fn MaaGetImageListAt(
1145        handle: MaaImageListBufferHandle,
1146        index: MaaSize,
1147    ) -> MaaImageBufferHandle;
1148}
1149extern "C" {
1150    pub fn MaaImageListAppend(
1151        handle: MaaImageListBufferHandle,
1152        value: MaaImageBufferHandle,
1153    ) -> MaaBool;
1154}
1155extern "C" {
1156    pub fn MaaImageListRemove(handle: MaaImageListBufferHandle, index: MaaSize) -> MaaBool;
1157}
1158extern "C" {
1159    pub fn MaaCreateRectBuffer() -> MaaRectHandle;
1160}
1161extern "C" {
1162    pub fn MaaDestroyRectBuffer(handle: MaaRectHandle);
1163}
1164extern "C" {
1165    pub fn MaaGetRectX(handle: MaaRectHandle) -> i32;
1166}
1167extern "C" {
1168    pub fn MaaGetRectY(handle: MaaRectHandle) -> i32;
1169}
1170extern "C" {
1171    pub fn MaaGetRectW(handle: MaaRectHandle) -> i32;
1172}
1173extern "C" {
1174    pub fn MaaGetRectH(handle: MaaRectHandle) -> i32;
1175}
1176extern "C" {
1177    pub fn MaaSetRect(handle: MaaRectHandle, x: i32, y: i32, w: i32, h: i32) -> MaaBool;
1178}
1179extern "C" {
1180    pub fn MaaSetRectX(handle: MaaRectHandle, value: i32) -> MaaBool;
1181}
1182extern "C" {
1183    pub fn MaaSetRectY(handle: MaaRectHandle, value: i32) -> MaaBool;
1184}
1185extern "C" {
1186    pub fn MaaSetRectW(handle: MaaRectHandle, value: i32) -> MaaBool;
1187}
1188extern "C" {
1189    pub fn MaaSetRectH(handle: MaaRectHandle, value: i32) -> MaaBool;
1190}
1191extern "C" {
1192    #[doc = " @brief Get the version of the framework.\n\n @return MaaStringView"]
1193    pub fn MaaVersion() -> MaaStringView;
1194}
1195extern "C" {
1196    #[doc = " @brief Set options globally.\n\n This function requires a given set of option keys and value types, otherwise this will fail.\n See #MaaGlobalOptionEnum for details.\n\n @param key The option key.\n @param value The option value.\n @param val_size The size of the option value.\n @return MaaBool Whether the option is set successfully."]
1197    pub fn MaaSetGlobalOption(
1198        key: MaaGlobalOption,
1199        value: MaaOptionValue,
1200        val_size: MaaOptionValueSize,
1201    ) -> MaaBool;
1202}
1203extern "C" {
1204    pub fn MaaQueryRecognitionDetail(
1205        reco_id: MaaRecoId,
1206        hit: *mut MaaBool,
1207        hit_box: MaaRectHandle,
1208        detail_json: MaaStringBufferHandle,
1209        draws: MaaImageListBufferHandle,
1210    ) -> MaaBool;
1211}
1212extern "C" {
1213    pub fn MaaQueryRunningDetail(
1214        run_id: MaaRunningId,
1215        reco_id: *mut MaaRecoId,
1216        successful: *mut MaaBool,
1217    ) -> MaaBool;
1218}
1219extern "C" {
1220    pub fn MaaToolkitInitOptionConfig(
1221        user_path: MaaStringView,
1222        default_json: MaaStringView,
1223    ) -> MaaBool;
1224}
1225extern "C" {
1226    #[doc = " \\deprecated Use MaaToolkitInitOptionConfig instead."]
1227    pub fn MaaToolkitInit() -> MaaBool;
1228}
1229extern "C" {
1230    #[doc = " \\deprecated Don't use it."]
1231    pub fn MaaToolkitUninit() -> MaaBool;
1232}
1233extern "C" {
1234    #[doc = " \\deprecated Use MaaToolkitPostFindDevice() and MaaToolkitWaitForFindDeviceToComplete()\n instead."]
1235    pub fn MaaToolkitFindDevice() -> MaaSize;
1236}
1237extern "C" {
1238    #[doc = " \\deprecated Use MaaToolkitPostFindDeviceWithAdb() and\n MaaToolkitWaitForFindDeviceToComplete() instead."]
1239    pub fn MaaToolkitFindDeviceWithAdb(adb_path: MaaStringView) -> MaaSize;
1240}
1241extern "C" {
1242    #[doc = " @brief Post a request to find all ADB devices.\n\n @return MaaBool"]
1243    pub fn MaaToolkitPostFindDevice() -> MaaBool;
1244}
1245extern "C" {
1246    #[doc = " @brief Post a request to find all ADB devices with a given ADB path.\n\n @param adb_path\n @return MaaBool"]
1247    pub fn MaaToolkitPostFindDeviceWithAdb(adb_path: MaaStringView) -> MaaBool;
1248}
1249extern "C" {
1250    #[doc = " @brief Check if the find device request is completed.\n\n @return MaaBool"]
1251    pub fn MaaToolkitIsFindDeviceCompleted() -> MaaBool;
1252}
1253extern "C" {
1254    #[doc = " @brief Wait for the find device request to complete.\n\n @return MaaSize The number of devices found."]
1255    pub fn MaaToolkitWaitForFindDeviceToComplete() -> MaaSize;
1256}
1257extern "C" {
1258    #[doc = " @brief Get the number of devices found.\n\n @return MaaSize The number of devices found."]
1259    pub fn MaaToolkitGetDeviceCount() -> MaaSize;
1260}
1261extern "C" {
1262    #[doc = " @brief Get the device name by index.\n\n @param index The 0-based index of the device. The index should not exceed the number of\n devices found otherwise out_of_range exception will be thrown.\n @return MaaStringView"]
1263    pub fn MaaToolkitGetDeviceName(index: MaaSize) -> MaaStringView;
1264}
1265extern "C" {
1266    #[doc = " @brief Get the device ADB path by index.\n\n @param index The 0-based index of the device. The index should not exceed the number of\n devices found otherwise out_of_range exception will be thrown.\n @return MaaStringView"]
1267    pub fn MaaToolkitGetDeviceAdbPath(index: MaaSize) -> MaaStringView;
1268}
1269extern "C" {
1270    #[doc = " @brief Get the device ADB serial by index.\n\n @param index The 0-based index of the device. The index should not exceed the number of\n devices found otherwise out_of_range exception will be thrown.\n @return MaaStringView"]
1271    pub fn MaaToolkitGetDeviceAdbSerial(index: MaaSize) -> MaaStringView;
1272}
1273extern "C" {
1274    #[doc = " @brief Get the device ADB controller type by index.\n\n @param index The 0-based index of the device. The index should not exceed the number of\n devices found otherwise out_of_range exception will be thrown.\n @return MaaAdbControllerType"]
1275    pub fn MaaToolkitGetDeviceAdbControllerType(index: MaaSize) -> MaaAdbControllerType;
1276}
1277extern "C" {
1278    #[doc = " @brief Get the device ADB config by index.\n\n @param index The 0-based index of the device. The index should not exceed the number of\n devices found otherwise out_of_range exception will be thrown.\n @return MaaStringView"]
1279    pub fn MaaToolkitGetDeviceAdbConfig(index: MaaSize) -> MaaStringView;
1280}
1281extern "C" {
1282    pub fn MaaToolkitRegisterCustomRecognizerExecutor(
1283        handle: MaaInstanceHandle,
1284        recognizer_name: MaaStringView,
1285        exec_path: MaaStringView,
1286        exec_params: *const MaaStringView,
1287        exec_param_size: MaaSize,
1288    ) -> MaaBool;
1289}
1290extern "C" {
1291    pub fn MaaToolkitUnregisterCustomRecognizerExecutor(
1292        handle: MaaInstanceHandle,
1293        recognizer_name: MaaStringView,
1294    ) -> MaaBool;
1295}
1296extern "C" {
1297    pub fn MaaToolkitClearCustomRecognizerExecutor(handle: MaaInstanceHandle) -> MaaBool;
1298}
1299extern "C" {
1300    pub fn MaaToolkitRegisterCustomActionExecutor(
1301        handle: MaaInstanceHandle,
1302        action_name: MaaStringView,
1303        exec_path: MaaStringView,
1304        exec_params: *const MaaStringView,
1305        exec_param_size: MaaSize,
1306    ) -> MaaBool;
1307}
1308extern "C" {
1309    pub fn MaaToolkitUnregisterCustomActionExecutor(
1310        handle: MaaInstanceHandle,
1311        action_name: MaaStringView,
1312    ) -> MaaBool;
1313}
1314extern "C" {
1315    pub fn MaaToolkitClearCustomActionExecutor(handle: MaaInstanceHandle) -> MaaBool;
1316}
1317extern "C" {
1318    #[doc = " @brief Find a win32 window by class name and window name.\n\n This function finds the function by exact match. See also MaaToolkitSearchWindow().\n\n @param class_name The class name of the window. If passed an empty string, class name will\n not be filtered.\n @param window_name The window name of the window. If passed an empty string, window name will\n not be filtered.\n @return MaaSize The number of windows found that match the criteria. To get the corresponding\n window handle, use MaaToolkitGetWindow()."]
1319    pub fn MaaToolkitFindWindow(class_name: MaaStringView, window_name: MaaStringView) -> MaaSize;
1320}
1321extern "C" {
1322    #[doc = " @brief Regex search a win32 window by class name and window name.\n\n This function searches the function by regex search. See also MaaToolkitFindWindow().\n\n @param class_name The class name regex of the window. If passed an empty string, class name\n will not be filtered.\n @param window_name The window name regex of the window. If passed an empty string, window\n name will not be filtered.\n @return MaaSize The number of windows found that match the criteria. To get the corresponding\n window handle, use MaaToolkitGetWindow()."]
1323    pub fn MaaToolkitSearchWindow(class_name: MaaStringView, window_name: MaaStringView)
1324        -> MaaSize;
1325}
1326extern "C" {
1327    #[doc = " @brief List all windows.\n @return MaaSize The number of windows found. To get the corresponding window handle, use"]
1328    pub fn MaaToolkitListWindows() -> MaaSize;
1329}
1330extern "C" {
1331    #[doc = " @brief Get the window handle by index.\n\n @param index The 0-based index of the window. The index should not exceed the number of\n windows found otherwise out_of_range exception will be thrown.\n @return MaaWin32Hwnd The window handle."]
1332    pub fn MaaToolkitGetWindow(index: MaaSize) -> MaaWin32Hwnd;
1333}
1334extern "C" {
1335    #[doc = " @brief Get the window handle of the window under the cursor. This uses the WindowFromPoint()\n system API.\n\n @return MaaWin32Hwnd The window handle."]
1336    pub fn MaaToolkitGetCursorWindow() -> MaaWin32Hwnd;
1337}
1338extern "C" {
1339    #[doc = " @brief Get the desktop window handle. This uses the GetDesktopWindow() system API.\n\n @return MaaWin32Hwnd The window handle."]
1340    pub fn MaaToolkitGetDesktopWindow() -> MaaWin32Hwnd;
1341}
1342extern "C" {
1343    #[doc = " @brief Get the foreground window handle. This uses the GetForegroundWindow() system API.\n\n @return MaaWin32Hwnd The window handle."]
1344    pub fn MaaToolkitGetForegroundWindow() -> MaaWin32Hwnd;
1345}
1346extern "C" {
1347    #[doc = " @brief Get the window class name by hwnd.\n\n @param hwnd The window hwnd.\n @param buffer The output buffer.\n @return MaaBool."]
1348    pub fn MaaToolkitGetWindowClassName(
1349        hwnd: MaaWin32Hwnd,
1350        buffer: MaaStringBufferHandle,
1351    ) -> MaaBool;
1352}
1353extern "C" {
1354    #[doc = " @brief Get the window window name by hwnd.\n\n @param hwnd The window hwnd.\n @param buffer The output buffer.\n @return MaaBool."]
1355    pub fn MaaToolkitGetWindowWindowName(
1356        hwnd: MaaWin32Hwnd,
1357        buffer: MaaStringBufferHandle,
1358    ) -> MaaBool;
1359}