ROM Hack How to convert a CDN game (tik/tmd/app) to a cia file ?

  • Thread starter Thread starter Rithynic
  • Start date Start date
  • Views Views 31,749
  • Replies Replies 17

Rithynic

New Member
Newbie
Joined
Aug 24, 2018
Messages
3
Reaction score
0
Trophies
0
Age
46
XP
109
Country
France
Hi all,

I've downloaded a lot of 3DS games with WiiU USB Helper. To install it, i use the "build CIA" fonction.
Since the WiiU USB Helper doesnt work very well (or be stop at any time), is there a way to manually convert the folder content (.tik file, .tmd file and .app files) to a cia file witch can be install with fbi ?

NB : I've try the make_cdn_cia script but the script need a .cetk file.
This .cetk file can be create from .tik file or downloaded from CDN servers ?

Thanks a lot !
(and sorry for my bad english).

Edit : Maybe in wrong section ?
 
Last edited by Rithynic,
Exactly the same for me, I hope there is a solution, no one to help us on this point?
 
a TIK file is the same as a 'CETK',

if your TIK file size is 2,640 bytes, then make a copy of the TIK file and rename it to 'CETK' without any extension and try building again.

if the TIK file is 848 bytes then that ticket is missing the 'Ticket Certificate Chain' from the end of the file. (I can't supply it though as its probably 'copywrited' material)
If you do manage to find a full-size ticket, the certificate chain is between offsets 0x0350 to 0x0A4F, you can just add that data to the end of the 848 byte ticket with a hex-editor.

edit: .app files don't sound like 3DS titles... usually 3DS CDN content is a TMD + numbered files like 00000000.
 
Last edited by c4388354,
I would love some more input on this thread. I have files from WiiU Usbhelper as well. None of them appear in the program anymore but if you go under the directory for WiiU USB helper all of the files for the 3ds are stored under DATA_3DS. I've tried to find some sort of converter to convert the files to.CIA format but no converter exist. Every file for the game contains 2 .app files, 1 .tik file, and 1 .tmd file. Can anything be done with the files now that Nintendo has updated their 3DS version. Would love more info on this situation.
 
I've never used WiiU UsbHelper so I have no idea what the filenames are or what format the files are in.

but If they are something like 00000000.app, 00000001.app, tik, tmd, try renaming them and removing the
.app file extensions and renaming the tik file to 'cetk', so you have a folder with files that look like this.
Code:
00000000
00000001
cetk
tmd
These are the filenames that make_cdn_cia expects, all files have no file extension at all
(also you might not have a 00000000 file, it may be another number, keep the original number of the file)

Try using make_cdn_cia on the folder and see if you get a CIA file.
Code:
make_cdn_cia <foldername> <filename.cia>
 
What program do we use to run "make_cdn_cia <foldername> <filename.cia>". Will this be ran in python with something like FunKeyCIA or FunkyCIA?
 
Assuming you are using windows, 'make_cdn_cia' needs to be run using a command prompt.
if you don't have the 'make_cdn_cia' program, I know FunKeyCIA includes it , 'WiiU UsbHelper' may also include it as well.

if you aren't sure on how to use the command prompt, I guess the easiest way is to make a folder and place the
games, '<titleid>' folder and the 'make_cdn_cia' program in it as well, then make a new text file and put this in it:
Code:
make_cdn_cia "00040000xxxxxxxx" "filename.cia"
pause
then save the text file and rename the extension to ".bat" and run it.
"00040000xxxxxxxx" is the name of the folder and "filename.cia" is the filename the CIA will be built to.

A command prompt window should open and make the CIA for you, hopefully without any errors. the 'pause' command is there so the
command prompt window doesn't immediately close after the made_cdn_cia program exits (so you can check for any error messages etc)
You can right-click on the batch file and chooose edit to change the foldername and cia filename, save, then run it again to make another CIA.
 
I try to run the program with everything in one folder with the bat file you told me too and I get an error with the tik

ex: ("3D After Burner II [0004000000158900]" "3d afterburner II"
CTR_Toolkit - CIA Generator for CDN Content
Version 1.0 (C) 3DSGuy 2013

[!] Could not open 'tik')

Files in folder:
(00000002.app
00000003.app
code.bat
make_cdn_cia.exe
title.tik
title.tmd)
 
Last edited by zachkeep,
the "title.tik" file needs to be renamed to "cetk" and the "title.tmd" file needs to be renamed to "tmd"
you will also need to remove the .app file extensions on the 00000002.app and 00000003.app files,

so you should have these files (note that ALL of the files should have no file extension at all)
Code:
00000002
00000003
cetk
tmd

The folder name where those files are stored should be named: "0004000000158900"

put the make_cdn_cia program and the code.bat file where the "0004000000158900" folder is.
this should be the contents of your code.bat:
Code:
make_cdn_cia "0004000000158900" "3D After Burner II (USA).cia"
pause

Hopefully that will successfully generate a CIA file for you.

So basically the file layout is:
Code:
0004000000158900 (this is a folder, with the 00000002, 00000003, cetk, tmd files inside)
code.bat (containing the build command)
make_cdn_cia.exe
 
Last edited by c4388354, , Reason: spelling and make instructions a bit more clear
Oh, hell yeah, bro. It worked. The last step I had to do after all that changed the file's extension to .cia and it lets you install on FBI. You're awesome man. Hope other people get help from this. I do get some error codes but the game still works.

These are them if interested.

[!] Caution, Ticket and TMD Title Versions do not match
[!] CETK Title Ver: 1
[!] TMD Title Ver: 16
[*] 3D Classics Excitebike (USA) Generated Successfully
 
The 'title version' is not checked when installing the CIA or playing the game on custom firmware so the game will install and work fine, but if you want a 'proper' CIA
you can fix the error by opening the 'tmd' and 'cetk' files in a hex editor, copying the two bytes of 'title version' data (e.g 00 10) in the TMD file located at '0x01DC and 0x01DD',
then going to the ticket at '0x01E6 and 0x01E7' and pasting / entering those two bytes of version data, then saving the ticket and rebuilding the CIA with 'make_cdn_cia' again.

in the above example, your TMD version data is '00 10' (which is 16 in decimal), but your ticket version data is '00 01' (which is 1 in decimal).
(I'm unsure why the ticket data doesn't match the tmd version, maybe 'WiiU USB Helper' uses a hardcoded value of '00 01' for the ticket version?)
 
Last edited by c4388354, , Reason: edit: fixed mistake with decimal / hexadecimal...
  • Like
Reactions: whateverg1012
I'm attempting to fix the error but I don't seem to be able to find the files in the hex editor you described. May have to do with I have little understanding of hex. I searched the whole file for '0x01DD' and '0x01DC' but never found that line of text.
 
below is an example of what a hex-Editor looks like.

YPgKK2f.png

(PS: this is just data from a random number generator)

'0x01DC and 0x01DD' are offsets (which are in hexadecimal as they start with 0x)
(you can see at the top the (h) after offset, telling us we are in 'hexadecimal mode')

Hexadecimal counts 00,01,02,03,04,05,06,07,08,09,0A,0B,0C,0D,0E,0F,10,11 etc
Each pair of values (from 00 to FF) is one byte, a two byte value will have two pairs of characters. (e.g 0000 to FFFF)

Usually hex-editors show lines of 16 bytes (from 00 to 0F) but the line length can be changed if wanted.

In the above picture, the highlight starts at row 0x01D0 and the value in column 0x0D is highlighted.
so we add 0x01D0 and 0x0D, and we get 0x01DD, so this means offset 0x01DD is the start of the selection,
the value next to it is also selected which is 0x01DE.

You can usually leave off the leading zeros just like you do with decimal numbers but hexadecimal numbers
are usually written in pairs, which is why I wrote 0x01DD without the leading zero dropped.

In the picture:
0x01DD contains the value '14' in hexadecimal (which is 20 in decimal)
0x01DE contains the value 'B9' in hexadecimal (which is 185 in decimal)
or you can write: 0x01DD contains the value 0x14B9. (which is two bytes long)

What you need to do is find the two bytes in the TMD at offset 0x01DC and copy them / remember them,
then in your ticket, go to offset 0x01E6 and overwrite the two values with the ones from the TMD.
(if pasting the values, make sure you choose paste-overwrite NOT paste-insert, you don't want to change the size of the file)
 
  • Like
Reactions: whateverg1012
@c4388354
So many thanks, It works perfectly with the hex editing !!!

The next step is to convert the cia file to a 3ds file (to play with Citra emulator or with a Gateway).
When I use "3DS To CIA Converter v4.1", i have an error (Could not read exheader file).

Must the CIA file be decrypted ?
 
Last edited by Rithynic,
I found the solution. I use Batch CIA 3DS Decryptor (gbatemp.net/threads/batch-cia-3ds-decryptor-a-simple-batch-file-to-decrypt-cia-3ds.512385/) and it works !!!
Thanks to all GBATemp's members !
 
Convert a RAW title downloaded from Villain3DS into a *.cia with GodMode9
  1. Copy your ############### folder that contains the 0000000X, cetk, and tmd files onto your SD card.
  2. In GodMode9, go to your folder and select the tmd > TMD file options... > Build CIA (standard)
  3. You'll find your CIA file named as tmd.cia in the 0:/gm9/out folder.
Note - This approach only does a single CIA conversion one at a time.
 
ok so i have collection of updates dlcs and eshop games but in the folder i only have 00000000000 etc and one or sometimes more tmd(s)
i can convert them to cia with my 3ds but cant seem to find a way to do this on my pc and was wondering if anyone had any ideas
i know it's supposed to have a cetk for use with make cdn cia but i dont have these and considering that i cant convert them with godmode9 i figured there must be a way to do it on pc
cuz converting all the content i have via my 3ds will literally take years also the reason i want to do this on pc mostly is so i can use the cias with citra

Okay so update I managed to mount my content via ninfs and inside is a decrypted cxi which would work great for my eshop games but not so much for updates or dlc Considering citra doesn't install cxi's because they are executables
Honestly I'm beginning to think it cant be done, except with my 3ds itself
Any help would be greatly appreciated a point in the right direction or anything
 
Last edited by HallowedTruth,

Site & Scene News

Popular threads in this forum