Thursday, July 1, 2010

How to work with Xbox 360 PAC files using X-PacKer

Firstly you need to understand the way in which the XBOX Pac files are structured. The file contains many other archives and is structured in a hierarchical manner as follows:

PAC FILE (Which I refer to as “Main Pac”)
|---- PACH File
|--------- Model Files
|--------- Texture Archives
|------------------Textures

The texture archives and model files are bpe compressed and will need to be uncompressed if you would like to make changes to them. The texture archives are usually named with a “0” followed by a letter eg. 0A, 0B, etc.

Here are the steps you need to follow:

1. Open the Main PAC file by selecting Open – Xbox 360 Main Pac.
2. Once you have opened main pac, the program will display all the PACH files contained in the archive.
3. Note down the data contained in the “File Name” and the “size” columns. You will need these later. In my example the file name is 00013202 and the size is 458300.



4. Click “Extract” on the row of the PACH file you wish to extract.
5. The app will extract the PACH file. Open the PACH file which you have extracted by selecting Open – 360 PACH archive.
6. The app will list the contents of your PACH archive. Select uncompress for the file which you wish to work with. In this case the textures are contained in the 0A file so I will uncompress this file. The app will create two files, X-Packer extracts the file as is (0A.bpe) and also cerates an uncompressed version of the file which is 0A.pac.
7. On the row which lists the 0A.bpe file, select inject and choose the 0A.pac file.
8. X-PacKer will inject the uncompressed file into the PACH archive. If you have done this correctly, the extension field of 0A will change from bpe to a symbol.
9. Now that you have uncompressed the data in the PACH file, you can extract and inject the textures into the 0A archive. Double click on the FileName field of the archive you want to work with, in this case 0A. This will list the contents of 0A in a second grid.
10. Extract which ever dds files you wish to work with from the second grid and reinject when you are done.



11. Finally when you are done working with the PACH file, open the main pac file again and inject the PACH file you edited earlier.
12. Make a note of the new size of the PACH file, in this example it is 588000.



You are done editing the PAC file but for the new PAC to work in game, you need to change the size value in your arc files. The arch file lists the name of every PACH file and it’s size. If the wrong size is indicated, the game will freeze.


Here are the steps to change the size value in your arc file (I might automate this in the next release).

1. Open you arc files in a hex editor. The xbox version has two different arc files and you need to make the changes in both the arc files.
2. Search for the name of your PACH file i.e. in this case it was 00013202
3. A few bytes after the name of your PACH file, the size of the file divded by 100 is listed. In this example the original size of the PACH file was 458300. Therefore the value (458300/100 = 4583) is listed.
4. The size value must be updated to the new size of the PACH file. In this example the new size of the PACH file was 588000. Therefore the old value should be replaced with 5880 i.e. (588000/100 = 5880).
5. Remember to do this in both arc files.