| 177 | } |
| 178 | |
| 179 | MaaControllerFeature CustomGetFeatures(void* trans_arg) |
| 180 | { |
| 181 | using Ret = std::optional<std::vector<std::string>>; |
| 182 | auto customCtx = reinterpret_cast<CustomControllerContext*>(trans_arg); |
| 183 | auto ctx = customCtx->callbacks["get_features"]; |
| 184 | auto result = ctx->Call<Ret>([&](maajs::FunctionType func) { return func.Call({ }); }); |
| 185 | if (!result) { |
| 186 | return 0; |
| 187 | } |
| 188 | |
| 189 | MaaControllerFeature ret = 0; |
| 190 | for (auto key : *result) { |
| 191 | if (key == "mouse") { |
| 192 | ret |= MaaControllerFeature_UseMouseDownAndUpInsteadOfClick; |
| 193 | } |
| 194 | else if (key == "keyboard") { |
| 195 | ret |= MaaControllerFeature_UseKeyboardDownAndUpInsteadOfClick; |
| 196 | } |
| 197 | } |
| 198 | return ret; |
| 199 | } |
| 200 | |
| 201 | MaaBool CustomStartApp(const char* intent, void* trans_arg) |
| 202 | { |