s32 what_to_do() { u32 pressed; u32 pressedGC; int selection = 0; int ret; char *optionsstring[3] = { "<Install IOS118 and 118 Channel>", "<Uninstall IOS118 and 118 Channel>", "<Exit>" }; while (true) { Con_ClearLine(); set_highlight(true); printf(optionsstring[selection]); set_highlight(false); waitforbuttonpress(&pressed, &pressedGC); if (pressed == WPAD_BUTTON_LEFT || pressedGC == PAD_BUTTON_LEFT) { if (selection > 0) { selection--; } else { selection =2; } } if (pressed == WPAD_BUTTON_RIGHT || pressedGC == PAD_BUTTON_RIGHT) { if (selection < 2) { selection++; } else { selection = 0; } } if (pressed == WPAD_BUTTON_A || pressedGC == PAD_BUTTON_A) { printf("\n"); if (selection == 0) { printf("About to install IOS118\n"); ret = Install_patched_IOS(36, IOS36version, true, true, true, true, 118, 65535, false); if (ret < 0) { printf("IOS118 Install failed. Press any button to exit...\n"); waitforbuttonpress(NULL, NULL); Reboot(); } printf("\nStep 1 Complete!\n"); printf("IOS118 Installation is complete!\n"); install_channel_118(); printf("\nStep 2 Complete!\n"); printf("118Channel Installation is complete!\n"); printf("Press any button to exit...\n"); waitforbuttonpress(NULL, NULL); Reboot(); return 0; } if (selection == 1) { ISFS_Initialize(); Uninstall_DeleteTicket(1, 118); Uninstall_DeleteTitle(1, 118); Uninstall_118Channel_all(); ISFS_Deinitialize(); } if (selection == 2) { Reboot(); } } } }
int main(int argc, char* argv[]) { int ret; u32 pressed; u32 pressedGC; Init_Console(); printf("\x1b[%u;%um", 37, false); PAD_Init(); WPAD_Init(); WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR); printheadline(); ret = *((int *)MAGIC1); if (ret == MAGIC2) { ret = *((int *)MAGIC3); if (ret == MAGIC4) { ret = *((int *)MAGIC3 + 1); printf("\nSo this now makes %d times you've tried to rerun me, pirate.\n", ret); printf("I told you before, you need to try harder than that.\n\n"); printf("Keep trying and I'll give you a hint...\n\n"); if (ret > 5) { printf("You're persistent aren't you? Here's a hint:\nShow me that you don't pirate all of your Wii games.\n\n"); } if (ret > 10) { printf("You're really persistent! The hint means to play a game normally in your Wii.\n"); printf("There are other ways around the trap too, but figure them out yourself.\n"); } ret++; } else { ret = 2; printf("\nSo you tell me you're a pirate and you expect that running\n"); printf("the application a second time is enough for me to forgive you?\n"); printf("You're going to have to try something harder than that, mate.\n"); *((int *)MAGIC3) = MAGIC4; } *((int *)MAGIC3 + 1) = ret; sleep(ret*2); printf("\nPress any button to exit...\n"); waitforbuttonpress(NULL, NULL); Reboot(); } printf("WARNING: If you are not connected to the Internet, this app might crash.\n"); printf("If you get a DSI error, rerun the app and be a little quicker.\n\n"); printf("\nThis Application will install IOS236 onto your Wii.\n"); printf("It relies on the fact that you launched this app with.\n"); printf("the AHBPROT flags set, so you must be using HBC 1.07 or\n"); printf("later.\n"); printf("\nIOS236 is a patched IOS36 v3351 and this app can be used\n"); printf("instead of the Trucha Bug Restorer, upon which the app\n"); printf("was based.\n"); printf("\nThis application should work on all Wii firmwares 4.3 and below,\n"); printf("and as long as the HBC supports AHBPROT, it should work on newer\n"); printf("firmwares too. It is safe to use this application to reinstall\n"); printf("IOS236 or replace a different IOS236.\n"); printf("\nThanks, in no particular order, go to Wiipower, oggzee, Team Twiizers,\n"); printf("tona, Joseph Jordan and anybody else who has code included in\n"); printf("the app. The app was quite a simple job, built upon their\n"); printf("actual real work.\n"); /*printf("\nPlease Wait...\n"); time_t t = time(NULL) + 7; while (time(NULL) < t) { WPAD_ScanPads(); PAD_ScanPads(); if(WPAD_ButtonsDown(0) || PAD_ButtonsDown(0)) { printf("Don't be impatient, press any button to exit...\n"); waitforbuttonpress(NULL, NULL); Reboot(); } }*/ printf("Press 1 or Start to start the application...\n"); waitforbuttonpress(&pressed, &pressedGC); if (pressed != WPAD_BUTTON_1 && pressedGC != PAD_BUTTON_START) { printf("Other button pressed, press any button to exit...\n"); waitforbuttonpress(NULL, NULL); Reboot(); } printf("Performing Step 1\n"); printf("Patching IOS\n"); if (!IOSPATCH_Apply()) { printf("Unable to initialise the initial patches.\n"); printf("This either means you didn't follow the download\n"); printf("and launching instructions correctly, or your IOS\n"); printf("is not vulnerable for an unknown reason.\n"); printf("Perhaps you need to update the Homebrew Channel (HBC).\n"); printf("Installation cannot continue. Press any button to exit...\n"); waitforbuttonpress(NULL, NULL); Reboot(); } printf("IOS patched\n"); printf("About to install IOS236\n"); ret = Install_patched_IOS(36, IOS36version, true, true, true, true, 236, 65535, false); if (ret < 0) { printf("IOS236 Install failed. Press any button to exit...\n"); waitforbuttonpress(NULL, NULL); Reboot(); } printf("\nStep 1 Complete!\n"); printf("\nStep 2 is an alteration that is only needed if you plan\n"); printf("to play games you don't own the original disc for.\n"); printf("Do you need this alteration?\n\n"); printf("Press the 1 or X button if you want to play pirated games.\n"); printf("Press the 2 or Y button if you have no need for piracy.\n"); char found = 0; while(!found) { waitforbuttonpress(&pressed, &pressedGC); if (pressed == WPAD_BUTTON_1 || pressedGC == PAD_BUTTON_X) { found = 1; } if (pressed == WPAD_BUTTON_2 || pressedGC == PAD_BUTTON_Y) { found = 2; } } if (found == 1) { printf("\nPerforming Step 2\n"); ISFS_Initialize(); Uninstall_DeleteTicket(1, 236); Uninstall_DeleteTitle(1, 236); ISFS_Deinitialize(); *((int *)MAGIC1) = MAGIC2; printf("\nStep 2 Complete!\n"); printf("\nStep 2 was to delete IOS236. You will need\n"); printf("to install it again.\n\n"); printf("Shame on you for being a pirate!\n"); printf("Sorry if you were just curious or not paying\n"); printf("attention, but you need to learn to be careful.\n\n"); printf("While I can't stop you from lying next time,\n"); printf("I can at least have the satisfaction that I've\n"); printf("wasted some of your time.\n"); printf("\nSeriously, though. Developers do deserve to be paid\n"); printf("to provide you with entertainment. At least consider\n"); printf("buying any game that you play a lot, or that you enjoy\n"); printf("enough to finish.\n"); printf("\nOh, and just be glad I didn't delete your HBC ;)\n"); sleep(10); printf("Press any button to exit\n"); waitforbuttonpress(NULL, NULL); Reboot(); } printf("IOS236 Installation is complete!\n"); printf("Press any button to exit...\n"); waitforbuttonpress(NULL, NULL); Reboot(); return 0; }
s32 Settings_Menu() { s32 ret = 0; u32 pressed; int i, selection = 0; char *menu_opt[3] = { "Device menu", "Update application", "Reload to another IOS (device remount required)" }; while(true) { resetscreen(); printheadline(); printf("Select an option. Press B to go back to the menu.\n\n"); for (i = 0; i <= 2; i++) { printf("%s %s\n", ((selection == i) ? ARROW : " "), menu_opt[i]); } pressed = DetectInput(DI_BUTTONS_DOWN); if (pressed == WPAD_BUTTON_UP) { if (selection > 0) selection--; } if (pressed == WPAD_BUTTON_DOWN) { if (selection < 2) selection++; } if (pressed == WPAD_BUTTON_A) { switch (selection) { case 0: /* Device menu */ ret = Device_Menu(true); break; case 1: /* Update application */ UpdateYABDM(launch_path); break; case 2: /* IOS reload */ ret = ios_selectionmenu(249); if (ret > 0) { if (ret != IOS_GetVersion()) { /* Unmount devices */ ISFS_Deinitialize(); Unmount_Devices(); KeepAccessRightsAndReload(ret, true); /* Remount devices */ ISFS_Initialize(); ret = Mount_Devices(); if (ret != -2) logfile_header(); } else { printf("\t- IOS reload aborted (IOS%ld is already loaded).", ret); waitforbuttonpress(); } } else if (ret == 0) { printf("\t- Proceeding without IOS reload..."); waitforbuttonpress(); } break; default: break; } break; } if (pressed == WPAD_BUTTON_B) break; } return ret; }
s32 Downgrade_IOS(u32 iosversion, u32 highrevision, u32 lowrevision, bool free) { printf("Preparing downgrade of IOS%u from revison: %u to: %u\n", iosversion, highrevision, lowrevision); int ret; IOS *highios; IOS *lowios; printf("Getting IOS%u revision %u...\n", iosversion, highrevision); ret = get_IOS(&highios, iosversion, highrevision); if (ret < 0) { printf("Error reading IOS into memory\n"); return ret; } printf("Getting IOS%u revision %u...\n", iosversion, lowrevision); ret = get_IOS(&lowios, iosversion, lowrevision); if (ret < 0) { printf("Error reading IOS into memory\n"); free_IOS(&highios); return ret; } printf("\n"); printf("Downgrading involves two steps:\n"); printf("Step 1: Set the revison to 0\n"); printf("Step 2: Install IOS with low revision\n"); printf("Preparations complete, step 1...\n"); u32 pressed; u32 pressedGC; waitforbuttonpress(&pressed, &pressedGC); if (pressed != WPAD_BUTTON_A && pressedGC != PAD_BUTTON_A) { printf("Other button pressed\n"); free_IOS(&highios); free_IOS(&lowios); return -1; } printf("Installing ticket...\n"); ret = ES_AddTicket(highios->ticket, highios->ticket_size, highios->certs, highios->certs_size, highios->crl, highios->crl_size); if (ret < 0) { printf("ES_AddTicket returned: %d\n", ret); free_IOS(&highios); free_IOS(&lowios); ES_AddTitleCancel(); return ret; } ret = Downgrade_TMD_Revision(highios->tmd, highios->tmd_size, highios->certs, highios->certs_size); if (ret < 0) { printf("Error: Could not set the revision to 0\n"); free_IOS(&highios); free_IOS(&lowios); return ret; } printf("Revision set to 0, step 1 of downgrade complete.\n"); printf("\n"); printf("step 2 of downgrade...\n"); waitforbuttonpress(&pressed, &pressedGC); if (pressed != WPAD_BUTTON_A && pressedGC != PAD_BUTTON_A) { printf("Other button pressed\n"); free_IOS(&highios); free_IOS(&lowios); return -1; } printf("Installing IOS%u Rev %u...\n", iosversion, lowrevision); ret = install_IOS(lowios, true); if (ret < 0) { printf("Error: Could not install IOS%u Rev %u\n", iosversion, lowrevision); free_IOS(&highios); free_IOS(&lowios); return ret; } printf("IOS%u downgrade to revision: %u complete.\n", iosversion, lowrevision); if (free) { free_IOS(&highios); free_IOS(&lowios); } return 0; }