View Single Post
  #355  
Old 24th January 2016, 01:09 AM
weighta weighta is offline
Grunty's Reject
 
Join Date: Oct 2015
Location: WA, USA
Total Awards: 1
You're Appreciated! 
Quote:
Originally Posted by Ice Mario View Post
Here is some of my preliminary investigative notes on the CAFF. I cannot guarantee that the information here is exactly right, but for extracting data, it serves it's purpose. Hopefully I've not made any typos, but if I have then with a little investigation, it should be apparent what it is supposed to be.

CAFF (most likely stands for Common Asset File Format) and has been used by Rare since it's days on the original Xbox.

Code:
Header (size 0x78)
offset	size	desc
0x00	0x04	FourCC (CAFF)
0x04	0x10	Version (char) 07.08.06.0036
0x14	0x04	Size of header (0x78)
0x18	0x04	Header Checksum
0x1c	0x04	Number of Symbols
0x20	0x04	Number of File Parts
0x48	0x01	Type
0x49	0x01	Number of Sections
0x50	0x04	DataBase (offset from the end of the caff header (0x78) )
0x60	0x04	DataBase
0x64	0x04	DataOffs (add to DataBase to get start of section data)
0x74	0x04	DataOffs
Then follows a SectionInfo structure for each Section

Code:
Section Info	(size 0x21)
offset	size	desc
0x09	0x04	Data Length
0x1d	0x04	Data Length
Next follows the null terminated section names

0x00 0x04 Length of Symbols Buffer

Then follows an offset value for each Symbol. This is an offset into the Symbol Buffer

Then the null-terminated Symbols

Then follows a entry for each file part. So, if a file has data in more than one section, it would have multiple entries here, tied together by the FileID member.

Code:
FileInfo	(size 0x14)
offset	size	desc
0x01	0x02	FileID
0x03	0x04	Data Offset
0x07	0x04	Data Len
0x0B	0x01	Section
Then the data sections

It is fairly easy to extract section data by iterating through the sectionInfo structures, adding the lengths to make data offsets

Extracting actual files can be achieved by iterating through the symbols list, and then getting it's data from each section by using the FileInfo table.


TYPES

.data
Generic data. For example: information describing the texture, such as type, width, height

.texturegpu
The data that will be loaded into the gpu. i.e raw texture data that has been converted to the correct format for the target platform.

.stream
data that will be streamed. Information about this layout is likely to be described in the .data section

The are more types, but I've not had to look at any more yet, but obviously when extracting models the .gpu section will come into play

It must be noted that some sections can be compressed. This was the case on Perfect Dark Zero, but I've not come across any that are compressed in Nuts & Bolts.

HTH
What program can I use to view the offsets?

No sections are compressed in N&B.
Quote:
Originally Posted by Ice Mario View Post
but I've not come across any that are compressed in Nuts & Bolts.
That should make it easy for me to maybe do a copy-paste my vehicle save data, to the 234cec file like mojo was saying. That caffextractors purpose was to extract data sections, then make them into files.. I think. So maybe HxD is easier considering I've never heard him talk about a CAFF injector.

Last edited by weighta; 24th January 2016 at 01:16 AM.