Standard Code: Difference between revisions

From WiiBrew
Jump to navigation Jump to search
Cboomf (talk | contribs)
m New page: Following a comment on the contribute talk page there is now a Standard Code page for pieces of code that could be usefull to anyone <br> such as return to launcher, rebooting e.t.c If yo...
 
Cboomf (talk | contribs)
No edit summary
Line 21: Line 21:


loader();
loader();
</source>
===Reboot===
<source lang="c">
void shutdown(void) {
    __STM_Init();
    STM_RebootSystem();
    __STM_Close();
}
</source>
When you want to reboot just call
<source lang="c">
shutdown();
</source>
You will need to include the following
<source lang="c">
#include <ogc/ios.h>
#include <ogc/stm.h>
#include <ogc/ipc.h>


</source>
</source>

Revision as of 06:05, 3 May 2008

Following a comment on the contribute talk page there is now a Standard Code page for pieces of code that could be usefull to anyone
such as return to launcher, rebooting e.t.c

If you are adding to this page please add your code in a source box then put a description of how it works.

Code

Return to Loader

typedef void (*Loader_Entry)(void);
Loader_Entry loader = (Loader_Entry)0x80001800;

Whenever you want to return to loader just call

loader();

Reboot

void shutdown(void) {
    __STM_Init();
    STM_RebootSystem();
    __STM_Close();
}

When you want to reboot just call

shutdown();

You will need to include the following

#include <ogc/ios.h>
#include <ogc/stm.h>
#include <ogc/ipc.h>