Hacking Possible fix for the WBFS corruption

AllWiidUp

Well-Known Member
OP
Newcomer
Joined
Dec 17, 2008
Messages
84
Trophies
0
XP
31
Country
Canada
Looking at the WBFS alloc and free functions I noticed an off by 1 error, that likely frees the wrong block.

in libwbfs.c:

CODE--- a/libwbfs.cÂÂ 2009-03-31 18:26:00.000000000 -0700
+++ b/libwbfs.cÂÂÂÂ 2009-04-12 12:28:23.516024000 -0700
@@ -389,8 +389,8 @@
}
static void free_block(wbfs_t *p,int bl)
{
-ÂÂÂÂÂÂÂÂint i = bl/(32);
-ÂÂÂÂÂÂÂÂint j = bl&31;
+ÂÂÂÂÂÂÂÂint i = (bl-1)/(32);
+ÂÂÂÂÂÂÂÂint j = (bl-1)&31;
ÂÂÂÂÂÂÂÂ u32 v = wbfs_ntohl(p->freeblks);
ÂÂÂÂÂÂÂÂ p->freeblks = wbfs_htonl(v | 1freeblks);
ÂÂÂÂÂÂÂÂp->freeblks = wbfs_htonl(v | 1wlba_table); // bl = info->wlba_table
ÂÂÂÂÂÂÂÂÂÂif (iwlba)
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂfree_block(p,iwlba); // should have beenÂÂfree_block(p,iwlba - 1);[/code]
but since "alloc_block" adds the +1 then "free_block" should have the -1, otherwise someone else might introduce the bug again, if the use free_block in another place since both block functions are used for "wlba_table".



EDIT:
WiiNinja compiled and tested a windows version with the fix and all it well ;P
WBFS.Windows.with.free.space.fix

now supported in WBFuse

Managers with Support:
WBFS Manager 2.2


Loaders with support:
KongsNutz Loader
Waninkoko v1.4
 

AllWiidUp

Well-Known Member
OP
Newcomer
Joined
Dec 17, 2008
Messages
84
Trophies
0
XP
31
Country
Canada
Mark McDonut said:
you should contact qwiirk or waninkoko, you really may be on to something.


I don't know Kwiirk's contact info and since he did up this version, I thought I'd put it out there in case he could see.
 

OuahOuah

Well-Known Member
Member
Joined
Oct 2, 2006
Messages
1,072
Trophies
1
Age
46
Location
France
Website
www.ouahouah.eu
XP
764
Country
France
He's on Wiibrew
smile.gif
 

FenrirWolf

Well-Known Member
Member
Joined
Nov 19, 2008
Messages
4,347
Trophies
1
Location
Sandy, UT
XP
615
Country
United States
So in what manner would this possibly fix the corruption? Would it cause a game to move the other games out of the way instead of overwriting them or something?
 

FoGBaV

Well-Known Member
Newcomer
Joined
Jan 31, 2008
Messages
82
Trophies
0
Age
52
Website
Visit site
XP
128
Country
Can someone confirm this fix - this would be the best Loader out there ... a Loader with no corruption in the file system ! 8)
 

FoGBaV

Well-Known Member
Newcomer
Joined
Jan 31, 2008
Messages
82
Trophies
0
Age
52
Website
Visit site
XP
128
Country
Its the libwbfs ... so its part of something when compiled ... so the usb loader has this code in it i guess ...
also the wbfs tools ...
 

djtaz

PM's Full - Wadder Me
Member
Joined
Sep 21, 2008
Messages
2,997
Trophies
0
Age
51
Website
Visit site
XP
101
Country
It would be a great find if its the fix - its been bugging everyone and makes the format seem a little unstable for most.
well done AllWiidup
 

Blue-K

No right of appeal.
Member
Joined
Jun 21, 2008
Messages
2,572
Trophies
0
Location
Helvetica
XP
209
Country
Swaziland
That's awesome!!!
smile.gif
.Good work! Have you maybe also found the bug why games can't be dumped by the Wii to a Partition over 512GB
tongue.gif
? That would be also awesome
wink.gif
.
 

wiiNinja

Well-Known Member
Member
Joined
Jan 13, 2009
Messages
645
Trophies
1
XP
1,755
Country
United States
QUOTE said:
You're completely right. It frees an incorrect block (we don't free the first block of the game, but we free the first block next to the last block of the game).

Finally, the bug is found. Thanks AllWiidup.
 

--=ZerO=--

Well-Known Member
Member
Joined
Jan 18, 2006
Messages
279
Trophies
0
XP
263
Country
Gambia, The
waninkoko said:
You're completely right. It frees an incorrect block (we don't free the first block of the game, but we free the first block next to the last block of the game).

So... i see... i'm sure u and kwiirk will fix this very soon... CIOS11 is on it's way.
wink.gif

U guys are great!
 

wiiNinja

Well-Known Member
Member
Joined
Jan 13, 2009
Messages
645
Trophies
1
XP
1,755
Country
United States
QUOTE said:
yeah, and? I thougth it's a problem of libwbfs and not the loader...

THe loader contains wbfs code for adding/deleting ISOs.

Version 1.3 does not fix this problem. I suspect 1.4.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • The Real Jdbye @ The Real Jdbye:
    cyberpunk at 4k without DLSS/fidelityfx *might* exceed 12gb
    +1
  • The Real Jdbye @ The Real Jdbye:
    but that game barely runs at native 4k
  • Psionic Roshambo @ Psionic Roshambo:
    I think it was some newer games and probably poorly optimized PS4 or PS5 ports
  • The Real Jdbye @ The Real Jdbye:
    they definitely will age better but i feel dlss might outweigh that since it looks about as good as native resolution and much less demanding
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    When I played Cyberpunk on my old 2080 Ti it sucked lol
  • The Real Jdbye @ The Real Jdbye:
    AMD could introduce something comparable to DLSS but nvidia's got a lot more experience with that
  • The Real Jdbye @ The Real Jdbye:
    least amd 7xxx has tensor cores which the previous generations didn't so there is the potential for AI upscaling
  • Psionic Roshambo @ Psionic Roshambo:
    They have FSR or whatever it's called and yeah it's still not great
  • The Real Jdbye @ The Real Jdbye:
    so AMD seem to finally be starting to take AI seriously
  • Psionic Roshambo @ Psionic Roshambo:
    Oh yeah those new 8000 CPUs have AI cores built in that's interesting
  • Psionic Roshambo @ Psionic Roshambo:
    Maybe they plan on offloading to the CPU?
  • Psionic Roshambo @ Psionic Roshambo:
    Would be kinda cool to have the CPU and GPU working in random more
  • Psionic Roshambo @ Psionic Roshambo:
    Tandem even
  • The Real Jdbye @ The Real Jdbye:
    i think i heard of that, it's a good idea, shouldn't need a dedicated GPU just to run a LLM or video upscaling
  • The Real Jdbye @ The Real Jdbye:
    even the nvidia shield tv has AI video upscaling
  • The Real Jdbye @ The Real Jdbye:
    LLMs can be run on cpu anyway but it's quite slow
  • BakerMan @ BakerMan:
    Have you ever been beaten by a wet spaghetti noodle by your girlfriend because she has a twin sister, and you got confused and fucked her dad?
  • Psionic Roshambo @ Psionic Roshambo:
    I had a girlfriend who had a twin sister and they would mess with me constantly.... Until one chipped a tooth then finally I could tell them apart.... Lol
  • Psionic Roshambo @ Psionic Roshambo:
    They would have the same hair style the same clothes everything... Really messed with my head lol
  • Psionic Roshambo @ Psionic Roshambo:
    @The Real Jdbye, I could see AMD trying to pull off the CPU GPU tandem thing, would be a way to maybe close the gap a bit with Nvidia. Plus it would kinda put Nvidia at a future disadvantage since Nvidia can't make X86/64 CPUs? Intel and AMD licensing issues... I wonder how much that has held back innovation.
  • The Real Jdbye @ The Real Jdbye:
    i don't think nvidia wants to get in the x64 cpu market anyways
  • The Real Jdbye @ The Real Jdbye:
    you've seen how much intel is struggling getting into the gpu market
  • The Real Jdbye @ The Real Jdbye:
    and nvidia is already doing ARM
  • The Real Jdbye @ The Real Jdbye:
    i don't think they want to take more focus away from their gpus
    The Real Jdbye @ The Real Jdbye: i don't think they want to take more focus away from their gpus