Jump to content

Pack and list files: Difference between revisions

From Battle Cats Game Modding Wiki
m fixed syntax highlight error
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
.pack and .list files are the files which contain most of the game's assets, stats, text, and animations.
.pack and .list files are the files which contain most of the game's assets, stats, text, and animations.


If you just want to know how to decrypt the files, see [Extracting .pack and .list files].
If you just want to know how to decrypt the files, see [[Extracting .pack and .list files]].


== .list files ==
== .list files ==
Line 94: Line 94:
==== Local files post 8.9.0 ====
==== Local files post 8.9.0 ====


If your pack file is a local pack file from a game package after the 8.9.0 update, then you need to use AES in the CBC mode. The keys and initial vectors change based on region and game version.
If your pack file is a local pack file from a game package after the 8.9.0 update, then you need to use AES in the CBC mode. The keys and initial vectors change based on region and game version. The following keys and initial vectors are not ASCII encoded hex strings, they are the exact bytes themselves.


===== EN or Pre 10.8.0 =====
===== EN or Pre 10.8.0 =====


If you are using the English version or a version from before 10.8.0, then the following is used:
If you are using the English version or a version from before 10.8.0, then the following keys and initial vectors  are used:


* key: <code>0ad39e4aeaf55aa717feb1825edef521</code>
* key: <code>0ad39e4aeaf55aa717feb1825edef521</code>
Line 104: Line 104:


===== JP =====
===== JP =====
If you are using the Japanese version then the following keys and initial vectors are used:


* key: <code>d754868de89d717fa9e7b06da45ae9e3</code>
* key: <code>d754868de89d717fa9e7b06da45ae9e3</code>
Line 109: Line 111:


===== KR =====
===== KR =====
If you are using the Korean version then the following keys and initial vectors are used:


* key: <code>bea585eb993216ef4dcb88b625c3df98</code>
* key: <code>bea585eb993216ef4dcb88b625c3df98</code>
Line 114: Line 118:


===== TW =====
===== TW =====
If you are using the Taiwanese version then the following keys and initial vectors are used:


* key: <code>313d9858a7fb939def1d7d859629087d</code>
* key: <code>313d9858a7fb939def1d7d859629087d</code>
* iv: <code>0e3743eb53bf5944d1ae7e10c2e54bdf</code>
* iv: <code>0e3743eb53bf5944d1ae7e10c2e54bdf</code>
=== Removing Padding ===
As is with the .list files, you need to remove the PKCS#7 padding from the end of the file (unless its a file from ImageDataLocal.pack)

Latest revision as of 13:32, 9 September 2025

.pack and .list files are the files which contain most of the game's assets, stats, text, and animations.

If you just want to know how to decrypt the files, see Extracting .pack and .list files.

.list files

.list files are the CSV files which specify the metadata about the files contained in the associated .pack file, it details the total number of files, the filename for each file, the start byte offset of each file, and the total size of each file.

Decrypting a .list file

Before opening the .list file, it needs to be decrypted.

The decryption algorithm is AES in ECB mode.

The key is the first 16 bytes of the ASCII encoded hex string of the MD5 hash of the string "pack", so the ASCII encoded string of "b484857901742afc".

After decryption, you must remove the PKCS#7 padding

The following Python code should provide a basic guide:

from Cryptodome.Cipher import AES
from Cryptodome.Util.Padding import unpad

with open("path_to_list.list", "rb") as f:
    data = f.read()

key = b"b484857901742afc"
cipher = AES.new(key, AES.MODE_ECB)

decrypted_data = cipher.decrypt(data)
unpadded = unpad(decrypted_data, 16)

print(unpadded.decode("utf-8"))

.list file CSV format

Once decrypted, you can open the .list file in a text editor, you will see that is a CSV file with many rows.

For example:

3
file1.csv,0,1040
cool_file.png,1040,512
cool_file.imgcut,1542,15824

The first row, the 3 in this case, is the total number of files in the .list file (and hence the associated .pack file).

Each row that follows will be the details for a file in the .pack file.

Take the first file for example:

file1.csv,0,1040

The first column is the name of the file, file1.csv in this case.

The second column is the start offset of the file in bytes inside the .pack file. So the 0 in this case means that file1.csv data starts at the very start of the .pack file.

The third column is the total length of the file in bytes (including any padding if present) as it appears in the pack file. So the 1040 in this case means that the file is 1040 bytes in size including padding.

If the .pack file contains encrypted files, every file will be padded to a 16 byte boundary, so the start offset and total size should always be a multiple of 16 in case.

Note that when writing code to read a .list file, you should not assume that the file offsets are always strictly increasing and that there is are no gaps between files, because the game supports both of those things.

.pack files

.pack files contain the actual data of the files.

Each file in a .pack file is encrypted separately and so needs to be decrypted separately. This means that instead of each file being placed one after the other in the .pack file, and then the whole .pack file is encrypted at once, they are each encrypted, then placed one after another in the .pack file.

Every .pack file contains encrypted files except ImageDataLocal.pack, so if you are writing code to extract a .pack file, you will need to be aware of this difference and just copy the files directly from the .pack into another directory.

Getting a file from a .pack file

To extract a file from a .pack file, you first need to find the file's row in a .list file.

Once you have the start offset and length of the file you can open the .pack file and seek to the start offset, then read the specified number of bytes.

If your pack file is ImageDataLocal, you can stop there since it's not encrypted.

Otherwise, you will need to decrypt the file data. The algorithm and key change depending on region and game version.

Server or pre 8.9.0 .pack files

If your pack file is from the game servers rather than from the game package or from a game version before 8.9.0, you need to use AES in ECB mode again with the key being the first 16 bytes of the ASCII encoded hex string of the MD5 hash of the string "battlecats", so the ASCII encoded string of "89a0f99078419c28".

Local files post 8.9.0

If your pack file is a local pack file from a game package after the 8.9.0 update, then you need to use AES in the CBC mode. The keys and initial vectors change based on region and game version. The following keys and initial vectors are not ASCII encoded hex strings, they are the exact bytes themselves.

EN or Pre 10.8.0

If you are using the English version or a version from before 10.8.0, then the following keys and initial vectors are used:

  • key: 0ad39e4aeaf55aa717feb1825edef521
  • iv: d1d7e708091941d90cdf8aa5f30bb0c2
JP

If you are using the Japanese version then the following keys and initial vectors are used:

  • key: d754868de89d717fa9e7b06da45ae9e3
  • iv: 40b2131a9f388ad4e5002a98118f6128
KR

If you are using the Korean version then the following keys and initial vectors are used:

  • key: bea585eb993216ef4dcb88b625c3df98
  • iv: 9b13c2121d39f1353a125fed98696649
TW

If you are using the Taiwanese version then the following keys and initial vectors are used:

  • key: 313d9858a7fb939def1d7d859629087d
  • iv: 0e3743eb53bf5944d1ae7e10c2e54bdf

Removing Padding

As is with the .list files, you need to remove the PKCS#7 padding from the end of the file (unless its a file from ImageDataLocal.pack)