0
\$\begingroup\$

I'm trying to mod the game Chocolatier from 2007. It has two .xml files, but they don't look like conventional XML when I open them in VS Code or Notepad++. Here's a sample of what they look like:

strings.xml strings.xml with many non-text characters

settings.xml settings.xml with many non-text characters

In the comments, Quentin suggests that both files' contents beginning with the characters "ZXML" could mean this data is compressed in "Cubetto 5.0 Compressed Document Format".

If that's the case, how can I decompress and read these files, or re-compress my modded files back to this format?

\$\endgroup\$
10
  • \$\begingroup\$ the file extension does not have to correspond to the file content. It looks like the file content is some form of binary. \$\endgroup\$
    – Raildex
    Mar 20, 2023 at 11:14
  • 2
    \$\begingroup\$ Many games use their own file formats. You might get better help in a community specifically about modding the game you are talking about. \$\endgroup\$
    – Philipp
    Mar 20, 2023 at 11:19
  • \$\begingroup\$ And if it is some form of binary, they could have added all the textures inside that xml as well. Everything is in the end a combination of 0 and 1, nothing would prevent the game makers to merge all their assests into one file \$\endgroup\$
    – Zibelas
    Mar 20, 2023 at 12:24
  • 2
    \$\begingroup\$ The common ZXML magic string could be a good hint, a quick search points to it being a "Cubetto 5.0 Compressed XML Document". \$\endgroup\$
    – Quentin
    Mar 20, 2023 at 12:37
  • 3
    \$\begingroup\$ Please tell us more about the game, including its name! \$\endgroup\$
    – Vaillancourt
    Mar 20, 2023 at 18:43

1 Answer 1

0
\$\begingroup\$

Please note that I can't know for sure that the programs linked through this post are "safe" for your computer; I always play with those files within a Virtual Machine to avoid most risks.


Ultimately, those "xml" files are compressed with zlib. The fastest way to take the data out is to use an hexadecimal editor (I use HxD) and remove the first 12 bytes, stopping just before 78 DA. Then, using a python script like the following:

import zlib

f = open('strings.xml', 'rb')
decompressed_data = zlib.decompress(f.read())
f.close()

f2 = open('out.strings.xml', 'wb')
f2.write(decompressed_data)
f2.close()

You'll find the XML file in out.strings.xml. You'll realize that it contains lots of Excel related stuff, so you could open it right away with Excel and voilà!

But that's not exactly what you're after if you want to modify the strings. To do so you'll have to work harder and install QuickBMS and run a couple of scripts, one for extracting:

idstring "ZXML"
get ZSIZE long
get SIZE long
savepos OFFSET
get NAME filename
clog NAME OFFSET ZSIZE SIZE

and one to re-compress it:

comtype zlib_compress
get SIZE asize
log MEMORY_FILE 0 0
putdstring "ZXML" 4 MEMORY_FILE
put 0 long MEMORY_FILE
put SIZE long MEMORY_FILE
savepos OFFSET MEMORY_FILE
append
clog MEMORY_FILE 0 SIZE SIZE
append
get ZSIZE asize MEMORY_FILE
math ZSIZE - OFFSET
goto 4 MEMORY_FILE
put ZSIZE long MEMORY_FILE
get NAME basename
string NAME + ".zxml"
get SIZE asize MEMORY_FILE
log NAME 0 SIZE MEMORY_FILE

I have tried the one to decompress it (it works!) but I have not been able to test the other one.

It is not a Cubetto file, it's rather a "custom" file format, likely made to 1) hide data to make tampering harder 2) make the loading of the game faster.

I'm not a pro-hacker, and as you see, I did not come up with those scripts myself. I admit that my search-fu is strong, though. Visiting the forum I've linked to will make you realize that you're not the first one in your situation. You'll also find information to figure out other file formats so you can further mod your game.

P.S. gamedev.stackexchange.com is not really the best place to ask this type of questions; it often requires back-and-forth between users, and game reverse engineering enthusiasts are pretty rare. What makes things even more complicated (at least for folks like me) is that I don't want to install shady stuff on my workstation so I have to work from within a virtual machine to use all the "hacking" tools available on the Internet, and also the access to the game files is pretty difficult, as you realized in the comments.

P.P.S. For what it's worth, I found the MacOS version through here, and the files are not compressed like for the windows version, so that could give you a hint about what you'll find in there.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Hi @Vaillancourt! I appreciate your reply a lot, I didn't really consider someone will really help with that, though it seems beyound my knowledge complecated but I'll try my best. And yeah, I've checked the Mac version and there indeed all the normal files are open for editing. Thanks you a lot! \$\endgroup\$
    – user4068
    Apr 8, 2023 at 9:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .