Log in

View Full Version : [Release] XCOM Enemy Unknown Compression Toolkit



fairchild
10-10-2012, 05:41 PM
Yet again a compression toolkit, this time for XCOM Enemy Unknown...

To use this toolkit you must first extract the savegame from within the xbox 360 container (CON), then use this toolkit on the extracted file. If you try to use this on the CON file itself it will give you a warning.

This is not a click 'n play tool, you need to use it from the Command Prompt or any other methods that handles this tool.





▄ ▄▄▄▄▄▄▄ ▄ █▀▀▀▀ ▀▀ ▀ ▄▄▄▄▄▄▄▄ ▀▄▄▄▄ ▄
▄▄▄▄▄▄ ▀ ▄▄▄▄▄▄█▀▀▀▀▀█ ▄▄▄▄▄▄ ▀ █▀▀▀▀▀▀█ █▀▀▀▀▀▀ ▄▄▄▄ █▄▄▄▄▄▄▄▄
▄▄█▀▀ ▄▄ ▀█▀▀▀ ▄▄ ▀▀ ▀▀▀ █▀▀ ▄▄ ▀▀█▄ ▀ █▀ ███▀̦ █ ▀▀▀▀ ████ ▄██ ▄▄▄▄ ▀█
▀ ▀▀ ▄▄██▀█▓▄ ▄▄██▀█▓▓▄ ███ ▄▄██▀██▓▄ █▀▀▀▀█ ███¦ █▄▄¦Ì███¦Ì███¦Ì███▄Ì███¦ ▄
▄▓▓██▀ ▀▀▄██▀ Ì██▓¦Ì██¦▄██▀ Ì██▓¦ ▄▄█▓▄ Ì████▄▄▄ ▓███ ████ █ ▄▄▄▄███▓
Ì▓██¦ ░ Ì▓██¦ ▀▀████ ███ ▓█¦ ▄███▀▄███▀ ▓███ ▀██▓▓ ██¦Ì███¦ ▄███▀ Ì██▓¦
▓███▀ █ ▓███ ░Ì███¦Ì██▓ ███ ░▀▀ Ì▓██¦ ▄¦Ì▓██¦Ì¦Ì██▓¦Ì█ ████ Ì▓██¦ ▄██▓▓▀
▀ Ì███¦Ì█¦Ì███¦ ▀▀▀▀ ▀▀ Ì███¦ ▀ ▀▓██▄██ ▀▀▀▀ ██ ███▓ Ì▓██¦ ▀▓██▄██▀▀ ▄▄ ▄
█ ▀▀▀▀ ██ ▀▀▀▀ █▀▀▀▀▀▀█▄ ▀▀▀▀ █▀█▄▄ ▀▀ ▄▄█▀▀▀▀█¦Ì███¦Ì ▀▓▓██▄░ ▀▀ ▄▄█▀▀
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▄ ▀ ▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀ !f █ ▀▀▀▀ ██▄▄ ▀▀▀▀ █▀▀▀▀
▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀ p r e s e n t s . . ▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀ █▀ ▀
▀ ▀▀▀▀▀ ▀ ▀

XCOM Enemy Unknown Compression Toolkit by fairchild
================================================== ===== version 0.1.6 ===

Usage: xcom.exe [options] <input> <output>

Options:
-d - Decompress.
-c - Compress.


Release notes:

Yet again a compression toolkit, this time for XCOM Enemy Unknown...

To use this toolkit you must first extract the savegame from within the
xbox 360 container (CON), then use this toolkit on the extracted file.
If you try to use this on the CON file itself it will give you a warning.

This is not a click 'n play tool, you need to use it from the Command Prompt
or any other methods that handles this tool.

Update:
* v0.1.6 - Added support for additional security check for PC savegames.
* v0.1.5 - Added support for PC savegames.

WARNING!

Always backup your saves, this tool may corrupt remove your savegames.


Decompress
==========

Now to decompress a savegame you run the application by entering the following:

* <PTEF> = the path to the extracted files, ex: c:\test

<PTEF>\xcom.exe -d <PTEF>\<my savegame filename> <PTEF>\save.decompressed

Example: c:\test\xcom.exe -d c:\test\save1 c:\test\save1.decompressed

The toolkit will process the savegame and decompress it's compressed data block
to the file names "save1.decompressed".

Open "save1.decompressed" in your favorite hex editor :-)


Compress
========

To compress and inject the uncompressed blocks back into your savegame use the
following command:

NOTE: !! make a copy of your orginal savegame !!

* <PTEF> = the path to the extracted files, ex: c:\test

<PTEF>\xcom.exe -c <PTEF>\save1.decompressed <PTEF>\save1

Example: c:\test\xcom.exe -c c:\test\save1.decompressed c:\test\save1

This will take the decompressed block, named "save1.decompressed" and
compress them, rebuild the package to a file named "save1.rebuilt".

The file to inject back into your CON file is the file ending with ".rebuilt" !


NOTE:

Always make backup of your savegames!!

Have fun :-)

pinoyballer
10-10-2012, 05:45 PM
it wont open...

oh wait nvm haha :)

CloudStrife7x
10-10-2012, 05:48 PM
excellent work on this toolkit fair :053:, i would try but i dont have the game >.> lol

Genepool
10-10-2012, 05:59 PM
Thanks for this! Looking forward to altering some stuff after I finish my legit playthrough

Renegade
10-10-2012, 06:01 PM
Fairchild strikes again!

Brotherivx
10-10-2012, 08:24 PM
Great Awesome work! Question how do I go about finding ALien Alloys and etc. in the Hex editior

kamokilla
10-11-2012, 05:00 AM
no checksum?

thegutta
10-11-2012, 06:33 AM
Excellent job on the tool Fairchild :)

fairchild
10-11-2012, 07:11 AM
no checksum?

No checksum protection on the savegames.

avroskin
10-11-2012, 09:37 AM
how did you open it ?? Mine is opening but suddenly shut down. :/

Idlehands88
10-11-2012, 09:41 AM
how did you open it ?? Mine is opening but suddenly shut down. :/

Please take the time to read the original post BEFORE you make a post...


This is not a click 'n play tool, you need to use it from the Command Prompt
or any other methods that handles this tool.

Wimm
10-12-2012, 01:17 AM
how you get it to work. when i click on it it goes away.

Brotherivx
10-12-2012, 01:36 AM
You run it from Cmd prompt.

poppin fresh
10-12-2012, 01:44 AM
This doesnt work for me at all. I followed the instructions exactly, but all I got was an error and it doesnt work.

Kenix
10-12-2012, 01:51 AM
i fear i may be doing something wrong i follow the command prompt but fail to create the *.d file in question. itll recognize compression but wont allow me to decompress the save2 file into a save2.d

Brotherivx
10-12-2012, 01:59 AM
i fear i may be doing something wrong i follow the command prompt but fail to create the *.d file in question. itll recognize compression but wont allow me to decompress the save2 file into a save2.d

Open your save in Horizon or Modio then click contents extract that save#. What i do is open CMD prompt drag xcom.exe into the cmd first. press spacebar, type -d, then drag your save file to cmd, space again drag the same save file again then type .d after. So it looks like save2.d at the end of the line.

Learning
10-12-2012, 05:04 AM
I got it to work once then it froze the editor so I try it again and now its telling me "-d is not recognized as an internal or external command, operable program or batch file". How the fuck does it forget

nvm figured it out. Your not supposed to execute the .exe until you have everything typed out

ThisGuyP1469
10-12-2012, 05:23 AM
Open your save in Horizon or Modio then click contents extract that save#. What i do is open CMD prompt drag xcom.exe into the cmd first. press spacebar, type -d, then drag your save file to cmd, space again drag the same save file again then type .d after. So it looks like save2.d at the end of the line. Yeah this seems what a lot of people are doing wrong, after draging the exe into the cmd, dont hit enter in tell you filled out everything. Like said by Brotherivx. Worked great after i read this! Thanks!

Kenix
10-12-2012, 05:23 AM
i wrote out in command prompt as: "xcom.exe -d save2 save2.d" the response from the program reads as: "open input file: save 2" followed by: "file size: 0x00029000 <167936>", then: "reading buffer from file, done" and lastly (in red): "! XBOX360 container detected"

this is the message i constantly get still it doenst yield the save2.d file. so im guessing im still doing something wrong

i wrote the file out as: "xcom.exe -d save2 save2.d" and still got that above message

ThisGuyP1469
10-12-2012, 05:34 AM
i wrote out in command prompt as: "xcom.exe -d save2 save2.d" the response from the program reads as: "open input file: save 2" followed by: "file size: 0x00029000 <167936>", then: "reading buffer from file, done" and lastly (in red): "! XBOX360 container detected"

this is the message i constantly get still it doenst yield the save2.d file. so im guessing im still doing something wrong

It's because your loading the wrong file, Your loading the whole save, from horizon. Drag that save onto horizon and click on the contents tab.. ( like said in the OP ) and use the extracted save.2 then it will work and you wont get that "! XBOX360 container detected" message

pedicata
10-12-2012, 05:49 AM
To the Creator of the Toolkit:
It works perfectly - thank you!

I thought your directions and warning were fine and had no trouble following them.

Kenix
10-12-2012, 06:49 AM
It's because your loading the wrong file, Your loading the whole save, from horizon. Drag that save onto horizon and click on the contents tab.. ( like said in the OP ) and use the extracted save.2 then it will work and you wont get that "! XBOX360 container detected" message


how do i get the save.2 file back to something horizon will recognize? i extracted it as save.2 but cant seem to figure out how to send it back as save2

Brotherivx
10-12-2012, 06:20 PM
how do i get the save.2 file back to something horizon will recognize? i extracted it as save.2 but cant seem to figure out how to send it back as save2

Open the Main save in horizon again click contents right click in the contents box options will come up. Click replace file and replace it with save#.d.rebuilt

Serious_M
10-12-2012, 06:57 PM
nice job on this new toolkit fairchild

jdmaxwell
10-13-2012, 03:19 AM
ok im kinda of dumb when in comes to cmd promt stuff but i followed all the instructions and it says all done but my file did not change or i cant find the file that did change


nvm got it working

gypsy hot head
10-13-2012, 04:08 AM
Decompressing and compressing worked, but here is the bad news....The mod tool is very unstable for me, it 80% of the time stops responding. when it does load up it freezes about half the time after you change things, the even after you do eveything as instructed to the "T" the game loads up but when you try to load the save game the system freezes. I hope they can get it to work better I know I can't but they are smart so I am pretty sure they will creat a better alternative

Kenix
10-13-2012, 05:25 AM
Open the Main save in horizon again click contents right click in the contents box options will come up. Click replace file and replace it with save#.d.rebuilt

thanks for the more detailed explanation. that seem to have done the trick

a1handedbandit
10-14-2012, 02:26 AM
Ok I honestly dont have a clue how to use command prompt and I can't even make sense of the directions. Can anyone break it down into something similar?

acehood
10-14-2012, 03:54 AM
thanks dude.

TheMasterOfLife
10-15-2012, 12:13 AM
I cant for the life of me comprehend the instructions, Can someone break it down for a less tech savvy person?

kobo
10-16-2012, 01:43 PM
it wont open please tell me how to open it do i have to run as administrator or what :0

pooloflave
10-17-2012, 12:41 AM
Program seems to stop responding every time i try to decompress my save. This is what it looks like when i am decompressing

http://pixldrop.com/drops/Image_2012-10-16_at_19.38_.07_PM_.png

These are the lines i am using
http://pixldrop.com/drops/Image_2012-10-16_at_19.40_.27_PM_.png

Can anyone help. Yes i extracted the save with the .con file with horizon.

EDIT: Nevermind, i was missing a "\".

kingj
10-17-2012, 01:33 AM
Wanted to say thx, took me a couple tries but it worked in the end!!!! Joined just to get this!

n.w.o.
10-17-2012, 07:47 AM
works fine :)

fantastic work, fairchild!!

thx again

kobo
10-17-2012, 10:17 AM
same with me :(

Game Wizard
10-17-2012, 10:53 PM
Cant seem to compress it back in ,do i do same steps for decompressing but instead of .d i use .c??

QuasiMod
10-18-2012, 11:34 AM
Hi,

I was just wondering is it possible to use this tool for PC version saves, I've tried and it says Unsupported file detected. Is it possible to fix this so it works for PC saves also? I know this is XBOX forum, sorry if it's inappropriate to ask for this.

Thanks

intex
10-18-2012, 11:06 PM
Thank you.

To make this work I had to compress the save in the same folder where I had decompressed.

Great job!

ogurets
10-19-2012, 02:49 AM
I was just wondering is it possible to use this tool for PC version saves, I've tried and it says Unsupported file detected. Is it possible to fix this so it works for PC saves also? I know this is XBOX forum, sorry if it's inappropriate to ask for this.
I'm eager to have that too! And, actually, was SO eager, that even did some work dissecting this format myself. Here's what I was able to discover:

First 1024 bytes of the save file are a constant-length block with descriptional strings and stuff. Not interesting for us and may be ignored.
Then, up to the end of the file goes an array of big blocks having the following format ([x] is a field length in bytes):
1. [4] Magic number: C1 83 2A 9E (or 0x9E2A83C1 in little-endian int32 format)
2. [4] A number, which was usually 00 00 02 00 for me (I think it is a buffer length used by the game to compress data).
3. [4] Length of a compressed block, which goes later (at field 7).
4. [4] Length of the decompressed data.
5. [4] A copy of field 3.
6. [4] A copy of field 4.
7. [Length from field 3] Compressed data. Looks like some kinda variation of LZ algorithm. Probably, LZO.

Fairchild, if you read this, please patch your program to work with this format!

Added: I did it! Turned out that the only difference between PC saves and XBOX saves were that the first one is little-endian, and the latter is big-endian. So I've reversed the byte order in fields 1-6 and used Fairchild's toolkit to decompress it!
The algorithm seems to be called LZX and is used in Xbox compression SDK. Finding the proper implementation of this one was a real pain in the ass and I didn't succeed so far, but there's no need for it now. I'll publish the source code of the PC<->XBox interconversion utility after a while.

Added 2: Too bad, but although it does the job on decompressing and recompressing the save, the rebuilt variant does not work in the game (and looks 40% smaller than the original). Maybe algorithms are different after all on Xbox and PC, but Fairchild's decompressor can understand both.
Anyway, here's the converter's code, as promised: http://pastebin.com/x7U9rAAx

QuasiMod
10-20-2012, 11:58 AM
Hi,

Thank you for dissecting the file, I've made a c# program to decompress save file (I'm using lzo.dll). I do get same result as fairchilds tool (except I add 1024 byte header at the top).
But I've bumped into same problem as you, I cannot find a proper algorithm to pack the file back, and the game always says the file is corrupted.
I cannot seem to find proper c# class library for LZX compression.
lzo.dll has dozens of compression functions, and all of them give bit different result, none of them pack exactly the same as original saved game.

So I'm stuck here for a time being.

Thanks again ogurets

Tokamak
10-22-2012, 11:32 PM
Thanks for this, works great!

devopurdue
10-23-2012, 04:29 PM
Followed the directions to a T

C:\Users\Devooo>C:\Users\Devooo\Desktop\borderlands\xcom.exe -d c:\xcom\save7 c:
\xcom\save6.decompressed

▄ ▄▄▄▄▄▄▄ ▄ ▀▀▀▀▀ ▀▀ ▀ ▄▄▄▄▄▄▄▄ ▀▄▄▄▄ ▄
▄▄▄▄▄▄ ▀ ▄▄▄▄▄▄█▀▀▀▀▀█ ▄▄▄▄▄▄ ▀ █▀▀▀▀▀▀█ █▀▀▀▀▀▀ ▄▄▄▄ █▄▄▄▄▄▄▄▄
▄▄█▀▀ ▄▄ ▀█▀▀▀ ▄▄ ▀▀ ▀▀▀ █▀▀ ▄▄ ▀▀█▄ ▀ █▀ ███▀▐▌ █ ▀▀▀▀ ████ ▄██ ▄▄▄▄ ▀█
▀ ▀▀ ▄▄██▀▓▓▄ ▄▄██▀█▓▓▄ ███ ▄▄██▀██▓▄ █▀▀▀▀█ ███▌ █▄▄▌▐███▌▐███▌▐███▄▐███▌ ▄
▄▓▓▓▓▀ ▀▀▄██▀ ▐██▓▌▐██▌▄█▓▀ ▐░░▒▌ ▄▄█▓▄ ▐██▓█▄▄▄ ▓██▒ ▒███ █ ▄▄▄▄███▓
▐▓▒░▌ ░ ▐▓▒░▌ ▀▀░░▒▒ ░░▒ ▓▒▌ ▄░██▀▄▒██▀ ░░▒█ ▀▀░▒▓ ▓░▌▐░▒▓▌ ▄█▓█▀ ▐▓█▓▌
▓░██▀ █ ▓░██ ░▐███▌▐██▓ ░░█ ░▀▀ ▐▓░▒▌ ▄▌▐▓██▌▐▌▐██░▌▐█ █░░▓ ▐▓░░▌ ▄█░▒▓▀
▀ ▐███▌▐█▌▐███▌ ▀▀▀▀ ▀▀ ▐███▌ ▀ ▀▓██▄██ ▀▀▀▀ ██ ███░ ▐▓██▌ ▀▓██▄██▀▀ ▄▄ ▄
█ ▀▀▀▀ ██ ▀▀▀▀ █▀▀▀▀▀▀█▄ ▀▀▀▀ █▀█▄▄ ▀▀ ▄▄█▀▀▀▀█▌▐███▌▐ ▀▓▓██▄░ ▀▀ ▄▄█▀▀
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▄ ▀ ▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀ !f █ ▀▀▀▀ ██▄▄ ▀▀▀▀ █▀▀▀▀
▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀ p r e s e n t s . . ▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀ ▀▀ ▀
▀ ▀▀▀▀▀ ▀ ▀

XCOM Enemy Unknown Compression Toolkit by fairchild
================================================== ===== version 0.1.0b ===

- Open input file: c:\xcom\save7
- File size: 0x000bc000 (770048)
- Reading buffer from file, done.
! XBOX360 Container detected.


This is what I get. I doesn't save the file. What is this 360 container detected?
Tried putting the file in different places still the same.

smoko400
10-23-2012, 04:41 PM
you have to drop the xcom.exe into cmd, hit space bar type -d hit space bar again then drop your extracted save7 content that you extracted from save hit space then drop it again and put .d at the end of it [ save7.d ]

QuasiMod
10-23-2012, 06:42 PM
Followed the directions to a T


! XBOX360 Container detected.

This is what I get. I doesn't save the file. What is this 360 container detected?
Tried putting the file in different places still the same.

Have you extracted your save file from container file (You can do that using Horizon, google it). Fairchild clearly states you have to extract save file before feeding it to his decompressor or you'll get a warning. You also have to repack your save later (after editing and using fairchild's tool with -c parameter) to container file.

Thanks

shinta101
10-23-2012, 07:17 PM
thanks for this can't wait to try it out

saurusmonster
10-25-2012, 08:00 AM
ogurets and Quasimod,

I tried reversing the 24 bytes you mentioned in multiple saved game files, in my case from

C1 83 2A 9E 00 00 02 00 45 7A 00 00 00 00 02 00 45 7A 00 00 00 00 02 00
to
9E 2A 83 C1 00 02 00 00 00 00 7A 45 00 02 00 00 00 00 7A 45 00 02 00 00

but fairchild's convertor says "gamesave file detected" but then just fails with app crash every time :(

any ideas?

jojo
10-25-2012, 09:14 AM
Can someone help me please,
when i am trying to decompress a savegame, eg save100,i got a error message saying:

C:\test>xcom.exe -d C:\test\save100 C:\test\save100.d

- Open input file: c:\test\save100
- File size: 0x0004dbc7 (318407)
- Reading buffer from file, done.
! Unsupported file detected!

what can i do in this case?

fairchild
10-26-2012, 08:24 AM
Can someone help me please,
when i am trying to decompress a savegame, eg save100,i got a error message saying:

C:\test>xcom.exe -d C:\test\save100 C:\test\save100.d

- Open input file: c:\test\save100
- File size: 0x0004dbc7 (318407)
- Reading buffer from file, done.
! Unsupported file detected!

what can i do in this case?

Looks like youre trying to use my tool with a PC savegame, this wasn't supported until version 0.1.5 (still untested) but it's available in the first post for anyone to try out.

QuasiMod
10-26-2012, 08:12 PM
Looks like youre trying to use my tool with a PC savegame, this wasn't supported until version 0.1.5 (still untested) but it's available in the first post for anyone to try out.

Hi Firchild,

First pf all BIG thanks for making a tool for XBOX users, all the kudos in the world.
Just here to report about PC support in 0.1.5: decompression seems to go just fine, but after recompression (without any changes) PC version of XCOM game does not load a file it says file is corrupted.

Thanks again for all your hard work.

P.S. Just hoped someone cracks file compression so to give a way for Save File Editor.

sukurudo
10-26-2012, 10:49 PM
This is a great tool! Are there any Modding tuts out there?

Doctor_Hyde
10-30-2012, 01:37 AM
Massive thanks to Fairchild for the excellent tool, but I'm wondering if anyone has any knowledge of hex editing.

I've found the values for: Rank, Psi Rank, etc. but trying to edit them screws with a lot of things in game... like characters having no head and re-setting abilities with no class... weird.

So yeah, if anyone has more knowledge of how/what to change, I'd appreciate it.

I'm looking to modify Psi Gift yes/no
Aim
Will
Rank (so I can rank them up at the beginning or relatively early with abilities I find useful)
Psi Rank (for same as above)

fairchild
10-30-2012, 08:20 AM
Cant seem to compress it back in ,do i do same steps for decompressing but instead of .d i use .c??

You should use the filename of your original savegame that you decompressed from, the tool needs some data from it but don't worry the modified savegame will ba named ".rebuilt" and will not overwrite your original savegame.

fairchild
10-30-2012, 08:30 AM
Hi Firchild,

First pf all BIG thanks for making a tool for XBOX users, all the kudos in the world.
Just here to report about PC support in 0.1.5: decompression seems to go just fine, but after recompression (without any changes) PC version of XCOM game does not load a file it says file is corrupted.

Thanks again for all your hard work.

P.S. Just hoped someone cracks file compression so to give a way for Save File Editor.

Hi, found additional security checks for the pc version, will update the tool and hopefully it's the last check.

Edit: I have now updated the toolkit to v0.1.6 and hopefully it will work now and thanks for testing it for me :-)

QuasiMod
10-30-2012, 01:17 PM
Hi, found additional security checks for the pc version, will update the tool and hopefully it's the last check.

Edit: I have now updated the toolkit to v0.1.6 and hopefully it will work now and thanks for testing it for me :-)

Hi Fairchild,

I've just tested 0.1.6 tool, sorry to bring bad news but I had no luck, now it displays (corrupted) before file name and no screenshot, loading is not possible.
Just a note: after repacking your file is approx 100 Kb in size, while original was 170K. You probably use some more potent compression because unpacking it again gives byte to byte identical files (unpacked).

Thanks.

fairchild
10-30-2012, 03:41 PM
Hi Fairchild,

I've just tested 0.1.6 tool, sorry to bring bad news but I had no luck, now it displays (corrupted) before file name and no screenshot, loading is not possible.
Just a note: after repacking your file is approx 100 Kb in size, while original was 170K. You probably use some more potent compression because unpacking it again gives byte to byte identical files (unpacked).

Thanks.

I'll see if i can get the game somehow to be able to better test and see whats going wrong by debugging the game, perhaps some other checksum or who knows.

Yes, i use LZO Professional when i re-compress the savegame. Theres no compatibility issues between them so that should not be the issue. The reason for the larger savegames from the game itself is that they want to preserve memory and thus using a light compression (less memory usage and faster).

The fight will continue ;-)

Cheers!

morbidone76
10-31-2012, 11:15 PM
Thanks for the tool

agnthvc
11-12-2012, 12:37 AM
IM STUCK AT REBUILDING THE FILE. i cant seems to get the save.rebuilt file help. NEVERMIND

morbidone76
11-12-2012, 02:39 AM
I will try to explain it. In the command prompt drag in the xcom.exe file just like decompressing. Then a space and then -c instead of -d. Another space then drag your save.d file next. Another space and then your original save. This should create the save.rebuilt file. Works for me using these steps.

After you have the save.rebuilt file replace the original file you extracted with the rebuilt one in Horizon/Modio and it should work. Good luck.

Modding_panda
11-17-2012, 11:05 AM
Hey, I'm currently having troubles trying to decompress the save file.
I'll explain the current sequence I have done.

1. Extracted the save file onto the desktop.
It currently reads as save1

2. Cmd. Started the xcom decompressing program.
Re-entered the xcom decompressing program. [space] -d [space] save1 and save1.d

And I get xbox 360 container detected in bright red.


*Managed to find the solution to this. &

faqurreg
11-24-2012, 01:09 AM
I am running across an issue on the PC. I only Change my amount of credits.

Using the compressed file was giving me an error message with the DLC content at first, saying it was missing "?INT?XComUISh.à’„UIFinalShell.m_strDLC_PackIn_Fri endlyName?" (basically the stuff right under the file info header). Now it just says the file is corrupt.

Any suggestions?

jayman122171
11-29-2012, 01:00 AM
never used one of these before.....this seems like as good as any to start with....if i can figure it out....thank you



hell this seems to be beyond my understanding.....ill keep trying though....do i need to have an extracted save before i open the decomp tool....to type it all into the Cmd promp that is...assuming i even know what that is....wow im clueless :(

I GOT IT!!! i know damn noobs....thank you none the less

jayman122171
11-29-2012, 04:23 PM
I have to say again thank you for this work....helped make me a god in the world of xcom. As for my excitement from my last post chalk it up to a personal triumph...im not very tech savvy...thanks again :)

darkaura
11-29-2012, 08:23 PM
looks like greek to me....lol

FNG_Midge
01-04-2013, 09:42 PM
i extracted my save to my desktop then tried decompressing it using the tool, then i got the error: ! XBOX360 Container Detected in red, i saw a couple other people with this problem but they appeared to fix, ill keep looking around but any help is apreciated. :)

cpizzo
01-05-2013, 03:21 PM
great job, keep up the good work

wizardy
01-15-2013, 08:28 PM
I've got some problems whith the compression part I guess.

I'm a PC User (Steam), and it decompress the savegame fine, I checked it with a Hex Editor and it looks good.

Now without doing any change to the decompressed file, I recompress it and try to load it on XCOM -> Corrupted file

So I have a problem with the trivial case of save -> decompress -> compress -> load without doing any modification.

There is no error message or warning when using the tool, neither on decompress or compress.

Logs:



C:\Users\xxxxxxxx\Desktop>xcom.exe -d save99 save99.d

XCOM Enemy Unknown Compression Toolkit by fairchild
================================================== ===== version 0.1.6 ===

- Open input file: save99
- File size: 0x0003504f (217167)
- Reading buffer from file, done.
- GameSave (PC) file detected!
- Decompress block# 0 / 15
- Decompress block# 1 / 15
- Decompress block# 2 / 15
- Decompress block# 3 / 15
- Decompress block# 4 / 15
- Decompress block# 5 / 15
- Decompress block# 6 / 15
- Decompress block# 7 / 15
- Decompress block# 8 / 15
- Decompress block# 9 / 15
- Decompress block# 10 / 15
- Decompress block# 11 / 15
- Decompress block# 12 / 15
- Decompress block# 13 / 15
- Decompress block# 14 / 15
- Decompress block# 15 / 15
- Open output file: save99.d

All done!




C:\Users\xxxxx\Desktop>xcom.exe -c save99.d save99


XCOM Enemy Unknown Compression Toolkit by fairchild
================================================== ===== version 0.1.6 ===

- Open output file: save99
- File size: 0x0003504f (217167)
- GameSave (PC) file detected!
- Reading buffer from file, done!
- Open input file: save99.d
- File size: 0x001ed5f5 (2020853)
- Reading buffer from file, done!
- Compress block# 0 / 15
- Compress block# 1 / 15
- Compress block# 2 / 15
- Compress block# 3 / 15
- Compress block# 4 / 15
- Compress block# 5 / 15
- Compress block# 6 / 15
- Compress block# 7 / 15
- Compress block# 8 / 15
- Compress block# 9 / 15
- Compress block# 10 / 15
- Compress block# 11 / 15
- Compress block# 12 / 15
- Compress block# 13 / 15
- Compress block# 14 / 15
- Compress block# 15 / 15
- Open output file: save99.rebuilt
- Add done!

Dudemeister
01-18-2013, 12:10 AM
Thanks fairchild! This would extend this game's replayability! Great job with this and thanks for the hardwork.

whywords
01-19-2013, 12:34 AM
Any chance we can get the source to this tool?

dimmit
01-20-2013, 09:33 PM
after compressing to save1.rebuilt i have a smaller file then my original save1 (original save1 - 155Kb, save1.rebuilt - 93Kb)and horizon write to me - invalid signature type detected for the loaded package. Halting reading.Please make sure the file is a valid xbox360 xcontent package. Or invalid STFS package. How to fixit? (sorry for my english)))

Nymrodic Mindset
01-23-2013, 11:01 AM
I have a problem every time i open the program it automatically closes is it corrupted?
edit: nevermind figured it out

pgpv
05-18-2013, 08:26 AM
I have the exact same problem (as wizardy). Can anyone try to help?

69bigplayer69
05-18-2013, 11:39 AM
xbox 360 only i think

pgpv
05-20-2013, 08:47 PM
Yeah, but there is a PC version too =/

obione
06-18-2013, 05:01 PM
First I wanted to say special thanks to fairchild for amazing job & hard work.
I've came across your tool while searching for save game editor for the PC game.
When I've tried to make one myself, I've noticed the saved game files were encrypted / compressed & then I made some google search & stumbled upon your tool here.

It seems though the tool itself runs without errors, the game cannot read a file compressed back using your tool.
Consider this "path": orig -> decompressed -> compressed -> back to orig file folder (replaced) -
When loading the game, it refusing to load file (says corrupted file).
Also noticed the generated saved-game file size is smaller than original one (original is 170KB & rebuilt is ~100KB)

I'm sure it's likely due to game recent update & some protection company made (since your last release v0.15):
Game installed with latest patch (update 4, XComGame.exe file version 1.0.0.28586)

Seeing that it's been over few months since last update of your tool, I'm assuming lack of time to "mess with it" is the cause of it.
I'm willing to gladly help if you're willing to accept my offer.
In real life I'm a professional C++ & C# coder (been doing it over 10 years), and I got some experience in reverse engineering on my spare time.
if you willing to share your insights discovered of what's the "compressed algorithm" & what checks have you found so far, I can try pick up where you left off & make it competiable with the latest pc version.

Regardless of above, I'm determined to make some nice visual slick GUI tool for editing as many parameters as I can find or identify inside the saved game,
with possible soldier weapons editor.
Promise to post it once it's ready...

RedReaperXX
06-27-2013, 03:44 AM
I can't get mine to work. It says "Not a valid Win32 application

UrK
06-27-2013, 03:05 PM
Nice work on the editor, I don't have the game but I was thinking about getting it.

allusing
07-01-2013, 06:14 AM
Hi fairchild,

Thanks for great tool! Would you please also support iOS version which just comes out? Hopefully they keep similar save format for iOS port.

The first bytes after 1024 also looks like PC version with little endian
C1 83 2A 9E 00 00 02 00 A5 42 00 00 00 00 02 00 A5 42 00 00 00 00 02 00 78 9C ED 7D

Tried "xcom.exe -d save1 save1.d" without luck though

- Open input file: save1
- File size: 0x0000da11 (55825)
- Reading buffer from file, done.
- GameSave (PC) file detected!
- Decompress block# 0 / 5
Error: the compressed LZO input is wrong or incomplete (-6)

Any chance you can take a look? The savefile is attached. Thanks!

Added: Looks like compression changes from lzo to zlib instead

khelal
07-04-2013, 06:01 AM
Any chance that somebody could come up with something similar for the iOS version? The savegame is easily accessible in the iCloud folder.

When I however try to use the xcom.exe tool to decompress it, I get the following error:



C:\Documents and Settings\Shish\Desktop>xcom.exe -d XComiCloudsave0 save1.d

▄ ▄▄▄▄▄▄▄ ▄ ▀▀▀▀▀ ▀▀ ▀ ▄▄▄▄▄▄▄▄ ▀▄▄▄▄ ▄
▄▄▄▄▄▄ ▀ ▄▄▄▄▄▄█▀▀▀▀▀█ ▄▄▄▄▄▄ ▀ █▀▀▀▀▀▀█ █▀▀▀▀▀▀ ▄▄▄▄ █▄▄▄▄▄▄▄▄
▄▄█▀▀ ▄▄ ▀█▀▀▀ ▄▄ ▀▀ ▀▀▀ █▀▀ ▄▄ ▀▀█▄ ▀ █▀ ███▀▐▌ █ ▀▀▀▀ ████ ▄██ ▄▄▄▄ ▀█
▀ ▀▀ ▄▄██▀▓▓▄ ▄▄██▀█▓▓▄ ███ ▄▄██▀██▓▄ █▀▀▀▀█ ███▌ █▄▄▌▐███▌▐███▌▐███▄▐███▌ ▄
▄▓▓▓▓▀ ▀▀▄██▀ ▐██▓▌▐██▌▄█▓▀ ▐░░▒▌ ▄▄█▓▄ ▐██▓█▄▄▄ ▓██▒ ▒███ █ ▄▄▄▄███▓
▐▓▒░▌ ░ ▐▓▒░▌ ▀▀░░▒▒ ░░▒ ▓▒▌ ▄░██▀▄▒██▀ ░░▒█ ▀▀░▒▓ ▓░▌▐░▒▓▌ ▄█▓█▀ ▐▓█▓▌
▓░██▀ █ ▓░██ ░▐███▌▐██▓ ░░█ ░▀▀ ▐▓░▒▌ ▄▌▐▓██▌▐▌▐██░▌▐█ █░░▓ ▐▓░░▌ ▄█░▒▓▀
▀ ▐███▌▐█▌▐███▌ ▀▀▀▀ ▀▀ ▐███▌ ▀ ▀▓██▄██ ▀▀▀▀ ██ ███░ ▐▓██▌ ▀▓██▄██▀▀ ▄▄ ▄
█ ▀▀▀▀ ██ ▀▀▀▀ █▀▀▀▀▀▀█▄ ▀▀▀▀ █▀█▄▄ ▀▀ ▄▄█▀▀▀▀█▌▐███▌▐ ▀▓▓██▄░ ▀▀ ▄▄█▀▀
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▄ ▀ ▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀ !f █ ▀▀▀▀ ██▄▄ ▀▀▀▀ █▀▀▀▀
▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀ p r e s e n t s . . ▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀ ▀▀ ▀
▀ ▀▀▀▀▀ ▀ ▀

XCOM Enemy Unknown Compression Toolkit by fairchild
================================================== ===== version 0.1.6 ===

- Open input file: XComiCloudsave0
- File size: 0x00014140 (82240)
- Reading buffer from file, done.
! Unsupported file detected!



Here is the file: 12608

khelal
07-04-2013, 06:08 AM
Hi thanks for a great tool, but is there any chance you could make this work on a the iOS version of the game? I could provide you with savegames if you need them.

allusing
07-04-2013, 09:28 AM
I wrote a version to decompress/compress with zlib, but there is a 32b checksum for iOS version. Still waiting for fairchild to get online to learn how he worked around security check for PC version. Btw, decompressed save is different from PC/Xbox version, so existing editor will not work. Still hackable with HEX editor

khelal
07-10-2013, 06:26 PM
Hi, any luck moving fwd with this? I'm stuck and wouldn't mind upping my cash a little bit :)

obione
07-11-2013, 05:47 PM
I'm having problems running PC game version under OllyDbg to understand the protection used.
Did anyone succeed in running it under some debugger (on windows 7), any special anti-debugger methods implemented & some way to workaround ?
Seems OllyDbg version 2.01g & 2.01h are not working. Attempted to use "swordfish" plugin to hide debugger, but not seems to be working.

carpi
07-26-2013, 12:16 AM
I wrote a version to decompress/compress with zlib, but there is a 32b checksum for iOS version. Still waiting for fairchild to get online to learn how he worked around security check for PC version. Btw, decompressed save is different from PC/Xbox version, so existing editor will not work. Still hackable with HEX editor

Save file crc check is at 0xBE offset and it is the same customized CRC32b as from Windows version. I don't see difference between PC and iOS version, the savefile structure is exactly the same.

allusing
07-26-2013, 03:38 AM
You are right that savefile structure is the same except the compression changes to zlib.
Any more information on "customized CRC32b"? Like polynomial and mask operations? Just need that to make iOS version works. Thanks!

carpi
07-26-2013, 12:55 PM
Here is my code in python. You can easy translate it to whatever you want.

carpi
08-01-2013, 09:21 PM
Can someone share with me save file form Xbox?

ASSASSlN
08-04-2013, 10:36 PM
Tanks for the toolkit.

Xrypticus
08-05-2013, 06:39 AM
I wrote a version to decompress/compress with zlib, but there is a 32b checksum for iOS version. Still waiting for fairchild to get online to learn how he worked around security check for PC version. Btw, decompressed save is different from PC/Xbox version, so existing editor will not work. Still hackable with HEX editor

Hi, can you release this tool for iOS? Did you get the CRC checks working yet? Thanks appreciated.

Minion
08-05-2013, 07:00 PM
great job, works fine

Malachi E Zo
08-10-2013, 05:36 PM
Much appreciated, thank you very much. I still remember Hex Editing the originals };þ[)

carpi
08-12-2013, 10:33 PM
For those who still have a problem with gamesave for PC or iOS version, let me explain few details. Data save is just serialized sets of classes (nothing more to add as people are doing great with finding & replaces patterns). In PC and iOS version (don’t have PS3 save) save game is compress with different algorithm. PC is using LZO1X_1 when iOS compresses data by zlib. Both saves are protected by CRC checksum. However, PC version has additional one CRC. One calculated from compressed data and 2nd generated from header.


save file = header[1024] + compressed_data[]

The compress_data is organized into blocks. The block starts with block header (18 bytes) and then results of compression of 131072 bytes of “original” save data.


save_file = header[1024] + [ [block_header] [compress block]] * X blocks

Fairchild did nice work and code compression toolkit for it. It works fine for Xbox (what I can see) but it generate ‘corrupted file’ for PC version. So what the problem?

1. He did wrong assumption that CRC checksum has constant offset and after game update it puts checksum in wrong place
2. He implemented only one check.

To fix it, you need to guys calculate CRC from whole compress data which is from offset 1024 to EOF() and put it just after game language code. In example, it’s at 0xEA. To calculate correct position it’s required to go though save header variable. Sum of first 3 in red (it’s just sizeof string), the 4th one is for DLC if you don’t have it will be 0 anything else it’s string size. And finally add 8 to results for sum and you are in correct place for 1st CRC.

2nd CRC has static offset so it’s not needed to do similar operation as for 1st one. The offset is 0x3FC. 4 bytes earlier, at 0x3F8 is size of block from beginning of save which will be used for generate checksum.

And that’s it more or less. I prepared fixer for pc and ios saves which will correct CRCs. Also I patched Fairchild’s xcom which now doesn’t break header but still requires CRC correction :) Now, you should be able to change saves.

Note: Don't worry about different save size from Fairchild tool. He used different compression level and dictionary size but game will handle it :)

obione
08-16-2013, 03:46 PM
Thank you for info & hex insight of saved game...
Much appreciated :)

obione
08-16-2013, 05:04 PM
I can confirm your xcom-fix.exe tool works perfectly on PC running latest patch installed ... *kudos*

One addition to your hex info, after the 3rd string (0x39 size in your screenshot example) needs to add additional "12" (decimal), possibly some extra spacing.

carpi
08-17-2013, 08:08 PM
I can confirm your xcom-fix.exe tool works perfectly on PC running latest patch installed ... *kudos*

One addition to your hex info, after the 3rd string (0x39 size in your screenshot example) needs to add additional "12" (decimal), possibly some extra spacing.

Yeah, you right just forgot to mention but its I my example :)

musawarrior
10-14-2013, 03:33 AM
nice work, thanks!

Darth Duane
10-25-2013, 08:02 PM
I know it's a long shot that this is still being supported but I just finally got around to trying the slingshot DLC and this seems to be incompatible with it. When i try and load a save after decompressing\compressing even if i make no changes i get

"CANNOT LOAD SAVE GAME
Missing Downloadable Content
Sb;/ shot Content Pack"

Any help would be appreciated.

Jobawa
11-13-2013, 06:39 PM
I haven't fired this up again, but I realized a bit ago (got Enemy Within yesterday) that if the compression bit didn't work, then it wouldn't matter if the hex positions were mostly the same. It seems likely that Enemy Within will be similar save-wise, but probably has to account for the extra data of the gene/mech additions as well.

69bigplayer69
11-13-2013, 10:57 PM
move to proper page

Dschonny
12-02-2013, 03:14 AM
For those who still have a problem with gamesave for PC or iOS version, let me explain few details. Data save is just serialized sets of classes (nothing more to add as people are doing great with finding & replaces patterns). In PC and iOS version (don’t have PS3 save) save game is compress with different algorithm. PC is using LZO1X_1 when iOS compresses data by zlib. Both saves are protected by CRC checksum. However, PC version has additional one CRC. One calculated from compressed data and 2nd generated from header.


save file = header[1024] + compressed_data[]

The compress_data is organized into blocks. The block starts with block header (18 bytes) and then results of compression of 131072 bytes of “original” save data.


save_file = header[1024] + [ [block_header] [compress block]] * X blocks

Fairchild did nice work and code compression toolkit for it. It works fine for Xbox (what I can see) but it generate ‘corrupted file’ for PC version. So what the problem?

1. He did wrong assumption that CRC checksum has constant offset and after game update it puts checksum in wrong place
2. He implemented only one check.

To fix it, you need to guys calculate CRC from whole compress data which is from offset 1024 to EOF() and put it just after game language code. In example, it’s at 0xEA. To calculate correct position it’s required to go though save header variable. Sum of first 3 in red (it’s just sizeof string), the 4th one is for DLC if you don’t have it will be 0 anything else it’s string size. And finally add 8 to results for sum and you are in correct place for 1st CRC.

2nd CRC has static offset so it’s not needed to do similar operation as for 1st one. The offset is 0x3FC. 4 bytes earlier, at 0x3F8 is size of block from beginning of save which will be used for generate checksum.

And that’s it more or less. I prepared fixer for pc and ios saves which will correct CRCs. Also I patched Fairchild’s xcom which now doesn’t break header but still requires CRC correction :) Now, you should be able to change saves.

Note: Don't worry about different save size from Fairchild tool. He used different compression level and dictionary size but game will handle it :)

Hey Guys - just trying to edit a XCom-EW-Save-File for PC. First tried Fairchilds tool, but the recompressed savegame didn't even show up in the load-Game-Section. Then found your fixed tool, now the savegame is shown in the loadgame-screen, but it's not loadable (corrupted). Tried to follow your checksum explanation, but I'm just not getting it. Could you (or somebody who knows how to do it) please explain that again in a few more details?
Which value has to be edited at what adress, and how do I calculate adress and value exactly?
Also tried your python-script (/w python f win 3.33) but it's giving me syntax-errors all the time - and I'm not firm to python to sort them out
Thanks in advance!

musawarrior
12-18-2013, 07:55 AM
thanks!!! awesome update

Elandril
12-23-2013, 07:30 PM
Hey Guys - just trying to edit a XCom-EW-Save-File for PC. First tried Fairchilds tool, but the recompressed savegame didn't even show up in the load-Game-Section. Then found your fixed tool, now the savegame is shown in the loadgame-screen, but it's not loadable (corrupted). Tried to follow your checksum explanation, but I'm just not getting it. Could you (or somebody who knows how to do it) please explain that again in a few more details?
Which value has to be edited at what adress, and how do I calculate adress and value exactly?
Also tried your python-script (/w python f win 3.33) but it's giving me syntax-errors all the time - and I'm not firm to python to sort them out
Thanks in advance!

You need to install Python 2.7 for this script to work, since it uses syntax that has been deprecated in Python 3.3!

Here are the steps to edit a savegame (in this example "save6"):

Use xcom-fix to decompress the savegame.
xcom-fix -d save6 save6.decompressed
Edit the decompressed savegame ("save6.decompressed").
Use xcom-fix to compress the savegame. Here it is important that you use the SAME savegame name as the original (since it has to take some parts from this to complete the savegame). Don't worry about the original savegame, since the program creates the new savegame with the extension ".rebuilt" and doesn't change the original.
xcom-fix -c save6.decompressed save6
Use check_crc.py to fix the CRC checksums.
"<path-to-python-directory>\python.exe" check_crc.py save6.rebuilt
Backup original savegame and rename the "save6.rebuilt" to "save6".
Play XCOM Enemy Unknown and enjoy! :-)

JakeShifter
04-06-2014, 12:54 AM
I'm trying to open a save from XCOM - Enemy Within, i assume they use the same save system since EW is basically EU with extra goodies galore. I've tried using both Modio and USB Xtaf, and both give me a "save4" file when i'm done with them, but i follow all the steps and the toolkit still warns me it detects an Xbox 360 container. Are there any special instructions for Enemy Within, for getting it out of the container, what? i've been working for hours and have exhausted most of my options.

Drebrock
04-19-2014, 03:54 AM
I just bought the game so I am trying something new thanks for making a tool kit.

hansw
10-15-2014, 12:00 AM
Hi guys, I tried using the xcom-fix on an EW (PC Version) save and it crashed, let a friend try it on his PC and it also crashed. Can someone help me there? Win 7 64 Bit, appcrash.

Dantical
11-15-2014, 12:10 AM
edit: got it workingnow,.. sory for bringin up that old thread :(

Kenpachi87
04-23-2016, 03:38 AM
Sorry to bring up an old thread. I do exactly as everyone advises and when I hit Enter the tool opens and closes almost instantly and I cannot see anything in here showing the same issue or what I may be doing wrong.

I extracted the file using Horizon.
Opened cmd
Created the line C:\Users\****>C:\Users\****\Desktop\xcom.exe -d C:\Users\****\Desktop\save27 C:\
Users\****\Desktop\save27.decompressed
Once I hit enter the fairchild tool briefly opens and closes right away.

EDIT: Got it sorted, I re-extracted the file from Horizon and it worked second time around. Not sure what caused the initial issues but it is all fine now.

JasonTyler
06-16-2016, 05:06 PM
Doesn't work, it closes itself as soon as i open it.


Nevermind, NEVERMIND
I was being a dumbass.

BlackYang
06-19-2016, 08:22 PM
Sorry to bring up an old thread. I do exactly as everyone advises and when I hit Enter the tool opens and closes almost instantly and I cannot see anything in here showing the same issue or what I may be doing wrong.

I extracted the file using Horizon.
Opened cmd
Created the line C:\Users\****>C:\Users\****\Desktop\xcom.exe -d C:\Users\****\Desktop\save27 C:\
Users\****\Desktop\save27.decompressed
Once I hit enter the fairchild tool briefly opens and closes right away.

EDIT: Got it sorted, I re-extracted the file from Horizon and it worked second time around. Not sure what caused the initial issues but it is all fine now.
I've been following the instructions precisely and I'm stuck at extracting from Horizon, which I've done repeatedly from the "contents" tab after dragging the game save into the Horizon space

Viper187
10-02-2016, 01:14 PM
I can't believe nobody has written this same tool for the PC version. Any chance of an update?

blackwing
01-18-2017, 06:02 PM
i can't get any of the 3 versions to load