-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpubgtool
205 lines (172 loc) · 5.2 KB
/
pubgtool
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#!/usr/bin/env bash
source etc/banner
echo -e "${LIGHTRED}executing: ${LIGHTGREEN} PUBG MOBILE OBB TOOL${NOCOLOR}"
echo "----------------------------"
chmod +x etc/*.bms
if [[ -d "/sdcard/Download/PUBG_OBB" ]]; then
echo ""
else
mkdir /sdcard/Download/PUBG_OBB
fi
output_folder="/sdcard/Download/PUBG_OBB/output_folder"
output_folder="/sdcard/Download/PUBG_OBB/output_folder"
# Function to play voice messages
play_voice() {
local message=$1
mpv "$message" > /dev/null 2>&1
}
unpacking () {
qemu-i386 $PREFIX/share/quickbms/quickbms_4gb_files etc/*.bms $output_folder/$(basename "$selected_file") $output_folder
}
repacking () {
qemu-i386 $PREFIX/share/quickbms/quickbms_4gb_files -w -r etc/*.bms $selected_file /sdcard/Download/copied_dat
}
function unpack {
prompt="Please select a file to unpack:"
options=($(find /sdcard/Download/PUBG_OBB -name "*.pak" -o -name "*.obb"))
PS3="$prompt "
select opt in "${options[@]}" "Quit" ; do
if (( REPLY == 1 + ${#options[@]} )) ; then
echo "Operation canceled."
exit
elif (( REPLY > 0 && REPLY <= ${#options[@]} )) ; then
selected_file="${options[$REPLY-1]}"
echo "You picked $selected_file which is file $REPLY"
mkdir -p "$output_folder"
cp "$selected_file" "$output_folder/"
unpacking
rm -rf $output_folder
break
else
echo "Invalid option. Try another one."
fi
done
}
function repack {
prompt="Please select a file to repack:"
options=($(find /sdcard/Download/PUBG_OBB -name "*.pak" -o -name "*.obb"))
PS3="$prompt "
select opt in "${options[@]}" "Quit" ; do
if (( REPLY == 1 + ${#options[@]} )) ; then
echo "Operation canceled."
exit
elif (( REPLY > 0 && REPLY <= ${#options[@]} )) ; then
selected_file="${options[$REPLY-1]}"
echo "You picked $selected_file which is file $REPLY"
repacking
break
else
echo "Invalid option. Try another one."
fi
done
}
function Search_Text {
read -p "Enter the string to search for: " search_string
search_results=( $(grep -ril "$search_string" $output_folder) )
if [ ${#search_results[@]} -eq 0 ]; then
echo "No matching files found."
else
echo "Matching files:"
for ((i=0; i<${#search_results[@]}; i++)); do
if [ $i -eq 0 ]; then
echo -e "\e[32m$(($i+1)): $(basename "${search_results[$i]}")\e[0m"
else
echo "$(($i+1)): $(basename "${search_results[$i]}")"
fi
done
all_files_option="All"
quit_option="Quit"
copy_all_option="Copy All"
options=("Select One" "$all_files_option" "$copy_all_option" "$quit_option")
selected_files=()
while true; do
read -p "Enter file numbers to add to the selection (e.g., 2,5,6,4), 'a' to select all, or 'q' to quit: " choice
if [ "$choice" = "q" ]; then
echo "Operation canceled."
break
elif [ "$choice" = "a" ]; then
selected_files=("${search_results[@]}")
echo "All files selected."
break
else
IFS=',' read -ra file_numbers <<< "$choice"
for num in "${file_numbers[@]}"; do
if [ "$num" -ge 1 ] && [ "$num" -le ${#search_results[@]} ]; then
selected_files+=("${search_results[$((num-1))]}")
echo "File '$(basename "${search_results[$((num-1))]}")' added to selection."
else
echo "Invalid file number '$num'. Try another one."
fi
done
fi
done
if [ "${#selected_files[@]}" -eq 0 ]; then
echo "No files selected for copying."
else
echo "Selected files:"
for file in "${selected_files[@]}"; do
echo "- $(basename "$file")"
done
copied_dat="/sdcard/Download/copied_dat"
if [ ! -d "$copied_dat" ]; then
mkdir -p "$copied_dat"
echo "Created directory '$copied_dat'."
fi
read -p "Enter 'c' to copy all selected files or 'q' to quit: " copy_option
if [ "$copy_option" = "c" ]; then
for file in "${selected_files[@]}"; do
cp "$file" "$copied_dat/"
echo "File '$(basename "$file")' copied to the destination directory."
done
else
echo "Operation canceled."
fi
fi
fi
}
function Error_Fix {
if [[ -d "$output_folder" ]]; then
rm -rf "$output_folder"
else
bash bottool
fi
}
function Delete_Output {
if [[ -d "$output_folder" ]]; then
rm -rf "$output_folder"
else
bash CHEN.sh
fi
}
PS3='Please enter your choice: '
options=("Unpack" "Repack" "Search_Text" "Delete_Output" "Error_Fix" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Unpack")
play_voice "unpack.mp3"
unpack
break
;;
"Repack")
play_voice "repack.mp3"
repack
;;
"Search_Text")
play_voice "Search_Text.mp3"
Search_Text
;;
"Delete_Output")
play_voice "Delete_Output.mp3"
Delete_Output
;;
"Error_Fix")
play_voice "Error_Fix.mp3"
Error_Fix
;;
"Quit")
break
;;
*) echo "invalid option $REPLY";;
esac
done