An Optional Chapter, Very Technical

Since we know that BCON resource 4097 contains the constant values, we would like a way to edit it. Although a PC user can edit BCON and BHAV code directly with IFFPencil2, this was not possible with IFFSnooper at the time this tutorial was first written in 2006.
So if you were using IFFSnooper 1.2.2 or earlier you would need to export and hex edit the individual resources, then reassemble the object, as shown below. A more direct way to edit these resources is shown on later pages.


Hex Editing Resources

If we open up the BCON resource 4097 from our disassembled chair with the program HexEdit, it looks like this:

BCON 4097 hex

This is slightly different from the IFFSnooper raw hex data view because it includes an extra 76 bytes (the resource header) which tell the game that this is a BCON resource called Tuning - Comfort with ID number 4097 (in hex notation). The header is always 76 bytes long and we usually don't want to modify it when we are altering the resource data. The rest of the resource is highlighted in blue. This is the part that contains the constant values which we want to modify.

Although we could edit the resource directly inside HexEdit, it is not an appealing option for most people. For one thing, it can be tricky to locate the right bytes to edit. Since the data is not formatted, everything runs together, and the larger the resource, the harder it is to find the right section to edit.

Look, for example, at BHAV resource 4113 in HexEdit, with the resource data highlighted. The bytes for "Test <=" and "stack obj's motives:Comfort" are much harder to locate now than they were in the IFFSnooper data window:

BHAV 4113 hex


IFFSnooper can help you from getting lost in a sea of unformatted hex data by exporting the resource data section as a formatted text file. This keeps the resource lines separate so they are easier to identify when editing. Once you have edited the formatted hex data, it can be pasted back into the object.

If you have IFFSnooper 1.2.0 you will need to paste the edited hex data into the disassembled resource file using HexEdit and then reassemble the object. If you have IFFSnooper 1.2.1 and later then you can skip the disassembly and reassembly steps and paste the edited hex data directly back into the object you plan to modify.

First we should walk through the process of exporting the BCON resource 4097 hex data as formatted text. Navigate to the resource using the pop-up menus and then use the Export Hex button.

Export Hex

You will be asked where you would like to save the hex data text file. The default file name is " BCON 4097 hex data" although you can change it to something else if you prefer.

The exported text looks like this:
hex data for Chair - Dining - Cheap.iff (2)
----
BCON, ID# 4097
Tuning - Comfort
Displaying binary data as hex
0C 80
01 00
02 00
03 00
04 00
01 00
01 00
14 00
1E 00
28 00
3C 00
1E 00
1E 00
----

Since this is a BCON resource, IFFSnooper exported the binary data as a series of lines of two bytes each. The hex values correspond to the decimal values we saw earlier
e.g. hex 14 = decimal 20, hex 1E = decimal 30, and so on.
The first line of hex defines how many lines are to follow (hex 0C = decimal 12).