Hacking [release] BFLIM Extractor

AboodXD

I hack NSMB games, and other shiz.
OP
Member
Joined
Oct 11, 2014
Messages
2,877
Trophies
1
Location
Not under a rock.
XP
2,904
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,877
Trophies
1
Location
Not under a rock.
XP
2,904
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
215
Trophies
1
XP
964
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,877
Trophies
1
Location
Not under a rock.
XP
2,904
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
  • No one is chatting at the moment.
  • YukiHomura @ YukiHomura:
    Or in turkish Iyi Geceler
  • BigOnYa @ BigOnYa:
    Game awards on now, live
  • Psionic Roshambo @ Psionic Roshambo:
    Hopefully Mario wins an award best plumber in video games or something
  • BigOnYa @ BigOnYa:
    Wonder won one already
  • GalacticWarsHalloween2023 @ GalacticWarsHalloween2023:
    Ironmouse won content creator??? This is invalid and I won't accept how a VTuber would win TGA (I support Raylife, the company that eliminates vtubers, and I am the founder of the company)
    +1
  • K3N1 @ K3N1:
    Gta 6 already won 12 awards
    +1
  • Sicklyboy @ Sicklyboy:
    Think I'm finally gonna install my hwfly modchip on my Switch OLED soon
  • GalacticWarsHalloween2023 @ GalacticWarsHalloween2023:
    "Ironmouse, you're next! let's see if you can stop you evil kind."
  • Psionic Roshambo @ Psionic Roshambo:
    Hmmm Hyperscan was in the XBox 360/PS3/Wii generation.... I guess the Wii wasn't the weakest lol
  • GalacticWarsHalloween2023 @ GalacticWarsHalloween2023:
    Hyperscan The console that uses cards
    +2
  • BigOnYa @ BigOnYa:
    cant believe that nickolodeon fighter game was nominated for best fighting game of the year. lol
  • K3N1 @ K3N1:
    Bring back arcade carts
  • FlareReZ @ FlareReZ:
    @K3N1, Hopefully lets not get the suicide battery in em.
  • K3N1 @ K3N1:
    I feel asleep to MJs song the girl is mine then I woke up like wait a minute mj how old was she
    +1
  • BigOnYa @ BigOnYa:
    then you woke up to "beat it"
  • a_username_that_is_cool @ a_username_that_is_cool:
    gyibhjm, .lkojihb hy6i8u79]8-9[0p;okl;ol;'[
  • a_username_that_is_cool @ a_username_that_is_cool:
    JO'p hyujiopn=
  • TheBakingGamer0424 @ TheBakingGamer0424:
    i didn't care to watch the game awards, what won goty?
  • TheBakingGamer0424 @ TheBakingGamer0424:
    guessing bg3
  • TheBakingGamer0424 @ TheBakingGamer0424:
    wow i just looked it up and i was right
  • TheBakingGamer0424 @ TheBakingGamer0424:
    AND HOW THE HELL DID HONKAI STAR RAIL WIN MOBILE GAME?
  • TheBakingGamer0424 @ TheBakingGamer0424:
    well, on second thought, at least it wasn't fkn hello kitty island adventure
    TheBakingGamer0424 @ TheBakingGamer0424: well, on second thought, at least it wasn't fkn hello kitty island adventure