-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_build_wii_wbfs.sh
73 lines (58 loc) · 2.96 KB
/
_build_wii_wbfs.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
#!/bin/bash
# Set a variable to track whether the ARK build failed
FAILED_ARK_BUILD=0
# Set the path to wit and arkhelper and check if the script is running on macOS
if [[ $(uname -s) == "Darwin" ]]; then
echo "Running on macOS"
# macOS-specific path to wit/arkhelper executable
WIT_PATH="$(pwd)/dependencies/wit/wit_macos"
ARKHELPER_PATH="$(pwd)/dependencies/macos/arkhelper"
else
echo "Not running on macOS"
# Assume Linux or other Unix-like systems
WIT_PATH="$(pwd)/dependencies/wit/wit"
ARKHELPER_PATH="$(pwd)/dependencies/linux/arkhelper"
fi
# Extract ISO using wit
"$WIT_PATH" extract "$PWD/iso" "$PWD/_build/wii"
# Copy patched main.dol and setup.txt
cp -rf "$PWD/dependencies/patch/main.dol" "$PWD/_build/wii/sys"
cp -rf "$PWD/dependencies/patch/setup.txt" "$PWD/_build/wii"
# Copy original main_wii.hdr to appropriate directory
cp "$PWD/dependencies/wii_rebuild_file/main_wii.hdr" "$PWD/_build/wii/files/gen"
# Remove lrb ultimate ark part
rm "$PWD/_build/wii/files/gen/main_wii_2.ark" 2> /dev/null
# Move the folder "songs_wii" into "_ark" and rename it to "songs"
echo "Temporarily moving Wii songs folder into ark"
mv "$PWD/_songs/songs_wii" "$PWD/_ark/songs"
# Temporarily move Xbox and Wii files out of the ARK path to reduce final ARK size
#echo
#echo "Temporarily moving Xbox and PS3 files out of the ark path to reduce final ARK size"
#find "$PWD/_ark" \( -name "*.milo_xbox" -o -name "*.png_xbox" -o -name "*.bmp_xbox" -o -name "*.milo_ps3" -o -name "*.png_ps3" -o -name "*.bmp_ps3" \) -exec mv -t "$PWD/_temp/_ark" {} +
# Create patched files using arkhelper
"$ARKHELPER_PATH" patchcreator "$PWD/_build/wii/files/gen/main_wii.hdr" "$PWD/dependencies/patch/main.dol" -a "$PWD/_ark" -o "$PWD/_build/wii/files/gen/temp"
if [ $? -ne 0 ]; then
FAILED_ARK_BUILD=1
fi
# Move/delete patchcreator files
mv "$PWD/_build/wii/files/gen/temp/gen/main_wii.hdr" "$PWD/_build/wii/files/gen/main_wii.hdr"
mv "$PWD/_build/wii/files/gen/temp/gen/main_wii_2.ark" "$PWD/_build/wii/files/gen/main_wii_2.ark"
rm -r "$PWD/_build/wii/files/gen/temp"
# Moving back Xbox files
#echo
#echo "Moving back Xbox files"
#find "$PWD/_temp/_ark" \( -name "*.milo_xbox" -o -name "*.png_xbox" -o -name "*.bmp_xbox" -o -name "*.milo_ps3" -o -name "*.png_ps3" -o -name "*.bmp_ps3" \) -exec mv -t "$PWD/_ark" {} + 2> /dev/null
# Move the folder "songs" back to the original directory and rename it to "songs_wii"
echo "Moving back Wii song folder"
mv "$PWD/_ark/songs" "$PWD/_songs/songs_wii"
# Extract ISO using wit
"$WIT_PATH" copy "$PWD/_build/wii" "$PWD/iso/TBRB Ultimate.wbfs"
# Check if the ARK build failed and provide appropriate message
echo
if [ "$FAILED_ARK_BUILD" -ne 1 ]; then
echo "Successfully built LEGO Rock Band Ultimate files. A wbfs file has been generate in the iso folder"
else
echo "Error building ARK. Download the repo again or some dta file is bad p.s turn echo on to see what arkhelper says"
fi
# Pause to keep terminal open
read -p "Press Enter to continue..."