Important information: this site is currently scheduled to go offline indefinitely by end of the year.

NfS Shift .BFF files

The Original Forum. Game archives, full of resources. How to open them? Get help here.
twisted
veteran
Posts: 100
Joined: Mon Apr 23, 2007 11:25 pm
Has thanked: 2 times
Been thanked: 7 times

Re: NfS Shift .BFF files

Post by twisted »

could anyone upload the new quickbms please as the current link doesnt seem to be working and cant find it anywhere else.
Thanks.
User avatar
aluigi
VVIP member
VVIP member
Posts: 1916
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 664 times
Contact:

Re: NfS Shift .BFF files

Post by aluigi »

retry again (there was a problem during the upload of a new minor version some hours ago), and if there are other difficulties go on the mirror
zeeh
beginner
Posts: 30
Joined: Sun Jul 26, 2009 2:10 am
Has thanked: 1 time
Been thanked: 2 times

Re: NfS Shift .BFF files

Post by zeeh »

In fact, I meant we => someone.
zeeh
beginner
Posts: 30
Joined: Sun Jul 26, 2009 2:10 am
Has thanked: 1 time
Been thanked: 2 times

Re: NfS Shift .BFF files

Post by zeeh »

Bugtest wrote:I make only the extractors.

if someone wants to write a quick rebuilder I suggest to use X12d equal to 0 (no encryption) and ever type 0 for each file so that it's not needed to use the compression.
the crc calculated on the files is just the simple classic one:

Code: Select all

unsigned int crtable[...0x77073096 polynomial...];
unsigned int crc = 0xffffffff;
for(i = 0; i < len; i++) {
    crc = crctable[(data[i] ^ crc) & 0xff] ^ (crc >> 8);
}
return(crc);
Bugtest, can you explain more about the two CRC (CRC32 ?) values for each file inside BFF files?
User avatar
aluigi
VVIP member
VVIP member
Posts: 1916
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 664 times
Contact:

Re: NfS Shift .BFF files

Post by aluigi »

the first crc (CRC1 in the script) is calculated on the file included in the archive as is.
with "as is" I mean that if it's compressed and encrypted the crc must be calculated over the decrypted but still compressed data.
crc2 instead should be calculated on the final file (the uncompressed one) but I didn't verify it.
User avatar
aluigi
VVIP member
VVIP member
Posts: 1916
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 664 times
Contact:

Re: NfS Shift .BFF files

Post by aluigi »

in case someone is interested the following is the explanation of all the fields of the bff archives.
yeah I know that probably was faster for me to just write the repacker but I'm sure that many people will have fun with these info:

Code: Select all

BFF header:
bytes   description
4       " KAP" ("PAK " in big endian)
4       0x03004010
4       files
4       alignment
4       zero
4       0x800
0x100   name of the archive
4       X118, size of the information table
4       zero
4       X120, size of the name table + 0x308
4       DHSA field offset
4       DHSA field size
1       zero
1       X12d, set it to 0
1       zero
1       zero
X118    information table
4       "TXEP"
4       not verified
0x100   Gecko.xml or GeckoDemo.xml
0x100   C:\DEV\Gecko\ or C:\DEV\GeckoDemo\
0x100   PC
X120    name table

Code: Select all

information table:
4       unused (set it as you want, the game works in any case)
4       unused (set it as you want, the game works in any case)
4       absolute offset of the file
4       ever zero
4       size of the file in the archive (for example its compressed size)
4       size of the extracted file
4       zero
4       zero
4       type, set it to 0 (2 is meant for compressed files)
4       zero
4       CRC of the file as is in the archive
4       extension (example: fxo)

Code: Select all

name table:
4       absolute offset where is located the name string
4       zero
4       not verified, tell me if there are problems
4       not verified, seems only a date timestamp
have phun
Last edited by aluigi on Tue Sep 22, 2009 10:20 pm, edited 1 time in total.
Simon
mega-veteran
mega-veteran
Posts: 180
Joined: Sun Sep 20, 2009 5:41 pm
Has thanked: 31 times
Been thanked: 20 times

Re: NfS Shift .BFF files

Post by Simon »

Looks really interesting .. but my coding skills to low ...
User avatar
aluigi
VVIP member
VVIP member
Posts: 1916
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 664 times
Contact:

Re: NfS Shift .BFF files

Post by aluigi »

I have just updated a small but important detail.
the first 2 fields of the information table are NOT the crc of the file but something else (probably a 64bit timestamp or similar) that can be set to any value.
while the CRC of the file as is stored in the archive is the one immediately before the extension field.
sorry for the mistake.
User avatar
japamd
advanced
Posts: 41
Joined: Sat Sep 19, 2009 10:26 pm
Has thanked: 3 times
Been thanked: 8 times

Re: NfS Shift .BFF files

Post by japamd »

Bugtest wrote:I have just updated a small but important detail.
the first 2 fields of the information table are NOT the crc of the file but something else (probably a 64bit timestamp or similar) that can be set to any value.
while the CRC of the file as is stored in the archive is the one immediately before the extension field.
sorry for the mistake.
Thanks for the file structure, you're right about the CRC field being immediately before extension field, but the fields you called initially CRC1 and CRC2 cannot be of any value, the game crashes if I try different values than the original ones. Fortunately those fields don't need to be recalculated if the contents are changed.

I've managed to insert the uncompressed file generated by quickbms in the BFF just changing the type field to 0 and recalculating the CRC and zsize/size fields and offsets.

The file I'm working on it's language_English.bff in /UI/Languages folder, there are 2 files inside the BFF, english.bin and english_histogram.bin, the first contains a lot of binary data on top and all game strings starting at 0x010164, but I can't figure out if the string lenghts or offsets are stored on the same file, tried to change some strings but the game menus gone crazy :lol:

The game it's working fine if I don't change the original string length, but it's useless that way :(
User avatar
japamd
advanced
Posts: 41
Joined: Sat Sep 19, 2009 10:26 pm
Has thanked: 3 times
Been thanked: 8 times

Re: NfS Shift .BFF files

Post by japamd »

Hi guys, good news. I did coded the BFF repacker, I'm still testing and will soon give you the code, it lacks a lot of things like error checking etc., but it's pretty functional. I managed to recreate the PHYSICSPERSISTENT.bff file from C:\Program Files (x86)\Electronic Arts\Need for Speed SHIFT\Pakfiles folder, which contains several text and XML files with game physics definitions, like the one bellow (driverhead.txt)

Code: Select all

// Vehicle movement affects driver's head physics, but head does NOT
// influence vehicle dynamics.  This violates Newton's 3rd law, but
// allows user to configure head physics without "cheating".

HeadMass=6.0                     // Head and helmet
HeadInertia=(0.032,0.028,0.029)  // Head and helmet
MinPos=(-0.03,-0.08,-0.050)       // Minimum extents of position (should be negative)
MaxPos=( 0.03, 0.08, 0.015)       // Maximum extents of position (should be positive)
MinOri=(-7.0,-7.0,-7.0)          // Minimum degrees of pitch, yaw, roll (should be negative)
MaxOri=( 7.0, 7.0, 7.0)          // Maximum degrees of pitch, yaw, roll (should be positive)

// There are three types of springs to control head movement:
//
// Sliding = spring/damper force maintains given direction relative to vehicle
// Normal = spring/damper force in direction between connection points
// FreeDamping = spring is normal, but damper resist velocity in any direction
//
// Parameters for springs are:
//
// SpringDir = direction of spring/damper forces (automatically normalized, not valid for Normal springs)
// SpringHead = connection to driver head (relative to head center)
// SpringBody = connection to vehicle body (relative to head center)
// SpringCollLen = if more than zero, spring doesn't take effect until minimum length has been reached
// SpringParams = spring rate and damper rate

Spring=Sliding
SpringDir=(0.0,1.0,-0.0)      // up/down
SpringHead=(0.0,-0.05,0.01)
SpringBody=(0.0,-0.05,0.01)
SpringParams=(1000.0,225.0)

Spring=Sliding
SpringDir=(0.0,-0.0,-1.0)     // forward/back
SpringHead=(0.0,-0.05,0.01)
SpringBody=(0.0,-0.05,0.01)
SpringParams=(1700.0,382.0)

Spring=Sliding
SpringDir=(1.0,0.0,0.0)       // lateral
SpringHead=(0.0,-0.05,0.01)
SpringBody=(0.0,-0.05,0.01)
SpringParams=(8500.0,351.0)

Spring=FreeDamping            // resists yawing and rolling
SpringHead=(2.0,0.0,0.0)
SpringBody=(2.0,0.0,0.0)
SpringParams=(63.9,1.31)

Spring=FreeDamping            // resists yawing and pitching
SpringHead=(0.0,0.0,2.0)
SpringBody=(0.0,0.0,2.0)
SpringParams=(63.9,1.31)
Again, thanks bugtest for the file structure and tips for recreating the archive.
User avatar
japamd
advanced
Posts: 41
Joined: Sat Sep 19, 2009 10:26 pm
Has thanked: 3 times
Been thanked: 8 times

Re: NfS Shift .BFF files

Post by japamd »

It's done.

I have attached the utility to this message, you'll need NET Framework 2.0 in order to execute it.

** Only for full version of game. **

Download Links

http://cid-0459fc515f4928b3.skydrive.li ... _Tools.rar
http://forum.racedepartment.com/downloa ... ools-1740/

Compiler (click here for more info)
Image

Repacker
Image

Injector
Image

You just need to put all BFF extracted files in a folder (which can have sub-folders) and all files, don't add or delete extracted files before repacking (adding files to the folder will not harm anything and will be simple ignored).

That's it, enjoy :)

Edited DDS car livery texture :D
Image

Image
Last edited by japamd on Tue Oct 06, 2009 2:30 pm, edited 29 times in total.
User avatar
japamd
advanced
Posts: 41
Joined: Sat Sep 19, 2009 10:26 pm
Has thanked: 3 times
Been thanked: 8 times

Re: NfS Shift .BFF files

Post by japamd »

bugtest,

Please, can you take a look at the attached file? I'm looking for string lengths or offsets but I can't figure out what kind of mechanism they used. I would really appreciate if you can give me some hint so I can start translating the game.
language_English.rar
Thanks!
You do not have the required permissions to view the files attached to this post.
User avatar
aluigi
VVIP member
VVIP member
Posts: 1916
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 664 times
Contact:

Re: NfS Shift .BFF files

Post by aluigi »

I see no offset or size values in these files
User avatar
japamd
advanced
Posts: 41
Joined: Sat Sep 19, 2009 10:26 pm
Has thanked: 3 times
Been thanked: 8 times

Re: NfS Shift .BFF files

Post by japamd »

Bugtest wrote:I see no offset or size values in these files
But do you see anything useful? I don't know how the strings are indexed, changing the length of a couple strings on the beginning it's sufficient to mess the entire game. :(
Simon
mega-veteran
mega-veteran
Posts: 180
Joined: Sun Sep 20, 2009 5:41 pm
Has thanked: 31 times
Been thanked: 20 times

Re: NfS Shift .BFF files

Post by Simon »

It's impossible to add a new File in the extracted Folder or change the lenght of any file?
Post Reply