Hacking Code Guru Needed

HsiaLin

Member
OP
Newcomer
Joined
Apr 5, 2009
Messages
13
Trophies
1
XP
105
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?
 

WiiPower

Well-Known Member
Member
Joined
Oct 17, 2008
Messages
8,165
Trophies
0
XP
345
Country
Gambia, The
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)
 

Dan_Aykroyd

Well-Known Member
Member
Joined
Oct 30, 2008
Messages
318
Trophies
0
XP
226
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!
 

WiiPower

Well-Known Member
Member
Joined
Oct 17, 2008
Messages
8,165
Trophies
0
XP
345
Country
Gambia, The
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.
 

Dan_Aykroyd

Well-Known Member
Member
Joined
Oct 30, 2008
Messages
318
Trophies
0
XP
226
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???
mad.gif


I've tried this before and it still crashes:
Code:
//Wpad_WaitButtons();
ret = IOS_ReloadIOS(249);

OMG... how can this be possible?
blink.gif
 

Dan_Aykroyd

Well-Known Member
Member
Joined
Oct 30, 2008
Messages
318
Trophies
0
XP
226
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!
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: Least they got head in the end