This commit is contained in:
dantmnf
2023-03-04 15:49:44 +08:00
137 changed files with 18573 additions and 6806 deletions

View File

@@ -797,7 +797,7 @@ bool asst::Controller::swipe_without_scale(const Point& p1, const Point& p2, int
const auto& opt = Config.get_options();
if (m_minitouch_enabled && m_minitouch_available) {
Log.trace(m_use_maa_touch ? "maatouch" : "minitouch", "swipe", p1, p2, duration, extra_swipe, slope_in,
slope_out);
slope_out);
Minitoucher toucher(std::bind(&Controller::input_to_minitouch, this, std::placeholders::_1), m_minitouch_props);
toucher.down(x1, y1);
@@ -896,6 +896,11 @@ bool asst::Controller::support_swipe_with_pause() const noexcept
return m_minitouch_enabled && m_minitouch_available && m_swipe_with_pause_enabled && !m_adb.press_esc.empty();
}
bool asst::Controller::support_precise_swipe() const noexcept
{
return m_minitouch_enabled && m_minitouch_available;
}
bool asst::Controller::connect(const std::string& adb_path, const std::string& address, const std::string& config)
{
LogTraceFunction;
@@ -1600,7 +1605,7 @@ std::optional<int> asst::Controller::call_command_posix(const std::string& cmd,
if (client_socket < 0) {
Log.error("accept failed:", strerror(errno));
::kill(m_child, SIGKILL);
::waitpid(m_child, &exit_ret, 0);
::waitpid(m_child, &exit_ret, 0);
return std::nullopt;
}
@@ -1621,7 +1626,8 @@ std::optional<int> asst::Controller::call_command_posix(const std::string& cmd,
}
} while (::waitpid(m_child, &exit_ret, WNOHANG) == 0 && !check_timeout());
}
::waitpid(m_child, &exit_ret, 0); // if ::waitpid(m_child, &exit_ret, WNOHANG) == 0, repeat it will cause ECHILD, so not check the return value
::waitpid(m_child, &exit_ret, 0); // if ::waitpid(m_child, &exit_ret, WNOHANG) == 0, repeat it will cause
// ECHILD, so not check the return value
}
else {
// failed to create child process