-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmake_release.sh
executable file
·79 lines (64 loc) · 2.07 KB
/
make_release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
set -eu
RST_ROOT=$(dirname "$0")
RELEASE_DIR=$RST_ROOT/release
VERSION=$(git describe --tags --dirty --always --long --match '*')
print_status () {
MSG=$1
BLUE='\033[0;34m'
NC='\033[0m'
echo -e "${BLUE}${MSG}${NC}"
}
# Clean up the release directory
rm -r $RELEASE_DIR || true
mkdir $RELEASE_DIR
build () {
TARGET_VERSION=$1
print_status "Building MM3D Practice Patch..."
# Copy the version-specific build files
cp $RST_ROOT/$TARGET_VERSION/*.bin $RST_ROOT/
# Touch main.cpp to get an up-to-date build time
touch $RST_ROOT/source/rst/main.cpp
# Run the patcher
Magikoopa --build --workdir $RST_ROOT/
# Copy build output
mkdir $RELEASE_DIR/$TARGET_VERSION
flips -i $RST_ROOT/bak/code.bin $RST_ROOT/code.bin $RELEASE_DIR/$TARGET_VERSION/code.ips
if [ -z ${RST_DEV+x} ]; then
flips -b $RST_ROOT/bak/code.bin $RST_ROOT/code.bin $RELEASE_DIR/$TARGET_VERSION/code.bps
fi
cp $RST_ROOT/code.bin $RST_ROOT/source/build/patched_code.bin
cp $RST_ROOT/exheader*.bin $RELEASE_DIR/$TARGET_VERSION/
# Clean up
rm -r $RST_ROOT/loader/*.bin $RST_ROOT/loader/*.sym || true
rm -r $RST_ROOT/*.bin $RST_ROOT/*.sym || true
rm -r $RST_ROOT/bak || true
}
make_patch_for_secondary_version () {
TARGET_VERSION=$1
mkdir $RELEASE_DIR/$TARGET_VERSION
cp $RELEASE_DIR/v100/exheader*.bin $RELEASE_DIR/$TARGET_VERSION/
flips -b $RST_ROOT/$TARGET_VERSION/code.bin $RST_ROOT/source/build/patched_code.bin $RELEASE_DIR/$TARGET_VERSION/code.bps
wait
}
if test -f "./v100/code.bin"; then
git submodule update --init
build v100
else
print_status "Code.bin is missing from v100. Please include to create."
fi
if [ -z ${RST_DEV+x} ]; then
mv $RELEASE_DIR/v100/exheader.bin $RELEASE_DIR/v100/exheader_citra.bin
mv $RELEASE_DIR/v100/exheader_legacy.bin $RELEASE_DIR/v100/exheader.bin
if test -f "./v101/code.bin"; then
make_patch_for_secondary_version v101 &
fi
if test -f "./v110/code.bin"; then
make_patch_for_secondary_version v110 &
fi
wait
print_status "packing"
pushd $RELEASE_DIR
7z a mm3d_practice_tools_${VERSION}.7z .
popd
fi