Skip to content

Commit

Permalink
Release v5.5.0-beta.2 (MaaAssistantArknights#9938)
Browse files Browse the repository at this point in the history
  • Loading branch information
ABA2396 authored Jul 27, 2024
2 parents ad4f69e + 1820aa9 commit abd0641
Show file tree
Hide file tree
Showing 13 changed files with 310 additions and 243 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,10 @@ jobs:
p12-file-base64: ${{ secrets.HGUANDL_SIGN_CERT_P12 }}
p12-password: ${{ secrets.HGUANDL_SIGN_CERT_PASSWD }}

- name: Setup Xcode Toolchain
run: |
sudo xcode-select -s /Applications/Xcode_15.0.1.app/Contents/Developer
- name: Build Universal Binaries
run: |
mkdir build
Expand Down
59 changes: 40 additions & 19 deletions .github/workflows/optimize-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ on:
required: false

jobs:
check-and-optimize-png:
optimize-png:
# Skip workflow to prevent double consecutive runs
if: ${{ github.event.head_commit.author.email != '41898282+github-actions[bot]@users.noreply.github.com' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -30,9 +32,32 @@ jobs:
show-progress: false
persist-credentials: false

- name: Run optimization script
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Cache Python packages
id: cache_python
if: always()
uses: actions/cache@v4
with:
path: ${{ env.pythonLocation }}/lib/python3.11/site-packages
key: ${{ runner.os }}-pip-optimize-templates-${{ hashFiles('./tools/OptimizeTemplates/requirements.txt') }}

- name: Install dependencies
if: steps.cache_python.outputs.cache-hit != 'true'
run: |
pip install -r tools/OptimizeTemplates/requirements.txt
- name: Setup oxipng
uses: baptiste0928/cargo-install@v3
with:
crate: oxipng

- name: Run optimize_templates
run: |
python3 optimize-templates.py
python3 tools/OptimizeTemplates/optimize_templates.py
- name: Commit changes
id: commit_changes
Expand All @@ -42,25 +67,21 @@ jobs:
git add .
$commit_msg = "${{ github.event.inputs.commit_message }}"
if (-not [string]::IsNullOrWhiteSpace($commit_msg)) {
$commit_msg = $commit_msg.Trim()
} else {
$commit_msg = "chore: Auto Templates Optimization"
}
git commit -m "$commit_msg" -m "[skip changelog]"
if ($LASTEXITCODE -eq 0) {
Write-Output "have_commits=True" >> $env:GITHUB_OUTPUT
}
git pull origin $(git rev-parse --abbrev-ref HEAD) --unshallow --rebase
- name: Cancelling
if: steps.commit_changes.outputs.have_commits != 'True'
uses: andymckay/cancel-action@0.5
if git diff-index --quiet HEAD --; then
echo "No changes to commit"
else
commit_msg="${{ github.event.inputs.commit_message }}"
if [ -z "$commit_msg" ]; then
commit_msg="chore: Auto Templates Optimization"
fi
git commit -m "$commit_msg" -m "[skip changelog]"
git pull origin $(git rev-parse --abbrev-ref HEAD) --unshallow --rebase
echo "have_commits=True" >> $GITHUB_OUTPUT
fi
- name: Push changes
if: steps.commit_changes.outputs.have_commits == 'True'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.MAA_RESOURCE_SYNC }}
branch: ${{ github.ref }}
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

### 修复 | Fix

* 修复萨卡兹肉鸽去伪存真印象重建后卡死 @zzyyyl
* fix zip filename encoding issue @horror-proton
* 完成制造通知弹出时,无法正确识别到所有宿舍 @ABA2396
* 尝试修复萨卡兹肉鸽刷新节点次数耗尽卡死的问题 @zzyyyl
* 修复印象加深后卡住的问题 @zzyyyl
Expand Down Expand Up @@ -67,9 +69,11 @@
* 添加 adb-lite 说明 @Rbqwow
* KR 添加 MAA 格式化要求说明 @HX3N
* 添加 MAA 格式化要求说明 @SherkeyXD
* fix docsearch base @SherkeyXD

### 其他 | Other

* top operator unrecognized recruitment @Constrat
* 修正文档网页右上角search组件本地化显示问题 (#9804) @sevmeowple
* switch downloading artifact order @Constrat
* 修复 methods 为空时直接崩溃的问题 @zzyyyl
Expand Down Expand Up @@ -136,6 +140,11 @@

### For Developers

* macOS CI Xcode版本 @hguandl
* 修复 StrategyChange 时 next 丢失的问题 @zzyyyl
* 更新 DebugTask 方便模板匹配测试 @zzyyyl
* add requirements.txt for optimize-templates.py @Constrat
* optimize templates perf and fixes @Constrat
* clang-format 格式修改 (#9586) @zzyyyl
* 使用 pre-commit-ci 来格式化与压缩文件 (#9732) @SherkeyXD
* 简单处理 DEBUG 的时候 OCR 很卡的问题 @zzyyyl
Expand Down
6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
"private": true,
"devDependencies": {
"@vuepress/bundler-vite": "2.0.0-rc.14",
"@vuepress/plugin-docsearch": "2.0.0-rc.38",
"@vuepress/plugin-docsearch": "2.0.0-rc.40",
"@vuepress/plugin-google-analytics": "2.0.0-rc.37",
"@vuepress/plugin-shiki": "^2.0.0-rc.39",
"@vuepress/plugin-shiki": "^2.0.0-rc.40",
"markdown-it": "^14.1.0",
"markdown-it-anchor": "^9.0.1",
"vue": "^3.4.33",
"vuepress": "2.0.0-rc.14",
"vuepress-theme-hope": "2.0.0-rc.51"
"vuepress-theme-hope": "2.0.0-rc.52"
},
"scripts": {
"dev": "vuepress dev .",
Expand Down
2 changes: 1 addition & 1 deletion resource/global/YoStarEN/resource/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@
"RecruitTags": {
"ocrReplace": [
["Starter", "新手"],
["Top Operator", "高级资深干员"],
["Top Operato.?", "高级资深干员"],
["Senior Operato.?", "资深干员"],
["Melee", "近战位"],
["Ranged", "远程位"],
Expand Down
9 changes: 5 additions & 4 deletions resource/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6872,13 +6872,13 @@
]
},
"Roguelike@StrategyChange": {
"baseTask": "Roguelike@StrategyChange_default",
"next": ["Roguelike@Stages"]
"baseTask": "Roguelike@StrategyChange_default"
},
"Roguelike@StrategyChange_default": {
"algorithm": "OcrDetect",
"text": ["_SKIP_"],
"roi": [593, 0, 186, 129]
"roi": [593, 0, 186, 129],
"next": ["Roguelike@Stages"]
},
"Roguelike@StrategyChange_mode0": {
"baseTask": "Roguelike@StrategyChange_default"
Expand Down Expand Up @@ -9317,7 +9317,8 @@
"next": [
"Sarkaz@Roguelike@StageTraderEnter",
"Sarkaz@Roguelike@StageFilterTruthEnter",
"Sarkaz@Roguelike@StageSafeHouseEnter"
"Sarkaz@Roguelike@StageSafeHouseEnter",
"Sarkaz@Roguelike@StageCanReconstructClose"
]
},
"Sarkaz@Roguelike@StageCanReconstructConfirm": {
Expand Down
Binary file added resource/template/debug_test_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 14 additions & 30 deletions src/MaaCore/Task/Interface/DebugTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,43 +76,27 @@ void asst::DebugTask::test_battle_image()

void asst::DebugTask::test_match_template()
{
cv::Mat image = asst::imread(utils::path("../../test/match_template/1.png"));
cv::Mat resized;
cv::resize(image, resized, cv::Size(1280, 720), 0, 0, cv::INTER_AREA);

{
auto test_task = [](const std::string& path, const std::string& task_name) {
cv::Mat image = imread(utils::path(path));
cv::Mat resized;
cv::resize(image, resized, cv::Size(1280, 720), 0, 0, cv::INTER_AREA);
Matcher match_analyzer(resized, Rect(0, 0, 1280, 720));
const auto& task_ptr = Task.get("Sarkaz@Roguelike@StageSafeHouseEnter");
const auto& task_ptr = Task.get(task_name);
const auto match_task_ptr = std::dynamic_pointer_cast<MatchTaskInfo>(task_ptr);
match_analyzer.set_task_info(match_task_ptr);
const auto& result_opt = match_analyzer.analyze();
if (result_opt) {
const auto& result = result_opt.value().to_string();
Log.info(__FUNCTION__, result);
Log.info(path, task_name, result);
}
}

{
Matcher match_analyzer(resized, Rect(0, 0, 1280, 720));
const auto& task_ptr = Task.get("Sarkaz@Roguelike@StageBoskyPassageEnter");
const auto match_task_ptr = std::dynamic_pointer_cast<MatchTaskInfo>(task_ptr);
match_analyzer.set_task_info(match_task_ptr);
const auto& result_opt = match_analyzer.analyze();
if (result_opt) {
const auto& result = result_opt.value().to_string();
Log.info(__FUNCTION__, result);
else {
Log.info(path, task_name, "inactive");
}
}
};

{
Matcher match_analyzer(resized, Rect(0, 0, 1280, 720));
const auto& task_ptr = Task.get("Sarkaz@Roguelike@StageCombatDpsEnter");
const auto match_task_ptr = std::dynamic_pointer_cast<MatchTaskInfo>(task_ptr);
match_analyzer.set_task_info(match_task_ptr);
const auto& result_opt = match_analyzer.analyze();
if (result_opt) {
const auto& result = result_opt.value().to_string();
Log.info(__FUNCTION__, result);
}
}
test_task("../../test/dist/1.png", "Sarkaz@Roguelike@StageCombatDps");
test_task("../../test/dist/2.png", "Sarkaz@Roguelike@StageCombatDps");
test_task("../../test/dist/3.png", "Sarkaz@Roguelike@StageCombatDps");

test_task("../../test/dist/2024-07-27_00-58-36-429_raw.png", "Sarkaz@Roguelike@StageCombatDps");
}
2 changes: 1 addition & 1 deletion tools/OTAPacker/ziplist.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -e

zipinfo -O GB2312 -v $1 \
zipinfo -O utf8 -v $1 \
| sed -n -e '/^Central directory entry/,+3p' -e '/32-bit CRC value (hex):/p' | grep '^ ' \
| sed -e 's/^ //g' | sed -z 's/\n32-bit CRC value (hex):\s*/\t/g' \
| awk '{last = $NF; $NF=""; print last,$0}'
2 changes: 1 addition & 1 deletion tools/OTAPacker/zipota.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ tmpdir=$(mktemp -d /tmp/zipota-files.XXX)
comm -23 <(echo "$from_fn") <(echo "$to_fn") > "$tmpdir"/removelist.txt
echo "$to_fn" > "$tmpdir"/filelist.txt

zip -r -j "$out_zip" "$tmpdir"/removelist.txt "$tmpdir"/filelist.txt
zip -X -r -j "$out_zip" "$tmpdir"/removelist.txt "$tmpdir"/filelist.txt

rm -rf $tmpdir
4 changes: 3 additions & 1 deletion tools/OptimizeTemplates/optimize_templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -2568,5 +2568,7 @@
"official/Sarkaz@Roguelike@StageRefresh": "332bb67afc54e63fcfafc4182e00b419de87b692d17d95de895c6e339cebdc07",
"official/Sarkaz@Roguelike@StageRefreshConfirm": "4a01239d427cbba5ec5b7f3df23c0af987f50620d3fda2143563e68c665e5133",
"official/Sarkaz@Roguelike@StageRefreshNoThought": "d63bc4ad27433c0cd12bf0c6a521694116f0b3806175b8b1c38ddb10d4cf336f",
"official/Sarkaz@Roguelike@StageRefreshUpperLimit": "c1fc9a8f2c6ccbced2266af63d21716f52778d5e483044e15542013646272eb1"
"official/Sarkaz@Roguelike@StageRefreshUpperLimit": "c1fc9a8f2c6ccbced2266af63d21716f52778d5e483044e15542013646272eb1",
"docs/en-us/readme/Captain_Falcon": "80bad0702f82a8d3af618321534f5ab42733e550153166c4f5cbeb9f896b744b",
"official/debug_test_image": "80bad0702f82a8d3af618321534f5ab42733e550153166c4f5cbeb9f896b744b"
}
3 changes: 3 additions & 0 deletions tools/OptimizeTemplates/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tqdm
numpy
pillow
Loading

0 comments on commit abd0641

Please sign in to comment.