Hacking Patching region-free directly into Home Menu (arm9loaderhax or EmuNAND only)

ihaveahax

Well-Known Member
OP
Member
Joined
Apr 20, 2015
Messages
6,070
Trophies
2
XP
7,852
Country
United States
Some custom firmwares such as AuReiNand now have region-free built into them, so you should use that instead if you just care about playing out-of-region games.

This could still be useful if you wanted to extract and rebuild Home Menu (or any system title) though. :)
This should go without saying, but using a patched Home Menu or NS will only work if using EmuNAND or arm9loaderhax with SysNAND. If you do this and install the modified Home Menu/NS to SysNAND without arm9loaderhax, you will brick.

Some might wait for a custom firmware to have this built in, some might want the Home Menu itself to do this. I like having this because it's more like actual custom firmware (loading pre-patched code into memory), but to each their own :P

And finally, this isn't really my work. The patch for Home Menu and NS is taken from Free multi Patcher, @daxtsu and I found out we could rebuild a Home Menu/NS CIA with these included.

Free multi Patcher searches for some bytes in memory when you try to use its region-free patch. Well, these bytes exist with Home Menu and NS system-module code.bin. If you can figure out how to rebuild a CIA (without doing 3DS -> CIA, unless that's possible for system titles?), then you can put these directly into the code.

Home Menu needs to be patched to show out-of-region icons, NS only needs to for out-of-region game cards due to the update partition. If you are only using out-of-region CIAs, you don't need to patch NS.

The exact bytes to patch are here:
https://github.com/hartmannaf/Free-...7ec2e99eedb07213/source/patches.cpp#L158-L186

The offsets for these change depending on region and version. For instance, here's 10.6.0-31U Home Menu:
BFZUyRN.png
For the Home Menu, 16 bytes need to be replaced. FMP only replaces 8, so the extra 8 are all 00.
Code:
normal:  00 00 55 E3 01 10 A0 E3 11 00 A0 E1 03 00 00 0A
patched: 01 00 A0 E3 70 80 BD E8 00 00 00 00 00 00 00 00
NS only needs 4 bytes to be replaced with 4. This appears in the code twice, at least with 10.0 - 10.3.
Code:
normal:  0C 18 E1 D8
patched: 0B 18 21 C8
I can't give a full tutorial on how to rebuild the CIA, however if you know how to use 3dstool and things, this might help you get started. Please back up your Sys/EmuNAND before you mess with important system titles.

Decrypt the original CIA first with Decrypt9 (Game Decryptor Options -> CIA Decryptor (deep)).

Once the CIA has been created, encrypt NCCH using Decrypt9 before installing, or it won't boot (Game Decryptor Options -> CIA Encryptor (NCCH)).
Code:
# extract CIA contents
ctrtool --contents=contents 0004003000008F02.cia

# extract CXI contents - the content ID (00000083) changes depending on region and version
3dstool -xvtf cxi contents.0000.00000083 --header ncch.header --exh exheader.bin --exefs exefs.bin --romfs romfs.bin --plain plain.bin

# extract ExeFS contents and header
3dstool -xvtf exefs exefs.bin --exefs-dir exefs --header exefs.header

# decompress code
3dstool -uvf exefs/code.bin --compress-type blz --compress-out code-orig.bin

# copy "code-orig.bin" to "code-patched.bin" and patch here

# re-compress code
3dstool -zvf code-patched.bin --compress-type blz --compress-out exefs/code.bin

# re-create ExeFS
3dstool -cvtf exefs exefs2.bin --exefs-dir exefs --header exefs.header

# re-create CXI
3dstool -cvtf cxi patched.cxi --header ncch.header --exh exheader.bin --exefs exefs2.bin --romfs romfs.bin --plain plain.bin

# re-create CIA
makerom -f cia -o HomeMenu-U-10.6-patched-noncch.cia -content patched.cxi:0 -ver 45000
# "ver" can be hex or an integer. you can change this without rebuilding by changing the two bytes at offset 0x2F9C of the CIA file
(Thanks to this post for helping with extracting and rebuilding the CXI)

Here's the video I made showing it off with normal ReiNand:
 
Last edited by ihaveahax,

ihaveahax

Well-Known Member
OP
Member
Joined
Apr 20, 2015
Messages
6,070
Trophies
2
XP
7,852
Country
United States
I suspect there will be patched home menu cias on that iso site in no time!
I plan on setting up a system so I can quickly extract, patch, and rebuild the CIAs if they ever get updates again, so... :P
So I suspect the CFW will include this soon anyway, but this would've been done after every Emunand update, right?
if you change the version of the CIA, it will resist Nintendo updates.
 

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
So I suspect the CFW will include this soon anyway, but this would've been done after every Emunand update, right?

It would have to be done on every update that updates Home Menu and NS, but like @ihaveamac said, if you change the version numbers to something really high (like 0xAA00) they won't be changed. However, I don't recommend doing that personally, at least for NS, because while NATIVE_FIRM will happily load an old Home Menu, I'm not entirely sure what'll happen if you have it trying to load an [eventually] really old NS module.
 

lefthandsword

Well-Known Member
Member
Joined
Apr 6, 2015
Messages
352
Trophies
0
Age
26
Location
root
XP
478
Country
Hong Kong
I experimented with this idea earlier but I gave up after bricking my 3DS multiple times by botching NS:https://gbatemp.net/threads/help-with-repacking-system-cias.416706/

(I also broke a JPN emunand beyond repair by trying to patch ngword, it won't update or install the clean CIA so I had to reformat it :/)

I'm not asking for credits but I'm happy someone has finally caught on
 
Last edited by lefthandsword,

ihaveahax

Well-Known Member
OP
Member
Joined
Apr 20, 2015
Messages
6,070
Trophies
2
XP
7,852
Country
United States

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BigOnYa @ BigOnYa:
    Biomutant looks cool tho, may have to try that
  • Quincy @ Quincy:
    Usually when such a big title leaks the Temp will be the first to report about it (going off of historical reports here, Pokemon SV being the latest one I can recall seeing pop up here)
  • K3Nv2 @ K3Nv2:
    I still like how a freaking mp3 file hacks webos all that security defeated by text yet again
  • BigOnYa @ BigOnYa:
    They have simulators for everything nowdays, cray cray. How about a sim that shows you playing the Switch.
  • K3Nv2 @ K3Nv2:
    That's called yuzu
    +1
  • BigOnYa @ BigOnYa:
    I want a 120hz 4k tv but crazy how more expensive the 120hz over the 60hz are. Or even more crazy is the price of 8k's.
  • K3Nv2 @ K3Nv2:
    No real point since movies are 30fps
  • BigOnYa @ BigOnYa:
    Not a big movie buff, more of a gamer tbh. And Series X is 120hz 8k ready, but yea only 120hz 4k games out right now, but thinking of in the future.
  • K3Nv2 @ K3Nv2:
    Mostly why you never see TV manufacturers going post 60hz
  • BigOnYa @ BigOnYa:
    I only watch tv when i goto bed, it puts me to sleep, and I have a nas drive filled w my fav shows so i can watch them in order, commercial free. I usually watch Married w Children, or South Park
  • K3Nv2 @ K3Nv2:
    Stremio ruined my need for nas
  • BigOnYa @ BigOnYa:
    I stream from Nas to firestick, one on every tv, and use Kodi. I'm happy w it, plays everything. (I pirate/torrent shows/movies on pc, and put on nas)
  • K3Nv2 @ K3Nv2:
    Kodi repost are still pretty popular
  • BigOnYa @ BigOnYa:
    What the hell is Kodi reposts? what do you mean, or "Wut?" -xdqwerty
  • K3Nv2 @ K3Nv2:
    Google them basically web crawlers to movie sites
  • BigOnYa @ BigOnYa:
    oh you mean the 3rd party apps on Kodi, yea i know what you mean, yea there are still a few cool ones, in fact watched the new planet of the apes movie other night w wifey thru one, was good pic surprisingly, not a cam
  • BigOnYa @ BigOnYa:
    Damn, only $2.06 and free shipping. Gotta cost more for them to ship than $2.06
  • BigOnYa @ BigOnYa:
    I got my Dad a firestick for Xmas and showed him those 3rd party sites on Kodi, he loves it, all he watches anymore. He said he has got 3 letters from AT&T already about pirating, but he says f them, let them shut my internet off (He wants out of his AT&T contract anyways)
  • K3Nv2 @ K3Nv2:
    That's where stremio comes to play never got a letter about it
  • BigOnYa @ BigOnYa:
    I just use a VPN, even give him my login and password so can use it also, and he refuses, he's funny.
  • BigOnYa @ BigOnYa:
    I had to find and get him an old style flip phone even without text, cause thats what he wanted. No text, no internet, only phone calls. Old, old school.
    K3Nv2 @ K3Nv2: @BigOnYa...