[Release] Inject any app into Health & Safety (O3DS/N3DS/CFW only)

Discussion in '3DS - Homebrew Development and Emulators' started by d0k3, Nov 6, 2015.

  1. d0k3
    OP

    d0k3 3DS Homebrew Legend

    Member
    2,604
    2,627
    Dec 3, 2004
    Gambia, The
    A lot of people know that problem - you just setup a brand new EmuNAND, just to notice, moments later, that you forgot about installing a CIA manager. Now you're out of luck, and the only choice you've got left is setting up your SysNAND (via PastaCFW / ReiNAND Sys / rxTools dev) with a CIA manager and formatting your EmuNAND anew. Don't fret, cause this thread contains the solution.

    Thanks to the work of @Syphurith, @Shadowtrance, @dark_samus3 and mself, we can now comfortably inject any homebrew app into the Health & Safety app. That does not only include FBI and DevMenu (which would be obvious choices), but in fact anything you can think off.


    What you will need:
    • A N3DS or O3DS on or below FW 9.2.
    • A CFW (rxMode, ReiNAND, CakesFW, PastaCFW) already set up (I won't help with that). Injected apps don't work without CFW.
    • Some way to run Decrypt9 on your 3DS plus the most recent version of Decrypt9WIP.
    • The most recent copy of the Universal Inject Generator, extracted to some place of your choice on your Windows / Linux PC. Alternatively, use the GUI written by @Shadowtrance.

    How to use it:
    1. Dump hs.app from either SysNAND or EmuNAND using Decrypt9 "Dump Health & Safety" feature. It's in "SysNAND File Options" or "EmuNAND File Options". Decrypt9 needs to be run from SysNAND.
    2. Get hs.app from the root of your 3DS SD card and put it plus as many homebrew CIAs as you like into the "input" folder of the Universal Inject Generator.
    3. Run go.bat, you'll get two inject-ready apps per CIA.
    4. If the last one for some reason doesn't work, you may try deep-decrypting (via Decrypt9, "Game Decrypt Options") your CIAs first. Then go back to step 2.
    5. To inject, copy the inject-ready .app files into the root of your 3DS SD card and inject via Decrypt9. The feature is also found in "SysNAND File Options" or "EmuNAND File Options", but stay with the NAND you used for dumping!
    6. That's it!

    Limitations of this:
    • Inject apps can not be bigger than the original H&S app. It is possible that this will not work for some homebrew. For a workaround, keep reading.
    • Obviously, the injected app will only show up when signatures are patched. Without signature patches, f.e. in SysNAND, you'll simply see nothing at all.
    • Won't work with commercial stuff (ie roms). You're free to try, of course, but to be honest I don't see much use in having games replace your H&S app ;).
    • You need to generate your inject apps yourself to prevent incompatibilities. Don't take ones from other persons if you can avoid it.

    C# rewrite with GUI:
    For all the command line illiterates, @Shadowtrance rewrote this in C# with a nice GUI. Get his release from here.
    [​IMG]



    Is this safe?

    The only critical feature is the injector itself. It (as well as all other file injector features in Decrypt9) is designed so that it will never touch anything but the space of the file to inject. For Health & Safety, the worst that can happen (if you do something wrong) is that Health & Safety vanishes from your menu, and that is still totally fixable (most likely, even for people who are too lazy to do backups). I still won't take any responsibility if anything breaks and advice you to do backups. You're on your own.


    Injecting apps larger than H&S

    Try @Syphuriths script. That one doesn't need Decrypt9, relies on xorpads and the user doing the inject himself via EmuNAND tools, 3DSFAT16tool and OSFmount. Needless to say, not for noobs, and you will have to do the reading on that yourselves.


    Credits
     
    Last edited by d0k3, Apr 1, 2016


  2. MsMidnight

    MsMidnight part time fe modder

    Member
    1,753
    1,308
    Oct 12, 2015
    kys
    good to see it released :)
     
  3. •Citrus•

    •Citrus• Advanced Member

    Newcomer
    54
    38
    Oct 14, 2015
    United States
    Amazing!
     
  4. dark_samus3

    dark_samus3 GBAtemp Addict

    Member
    2,314
    1,712
    May 30, 2015
    United States
    In the script it seems to check the size at the end and warn the user that it is bigger than the original why is that? I'm guessing it has to do with decrypt9's feature to not have to fully decrypt and then reencrypt the whole NAND image... Anyways thanks for such a useful tool and the openness that we never got from rxTools and Riku's injection tool, this will make things so much easier :)
     
    Subtle Demise likes this.
  5. Dean_

    Dean_ GBAtemp Advanced Fan

    Member
    651
    374
    Sep 11, 2014
    To prevent fragmentation or something I guess.
     
  6. dark_samus3

    dark_samus3 GBAtemp Addict

    Member
    2,314
    1,712
    May 30, 2015
    United States
    Ah, yeah that would make sense
     
  7. d0k3
    OP

    d0k3 3DS Homebrew Legend

    Member
    2,604
    2,627
    Dec 3, 2004
    Gambia, The
    Exactly that. Fragmentation may have unexpected side effects (an untouched SysNAND is never fragmented). Decrypt9 even checks for fragmentation before injecting and will stop if it detects something. Plus, I would never touch the CTRNAND FAT table in Decrypt9, not even utilizing something like FatFS. You accidentially turn it off during the process of reencryption, or even I missed something when coding it, and what would happen? You'd be left with a bricked NAND, that's what. Too dangerous, so this will only support apps smaller than the original H&S app.

    On a sidenote - each and every feature in Decrypt9 is developed with that principle of "touch only what is absolutely needed" in mind. A lot of stuff would actually have been so much easier without that prinicple, but I understand that not everyone has a hardmod (even I do not) and for many a brick would have dire consequences. And, so that this doesn't stay unmentioned... of course the last responsibilty is always with the users. There are multiple safetly locks in place, but it is possible to brick your 3DS with Decrypt9, after all. Carefully read the information that you are given. Have backups. If you are unsure about something, just stop.
     
    Last edited by d0k3, Nov 6, 2015
  8. peteruk

    peteruk GBAtemp Maniac

    Member
    1,399
    638
    Jun 26, 2015
    @d0k3

    Thanks this is awesome to finally be able to inject something like FBI or Devmenu into H&S on N3DS

    For me though is very difficult to follow, i failed at the first step, as soon as i pressed on Decrypt9 i got a black screen
     
  9. Dean_

    Dean_ GBAtemp Advanced Fan

    Member
    651
    374
    Sep 11, 2014
    Did you put the files in the right folders?
    sd:/Decrypt9WIP.bin
    sd:/3ds/Decrypt9WIP/~~.3dsx and ~~.smdh
     
    peteruk likes this.
  10. peteruk

    peteruk GBAtemp Maniac

    Member
    1,399
    638
    Jun 26, 2015

    No lol :(

    I missed this one sd:/Decrypt9WIP.bin

    thanks for the heads up, i will try again later, fingers crossed :)
     
  11. Shadowtrance

    Shadowtrance GBAtemp Addict

    Member
    2,482
    1,515
    May 9, 2014
    Hervey Bay, Queensland
    The .bin file isn't needed.
    And sometimes you WILL get a black screen when trying to load it, just the nature of the loader it runs on. It isn't perfect and can fail to load properly sometimes. :)
    If that happens, just restart and try again. :)
     
    peteruk likes this.
  12. peteruk

    peteruk GBAtemp Maniac

    Member
    1,399
    638
    Jun 26, 2015
    Thanks, i re downloaded all the decrypt9 files, will have a go this evening when kids have settled, thanks @Shadowtrance :)
     
  13. peteruk

    peteruk GBAtemp Maniac

    Member
    1,399
    638
    Jun 26, 2015
    Ok quick update

    I persisted, using the guide above, followed it step by step and can confirm it worked 100%

    I used it on emuNAND because i am always too afraid to mess with sysNAND, but wish to feedback to the creator's that it worked 100% on N3DS EURO 9.0 / 9.5 emu

    Thanks for this awesome guide !!
     
    dark_samus3 and d0k3 like this.
  14. SmellyPirateMonkey

    SmellyPirateMonkey GBAtemp Fan

    Member
    397
    110
    Sep 18, 2015
    United States
    Neat! Will be trying this out soon
    Thank you for your work
     
  15. camicortes

    camicortes Chochos

    Newcomer
    21
    0
    Sep 20, 2006
    Cote d'Ivoire
    Concepción, Chile
    Hey guys, I get the following error while trying to inject FBI:

    https://www.dropbox.com/s/6gcw60l1ieqtp5v/InjectError.PNG?dl=0

    If I try to run the go.bat as administrator it says it hasn't found the hs.app (it's inside the input folder).

    It generated two FBI apps either way, none of which work when I inject them back to the emunand (if I try to open the H&S App, an error occurs and the 3ds prompts me to reboot it).

    Any help with this?
     
  16. dark_samus3

    dark_samus3 GBAtemp Addict

    Member
    2,314
    1,712
    May 30, 2015
    United States
    Hmm interesting, I'll send you a PM in a bit regarding a fix
     
  17. Shadowtrance

    Shadowtrance GBAtemp Addict

    Member
    2,482
    1,515
    May 9, 2014
    Hervey Bay, Queensland
    You shouldn't need to run it as admin (bat files / cmd) don't usually like that...

    And @dark_samus3 if you're going to help someone, help everyone by posting it here instead of PM's. :P (unless it can't be said out here in the open i guess :) )
     
  18. d0k3
    OP

    d0k3 3DS Homebrew Legend

    Member
    2,604
    2,627
    Dec 3, 2004
    Gambia, The
    Well, my spanish is a bit rusty, but it looks like the fsutil tool is asking for administrative privileges. In fact, that tool is not required (with a workaround). I'll have a fix in a minute...

    @camicortes can you redownload from Github and try again?
     
    Last edited by d0k3, Nov 9, 2015
  19. dark_samus3

    dark_samus3 GBAtemp Addict

    Member
    2,314
    1,712
    May 30, 2015
    United States
    It was more of a I'll have you test a fix real quick and then post it for public knowledge after I know it works
     
  20. Shadowtrance

    Shadowtrance GBAtemp Addict

    Member
    2,482
    1,515
    May 9, 2014
    Hervey Bay, Queensland
    Fair enough :)