underlying codes implement

This commit is contained in:
lhhxxxxx
2022-06-04 23:15:03 +08:00
parent d0049ddd1f
commit 6e9c1914c2
6 changed files with 49 additions and 1 deletions

View File

@@ -522,6 +522,21 @@ cv::Mat asst::Controller::get_resized_image() const
return resized_mat;
}
int asst::Controller::start_game(const ServerType& server_type, bool block)
{
if (auto intent_name = Resrc.cfg().get_intent_name(server_type))
{
std::string cur_cmd = utils::string_replace_all(m_adb.start, "[Intent]", intent_name.value());
int id = push_cmd(cur_cmd);
if (block)
{
wait(id);
}
return id;
}
return -1;
}
int asst::Controller::click(const Point& p, bool block)
{
int x = static_cast<int>(p.x * m_control_scale);
@@ -828,6 +843,7 @@ bool asst::Controller::connect(const std::string& adb_path, const std::string& a
m_adb.screencap_raw_with_gzip = cmd_replace(adb_cfg.screencap_raw_with_gzip);
m_adb.screencap_encode = cmd_replace(adb_cfg.screencap_encode);
m_adb.release = cmd_replace(adb_cfg.release);
m_adb.start = cmd_replace(adb_cfg.start);
return true;
}