Skip to content

Commit

Permalink
添加 CI 脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
hguandl committed Oct 14, 2021
1 parent 7bd2729 commit 8545732
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ci/00-unpack_dlc.sh
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions ci/01-build_fonts.sh
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions ci/02-repack_texts.sh
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions ci/03-put_images.sh
Original file line number Diff line number Diff line change
@@ -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/
19 changes: 19 additions & 0 deletions ci/04-repack_dlc.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8545732

Please sign in to comment.