Hacking libfat with USB patch needed

D-Jay

High rulez
OP
Member
Joined
Jan 23, 2009
Messages
555
Trophies
0
Age
45
Location
Home
XP
570
Country
Germany
Hey guys,

I have to compile some code with DevKitPro, but everytime I get some errors:

Code:
c:/wiiprojects/installer/source/installer.c:31: error: 'PI_INTERNAL_SD' undeclared here (not in a function)
c:/wiiprojects/installer/source/installer.c: In function 'main':
c:/wiiprojects/installer/source/installer.c:348: error: 'PI_SDGECKO_A' undeclared (first use in this function)
c:/wiiprojects/installer/source/installer.c:348: error: (Each undeclared identifier is reported only once
c:/wiiprojects/installer/source/installer.c:348: error: for each function it appears in.)
c:/wiiprojects/installer/source/installer.c:352: error: 'PI_SDGECKO_B' undeclared (first use in this function)
c:/wiiprojects/installer/source/installer.c:360: error: 'PI_USBSTORAGE' undeclared (first use in this function)
make[1]: *** [installer.o] Error 1
"make": *** [build] Error 2

I think that's USB-Patch for libfat!?

Does somebody have the correct libfat?


Thanks & greets
 

WiiPower

Well-Known Member
Member
Joined
Oct 17, 2008
Messages
8,165
Trophies
0
XP
345
Country
Gambia, The
Looks correct to me. One update to libfat changed some things, and you need to change the code of you project a liitle to fix it. For example " fatInitDefault();" now initializes both sd card and usb, To unmount the devices you need fatUnmount("sd"); and fatUnmount("usb");. And the filenames now require "sd:/..." or "usb:/..." instead of "fat:/...". Oh and usb does not work after a change of the used IOS.
 

WiiPower

Well-Known Member
Member
Joined
Oct 17, 2008
Messages
8,165
Trophies
0
XP
345
Country
Gambia, The
D-Jay said:
I tried some older libfats but none of them worked.

I don't want to rewrite the whole code.

If i remember correctly and the project you have doesn't do anything strange, you only need to fix the compiling errors with the commands i posted and to search all commands which include file paths like "fat:/..." and patch them.
 

D-Jay

High rulez
OP
Member
Joined
Jan 23, 2009
Messages
555
Trophies
0
Age
45
Location
Home
XP
570
Country
Germany
WiiPower said:
D-Jay said:
I tried some older libfats but none of them worked.

I don't want to rewrite the whole code.

If i remember correctly and the project you have doesn't do anything strange, you only need to fix the compiling errors with the commands i posted and to search all commands which include file paths like "fat:/..." and patch them.

I don't have something like "fat:/"

Sorry...
 

D-Jay

High rulez
OP
Member
Joined
Jan 23, 2009
Messages
555
Trophies
0
Age
45
Location
Home
XP
570
Country
Germany
WiiPower said:
If you PM me the code, i will take a look at it. Tomorrow(today).

Thanks. I'm going to try something. If it not works, I will send you the source.


---
Edit:
-btw- I took some code from WAD Manager 1.3 for testing. It uses the same variables and dumps me same error code!
Maybe you can take a look at waninkokos source.
 

WiiPower

Well-Known Member
Member
Joined
Oct 17, 2008
Messages
8,165
Trophies
0
XP
345
Country
Gambia, The
Send me the code of the project you want to change. I'm sure i can change the WAD Manager code to use the new libfat methods.
 

Jacobeian

Well-Known Member
Member
Joined
May 15, 2008
Messages
1,893
Trophies
0
XP
387
Country
Cuba
you don't need to re-code much, you just replace the function (don't remember the name) that use those PI_xxx as parameter to initialize stuff and replace everything by fatInitDefault() as WiiPower told you

then in filenames used as parameter for fopen function calls, you should make them start by by usb: or sd: (for example, /wad/xxx.wad becomes sd:/wad/xxx.wad)

btw, if the project you want to compile is the backup launcher, you can also get rid of any call to libfat stuff and commenting them, they are only used for Ocarina (remember backup laucher is a rip of gekko OS)
 

D-Jay

High rulez
OP
Member
Joined
Jan 23, 2009
Messages
555
Trophies
0
Age
45
Location
Home
XP
570
Country
Germany
The project is based on WAD Manager 1.3

Everything I found with "fat" is the following:

QUOTE said:
/* Generate dirpath */
sprintf(dirpath, "fat%d:/" WAD_DIRECTORY, device);

QUOTE said:
/* Generate filepath */
sprintf(filepath, "fat%d:/" WAD_DIRECTORY "/%s", device, ptr);

Changed it to QUOTE
sd%d:/

Doesn't work.
 

WiiPower

Well-Known Member
Member
Joined
Oct 17, 2008
Messages
8,165
Trophies
0
XP
345
Country
Gambia, The
sprintf(filepath, "fat%d:/" WAD_DIRECTORY "/%s", device, ptr);

will return "fat1:/..." as path for device == 1


for sd you need to change it to
sprintf(filepath, "sd:/" WAD_DIRECTORY "/%s", ptr);

for usb you need to change it to
sprintf(filepath, "usb:/" WAD_DIRECTORY "/%s", ptr);
 

WiiPower

Well-Known Member
Member
Joined
Oct 17, 2008
Messages
8,165
Trophies
0
XP
345
Country
Gambia, The
I got it to compile with the new libfat and shortly tested it. It displayed the wads i had on sd card and usb stick.

I removed libpng and the banner, because i didn't get them to work. I changed it to return to the HBC instead of rebooting as this is 10 times more safe if you plan to install cioscorp with it and i removed the sd gecko support, now only sd card and usb storage are supported.


http://rapidshare.com/files/197979542/wadmanagersrc.zip.html
 

WiiCrazy

Be water my friend!
Member
Joined
May 8, 2008
Messages
2,397
Trophies
1
Location
Istanbul
Website
www.tepetaklak.com
XP
424
Country
There are some more annoying differences between those two libs, yesterday got some issues with them too...

For example, after seeking to the end of the file and using ftell to get the size, it returns just 4...

Best is to use the compatible fat lib that application is meant to be compiled with...

You can find the libogc with that old interface in the mplayerwii's old source dumps,
http://ronwarez.com/mplayerwii/old/

Just rename the libogc in the devkitpro folder and copy the one with the old fat interface...
If there are any missing libs, you need to manually add...
 

WiiPower

Well-Known Member
Member
Joined
Oct 17, 2008
Messages
8,165
Trophies
0
XP
345
Country
Gambia, The
I never had problems with ftell with the new libfat, only the problem that usb is unusable if you want to use it before and after a IOS reload.
 

D-Jay

High rulez
OP
Member
Joined
Jan 23, 2009
Messages
555
Trophies
0
Age
45
Location
Home
XP
570
Country
Germany
WiiCrazy said:
There are some more annoying differences between those two libs, yesterday got some issues with them too...

For example, after seeking to the end of the file and using ftell to get the size, it returns just 4...

Best is to use the compatible fat lib that application is meant to be compiled with...

Think so, too. But I don't know where to download the fatlib / projectfiles for WAD-Manager 1.3
 

nicksasa

Well-Known Member
Member
Joined
Oct 25, 2008
Messages
1,410
Trophies
0
XP
79
Country
Belgium
look for the libs on the devkitpro sourceforge site
wink.gif
and i also have 2 libogc's the old one and the new one i only use the old one for gamma and wad manager 1.3
 

D-Jay

High rulez
OP
Member
Joined
Jan 23, 2009
Messages
555
Trophies
0
Age
45
Location
Home
XP
570
Country
Germany
nicksasa said:
look for the libs on the devkitpro sourceforge site
wink.gif
and i also have 2 libogc's the old one and the new one i only use the old one for gamma and wad manager 1.3

I tried several libs from there. Nothing worked.
I'm going to try something else.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users