| 181 | } |
| 182 | |
| 183 | MaaController* MaaRecordControllerCreate(MaaController* inner, const char* recording_path) |
| 184 | { |
| 185 | LogFunc << VAR_VOIDP(inner) << VAR(recording_path); |
| 186 | |
| 187 | if (!inner) { |
| 188 | LogError << "inner controller is null"; |
| 189 | return nullptr; |
| 190 | } |
| 191 | |
| 192 | if (!recording_path) { |
| 193 | LogError << "recording_path is null"; |
| 194 | return nullptr; |
| 195 | } |
| 196 | |
| 197 | auto* agent = dynamic_cast<MAA_CTRL_NS::ControllerAgent*>(inner); |
| 198 | if (!agent) { |
| 199 | LogError << "inner is not a ControllerAgent"; |
| 200 | return nullptr; |
| 201 | } |
| 202 | |
| 203 | auto inner_unit = agent->control_unit(); |
| 204 | if (!inner_unit) { |
| 205 | LogError << "inner control unit is null"; |
| 206 | return nullptr; |
| 207 | } |
| 208 | |
| 209 | auto control_unit = MAA_NS::RecordControlUnitLibraryHolder::create_control_unit(std::move(inner_unit), recording_path); |
| 210 | if (!control_unit) { |
| 211 | LogError << "Failed to create record control unit"; |
| 212 | return nullptr; |
| 213 | } |
| 214 | |
| 215 | return new MAA_CTRL_NS::ControllerAgent(std::move(control_unit)); |
| 216 | } |
| 217 | |
| 218 | MaaController* MaaPlayCoverControllerCreate(const char* address, const char* uuid) |
| 219 | { |
no test coverage detected