Hacking [release] BFLIM Extractor

AboodXD

I hack NSMB games, and other shiz.
OP
Member
Joined
Oct 11, 2014
Messages
2,880
Trophies
1
Location
Not under a rock.
XP
2,926
Country
United Arab Emirates
BFLIM Extractor v2.1

BFLIM Extractor is a tool for extracting and creating .bflim files used for layouts' textures in some of the Wii U games.

Supported texture formats:
  • GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM (ABGR8 / BGR8)
  • GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_SRGB (ABGR8 SRGB / BGR8 SRGB)
  • GX2_SURFACE_FORMAT_TCS_R10_G10_B10_A2_UNORM (A2RGB10)
  • GX2_SURFACE_FORMAT_TCS_R5_G6_B5_UNORM (RGB565)
  • GX2_SURFACE_FORMAT_TC_R5_G5_B5_A1_UNORM (A1RGB5)
  • GX2_SURFACE_FORMAT_TC_R4_G4_B4_A4_UNORM (ARGB4)
  • GX2_SURFACE_FORMAT_TC_R8_UNORM (L8 / A8)
  • GX2_SURFACE_FORMAT_TC_R8_G8_UNORM (A8L8)
  • GX2_SURFACE_FORMAT_TC_R4_G4_UNORM (A4L4)
  • GX2_SURFACE_FORMAT_T_BC1_UNORM (BC1 / DXT1 / ETC1)
  • GX2_SURFACE_FORMAT_T_BC1_SRGB (BC1 SRGB / DXT1 SRGB)
  • GX2_SURFACE_FORMAT_T_BC2_UNORM (BC2 / DXT3)
  • GX2_SURFACE_FORMAT_T_BC2_SRGB (BC2 SRGB / DXT3 SRGB)
  • GX2_SURFACE_FORMAT_T_BC3_UNORM (BC3 / DXT5)
  • GX2_SURFACE_FORMAT_T_BC3_SRGB (BC3 SRGB / DXT5 SRGB)
  • GX2_SURFACE_FORMAT_T_BC4_UNORM (BC4L / BC4A)
  • GX2_SURFACE_FORMAT_T_BC5_UNORM (BC5)
Treeki said:
Why so complex?
Wii U textures appear to be packed using a complex 'texture swizzling' algorithm, presumably for faster access.

Download.
Source code / Github.
 
Last edited by AboodXD,

Ray Koopa

Obviously a Koopaling
Member
Joined
Aug 18, 2015
Messages
332
Trophies
0
XP
320
Country
Batch is your friend (converts all BFLIM files in Convert folder):
Code:
@ECHO OFF
FOR %%f IN (Convert/*.bflim) DO (
    ECHO Converting: .\Convert\%%f
    BFLIM_EXTRACT Convert/%%f
)

Suggestions:
- Please don't wait 5 seconds to display errors. Horrible in a batch process. Maybe just do that if started without any parameters to make users just clicking the exe see it.
- Support output path
- Don't open input files with write access (errors out when read-only flag set)

I like your effort. Format 0x10 and 0xF is heavily used in MK8, looking forward for support. Sadly, the other formats are not unswizzled correctly most of the time.
errors.png
 
Last edited by Ray Koopa,

EpicLPer

Your friendly Austrian IT Guy
Member
Joined
Mar 13, 2015
Messages
1,060
Trophies
0
Age
29
Location
Austria
Website
epiclper.com
XP
1,151
Country
Austria
Batch is your friend (converts all BFLIM files in Convert folder):
Code:
@ECHO OFF
FOR %%f IN (Convert/*.bflim) DO (
    ECHO Converting: .\Convert\%%f
    BFLIM_EXTRACT Convert/%%f
)

Suggestions:
- Please don't wait 5 seconds to display errors. Horrible in a batch process. Maybe just do that if started without any parameters to make users just clicking the exe see it.
- Support output path
- Don't open input files with write access (errors out when read-only flag set)

I like your effort. Format 0x10 and 0xF is heavily used in MK8, looking forward for support. Sadly, the other formats are not unswizzled correctly most of the time.
errors.png
Suggestion: Add a /nowait option or something, also a /folder maybe to make it easier ;)

But it's still early so yeah, we'll see :D

PS.: Oh boy I'm so hyped for all the dick texture replacements people will come up with then lol (sarcasm)
 
  • Like
Reactions: TotalInsanity4

Ray Koopa

Obviously a Koopaling
Member
Joined
Aug 18, 2015
Messages
332
Trophies
0
XP
320
Country
NOWAIT? You stole that name from Commander Keen right? :P
Anyway, don't do that, a command line tool should never wait needlessy, so handle it cleverly just when displaying help.
 

AboodXD

I hack NSMB games, and other shiz.
OP
Member
Joined
Oct 11, 2014
Messages
2,880
Trophies
1
Location
Not under a rock.
XP
2,926
Country
United Arab Emirates
All your requests are too easy to implement. :P

@EpicLPer Use:
Code:
for %%f in (Path/*.bflim) do bflim_extract Path/%%f

Files which end with ^l are RGBA32 files, those are 100% tested and they work perfectly.
Files which end with ^o, ^p, or ^q are BC compressed, those are 100% tested, for some odd reason the output image gets cut in half... :/

Everything else isn't supported, and will be soon.
 
Last edited by AboodXD,

Spidey_BR

Well-Known Member
Member
Joined
Feb 1, 2008
Messages
217
Trophies
1
XP
1,179
Country
Netherlands
Nice work. Too bad my Python skills are ridiculous at best. I was hoping to fork and implement the requested changes right away (no sleep, error code semantics) just as a practice section.

What are the references on these file formats?
 

AboodXD

I hack NSMB games, and other shiz.
OP
Member
Joined
Oct 11, 2014
Messages
2,880
Trophies
1
Location
Not under a rock.
XP
2,926
Country
United Arab Emirates
I've already made a documentation of the GFD (A very similar format to BFLIM, they're both used on Wii U) File format, you can find it here:
https://github.com/aboood40091/GTX-Extractor/wiki

It's a bit incomplete but that doesn't matter that much. :P

I can still make a documentation of the BFLIM File format if you want.

Please note that both GFD and BFLIM formats are very complex.
 
Last edited by AboodXD,

Ray Koopa

Obviously a Koopaling
Member
Joined
Aug 18, 2015
Messages
332
Trophies
0
XP
320
Country
For me it's just the bugs I posted in my previous post, if you want =3
- Don't wait 5 seconds
- Don't open input files with write access
- Look at the other format which completely throws up due to wrong swizzling (the greenish blocks)
 

Ray Koopa

Obviously a Koopaling
Member
Joined
Aug 18, 2015
Messages
332
Trophies
0
XP
320
Country
If you call open, don't pass 'w'. That makes the program crash being incapable to open files with a read-only flag. Just open them with 'rb'. I send you the files as a PM
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BigOnYa @ BigOnYa:
    It was my old PC way back in the day that I passed down to her when built mine. Was decent then, poop now. She never use it anyways, she use her iPad mostly.
  • K3Nv2 @ K3Nv2:
    2 years ago?
    +1
  • BigOnYa @ BigOnYa:
    lol, no that one i built like 8 years ago. My new one has a Ryzen 7 something, with a GTX 2080.
  • K3Nv2 @ K3Nv2:
    So 80 years ago in pc years
    +1
  • BigOnYa @ BigOnYa:
    Cool tho
  • Sicklyboy @ Sicklyboy:
    2080 gang
    +1
  • K3Nv2 @ K3Nv2:
    Sell your steam account for a new gpu
  • BigOnYa @ BigOnYa:
    That 2080 and HDs prob only parts I can use on a new PC build.
  • K3Nv2 @ K3Nv2:
    I like how people buy switches and use Xbox style controllers with them
  • BigOnYa @ BigOnYa:
    I use a Switch pro controller, its close to Xbox style, other than stupid A B X Y buttons reversed.
  • K3Nv2 @ K3Nv2:
    Must be a crappy feeling for switch owners $300 device just to get crushed by linux
  • BigOnYa @ BigOnYa:
    I've had mine since launch, a V1. Did have to put new battery in it last year tho.
  • K3Nv2 @ K3Nv2:
    Yeah launch I get it because it takes emulation a good couple years
    +1
  • BigOnYa @ BigOnYa:
    I wonder how well switch 2 games will play in emulators, but then again, how would you dump the game anyways.
  • K3Nv2 @ K3Nv2:
    I almost picked up deodorant thinking it was mouthwash I mean same principle?
  • Veho @ Veho:
    As long as it's not antiperspirant, it's all the same.
  • Veho @ Veho:
    Alcohol, glycerine, aroma, water. Works on whatever needs cleaning.
  • K3Nv2 @ K3Nv2:
    Mouthwash for the ballsack only stings a little
  • BigOnYa @ BigOnYa:
    Like you would know....Ms. Ken
  • K3Nv2 @ K3Nv2:
    Your wife taught me how to use it on ballsacks
    +1
  • K3Nv2 @ K3Nv2:
    Ancientboi finally got booked
    K3Nv2 @ K3Nv2: Ancientboi finally got booked