MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / MaaContextRunAction

Function MaaContextRunAction

source/Common/MaaContext.cpp:78–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78MaaActId
79 MaaContextRunAction(MaaContext* context, const char* entry, const char* pipeline_override, const MaaRect* box, const char* reco_detail)
80{
81 LogFunc << VAR_VOIDP(context) << VAR(entry) << VAR(pipeline_override) << VAR(box) << VAR(reco_detail);
82
83 if (!context) {
84 LogError << "handle is null";
85 return MaaInvalidId;
86 }
87
88 if (!entry) {
89 LogError << "entry is null";
90 return MaaInvalidId;
91 }
92
93 if (!pipeline_override) {
94 LogError << "pipeline_override is null";
95 return MaaInvalidId;
96 }
97
98 if (!reco_detail) {
99 LogError << "reco_detail is null";
100 return MaaInvalidId;
101 }
102
103 auto ov_opt = json::parse(pipeline_override);
104 if (!ov_opt) {
105 LogError << "failed to parse" << VAR(pipeline_override);
106 return MaaInvalidId;
107 }
108 if (!ov_opt->is_object()) {
109 LogError << "json is not object" << VAR(pipeline_override);
110 return MaaInvalidId;
111 }
112
113 cv::Rect cvbox { };
114 if (box) {
115 cvbox.x = box->x;
116 cvbox.y = box->y;
117 cvbox.width = box->width;
118 cvbox.height = box->height;
119 }
120 return context->run_action(entry, ov_opt->as_object(), cvbox, reco_detail);
121}
122
123MaaRecoId MaaContextRunRecognitionDirect(MaaContext* context, const char* reco_type, const char* reco_param, const MaaImageBuffer* image)
124{

Callers 1

run_actionMethod · 0.85

Calls 1

run_actionMethod · 0.45

Tested by

no test coverage detected