Getting USB Loader with cover (libfat) function to work in channel?

Discussion in 'Wii - Hacking' started by twofive, Apr 9, 2009.

  1. twofive
    OP

    Member twofive GBAtemp Regular

    Joined:
    Nov 20, 2008
    Messages:
    150
    Country:
    Poland
    Currently I am throwing the profits of all the loaders together into my "own" loader.
    I try to make a channel out of it, but it always throws a code dump when I load the channel or channel forwarder. From HBC or WiiLoad it works perfectly.
    It stopped working as channel when I added cover support

    Here is my code:
    http://www.wii-free.de/usbl-rev3-bf2-mf2.zip

    May someone take a look, please?
    I already tried removing libfat functions but it still throws me a code dump.

    Thanks!
     
  2. kedest

    Member kedest GBAtemp Psycho!

    Joined:
    Feb 6, 2007
    Messages:
    3,283
    Country:
    Netherlands
  3. twofive
    OP

    Member twofive GBAtemp Regular

    Joined:
    Nov 20, 2008
    Messages:
    150
    Country:
    Poland
    This one works. What's different to my channel?
    And why doesn't it work as a normal (direct) channel?
     
  4. kedest

    Member kedest GBAtemp Psycho!

    Joined:
    Feb 6, 2007
    Messages:
    3,283
    Country:
    Netherlands
    well as I understand it, this is how it goes:
    when launched from hbc, the hbc will pass the name of the folder containing the dol as an argument to the application.
    That app can then use that to load its own stuff (such as covers)
    But when launched directly from a channel or forwarder, no such argument is passed and the loader will crash when trying to use that argument.
    The dol in the forwarder i posted (not my own creation, i just made the channel), will pass a hardcoded path as argument.
     
  5. twofive
    OP

    Member twofive GBAtemp Regular

    Joined:
    Nov 20, 2008
    Messages:
    150
    Country:
    Poland

    Aahhh, thank you!
    I think I know how to fix it now!

    Thank you ! [​IMG]
     
  6. kavid

    Member kavid GBAtemp Advanced Fan

    Joined:
    Sep 28, 2008
    Messages:
    519
    Country:
    China
    hello twofive ,nice to meet you ,again!
     
  7. twofive
    OP

    Member twofive GBAtemp Regular

    Joined:
    Nov 20, 2008
    Messages:
    150
    Country:
    Poland
    If I'm right, I have to modify this code:

    Code:
    ÂÂÂÂ/* Set current working directory as app path */
    ÂÂÂÂchar buffer[0x100];
    ÂÂÂÂchar *pos = strrchr(argv[0], '/');
    ÂÂÂÂpos++;
    ÂÂÂÂstrncpy(buffer, argv[0], pos - argv[0]);
    ÂÂÂÂbuffer[pos - argv[0]] = '';
    ÂÂÂÂchdir(buffer);
    ÂÂÂÂ/* Show background */
    ÂÂÂÂBackground_Show();
    ÂÂÂÂ
    ÂÂÂÂif(devmode) {
    ÂÂÂÂsleep(1);
    ÂÂÂÂ}
    I don't really understand the code; I just want to be able to read from SD from a defined folder (SD:/boxart/xxxx.png)
    May someone please tell me how to do that?

    I have never used libfat before.

    Thanks in advance
    - twofive
     
  8. WiiPower

    Member WiiPower GBAtemp Guru

    Joined:
    Oct 17, 2008
    Messages:
    8,165
    Country:
    Germany
    If you have the source of a forwarder try to init the sd card with these commands:
    __io_wiisd.startup();
    fatMountSimple("sd", &__io_wiisd);

    and deinit with these after you loaded the .dol:
    fatUnmount("sd");
    __io_wiisd.shutdown();

    And remove all other fat init or deinit commands, especially the fatinitdefault as it kills usb in combination with ios reloads(and the usb launcher does an ios reload).

    PS: I don't remember which includes you need for this exactly, but
    #include
    is one of them
     
  9. twofive
    OP

    Member twofive GBAtemp Regular

    Joined:
    Nov 20, 2008
    Messages:
    150
    Country:
    Poland
    I got it working using a forwarder, but I think I need to hardcode the SD path to make it work as a normal channel (without forwarder). Have you got any tips at this? [​IMG]

    -- two
     
  10. suloku

    Member suloku GBAtemp Advanced Fan

    Joined:
    Apr 28, 2008
    Messages:
    857
    Country:
    Spain
    chdir() is all you need to be on a certain path...as the code you posted says.

    So chdir ("/") to be at root dir...
     
  11. twofive
    OP

    Member twofive GBAtemp Regular

    Joined:
    Nov 20, 2008
    Messages:
    150
    Country:
    Poland

    Still throws me a code dump with my forwarder which doesn't pass the name of the folder containing the dol.
    This thingy drives me crazy [​IMG]

    Anyone please got some tips?
     
  12. WiiPower

    Member WiiPower GBAtemp Guru

    Joined:
    Oct 17, 2008
    Messages:
    8,165
    Country:
    Germany
    You used the wrong base loader for ocarina. Fatinitdefault is VERY bad for everything related to usb. I already corrected this in fishears loader, search for that.

    And:
    You initalize the fat twice, very bad also. I posted what you should use to init the fat, use it ONCE in the whole code.
     
  13. WiiMonkey

    Member WiiMonkey GBAtemp Fan

    Joined:
    Jan 16, 2009
    Messages:
    408
    Location:
    UK
    Country:
    United Kingdom
    I have this problem i cannot get nIxx's usb loader to work through a forwarder or channel wad
     
  14. kavid

    Member kavid GBAtemp Advanced Fan

    Joined:
    Sep 28, 2008
    Messages:
    519
    Country:
    China

    Where can i find codes “what you posted what you should use to init the fat”

    plze tell me ?i can't find it ?thank u

    hope your answer?
     

Share This Page