ROM Hack [HELP] Building .cia from Zelda ALBW PAL (modified files) (for 4.5 CFW)

Anton299

Well-Known Member
OP
Member
Joined
Jan 18, 2012
Messages
126
Trophies
1
Age
50
Location
Kiev
Website
www.shedevr.org.ru
XP
359
Country
Ukraine
Could anybody explain how to build fully working Zelda ALBW (PAL) .cia from decrypted files with MODIFIED data (translation), please?

After decrypting ROM file, replacing some files in "romfs\EU_English" folder and rebuilding RomFS.bin with this batch file:

Code:
[USER=325063]Echo[/USER] off
SETLOCAL ENABLEEXTENSIONS
set ATTR=%~a1
set DIRATTR=%ATTR:~0,1%
if /I "%DIRATTR%" equ "d" (
  goto :begin
) else (
  echo NOT A FOLDER!
)
pause
exit /b
 
:begin
if exist "%~dp0%~n1.bin" goto :error
echo.
echo.
[USER=325063]Echo[/USER] PACKING ROMFS BINARY... PLEASE WAIT
"%~dp0program\ctr_makerom32" -rsf "%~dp0Program\Child.rsf" -f data -DROMFS_ROOT="%~dp1%~n1" -DPROGRAM_ID=0x1234 -o "%~dp0%~n1.cfa"
call :getFilesize "%~dp0%~n1.cfa
set /a fileSize-=4096
echo.
echo.
[USER=325063]Echo[/USER] ALMOST DONE... PLEASE WAIT
"%~dp0program\tail" -c %fileSize% "%~dp0%~n1.cfa" 1> "%~dp0%~n1.bin"
del "%~dp0%~n1.cfa
del "%~dp0%~n1.cfa.xml
MSG * DONE!
exit /b
 
 
:getFilesize
set filesize=%~z1
exit /b
 
:error
echo.
echo.
echo A FILE WITH THIS NAME ALREADY EXISTS!
echo.
pause
exit /b


I've managed to build .cia and get it to work on Palatine CFW with this batch file:

Code:
makerom -f ncch -rsf albw.rsf -target t -desc app:4 -icon exefs\icon.bin -banner exefs\banner.bin -exefslogo -code exefs\code.bin -exheader exheader.bin -romfs romfs.bin -o LoZ-ALBW.cxi
makerom -f cia -rsf albw.rsf -target t -content LoZ-ALBW.cxi:0:0 -content manual.cfa:1:1 -o albw.cia

With this Makerom:
CTR MAKEROM 0.13 (C) 3DSGuy 2014 (662 Kb (678 274 bytes).

And with this "albw.RSF":

Code:
BasicInfo:
  Title                  : "LoZ-ALBW-EU"
  CompanyCode            : "00"
  ProductCode            : "CTR-P-BZLP"
  ContentType            : Application # Application / SystemUpdate / Manual / Child / Trial
  Logo                  : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem
 
TitleInfo:
  UniqueId              : 0x0ec4
  Category              : Application
 
Option:
  UseOnSD                : true
  EnableCompress        : true
  FreeProductCode        : true
  EnableCrypt            : false
  MediaFootPadding      : true
 
AccessControlInfo:
  ExtSaveDataId: 0x0ec4 # same as UniqueId
  SystemSaveDataId1: 0x00000000
  SystemSaveDataId2: 0x00000000
  OtherUserSaveDataId1: 0x00000
  OtherUserSaveDataId2: 0x00000
  OtherUserSaveDataId3: 0x00000
  UseOtherVariationSaveData : false
 
SystemControlInfo:
  SaveDataSize: 512KB # plaintext exheader
  RemasterVersion: 0 # plaintext exheader
  StackSize: 0x00040000 # plaintext exheader
  JumpId: 0x0004000000030800L # plaintext exheader (0x00040000000EC400L)


Questions:
1. After installing CIA there is NO GIFT ICON appears (a white frame just "flashes" and disappears immediately, instead of new gift/game icon). The game only runs from BigBlueMenu.
2. So, I can't exit the game in a normal way and see if there is a manual I'm trying to add with "-content manual.cfa:1:1" - pressing HOME button just causes the game to hang. I can quit game only by pressing Power button and power off the console.
3. I've extracted manual (*.cfa file) from original (and encrypted) ROM using Rom_tool - "rom_tool -x manual romname.3ds". Is this a right way to do so?
4. WHY there are no gift/game icon appears after installing .cia? What should I do to make it appear? I've tried everything, hundreds of times - no icon appears... EVER...
5. This line in rsf file -> "JumpId: 0x0004000000030800L # plaintext exheader (0x00040000000EC400L)" should be "JumpId: 0x00040000000EC400L" or not?
(it seems to work in both cases, though). I got that rsf somewhere here at gbatemp, but for US version of the game and edited it for EUR version. Maybe something wrong with rsf?..

Help, please...
 

gamesquest1

Nabnut
Former Staff
Joined
Sep 23, 2013
Messages
15,153
Trophies
2
XP
12,237
sounds like you have it set up for the wrong region, basically if a game doesnt match the region of your console it won't show up on the homescreen, but can be booted from devmenu
 

ChrisX930

Banned!
Banned
Joined
Sep 3, 2013
Messages
788
Trophies
0
Location
Germany
XP
458
Country
Gambia, The
Try to rebuild your romfs with scire'sM tool : RomFS Builder

This tool doesn't worked for me with "Harvest Moon - A New Beginning".
I built a romfs with this romfs-builder. After I started the Game with the rebuilded romfs, I only got a freeze + Black Screen.


I prefer to use this tool.
<snip>

Download it, copy the romfs-folder in the root of this and start "Make a new ROMFS.bat".
It will build a working romfs.bin for your game.
 

Anton299

Well-Known Member
OP
Member
Joined
Jan 18, 2012
Messages
126
Trophies
1
Age
50
Location
Kiev
Website
www.shedevr.org.ru
XP
359
Country
Ukraine
sounds like you have it set up for the wrong region, basically if a game doesnt match the region of your console it won't show up on the homescreen, but can be booted from devmenu

It's PAL.
My console is PAL, translated game is PAL, also.
This is PAL, right? )
"CTR-P-BZLP" and UniqueId : 0x0ec4
Also, I've checked original ROM in 3DExplorer, and it says that it EU, too.

I'm really confused with that "no icon"...

Try to rebuild your romfs with scire'sM tool : RomFS Builder

I use ctr_makerom32 (50 kb) for RomFS build from... well... I guess its's from SDK?

can you give any modified files 4 test? I'll try to build cia. If I can, I will write you how.

See attached file.
Extract and replace in decrypted PAL rom: icon.bin in ExeFS folder, 5 *.szs files in RomFS\EU_English folder.
 

Attachments

  • loz_albw_rus-files_wip.rar
    667.2 KB · Views: 278

Anton299

Well-Known Member
OP
Member
Joined
Jan 18, 2012
Messages
126
Trophies
1
Age
50
Location
Kiev
Website
www.shedevr.org.ru
XP
359
Country
Ukraine
gamesquest1 - it works perfectly with you icon.bin! Manual works, too!
It seems that I really played with the wrong icon... shame on me... (

But tell me, please, how did you fix my icon?



icon_ru.jpg
 

gamesquest1

Nabnut
Former Staff
Joined
Sep 23, 2013
Messages
15,153
Trophies
2
XP
12,237
gamesquest1 - it works perfectly with you icon.bin!
It seems that I really played with the wrong icon... shame on me... (

But tell me, please, how did you fix my icon?
View attachment 16741
In the icon file if you go to 0x2018 that is the region byte, 3dsbrew has the relevant info, yours was set to 02 which is US, I just changed it to 04 for EU.....pretty sure setting it to 7F will make the CIA region free
 

Anton299

Well-Known Member
OP
Member
Joined
Jan 18, 2012
Messages
126
Trophies
1
Age
50
Location
Kiev
Website
www.shedevr.org.ru
XP
359
Country
Ukraine
In the icon file if you go to 0x2018 that is the region byte, 3dsbrew has the relevant info, yours was set to 02 which is US, I just changed it to 04 for EU.....pretty sure setting it to 7F will make the CIA region free

Thank you!
One damn byte... and two weeks of trying to build working cia...
Thanks again for your help!
 
  • Like
Reactions: cearp

Anton299

Well-Known Member
OP
Member
Joined
Jan 18, 2012
Messages
126
Trophies
1
Age
50
Location
Kiev
Website
www.shedevr.org.ru
XP
359
Country
Ukraine
I'll bump this, because I'm in trouble again... )
Now I can't build working .3ds rom.

Here is my .bat file:

This part seems OK and it builds .cxi file:
Code:
makerom -f ncch -rsf albw_3ds.rsf -target t -desc app:4 -icon exefs\icon.bin -banner exefs\banner.bin -exefslogo -code exefs\code.bin -exheader exheader.bin -romfs romfs.bin -o LoZ-ALBW_RU.cxi

But after that I can't build a .cci container (.3ds rom), it always fails:
Code:
makerom -f cci -i LoZ-ALBW_RU.cxi:0:0 -i manual.cfa:1:1 -i updatedata.cfa:2:2 -o LoZ-ALBW_RU.3ds

It prints this error:
[NCCH ERROR] Failed to load ncch aes key
[RESULT] Failed to build CCI

My .rsf file:

Code:
BasicInfo:
  Title                  : "LoZ-ALBW-EU" #CHANGE ME
  CompanyCode            : "00" #CHANGE ME
  ProductCode            : "CTR-P-BZLP" #CHANGE ME
  ContentType            : Application # Application / SystemUpdate / Manual / Child / Trial
  Logo                    : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem
 
TitleInfo:
  UniqueId                : 0x0ec4 #CHANGE ME
  Category                : Application # Application / SystemApplication / Applet / Firmware / Base / DlpChild / Demo / Contents / SystemContents / SharedContents / AddOnContents / Patch / AutoUpdateContents
 
CardInfo:
  MediaSize              : 1GB # 128MB / 256MB / 512MB / 1GB / 2GB / 4GB / 8GB / 16GB / 32GB #CHANGE ME
  MediaType              : Card1 # Card1 / Card2 #CHANGE ME
  CardDevice              : NorFlash # NorFlash(Pick this if you use savedata) / None (Choose None if it's a card2 game)
 
 
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            : false # 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:
  #UseExtSaveData : true
  ExtSaveDataId: 0x0ec4
  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: 512KB #CHANGE ME
  RemasterVersion: 0
  StackSize: 0x40000
  JumpId: 0x00040000000EC400L

I've managed to build .3ds file once, with this .rsf, I guess... (it works for cia creating):
Code:
BasicInfo:
  Title                  : "LoZ-ALBW-EU"
  CompanyCode            : "00"
  ProductCode            : "CTR-P-BZLP"
  ContentType            : Application # Application / SystemUpdate / Manual / Child / Trial
  Logo                    : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem
 
TitleInfo:
  UniqueId                : 0x0ec4
  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            : false # Enables encryption for NCCH and CIA
  MediaFootPadding        : true # If true CCI files are created with padding
 
AccessControlInfo:
  ExtSaveDataId: 0x0ec4 # 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: 512KB # plaintext exheader
  RemasterVersion: 0 # plaintext exheader
  StackSize: 0x00040000 # plaintext exheader
  JumpId: 0x00040000000EC400L # plaintext exheader (0x00040000000EC400L)

...But it shows me a white square instead of icon and no title in Gateway game list.
The is NO problem with microSD. Original game works just fine.

Please, help me to figure out, what's wrong?

PS. In "icon.bin" at offset 2018 - "region byte" = "0C" in LoZ:ALBW (PAL). Why it's not "04"?
 

Anton299

Well-Known Member
OP
Member
Joined
Jan 18, 2012
Messages
126
Trophies
1
Age
50
Location
Kiev
Website
www.shedevr.org.ru
XP
359
Country
Ukraine
Still can't rebuild .3ds (.cci) ROM with manual.cfa included..
Every time I get this error:

[NCCH ERROR] Failed to load ncch aes key
[RESULT] Failed to build CCI

EnableCrypt: false- target t

Any suggestions, please?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: @LeoTCK, mods are probably hating you