-
Notifications
You must be signed in to change notification settings - Fork 16
/
build_saveimages.sh
executable file
·63 lines (46 loc) · 1.95 KB
/
build_saveimages.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
# build_saveimages.sh serverip <readbuf in the linermem area, such as 0x3E220000> <proc9_patchaddr> <save region for the user gamecard> <otherapp payload filename for the user gamecard>
set -e
serverip=$1
readbuf=$2
patchaddr=$3
function init_keyslots
{
3dshaxclient --serveradr=$serverip --keyslot=33 "--keyY=$1$2"fe009000000000
3dshaxclient --serveradr=$serverip --keyslot=37 "--keyY=$1$2"fe009000000000
}
function build_region
{
init_keyslots `cat accessdescsig_oot3d$1` "$3"
rm -f clientscript
for path in otherapp_payloads/otherapp/*_$2_*;
do
filename=$(basename "$path")
basefn=$(echo -n "$filename" | cut "-d." -f1)
echo "Building with payload: $filename"
savedir=saveimages/cardids_"$3"fe009000000000/$1
mkdir -p $savedir
./build_saveimage_clientcmds.sh $serverip $readbuf $savedir/$basefn.sav oot3dhax_$1.bin "$path" >> clientscript
done
echo "quit" >> clientscript
echo "Running clientscript..."
cat clientscript | 3dshaxclient --serveradr=$serverip --shell=0
}
rm -R -f saveimages
mkdir -p saveimages
rm -R -f otherapp_payloads
rm -f othrapp.zip
curl -v https://smealum.github.io/ninjhax2/otherapp.zip > otherapp.zip
unzip otherapp.zip -d otherapp_payloads
# Temporarily NOP-out the Process9 code which sets the gamecard savedata keyslots' keyY.
3dshaxclient --serveradr=$serverip "--customcmd=readmem:9 $patchaddr 0xc @tmpcode.bin"
3dshaxclient --serveradr=$serverip "--customcmd=writemem:9 $patchaddr 0xc 0x0 0x0 0x0"
build_region "usa" "U" "c2"
build_region "usa" "U" "45"
build_region "eur" "E" "c2"
build_region "eur" "E" "45"
build_region "jpn" "J" "c2"
build_region "jpn" "J" "45"
echo "Building for your own gamecard..."
init_keyslots `cat accessdescsig_oot3d$4` "c2"
./build_saveimage_clientcmds.sh $serverip $readbuf savedump_usergamecardoot3dhax.bin oot3dhax_$4.bin otherapp_payloads/otherapp/$5 | 3dshaxclient --serveradr=$serverip --shell=0
3dshaxclient --serveradr=$serverip "--customcmd=writemem:9 $patchaddr 0xc @tmpcode.bin"