diff --git a/.gitignore b/.gitignore index 96374c4..ea101d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ +# Custom ignore files +*.app +*.cia +*.zip +*.7z + # Windows image file caches Thumbs.db ehthumbs.db diff --git a/go.bat b/go.bat new file mode 100644 index 0000000..4fd7515 --- /dev/null +++ b/go.bat @@ -0,0 +1,3 @@ +@echo off +for %%x in (input\*.cia) do call tools\process.bat %%x input\hs.app +pause diff --git a/input/dummy.txt b/input/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..b288267 --- /dev/null +++ b/readme.md @@ -0,0 +1,13 @@ +**Universal Inject Generator** + + +This script will generate an inject-ready app to inject over the Health & Safety app in the 3DS console. The package includes code by @Syphurith, CTRtool (by profi200) and 3DStool (by dnasdw). + +This is how it works: +* This is used in conjunction with most recent (mine) Decrypt9's "Dump Health&Safety" and "Inject Health&Safety" features +* Put hs.app (dumped via Decrypt9) plus as many homebrew CIAs as you like into the input folder +* Run go.bat, you'll get one inject-ready .app per CIA +* If the last one for some reason doesn't work, you may try deep-decrypting (via Decrypt9) your CIAs first. +* To inject, rename inject-ready .app to hs.app, put it into the root of your 3DS SD card and inject via Decrypt9 + +You should always generate your inject-ready .apps yourself and never take ones from other persons. There might be a version mismatch in the H&S app, leading to it not working otherwise. diff --git a/tools/3dstool.exe b/tools/3dstool.exe new file mode 100644 index 0000000..8fc52aa Binary files /dev/null and b/tools/3dstool.exe differ diff --git a/tools/MergeExHeader.exe b/tools/MergeExHeader.exe new file mode 100644 index 0000000..46d93d3 Binary files /dev/null and b/tools/MergeExHeader.exe differ diff --git a/tools/ctrtool.exe b/tools/ctrtool.exe new file mode 100644 index 0000000..b294401 Binary files /dev/null and b/tools/ctrtool.exe differ diff --git a/tools/ignore_3dstool.txt b/tools/ignore_3dstool.txt new file mode 100644 index 0000000..a7a99aa --- /dev/null +++ b/tools/ignore_3dstool.txt @@ -0,0 +1 @@ +// regex: ECMAScript grammar and case insensitive diff --git a/tools/process.bat b/tools/process.bat new file mode 100644 index 0000000..1c2b55c --- /dev/null +++ b/tools/process.bat @@ -0,0 +1,49 @@ +@echo off + +echo [!] --- UNIVERSAL INJECT GENERATOR V0.3 --- +echo . +echo . + +echo. +echo [+] IDENTIFY FILES TO WORK WITH +ren work work_old +del /s /q work_old +rd /s /q work_old +del /q hs.* +md work +copy /y /v %2 work\hs.app +tools\ctrtool -x --contents work\ciacnt %1 +ren "work\ciacnt.0000.*" inject.app + +echo. +echo [+] EXTRACT HS AND INJECT APP +tools\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 +tools\3dstool -x -f work\inject.app --exh work\inject_exhdr.bin --exefs work\inject_exefs.bin +tools\3dstool -x -f work\hs_exefs.bin --exefs-dir work\hs_exefs +tools\3dstool -x -f work\inject_exefs.bin --exefs-dir work\inject_exefs + +echo. +echo [+] GENERATE NEW EXEFS +copy /y /v work\inject_exefs\code.bin work\hs_exefs\code.bin +rem copy /y /v work\inject_exefs\banner.bnr work\hs_exefs\banner.bnr +rem copy /y /v work\inject_exefs\icon.icn work\hs_exefs\icon.icn +tools\3dstool -c -z -t exefs -f work\hs_mod_exefs.bin --exefs-dir work\hs_exefs --header work\hs_exefs.bin + +echo. +echo [+] GENERATE NEW ROMFS +md work\dummy_romfs +fsutil file createnew work\dummy_romfs\dummy.bin 16 +tools\3dstool -c -t romfs -f work\dummy_romfs.bin --romfs-dir work\dummy_romfs + +echo. +echo [+] MERGE EXHEADER +tools\MergeExHeader work\inject_exhdr.bin work\hs_exhdr.bin work\merge_exhdr.bin + +echo. +echo [+] REBUILD HS INJECT APP +if exist work\hs_logo.bin (tools\3dstool -c -t cxi -f %~n1.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) else (tools\3dstool -c -t cxi -f %~n1.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) +for %%i in (work\hs.app) do set HS_ORIGINAL_SIZE=%%~zi +for %%i in (%~n1.app) do set HS_INJECT_SIZE=%%~zi +echo [*] HS APP ORIGINAL SIZE: %HS_ORIGINAL_SIZE% byte +echo [*] HS APP INJECT SIZE : %HS_INJECT_SIZE% byte +if HS_ORIGINAL_SIZE LSS HS_INJECT_SIZE (echo [!] INJECT APP IS BIGGER THAN HS APP) else (echo [+] SIZE IS OKAY!)