Battleblock Theater (Xbox 360) .baf

Textures, recreate headers, conversions, algorithms and parsing of image files
Swagguy47
Posts: 2
Joined: Mon Sep 06, 2021 12:09 am

Battleblock Theater (Xbox 360) .baf

Post by Swagguy47 »

Just like the PC version, all sprites and animations are stored in the .baf files under "GameData/AnimFiles", despite this, previously made scripts (viewtopic.php?f=7&t=444&hilit=battleblock) seemingly fail to function with these Xbox 360 counterparts. I assume they're compressed, since that was also the problem on the PC game.

I'm a complete rook at this stuff, but a quick glance between two of the same textures from the PC and 360 versions in a hex editor shows they look completely different.

I'll supply some sample files from both platforms, any assistance is greatly appreciated! I thank you in advance :)
LinkOFF
Posts: 88
Joined: Thu Aug 11, 2016 6:52 pm

Re: Battleblock Theater (Xbox 360) .baf

Post by LinkOFF »

To extract X360 baf need to switch endian. Use this script:

Code: Select all

endian big
comtype zlib
get NAME filename
string NAME += ".dat"
get ZSIZE asize
math ZSIZE -= 4
get SIZE long
clog NAME 4 ZSIZE SIZE


To extract raw pixel data:

Code: Select all

# BattleBlock Theater .baf format (Xbox 360)
#
# Written by puggsoy and MerlinSVK
# script for QuickBMS http://quickbms.aluigi.org

big endian
comtype zlib
get ZSIZE asize
math ZSIZE -= 4
get SIZE long
clog MEMORY_FILE 4 ZSIZE SIZE

get FILENUM short MEMORY_FILE

goto 0x50 MEMORY_FILE

for i = 1 <= FILENUM
   get SIZE long MEMORY_FILE
   get OFFSET long MEMORY_FILE
   get NAME filename
   set NUM string i
   string NAME -= 4
   string NAME += _
   string NAME += NUM
   string NAME += .rawpixels
   
   log NAME OFFSET SIZE MEMORY_FILE
   
   goto 0x30 MEMORY_FILE SEEK_CUR
next i

but in this case we don't have a DDS header.
And idk what pixel format it is but looks like it's 8bpp format.

0x48 & 0x4C - width and heigth. 2048x2048 for BBTFont3_48.baf.