libfat with USB patch needed

Discussion in 'Wii - Hacking' started by D-Jay, Feb 14, 2009.

Feb 14, 2009

libfat with USB patch needed by D-Jay at 12:33 AM (3,133 Views / 0 Likes) 23 replies

  1. D-Jay
    OP

    Member D-Jay GBAtemp Fan

    Joined:
    Jan 23, 2009
    Messages:
    477
    Location:
    Germany
    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
     


  2. WiiPower

    Member WiiPower GBAtemp Guru

    Joined:
    Oct 17, 2008
    Messages:
    8,165
    Country:
    Germany
    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.
     
  3. D-Jay
    OP

    Member D-Jay GBAtemp Fan

    Joined:
    Jan 23, 2009
    Messages:
    477
    Location:
    Germany
    Country:
    Germany
    I tried some older libfats but none of them worked.

    I don't want to rewrite the whole code.
     
  4. WiiPower

    Member WiiPower GBAtemp Guru

    Joined:
    Oct 17, 2008
    Messages:
    8,165
    Country:
    Germany
    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.
     
  5. D-Jay
    OP

    Member D-Jay GBAtemp Fan

    Joined:
    Jan 23, 2009
    Messages:
    477
    Location:
    Germany
    Country:
    Germany
    I don't have something like "fat:/"

    Sorry...
     
  6. WiiPower

    Member WiiPower GBAtemp Guru

    Joined:
    Oct 17, 2008
    Messages:
    8,165
    Country:
    Germany
    If you PM me the code, i will take a look at it. Tomorrow(today).
     
  7. D-Jay
    OP

    Member D-Jay GBAtemp Fan

    Joined:
    Jan 23, 2009
    Messages:
    477
    Location:
    Germany
    Country:
    Germany
    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.
     
  8. D-Jay
    OP

    Member D-Jay GBAtemp Fan

    Joined:
    Jan 23, 2009
    Messages:
    477
    Location:
    Germany
    Country:
    Germany
    Edit: sorry double-posting
     
  9. WiiPower

    Member WiiPower GBAtemp Guru

    Joined:
    Oct 17, 2008
    Messages:
    8,165
    Country:
    Germany
    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.
     
  10. Jacobeian

    Member Jacobeian GBAtemp Advanced Maniac

    Joined:
    May 15, 2008
    Messages:
    1,879
    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)
     
  11. D-Jay
    OP

    Member D-Jay GBAtemp Fan

    Joined:
    Jan 23, 2009
    Messages:
    477
    Location:
    Germany
    Country:
    Germany
    The project is based on WAD Manager 1.3

    Everything I found with "fat" is the following:

    Doesn't work.
     
  12. WiiPower

    Member WiiPower GBAtemp Guru

    Joined:
    Oct 17, 2008
    Messages:
    8,165
    Country:
    Germany
    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);
     
  13. D-Jay
    OP

    Member D-Jay GBAtemp Fan

    Joined:
    Jan 23, 2009
    Messages:
    477
    Location:
    Germany
    Country:
    Germany
    Doesn't work.

    Sorry, my skills aren't great.
     
  14. WiiPower

    Member WiiPower GBAtemp Guru

    Joined:
    Oct 17, 2008
    Messages:
    8,165
    Country:
    Germany
    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
     
  15. WiiCrazy

    Member WiiCrazy Be water my friend!

    Joined:
    May 8, 2008
    Messages:
    2,391
    Location:
    Istanbul
    Country:
    Turkey
    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...
     
  16. WiiPower

    Member WiiPower GBAtemp Guru

    Joined:
    Oct 17, 2008
    Messages:
    8,165
    Country:
    Germany
    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.
     
  17. D-Jay
    OP

    Member D-Jay GBAtemp Fan

    Joined:
    Jan 23, 2009
    Messages:
    477
    Location:
    Germany
    Country:
    Germany
    Think so, too. But I don't know where to download the fatlib / projectfiles for WAD-Manager 1.3
     
  18. nicksasa

    Member nicksasa GBAtemp Maniac

    Joined:
    Oct 25, 2008
    Messages:
    1,410
    Country:
    Belgium
    look for the libs on the devkitpro sourceforge site [​IMG] 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
     
  19. D-Jay
    OP

    Member D-Jay GBAtemp Fan

    Joined:
    Jan 23, 2009
    Messages:
    477
    Location:
    Germany
    Country:
    Germany
    I tried several libs from there. Nothing worked.
    I'm going to try something else.
     
  20. WiiCrazy

    Member WiiCrazy Be water my friend!

    Joined:
    May 8, 2008
    Messages:
    2,391
    Location:
    Istanbul
    Country:
    Turkey
    Well I'm talking about the old one which fails in ftell...
     

Share This Page