From cb4d9c43e346579d2d20cc6a0a7dbd4f443ee74f Mon Sep 17 00:00:00 2001 From: zzyyyl Date: Mon, 15 Jul 2024 21:21:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E7=89=B9=E5=AE=9A?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=E6=A3=80=E6=9F=A5=E5=88=B0=20roi=20?= =?UTF-8?q?=E4=B8=BA=E5=85=A8=E5=B1=8F=E7=9A=84=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit perf: 对隐式全屏 roi 检测加点注释 --- src/MaaCore/Config/TaskData.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/MaaCore/Config/TaskData.cpp b/src/MaaCore/Config/TaskData.cpp index 1f5b9331e9..20169d3f2f 100644 --- a/src/MaaCore/Config/TaskData.cpp +++ b/src/MaaCore/Config/TaskData.cpp @@ -416,6 +416,16 @@ asst::TaskPtr asst::TaskData::generate_task_info(std::string_view name) #undef ASST_TASKDATA_GET_VALUE_OR_LAZY #ifdef ASST_DEBUG + if (!json.contains("roi") && base == default_task_info_ptr // 无 base 任务 + && algorithm != asst::AlgorithmType::JustReturn // 非 JustReturn + && !task->next.empty() // 有 next + && (algorithm != asst::AlgorithmType::MatchTemplate // template 不是 empty + || std::dynamic_pointer_cast(task)->templ_names + != std::vector { "empty.png" })) { + // 符合上述条件时,我们认为此时的隐式全屏 roi 不是期望行为,给个警告 + Log.warn("Task", name, "has implicit fullscreen roi."); + } + // Debug 模式下检查 roi 是否超出边界 if (auto [x, y, w, h] = task->roi; x + w > WindowWidthDefault || y + h > WindowHeightDefault) { Log.warn(name, "roi is out of bounds");