| 37 | } |
| 38 | |
| 39 | std::shared_ptr<MAA_CTRL_UNIT_NS::AdbControlUnitAPI> AdbControlUnitLibraryHolder::create_control_unit( |
| 40 | const char* adb_path, |
| 41 | const char* adb_serial, |
| 42 | MaaAdbScreencapMethod screencap_methods, |
| 43 | MaaAdbInputMethod input_methods, |
| 44 | const char* config, |
| 45 | const char* agent_path) |
| 46 | { |
| 47 | if (!load_library(library_dir() / libname_)) { |
| 48 | LogError << "Failed to load library" << VAR(library_dir()) << VAR(libname_); |
| 49 | return nullptr; |
| 50 | } |
| 51 | |
| 52 | check_version<AdbControlUnitLibraryHolder, decltype(MaaAdbControlUnitGetVersion)>(version_func_name_); |
| 53 | |
| 54 | auto create_control_unit_func = get_function<decltype(MaaAdbControlUnitCreate)>(create_func_name_); |
| 55 | if (!create_control_unit_func) { |
| 56 | LogError << "Failed to get function create_control_unit"; |
| 57 | return nullptr; |
| 58 | } |
| 59 | |
| 60 | auto destroy_control_unit_func = get_function<decltype(MaaAdbControlUnitDestroy)>(destroy_func_name_); |
| 61 | if (!destroy_control_unit_func) { |
| 62 | LogError << "Failed to get function destroy_control_unit"; |
| 63 | return nullptr; |
| 64 | } |
| 65 | |
| 66 | auto control_unit_handle = create_control_unit_func(adb_path, adb_serial, screencap_methods, input_methods, config, agent_path); |
| 67 | |
| 68 | if (!control_unit_handle) { |
| 69 | LogError << "Failed to create control unit"; |
| 70 | return nullptr; |
| 71 | } |
| 72 | |
| 73 | return std::shared_ptr<MAA_CTRL_UNIT_NS::AdbControlUnitAPI>(control_unit_handle, destroy_control_unit_func); |
| 74 | } |
| 75 | |
| 76 | std::shared_ptr<MAA_CTRL_UNIT_NS::Win32ControlUnitAPI> Win32ControlUnitLibraryHolder::create_control_unit( |
| 77 | void* hWnd, |
nothing calls this directly
no outgoing calls
no test coverage detected