Added a notes file

Updated header parsing, and replaced the endian with little instead of big, because the files are def little endian
This commit is contained in:
2025-09-18 22:53:57 -06:00
parent c24cca2373
commit 19344c50d5
2 changed files with 63 additions and 11 deletions

24
main.py
View File

@@ -12,7 +12,7 @@ class BZZCompressor:
# read the input file # read the input file
try: try:
with open(f"{input_file_path}/{input_file}", "rb") as infile: with open(f"{input_file_path}/{input_file}", "rb") as infile:
temp = bitarray(endian="big") temp = bitarray(endian="little")
temp.fromfile(infile) temp.fromfile(infile)
data = temp.tobytes() data = temp.tobytes()
@@ -30,13 +30,9 @@ class BZZCompressor:
############################################################################## ##############################################################################
# This is always 1, 0, 0, 0. so I'm just having fun # This is always 1, 0, 0, 0. so I'm just having fun
bzz_version = f"v{data[0]}.{data[1]}.{data[2]}.{data[3]}" bzz_version = int.from_bytes(data[0:4], "little")
game_id = "".join([str(int(bin(item)[2:], 2)) for item in data[4:8]]) game_id = int.from_bytes(data[4:8], "little")
num_files = int.from_bytes(data[8:12], "little")
num_files = 0
for item in data[8:12]:
num_files += int(bin(item)[2:].zfill(8), 2)
print(f"BZZ Version: {bzz_version}") print(f"BZZ Version: {bzz_version}")
print(f"Game ID: {game_id}") print(f"Game ID: {game_id}")
@@ -48,9 +44,15 @@ class BZZCompressor:
tmp = (i) * 12 tmp = (i) * 12
files.append( files.append(
{ {
"pt_a": data[12 + tmp : 12 + tmp + 4], "pt_a": hex(
"pt_b": data[12 + tmp + 4 : 12 + tmp + 8], int.from_bytes(data[12 + tmp : 12 + tmp + 4], "little")
"pt_c": data[12 + tmp + 8 : 12 + tmp + 12], ),
"pt_b": hex(
int.from_bytes(data[12 + tmp + 4 : 12 + tmp + 8], "little")
),
"pt_c": hex(
int.from_bytes(data[12 + tmp + 8 : 12 + tmp + 12], "little")
),
} }
) )

50
notes.txt Normal file
View File

@@ -0,0 +1,50 @@
Conclusions based on the data below:
1. It looks like the Part A is the file's type
2. It looks like Part C - Part B is 1 more than the length of the 0-padding between files
note: I don't know why they didn't just write the file's size here, it would've saved on space
3. PS1 developers were madlads
Header:
Header Data Start: 0x00
Header Data End: 0x2F
0 Padding Start: 0x30
0 Padding End: 0x7FB
Checksum Start: 0x7FC
Checksum End: 0x7FF
File 1:
Part A: 0x1
Part B: 0x8fc
Part C: 0x1000
C - B = 0x704
Data Start: 0x800
Data End: 0x10F9
0 Padding Start: 0x10FA
0 Padding End: 0x17FF
End - Start = 0x705
File 2:
Part A: 0x3
Part B: 0xE240
Part C: 0xE800
C - B = 0x5C0
Data Start: 0x1800
Data End: 0xFA3F
0 Padding Start: 0xFA40
0 Padding End: 0xFFFF
0 Padding End - Start = 0x5BF
File 3:
Part A: 0x4
Part B: 0xD450
Part C: 0xD800
C - B = 0x3B0
Data Start: 0x10000
Data End: 0x1D44F
0 Padding Start: 0x1D450
0 Padding End: 0x1D7FF
End - Start = 3AF