mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-19 18:47:55 +08:00
fix.修复ADB子进程不释放的问题: https://github.com/MistEO/MeoAssistantArknights/issues/53
This commit is contained in:
@@ -38,7 +38,8 @@
|
||||
"swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]",
|
||||
"display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '",
|
||||
"displayFormat": "cur=%dx%d",
|
||||
"screencap": "[Adb] -s [Address] exec-out screencap -p"
|
||||
"screencap": "[Adb] -s [Address] exec-out screencap -p",
|
||||
"release": "[Adb] kill-server"
|
||||
}
|
||||
},
|
||||
"BlueStacksInternational": {
|
||||
@@ -56,7 +57,8 @@
|
||||
"swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]",
|
||||
"display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '",
|
||||
"displayFormat": "cur=%dx%d",
|
||||
"screencap": "[Adb] -s [Address] exec-out screencap -p"
|
||||
"screencap": "[Adb] -s [Address] exec-out screencap -p",
|
||||
"release": "[Adb] kill-server"
|
||||
}
|
||||
},
|
||||
"MuMuEmulator": {
|
||||
@@ -74,7 +76,8 @@
|
||||
"swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]",
|
||||
"display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '",
|
||||
"displayFormat": "cur=%dx%d",
|
||||
"screencap": "[Adb] -s [Address] exec-out screencap -p"
|
||||
"screencap": "[Adb] -s [Address] exec-out screencap -p",
|
||||
"release": "[Adb] kill-server"
|
||||
}
|
||||
},
|
||||
"LDPlayer": {
|
||||
@@ -92,7 +95,8 @@
|
||||
"swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]",
|
||||
"display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '",
|
||||
"displayFormat": "cur=%dx%d",
|
||||
"screencap": "[Adb] -s [Address] shell screencap -p"
|
||||
"screencap": "[Adb] -s [Address] shell screencap -p",
|
||||
"release": "[Adb] kill-server"
|
||||
}
|
||||
},
|
||||
"Nox": {
|
||||
@@ -110,7 +114,8 @@
|
||||
"swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]",
|
||||
"display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '",
|
||||
"displayFormat": "cur=%dx%d",
|
||||
"screencap": "[Adb] -s [Address] exec-out screencap -p"
|
||||
"screencap": "[Adb] -s [Address] exec-out screencap -p",
|
||||
"release": "[Adb] kill-server"
|
||||
}
|
||||
},
|
||||
"XYAZ": {
|
||||
@@ -128,7 +133,8 @@
|
||||
"swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]",
|
||||
"display": "[Adb] -s [Address] shell dumpsys window displays | grep init=",
|
||||
"displayFormat": " init=%dx%d",
|
||||
"screencap": "[Adb] -s [Address] shell screencap -p"
|
||||
"screencap": "[Adb] -s [Address] shell screencap -p",
|
||||
"release": "[Adb] kill-server"
|
||||
}
|
||||
},
|
||||
"Custom": {
|
||||
@@ -148,7 +154,8 @@
|
||||
"swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]",
|
||||
"display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '",
|
||||
"displayFormat": "cur=%dx%d",
|
||||
"screencap": "[Adb] -s [Address] exec-out screencap -p"
|
||||
"screencap": "[Adb] -s [Address] exec-out screencap -p",
|
||||
"release": "[Adb] kill-server"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,6 +242,7 @@ namespace asst
|
||||
std::string display;
|
||||
std::string display_format;
|
||||
std::string screencap;
|
||||
std::string release;
|
||||
//std::string pullscreen;
|
||||
int display_width = 0;
|
||||
int display_height = 0;
|
||||
|
||||
@@ -98,6 +98,7 @@ bool asst::Controller::connect_adb(const std::string& address)
|
||||
m_emulator_info.adb.click = utils::string_replace_all(utils::string_replace_all(m_emulator_info.adb.click, "[Adb]", m_adb_path), "[Address]", address);
|
||||
m_emulator_info.adb.swipe = utils::string_replace_all(utils::string_replace_all(m_emulator_info.adb.swipe, "[Adb]", m_adb_path), "[Address]", address);
|
||||
m_emulator_info.adb.screencap = utils::string_replace_all(utils::string_replace_all(m_emulator_info.adb.screencap, "[Adb]", m_adb_path), "[Address]", address);
|
||||
m_emulator_info.adb.release = utils::string_replace_all(m_emulator_info.adb.release, "[Adb]", m_adb_path);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -115,6 +116,10 @@ asst::Controller::~Controller()
|
||||
m_cmd_thread.join();
|
||||
}
|
||||
|
||||
if (!m_emulator_info.adb.release.empty()) {
|
||||
call_command(m_emulator_info.adb.release);
|
||||
}
|
||||
|
||||
::CloseHandle(m_pipe_read);
|
||||
::CloseHandle(m_pipe_write);
|
||||
::CloseHandle(m_pipe_child_read);
|
||||
@@ -220,10 +225,14 @@ bool asst::Controller::try_capture(const EmulatorInfo& info, bool without_handle
|
||||
{
|
||||
LogTraceScope("try_capture | " + info.name);
|
||||
|
||||
if (!m_emulator_info.adb.release.empty()) {
|
||||
call_command(m_emulator_info.adb.release);
|
||||
}
|
||||
|
||||
const HandleInfo& handle_info = info.handle;
|
||||
|
||||
if (!without_handle) { // 使用模拟器自带的adb
|
||||
// 转成宽字符的
|
||||
// 转成宽字符的
|
||||
wchar_t* class_wbuff = nullptr;
|
||||
if (!handle_info.class_name.empty()) {
|
||||
size_t class_len = (handle_info.class_name.size() + 1) * 2;
|
||||
|
||||
@@ -52,6 +52,7 @@ bool asst::GeneralConfiger::parse(const json::value& json)
|
||||
emulator_info.adb.display = adb_json.at("display").as_string();
|
||||
emulator_info.adb.display_format = adb_json.at("displayFormat").as_string();
|
||||
emulator_info.adb.screencap = adb_json.at("screencap").as_string();
|
||||
emulator_info.adb.release = adb_json.at("release").as_string();
|
||||
//emulator_info.adb.pullscreen = adb_json.at("pullscreen").as_string();
|
||||
|
||||
m_emulators_info.emplace(name, std::move(emulator_info));
|
||||
|
||||
@@ -374,6 +374,10 @@ namespace MeoAsstGui
|
||||
string cur_sha = ViewStatusStorage.Get(filename, string.Empty);
|
||||
|
||||
string response = RequestApi(req_base_url + url);
|
||||
if (response == String.Empty)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
string cloud_sha;
|
||||
string cur_message = "";
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user