MCPcopy Create free account
hub / github.com/dborth/vbagx / SystemExit

Function SystemExit

source/system.cpp:213–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211#endif
212
213void SystemExit(int exitAction, bool autoloadedGame)
214{
215#ifdef HW_RVL
216 ShutoffRumble();
217#endif
218
219 ExitCleanup();
220
221#ifdef HW_RVL
222 if(ShutdownRequested) {
223 SYS_ResetSystem(SYS_POWEROFF_STANDBY, 0, FALSE);
224 }
225 else if(autoloadedGame) {
226 if( !!*(u32*)0x80001800 )
227 {
228 // Were we launched via HBC? (or via WiiFlow's stub replacement)
229 exit(1);
230 }
231 else
232 {
233 // Wii channel support
234 SYS_ResetSystem(SYS_RETURNTOMENU, 0, FALSE);
235 }
236 }
237 else {
238 if(exitAction == EXITACTION_WII_AUTO) // Auto
239 {
240 char * sig = (char *)0x80001804;
241 if(
242 sig[0] == 'S' &&
243 sig[1] == 'T' &&
244 sig[2] == 'U' &&
245 sig[3] == 'B' &&
246 sig[4] == 'H' &&
247 sig[5] == 'A' &&
248 sig[6] == 'X' &&
249 sig[7] == 'X')
250 exitAction = EXITACTION_WII_RETURN_TO_LOADER; // Exit to HBC
251 else
252 exitAction = EXITACTION_WII_RETURN_TO_MENU; // HBC not found
253 }
254
255 if(exitAction == EXITACTION_WII_RETURN_TO_MENU) // Exit to Menu
256 {
257 SYS_ResetSystem(SYS_RETURNTOMENU, 0, FALSE);
258 }
259 else if(exitAction == EXITACTION_WII_POWER_OFF) // Shutdown Wii
260 {
261 SYS_ResetSystem(SYS_POWEROFF_STANDBY, 0, FALSE);
262 }
263 else // Exit to Loader
264 {
265 exit(0);
266 }
267 }
268#else
269 if(exitAction == EXITACTION_GC_REBOOT) // Reboot
270 {

Callers 1

ExitAppFunction · 0.85

Calls 2

ShutoffRumbleFunction · 0.85
ExitCleanupFunction · 0.85

Tested by

no test coverage detected