mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 10:10:45 +08:00
fix: update rust ffi
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "AsstPort.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
typedef void* AsstHandle;
|
||||
typedef int TaskId;
|
||||
typedef void(ASST_CALL* AsstApiCallback)(int msg, const char* detail_json, void* custom_arg);
|
||||
|
||||
int ASSTAPI AsstLoadResource(const char* path);
|
||||
|
||||
AsstHandle ASSTAPI AsstCreate();
|
||||
AsstHandle ASSTAPI AsstCreateEx(AsstApiCallback callback, void* custom_arg);
|
||||
void ASSTAPI AsstDestroy(AsstHandle handle);
|
||||
|
||||
int ASSTAPI AsstConnect(AsstHandle handle, const char* adb_path, const char* address, const char* config);
|
||||
|
||||
TaskId ASSTAPI AsstAppendTask(AsstHandle handle, const char* type, const char* params);
|
||||
int ASSTAPI AsstSetTaskParams(AsstHandle handle, TaskId id, const char* params);
|
||||
|
||||
int ASSTAPI AsstStart(AsstHandle handle);
|
||||
int ASSTAPI AsstStop(AsstHandle handle);
|
||||
|
||||
int ASSTAPI AsstCtrlerClick(AsstHandle handle, int x, int y, int block);
|
||||
unsigned long long ASSTAPI AsstGetImage(AsstHandle handle, void* buff, unsigned long long buff_size);
|
||||
unsigned long long ASSTAPI AsstGetUUID(AsstHandle handle, char* buff, unsigned long long buff_size);
|
||||
unsigned long long ASSTAPI AsstGetTasksList(AsstHandle handle, TaskId* buff, unsigned long long buff_size);
|
||||
unsigned long long ASSTAPI AsstGetNullSize();
|
||||
|
||||
ASSTAPI_PORT const char* ASST_CALL AsstGetVersion();
|
||||
void ASSTAPI AsstLog(const char* level, const char* message);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,37 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// The way how the function is called
|
||||
#if !defined(ASST_CALL)
|
||||
#if defined(_WIN32)
|
||||
#define ASST_CALL __stdcall
|
||||
#else
|
||||
#define ASST_CALL
|
||||
#endif /* _WIN32 */
|
||||
#endif /* ASST_CALL */
|
||||
|
||||
// The function exported symbols
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#define ASST_DLL_IMPORT __declspec(dllimport)
|
||||
#define ASST_DLL_EXPORT __declspec(dllexport)
|
||||
#define ASST_DLL_LOCAL
|
||||
#else
|
||||
#if __GNUC__ >= 4
|
||||
#define ASST_DLL_IMPORT __attribute__((visibility("default")))
|
||||
#define ASST_DLL_EXPORT __attribute__((visibility("default")))
|
||||
#define ASST_DLL_LOCAL __attribute__((visibility("hidden")))
|
||||
#else
|
||||
#define ASST_DLL_IMPORT
|
||||
#define ASST_DLL_EXPORT
|
||||
#define ASST_DLL_LOCAL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ASST_DLL_EXPORTS // defined if we are building the DLL (instead of using it)
|
||||
#define ASSTAPI_PORT ASST_DLL_EXPORT
|
||||
#else
|
||||
#define ASSTAPI_PORT ASST_DLL_IMPORT
|
||||
#endif // ASST_DLL_EXPORTS
|
||||
|
||||
#define ASSTAPI ASSTAPI_PORT ASST_CALL
|
||||
|
||||
#define ASSTLOCAL ASST_DLL_LOCAL ASST_CALL
|
||||
@@ -1,92 +0,0 @@
|
||||
/* automatically generated by rust-bindgen 0.60.1 */
|
||||
|
||||
pub type AsstHandle = *mut ::std::os::raw::c_void;
|
||||
pub type TaskId = ::std::os::raw::c_int;
|
||||
pub type AsstApiCallback = ::std::option::Option<
|
||||
unsafe extern "C" fn(
|
||||
msg: ::std::os::raw::c_int,
|
||||
detail_json: *const ::std::os::raw::c_char,
|
||||
custom_arg: *mut ::std::os::raw::c_void,
|
||||
),
|
||||
>;
|
||||
extern "C" {
|
||||
pub fn AsstLoadResource(path: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstCreate() -> AsstHandle;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstCreateEx(
|
||||
callback: AsstApiCallback,
|
||||
custom_arg: *mut ::std::os::raw::c_void,
|
||||
) -> AsstHandle;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstDestroy(handle: AsstHandle);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstConnect(
|
||||
handle: AsstHandle,
|
||||
adb_path: *const ::std::os::raw::c_char,
|
||||
address: *const ::std::os::raw::c_char,
|
||||
config: *const ::std::os::raw::c_char,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstAppendTask(
|
||||
handle: AsstHandle,
|
||||
type_: *const ::std::os::raw::c_char,
|
||||
params: *const ::std::os::raw::c_char,
|
||||
) -> TaskId;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstSetTaskParams(
|
||||
handle: AsstHandle,
|
||||
id: TaskId,
|
||||
params: *const ::std::os::raw::c_char,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstStart(handle: AsstHandle) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstStop(handle: AsstHandle) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstCtrlerClick(
|
||||
handle: AsstHandle,
|
||||
x: ::std::os::raw::c_int,
|
||||
y: ::std::os::raw::c_int,
|
||||
block: ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstGetImage(
|
||||
handle: AsstHandle,
|
||||
buff: *mut ::std::os::raw::c_void,
|
||||
buff_size: ::std::os::raw::c_ulonglong,
|
||||
) -> ::std::os::raw::c_ulonglong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstGetUUID(
|
||||
handle: AsstHandle,
|
||||
buff: *mut ::std::os::raw::c_char,
|
||||
buff_size: ::std::os::raw::c_ulonglong,
|
||||
) -> ::std::os::raw::c_ulonglong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstGetTasksList(
|
||||
handle: AsstHandle,
|
||||
buff: *mut TaskId,
|
||||
buff_size: ::std::os::raw::c_ulonglong,
|
||||
) -> ::std::os::raw::c_ulonglong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstGetNullSize() -> ::std::os::raw::c_ulonglong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstGetVersion() -> *const ::std::os::raw::c_char;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstLog(level: *const ::std::os::raw::c_char, message: *const ::std::os::raw::c_char);
|
||||
}
|
||||
@@ -1,18 +1,37 @@
|
||||
/* automatically generated by rust-bindgen 0.60.1 */
|
||||
/* automatically generated by rust-bindgen 0.63.0 */
|
||||
|
||||
pub type AsstHandle = *mut ::std::os::raw::c_void;
|
||||
pub type TaskId = ::std::os::raw::c_int;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct AsstExtAPI {
|
||||
_unused: [u8; 0],
|
||||
}
|
||||
pub type AsstHandle = *mut AsstExtAPI;
|
||||
pub type AsstBool = u8;
|
||||
pub type AsstSize = u64;
|
||||
pub type AsstMsgId = i32;
|
||||
pub type AsstTaskId = i32;
|
||||
pub type AsstAsyncCallId = i32;
|
||||
pub type AsstStaticOptionKey = i32;
|
||||
pub type AsstInstanceOptionKey = i32;
|
||||
pub type AsstApiCallback = ::std::option::Option<
|
||||
unsafe extern "C" fn(
|
||||
msg: ::std::os::raw::c_int,
|
||||
msg: AsstMsgId,
|
||||
detail_json: *const ::std::os::raw::c_char,
|
||||
custom_arg: *mut ::std::os::raw::c_void,
|
||||
),
|
||||
>;
|
||||
extern "C" {
|
||||
pub fn AsstLoadResource(path: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int;
|
||||
pub fn AsstSetUserDir(path: *const ::std::os::raw::c_char) -> AsstBool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstLoadResource(path: *const ::std::os::raw::c_char) -> AsstBool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstSetStaticOption(
|
||||
key: AsstStaticOptionKey,
|
||||
value: *const ::std::os::raw::c_char,
|
||||
) -> AsstBool;
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
extern "C" {
|
||||
pub fn AsstCreate() -> AsstHandle;
|
||||
}
|
||||
@@ -25,70 +44,86 @@ extern "C" {
|
||||
extern "C" {
|
||||
pub fn AsstDestroy(handle: AsstHandle);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstSetInstanceOption(
|
||||
handle: AsstHandle,
|
||||
key: AsstInstanceOptionKey,
|
||||
value: *const ::std::os::raw::c_char,
|
||||
) -> AsstBool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstConnect(
|
||||
handle: AsstHandle,
|
||||
adb_path: *const ::std::os::raw::c_char,
|
||||
address: *const ::std::os::raw::c_char,
|
||||
config: *const ::std::os::raw::c_char,
|
||||
) -> ::std::os::raw::c_int;
|
||||
) -> AsstBool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstAppendTask(
|
||||
handle: AsstHandle,
|
||||
type_: *const ::std::os::raw::c_char,
|
||||
params: *const ::std::os::raw::c_char,
|
||||
) -> TaskId;
|
||||
) -> AsstTaskId;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstSetTaskParams(
|
||||
handle: AsstHandle,
|
||||
id: TaskId,
|
||||
id: AsstTaskId,
|
||||
params: *const ::std::os::raw::c_char,
|
||||
) -> ::std::os::raw::c_int;
|
||||
) -> AsstBool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstStart(handle: AsstHandle) -> ::std::os::raw::c_int;
|
||||
pub fn AsstStart(handle: AsstHandle) -> AsstBool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstStop(handle: AsstHandle) -> ::std::os::raw::c_int;
|
||||
pub fn AsstStop(handle: AsstHandle) -> AsstBool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstCtrlerClick(
|
||||
pub fn AsstRunning(handle: AsstHandle) -> AsstBool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstAsyncConnect(
|
||||
handle: AsstHandle,
|
||||
x: ::std::os::raw::c_int,
|
||||
y: ::std::os::raw::c_int,
|
||||
block: ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
adb_path: *const ::std::os::raw::c_char,
|
||||
address: *const ::std::os::raw::c_char,
|
||||
config: *const ::std::os::raw::c_char,
|
||||
block: AsstBool,
|
||||
) -> AsstAsyncCallId;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstAsyncClick(handle: AsstHandle, x: i32, y: i32, block: AsstBool) -> AsstAsyncCallId;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstAsyncScreencap(handle: AsstHandle, block: AsstBool) -> AsstAsyncCallId;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstGetImage(
|
||||
handle: AsstHandle,
|
||||
buff: *mut ::std::os::raw::c_void,
|
||||
buff_size: ::std::os::raw::c_ulonglong,
|
||||
) -> ::std::os::raw::c_ulonglong;
|
||||
buff_size: AsstSize,
|
||||
) -> AsstSize;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstGetUUID(
|
||||
handle: AsstHandle,
|
||||
buff: *mut ::std::os::raw::c_char,
|
||||
buff_size: ::std::os::raw::c_ulonglong,
|
||||
) -> ::std::os::raw::c_ulonglong;
|
||||
buff_size: AsstSize,
|
||||
) -> AsstSize;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstGetTasksList(
|
||||
handle: AsstHandle,
|
||||
buff: *mut TaskId,
|
||||
buff_size: ::std::os::raw::c_ulonglong,
|
||||
) -> ::std::os::raw::c_ulonglong;
|
||||
buff: *mut AsstTaskId,
|
||||
buff_size: AsstSize,
|
||||
) -> AsstSize;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstGetNullSize() -> ::std::os::raw::c_ulonglong;
|
||||
pub fn AsstGetNullSize() -> AsstSize;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn AsstGetVersion() -> *const ::std::os::raw::c_char;
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
extern "C" {
|
||||
pub fn AsstLog(level: *const ::std::os::raw::c_char, message: *const ::std::os::raw::c_char);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
use std::{collections::{HashMap, HashSet}, ffi::c_void};
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
ffi::c_void,
|
||||
};
|
||||
|
||||
include!("./bind.rs");
|
||||
|
||||
@@ -22,10 +25,10 @@ impl From<std::str::Utf8Error> for Error {
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Task{
|
||||
pub struct Task {
|
||||
pub id: i32,
|
||||
pub type_:String,
|
||||
pub params:String
|
||||
pub type_: String,
|
||||
pub params: String,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -83,8 +86,8 @@ impl Maa {
|
||||
.to_string()
|
||||
);
|
||||
}
|
||||
pub fn load_resource(path:&str) -> Result<(), Error> {
|
||||
let ret: i32;
|
||||
pub fn load_resource(path: &str) -> Result<(), Error> {
|
||||
let ret: AsstBool;
|
||||
unsafe {
|
||||
let path = std::ffi::CString::new(path.to_string())?;
|
||||
ret = AsstLoadResource(path.as_ptr());
|
||||
@@ -101,47 +104,107 @@ impl Maa {
|
||||
Ok(ret)
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn set_static_option(option: AsstStaticOptionKey, value: &str) -> Result<(), Error> {
|
||||
let c_option_value = std::ffi::CString::new(value)?;
|
||||
unsafe {
|
||||
if AsstSetStaticOption(option, c_option_value.as_ptr()) == 1 {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(Error::Unknown)
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
pub fn set_working_directory(path: &str) -> Result<(), Error> {
|
||||
let c_path = std::ffi::CString::new(path)?;
|
||||
unsafe {
|
||||
if AsstSetUserDir(c_path.as_ptr()) == 1 {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(Error::Unknown)
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
pub fn set_option(&mut self, option: AsstInstanceOptionKey, value: &str) -> Result<(), Error> {
|
||||
let c_option_value = std::ffi::CString::new(value)?;
|
||||
unsafe {
|
||||
if AsstSetInstanceOption(self.handle, option, c_option_value.as_ptr()) == 1 {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(Error::Unknown)
|
||||
}
|
||||
}
|
||||
}
|
||||
pub fn connect(
|
||||
&mut self,
|
||||
adb_path: &str,
|
||||
address: &str,
|
||||
config: Option<&str>,
|
||||
) -> Result<(), Error> {
|
||||
) -> Result<i32, Error> {
|
||||
unsafe {
|
||||
let c_adb_path = std::ffi::CString::new(adb_path)?;
|
||||
let c_address = std::ffi::CString::new(address)?;
|
||||
let ret = match config {
|
||||
Some(config) => {
|
||||
let c_config = std::ffi::CString::new(config)?;
|
||||
AsstConnect(
|
||||
self.handle,
|
||||
c_adb_path.as_ptr(),
|
||||
c_address.as_ptr(),
|
||||
c_config.as_ptr(),
|
||||
)
|
||||
}
|
||||
None => AsstConnect(
|
||||
self.handle,
|
||||
c_adb_path.as_ptr(),
|
||||
c_address.as_ptr(),
|
||||
0 as *const std::os::raw::c_char,
|
||||
),
|
||||
let c_cfg_ptr = match config {
|
||||
Some(cfg) => std::ffi::CString::new(cfg)?.as_ptr(),
|
||||
None => 0 as *const std::os::raw::c_char,
|
||||
};
|
||||
match ret {
|
||||
1 => {
|
||||
self.target=Some(address.to_string());
|
||||
Ok(())
|
||||
},
|
||||
_ => Err(Error::Unknown),
|
||||
let ret = AsstAsyncConnect(
|
||||
self.handle,
|
||||
c_adb_path.as_ptr(),
|
||||
c_address.as_ptr(),
|
||||
c_cfg_ptr,
|
||||
1,
|
||||
);
|
||||
if ret != 0 {
|
||||
self.target = Some(address.to_string());
|
||||
Ok(ret)
|
||||
} else {
|
||||
Err(Error::Unknown)
|
||||
}
|
||||
}
|
||||
}
|
||||
pub fn click(&self, x: i32, y: i32) -> Result<(), Error> {
|
||||
|
||||
#[deprecated]
|
||||
#[allow(dead_code)]
|
||||
pub fn connect_legacy(
|
||||
&mut self,
|
||||
adb_path: &str,
|
||||
address: &str,
|
||||
config: Option<&str>,
|
||||
) -> Result<(), Error> {
|
||||
let c_adb_path = std::ffi::CString::new(adb_path)?;
|
||||
let c_address = std::ffi::CString::new(address)?;
|
||||
let c_cfg_ptr = match config {
|
||||
Some(cfg) => std::ffi::CString::new(cfg)?.as_ptr(),
|
||||
None => 0 as *const std::os::raw::c_char,
|
||||
};
|
||||
unsafe {
|
||||
match AsstCtrlerClick(self.handle, x, y, 0) {
|
||||
1 => Ok(()),
|
||||
_ => Err(Error::Unknown),
|
||||
let ret = AsstConnect(
|
||||
self.handle,
|
||||
c_adb_path.as_ptr(),
|
||||
c_address.as_ptr(),
|
||||
c_cfg_ptr,
|
||||
);
|
||||
if ret == 1 {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(Error::Unknown)
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
pub fn running(&self) -> bool {
|
||||
unsafe { AsstRunning(self.handle) == 1 }
|
||||
}
|
||||
pub fn click(&self, x: i32, y: i32) -> Result<i32, Error> {
|
||||
unsafe {
|
||||
let ret = AsstAsyncClick(self.handle, x, y, 0);
|
||||
if ret != 0 {
|
||||
Ok(ret)
|
||||
} else {
|
||||
Err(Error::Unknown)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -168,16 +231,28 @@ impl Maa {
|
||||
}
|
||||
}
|
||||
}
|
||||
pub fn create_task(&mut self, type_: &str, params: &str) -> Result<i32, Error> {
|
||||
#[allow(dead_code)]
|
||||
pub fn take_screenshot(&mut self) -> Result<(), Error> {
|
||||
unsafe {
|
||||
match AsstAsyncScreencap(self.handle, 1) {
|
||||
0 => Err(Error::Unknown),
|
||||
_ => Ok(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
pub fn create_task(&mut self, type_: &str, params: &str) -> Result<AsstTaskId, Error> {
|
||||
unsafe {
|
||||
let c_type = std::ffi::CString::new(type_)?;
|
||||
let c_params = std::ffi::CString::new(params)?;
|
||||
let task_id = AsstAppendTask(self.handle, c_type.as_ptr(), c_params.as_ptr());
|
||||
self.tasks.insert(task_id, Task {
|
||||
id: task_id,
|
||||
type_: type_.to_string(),
|
||||
params: params.to_string(),
|
||||
});
|
||||
self.tasks.insert(
|
||||
task_id,
|
||||
Task {
|
||||
id: task_id,
|
||||
type_: type_.to_string(),
|
||||
params: params.to_string(),
|
||||
},
|
||||
);
|
||||
Ok(task_id)
|
||||
}
|
||||
}
|
||||
@@ -191,7 +266,7 @@ impl Maa {
|
||||
}
|
||||
}
|
||||
pub fn get_uuid(&mut self) -> Result<String, Error> {
|
||||
if let Some(uuid)=self.uuid.clone(){
|
||||
if let Some(uuid) = self.uuid.clone() {
|
||||
return Ok(uuid);
|
||||
};
|
||||
unsafe {
|
||||
@@ -214,7 +289,7 @@ impl Maa {
|
||||
}
|
||||
}
|
||||
}
|
||||
pub fn get_target(&self)->Option<String>{
|
||||
pub fn get_target(&self) -> Option<String> {
|
||||
return self.target.clone();
|
||||
}
|
||||
pub fn get_tasks(&mut self) -> Result<&HashMap<i32, Task>, Error> {
|
||||
@@ -234,12 +309,10 @@ impl Maa {
|
||||
buff.set_len(data_size as usize);
|
||||
buff.resize(data_size as usize, 0);
|
||||
let mut task_ids = HashSet::with_capacity(buff.len());
|
||||
for i in buff{
|
||||
for i in buff {
|
||||
task_ids.insert(i);
|
||||
}
|
||||
self.tasks.retain(|k, _|{
|
||||
task_ids.contains(k)
|
||||
});
|
||||
self.tasks.retain(|k, _| task_ids.contains(k));
|
||||
return Ok(&self.tasks);
|
||||
}
|
||||
}
|
||||
@@ -260,6 +333,15 @@ impl Maa {
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
pub fn log(level_str: &str, message: &str) -> Result<(), Error> {
|
||||
let c_level_str = std::ffi::CString::new(level_str)?;
|
||||
let c_message = std::ffi::CString::new(message)?;
|
||||
unsafe {
|
||||
AsstLog(c_level_str.as_ptr(), c_message.as_ptr());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Maa {
|
||||
|
||||
Reference in New Issue
Block a user