//--------------------------------------------------------------------------------- int main(int argc, char **argv) { //--------------------------------------------------------------------------------- // Initialise the video system VIDEO_Init(); Video_SetMode(); WPAD_Init(); PAD_Init(); if(AHBPROT_DISABLED) IosPatch_RUNTIME(true, false, false, true); else IOS_ReloadIOS(236); menu(); signed_blob *p_tmd = NULL; u32 len; s32 ret; ret = GetTMD(0x0001000154484246LL, &p_tmd, &len); if(ret < 0) { *(vu32*)0x8132FFFB = 0x50756E65; DCFlushRange((void*)0x8132FFFB, 4); SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); } else { WII_LaunchTitle(0x0001000154484246); } return 0; }
void KeepAccessRightsAndReload(s32 ios, bool verbose) { s32 ret; if (AHBPROT_DISABLED) { /* There should be nothing to worry about if this fails, as long as the new IOS is patched */ if (verbose) printf("\t- Patching IOS%ld to keep hardware access rights... ", IOS_GetVersion()); ret = IosPatch_AHBPROT(false); if (verbose) printf("%s.\n", (ret < 0 ? "FAILED" : "OK")); } if (verbose) printf("\t- Reloading to IOS%ld... ", ios); WUPC_Shutdown(); WPAD_Shutdown(); IOS_ReloadIOS(ios); //sleep(2); PAD_Init(); WUPC_Init(); WPAD_Init(); WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR); if (verbose) printf("done."); if (AHBPROT_DISABLED) { if (verbose) printf("\n\t- Applying runtime patches to IOS%ld... ", IOS_GetVersion()); ret = IosPatch_RUNTIME(true, false, vwii, false); if (verbose) printf("%s.\n", (ret < 0 ? "FAILED" : "OK")); } if (IsHermesIOS(ios)) { mload_Init(); if (verbose) printf("\n\t- Hermes cIOS detected! ehcmodule loaded through mload."); } }
s32 ahbprot_menu() { s32 ret; u32 pressed; /* HW_AHBPROT check */ if (AHBPROT_DISABLED) { printf("Hardware protection is disabled!\n"); printf("Current IOS: %ld.\n\n", IOS_GetVersion()); printf("Press A button to use full hardware access.\n"); printf("Press B button to reload to another IOS.\n"); printf("Press HOME or Start to exit.\n\n"); for (;;) { pressed = DetectInput(DI_BUTTONS_DOWN); /* A button */ if (pressed == WPAD_BUTTON_A) { printf("Initializing IOS patches... "); ret = IosPatch_RUNTIME(true, false, vwii, false); if (ret < 0) { /* This is a very, very weird error */ printf("ERROR!\n\n"); printf("\tUnable to load the initial patches. Maybe the loaded IOS isn't\n"); printf("\tvulnerable for an unknown reason.\n"); sleep(4); printf("\tThis error is very uncommon. I already checked if the hardware\n"); printf("\tprotection was disabled. You should report this to me as soon as\n"); printf("\tyou can.\n"); sleep(4); printf("\tI'll let you reload to another IOS instead of kicking you out\n"); printf("\tto the loader..."); sleep(4); } else { printf("OK!"); } break; } /* B button */ if (pressed == WPAD_BUTTON_B) { ret = -1; break; } /* HOME/Start button */ if (pressed == WPAD_BUTTON_HOME) return -1; } } else { ret = -1; } if (ret < 0) { ret = ios_selectionmenu(249); if (ret > 0) { if (ret != IOS_GetVersion()) { KeepAccessRightsAndReload(ret, true); } else { printf("\t- IOS reload aborted (IOS%ld is already loaded).", ret); } } else if (ret == 0) { printf("\t- Proceeding without IOS reload..."); } else { return ret; } } return 0; }