Posted: Thu Sep 11, 2008 3:02 am Post subject: files inside CC3 Guns.zfx - unpack and repack?
Hi,
Could someone please help me figure out which CC3 tool unpacks and repacks the files inside Guns.zfx?
I did it before, a couple a years ago ... but have gone through all CC3 files and programs on the hard disc, but can't remember how to do it.
CSO was down today too, so I didn't get a chance to check their tool section.
CC2Spriter.exe by Mafi will do it. was also an older program i used to use but can't remember which.
Thanks curtain6,
I was able to extract the Guns.zfx file with mafi's CC2Spriter tool, but can't seem to find any way of opening the different files from the unpacked Guns.zfx (extensions like: .nnh, .nsh, etc.).
Any ideas or instructions to open these with mafi's CC2Spriter tool?
I ended up finding TXTFPack at CSO ... and it unpacks and packs the files inside Guns.zfx. Thanks again CSO.
I also noticed that mafi's latest CC2Spriter v2.91 seems to unpack the Guns.zfx with errors. Some of the files unpack as "0" file size.
A previous version (CC2Spriter v2.81) does all the unpacking and packing correctly. Thanks mafi for your modding tools.
Modding of CC3/CoI-Guns/Wrecks ZFX files requires five steps:
- unpacking ZFX archives,
- converting resulting CC3/CoI-TXTF-files into TGA 16-bit uncompressed,
- editing TGA graphics,
- re-converting TGA to CC3/CoI-TXTF-file format,
- repacking these files into ZFX-archives.
To understand why, you must know something about CC-file formats. The TXTF file format was introduced by CC2. 16-bit graphics with a given header telling the graphic's size. CC3 introduced much more file formats. For vehicles, they used a format storing more than one graphic (to give the graphical effect of vehicles "shaking" over the terrain).
But for guns and wrecks, this was not neccessary, so they used for those CC3/CoI graphics a file format similiar to the one of CC2: some graphical concept but with an extended header (8 bytes more) to store the "hotpoint" coordinates.
Despite the differences between vehicle graphic file concept and the gun/wreck file concept, they decided to bundle such files into archives of the same concept: the ZFX-archive format. To increase the trouble for modders, they used also the same filetype extensions (or even no extension at all) no matter which real filetype the graphics file is.
So be warned: a *.NNH file of CC3/CoI can be a vehicles file and also a guns file. You must examine the header, to determine it (and you might fail). So for modders it will be best to know the source-ZFX-archive to know what kind of file you are currently handling (and of course, you cannot be sure!).
Me only made additional tools to handle CC3-files under MacOS-X, but you can use them for these CC3/CoI-specials as well on a PC:
- CC2Spriter v2.91 for ZFX-un- & -repacking.
- RtBTool v2.17 for CC3/CoI-TXTF-file conversion to TGA and back and for more CC3/CoI actions (see menubar of RtBTool !)
- or CC2Tools v5.01 for CC3/CoI-TXTF-file conversion to TGA and back
(see chapter CC3-CC5-RtB-Graphics, button "CC3 txtf -> TGA" / "TGA -> CC3 txtf"; the hotpoint coordinates are placed into the file name).
This is what CC2Spriter does with ZFX-archives:
CC3’s *.ZFX archives can not only be extracted, but also rebuilded. These *.ZFX files have a fixed size header (number of files, filename table with 600 entries, offset table with 600 entries, file size table with 600 entries) followed by the file datas. The extracting process will respect the values entered in the file size table. The only exception are zero values. In this case my tool will calculate the file size from the file offset distances. The tool will report such errors in the ZFX directory table. Zero values in the file size table are always present if the ZFX archive was made with older tools. Such zero values are not used in the original CC3 files, but zero values here will not prevent CC3 from handling the ZFX archive correctly. When repacking the ZFX archives my tool will only import readable and visible files if their filename does not start with a dot ".".
The RtBTool-package also contains the needed file format infos like this:
CC3-txtf files of Guns.zfx / Wrecks.zfx with
file name extension NNH/NSH/ZNH/ZSH
Their header is 8 bytes longer than a regular CC2-txtf file.
WARNING: same format used by CC4/CC5/CCM/RtB files inside the file 'FT.azp'. file format description by Mafi, last update Jan. 6th, 2008.
contents of these "txtf"-files: 1 small graphical texture for gun or wreck.
Byte order: Little Endian (Intel style)
// header, 24 bytes
char(4) // 4 bytes headerID, always ‘txtf’ short // 2 bytes, unknown, always 0000h short // 2 bytes, versionID, always 0002h long // 4 bytes, image width
long // 4 bytes, image height
long // 4 bytes, hotpoint-X
long // 4 bytes, hotpoint-Y
// the graphical datas will follow immediately (one image only) data (16-bit encoded RGB-graphics)
And this is the CC3-ZFX-file format as reported by Gerry Shaw aka 'TinTin':
ZFX File Format
The .zfx file contain a bunch of other files concatenated into a single file. This is done to decrease seek times when reading files from disk or CD.
Basic Format:
• Intel style byte ordering
• File Count (4 byte int)
• Directory (13 byte strings, 0 padded 8.3 format – always at least one terminating null character, always starts at offset 4, 0 padded to a fixed size of 600 strings - 7800 bytes)
• File Offsets (always starts at 7804, 600 32bit ints)
• Files (always start 12604, offsets are from start of file so this tidbit isn’t really needed)
Example of Guns.zfx offset table
12604
13648
14692
18660
I also noticed that mafi's latest CC2Spriter v2.91 seems to unpack the Guns.zfx with errors. Some of the files unpack as "0" file size.
A previous version (CC2Spriter v2.81) does all the unpacking and packing correctly.
Hi David,
made a quick test with original CC3-Guns.zfx. Didnot found the reported errors. Made the repacking twice. With the latest version of CC2Spriter v2.91. Again no errors. Perhaps you can send me the buggy-Guns.zfx file via email for further investigation, if still necessary: closecombat2 (at> claranet (dot> de
I also noticed that mafi's latest CC2Spriter v2.91 seems to unpack the Guns.zfx with errors. Some of the files unpack as "0" file size.
A previous version (CC2Spriter v2.81) does all the unpacking and packing correctly.
Hi David,
made a quick test with original CC3-Guns.zfx. Didnot found the reported errors. Made the repacking twice. With the latest version of CC2Spriter v2.91. Again no errors. Perhaps you can send me the buggy-Guns.zfx file via email for further investigation, if still necessary: closecombat2 (at> claranet (dot> de
Cheers
Mafi
Hi Mafi,
I tried to recreate the errors, but am not able to. Your CC2Spriter v2.91 tool worked perfect. I must have messed up a certain Guns.zfx file, and thought it was the tool's fault ... instead of mine. Whatever the case, it is all working now ... sorry for wasting any of your time.
Thanks also for your explanation above regarding all the Guns.zfx stuff. I will give your rtb tool a try next time I go into that file.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
In August of 2004, Zappi, Homba, Bambam887, RedScorpion and MOOXE all pitched
in to create this Close Combat site. I would to thank all the people who have visited
and found this site to thier liking. I hope you had time to check out some
of the great Close Combat mods and our forums. I'd also like to thank
all the members of our volunteer staff that have helped over
the years, and all our users that contributed to this site!