Program to decompress Powder Toy Saves?

  • Roberttherobot
    21st Jan 2021 Member 0 Permalink

    Hello! I have been archiving some Powder Toy Saves and I have been wondering if there is a program to decompress (or documentation in general) of the .CPS format. The reason I want them decompressed is that I wish to store them in a compressed archive and I have reason to believe that compression formats will compress better if they are uncompressed as it can compare a large number of files to one another thus saving tons of data. if anyone has any hints on the sections of code which decompress and compress a save I would be greatful.

    Edited once by Roberttherobot. Last: 21st Jan 2021
  • LBPHacker
    21st Jan 2021 Developer 0 Permalink
    OPS1 (the format used in .cps saves) decompression happens here. It's all rather trivial; the first 12 bytes of the file form a header: 4 bytes of magic (OPS1), then four bytes encoding client version, cell size, width and height, followed by an uint32be that tells you the original size of the (non-conformant) BSON document whose BZ2-compressed form follows the header and continues until the end of the file.
  • Roberttherobot
    21st Jan 2021 Member 0 Permalink

    @LBPHacker (View Post)

     I am a noob with C, it looks like you used the command line to decompress the file? I have bunzip2 installed, could you guide me on what you did to uncompress the .CPS  as bunzip2 says that its not a bzip2 file (which makes sense as you mentioned a header). TLDR: What commands did you use to uncompress .cps in the command line? Im sorry if this question sounds stupid I honestly am a noob at C

  • LBPHacker
    21st Jan 2021 Developer 0 Permalink
    The commands are right there in the paste >_> I just chopped off the header with dd.
  • Roberttherobot
    21st Jan 2021 Member 0 Permalink

    @LBPHacker (View Post)

     I am blind, sorry XD, let me try now, Thank you! I'm going to write a python script to be able to uncompress and then compress adding back the header

    Edited once by Roberttherobot. Last: 21st Jan 2021