From 8545732faa8a75ab6471a3b195341d9ebd6770b2 Mon Sep 17 00:00:00 2001 From: Hao Guan <10684225+hguandl@users.noreply.github.com> Date: Fri, 15 Oct 2021 02:43:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20CI=20=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ci/00-unpack_dlc.sh | 16 ++++++++++++++++ ci/01-build_fonts.sh | 31 +++++++++++++++++++++++++++++++ ci/02-repack_texts.sh | 9 +++++++++ ci/03-put_images.sh | 15 +++++++++++++++ ci/04-repack_dlc.sh | 19 +++++++++++++++++++ 5 files changed, 90 insertions(+) create mode 100755 ci/00-unpack_dlc.sh create mode 100755 ci/01-build_fonts.sh create mode 100755 ci/02-repack_texts.sh create mode 100755 ci/03-put_images.sh create mode 100755 ci/04-repack_dlc.sh diff --git a/ci/00-unpack_dlc.sh b/ci/00-unpack_dlc.sh new file mode 100755 index 0000000..dea49ae --- /dev/null +++ b/ci/00-unpack_dlc.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e -o pipefail + +BIN="./external/bin" +DLC_FILE="./external/rom/0004008C001AE200.cia" +REPACK_DIR="./build/repack" + +mkdir -p $REPACK_DIR +$BIN/ctrtool --contents=$REPACK_DIR/Content $DLC_FILE + +$BIN/3dstool -xvtf cfa $REPACK_DIR/Content.0001.00000004 --header $REPACK_DIR/Header_1_4.bin --romfs $REPACK_DIR/RomFS_1_4.bin --romfs-auto-key +$BIN/3dstool -xvtf cfa $REPACK_DIR/Content.0002.00000005 --header $REPACK_DIR/Header_2_5.bin --romfs $REPACK_DIR/RomFS_2_5.bin --romfs-auto-key + +$BIN/3dstool -xvtf romfs $REPACK_DIR/RomFS_1_4.bin --romfs-dir build/rom_1_4 +$BIN/3dstool -xvtf romfs $REPACK_DIR/RomFS_2_5.bin --romfs-dir build/rom_2_5 diff --git a/ci/01-build_fonts.sh b/ci/01-build_fonts.sh new file mode 100755 index 0000000..226e7cd --- /dev/null +++ b/ci/01-build_fonts.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +set -e -o pipefail + +FONT_DB_EXE="python3 -m dgs2utils.font_db" +GFD_EXE="python3 -m dgs2utils.gfd" + +FONT_RES_DIR="./build/font_res" +ROMFS_DIR="./build/rom_2_5" + +mkdir -p $FONT_RES_DIR +$GFD_EXE dump -o $FONT_RES_DIR $ROMFS_DIR/font/font00_jpn.gfd +$GFD_EXE dump -o $FONT_RES_DIR $ROMFS_DIR/font/font01_jpn.gfd +$GFD_EXE dump -o $FONT_RES_DIR $ROMFS_DIR/font/font02_jpn.gfd +$GFD_EXE dump -o $FONT_RES_DIR $ROMFS_DIR/font/font03_jpn.gfd + +$FONT_DB_EXE count -d ./msg_dump -o $FONT_RES_DIR/msg_text.json +$FONT_DB_EXE count -d ./script_dump -o $FONT_RES_DIR/script_text.json + +$FONT_DB_EXE merge -o $FONT_RES_DIR/font00_jpn_list.json \ + ./font_acg/font00_acg.json $FONT_RES_DIR/script_text.json +$FONT_DB_EXE merge -o $FONT_RES_DIR/font01_jpn_list.json \ + ./font_acg/font01_acg.json $FONT_RES_DIR/msg_text.json +$FONT_DB_EXE merge -o $FONT_RES_DIR/font02_jpn_list.json \ + ./font_acg/font02_acg.json $FONT_RES_DIR/msg_text.json +cp font_acg/font03_acg.json $FONT_RES_DIR/font03_jpn_list.json + +$GFD_EXE generate -i $FONT_RES_DIR -f ./external/ttf/hanyi-65s.ttf -n 00 -o $ROMFS_DIR/font +$GFD_EXE generate -i $FONT_RES_DIR -f ./external/ttf/dayasong.ttf -n 01 -o $ROMFS_DIR/font +$GFD_EXE generate -i $FONT_RES_DIR -f ./external/ttf/dayasong.ttf -n 02 -o $ROMFS_DIR/font +$GFD_EXE generate -i $FONT_RES_DIR -f ./external/ttf/SourceHanSans-Bold.otf -n 03 -o $ROMFS_DIR/font diff --git a/ci/02-repack_texts.sh b/ci/02-repack_texts.sh new file mode 100755 index 0000000..8b9f207 --- /dev/null +++ b/ci/02-repack_texts.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e -o pipefail + +GMD_EXE="python3 -m dgs2utils.gmd" +ROMFS_DIR="./build/rom_2_5" + +$GMD_EXE repack -o $ROMFS_DIR/msg ./msg_dump +$GMD_EXE repack -o $ROMFS_DIR/script ./script_dump diff --git a/ci/03-put_images.sh b/ci/03-put_images.sh new file mode 100755 index 0000000..0571ce7 --- /dev/null +++ b/ci/03-put_images.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e -o pipefail + +ROMFS1_DIR="./build/rom_1_4" +ROMFS2_DIR="./build/rom_2_5" + +cp ./pictures_tex/dlc_costumepack_BM_NOMIP_HQ.tex $ROMFS1_DIR/ + +cp ./pictures_tex/dlc_scenario00_BM_NOMIP_HQ.tex $ROMFS2_DIR/UI/tex/ +cp ./pictures_tex/dlc_scenario01_BM_NOMIP_HQ.tex $ROMFS2_DIR/UI/tex/ + +cp ./pictures_tex/EVENT8_01_01_BM_NOMIP_HQ.tex $ROMFS2_DIR/UI/evt/ +cp ./pictures_tex/EVENT8_05_01_big_BM_NOMIP_HQ.tex $ROMFS2_DIR/UI/evt/ +cp ./pictures_tex/EVENT8_05_01_BM_NOMIP_HQ.tex $ROMFS2_DIR/UI/evt/ diff --git a/ci/04-repack_dlc.sh b/ci/04-repack_dlc.sh new file mode 100755 index 0000000..2ff2f57 --- /dev/null +++ b/ci/04-repack_dlc.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e -o pipefail + +BIN="./external/bin" +REPACK_DIR="./build/repack" +OUTPUT_FILE="./build/dgs2-dlc-cn.cia" + +$BIN/3dstool -cvtf romfs $REPACK_DIR/RepackRomFS_1_4.bin --romfs-dir ./build/rom_1_4 +$BIN/3dstool -cvtf romfs $REPACK_DIR/RepackRomFS_2_5.bin --romfs-dir ./build/rom_2_5 + +$BIN/3dstool -cvtf cfa $REPACK_DIR/Repack.1.4 --header $REPACK_DIR/Header_1_4.bin --romfs $REPACK_DIR/RepackRomFS_1_4.bin --romfs-auto-key +$BIN/3dstool -cvtf cfa $REPACK_DIR/Repack.2.5 --header $REPACK_DIR/Header_2_5.bin --romfs $REPACK_DIR/RepackRomFS_2_5.bin --romfs-auto-key + +$BIN/makerom -target p -dlc -ignoresign -f cia \ + -o $OUTPUT_FILE \ + -content $REPACK_DIR/Content.0000.00000003:0:3 \ + -content $REPACK_DIR/Repack.1.4:1:4 \ + -content $REPACK_DIR/Repack.2.5:2:5