-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathdltools.sh
More file actions
executable file
·104 lines (91 loc) · 4.89 KB
/
dltools.sh
File metadata and controls
executable file
·104 lines (91 loc) · 4.89 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
#!/usr/bin/env bash
SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
BOLD=$(tput bold)
NORMAL=$(tput sgr0)
CTRDECRYPT_VER=1.1.0
CTRTOOL_VER=1.2.0
MAKEROM_VER=0.18.4
# Darwin
if [[ "$OSTYPE" == "darwin"* ]]; then
# Ensure the dependency wget is installed
if ! command -v wget &> /dev/null; then
echo " * wget not found. Installing..."
# Check if Homebrew is installed
if ! command -v brew &> /dev/null; then
echo " * Homebrew not found. Installing Homebrew first..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add Homebrew to PATH for current session
if [[ $(uname -m) == "arm64" ]]; then
export PATH="/opt/homebrew/bin:$PATH"
else
export PATH="/usr/local/bin:$PATH"
fi
fi
# Install wget using Homebrew
brew install wget
# Verify installation
if command -v wget &> /dev/null; then
echo "wget successfully installed!"
else
echo "Error: wget installation failed"
exit 1
fi
fi
# Apple Silicon
echo " * Downloading ${BOLD}ctrdecrypt${NORMAL}"
wget "https://github.com/shijimasoft/ctrdecrypt/releases/download/v${CTRDECRYPT_VER}/ctrdecrypt-macos-universal.zip" -q
echo " * Extracting ${BOLD}ctrdecrypt${NORMAL}"
unzip -qq "ctrdecrypt-macos-universal.zip" -d "ctrdecrypt-macos-universal"
mv "ctrdecrypt-macos-universal/ctrdecrypt" "${SCRIPT_DIR}/ctrdecrypt"
if [[ $(uname -m) == 'arm64' ]]; then
echo " * Downloading ${BOLD}ctrtool${NORMAL}"
wget "https://github.com/3DSGuy/Project_CTR/releases/download/ctrtool-v${CTRTOOL_VER}/ctrtool-v${CTRTOOL_VER}-macos_arm64.zip" -q
echo " * Extracting ${BOLD}ctrtool${NORMAL}"
unzip -qq "ctrtool-v${CTRTOOL_VER}-macos_arm64.zip" -d "ctrtool-v${CTRTOOL_VER}-macos_arm64"
mv "ctrtool-v${CTRTOOL_VER}-macos_arm64/ctrtool" "${SCRIPT_DIR}/ctrtool"
echo " * Downloading ${BOLD}makerom${NORMAL}"
wget "https://github.com/3DSGuy/Project_CTR/releases/download/makerom-v${MAKEROM_VER}/makerom-v${MAKEROM_VER}-macos_arm64.zip" -q
echo " * Extracting ${BOLD}makerom${NORMAL}"
unzip -qq "makerom-v${MAKEROM_VER}-macos_arm64.zip" -d "makerom-v${MAKEROM_VER}-macos_arm64"
mv "makerom-v${MAKEROM_VER}-macos_arm64/makerom" "${SCRIPT_DIR}/makerom"
# x86_64
else
echo " * Downloading ${BOLD}ctrtool${NORMAL}"
wget "https://github.com/3DSGuy/Project_CTR/releases/download/ctrtool-v${CTRTOOL_VER}/ctrtool-v${CTRTOOL_VER}-macos_x86_64.zip" -q
echo " * Extracting ${BOLD}ctrtool${NORMAL}"
unzip -qq "ctrtool-v${CTRTOOL_VER}-macos_x86_64.zip" -d "ctrtool-v${CTRTOOL_VER}-macos_x86_64"
mv "ctrtool-v${CTRTOOL_VER}-macos_x86_64/ctrtool" "${SCRIPT_DIR}/ctrtool"
echo " * Downloading ${BOLD}makerom${NORMAL}"
wget "https://github.com/3DSGuy/Project_CTR/releases/download/makerom-v${MAKEROM_VER}/makerom-v${MAKEROM_VER}-macos_x86_64.zip" -q
echo " * Extracting ${BOLD}makerom${NORMAL}"
unzip -qq "makerom-v${MAKEROM_VER}-macos_x86_64.zip" -d "makerom-v${MAKEROM_VER}-macos_x86_64"
mv "makerom-v${MAKEROM_VER}-macos_x86_64/makerom" "${SCRIPT_DIR}/makerom"
fi
# Linux (x86_64)
elif [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "linux" ]]; then
echo " * Downloading ${BOLD}ctrdecrypt${NORMAL}"
wget "https://github.com/shijimasoft/ctrdecrypt/releases/download/v${CTRDECRYPT_VER}/ctrdecrypt-linux-x86_64.zip" -q
echo " * Extracting ${BOLD}ctrdecrypt${NORMAL}"
unzip -qq "ctrdecrypt-linux-x86_64.zip" -d "ctrdecrypt-linux-x86_64"
mv "ctrdecrypt-linux-x86_64/ctrdecrypt" "${SCRIPT_DIR}/ctrdecrypt"
echo " * Downloading ${BOLD}ctrtool${NORMAL}"
wget "https://github.com/3DSGuy/Project_CTR/releases/download/ctrtool-v${CTRTOOL_VER}/ctrtool-v${CTRTOOL_VER}-ubuntu_x86_64.zip" -q
echo " * Extracting ${BOLD}ctrtool${NORMAL}"
unzip -qq "ctrtool-v${CTRTOOL_VER}-ubuntu_x86_64.zip" -d "ctrtool-v${CTRTOOL_VER}-ubuntu_x86_64"
mv "ctrtool-v${CTRTOOL_VER}-ubuntu_x86_64/ctrtool" "${SCRIPT_DIR}/ctrtool"
echo " * Downloading ${BOLD}makerom${NORMAL}"
wget "https://github.com/3DSGuy/Project_CTR/releases/download/makerom-v${MAKEROM_VER}/makerom-v${MAKEROM_VER}-ubuntu_x86_64.zip" -q
echo " * Extracting ${BOLD}makerom${NORMAL}"
unzip -qq "makerom-v${MAKEROM_VER}-ubuntu_x86_64.zip" -d "makerom-v${MAKEROM_VER}-ubuntu_x86_64"
mv "makerom-v${MAKEROM_VER}-ubuntu_x86_64/makerom" "${SCRIPT_DIR}/makerom"
fi
if [[ ! -f "seeddb.bin" ]]; then
echo " * Downloading ${BOLD}seeddb.bin${NORMAL}"
wget "https://github.com/ihaveamac/3DS-rom-tools/raw/master/seeddb/seeddb.bin" -q
fi
echo " * Cleaning up"
rm -rf "ctrdecrypt-"*
rm -rf "ctrtool-v${CTRTOOL_VER}-"*
rm -rf "makerom-v${MAKEROM_VER}-"*
chmod +x ctrdecrypt ctrtool makerom
echo