Page 1 of 1

programming wii homebrew .dol restart wii??help needed

Posted: Tue Sep 23, 2008 1:26 pm
by djdynamite123
hi, im wanting to know how to edit a .dol so when i make it a wad channel, it can restart the wii when i quit, otherwise it will jsut code dump, which makes you have to power off wii, as it is trying to return to the loader(which there isnt one when made to a channel)
i want to program the dol, to make channels so it can restart wii....
and help, would be appreciated, i dont know what tool to use or how to do it, and where to find the source and replace it...


i understand there are developers tips on wiibrew site, which gives codes, but im lost help please....

Re: programming wii homebrew .dol restart wii??help needed

Posted: Tue Nov 11, 2008 6:40 pm
by lnuxguy
Just use exit(0); to exit the program.

Re: programming wii homebrew .dol restart wii??help needed

Posted: Fri Apr 17, 2009 9:24 pm
by bobpaul
exit(0) will exit to the loader but will code dump if you loaded your program from the system menu (ie, as a channel). It sounds like djdynamite123 is already using exit(0).

To restart to the system menu, do SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);

If you want your channel to either exit to the loader or to the system menu, check the length of argc.

ie, if your main is "int main(int argc, char *argv[])" then argc will contain the number arguments passed. This will be 0 if loaded from the system menu. This will be 1 if loaded from a loader like HBC. Additionally, argv[0] will be a c-string listing the path of the dol file that was executed (eg: sd:/apps/program/boot.dol).