Xenoblade Chronicles 3D Save Compression

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by moosehunter, Apr 2, 2015.

  1. moosehunter
    OP

    moosehunter GBAtemp Regular

    Member
    200
    2
    Nov 26, 2008
    United States
    It appears that Xenoblade 3D uses a similar or identical format to the Wii version, but the save files are compressed with a format I haven't seen before. The header starts with !qbz. I've uploaded some compressed and uncompressed samples in the hopes that somebody more experienced than me might be able to help.
     

    Attached Files:

  2. Kaphotics

    Kaphotics badc0ded

    Member
    611
    460
    Sep 10, 2010
    United States
    quick glance

    0xC header:
    4byte magic
    uint uncompressed size
    uint compressed size

    data
    byte 4F
    uint size
    uint uncompressed size
    ...

    if I had to take a guess it'd be some form of bzip if endianness is considered
     
    Thelostrune and cearp like this.
  3. moosehunter
    OP

    moosehunter GBAtemp Regular

    Member
    200
    2
    Nov 26, 2008
    United States
    It does seem to swap each word of the original file. After the first 0x20-ish bytes it would only be compressing zeros. What algorithm might give the data that repeats the way it does in the compressed file?
    Compressed file
     
  4. amrenj

    amrenj Member

    Newcomer
    15
    14
    Jun 26, 2011
    Anyone managed to figure this out?
     
  5. MK73DS

    MK73DS GBAtemp Fan

    Member
    313
    121
    Feb 23, 2015
    France
    France
    Hi,

    I'm trying to figure out how to decompress XB3D saves, but I'm not very good at this :(
    I tried a lot of methods, zlib, bz2, gzip ... without success :(

    I found some things, I think that the 0x8B first bytes aren't compressed. I found in this "header" some similarities with the uncompressed Wii version (some "magic" numbers in common, they are just reversed), and we can clearely see the name of the characters so this part doesn't seem to be compressed.
    Then, at 0x8C, there are 4 bytes which are the same (only for non empty save ?) : CE FA ED FE
    I googled it without succes, I only was able to find that this is the magic number of some old mac binaries or whatever :/

    Here is a screenshot with some of the similarities I was able to find :
    Warning: Spoilers inside!


    If anyone can help us it would be very great :)

    Thank you :)
     
  6. MK73DS

    MK73DS GBAtemp Fan

    Member
    313
    121
    Feb 23, 2015
    France
    France
    Please if anyone can help us I spent all the day searching and browsing and I didn't find anything :(
     
  7. WulfyStylez

    WulfyStylez SALT/Bemani Princess

    Member
    1,149
    2,609
    Nov 3, 2013
    United States
    For the record, these saves seem to be compressed with Nintendo's proprietary CX compression, in the Huffman mode. AFAIK there's no public tools to handle this type of CX compression, though it could readily be reversed from the game code itself or the wii or 3DS SDKs (for symbols).

    EDIT: Actually dug into the executable and it seems to be some home-grown RLE encoding, if I can get the time I'll fully RE it and release a tool for compression/decompression.
     
    Last edited by WulfyStylez, Mar 19, 2016
    MK73DS and RainThunder like this.
  8. MK73DS

    MK73DS GBAtemp Fan

    Member
    313
    121
    Feb 23, 2015
    France
    France
    Thank you very much :D
     
  9. cualquiercosa327

    cualquiercosa327 Advanced Member

    Newcomer
    93
    11
    Mar 24, 2009
    Thanks!
    It would be great if were someway to share the savefile between both versions (somekind of Sony's "Cross Save").I did some research and it was already a tool for extract,compress,uncompres and add the wii version.
    Also found a n3ds save file extracted.

    I tried some test but i fail .Maybe it can help
    The only i found was :
    1-Both has the 3 monado0x files but n3ds had a extra file called "specialmode"). Wii had no the "special mode" file
    2-the wii version was much larger than the same n3ds files

    3-The magic number is diferent betwen both,but the rest of initial chunks are identical
    Here i put the original links i used as reference (it had the source code ):

    https://www.mediafire.com/folder/9jdbd1xwmi6gw/Xenoblade

    from

    https://forums.dolphin-emu.org/Thre...nicles-v5-0u-may-17-2014?pid=317059#pid317059

    https://forums.dolphin-emu.org/Thread-xenoblade-save-file-tools

    and here the info/files i found of n3ds:

    https://gbatemp.net/threads/request-xenoblade-chronicles-3d-save-editor.398912/


    Yours
    Dani
     
    Last edited by cualquiercosa327, Mar 20, 2016
  10. WulfyStylez

    WulfyStylez SALT/Bemani Princess

    Member
    1,149
    2,609
    Nov 3, 2013
    United States
    Xenoblade saves on 3DS seem to be identical to the Wii version actually, except for that layer of compression. The decompressed size is the same as a Wii save. Given compress/decompress tools I bet there's a pretty good chance you could move a save back and forth.
     
    popokakapetu and Thelostrune like this.