-
Notifications
You must be signed in to change notification settings - Fork 0
/
nintendoswitch.sh
65 lines (52 loc) · 1.3 KB
/
nintendoswitch.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
#!/bin/bash
modify_source_code() {
if [ ! -d "romfs" ]; then
mkdir romfs
fi
cp -rf fondid romfs
cp -rf pilt romfs
cp -rf sfx romfs
cp -rf muusika romfs
if [ ! -d "source" ]; then
mkdir source
fi
cp paastatudrukut.cpp source/paastatudrukut.cpp
sed -i 's|fondid/|romfs:/fondid/|g' source/paastatudrukut.cpp
sed -i 's|pilt/|romfs:/pilt/|g' source/paastatudrukut.cpp
sed -i 's|sfx/|romfs:/sfx/|g' source/paastatudrukut.cpp
sed -i 's|muusika/|romfs:/muusika/|g' source/paastatudrukut.cpp
}
revert_source_code() {
rm -rf failid
if [ -f source/paastatudrukut.cpp ]; then
rm source/paastatudrukut.cpp
fi
rm -rf source
}
handle_cancel() {
echo "Katkestatud, tagasi..."
if [ -f Makefile.bak ]; then
mv Makefile Makefile.NX
mv Makefile.bak Makefile
fi
revert_source_code
exit 1
}
mv -n Makefile Makefile.bak
mv -n Makefile.NX Makefile
trap handle_cancel INT TERM
modify_source_code
if ! make PLATFORM=PLATFORM_NX; then
echo "Make vigu. Tagasi..."
if [ -f Makefile.bak ]; then
mv Makefile Makefile.NX
mv Makefile.bak Makefile
fi
revert_source_code
exit 1
fi
revert_source_code
if [ -f Makefile.bak ]; then
mv Makefile Makefile.NX
mv Makefile.bak Makefile
fi