Merge pull request #2931 from MaaAssistantArknights/release/v4.7.3

Release v4.7.3
This commit is contained in:
MistEO
2022-11-29 00:03:01 +08:00
committed by GitHub
10 changed files with 93 additions and 45 deletions

Binary file not shown.

View File

@@ -1,3 +1,8 @@
## v4.7.3
- 新增 `MaaTouch` 连接配置 项,推荐在 minitouch 无法使用,但又不想用 `兼容触控模式` 时开启 @aa889788 @MistEO
- 修复 minitouch 路径错误无法使用的问题 @MistEO
## v4.7.2
- 修复 刷理智 掉落识别 在极端情况下疯狂上传的问题 @MistEO

View File

@@ -16,6 +16,14 @@
"adbSwipeDurationMultiplier_Doc": "adb 滑动延迟倍数",
"minitouchExtraSwipeDist": 100,
"minitouchExtraSwipeDuration": 200,
"minitouchProgramsOrder": [
"x86_64",
"x86",
"arm64-v8a",
"armeabi-v7a",
"armeabi",
"maatouch"
],
"penguinReport": {
"Doc": "企鹅物流汇报: https://penguin-stats.cn/",
"cmdFormat": "curl -H \"Content-Type: application/json\" -s -S -m 10 -i -d \"[body]\" \"https://penguin-stats.io/PenguinStats/api/v2/report\" --ssl-no-revoke [extra]",
@@ -60,7 +68,7 @@
"release": "[Adb] kill-server",
"start": "[Adb] -s [AdbSerial] shell am start -n [Intent]",
"stop": "[Adb] -s [AdbSerial] shell \"am force-stop `dumpsys activity activities 2>/dev/null | grep Activities= 2>/dev/null | grep -m 1 -i -o -E [^\\ ]*arknights[^/]*`\"",
"abilist": "[Adb] -s [AdbSerial] shell getprop ro.product.cpu.abilist",
"abilist": "[Adb] -s [AdbSerial] shell getprop ro.product.cpu.abilist",
"orientation": "[Adb] -s [AdbSerial] shell dumpsys input | grep SurfaceOrientation | grep -m 1 -o -E [0-9]",
"pushMinitouch": "[Adb] -s [AdbSerial] push \"[minitouchLocalPath]\" \"/data/local/tmp/[minitouchWorkingFile]\"",
"chmodMinitouch": "[Adb] -s [AdbSerial] shell chmod 700 \"/data/local/tmp/[minitouchWorkingFile]\"",
@@ -83,7 +91,7 @@
"release": "[Adb] kill-server",
"start": "[Adb] -s [AdbSerial] shell am start -n [Intent]",
"stop": "[Adb] -s [AdbSerial] shell \"am force-stop `dumpsys activity activities 2>/dev/null | grep Activities= 2>/dev/null | grep -m 1 -i -o -E [^\\ ]*arknights[^/]*`\"",
"abilist": "[Adb] -s [AdbSerial] shell getprop ro.product.cpu.abilist",
"abilist": "[Adb] -s [AdbSerial] shell getprop ro.product.cpu.abilist",
"orientation": "[Adb] -s [AdbSerial] shell dumpsys input | grep SurfaceOrientation | grep -m 1 -o -E [0-9]",
"pushMinitouch": "[Adb] -s [AdbSerial] push \"[minitouchLocalPath]\" \"/data/local/tmp/[minitouchWorkingFile]\"",
"chmodMinitouch": "[Adb] -s [AdbSerial] shell chmod 700 \"/data/local/tmp/[minitouchWorkingFile]\"",
@@ -106,7 +114,7 @@
"release": "[Adb] kill-server",
"start": "[Adb] -s [AdbSerial] shell am start -n [Intent]",
"stop": "[Adb] -s [AdbSerial] shell \"am force-stop `dumpsys activity activities 2>/dev/null | grep Activities= 2>/dev/null | grep -m 1 -i -o -E [^\\ ]*arknights[^/]*`\"",
"abilist": "[Adb] -s [AdbSerial] shell getprop ro.product.cpu.abilist",
"abilist": "[Adb] -s [AdbSerial] shell getprop ro.product.cpu.abilist",
"orientation": "[Adb] -s [AdbSerial] shell dumpsys input | grep SurfaceOrientation | grep -m 1 -o -E [0-9]",
"pushMinitouch": "[Adb] -s [AdbSerial] push \"[minitouchLocalPath]\" \"/data/local/tmp/[minitouchWorkingFile]\"",
"chmodMinitouch": "[Adb] -s [AdbSerial] shell chmod 700 \"/data/local/tmp/[minitouchWorkingFile]\"",
@@ -129,7 +137,7 @@
"release": "[Adb] kill-server",
"start": "[Adb] -s [AdbSerial] shell am start -n [Intent]",
"stop": "[Adb] -s [AdbSerial] shell \"am force-stop `dumpsys activity activities 2>/dev/null | grep Activities= 2>/dev/null | grep -m 1 -i -o -E [^\\ ]*arknights[^/]*`\"",
"abilist": "[Adb] -s [AdbSerial] shell getprop ro.product.cpu.abilist",
"abilist": "[Adb] -s [AdbSerial] shell getprop ro.product.cpu.abilist",
"orientation": "[Adb] -s [AdbSerial] shell dumpsys input | grep SurfaceOrientation | grep -m 1 -o -E [0-9]",
"pushMinitouch": "[Adb] -s [AdbSerial] push \"[minitouchLocalPath]\" \"/data/local/tmp/[minitouchWorkingFile]\"",
"chmodMinitouch": "[Adb] -s [AdbSerial] shell chmod 700 \"/data/local/tmp/[minitouchWorkingFile]\"",
@@ -152,7 +160,7 @@
"release": "[Adb] kill-server",
"start": "[Adb] -s [AdbSerial] shell am start -n [Intent]",
"stop": "[Adb] -s [AdbSerial] shell \"am force-stop `dumpsys activity activities 2>/dev/null | grep Activities= 2>/dev/null | grep -m 1 -i -o -E [^\\ ]*arknights[^/]*`\"",
"abilist": "[Adb] -s [AdbSerial] shell getprop ro.product.cpu.abilist",
"abilist": "[Adb] -s [AdbSerial] shell getprop ro.product.cpu.abilist",
"orientation": "[Adb] -s [AdbSerial] shell dumpsys input | grep SurfaceOrientation | grep -m 1 -o -E [0-9]",
"pushMinitouch": "[Adb] -s [AdbSerial] push \"[minitouchLocalPath]\" \"/data/local/tmp/[minitouchWorkingFile]\"",
"chmodMinitouch": "[Adb] -s [AdbSerial] shell chmod 700 \"/data/local/tmp/[minitouchWorkingFile]\"",
@@ -175,7 +183,7 @@
"release": "[Adb] kill-server",
"start": "[Adb] -s [AdbSerial] shell am start -n [Intent]",
"stop": "[Adb] -s [AdbSerial] shell \"am force-stop `dumpsys activity activities 2>/dev/null | grep Activities= 2>/dev/null | grep -m 1 -i -o -E [^\\ ]*arknights[^/]*`\"",
"abilist": "[Adb] -s [AdbSerial] shell getprop ro.product.cpu.abilist",
"abilist": "[Adb] -s [AdbSerial] shell getprop ro.product.cpu.abilist",
"orientation": "[Adb] -s [AdbSerial] shell dumpsys input | grep SurfaceOrientation | grep -m 1 -o -E [0-9]",
"pushMinitouch": "[Adb] -s [AdbSerial] push \"[minitouchLocalPath]\" \"/data/local/tmp/[minitouchWorkingFile]\"",
"chmodMinitouch": "[Adb] -s [AdbSerial] shell chmod 700 \"/data/local/tmp/[minitouchWorkingFile]\"",
@@ -199,7 +207,7 @@
"release": "[Adb] kill-server",
"start": "[Adb] -s [AdbSerial] shell am start -n [Intent]",
"stop": "[Adb] -s [AdbSerial] shell \"am force-stop `dumpsys activity activities 2>/dev/null | grep Activities= 2>/dev/null | grep -m 1 -i -o -E [^\\ ]*arknights[^/]*`\"",
"abilist": "[Adb] -s [AdbSerial] shell getprop ro.product.cpu.abilist",
"abilist": "[Adb] -s [AdbSerial] shell getprop ro.product.cpu.abilist",
"orientation": "[Adb] -s [AdbSerial] shell dumpsys input | grep SurfaceOrientation | grep -m 1 -o -E [0-9]",
"pushMinitouch": "[Adb] -s [AdbSerial] push \"[minitouchLocalPath]\" \"/data/local/tmp/[minitouchWorkingFile]\"",
"chmodMinitouch": "[Adb] -s [AdbSerial] shell chmod 700 \"/data/local/tmp/[minitouchWorkingFile]\"",
@@ -222,7 +230,7 @@
"release": "[Adb] kill-server",
"start": "[Adb] -s [AdbSerial] shell am start -n [Intent]",
"stop": "[Adb] -s [AdbSerial] shell \"am force-stop `dumpsys activity activities 2>/dev/null | grep Activities= 2>/dev/null | grep -m 1 -i -o -E [^\\ ]*arknights[^/]*`\"",
"abilist": "[Adb] -s [AdbSerial] shell getprop ro.product.cpu.abilist",
"abilist": "[Adb] -s [AdbSerial] shell getprop ro.product.cpu.abilist",
"orientation": "[Adb] -s [AdbSerial] shell dumpsys input | grep SurfaceOrientation | grep -m 1 -o -E [0-9]",
"pushMinitouch": "[Adb] -s [AdbSerial] push \"[minitouchLocalPath]\" \"/data/local/tmp/[minitouchWorkingFile]\"",
"chmodMinitouch": "[Adb] -s [AdbSerial] shell chmod 700 \"/data/local/tmp/[minitouchWorkingFile]\"",
@@ -245,11 +253,34 @@
"release": "[Adb] kill-server",
"start": "[Adb] -s [AdbSerial] shell am start -n [Intent]",
"stop": "[Adb] -s [AdbSerial] shell \"am force-stop `dumpsys activity activities 2>/dev/null | grep Activities= 2>/dev/null | grep -m 1 -i -o -E [^\\ ]*arknights[^/]*`\"",
"abilist": "[Adb] -s [AdbSerial] shell getprop ro.product.cpu.abilist",
"abilist": "[Adb] -s [AdbSerial] shell getprop ro.product.cpu.abilist",
"orientation": "[Adb] -s [AdbSerial] shell dumpsys input | grep SurfaceOrientation | grep -m 1 -o -E [0-9]",
"pushMinitouch": "[Adb] -s [AdbSerial] push \"[minitouchLocalPath]\" \"/data/local/tmp/[minitouchWorkingFile]\"",
"chmodMinitouch": "[Adb] -s [AdbSerial] shell chmod 700 \"/data/local/tmp/[minitouchWorkingFile]\"",
"callMinitouch": "[Adb] -s [AdbSerial] shell \"/data/local/tmp/[minitouchWorkingFile]\" -i"
},
"MaaTouch": {
"devices": "[Adb] devices",
"addressRegex": "(.+)\tdevice",
"connect": "[Adb] connect [AdbSerial]",
"uuid": "[Adb] -s [AdbSerial] shell settings get secure android_id",
"click": "[Adb] -s [AdbSerial] shell input tap [x] [y]",
"swipe": "[Adb] -s [AdbSerial] shell input swipe [x1] [y1] [x2] [y2] [duration]",
"display": "[Adb] -s [AdbSerial] shell dumpsys window displays | grep -o -E cur=+[^\\ ]+ | grep -o -E [0-9]+",
"displayFormat": "%d%d",
"screencapRawByNC": "[Adb] -s [AdbSerial] exec-out \"screencap | nc -w 3 [NcAddress] [NcPort]\"",
"ncAddress": "[Adb] -s [AdbSerial] shell \" cat /proc/net/arp | grep : \"",
"ncPort": 6723,
"screencapRawWithGzip": "[Adb] -s [AdbSerial] exec-out \"screencap | gzip -1\"",
"screencapEncode": "[Adb] -s [AdbSerial] exec-out screencap -p",
"release": "[Adb] kill-server",
"start": "[Adb] -s [AdbSerial] shell am start -n [Intent]",
"stop": "[Adb] -s [AdbSerial] shell \"am force-stop `dumpsys activity activities 2>/dev/null | grep Activities= 2>/dev/null | grep -m 1 -i -o -E [^\\ ]*arknights[^/]*`\"",
"abilist": "[Adb] -s [AdbSerial] shell echo maatouch",
"orientation": "[Adb] -s [AdbSerial] shell echo 0",
"pushMinitouch": "[Adb] -s [AdbSerial] push \"[minitouchLocalPath]\" \"/data/local/tmp/[minitouchWorkingFile]\"",
"chmodMinitouch": "[Adb] -s [AdbSerial] shell chmod 700 \"/data/local/tmp/[minitouchWorkingFile]\"",
"callMinitouch": "[Adb] -s [AdbSerial] shell \"export CLASSPATH=/data/local/tmp/[minitouchWorkingFile]; app_process /data/local/tmp com.shxyke.MaaTouch.App\""
}
}
}

View File

@@ -48,15 +48,17 @@ bool AsstSetUserDir(const char* path)
bool AsstLoadResource(const char* path)
{
using namespace asst::utils::path_literals;
auto os_path = asst::utils::path(path);
auto res_path = os_path / "resource"_p;
if (asst::ResDir.empty()) {
asst::ResDir.set(os_path);
asst::ResDir.set(res_path);
}
if (asst::UserDir.empty()) {
asst::UserDir.set(os_path);
}
using namespace asst::utils::path_literals;
inited = asst::ResourceLoader::get_instance().load(os_path / "resource"_p);
inited = asst::ResourceLoader::get_instance().load(res_path);
return inited;
}

View File

@@ -456,7 +456,6 @@ bool asst::Controller::call_and_hup_minitouch(const std::string& cmd)
release_minitouch(true);
Log.info(cmd);
m_minitouch_avaiable = false;
constexpr int PipeReadBuffSize = 4096ULL;
constexpr int PipeWriteBuffSize = 64 * 1024ULL;
@@ -639,7 +638,6 @@ bool asst::Controller::call_and_hup_minitouch(const std::string& cmd)
m_minitouch_props.x_scaling = static_cast<double>(m_minitouch_props.max_x) / m_width;
m_minitouch_props.y_scaling = static_cast<double>(m_minitouch_props.max_y) / m_height;
m_minitouch_avaiable = true;
return true;
}
@@ -1506,43 +1504,46 @@ bool asst::Controller::connect(const std::string& adb_path, const std::string& a
return false;
}
std::string abilist = call_command(cmd_replace(adb_cfg.abilist)).value_or("");
constexpr std::array<std::string_view, 5> OrderedABI = {
"x86_64", "x86", "arm64-v8a", "armeabi-v7a", "armeabi",
};
std::string_view optimal_abi = "armeabi-v7a";
for (const auto& abi : OrderedABI) {
if (abilist.find(abi) != std::string::npos) {
optimal_abi = abi;
break;
do {
m_minitouch_avaiable = false;
std::string abilist = call_command(cmd_replace(adb_cfg.abilist)).value_or("maatouch");
std::string_view optimal_abi;
for (const auto& abi : Configer.get_options().minitouch_programs_order) {
if (abilist.find(abi) != std::string::npos) {
optimal_abi = abi;
break;
}
}
}
Log.info("The optimal abi is", optimal_abi);
Log.info("The optimal abi is", optimal_abi);
auto minitouch_cmd_rep = [&](const std::string& cfg_cmd) -> std::string {
using namespace asst::utils::path_literals;
return utils::string_replace_all(
cmd_replace(cfg_cmd),
{
{ "[minitouchLocalPath]",
utils::path_to_utf8_string(ResDir.get() / "minitouch"_p / optimal_abi / "minitouch"_p) },
{ "[minitouchWorkingFile]", m_uuid },
});
};
auto minitouch_cmd_rep = [&](const std::string& cfg_cmd) -> std::string {
using namespace asst::utils::path_literals;
return utils::string_replace_all(
cmd_replace(cfg_cmd),
{
{ "[minitouchLocalPath]",
utils::path_to_utf8_string(ResDir.get() / "minitouch"_p / optimal_abi / "minitouch"_p) },
{ "[minitouchWorkingFile]", m_uuid },
});
};
call_command(minitouch_cmd_rep(adb_cfg.push_minitouch));
call_command(minitouch_cmd_rep(adb_cfg.chmod_minitouch));
if (!call_command(minitouch_cmd_rep(adb_cfg.push_minitouch))) break;
if (!call_command(minitouch_cmd_rep(adb_cfg.chmod_minitouch))) break;
m_adb.call_minitouch = minitouch_cmd_rep(adb_cfg.call_minitouch);
call_and_hup_minitouch(m_adb.call_minitouch);
m_adb.call_minitouch = minitouch_cmd_rep(adb_cfg.call_minitouch);
if (!call_and_hup_minitouch(m_adb.call_minitouch)) break;
std::string orientation_str = call_command(cmd_replace(adb_cfg.orientation)).value_or("0");
if (!orientation_str.empty()) {
char first = orientation_str.front();
if (first == '0' || first == '1' || first == '2' || first == '3') {
m_minitouch_props.orientation = static_cast<int>(first - '0');
std::string orientation_str = call_command(cmd_replace(adb_cfg.orientation)).value_or("0");
if (!orientation_str.empty()) {
char first = orientation_str.front();
if (first == '0' || first == '1' || first == '2' || first == '3') {
m_minitouch_props.orientation = static_cast<int>(first - '0');
}
}
}
m_minitouch_avaiable = true;
} while (false);
// try to find the fastest way
if (!screencap()) {

View File

@@ -18,6 +18,11 @@ bool asst::GeneralConfiger::parse(const json::value& json)
m_options.adb_swipe_duration_multiplier = options_json.get("adbSwipeDurationMultiplier", 10.0);
m_options.minitouch_extra_swipe_dist = options_json.get("minitouchExtraSwipeDist", 100);
m_options.minitouch_extra_swipe_duration = options_json.get("minitouchExtraSwipeDuration", -1);
if (auto order = options_json.find<json::array>("minitouchProgramsOrder")) {
for (const auto& type : *order) {
m_options.minitouch_programs_order.emplace_back(type.as_string());
}
}
m_options.penguin_report.cmd_format = options_json.get("penguinReport", "cmdFormat", std::string());
m_options.yituliu_report.cmd_format = options_json.get("yituliuReport", "cmdFormat", std::string());
m_options.depot_export_template.ark_planner =

View File

@@ -42,6 +42,7 @@ namespace asst
double adb_swipe_duration_multiplier = 0; // adb 滑动持续时间倍数
int minitouch_extra_swipe_dist = 0;
int minitouch_extra_swipe_duration = -1;
std::vector<std::string> minitouch_programs_order;
PenguinReportCfg penguin_report; // 企鹅物流汇报:
// 每次到结算界面,汇报掉落数据至企鹅物流 https://penguin-stats.cn/
DepotExportTemplate depot_export_template; // 仓库识别结果导出模板

View File

@@ -60,6 +60,7 @@
<system:String x:Key="Nox">Nox</system:String>
<system:String x:Key="XYAZ">XYAZ</system:String>
<system:String x:Key="WSA">Old version of WSA</system:String>
<system:String x:Key="MaaTouch">MaaTouch</system:String>
<system:String x:Key="Compatible">Compatible Mode</system:String>
<system:String x:Key="DormThreshold">Morale Threshold</system:String>

View File

@@ -60,6 +60,7 @@
<system:String x:Key="Nox">夜神模拟器</system:String>
<system:String x:Key="XYAZ">逍遥模拟器</system:String>
<system:String x:Key="WSA">WSA 旧版本</system:String>
<system:String x:Key="MaaTouch">MaaTouch</system:String>
<system:String x:Key="Compatible">兼容模式</system:String>
<system:String x:Key="DormThreshold">基建工作心情阈值</system:String>

View File

@@ -176,6 +176,7 @@ namespace MeoAsstGui
new CombData { Display = Localization.GetString("Nox"), Value = "Nox" },
new CombData { Display = Localization.GetString("XYAZ"), Value = "XYAZ" },
new CombData { Display = Localization.GetString("WSA"), Value = "WSA" },
new CombData { Display = Localization.GetString("MaaTouch"), Value = "MaaTouch" },
new CombData { Display = Localization.GetString("Compatible"), Value = "Compatible" },
};