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,921
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
310
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
28
Location
Austria
Website
epiclper.com
XP
1,141
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
310
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,921
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,060
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,921
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
310
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
310
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
  • sp3off @ sp3off:
    ouch @K3Nv2 hope nothing's too bad !
  • RedColoredStars @ RedColoredStars:
    xda a good site. My go to site for phone shit. :)
  • K3Nv2 @ K3Nv2:
    Females have burnt me worse
  • ZeroT21 @ ZeroT21:
    females don't exist
  • SylverReZ @ SylverReZ:
    @ZeroT21, Tamales exist.
    +1
  • RedColoredStars @ RedColoredStars:
    Setting FF to max performance on my gpu made it slower. lol. Tried it on Edge too just to see, and it made Edge slower too. lol
  • RedColoredStars @ RedColoredStars:
    Thanks for trying. :)
    +1
  • RedColoredStars @ RedColoredStars:
    ill just use edge and watch nintendo videos on firefox. lolol.
  • K3Nv2 @ K3Nv2:
    The everything beagle cup noodles are actually pretty decent
  • RedColoredStars @ RedColoredStars:
    dog noodles. mmmmmm.
  • ZeroT21 @ ZeroT21:
    monkey brains
  • RedColoredStars @ RedColoredStars:
    The cream cheese flavoring in the bagel cups scares me
  • RedColoredStars @ RedColoredStars:
    Did you try the breakfast one they make?
  • sp3off @ sp3off:
    A good salmon Poké bowl with some cream cheese is decadent
  • K3Nv2 @ K3Nv2:
    It's really not bad you just think of cold cream cheese
  • ZeroT21 @ ZeroT21:
    being lactose intolerant is a sin
  • RedColoredStars @ RedColoredStars:
    I dont like cream cheese. Thats why. Haha. The breakfast noodle cup sounds fantastic though.
  • K3Nv2 @ K3Nv2:
    I beat grilled cream cheese would be top notch
  • sp3off @ sp3off:
    @ZeroT21 tons of ingredients contains lactose more or less sadly. Makes them tummy aches and farts-o-lantern rocket launches
    +1
  • K3Nv2 @ K3Nv2:
    My only gripe too many poppy seeds a cop may taze me
  • RedColoredStars @ RedColoredStars:
    "Start your day with Cup Noodles Breakfast! This limited time flavor blends ramen with your favorite breakfast flavors, including pancakes, maple syrup, sausage, and eggs."
  • K3Nv2 @ K3Nv2:
    If our Walmart has them yours probably does
  • ZeroT21 @ ZeroT21:
    I came to like french Camembert
    ZeroT21 @ ZeroT21: I came to like french Camembert