convert PNG to CTPK with ETC1(a4) compression?

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by DJPlayer, Jul 10, 2015.

  1. DJPlayer
    OP

    DJPlayer Banned

    Banned
    542
    186
    May 21, 2015
    Netherlands
    Hey Guys,

    I want to know if there's a tool to convert PNG to CTPK with ETC1(a4) compression.
    RIght now, I'm working on a Translation Patch of Fire Emblem Fates with some other guys but I want to work on a private project, too.
    At the moment, I want to Recolor some Images used for Live2D (pat your waifu) but they're ctpk-files with ETC1a4 compression.
    I also want to try to add a new character / custom character in Live2D but I need a way to recompress this ctpk-files.
    I'm able to decompress the ctpk-files to png files with ctpktool but ctpktool doesn't support recompression to ETC1(a4).
    The recompressed files with ctpktool (like it is at the moment) are compressed with Rgba4 which isn't supported by the game.

    Could someone help me out with this?
     
  2. DJPlayer
    OP

    DJPlayer Banned

    Banned
    542
    186
    May 21, 2015
    Netherlands
    Someone who knows how to do that? COuld someone help me with this?
     
  3. Kaphotics

    Kaphotics badc0ded

    Member
    611
    460
    Sep 10, 2010
    United States
    Would there be a way to change the pixelformat to RGBA8888? That trick works for bclims.
     
  4. DJPlayer
    OP

    DJPlayer Banned

    Banned
    542
    186
    May 21, 2015
    Netherlands
    not sure :/ bclimtool supports more than one compression method, ctpktool only supports Rgba4-Compression.
    When I use Rgba4-compressed ctpk-files, they are looks like "stripes of corrupted stuff"
     
  5. Gericom

    Gericom GBAtemp Advanced Fan

    Member
    857
    908
    Jun 30, 2011
    Netherlands
    EFE can create bclim files with ECT1A4 compression, so you could use that, and copy the data over.
     
  6. DJPlayer
    OP

    DJPlayer Banned

    Banned
    542
    186
    May 21, 2015
    Netherlands
    Could you explain how I can copy the Data over? would be awesome :)

    Example of edited files: http://www.file-upload.net/download-10760260/------------_1.rar.html

    I'm not very familiar with developing tools like this, especially with Code written by others^^'
     
    Last edited by DJPlayer, Jul 12, 2015
  7. DJPlayer
    OP

    DJPlayer Banned

    Banned
    542
    186
    May 21, 2015
    Netherlands
    still need help with this ._.
     
  8. Rusb

    Rusb GBAtemp Regular

    Member
    138
    56
    Apr 17, 2014
    https://github.com/polaris-/ctpktool

    I don't know what version are you using, but I've compiled this.

    When you make a conversion from CTPK image, you generate a folder with the image and xml files, for reconvert the image to CTPK, you only have to put the command:

    ctpktool.exe "Foldername"

    as it's said in Readme.md
     
  9. DJPlayer
    OP

    DJPlayer Banned

    Banned
    542
    186
    May 21, 2015
    Netherlands
    This is the tool I've used. It does not repack the file back with ETC1a4 compression.
    Decompression of the files of Fire EMblem If does not work with CTPK-Tool. I used FEAT instead.
    This xml-file was created
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <Entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <InternalFilePath>R:/graphics/3D/L2D/ch126_カザハナ_KAZAHANA/カザハナ.1024/texture_01.tga</InternalFilePath>
      <RealFilePath>texture_01.png</RealFilePath>
      <Format>13</Format>
      <MipLevel>1</MipLevel>
      <Type>2</Type>
      <Unknown>0</Unknown>
      <BitmapSizeOffset>16</BitmapSizeOffset>
      <Info>1048576</Info>
      <Info2>117506317</Info2>
      <HasAlpha>true</HasAlpha>
    </Entry>
    FEAT uses the original source of ctpk-tool

    the original ctpk-filesize is: 1.048.832 Bytes
    The rebuilt filesize with ctpk-tool is: 4.194.560 Bytes
    the rebuilt filesize with FEAT is: 4.194.560 Bytes (the same like ctpktool)

    I heard that ctpktool rebuild files with RGBa4 only.
    Fire Emblem If does not support this compression.
    That's why I need a way to rebuild the file with ETC1a4 encryption
     
  10. DJPlayer
    OP

    DJPlayer Banned

    Banned
    542
    186
    May 21, 2015
    Netherlands
    Okay finally I found a way to create ctpk-files with etc1a4 compression!
    There's no tool For it yet, I did it with hex-editing.
    There's a fast-created example.
    [​IMG]
     
  11. DeathChaos25

    DeathChaos25 Unmei wo kaeru!

    Member
    1,312
    671
    Oct 21, 2015
    bumping this in hopes that someone has figured something out.
     
  12. DarkSynopsis

    DarkSynopsis GBAtemp Fan

    Member
    408
    240
    Oct 15, 2014
    New Zealand
    New Zealand
    I guess I figured it out like a month back now but since it was pain in the ass process I didn't bother posting about it since I didn't see many people ask about it, last couple of days though I've seen Fates CTPK editing come up so here is the tutorial I captured.



    Hope it helps and makes sense :P
     
    RainThunder and DeathChaos25 like this.
  13. DeathChaos25

    DeathChaos25 Unmei wo kaeru!

    Member
    1,312
    671
    Oct 21, 2015
    Will try once I get my 3DS back in working order.