Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if( ((*(vu32*)0xCC003000)>>16) == 1 && CheckMagicWords() == 0) //if( ((*(vu32*)0xCC003000)>>16)&1 && !CheckMagicWords())
- {
- //Check autoboot settings
- switch( Bootstate )
- {
- case TYPE_UNKNOWN: //255 or -1, only seen when shutting down from MIOS or booting dol from HBC. it is actually an invalid value
- temp = GetStateFlags();
- gprintf("Bootstate %u detected. DiscState %u ,ReturnTo %u & Flags %u\n",temp.type,temp.discstate,temp.returnto,temp.flags);
- if( temp.flags == 130 ) //&& temp.discstate != 2)
- {
- //if the flag is 130, its probably shutdown from mios. in that case system menu
- //will handle it perfectly (and i quote from SM's OSreport : "Shutdown system from GC!")
- //it seems to reboot into bootstate 5. but its safer to let SM handle it
- gprintf("255:System Menu\n");
- BootMainSysMenu(0);
- }
- else
- {
- Autoboot_System();
- }
- break;
- case TYPE_SHUTDOWNSYSTEM: // 5 - shutdown
- ClearState();
- //check for valid nandboot shitzle. if its found we need to change bootstate to 4.
- //yellow8 claims system menu reset everything then, but it didn't on my wii (joy). this is why its not activated code.
- //its not fully confirmed system menu does it(or ios while being standby) and if system menu does indeed clear it.
- /*if(VerifyNandBootInfo())
- {
- gprintf("Verifty of NandBootInfo : 1\nbootstate changed to %d\n",CheckBootState());
- }
- else
- {
- gprintf("Verifty of NandBootInfo : 0\n");
- }*//*
- if(!SGetSetting(SETTING_SHUTDOWNTOPRELOADER))
- {
- gprintf("Shutting down...\n");
- DVDStopDisc(true);
- ShutdownDevices();
- USB_Deinitialize();
- *(vu32*)0xCD8000C0 &= ~0x20;
- Control_VI_Regs(0);
- while(DvdKilled() < 1);
- if( SGetSetting(SETTING_IGNORESHUTDOWNMODE) )
- {
- STM_ShutdownToStandby();
- } else {
- if( CONF_GetShutdownMode() == CONF_SHUTDOWN_STANDBY )
- {
- //standby = red = off
- STM_ShutdownToStandby();
- }
- else
- {
- //idle = orange = standby
- s32 ret;
- ret = CONF_GetIdleLedMode();
- if (ret >= 0 && ret <= 2)
- STM_SetLedMode(ret);
- STM_ShutdownToIdle();
- }
- }
- }
- break;
- case RETURN_TO_ARGS: //2 - normal reboot which funny enough doesn't happen very often
- case TYPE_RETURN: //3 - return to system menu
- switch( SGetSetting(SETTING_RETURNTO) )
- {
- case RETURNTO_SYSMENU:
- gprintf("ReturnTo:System Menu\n");
- BootMainSysMenu(0);
- break;
- case RETURNTO_AUTOBOOT:
- Autoboot_System();
- break;
- default:
- break;
- }
- break;
- case TYPE_NANDBOOT: // 4 - nandboot
- //apparently a boot state in which the system menu auto boots a title. read more : http://wiibrew.org/wiki/WiiConnect24#WC24_title_booting
- //as it hardly happens i guess nothing bad can happen if we ignore it and just do autoboot instead :)
- case RETURN_TO_SETTINGS: // 1 - Boot when fully shutdown & wiiconnect24 is off. why its called RETURN_TO_SETTINGS i have no clue...
- case RETURN_TO_MENU: // 0 - boot when wiiconnect24 is on
- Autoboot_System();
- break;
- default :
- if( ClearState() < 0 )
- {
- error = ERROR_STATE_CLEAR;
- gprintf("ClearState failure\n");
- }
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment