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

Function SystemExit

source/system.cpp:225–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

ExitAppFunction · 0.85

Calls 2

ShutoffRumbleFunction · 0.85
ExitCleanupFunction · 0.85

Tested by

no test coverage detected