decrypt9 - alternative or official source for Ninjhax (on N3DS)?

Discussion in '3DS - Flashcards & Custom Firmwares' started by d0k3, May 12, 2015.

  1. d0k3
    OP

    d0k3 3DS Homebrew Legend

    Member
    2,663
    2,670
    Dec 3, 2004
    Gambia, The
    EDIT: The solution is found, just look here. Thanks to everyone involved in this thread!

    I'm in search of a working build of decrypt9 for Ninjhax to be used on my N3DS. None of the supposedly working decrypt9 builds I've found in several places over the web so far work. The typical error is that instead of several XORpads, only one file ("s") is created. And no, it's not about about a bad ncchinfo.bin, an old version of the Python script or missing slot0x25keyx.bin (do I even need that?).

    The official (to my knowledge) source for decrypt 9 is here, but that will only work on O3DS. So, can anyone help? And maybe there are also working alternatives for decrypt9 for Ninjhax / N3DS?
     
    Margen67 likes this.
  2. Neptune

    Neptune GBAtemp Advanced Maniac

    Member
    1,588
    533
    Dec 7, 2003
    United States
    Internet
    slot0x25KeyX.bin isn't required on 7.x+ systems. It *was* required so it could decrypt newer stuff but if you are on new firmware the new keys are already loaded anyway.
     
    Margen67 likes this.
  3. Shadowtrance

    Shadowtrance GBAtemp Addict

    Member
    2,488
    1,517
    May 9, 2014
    Hervey Bay, Queensland
    You are correct, that is the "official" source for it and it works on both old and new 3ds as well.

    Attached my working copy (updated it yesterday). Let me know how it goes. :)
     

    Attached Files:

    Margen67 and d0k3 like this.
  4. otto888

    otto888 I break things for a living.

    Member
    312
    42
    Mar 12, 2008
    United States
    I had the same issue earlier. Here is an odd fix to try.
    Open Decrypt9 and choose titlekey gen or whatever its called. It'll fail. Go back to HOME and run D9 again, and pick the correct option. Make sure the "s" file is deleted before trying this. It may just work by trying again, but it worked for me, either by this method or just pure luck.
     
    Margen67 and d0k3 like this.
  5. d0k3
    OP

    d0k3 3DS Homebrew Legend

    Member
    2,663
    2,670
    Dec 3, 2004
    Gambia, The
    That looks and works much better than anything that I have downloaded before (even quits using the START button), but it still generates only an "s" file, and that's for a ncchinfo.bin that was correctly processed on GW (O3DS) by someone else. Is this your project? If so, I could send the ncchinfo.bin via PM for you to have a look at. I could also try generating the NCCHinfo.bin anew using the included script (the one used for this was the most recent from the official source).

    Also (minor issue, and not a new one): the content of the top screen is neither deleted nor scrolled when the bottom is reached. Newer status messages are just written over older ones, making it badly readable.


    Good to know, but... Taking into account how long the decryption takes on a N3DS with Ninjhax, this is not an acceptable solution for someone who wants to regularly generate XORpads. You also never know when it worked, except if you exit Ninjhax, and use some of the available options to look at the N3DS file system. And that will in turn make the process even more lengthy and needs manual interaction, too.
     
    Margen67 likes this.
  6. Shadowtrance

    Shadowtrance GBAtemp Addict

    Member
    2,488
    1,517
    May 9, 2014
    Hervey Bay, Queensland
    No it's not my project. And as for it working better than others it's probably because it's run with Brahma rather than bootstrap which i've personally found more reliable.

    As for the "s" file thing... did you try using the ncchinfo_gen.py in the scripts folder of the download i shared? Because that one works for me whereas the one in source doesn't for some strange reason, but i tried every version i could find on my hard drive and that one works.

    As for the other issues like text not scrolling etc, out of my control as I'm no coder so i wouldn't know how to fix it anyway. haha But yeah it does glitch out like that sometimes.
     
    Margen67 likes this.
  7. Pacman`

    Pacman` GBAtemp Fan

    Member
    486
    140
    Dec 19, 2006
    Hi,

    I tried your ncchinfo_gen.py script and it gives me the same ncchinfo.bin that I got from the converter.

    He needs to find another 9.0 N3DS and try it on there.
     
    Margen67 likes this.
  8. RednaxelaNnamtra

    RednaxelaNnamtra GBAtemp Advanced Fan

    Member
    750
    638
    Dec 8, 2011
    Germany
    did you tried to simply rename the "s" file, maybe its usable :)
     
    Margen67 likes this.
  9. Apache Thunder

    Apache Thunder I have cameras in your head!

    Member
    4,122
    4,074
    Oct 7, 2007
    United States
    Levelland, Texas
    The "s" file is because you did not generate a correct ncchinfo.bin file. You need to use the newer python script of it as the way the file stores the file names was changed. Perhaps the included python script for Decrypt9 is outdated. Did you try using the one included with rxTools? (yes rxTools doesn't work on n3DS, but it also includes the python scripts for generating the info files which will also work on n3DS).

    I know for a fact the ones from rxTools works for me because I did not get "s" files anymore after using it.

    Also as for the s file it self. It's the last xorpad that was generated. So sure it could be useful if you happen to know what the last xorpad was for (usually the romfs for most games, but most likely it will be the xorpad for the manual romfs or update partition romfs). So in most instances the s file will be useless. Better to get the issue fixed. ;)
     
    Margen67 likes this.
  10. Pacman`

    Pacman` GBAtemp Fan

    Member
    486
    140
    Dec 19, 2006
    Trust me, Shadowtrance's ncchinfo_gen.py script works. You can see all the xorpad names clearly if you try to read the resulting ncchinfo.bin file.
    It shows something like /000400000F700100.Main.exheader.xorpad

    The older script (for 4.xx), shows something like s d m c : / 0 0 0 4 0 0 0 0 0 F 7 0 0 1 0 0 . M a i n . e x h e a d e r . x o r p a d in UNICODE
     
    Margen67 likes this.
  11. d0k3
    OP

    d0k3 3DS Homebrew Legend

    Member
    2,663
    2,670
    Dec 3, 2004
    Gambia, The
    We're nearing the solution here. The output from the script included in ShadowTrances Archive is in ASCII format (or something else with 8 bit / letter). The output from the script included in RXtools is UNICODE format (16 bit / letter). I checked it in a Hexeditor. And no, I think the newer script is in Unicode, not the older one. At least the version from the official decrypt9 download is in Unicode. I think ShadowTrances version of decrypt9 (for Ninjhax) is only compatible with the ASCII format ncchinfo.bin, as are all versions I had so far. So, ApacheThunder, are you using a different version of decrypt9 for Ninjhax? And, ShadowTrance, what is the source of your decrypt9 archive, i.e. where did you get it from?

    BTW: I have always used the scripts from either the official download or the one included in RXtool for extracting ncchinfo.bin.
     
    Margen67 likes this.
  12. Pacman`

    Pacman` GBAtemp Fan

    Member
    486
    140
    Dec 19, 2006
    By older script, I meant the one used for 4.xx OLD 3DS.
    It uses # 112 bytes Output file name in UTF-16 (format used: "/titleId.partitionName.sectionName.xorpad")

    The newer script (for 9.x 3DS) uses # 112 bytes Output file name in UTF-8 (format used: "/titleId.partitionName.sectionName.xorpad")

    So, one uses UTF-16 and the other uses UTF-8.

    The two scripts are identical except for the initial part of def genOutName(titleId, partitionName, sectionName)

    Older:
    def genOutName(titleId, partitionName, sectionName):
    outName = b'sdmc:/%s.%s.%s.xorpad' % (titleId, partitionName, sectionName)
    outName = outName.encode('utf-16le') + b'\x00\x00'
    ...

    Newer:
    def genOutName(titleId, partitionName, sectionName):
    outName = b'/%s.%s.%s.xorpad' % (titleId, partitionName, sectionName)
    ...

    Have you tried using the ncchinfo.bin generated by ShadowTrance's ncchinfo_gen.py. It would be using UTF-8 which would work with his Decrypt9.
    You just need to try it.
     
    Margen67 likes this.
  13. d0k3
    OP

    d0k3 3DS Homebrew Legend

    Member
    2,663
    2,670
    Dec 3, 2004
    Gambia, The
    Yes I have, and I even got proper XORpad names, but it generated only two files whereas it should have generated 116. Duh. Maybe it's due to me only having 1GB free, I don't know. Still, maybe Apache Thunder has a different version of decrypt9.
     
    Margen67 likes this.
  14. Pacman`

    Pacman` GBAtemp Fan

    Member
    486
    140
    Dec 19, 2006
    Try with a bigger memory card then.
    It should only generate 7 xorpads.

    What do you mean by 116 files?
     
    Margen67 likes this.
  15. d0k3
    OP

    d0k3 3DS Homebrew Legend

    Member
    2,663
    2,670
    Dec 3, 2004
    Gambia, The
    CIA to CHMM conversion, I tried to convert one of the bigger theme packs, so that's where all these files come from. I think ShadowTrances decrypt9 (or decrypt9 for Ninjhax in general) might have some trouble with that.
     
    Margen67 likes this.
  16. Pacman`

    Pacman` GBAtemp Fan

    Member
    486
    140
    Dec 19, 2006
    Ok but why don't you divide and conquer?
    Start getting the xorpads first
    Then try creating a working cia
    Then do your CIA to CHMM conversion, whatever that means

    I'm only trying to help, don't wish to be rude or anything
    Good luck
     
    Margen67 likes this.
  17. d0k3
    OP

    d0k3 3DS Homebrew Legend

    Member
    2,663
    2,670
    Dec 3, 2004
    Gambia, The
    CIA to CHMM conversion means converting the themes from a themepack .CIA to CHMM compatible format (that also means region free themes, plus themes being installable via Ninjhax). In the process you extract data and generate XORpads from a .CIA file (not from a .3DS file, as usual). However, my main interest now is to find a reliable method of XORpad generation (from ncchinfo.bin) on the N3DS without GW. I suspect that the version of decrypt9 for Ninjhax we have is based off old code, and therefore not compatible with everything. Also, there might be a newer version, but I don't know where to look :glare:. I'm still interested in what Apache Thunder and Shadowtrance have to say about my discovery.
     
    Margen67 likes this.
  18. Shadowtrance

    Shadowtrance GBAtemp Addict

    Member
    2,488
    1,517
    May 9, 2014
    Hervey Bay, Queensland
    The decrypt9.bin in my archive is compiled by myself from the latest "bootstrap" branch source paired with Brahma. The ncchinfo_gen.py is from a copy of decrypt9 i have on my hdd from back in march. Although it appears to match the latest in decrypt9 source except for the very first line at the top (i have both python 2.7 and 3.4 so its set to use 2.7).
    For it to work with cia to chmm conversion part of line 230 in the script in my archive has to be changed otherwise you will get 2 xorpads (or however many) like you did.

    So for normal xorpad generation line 230 should be:
    outName = b'/%s.%s.%s.xorpad' % (titleId, partitionName, sectionName)

    And for cia to chmm theme conversion line 230 should be:
    outName = b'/%s.%s.%s.xorpad' % (fh.name, partitionName, sectionName)

    So only the bold part changes.

    And also it doesn't seem to like generation the ncchinfo.bin via drag n drop with it set to the 2nd option above, rather you have to do it via command line ncchinfo_gen.py out.* and it should work.
     
    d0k3 likes this.
  19. d0k3
    OP

    d0k3 3DS Homebrew Legend

    Member
    2,663
    2,670
    Dec 3, 2004
    Gambia, The
    Thank you! I've compared both sources, master and bootstrap using WinMerge. The actual changes between the two are pretty small - they are mainly about the drawing code (these changes most likely fix the bad output on the top screen) and a few memory adresses are different in the machine code files ( -> the actual difference between the master and bootstrap version). There's nothing about UTF8 vs UTF16 in there, so I suspect the difference must either be in the way you compile it or in the way GCC handles 3DSX compilation.

    You're right - the only difference is in the very first line. And you say we basically need two different scripts for extraction of ncchinfo.bin from .CIA and .3DS, right? Duh...


    Anyways, after I have now taken a look at the sources I'll try to fix the drawing system / implement the more recent changes to the bootstrap version. That won't fix the UTF8 / UTF16 problem, though.
     
  20. d0k3
    OP

    d0k3 3DS Homebrew Legend

    Member
    2,663
    2,670
    Dec 3, 2004
    Gambia, The
    If you still have it, could you possibly provide us with your source code? Maybe you made some changes to the makefile, plus you had to get Brahma in there somehow. I'm still trying to figure out how to setup the build environmen.