better unix-like support, should be able to easily be ported to any unix-like now

This commit is contained in:
dark_samus 2016-04-01 13:44:58 -04:00
parent eea6cab037
commit e5351e6d89
7 changed files with 14 additions and 25 deletions

View file

@ -2,17 +2,6 @@
clear clear
#tools
_3DSTOOL=./tools/3dstool-linux
CTRTOOL=./tools/ctrtool-linux
MERGEEXHEADER=./tools/MergeExHeader-linux
if [ "$(uname -s)" == "Darwin" ]
then
_3DSTOOL=./tools/3dstool-osx
CTRTOOL=./tools/ctrtool-osx
MERGEEXHEADER=./tools/MergeExHeader-osx
fi
printf " --- UNIVERSAL INJECT GENERATOR V0.3 ---\n" printf " --- UNIVERSAL INJECT GENERATOR V0.3 ---\n"
printf " --- LINUX EDITION --- \n\n\n" printf " --- LINUX EDITION --- \n\n\n"
@ -21,41 +10,41 @@ mv work work_old
rm -rf work_old rm -rf work_old
rm -rf hs.* rm -rf hs.*
mkdir work mkdir work
cp $2 work/hs.app cat $2 > work/hs.app
${CTRTOOL} -x --contents work/ciacnt $1 &>/dev/null ./tools/ctrtool-($uname) -x --contents work/ciacnt $1 &>/dev/null
mv work/ciacnt.0000.* work/inject.app mv work/ciacnt.0000.* work/inject.app
printf "[+] EXTRACT HS AND INJECT APP\n" printf "[+] EXTRACT HS AND INJECT APP\n"
${_3DSTOOL} -x -f work/hs.app --header work/hs_hdr.bin --exh work/hs_exhdr.bin --plain work/hs_plain.bin --logo work/hs_logo.bin --exefs work/hs_exefs.bin --romfs work/hs_romfs.bin &>/dev/null ./tools/3dstool-($uname) -x -f work/hs.app --header work/hs_hdr.bin --exh work/hs_exhdr.bin --plain work/hs_plain.bin --logo work/hs_logo.bin --exefs work/hs_exefs.bin --romfs work/hs_romfs.bin &>/dev/null
${_3DSTOOL} -x -f work/inject.app --exh work/inject_exhdr.bin --exefs work/inject_exefs.bin &>/dev/null ./tools/3dstool-($uname) -x -f work/inject.app --exh work/inject_exhdr.bin --exefs work/inject_exefs.bin &>/dev/null
${_3DSTOOL} -x -f work/hs_exefs.bin --exefs-dir work/hs_exefs &>/dev/null ./tools/3dstool-($uname) -x -f work/hs_exefs.bin --exefs-dir work/hs_exefs &>/dev/null
${_3DSTOOL} -x -f work/inject_exefs.bin --exefs-dir work/inject_exefs &>/dev/null ./tools/3dstool-($uname) -x -f work/inject_exefs.bin --exefs-dir work/inject_exefs &>/dev/null
printf "[+] GENERATE NEW EXEFS\n" printf "[+] GENERATE NEW EXEFS\n"
cp work/inject_exefs/code.bin work/hs_exefs/code.bin cp work/inject_exefs/code.bin work/hs_exefs/code.bin
${_3DSTOOL} -c -z -t exefs -f work/hs_mod_exefs.bin --exefs-dir work/hs_exefs --header work/hs_exefs.bin &>/dev/null ./tools/3dstool-($uname) -c -z -t exefs -f work/hs_mod_exefs.bin --exefs-dir work/hs_exefs --header work/hs_exefs.bin &>/dev/null
cp work/inject_exefs/banner.bnr work/hs_exefs/banner.bnr cp work/inject_exefs/banner.bnr work/hs_exefs/banner.bnr
cp work/inject_exefs/icon.icn work/hs_exefs/icon.icn cp work/inject_exefs/icon.icn work/hs_exefs/icon.icn
${_3DSTOOL} -c -z -t exefs -f work/hs_mod_banner_exefs.bin --exefs-dir work/hs_exefs --header work/hs_exefs.bin &>/dev/null ./tools/3dstool-($uname) -c -z -t exefs -f work/hs_mod_banner_exefs.bin --exefs-dir work/hs_exefs --header work/hs_exefs.bin &>/dev/null
printf "[+] GENERATE NEW ROMFS\n" printf "[+] GENERATE NEW ROMFS\n"
mkdir work/dummy_romfs mkdir work/dummy_romfs
cp tools/dummy.bin work/dummy_romfs/dummy.bin cp tools/dummy.bin work/dummy_romfs/dummy.bin
${_3DSTOOL} -c -t romfs -f work/dummy_romfs.bin --romfs-dir work/dummy_romfs &>/dev/null ./tools/3dstool-($uname) -c -t romfs -f work/dummy_romfs.bin --romfs-dir work/dummy_romfs &>/dev/null
printf "[+] MERGE EXHEADER\n" printf "[+] MERGE EXHEADER\n"
${MERGEEXHEADER} work/inject_exhdr.bin work/hs_exhdr.bin work/merge_exhdr.bin &>/dev/null ./tools/MergeExHeader-($uname) work/inject_exhdr.bin work/hs_exhdr.bin work/merge_exhdr.bin &>/dev/null
printf "[+] REBUILD HS INJECT APP\n" printf "[+] REBUILD HS INJECT APP\n"
if [ -e work/hs_logo.bin ] if [ -e work/hs_logo.bin ]
then ${_3DSTOOL} -c -t cxi -f ${1%.*}_inject_no_banner.app --header work/hs_hdr.bin --exh work/merge_exhdr.bin --plain work/hs_plain.bin --logo work/hs_logo.bin --exefs work/hs_mod_exefs.bin --romfs work/dummy_romfs.bin &>/dev/null then ./tools/3dstool-($uname) -c -t cxi -f ${1%.*}_inject_no_banner.app --header work/hs_hdr.bin --exh work/merge_exhdr.bin --plain work/hs_plain.bin --logo work/hs_logo.bin --exefs work/hs_mod_exefs.bin --romfs work/dummy_romfs.bin &>/dev/null
else ${_3DSTOOL} -c -t cxi -f ${1%.*}_inject_no_banner.app --header work/hs_hdr.bin --exh work/merge_exhdr.bin --plain work/hs_plain.bin --exefs work/hs_mod_exefs.bin --romfs work/dummy_romfs.bin &>/dev/null else ./tools/3dstool-($uname) -c -t cxi -f ${1%.*}_inject_no_banner.app --header work/hs_hdr.bin --exh work/merge_exhdr.bin --plain work/hs_plain.bin --exefs work/hs_mod_exefs.bin --romfs work/dummy_romfs.bin &>/dev/null
fi fi
if [ -e work/hs_logo.bin ] if [ -e work/hs_logo.bin ]
then ${_3DSTOOL} -c -t cxi -f ${1%.*}_inject_with_banner.app --header work/hs_hdr.bin --exh work/merge_exhdr.bin --plain work/hs_plain.bin --logo work/hs_logo.bin --exefs work/hs_mod_banner_exefs.bin --romfs work/dummy_romfs.bin &>/dev/null then ./tools/3dstool-($uname) -c -t cxi -f ${1%.*}_inject_with_banner.app --header work/hs_hdr.bin --exh work/merge_exhdr.bin --plain work/hs_plain.bin --logo work/hs_logo.bin --exefs work/hs_mod_banner_exefs.bin --romfs work/dummy_romfs.bin &>/dev/null
else ${_3DSTOOL} -c -t cxi -f ${1%.*}_inject_with_banner.app --header work/hs_hdr.bin --exh work/merge_exhdr.bin --plain work/hs_plain.bin --exefs work/hs_mod_banner_exefs.bin --romfs work/dummy_romfs.bin &>/dev/null else ./tools/3dstool-($uname) -c -t cxi -f ${1%.*}_inject_with_banner.app --header work/hs_hdr.bin --exh work/merge_exhdr.bin --plain work/hs_plain.bin --exefs work/hs_mod_banner_exefs.bin --romfs work/dummy_romfs.bin &>/dev/null
fi fi
for i in work/hs.app; do HS_ORIGINAL_SIZE=$(ls -l $i | awk '{print $5}'); done for i in work/hs.app; do HS_ORIGINAL_SIZE=$(ls -l $i | awk '{print $5}'); done