Homebrew Official [Release] EmuNAND9 - Open Source EmuNAND Formatter & Manager

  • Thread starter d0k3
  • Start date
  • Views 228,768
  • Replies 961
  • Likes 87

d0k3

3DS Homebrew Legend
OP
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
Well, it finally happened, I used EmuNAND9 to remove an emuNAND partition by formatting the SD card before I remembered to back the emuNAND up. Currently running TestDisk in an attempt to recovery the partition table and restore it. Analyzing another SD card that was still setup with emuNAND shows it as a Bootable Primary FAT16 partition starting at sector 32, so that's what I'm hoping to find. Stupid me, wish me luck. I'll report if I managed to do it or not.
Sooo... what you did is using the standard format when you actually wanted one of the EmuNAND format options? Despite the, like, 5 warnings and confirmations you get? :) Anyways, I'll help you. There is an easier way than what you are doing now. Background info first: What happened here in more technical terms is that while formatting, the MBR (first 512 bytes) was rewritten, and there is a FAT header and table written at offset 4MB. The data overwritten by FAT header & table is destroyed, luckily there is only the TWLN partition there, which you can easily swap out with a valid one (from SysNAND, f.e.) with Decrypt9WIP or GodMode9. So, no biggie.

Here's what you do:
  1. (optional) I recommend making an image of your SD card first and to backup that on PC. At least for the first 2GB of it.
  2. Now, use EmuNAND9 with the format SD... for EmuNAND (legacy option)
  3. Try to boot that EmuNAND, most likely it will work
  4. (optional) repair that TWLN partition using Decrypt9WIP / GodMode9
Also take note, that the partition type with newer versions of EmuNAND9 is 0x1C (don't remember exactly what that was).
 
  • Like
Reactions: Doopl

DocKlokMan

Plugin Dev
Member
Joined
Apr 20, 2007
Messages
3,009
Trophies
2
Age
36
XP
4,571
Country
United States
Sooo... what you did is using the standard format when you actually wanted one of the EmuNAND format options? Despite the, like, 5 warnings and confirmations you get? :) Anyways, I'll help you. There is an easier way than what you are doing now. Background info first: What happened here in more technical terms is that while formatting, the MBR (first 512 bytes) was rewritten, and there is a FAT header and table written at offset 4MB. The data overwritten by FAT header & table is destroyed, luckily there is only the TWLN partition there, which you can easily swap out with a valid one (from SysNAND, f.e.) with Decrypt9WIP or GodMode9. So, no biggie.

Here's what you do:
  1. (optional) I recommend making an image of your SD card first and to backup that on PC. At least for the first 2GB of it.
  2. Now, use EmuNAND9 with the format SD... for EmuNAND (legacy option)
  3. Try to boot that EmuNAND, most likely it will work
  4. (optional) repair that TWLN partition using Decrypt9WIP / GodMode9
Also take note, that the partition type with newer versions of EmuNAND9 is 0x1C (don't remember exactly what that was).
Holy crud, you blessed me just in the knick of time, I was going to call it quits. I made this emuNAND a long time ago back when the partition ID was 0x0C, FAT16 LBA. Would simply using emuNAND9 Format SD... for EmuNAND (legacy) just repair the MBR and my emuNAND's old partition would be intact?

Also, yes, I blew through the warnings, I knew what it was doing but realized too late that I just hadn't made the back up like I thought I did. Took me about 4 seconds after confirming the format to realize.

Lastly, when emuNAND9 finishes formatting it takes an emuNAND9 folder, would that have overwritten anything?
 

d0k3

3DS Homebrew Legend
OP
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
Holy crud, you blessed me just in the knick of time, I was going to call it quits. I made this emuNAND a long time ago back when the partition ID was 0x0C, FAT16 LBA. Would simply using emuNAND9 Format SD... for EmuNAND (legacy) just repair the MBR and my emuNAND's old partition would be intact?

Also, yes, I blew through the warnings, I knew what it was doing but realized too late that I just hadn't made the back up like I thought I did. Took me about 4 seconds after confirming the format to realize.

Lastly, when emuNAND9 finishes formatting it takes an emuNAND9 folder, would that have overwritten anything?
The format (legacy) option will (1) restore the MBR to a state where the EmuNAND can be recognized again and (2) do an actual format, but beyond the limits of the previous EmuNAND. And yes, EmuNAND9 will also write some data, but again, only TWLN (~first 140MB of the NAND) is affected, and that is easily repaired.
 
  • Like
Reactions: Doopl

DocKlokMan

Plugin Dev
Member
Joined
Apr 20, 2007
Messages
3,009
Trophies
2
Age
36
XP
4,571
Country
United States
The format (legacy) option will (1) restore the MBR to a state where the EmuNAND can be recognized again and (2) do an actual format, but beyond the limits of the previous EmuNAND. And yes, EmuNAND9 will also write some data, but again, only TWLN (~first 140MB of the NAND) is affected, and that is easily repaired.
Alright, making a forensic clone of my card just in case. Will try this and report back. You are the most helpful of the 3DS devs and I appreciate that you help us with our little fuck ups.
 

DocKlokMan

Plugin Dev
Member
Joined
Apr 20, 2007
Messages
3,009
Trophies
2
Age
36
XP
4,571
Country
United States
The format (legacy) option will (1) restore the MBR to a state where the EmuNAND can be recognized again and (2) do an actual format, but beyond the limits of the previous EmuNAND. And yes, EmuNAND9 will also write some data, but again, only TWLN (~first 140MB of the NAND) is affected, and that is easily repaired.
Well, it was worth a try. Thanks very much for the help. I attempted formatting both with the Legacy Option and the Default Option but on either one any attempts to access, dump, or inject files into the emuNAND results in a failure which I'm assuming means it cannot be read. I may try with an older version of emuNAND9 just to see if the partition type makes any difference.
 
Last edited by DocKlokMan,

d0k3

3DS Homebrew Legend
OP
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
Well, it was worth a try. Thanks very much for the help. I attempted formatting both with the Legacy Option and the Default Option but on either one any attempts to access, dump, or inject files into the emuNAND results in a failure which I'm assuming means it cannot be read. I may try with an older version of emuNAND9 just to see if the partition type makes any difference.
You may have overwitten critical data with something. What you could still try in that state is dump the EmuNAND via EmuNAND9 and use the CTRNAND XORpad (Decrypt9) and FAT16Tool (my C rewrite) to extract the CTRNAND partition from that. Then mount it via OSFMount on PC and see if there are any filesystem errors.
 

DocKlokMan

Plugin Dev
Member
Joined
Apr 20, 2007
Messages
3,009
Trophies
2
Age
36
XP
4,571
Country
United States
You may have overwitten critical data with something. What you could still try in that state is dump the EmuNAND via EmuNAND9 and use the CTRNAND XORpad (Decrypt9) and FAT16Tool (my C rewrite) to extract the CTRNAND partition from that. Then mount it via OSFMount on PC and see if there are any filesystem errors.
I'm waiting for my image to finish cloning back to the card but will try what you mention. I did not write or delete anything on the card after using emuNAND9 to format it. Hopefully I'll get lucky. Would the most important thing be the CTRNAND? Would I be able to just inject the CTRNAND partition into a newly created emuNAND?
 

DocKlokMan

Plugin Dev
Member
Joined
Apr 20, 2007
Messages
3,009
Trophies
2
Age
36
XP
4,571
Country
United States
You may have overwitten critical data with something. What you could still try in that state is dump the EmuNAND via EmuNAND9 and use the CTRNAND XORpad (Decrypt9) and FAT16Tool (my C rewrite) to extract the CTRNAND partition from that. Then mount it via OSFMount on PC and see if there are any filesystem errors.
I'm in! I managed to get the emuNAND.fat16.bin to mount and can explore the contents of the CTRNAND. I have access to the moveable.sed, ticket.db and title.db.

This is great, at the very least I should be able to use the movable.sed to decrypt the saves on the SD card, correct?
 
Last edited by DocKlokMan,

d0k3

3DS Homebrew Legend
OP
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
I'm in! I managed to get the emuNAND.fat16.bin to mount and can explore the contents of the CTRNAND. I have access to the moveable.sed, ticket.db and title.db.

This is great, at the very least I should be able to use the movable.sed to decrypt the saves on the SD card, correct?
Correct. And, if there seems to be nothing wrong with CTRNAND, I really wonder why it should not work. You could try injecting that CTRNAND into a known wroking NAND backup of the same FW version, then try running it as EmuNAND again.
 

d0k3

3DS Homebrew Legend
OP
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
Here's a new release, this is new:
  • Simplified menu, when formatting you can now decide about autosetup at a later point
  • Updated starter.bin with most recent versions of all tools
  • Some minor improvements to on-screen output.
  • Improved readme file
The main difference vs the previous release is in the menu structure. You are now given the choice to use starter.bin (if it exists) for autosetup while formating and you don't have to make that choice from the menu anymore.
 
  • Like
Reactions: klear

DocKlokMan

Plugin Dev
Member
Joined
Apr 20, 2007
Messages
3,009
Trophies
2
Age
36
XP
4,571
Country
United States
Correct. And, if there seems to be nothing wrong with CTRNAND, I really wonder why it should not work. You could try injecting that CTRNAND into a known wroking NAND backup of the same FW version, then try running it as EmuNAND again.
This did it. I injected the CTRNAND partition into a fresh sysNAND dump and I was able to recover everything. I got some errors while doing the restore while preserving A9LH:

Code:
FIRM0 section2 hash mismatch
FIRM0 is corrupt (non critical)

But it restored fine and booted right up. Turns out I injected a 10.6 CTRNAND into a 10.7 sysNAND (could have SWORN the emuNAND was updated) but it still worked and updated okay. I can't thank you enough. I never would have found this solution without your guidance and explanations. I have a new appreciation to the safe guards, complexity and sheer work you've put into your tools and understanding the 3DS. I will be sure to pass this knowledge along in the event anyone else makes a similar mistake.
 
  • Like
Reactions: d0k3

d0k3

3DS Homebrew Legend
OP
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
This did it. I injected the CTRNAND partition into a fresh sysNAND dump and I was able to recover everything. I got some errors while doing the restore while preserving A9LH:

Code:
FIRM0 section2 hash mismatch
FIRM0 is corrupt (non critical)

But it restored fine and booted right up. Turns out I injected a 10.6 CTRNAND into a 10.7 sysNAND (could have SWORN the emuNAND was updated) but it still worked and updated okay. I can't thank you enough. I never would have found this solution without your guidance and explanations. I have a new appreciation to the safe guards, complexity and sheer work you've put into your tools and understanding the 3DS. I will be sure to pass this knowledge along in the event anyone else makes a similar mistake.
That error message is no problem. This comes from A9LH, which (intentionally) partially corrupts your FIRM.
 

ihaveahax

Well-Known Member
Member
Joined
Apr 20, 2015
Messages
6,069
Trophies
2
XP
7,830
Country
United States
I noticed the OP had some outdated screenshots, so I decided to take some newer ones, if you want to use them. :)

thanks for this tool, it's really good
 

Attachments

  • snap000.png
    snap000.png
    4.6 KB · Views: 33,118
  • snap001.png
    snap001.png
    4.6 KB · Views: 33,909
  • snap002.png
    snap002.png
    4.9 KB · Views: 32,625

Dennet1212

New Member
Newbie
Joined
Apr 14, 2016
Messages
1
Trophies
0
Age
28
XP
51
Country
United States
I don't know if I should post this here but if I have emunand on another sd can I use it with another 3ds where I didn't make the emunand from?
 

NicKFree

Well-Known Member
Newcomer
Joined
Mar 10, 2016
Messages
48
Trophies
0
Age
33
XP
90
Country
Cuba
Sorry the n00b question, but I have a9lh sysNAND Updated, and I want to set up an Emunand, should I go with complete emuNAND setup?
 

jerrmy12

Well-Known Member
Member
Joined
Apr 8, 2016
Messages
240
Trophies
0
XP
108
Country
United States
Sorry the n00b question, but I have a9lh sysNAND Updated, and I want to set up an Emunand, should I go with complete emuNAND setup?
Yes, backup your sd first
Then backup your sysnand and sd, then use tinyformat to format sysnand, or emunand, i'd go with emunand format if you plan on using sysnsnand
 
Last edited by jerrmy12,
  • Like
Reactions: NicKFree

4gionz

Well-Known Member
Member
Joined
Aug 16, 2014
Messages
793
Trophies
0
Age
33
XP
488
Country
Canada
Will emunand9ui ever be updated to use with a9lh? I use decrypt9ui and it boots no problem but emunand9ui doesn't work. I personally like the terminal looking theme but when I set up a9lh on other peoples 3ds I like to give them ui versions for obvious reasons. Thanks again for this tool btw it's great
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: It's a shame some people's cake always resort to the same taste