void __WBFS_Spinner(s32 x, s32 max) { static time_t start; static u32 expected; f32 percent, size; u32 d, h, m, s; /* First time */ if (!x) { start = time(0); expected = 300; } /* Elapsed time */ d = time(0) - start; if (x != max) { /* Expected time */ if (d && x) expected = (expected * 3 + d * max / x) / 4; /* Remaining time */ d = (expected > d) ? (expected - d) : 1; } /* Calculate time values */ h = d / 3600; m = (d / 60) % 60; s = d % 60; /* Calculate percentage/size */ percent = (x * 100.0) / max; if (hdd) { size = (hdd->wii_sec_sz / GB_SIZE) * max; } else { size = (0x8000 / GB_SIZE) * max; } Con_ClearLine(); /* Show progress */ if (x != max) { printf_(gt("%.2f%% of %.2fGB (%c) ETA: %d:%02d:%02d"), percent, size, "/-\\|"[(x / 10) % 4], h, m, s); printf("\r"); fflush(stdout); } else { printf_(gt("%.2fGB copied in %d:%02d:%02d"), size, h, m, s); printf(" \n"); } __console_flush(1); }
void Init_USB() { //Close_USB(); printf("\n"); if (AHBPROT_DISABLED && !USB_PORT_CONNECTED) { USBmnt = false; } else { bool started = false; isUSB2 = (IOS_GetVersion() >= 200); time_t tStart = time(0); while ((time(0) - tStart) < 10) // 10 seconds timeout { Con_ClearLine(); printf("\t- USB drive: %.f...", difftime(time(0), tStart)); if (isUSB2) { started = (__io_usbstorage2.startup() && __io_usbstorage2.isInserted()); } else { started = (__io_usbstorage.startup() && __io_usbstorage.isInserted()); } if (started) break; usleep(50000); } USBmnt = (started && fatMountSimple("usb", (isUSB2 ? &__io_usbstorage2 : &__io_usbstorage))); Con_ClearLine(); } printf("\t- USB drive: %s.\n\n", (USBmnt ? "OK" : "FAILED")); }
void menu_print_mark(struct Menu *m) { //if (m->active[m->line_count] && m->current == m->line_count) { if (m->current == m->line_count) { BgColor(CFG.color_selected_bg); FgColor(CFG.color_selected_fg); Con_ClearLine(); } else if (m_active(m, m->line_count)) { DefaultColor(); } else { DefaultColor(); FgColor(CFG.color_inactive); } char *xx; //if (m->active[m->line_count] && m->current == m->line_count) { if (m->current == m->line_count) { xx = CFG.cursor; } else { xx = CFG.cursor_space; } printf(" %s ", xx); }
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(); } } } }
void __Menu_ShowList(void) { FgColor(CFG.color_header); if (enable_favorite) { printf_x(gt("Favorite Games")); printf(":\n"); } else { if (!CFG.hide_header) { printf_x(gt("Select the game you want to boot")); printf(":\n"); } } DefaultColor(); if (CFG.console_mark_page && gameStart > 0) { printf(" %s +", CFG.cursor_space); } printf("\n"); /* No game list*/ if (gameCnt) { u32 cnt; /* Print game list */ for (cnt = gameStart; cnt < gameCnt; cnt++) { struct discHdr *header = &gameList[cnt]; /* Entries per page limit reached */ if ((cnt - gameStart) >= ENTRIES_PER_PAGE) break; if (gameSelected == cnt) { FgColor(CFG.color_selected_fg); BgColor(CFG.color_selected_bg); Con_ClearLine(); } else { DefaultColor(); } /* Print entry */ //printf(" %2s %s\n", (gameSelected == cnt) ? ">>" : " ", char *title = __Menu_PrintTitle(get_title(header)); // cursor printf(" %s", (gameSelected == cnt) ? CFG.cursor : CFG.cursor_space); // favorite mark printf("%s", (CFG.console_mark_favorite && is_favorite(header->id)) ? CFG.favorite : " "); // title printf("%s", title); // saved mark if (CFG.console_mark_saved) { printf("%*s", (MAX_CHARACTERS - con_len(title)), (CFG_is_saved(header->id)) ? CFG.saved : " "); } printf("\n"); } DefaultColor(); if (CFG.console_mark_page && cnt < gameCnt) { printf(" %s +", CFG.cursor_space); } else { printf(" %s ", CFG.cursor_space); } //if (CFG.hide_hddinfo) { FgColor(CFG.color_footer); BgColor(CONSOLE_BG_COLOR); int num_page = 1 + (gameCnt - 1) / ENTRIES_PER_PAGE; int cur_page = 1 + gameSelected / ENTRIES_PER_PAGE; printf(" %-*.*s %d/%d", MAX_CHARACTERS - 8, MAX_CHARACTERS - 8, action_string, cur_page, num_page); action_string[0] = 0; //} } else { printf(" "); printf(gt("%s No games found!!"), CFG.cursor); printf("\n"); } /* Print free/used space */ FgColor(CFG.color_footer); BgColor(CONSOLE_BG_COLOR); if (!CFG.hide_footer) { printf("\n"); // (B) GUI (1) Options (2) Favorites // B: GUI 1: Options 2: Favorites //char c_gui = 'B', c_opt = '1'; //if (CFG.buttons == CFG_BTN_OPTIONS_B) { // c_gui = '1'; c_opt = 'B'; //} printf_(""); if (CFG.gui && CFG.button_gui) { printf("%s: GUI ", (button_names[CFG.button_gui])); } if (!CFG.disable_options && CFG.button_opt) { printf("%s: Options ", (button_names[CFG.button_opt])); } if (CFG.button_fav) { printf("%s: Favorites", (button_names[CFG.button_fav])); } } if (CFG.db_show_info) { printf("\n"); //load game info from XML - lustar __Menu_ShowGameInfo(false, gameList[gameSelected].id); } DefaultColor(); __console_flush(0); }