| 119 | } |
| 120 | |
| 121 | MaaBool CustomAct( |
| 122 | MaaContext* context, |
| 123 | MaaTaskId task_id, |
| 124 | const char* node_name, |
| 125 | const char* custom_action_name, |
| 126 | const char* custom_action_param, |
| 127 | MaaRecoId reco_id, |
| 128 | const MaaRect* box, |
| 129 | void* trans_arg) |
| 130 | { |
| 131 | using Ret = bool; |
| 132 | auto ctx = reinterpret_cast<maajs::CallbackContext*>(trans_arg); |
| 133 | return ctx->Call<Ret>([&](maajs::FunctionType func) { |
| 134 | auto env = func.Env(); |
| 135 | auto self = maajs::ObjectType::New(env); |
| 136 | |
| 137 | self["context"] = ContextImpl::locate_object(env, context); |
| 138 | self["id"] = maajs::JSConvert<MaaTaskId>::to_value(env, task_id); |
| 139 | self["task"] = maajs::StringType::New(env, node_name); |
| 140 | self["name"] = maajs::StringType::New(env, custom_action_name); |
| 141 | self["param"] = maajs::JsonParse(env, custom_action_param); |
| 142 | self["recoId"] = maajs::JSConvert<MaaRecoId>::to_value(env, reco_id); |
| 143 | self["box"] = maajs::JSConvert<MaaRect>::to_value(env, *box); |
| 144 | |
| 145 | return func.Call(self, { self }); |
| 146 | }); |
| 147 | } |
| 148 | |
| 149 | MaaBool CustomConnect(void* trans_arg) |
| 150 | { |