A call to devs: Stop using libfat

V10lator

Well-Known Member
OP
Member
Joined
Apr 21, 2019
Messages
2,678
Trophies
1
Age
36
XP
5,658
Country
Germany
So why this call? Simple: Cause of caching issues. libFAT use its own cache, so distracts itself from CafeOS/IOSUs FAT driver. This leads to libfat and IOSUs FAT driver having different on-disc states in their caches which leads to filesystem corruptions.

Examples:
  • Currently the Wii U needs a restart after updating a homebrew with Wii U FTP Server (cause the homebrew launchers libfat will load from its cache instead of the SD card?).
  • SaveMii WUT has crashing issues since using libfat (exact source unknown but maybe cause SaveMii utilizes MCP which uses IOSU FAT).
  • Tried to switch to libfat with NUSspli one time. The result was horror (homebrew codes and MCP accessing the SD card at the same time, leading to horrible filesystem corruptions. Example:
    Code:
    /wiiu/apps/NUSspli  and
    /install/Yoshi's Island_ Super Mario Advance 3 [0005000010156a00]
      share clusters.
    )
While the impact on these caching issues might be extremely small (how many homebrews are using their own FS access while also utilizing OS libraries which do their own FAT access?) now Aroma will have an FTP plugin running always in the background so problems might rise in the future.
 
Joined
Apr 19, 2015
Messages
1,023
Trophies
1
Location
Stuck in the PowerPC
Website
heyquark.com
XP
3,915
Country
Australia
Currently the Wii U needs a restart after updating a homebrew with Wii U FTP Server (cause the homebrew launchers libfat will load from its cache instead of the SD card?).
I'm not sure the libfat page cache continues to exist after the parent app exits (in this case HBL, which I am pretty sure doesn't use libfat anyway?). Assuming the app in question doesn't do something silly like not unmounting the card it should all get flushed.

Race conditions with MCP sounds like a real issue though. Can't we unmount the card on the IOSU side? I thought we had to manually request for it to be mounted in the first place.
 
  • Like
Reactions: VinsCool

V10lator

Well-Known Member
OP
Member
Joined
Apr 21, 2019
Messages
2,678
Trophies
1
Age
36
XP
5,658
Country
Germany
Race conditions with MCP sounds like a real issue though. Can't we unmount the card on the IOSU side?
That would break tools like WUP Installer.
I thought we had to manually request for it to be mounted in the first place.
Each WUT homebrew auto-mounts the card:
https://github.com/devkitPro/wut/blob/master/libraries/wutcrt/wut_crt.c#L19
https://github.com/devkitPro/wut/blob/master/libraries/wutdevoptab/devoptab_fs.c#L77

Also keep in mind that Aroma will have that FTP plugin running always in the background. This FTP plugin will have SD access, too, so the card will be mounted all the time.
 
Joined
Apr 19, 2015
Messages
1,023
Trophies
1
Location
Stuck in the PowerPC
Website
heyquark.com
XP
3,915
Country
Australia
Fair. wut already supports replacing the built-in socket impl using weak symbols, maybe something similar should be added for the devoptab, which libfat can then hook into. Not only would this prevent the automount, this would also make development of apps using libfat less error-prone since the crt handles setup and teardown (at the potential cost of HaxchiFW compatibility, but who cares?)

Someone who isn't blacklisted (like I almost definitely am 😅) should ask them about that. @Maschell ?

Also keep in mind that Aroma will have that FTP plugin running always in the background. This FTP plugin will have SD access, too, so the card will be mounted all the time.
This would be a big problem, yes. Maybe the FTP plugin and/or the PluginSystem could have a callback to request it stop all access to the SD card?

I'm more inclined to fix things rather than stop using libfat outright, it's such a significant performance boost that it's worth investing into.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • SylverReZ @ SylverReZ:
    @Xdqwerty, To be fair, I have no idea.
    +1
  • SylverReZ @ SylverReZ:
    Likely because they are not as economic compared to us.
    +1
  • Xdqwerty @ Xdqwerty:
    @SylverReZ, so their only way of getting money is thru scams?
  • SylverReZ @ SylverReZ:
    @Xdqwerty, Exactly.
  • SylverReZ @ SylverReZ:
    Why not they just mine Monero instead of scamming vulnerable people? If they have a decent machine they can hit a jackpot at any given time.
    +1
  • SylverReZ @ SylverReZ:
    Bitcoin on the other hand, requires a very powerful mining rig and is more costly.
  • Xdqwerty @ Xdqwerty:
    @SylverReZ, different cultures so probably they have their reasons
  • K3Nv2 @ K3Nv2:
    Yes a $2,000 rig for $5 a day
  • SylverReZ @ SylverReZ:
    @Xdqwerty, Or could be in correlation to laws.
    +1
  • SylverReZ @ SylverReZ:
    Technically, cryptocurrencies aren't illegal, as long as you don't use it for criminal activity. If you sign up with an exchange, and that they get a tip from law enforcement, they have the right to freeze your assets.
    +1
  • Xdqwerty @ Xdqwerty:
    @SylverReZ, Yea I heard law is vastly different there
  • SylverReZ @ SylverReZ:
    Nigeria's central bank did make crypto illegal before, until last year they lifted the ban. Always make sure to check before you exchange. ;)
    +1
  • Xdqwerty @ Xdqwerty:
    @SylverReZ, speaking of crypto i remember reading about a guy who spend like 10 grand bitcoin on a couple pizzas (when bitcoin wasnt as worthy as nowadays)
  • SylverReZ @ SylverReZ:
    @Xdqwerty, That's mental. If he had saved up when Bitcoin sky-rocketed in price, then he might've become the next Jeff Bezos for all I know.
  • Xdqwerty @ Xdqwerty:
    @SylverReZ, he couldnt know the price was gonna skyrocket anyway
  • SylverReZ @ SylverReZ:
    @Xdqwerty, Then it dropped sometime in 2022, 2021 was when it really went up in price.
  • Xdqwerty @ Xdqwerty:
    @SylverReZ, I also recall watching a video of some failed games with their own crypto currency or smth like that, lemme link it to you (it's in spanish tho)
  • SylverReZ @ SylverReZ:
    @Xdqwerty, I remember that. Didn't Steam ban games with NFTs before somehow devs managed to circumvent it? Think EA tried to dabble in NFTs too.
  • SylverReZ @ SylverReZ:
    Glad to hear people realise that NFTs aren't worth it these days. They realise that they're JPEGs hosted on a file-hosting site like AWS or Google Drive.
  • Xdqwerty @ Xdqwerty:
    Atleast it has captions
  • SylverReZ @ SylverReZ:
    @Xdqwerty, Meta also tried to create their own crypto, but that fell through.
  • SylverReZ @ SylverReZ:
    Was called Libra, they had around 100 employees and wanted to hire more near to end of the year.
  • Xdqwerty @ Xdqwerty:
    @SylverReZ, idk why facebook tried to do that metaverse thing if mmo games already existed before
    Xdqwerty @ Xdqwerty: @SylverReZ, idk why facebook tried to do that metaverse thing if mmo games already existed before