aboutsummaryrefslogtreecommitdiff
path: root/project/scripts/patch-all-messages.sh
blob: 845260c2be068450d37f4a4cb556b7fc59aea1e0 (plain) (blame)
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
#!/usr/bin/env bash

#--- pre definitions: enter your local settings

# This is the directory with all message files (/Scene/UI)
SRC_UI_DIR="./ui"

# and this is the destination directory. If it is the same as the source
# than all files are replaced by the patched version.
DEST_UI_DIR="$SRC_UI_DIR"

# This is the path to the message file of above:
PATCH_FILE="bmg-patch.txt"

# Remove the the hash ('#') of the second line for fast operation.
# This makes the file about 25-30% larger but the operation is much faster 
FAST=
#FAST=--fast

#--- more automated setup

TEMP="$(mktemp -d)" || exit 1

#--- patch it in 3 steps: extract szs + patch bmg + create new szs

wszst extract --quiet "$SRC_UI_DIR/"*_?.szs --dest "$TEMP/%N.d"
wbmgt patch   --quiet "$TEMP/"*.d/message/*.bmg --patch "replace,$PATCH_FILE"
wszst create  --quiet --remove "$TEMP/"*.d --dest "$DEST_UI_DIR" $FAST

#--- clean up (remove temp dir)

rm -rf "$TEMP"