NodeJS addon for MaaFramework
npm install @nekosu/maa-node
NodeJS addon for MaaFramework
npm install @nekosu/maa-node
请教下,我希望在自定义识别的任务中,获取到当前屏幕的截图,然后自己进行处理,最后返回关键信息。
在看源码的时候,我注意到 encode 方法应该可以返回一个 ArrayBuffer 对象,但实际使用时却出现了问题,导致进程直接闪退。
之前没有 NodeJs 的经验,没看明白哪里出了问题
环境
以下是我的代码片段
register_custom_recognizer
instance.register_custom_recognizer('myReco', (ctx, name, param, image) => {
console.log(image.info)
// console.log(image.encoded)
console.log(maa.get_image_encoded(image.handle))
// return ctx.run_recognition('another_task', image)
return {
out_box: {
x: 0,
y: 0,
width: 10,
height: 10
},
out_detail: '11111'
}
})
pipeline
{
"start": {
"recognition": "Custom",
"custom_recognition": "myReco",
"custom_recognition_param": {
"msg": "Hello world!"
}
}
}
错误日志
instance Task.Started {"entry":"start","hash":"e2d86b72eb4eca2a","id":1,"name":"start","uuid":"ab9f59fa34cdcac8"}
{ width: 720, height: 1280, type: 16 }
FATAL ERROR: Object::CheckCast value is not napi_object
----- Native stack trace -----
1: 00007FF66C74836A uv_cpumask_size+72474
2: 00007FF66C6D4672 node::OnFatalError+290
3: 00007FF66CEAD4B5 napi_fatal_error+245
4: 00007FFC986B23A6
5: 00007FFC986C20A4
6: 00007FFC986C3750
7: 00007FFC986C1AD7
8: 00007FFC986C05E9
9: 00007FFC986C3437
10: 00007FF66D5AA947 napi_is_detached_arraybuffer+855
11: 00007FF66E4E6941 v8::internal::compiler::CompilationDependencies::FieldTypeDependencyOffTheRecord+2112817
12: 00007FF66E603EB1 v8::internal::compiler::CompilationDependencies::FieldTypeDependencyOffTheRecord+3281569
13: 00007FF66E514704 v8::internal::compiler::CompilationDependencies::FieldTypeDependencyOffTheRecord+2300660
14: 00007FF66E4E1EB3 v8::internal::compiler::CompilationDependencies::FieldTypeDependencyOffTheRecord+2093731
15: 00007FF66DEF6D01 v8::internal::ThreadIsolation::StartOfJitAllocationAt+90673
16: 00007FF66B20A611 v8::internal::ThreadIsolation::SplitJitPages+64577
17: 00007FF66B20A7EB v8::internal::ThreadIsolation::SplitJitPages+65051
18: 00007FF66DF050C7 v8::internal::ThreadIsolation::StartOfJitAllocationAt+148983
19: 00007FF66CE5B54B node::PromiseRejectCallback+2043
20: 00007FF66E4E6941 v8::internal::compiler::CompilationDependencies::FieldTypeDependencyOffTheRecord+2112817
21: 00007FF6CE529B80
----- JavaScript stack trace -----
1: processTicksAndRejections (node:internal/process/task_queues:95:5)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.