That thing about copying data from the exheader of the game sounds a bit confusing to me, so I want to go to the secured path. Even when rebuilding VC GBC with Makerom was supposedly eeasy, I got a hard time getting them to work and I don't even remember what I did later to fix it.
We figured out that's not entirely necessary. Makerom can't set everyting up just by using the RSF file, so it relies on built-in setting templates.
You need to use the '-desc <apptype>:<fw> ' switch for setting up everything correctly. It will invoke one of the internal setting templates to be added into the exheader. Apptype can be 'app' or 'ecapp', and 'fw' goes from 1 to 8. Ecapp is an application that uses additional services.
NSMB2 is one of these cases, and we can use '-desc ecapp:3' to rebuild it.
These templates need to be signed too, so they require the '-target g' switch, to use Gateway's keys and certificates. (requires applestash's 'vandalized' revision)
Building is an easy task now. The only detail left for figuring out in the commandline is the logo, which is also easy do determine.
First extract the exefs's contents. If there's a logo inside, '-exefslogo' is necessary.
If there's no logo there, try to extract it from the rom. If there's a valid file, then you need to add it with '-logo logo.bin' for example.
But f the logo is just an empty file, then just leave it set to 'Nintendo' in the RSF file and add nothing to the command line.
This is a proper RSF for New Super Mario Bros2 USA, for example:
Code:
BasicInfo:
Title : "BIGRED" # 'Name' from the exheader
CompanyCode : "01" # 'Company Code' from 3DSExplorer
ProductCode : "CTR-P-ABEE" 'Product code from 3DSExplorer
ContentType : Application # Application / SystemUpdate / Manual / Child / Trial
Logo : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem
#RomFs:
# Specifies the root path of the file system to include in the ROM. It's also broken.
#HostRoot : "rom"
TitleInfo:
UniqueId : 0x07AE # final digits from 'Program id' except the last 2 zeros
Category : Application
CardInfo:
MediaSize : 512MB # 128MB / 256MB / 512MB / 1GB / 2GB / 4GB
MediaType : Card1 # Card1 / Card2
CardDevice : NorFlash # NorFlash(for Card1 with savedata) / None (for Card2)
Option:
UseOnSD : false # true if App is to be installed to SD
FreeProductCode : true # Removes limitations on ProductCode
MediaFootPadding : false # If true CCI files are created with padding
EnableCrypt : true # Enables encryption for NCCH and CIA
EnableCompress : true # Compresses exefs code
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
SystemControlInfo:
SaveDataSize : 128K # either K, M or KB, MB
RemasterVersion : 0
StackSize : 0x4000 # 'Code stack size' from the exheader
AccessControlInfo:
ExtSaveDataId: 0x000007ae
#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
And it can be rebuilt using this command line
Code:
..\makerom -f cci -target g -desc ecapp:3 -rsf NSMB.rsf -romfs xored_romfs.bin -exheader xored_exh.bin -code exefs/code.bin -icon exefs/icon.bin -banner exefs/banner.bin -alignwr -o NSMB.3DS