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

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

  1. twofive
    OP

    twofive GBAtemp Regular

    Member
    150
    0
    Nov 20, 2008
    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

    kedest GBAtemp Psycho!

    Member
    3,287
    110
    Feb 6, 2007
    Netherlands
  3. twofive
    OP

    twofive GBAtemp Regular

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

    kedest GBAtemp Psycho!

    Member
    3,287
    110
    Feb 6, 2007
    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

    twofive GBAtemp Regular

    Member
    150
    0
    Nov 20, 2008
    Poland

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

    Thank you ! [​IMG]
     
  6. kavid

    kavid GBAtemp Advanced Fan

    Member
    550
    38
    Sep 28, 2008
    Switzerland
    hello twofive ,nice to meet you ,again!
     
  7. twofive
    OP

    twofive GBAtemp Regular

    Member
    150
    0
    Nov 20, 2008
    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

    WiiPower GBAtemp Guru

    Member
    8,165
    72
    Oct 17, 2008
    Gambia, The
    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

    twofive GBAtemp Regular

    Member
    150
    0
    Nov 20, 2008
    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

    suloku GBAtemp Advanced Fan

    Member
    866
    491
    Apr 28, 2008
    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

    twofive GBAtemp Regular

    Member
    150
    0
    Nov 20, 2008
    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

    WiiPower GBAtemp Guru

    Member
    8,165
    72
    Oct 17, 2008
    Gambia, The
    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

    WiiMonkey GBAtemp Fan

    Member
    408
    1
    Jan 16, 2009
    UK
    I have this problem i cannot get nIxx's usb loader to work through a forwarder or channel wad
     
  14. kavid

    kavid GBAtemp Advanced Fan

    Member
    550
    38
    Sep 28, 2008
    Switzerland

    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?