From 8a6a1e7b41661dc07b5e63adbfe035f0f53b7ace Mon Sep 17 00:00:00 2001 From: MistEO Date: Thu, 12 Jan 2023 15:16:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B0=86OCR=E6=A8=A1=E5=9E=8B=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=90=8C=E6=AD=A5=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/3342 --- src/MaaCore/Config/ResourceLoader.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/MaaCore/Config/ResourceLoader.cpp b/src/MaaCore/Config/ResourceLoader.cpp index d7b82f18d2..5406c33596 100644 --- a/src/MaaCore/Config/ResourceLoader.cpp +++ b/src/MaaCore/Config/ResourceLoader.cpp @@ -27,7 +27,6 @@ bool asst::ResourceLoader::load(const std::filesystem::path& path) auto full_path = path / Filename; \ bool ret = load_resource(full_path); \ if (!ret) { \ - m_loaded = false; \ Log.error(#Config, " load failed, path:", full_path); \ return false; \ } \ @@ -40,7 +39,6 @@ bool asst::ResourceLoader::load(const std::filesystem::path& path) auto full_templ_dir = path / TemplDir; \ bool ret = load_resource_with_templ(full_path, full_templ_dir); \ if (!ret) { \ - m_loaded = false; \ Log.error(#Config, "load failed, path:", full_path, ", templ dir:", full_templ_dir); \ return false; \ } \ @@ -73,11 +71,8 @@ bool asst::ResourceLoader::load(const std::filesystem::path& path) }); auto ocr_future = std::async(std::launch::async, [&]() -> bool { + // fastdeploy 不知道有啥问题,没法异步加载两个模型,改成同步算了 LoadResourceAndCheckRet(WordOcr, "PaddleOCR"_p); - return true; - }); - - auto ocr_char_future = std::async(std::launch::async, [&]() -> bool { LoadResourceAndCheckRet(CharOcr, "PaddleCharOCR"_p); return true; }); @@ -85,7 +80,11 @@ bool asst::ResourceLoader::load(const std::filesystem::path& path) #undef LoadTemplByConfigAndCheckRet #undef LoadResourceAndCheckRet - m_loaded = config_future.get() && tile_future.get() && ocr_future.get() && ocr_char_future.get(); + m_loaded = true; + m_loaded &= config_future.get(); + m_loaded &= tile_future.get(); + m_loaded &= ocr_future.get(); + return m_loaded; }