ROM Hack [Tutorial] How to Decrypt, Extract & Rebuild 3DS|CIA|CXI Files

  • Thread starter Asia81
  • Start date
  • Views 1,443,620
  • Replies 1,736
  • Likes 96

How is my english?

  • So bad...

    Votes: 67 7.3%
  • Good, sometimes it's not understandable

    Votes: 139 15.2%
  • Very understandable

    Votes: 551 60.1%
  • Perfect?

    Votes: 160 17.4%

  • Total voters
    917

ubergeek77

Post editing world champ.
Member
Joined
Dec 6, 2014
Messages
584
Trophies
0
XP
607
Country
United States
What game are you trying to edit ?
bad rsf i'm very sure
It's Story of Seasons (USA). I didn't make a custom RSF, but I used an RSF generated by another tool. I'll try making a custom one and see if that works. Thanks for the tip.
 

ubergeek77

Post editing world champ.
Member
Joined
Dec 6, 2014
Messages
584
Trophies
0
XP
607
Country
United States
MAJOR EDIT:
I finally got it working! :yaynds:
Here is the RSF I used:
Code:
BasicInfo:
  Title                   : "STORYOFS"
  CompanyCode             : "00"
  ProductCode             : "CTR-P-BTSE"
  ContentType             : Application
  Logo                    : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem

TitleInfo:
  UniqueId                : 0x1421
  Category                : Application
  
CardInfo:
  MediaSize               : 1GB # 128MB / 256MB / 512MB / 1GB / 2GB / 4GB
  MediaType               : Card1 # Card1 / Card2
  CardDevice              : NorFlash # NorFlash(if you use savedata and Card1) / None (for Card2)


Option:
  UseOnSD                 : false # true if App is to be installed to SD #CHANGE ME
  EnableCompress          : true # Compresses exefs code #CHANGE ME
  FreeProductCode         : true # Removes limitations on ProductCode #CHANGE ME
  EnableCrypt             : true # Enables encryption for NCCH and CIA #CHANGE ME
  MediaFootPadding        : true # If true CCI files are created with padding #CHANGE ME

ExeFs: # these are the program segments from the ELF, check your elf for the appropriate segment names
  ReadOnly: 
   - .rodata
   - RO
  ReadWrite: 
   - .data
   - RO
  Text: 
   - .init
   - .text
   - STUP_ENTRY
   
PlainRegion: # only used with SDK ELFs 
 - .module_id
   
AccessControlInfo:
  ExtSaveDataId: 0x00001421
  SystemSaveDataId1: 0x00000000
  SystemSaveDataId2: 0x00000000
  OtherUserSaveDataId1: 0x00000
  OtherUserSaveDataId2: 0x00000
  OtherUserSaveDataId3: 0x00000
  #UseOtherVariationSaveData : true
  #UseExtendedSaveDataAccessControl: true
  #AccessibleSaveDataIds: [0x101, 0x202, 0x303, 0x404, 0x505, 0x606]
  FileSystemAccess:
   #- Boss
   #- CardBoard
   #- CategoryFileSystemTool
   #- CategoryHardwareCheck
   #- CategoryHomeMenu
   #- CategorySystemApplication
   #- CategorySystemSettings
   #- Core
   #- CtrNandRo
   #- CtrNandRoWrite
   #- CtrNandRw
    - Debug
    - DirectSdmc
   #- DirectSdmcWrite
   #- ExportImportIvs
   #- SaveDataMove
   #- Shell
   #- Shop
   #- SwitchCleanup
   #- TwlCardBackup
   #- TwlNandData
   
SystemControlInfo:
  SaveDataSize: 512K
  RemasterVersion: 0000
  StackSize: 0x40000
  JumpId: 0x0004000000142100L

This was insane. You know what my problem was for the last hour? Take a look at the line "SaveDataSize." You can't put KB for some reason. You can put K, sure, but KB is apparently so catastrophically bad that it breaks the game.

I don't yet know if it saves properly, but I'm willing to bet it does. Doesn't matter though. I'll be using it for debugging my romhack anyway.
 

Asia81

Yuri Lover ~
OP
Member
Joined
Nov 15, 2014
Messages
6,665
Trophies
3
Age
29
XP
3,554
Country
France
Majora's Mask 3D, don't work with both K or KB...

Also, a small question. What means "-target g" in batch file?
My makerom doesn't accept this key, only t, d & p...

I don't really know, but it's needed.
"Your" Makerom ?
You are not using makerom in the pack ?
 

Anton299

Well-Known Member
Member
Joined
Jan 18, 2012
Messages
126
Trophies
1
Age
50
Location
Kiev
Website
www.shedevr.org.ru
XP
359
Country
Ukraine
I don't really know, but it's needed.
"Your" Makerom ? You are not using makerom in the pack ?

Makerom from you pack is for 64 bit. But I need for 32 bit.
And all makeroms I have for 32 bit don't accept target -g...

My goal is to rebuild Majora's Mask (for future translaton). But all I get is white square in Gateway menu for now.
RSF file seems to be correct... dunno...
I've also tried very simple rsf for building *.cxi, then I used ExInjector, then building cci = white square. When trying to include manual (-content manual.cfa:1) = aes key error... :hateit:
Also I absolutely can't build CCI (3ds) ROM with manual included for Zelda ALBW. Without manual it works OK. Building CIA works fine, though (didn't test Majora's cia yet).

4.5 sysnanad, 9.0 emunand, if this helps somehow. Majora was decrypted on 4.5 sysnand using xorpads method. All files seems to be decrypted...
 

Randomixx

Member
Newcomer
Joined
Apr 22, 2015
Messages
7
Trophies
0
Age
31
XP
109
Country
Hello! Long time lurker here who's finally hit a significant enough roadblock that they needed to make an account. First of all, thank you Asia81 for writing up an English tutorial! I spent way too much time trying (and failing) to navigate through the French ones toward the start of the year, heh.

Anyway, I'm yet another person who has run into exheader issues - namely, my repacked test roms failing to boot without the 1.3 update. At this point I've only decrypted and repacked an unedited OR (EUR) rom as a test to make sure everything is working, however I do intend to make some text edits at a later date so I do need to get this right. Basically, I've encountered the exact same problem that you faced in this thread (https://gbatemp.net/threads/may-over-world-location.377769/page-2): the repacked rom hangs on the Nintendo 3DS loading screen if run without an update installed, however trying to inject the decrypted header (2KB file, extracted using ctrtool) just causes ExInjector to throw an error "Could not inject properly". I can inject the encrypted header, but that results in a rom that my n3DS cannot detect, with a blank icon that can't be launched.

Were you and Apache Thunder able to resolve this when it happened to you? That is basically my only hope at this point, however no solution was posted in the original thread.
 

Asia81

Yuri Lover ~
OP
Member
Joined
Nov 15, 2014
Messages
6,665
Trophies
3
Age
29
XP
3,554
Country
France
Makerom from you pack is for 64 bit. But I need for 32 bit.
And all makeroms I have for 32 bit don't accept target -g...

My goal is to rebuild Majora's Mask (for future translaton). Buy all I get is white square in Gateway menu.
RSF file seems to be correct... dunno...
I've also tried very simple rsf for building *.cxi, then I used ExInjector, then building cci = white square. When trying to include manual (-content manual.cfa:1) = aes key error... :hateit:
Also I absolutely can't build CCI (3ds) ROM with manual included for Zelda ALBW. Without manual it works OK. Building CIA works fine, though (didn't test Majora's cia yet).

4.5 sysnanad, 9.0 emunand, if this helps somehow. Majora was decrypted on 4.5 sysnand using xorpads method. All files seems to be decrypted...

Try without -target g ?
 

Asia81

Yuri Lover ~
OP
Member
Joined
Nov 15, 2014
Messages
6,665
Trophies
3
Age
29
XP
3,554
Country
France
Hello! Long time lurker here who's finally hit a significant enough roadblock that they needed to make an account. First of all, thank you Asia81 for writing up an English tutorial! I spent way too much time trying (and failing) to navigate through the French ones toward the start of the year, heh.

Anyway, I'm yet another person who has run into exheader issues - namely, my repacked test roms failing to boot without the 1.3 update. At this point I've only decrypted and repacked an unedited OR (EUR) rom as a test to make sure everything is working, however I do intend to make some text edits at a later date so I do need to get this right. Basically, I've encountered the exact same problem that you faced in this thread (https://gbatemp.net/threads/may-over-world-location.377769/page-2): the repacked rom hangs on the Nintendo 3DS loading screen if run without an update installed, however trying to inject the decrypted header (2KB file, extracted using ctrtool) just causes ExInjector to throw an error "Could not inject properly". I can inject the encrypted header, but that results in a rom that my n3DS cannot detect, with a blank icon that can't be launched.

Were you and Apache Thunder able to resolve this when it happened to you? That is basically my only hope at this point, however no solution was posted in the original thread.

Just read the first post (the tutorial) and you will be able to run ORAS without his update
 

Randomixx

Member
Newcomer
Joined
Apr 22, 2015
Messages
7
Trophies
0
Age
31
XP
109
Country
Just read the first post (the tutorial) and you will be able to run ORAS without his update

That's exactly what I've been doing, though. I've followed it, right down to the letter, and have still ended up with this error every single time...

EDIT: AND I decided to run through it one more time before bed. Of course it decided to work this time. I just hope this doesn't turn into a luck thing, because wasting 5+ hours to test a single edit is going to become very annoying...
 

Eyco

Member
Newcomer
Joined
Apr 19, 2015
Messages
5
Trophies
0
Age
28
XP
78
Country
Gambia, The
I've got the decrypted folder from the pokemon alpha sapphire rom, because mz nintendo 3ds is uptodate so i couldn't follow the tutorial... .-.

But now i have no idea how i could dump the ExeFS and the RomFS bin files. :(

Is the Folder useless?
ac5ec7e754.png
 

Asia81

Yuri Lover ~
OP
Member
Joined
Nov 15, 2014
Messages
6,665
Trophies
3
Age
29
XP
3,554
Country
France
I've got the decrypted folder from the pokemon alpha sapphire rom, because mz nintendo 3ds is uptodate so i couldn't follow the tutorial... .-.

But now i have no idea how i could dump the ExeFS and the RomFS bin files. :(

Is the Folder useless?
ac5ec7e754.png

Your folder (on the screen) is the romfs data extracted
 
  • Like
Reactions: Eyco

Eyco

Member
Newcomer
Joined
Apr 19, 2015
Messages
5
Trophies
0
Age
28
XP
78
Country
Gambia, The
Your folder (on the screen) is the romfs data extracted

Thank you i was enable to rebuild the romFS.bin with your tutorial. I still need the ExeFS and HeadExFS. How can I rebuild them? :o
Is that even possible? :o
Please forgive me my stupidity :D
 

ubergeek77

Post editing world champ.
Member
Joined
Dec 6, 2014
Messages
584
Trophies
0
XP
607
Country
United States

Asia81

Yuri Lover ~
OP
Member
Joined
Nov 15, 2014
Messages
6,665
Trophies
3
Age
29
XP
3,554
Country
France
Hey, do we know how to fix this? Should I replace the ctrtool.exe that's in there or something? It's happening to me too:

2cSdB5a.png


Doesn't matter if I'm decrypting the game with xorpads or if the .3ds is already decrypted. It just happens if the .3ds has a lot of files in it. It hasn't happened to me in other packs though.

It's a problem with CTR tool, so i don't know
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    NinStar @ NinStar: :wub: