1. Nagato

    OP Nagato GBAtemp Advanced Fan
    Member

    Joined:
    Jul 15, 2011
    Messages:
    535
    Country:
    United States
    I created this tool for the Labyrinth no Kanata translation project and wanted to share it with everyone since .CTPK is a common 3DS format. It uses Normmatt's code for converting the image data to .pngs.

    As far as dumping images goes, this doesn't offer too much compared to Normmatt's texturipper besides a small bugfix that caused the colors to be inverted for Rgb8 images. The biggest addition is that I added a way to create a new .CTPK based on some metadata output when dumping using this tool. It only supports generating Rgb8 and Argb8 images, but since the image format is just a flag in the file, most games shouldn't care too much. I've tested this by recreating an image that was originally ETC1A4 and recreating it as Argb8 and inserted it inside of a game and had no issues.

    Usage:
    To dump a .CTPK file: ctpktool.exe file.ctpk
    To create a .CTPK file from a folder (folder most contain .xml files generated while dumping): ctpktool.exe foldername

    It's really simple.

    Source code (C#): https://github.com/polaris-/ctpktool
    Binary: https://github.com/polaris-/ctpktool/releases
     
    maorninja, Joel16, Zidapi and 11 others like this.
  2. arbalest876

    arbalest876 Advanced Member
    Newcomer

    Joined:
    Oct 7, 2014
    Messages:
    54
    Country:
    Switzerland
    I open an .txp file in UE,and I think it should be a ctpk file.(look at the picture)
    But I can't use ctpktool to dump it.The tool says"Not a valid ctpk file".
    Even I cut the beginning of the txp file.The tool still doesn't work.
     

    Attached Files:

    • txp.png
      txp.png
      File size:
      5.1 KB
      Views:
      933
  3. Anton299

    Anton299 GBAtemp Regular
    Member

    Joined:
    Jan 18, 2012
    Messages:
    125
    Country:
    Ukraine
    Could you please make the same tool for .CTXB and .B(FLIM) formats?..
    Normmatt's Texturipper is able to extract PNG from that files, but I couldn't find any tool on this planet that is able to convert PNGs back to CTXB & BFLIM... :(
     
  4. Asia81

    Asia81 GBAtemp Guru
    Member

    Joined:
    Nov 15, 2014
    Messages:
    5,953
    Country:
    France
    nice, thank you
     
  5. Nagato

    OP Nagato GBAtemp Advanced Fan
    Member

    Joined:
    Jul 15, 2011
    Messages:
    535
    Country:
    United States
    That's not a valid CTPK file on its own. The data is compressed. You need to decompress it before it'll work. You can use DSDecmp (3DSExplorer has a DSDecmp tool built in) to decompress the data.


    Norrmatt's tool searches the input data looking for any valid image data, regardless of what the overall format is. So I won't be making a tool for .CTXB or .B(FLIM) files unless I'm required to for a personal project.
     
  6. Anton299

    Anton299 GBAtemp Regular
    Member

    Joined:
    Jan 18, 2012
    Messages:
    125
    Country:
    Ukraine
    I'm translating Zelda ALBW and Oot3D, but got stuck with that graphics... it's need to be translated too.
    Sad... But thanks for answering, anyway.
     
  7. Dan_Tsukasa

    Dan_Tsukasa GBAtemp Regular
    Member

    Joined:
    Oct 14, 2014
    Messages:
    178
    Country:
    United States
    If I remember correct this is LZ7 compressed, so decompress that then use OP's tool and everythings sorted.

    Those files are from One of the Level 5 games are they not? If I remember correctly Attack of theFriday Monsters looked exactly like that.
     
  8. arbalest876

    arbalest876 Advanced Member
    Newcomer

    Joined:
    Oct 7, 2014
    Messages:
    54
    Country:
    Switzerland
    I use DSDecmp to decompress it successfully,thank you.But,when I try to decompress another txp file,DSDecmp says "No suitable decompressor found for xxxx.txp"(look at the attach)

    No,it's the images from BNGI's Taiko no Tatsujin.
     

    Attached Files:

  9. Smariter

    Smariter Member
    Newcomer

    Joined:
    Dec 23, 2014
    Messages:
    29
    Country:
    That's compress with LZ-11
     
  10. Dan_Tsukasa

    Dan_Tsukasa GBAtemp Regular
    Member

    Joined:
    Oct 14, 2014
    Messages:
    178
    Country:
    United States
    Ah LZ7, I always get confused between 11 and 7.
     
  11. Nagato

    OP Nagato GBAtemp Advanced Fan
    Member

    Joined:
    Jul 15, 2011
    Messages:
    535
    Country:
    United States
    You'd probably be better off using this: http://www.romhacking.net/utilities/826/
    I think since it starts with 11 then you should probably use the lzx tool.
     
  12. ninb

    ninb Member
    Newcomer

    Joined:
    Apr 23, 2015
    Messages:
    43
    Country:
  13. DJPlayer

    DJPlayer Banned
    Banned

    Joined:
    May 21, 2015
    Messages:
    542
    Country:
    Netherlands
    is there a way to rebuild ctpk-files with etc1 (Ericsson Texture Compression 1)?
    Fire Emblem If is using this Compression for ctpk-files and other image-files but ctpktool seems to use another compression.
    I tried to use a rebuilt FIle (with no etc1 compression) ingame but it does not work properly...
     
  14. jaxx21

    jaxx21 Member
    Newcomer

    Joined:
    Jun 24, 2007
    Messages:
    20
    Country:
    France
    hi, for me, its for Dragon ball Z Ultimate Mission 2 card game. i try to decompress with cptk tool and i have an error:
    Code:
    Converting D:/work/TAG2/svn/trunk/Projects/WorkData/2D/CARD/GB-01_F.rotate.tmp.tga...
    
    Exception non gérée : System.UnauthorizedAccessException: L'accès au chemin d'accès 'D:\work\TAG2\svn\trunk\Projects\WorkData\2D\CARD' est refusé.
       à System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       à System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
       à System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
       à System.IO.Directory.CreateDirectory(String path)
       à ctpktool.CTPKEntry.ToFile(String outputFolder)
       à ctpktool.Ctpk.Read(Byte[] data, String filename)
       à ctpktool.Ctpk.Read(String filename)
       à ctpktool.Program.Main(String[] args)
    there are others file for menu and others, and it works. But for cards game, nothing work. Somebody know why? Thx.
    here is a 2 files from the game. 2 file for one card (i dont know why).
    http://www.mediafire.com/download/l6k64xut3msqe76/Card.rar

    with hex editor i can see the address D: error

    — Posts automatically merged - Please don't double post! —

    ho, its ok now, i just change letter D to C and it work. tsss. thx :)
     

    Attached Files:

  15. CaesarMoonSama

    Newcomer

    Joined:
    Mar 4, 2014
    Messages:
    7
    Country:
    France
    Hi, I have some issues with some ctpk files, they do not want to unpack.
    This always happens with the games of the same company: Furyu.
    This is for the translation of the game Cardfight Vanguard G Stride to Victory.
    Here, a ctpk from this game: http://www.filedropper.com/bt01001f
     

    Attached Files:

  16. szh

    szh Member
    Newcomer

    Joined:
    Aug 22, 2009
    Messages:
    47
    Country:
    Senegal
    The file is compressed with gzip. I deleted the first 4 bytes and was able to decompress it.
    However, the resulting file still does not work with ctpktool. I get this error:
    Code:
    Converting ...
    
    Unhandled Exception: System.ArgumentException: The path is not of a legal form.
       at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPath
    Length, Boolean expandShortPaths)
       at System.IO.Path.GetDirectoryName(String path)
       at ctpktool.CTPKEntry.ToFile(String outputFolder)
       at ctpktool.Ctpk.Read(Byte[] data, String filename)
       at ctpktool.Ctpk.Read(String filename)
       at ctpktool.Program.Main(String[] args)
    Looking at the CTPK file in a hex editor, I don't see the filename on the right. I assume (from guessing at the source code :X ) ctpktool is trying to create a file with an invalid filename, perhaps?
    upload_2016-2-9_1-3-42.png

    Any help would be appreciated!
     
  17. CaesarMoonSama

    Newcomer

    Joined:
    Mar 4, 2014
    Messages:
    7
    Country:
    France
    Thanks for your reply. And for discover the gzip compression.
    I tested what have you did and it works like you.
    I tested to insert a filename in the file, the tool extract it but the result is corrupt...
    Someone could help?
     
  18. szh

    szh Member
    Newcomer

    Joined:
    Aug 22, 2009
    Messages:
    47
    Country:
    Senegal
    Insert it at the correct position, offset 44 onwards.
    upload_2016-2-11_12-3-40.png

    And it should extract with ctpktool. I got this from common/continue00.ctpk (although I'm trying to do this for Ride to Victory, not G Stride to Victory). This is the image of the main menu, I think.
    continue00.png

    I modified the image, but don't yet know how to repack it back into 3DS format. I tried and it crashes on my 3DS :(
     
  19. HenryLeonheart

    HenryLeonheart GBAtemp Regular
    Member

    Joined:
    Apr 10, 2014
    Messages:
    157
    Country:
    Has anyone repacked images to ctpk format from FE:Fates yet? I've been trying to but it's not working.
     
  20. CaesarMoonSama

    Newcomer

    Joined:
    Mar 4, 2014
    Messages:
    7
    Country:
    France
    Can you show us a file to repack and the process you used to modify it?
     
    Last edited by CaesarMoonSama, Feb 20, 2016
Loading...

Hide similar threads Similar threads with keywords - [Release],