Hacking (4.x only) CIA CFW Complete Guide

aliak11

Pokemon Master
Member
Joined
Dec 5, 2010
Messages
195
Trophies
1
Age
30
Location
Florida
XP
1,126
Country
United States
I'm working on a tutorial for converting roms to CIA files! Should be ready tonight hopefully.

Do you know what causes this error on import?
Code:
Import failed
Level: LEVEL_PERMANENT(-5)
Summary: SUMMARY_INVALID_ARGUMENT(7)
Module: MODULE_NN_AM(32)
Desc: (unknown)(106)
 

ground

Well-Known Member
Member
Joined
Mar 22, 2007
Messages
907
Trophies
0
XP
597
Country
Netherlands
Do you know what causes this error on import?
Code:
Import failed
Level: LEVEL_PERMANENT(-5)
Summary: SUMMARY_INVALID_ARGUMENT(7)
Module: MODULE_NN_AM(32)
Desc: (unknown)(106)
i had this error once, and i guess it is a faulty cia file. did you edit the .cia file after compiling?

p.s. anybody who wants to switch between regions: edit the byte at offset 2018 in icon.bin before compiling (http://3dbrew.org/wiki/SMDH#Region_Lockout), i had succes with pilotwings :)
 
  • Like
Reactions: Brandon1990

CalebW

Fellow Temper
Member
Joined
Jun 29, 2012
Messages
638
Trophies
0
Location
Texas
XP
545
Country
United States
i had this error once, and i guess it is a faulty cia file. did you edit the .cia file after compiling?

p.s. anybody who wants to switch between regions: edit the byte at offset 2018 in icon.bin before compiling (http://3dbrew.org/wiki/SMDH#Region_Lockout), i had succes with pilotwings :)
Why is it in the icon file?


Hmmm, so I compiled my decrypted Ocarina of time into a cia. Then I converted it to cci with -ccitocia in order to inject the decrypted exheader as mentioned earlier in this thread. I then converted back to cia with -ccitocia and installed it to rednand. But when I try to run it, I get "An error has occurred" instead of the usual freezing on the black 3ds screen.
 

palantine

Well-Known Member
OP
Member
Joined
Oct 5, 2014
Messages
174
Trophies
0
Age
38
XP
593
Country
Italy
Do you know what causes this error on import?
Code:
Import failed
Level: LEVEL_PERMANENT(-5)
Summary: SUMMARY_INVALID_ARGUMENT(7)
Module: MODULE_NN_AM(32)
Desc: (unknown)(106)


I'm not sure what causes it, but I do know that almost all of the BBB sdk CIA files cause this error. The error code says its happening in "Application Manager" (AM)
 

palantine

Well-Known Member
OP
Member
Joined
Oct 5, 2014
Messages
174
Trophies
0
Age
38
XP
593
Country
Italy
ROM to CIA Guide

This guide requires makerom and ctrtool.

Step1: decrypt the .3ds rom.
I will not explain it in this tutorial, as it is explained a couple of times around the forum. (http://gbatemp.net/threads/release-3ds_ctr_decryptor-void.370684/)

If you end up with a decrypted romfs.bin, exheader.bin, code.bin (decompressed), icon.bin and banner.bin you did everything correct.

Step2: creating an .rsf file
The .rsf file is a little bit different then the one for .3ds roms. Anyway here is the proper one, make sure you fill in the XXXX the right way. Just copy the text in the codebox underneath in a text editor and save it as cia.rsf in the folder with the other stuff.

• you can open the exheader or original rom in a hex editor to look up the right values for the companycode, producttyp and productcode
•For the correct UniqueID you can check ctrtool and the official rom. Just remove the last 2 0 and write the 4 digits before that in the .rsf file:

Code:
BasicInfo:
  Title                  : "Custom Title"
  CompanyCode            : "00"
  ProductCode            : "CTR-P-DERP"
  ContentType            : Application # Application / SystemUpdate / Manual / Child / Trial
  Logo                    : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem
 
TitleInfo:
  UniqueId                : 0x7850
  Category                : Application
 
Option:
  UseOnSD                : true # true if App is to be #installed to SD
  EnableCompress          : true # Compresses exefs code
  FreeProductCode        : true # Removes limitations on ProductCode
  EnableCrypt            : true # Enables encryption for NCCH and CIA
  MediaFootPadding        : true # If true CCI files are created with padding
 
AccessControlInfo:
  ExtSaveDataId: 0xb7850 # same as UniqueId
  SystemSaveDataId1: 0x00000000 # plaintext exheader
  SystemSaveDataId2: 0x00000000 # plaintext exheader
  OtherUserSaveDataId1: 0x00000 # plaintext exheader
  OtherUserSaveDataId2: 0x00000 # plaintext exheader
  OtherUserSaveDataId3: 0x00000 # plaintext exheader
  UseOtherVariationSaveData : false
 
SystemControlInfo:
  SaveDataSize: 1M # plaintext exheader
  RemasterVersion: 0 # plaintext exheader
  StackSize: 0x00040000 # plaintext exheader
  JumpId: 0x000400000b000000L # plaintext exheader (<full UniqueID>L)

step 3: creating the .cia
Open the command window in the folder with the exefs.bin, exheader.bin, romfs.bin, icon.bin, code.bin, banner.bin, cia.rsf and makerom. Now run the following command:

makerom -f cia -target t -desc app:1 -icon icon.bin -banner banner.bin -exefslogo -code code.bin -exheader exh.bin -romfs romfs.bin -rsf cia.rsf -o Install.cia

this will output an .cia file which you can install with the DevMenu and then run.

If you encounter an error saying "[ROMFS ERROR] Invalid RomFS Binary.", then remove the "-romfs romfs.bin" from the command.
 

pLaYeR^^

Doctor Switch
Member
Joined
Sep 18, 2014
Messages
3,151
Trophies
1
Age
27
Location
Austria
XP
3,928
Country
Austria
ROM to CIA Guide

This guide requires makerom and ctrtool.

Step1: decrypt the .3ds rom.
I will not explain it in this tutorial, as it is explained a couple of times around the forum. (http://gbatemp.net/threads/release-3ds_ctr_decryptor-void.370684/)

If you end up with a decrypted romfs.bin, exheader.bin, code.bin (decompressed), icon.bin and banner.bin you did everything correct.

Step2: creating an .rsf file
The .rsf file is a little bit different then the one for .3ds roms. Anyway here is the proper one, make sure you fill in the XXXX the right way. Just copy the text in the codebox underneath in a text editor and save it as cia.rsf in the folder with the other stuff.

• you can open the exheader or original rom in a hex editor to look up the right values for the companycode, producttyp and productcode
•For the correct UniqueID you can check ctrtool and the official rom. Just remove the last 2 0 and write the 4 digits before that in the .rsf file:

Code:
BasicInfo:
  Title                  : "Custom Title"
  CompanyCode            : "00"
  ProductCode            : "CTR-P-DERP"
  ContentType            : Application # Application / SystemUpdate / Manual / Child / Trial
  Logo                    : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem
 
TitleInfo:
  UniqueId                : 0x7850
  Category                : Application
 
Option:
  UseOnSD                : true # true if App is to be #installed to SD
  EnableCompress          : true # Compresses exefs code
  FreeProductCode        : true # Removes limitations on ProductCode
  EnableCrypt            : true # Enables encryption for NCCH and CIA
  MediaFootPadding        : true # If true CCI files are created with padding
 
AccessControlInfo:
  ExtSaveDataId: 0xb7850 # same as UniqueId
  SystemSaveDataId1: 0x00000000 # plaintext exheader
  SystemSaveDataId2: 0x00000000 # plaintext exheader
  OtherUserSaveDataId1: 0x00000 # plaintext exheader
  OtherUserSaveDataId2: 0x00000 # plaintext exheader
  OtherUserSaveDataId3: 0x00000 # plaintext exheader
  UseOtherVariationSaveData : false
 
SystemControlInfo:
  SaveDataSize: 1M # plaintext exheader
  RemasterVersion: 0 # plaintext exheader
  StackSize: 0x00040000 # plaintext exheader
  JumpId: 0x000400000b000000L # plaintext exheader (<full UniqueID>L)

step 3: creating the .cia
Open the command window in the folder with the exefs.bin, exheader.bin, romfs.bin, icon.bin, code.bin, banner.bin, cia.rsf and makerom. Now run the following command:



this will output an .cia file which you can install with the DevMenu and then run.

If you encounter an error saying "[ROMFS ERROR] Invalid RomFS Binary.", then remove the "-romfs romfs.bin" from the command.
Thanks, i will test today. If the roms are decrypted, this mean I also can install 7X games, right?
 

sonic2756

Friendly Neighborhood Wolf
Member
Joined
Feb 3, 2010
Messages
673
Trophies
1
Age
26
Website
www.keenbrigade.com
XP
1,229
Country
United States


Getting this when trying to build the CIA

[EXHEADER ERROR] Failed to set ExtSaveDataId. UseExtSaveData must be true.
[EXHEADER ERROR] Failed to create ExHeader
[NCCH ERROR] NCCH Build Process Failed
[RESULT] Failed to build outfile

EDIT:

Set UseExtSaveData to true under AccessControlInfo in the .rsf and it compiled.
 
  • Like
Reactions: laurorual

mocalacace

Well-Known Member
Member
Joined
Sep 28, 2008
Messages
327
Trophies
1
Location
127.0.0.1
XP
960
Country
United States
Mario Kart 7, and I typed this :
Code:
makerom -f cia -o MK7.cia -rsf RSF.rsf -target d -desc app:2 -exheader decrypted/exheader.bin -exefslogo -code decrypted/exefs/code.bin -icon decrypted/exefs/icon.bin -banner decrypted/exefs/banner.bin
pause

If you got mk7 compiled did it work for you? I got it installed but when I run it I get black screen an error has occurred message. If it did work can you post your rsf file.
 

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
ROM to CIA Guide

This guide requires makerom and ctrtool.

-snip-


Before I start, let me say thanks for removing the sketchy network calls, and for writing up the tutorial.

Figured I'd have a go at this with my Ocarina of Time cart, but makerom (compiled myself from the latest source at https://github.com/3DSGuy/Project_CTR) says [SETTING ERROR] Argument "-elf" is required.

Here's how I tried to run makerom:
Code:
makerom -f cia -rsf rsf.rsf -target t -desc app:1
-icon decrypted/exefs/icon.bin -banner decrypted/exefs/banner.bin -exefslogo -ex
header decrypted/exheader.bin -romfs decrypted/romfs.bin -rsf rsf.rsf -o rom.cia

Note that the -rsf is listed twice, like the tutorial deems it so (so it's not a mistake on my end, if it is indeed a mistake).

Here's the RSF I'm using (UniqueId is the same thing as "Program ID" in ctrtool, right?):

Code:
BasicInfo:
  Title                  : "The Legend of Zelda: Ocarina of Time 3D"
  CompanyCode            : "00"
  ProductCode            : "CTR-P-AQEE"
  ContentType            : Application # Application / SystemUpdate / Manual / Child / Trial
  Logo                    : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem
 
TitleInfo:
  UniqueId                : 0x0335
  Category                : Application
 
Option:
  UseOnSD                : true # true if App is to be #installed to SD
  EnableCompress          : true # Compresses exefs code
  FreeProductCode        : true # Removes limitations on ProductCode
  EnableCrypt            : true # Enables encryption for NCCH and CIA
  MediaFootPadding        : true # If true CCI files are created with padding
 
AccessControlInfo:
  ExtSaveDataId: 0x0335 # same as UniqueId
  SystemSaveDataId1: 0x00000000 # plaintext exheader
  SystemSaveDataId2: 0x00000000 # plaintext exheader
  OtherUserSaveDataId1: 0x00000 # plaintext exheader
  OtherUserSaveDataId2: 0x00000 # plaintext exheader
  OtherUserSaveDataId3: 0x00000 # plaintext exheader
  UseOtherVariationSaveData : false
 
SystemControlInfo:
  SaveDataSize: 128K # plaintext exheader
  RemasterVersion: 0 # plaintext exheader
  StackSize: 0x00004000 # plaintext exheader
  JumpId: 0x0004000000033500L # plaintext exheader (<full UniqueID>L)

Any insight is appreciated.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • SylverReZ @ SylverReZ:
    You never know if the key works or not, they don't provide a guarantee.
  • linuxares @ linuxares:
    Sure is... and poor devs get hit with the charge backs
    +1
  • SylverReZ @ SylverReZ:
    Exactly.
  • linuxares @ linuxares:
    Thor from "Pirate Software" said its just better to pirate the game than buy from a keyshop if you care about the devs
    +2
  • The Real Jdbye @ The Real Jdbye:
    devs don't get hit with the chargebacks, the keys are free to generate
  • The Real Jdbye @ The Real Jdbye:
    at least on steam
  • linuxares @ linuxares:
    Except he said the DEVS get hits with the chargeback cost
    +1
  • linuxares @ linuxares:
    since the key gets bought with a stolen credit card
  • The Real Jdbye @ The Real Jdbye:
    there's nothing to charge back because the keys don't cost them money to generate in the first place
  • K3Nv2 @ K3Nv2:
    If the game has a crack sure
  • K3Nv2 @ K3Nv2:
    Most these crack sites have dead links anymore or the crack don't even work
  • linuxares @ linuxares:
    @The Real Jdbye What don't you get? If someone use a stolen creditcard. Then sell said key on G2A. If I the dev sold the game key, I will get the charge back cost. That's how it works, it doesn't matter if I generate 300 keys if 300 of them are bought with stolen credit cards. I never said it was on Steam, but its the dev that gets hit. There is a ton of stories out there if you google it.
    +1
  • K3Nv2 @ K3Nv2:
    Just buy other people's steam account :teach:
  • linuxares @ linuxares:
    Just tell them you're dead ;D
    +1
  • K3Nv2 @ K3Nv2:
    They already know
  • linuxares @ linuxares:
    I honestly wonder how the EU would say if I willed my account to you. And Valve be like "nope!"
    +1
  • cearp @ cearp:
    @K3Nv2 - sounds like you need a better place to find cracks!
  • K3Nv2 @ K3Nv2:
    Psionics offline right now or I would
  • SylverReZ @ SylverReZ:
    @cearp, Psi is offline at the minute, but he knows where to find them.
  • cearp @ cearp:
    get your mind out of the gutter, I'm talking about piracy
  • cearp @ cearp:
    not that type of crack
    +1
  • K3Nv2 @ K3Nv2:
    I mean the drug not the booty pervs
    +2
  • linuxares @ linuxares:
    @cearp At a plumber convenstion. Loads of cracks!
    +1
  • K3Nv2 @ K3Nv2:
    A plumber is either on crack or in crack or showcasing crack
    K3Nv2 @ K3Nv2: A plumber is either on crack or in crack or showcasing crack