-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
150 lines (133 loc) · 4.27 KB
/
Copy pathbuild.sh
File metadata and controls
150 lines (133 loc) · 4.27 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/bin/bash
# Check if running interactively
if [[ ! -t 0 ]]; then
echo "This script requires an interactive terminal. Please run it directly."
exit 1
fi
# Configuration
ROOT_BUILD_DIR="$(dirname "$0")/to sdcard"
BUILD_DIR="$ROOT_BUILD_DIR/wiiu/apps/Balatro"
OUTPUT_NAME="Balatro U"
PKGS="git p7zip"
function install_deps() {
clear
echo "==============================="
echo "Installing Dependencies..."
echo "==============================="
# Detect package manager
if command -v apt-get &> /dev/null; then
PM="apt-get"
INSTALL="sudo apt-get install -y"
elif command -v dnf &> /dev/null; then
PM="dnf"
INSTALL="sudo dnf install -y"
elif command -v pacman &> /dev/null; then
PM="pacman"
INSTALL="sudo pacman -S --noconfirm"
else
echo "Unsupported package manager. Please install dependencies manually: $PKGS"
exit 1
fi
sudo $PM update -y || true
$INSTALL $PKGS
echo
echo "==============================="
echo "Dependency Installation Complete!"
echo "==============================="
echo
echo "Components that should be installed:"
echo "- Git"
echo
}
function extract() {
read -n 1 -s -r -p "Press any key to continue... (only after you copied Balatro.exe)"
clear
echo "==============================="
echo "Extracting needed files from Balatro..."
echo "==============================="
BALATRO_PATH="$(dirname "$0")/Balatro.exe"
if [[ -f "$BALATRO_PATH" ]]; then
echo "Found local Balatro.exe"
else
echo "ERROR: Balatro.exe not found!"
echo
echo "Please copy Balatro.exe to this folder."
echo
read -n 1 -s -r -p "Press any key to continue..."
return
fi
echo "Using Balatro from: \"$BALATRO_PATH\""
GAME_DIR="$(dirname "$0")/game"
if [[ ! -d "$GAME_DIR" ]]; then
echo "Creating game directory..."
mkdir "$GAME_DIR"
else
echo "Removing existing game directory..."
rm -rf "$GAME_DIR"
mkdir "$GAME_DIR"
fi
7z x "$BALATRO_PATH" -o"$GAME_DIR" -y
if [[ $? -ne 0 ]]; then
echo "ERROR: Failed to extract Balatro.exe"
echo "Make sure the file is not corrupted"
read -n 1 -s -r -p "Press any key to continue..."
return
fi
echo
echo "==============================="
echo "Extraction completed successfully!"
echo "==============================="
echo
echo "Game files extracted to: game/"
echo
}
function build() {
clear
echo "==============================="
echo "Building..."
echo "==============================="
rm -rf "$ROOT_BUILD_DIR"
rm -rf "$(dirname "$0")/temp"
echo "Build directory cleaned."
echo "Cloning Lovepotion repository..."
mkdir -p "$(dirname "$0")/temp"
cd "$(dirname "$0")/temp"
git clone https://github.com/xtomasnemec/lovepotion.git --branch 3.1.0-development --single-branch
if [[ $? -ne 0 ]]; then
echo "ERROR: Failed to clone Lovepotion repository."
echo "Make sure Git is installed and working."
read -n 1 -s -r -p "Press any key to continue..."
return
fi
cd "$(dirname "$0")"
echo "Patching the game files..."
cp -r "$(dirname "$0")/game/." "$(dirname "$0")/temp/lovepotion/game/"
cp -r "$(dirname "$0")/patch/." "$(dirname "$0")/temp/lovepotion/game/"
cd "$(dirname "$0")/temp/lovepotion"
sudo chmod +x build.sh
./build.sh
cd "$(dirname "$0")"
WUHBSRC="$(dirname "$0")/temp/lovepotion/build/balatro.wuhb"
if [[ ! -f "$WUHBSRC" ]]; then
echo "ERROR: balatro.wuhb not found in $WUHBSRC."
read -n 1 -s -r -p "Press any key to continue..."
return
fi
WUHBSIZE=$(stat -c%s "$WUHBSRC")
echo "Size of balatro.wuhb after build: $WUHBSIZE bytes"
echo "Copying built files to $BUILD_DIR..."
mkdir -p "$BUILD_DIR"
cp "$WUHBSRC" "$BUILD_DIR/"
WUHBSIZE2=$(stat -c%s "$BUILD_DIR/balatro.wuhb")
echo "Size of balatro.wuhb in $BUILD_DIR: $WUHBSIZE2 bytes"
clear
echo "==============================="
echo "Build complete!"
echo "==============================="
read -n 1 -s -r -p "Press any key to continue..."
}
# End of script
install_deps
extract
build
exit 0