Code Guru Needed

Discussion in 'Wii - Hacking' started by HsiaLin, Apr 25, 2009.

Apr 25, 2009

Code Guru Needed by HsiaLin at 3:24 AM (1,495 Views / 0 Likes) 7 replies

  1. HsiaLin
    OP

    Newcomer HsiaLin Member

    Joined:
    Apr 5, 2009
    Messages:
    11
    Country:
    United States
    Hello all,

    I have a question about WPAD_Init() and IOS_ReloadIOS(). Ok the first part is...why does WPAD_Init() crap out after calling IOS_ReloadIOS()?

    Second part is, how do i recover WPAD_Init() after its been crapped out? If i call WPAD_INit() again i get a code dump. Anyone have any help on this?
     
  2. WiiPower

    Member WiiPower GBAtemp Guru

    Joined:
    Oct 17, 2008
    Messages:
    8,165
    Country:
    Germany
    Your code should look like this:

    Code:
    WPAD_Init();
    WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR);
    
    [...]
    
    WPAD_Shutdown();
    IOS_ReloadIOS(x);
    WPAD_Init();
    WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR);
    And keep in mind that you need to shutdown the storage device as well before an ios reload, so might want to write like this:

    CODE#include

    [...]

    __io_wiisd.startup();
    fatMountSimple("sd", &__io_wiisd);

    WPAD_Init();
    WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR);

    [...]

    WPAD_Shutdown();

    fatUnmount("sd");
    __io_wiisd.shutdown();

    IOS_ReloadIOS(x);

    __io_wiisd.startup();
    fatMountSimple("sd", &__io_wiisd);

    WPAD_Init();
    WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR);

    I recommend using fatMountSimple instead of fatinitdefault, because it only touches the sd card. If you use the usb loader cIOS and have a usb device attached, you get problems with fatinitdefault. (yes you need to remove ALL fatinitdefault commands in your code if you use fatMountSimple)
     
  3. HsiaLin
    OP

    Newcomer HsiaLin Member

    Joined:
    Apr 5, 2009
    Messages:
    11
    Country:
    United States
    Thanks very much for that info WiiPower.
     
  4. Dan_Aykroyd

    Member Dan_Aykroyd GBAtemp Fan

    Joined:
    Oct 30, 2008
    Messages:
    318
    Country:
    United States
    I'm having a similar problem that is driving me nuts!

    Trying to mod some source I found:


    Code:
    Wpad_WaitButtons();
    if (IOS_GetVersion() != version) 
    {
    ÂÂÂÂ/* Shutdown subsystems */
    ÂÂÂÂWpad_Disconnect();
    
    ÂÂÂÂ/* Load IOS */
    ÂÂÂÂret = IOS_ReloadIOS(version); 
    
    ÂÂÂÂ/* Initialize subsystems */
    ÂÂÂÂWpad_Init();
    }
    If I remove the first line, in the IOS_ReloadIOS line it crashes (code dump)! And I don't want to wait for user input to reload the IOS, so I can't continue! I've tried pretty much everything I could to make it work, but it just refuses. If I comment the IOS_ReloadIOS line it works OK and execution continues perfectly (only that with the default IOS36 loaded instead of the cIOS I'd like to reload).

    Please... can you tell me what I'm missing here? Thanks in advance!
     
  5. WiiPower

    Member WiiPower GBAtemp Guru

    Joined:
    Oct 17, 2008
    Messages:
    8,165
    Country:
    Germany
    Did you try to move the IOS Reload to the beginning of the app, BEFORE wpad and storage init? And you can remove the whole if.
     
  6. Dan_Aykroyd

    Member Dan_Aykroyd GBAtemp Fan

    Joined:
    Oct 30, 2008
    Messages:
    318
    Country:
    United States
    I can't move it very much more to the top because I'm also selecting which IOS to load in . I'll try though, putting it as the first line possible with a hardcoded IOS to see what happens.

    In any case, my main concern is this: why in HELL does it crashes if I didn't previously use the Wpad_WaitButtons function??? [​IMG]

    I've tried this before and it still crashes:
    Code:
    //Wpad_WaitButtons();
    ret = IOS_ReloadIOS(249);
    OMG... how can this be possible? [​IMG]
     
  7. WiiPower

    Member WiiPower GBAtemp Guru

    Joined:
    Oct 17, 2008
    Messages:
    8,165
    Country:
    Germany
    Upload the source or paste it into [ code ] tags, maybe someone is able to see the error then.(if there is)
     
  8. Dan_Aykroyd

    Member Dan_Aykroyd GBAtemp Fan

    Joined:
    Oct 30, 2008
    Messages:
    318
    Country:
    United States
    Well... after running through all the code again and previous libraries, I found out that there was a Wpad_Init somewhere above it. Somehow, if you init the module and then don't use it, it crashes? :S

    Pretty weird... but I removed that and right now I'm handling to only init it if there's the need for user interaction.

    Anyway... nice finding that out. Thanks for your support!
     

Share This Page