/* File Operations - Leathl */ int Menu_FileOperations(fatFile *file, char *inFilePath) { f32 filesize = (file->filestat.st_size / MB_SIZE); for (;;) { Con_Clear(); printf("[+] WAD Filename : %s\n", file->filename); printf(" WAD Filesize : %.2f MB\n\n\n", filesize); printf("[+] Select action: < %s WAD >\n\n", "Delete"); //There's yet nothing else than delete printf(" Press LEFT/RIGHT to change selected action.\n\n"); printf(" Press A to continue.\n"); printf(" Press B to go back to the menu.\n\n"); u32 buttons = WaitButtons(); /* A button */ if (buttons & WPAD_BUTTON_A) break; /* B button */ if (buttons & WPAD_BUTTON_B) return 0; } Con_Clear(); printf("[+] Deleting \"%s\", please wait...\n", file->filename); sprintf(gTmpFilePath, "%s/%s", inFilePath, file->filename); int error = remove(gTmpFilePath); if (error != 0) printf(" ERROR!"); else printf(" Successfully deleted!"); printf("\n"); printf(" Press any button to continue...\n"); WaitButtons(); return !error; }
void WaitPrompt (char *prompt) { printf("\n%s", prompt); printf(" Press any button to continue...\n"); /* Wait for button */ WaitButtons(); }
void Menu_WadList(void) { char str [100]; fatFile *fileList = NULL; u32 fileCnt; s32 ret, selected = 0, start = 0; char *tmpPath = malloc (MAX_FILE_PATH_LEN); // wiiNinja: check for malloc error if (tmpPath == NULL) { ret = -999; // What am I gonna use here? printf(" ERROR! Out of memory (ret = %d)\n", ret); return; } printf("[+] Retrieving file list..."); fflush(stdout); gDirLevel = 0; // wiiNinja: The root is always the primary folder // But if the user has a /wad directory, just go there. This makes // both sides of the argument win sprintf(tmpPath, "%s:" WAD_DIRECTORY, fdev->mount); PushCurrentDir(tmpPath,0,0); //if (strcmp (WAD_DIRECTORY, WAD_ROOT_DIRECTORY) != 0) if (strcmp (WAD_DIRECTORY, gConfig.startupPath) != 0) { // If the directory can be successfully opened, it must exists //DIR_ITER *tmpDirPtr = NULL; //tmpDirPtr = diropen(WAD_ROOT_DIRECTORY); //if (tmpDirPtr) //{ // dirclose (tmpDirPtr); // Now push the /wad directory as the current operating folder //sprintf(tmpPath, "%s:" WAD_ROOT_DIRECTORY, fdev->mount); sprintf(tmpPath, "%s:%s", fdev->mount, gConfig.startupPath); //printf ("\nThe final startupPath is: %s\n", tmpPath); //WaitButtons (); PushCurrentDir(tmpPath,0,0); // wiiNinja //} } /* Retrieve filelist */ getList: if (fileList) { free (fileList); fileList = NULL; } ret = __Menu_RetrieveList(tmpPath, &fileList, &fileCnt); if (ret < 0) { printf(" ERROR! (ret = %d)\n", ret); goto err; } /* No files */ if (!fileCnt) { printf(" No files found!\n"); goto err; } for (;;) { u32 cnt; s32 index; /* Clear console */ Con_Clear(); /** Print entries **/ cnt = strlen(tmpPath); if(cnt>30) index = cnt-30; else index = 0; printf("[+] WAD files on [%s]:\n\n", tmpPath+index); /* Print entries */ for (cnt = start; cnt < fileCnt; cnt++) { fatFile *file = &fileList[cnt]; f32 filesize = file->filestat.st_size / MB_SIZE; /* Entries per page limit */ if ((cnt - start) >= ENTRIES_PER_PAGE) break; strncpy(str, file->filename, 48); str[48]=0; /* Print filename */ //printf("\t%2s %s (%.2f MB)\n", (cnt == selected) ? ">>" : " ", file->filename, filesize); if (file->filestat.st_mode & S_IFDIR) // wiiNinja printf("\t%2s [%s]\n", (cnt == selected) ? ">>" : " ", str); else printf("\t%2s %s (%.2f MB)\n", (cnt == selected) ? ">>" : " ", str, filesize); } printf("\n"); printf("[+] Press A button to (un)install a WAD file.\n"); if(gDirLevel>1) printf(" Press B button to go up-level DIR"); else printf(" Press B button to select a storage device"); /** Controls **/ u32 buttons = WaitButtons(); /* DPAD buttons */ if (buttons & (WPAD_BUTTON_UP | WPAD_BUTTON_LEFT)) { selected -= (buttons & WPAD_BUTTON_LEFT) ? ENTRIES_PER_PAGE : 1; if (selected <= -1) selected = (fileCnt - 1); } if (buttons & (WPAD_BUTTON_DOWN | WPAD_BUTTON_RIGHT)) { selected += (buttons & WPAD_BUTTON_RIGHT) ? ENTRIES_PER_PAGE : 1; if (selected >= fileCnt) selected = 0; } /* HOME button */ if (buttons & WPAD_BUTTON_HOME) Restart(); /* A button */ if (buttons & WPAD_BUTTON_A) { fatFile *tmpFile = &fileList[selected]; char *tmpCurPath; if (tmpFile->filestat.st_mode & S_IFDIR) // wiiNinja { if (strcmp (tmpFile->filename, "..") == 0) { selected = 0; start = 0; // Previous dir tmpCurPath = PopCurrentDir(&selected, &start); if (tmpCurPath != NULL) sprintf(tmpPath, "%s", tmpCurPath); goto getList; } else if (IsListFull () == true) { WaitPrompt ("Maximum number of directory levels is reached.\n"); } else { tmpCurPath = PeekCurrentDir (); if (tmpCurPath != NULL) { if(gDirLevel>1) sprintf(tmpPath, "%s/%s", tmpCurPath, tmpFile->filename); else sprintf(tmpPath, "%s%s", tmpCurPath, tmpFile->filename); } // wiiNinja: Need to PopCurrentDir PushCurrentDir (tmpPath, selected, start); selected = 0; start = 0; goto getList; } } else { tmpCurPath = PeekCurrentDir (); if (tmpCurPath != NULL) Menu_WadManage(tmpFile, tmpCurPath); } } /* B button */ if (buttons & WPAD_BUTTON_B) { if(gDirLevel<=1) { return; } char *tmpCurPath; selected = 0; start = 0; // Previous dir tmpCurPath = PopCurrentDir(&selected, &start); if (tmpCurPath != NULL) sprintf(tmpPath, "%s", tmpCurPath); goto getList; //return; } /** Scrolling **/ /* List scrolling */ index = (selected - start); if (index >= ENTRIES_PER_PAGE) start += index - (ENTRIES_PER_PAGE - 1); if (index <= -1) start += index; } err: printf("\n"); printf(" Press any button to continue...\n"); free (tmpPath); /* Wait for button */ WaitButtons(); }
void Menu_WadManage(fatFile *file, char *inFilePath) { FILE *fp = NULL; //char filepath[128]; f32 filesize; u32 mode = 0; /* File size in megabytes */ filesize = (file->filestat.st_size / MB_SIZE); for (;;) { /* Clear console */ Con_Clear(); printf("[+] WAD Filename : %s\n", file->filename); printf(" WAD Filesize : %.2f MB\n\n\n", filesize); printf("[+] Select action: < %s WAD >\n\n", (!mode) ? "Install" : "Uninstall"); printf(" Press LEFT/RIGHT to change selected action.\n\n"); printf(" Press A to continue.\n"); printf(" Press B to go back to the menu.\n\n"); u32 buttons = WaitButtons(); /* LEFT/RIGHT buttons */ if (buttons & (WPAD_BUTTON_LEFT | WPAD_BUTTON_RIGHT)) mode ^= 1; /* A button */ if (buttons & WPAD_BUTTON_A) break; /* B button */ if (buttons & WPAD_BUTTON_B) return; } /* Clear console */ Con_Clear(); printf("[+] Opening \"%s\", please wait...", file->filename); fflush(stdout); /* Generate filepath */ // sprintf(filepath, "%s:" WAD_DIRECTORY "/%s", fdev->mount, file->filename); sprintf(gTmpFilePath, "%s/%s", inFilePath, file->filename); // wiiNinja /* Open WAD */ fp = fopen(gTmpFilePath, "rb"); if (!fp) { printf(" ERROR!\n"); goto out; } else printf(" OK!\n\n"); printf("[+] %s WAD, please wait...\n", (!mode) ? "Installing" : "Uninstalling"); /* Do install/uninstall */ WiiLightControl (WII_LIGHT_ON); if (!mode) Wad_Install(fp); else Wad_Uninstall(fp); WiiLightControl (WII_LIGHT_OFF); out: /* Close file */ if (fp) fclose(fp); printf("\n"); printf(" Press any button to continue...\n"); /* Wait for button */ WaitButtons(); }
void Menu_NandDevice(void) { s32 ret, selected = 0; /* Disable NAND emulator */ if (ndev) { Nand_Unmount(ndev); Nand_Disable(); } /* Select source device */ if (gConfig.nandDeviceIndex < 0) { for (;;) { /* Clear console */ Con_Clear(); /* Selected device */ ndev = &ndevList[selected]; printf("\t>> Select NAND emulator device: < %s >\n\n", ndev->name); printf("\t Press LEFT/RIGHT to change the selected device.\n\n"); printf("\t Press A button to continue.\n"); printf("\t Press HOME button to restart.\n\n"); u32 buttons = WaitButtons(); /* LEFT/RIGHT buttons */ if (buttons & WPAD_BUTTON_LEFT) { if ((--selected) <= -1) selected = (NB_NAND_DEVICES - 1); } if (buttons & WPAD_BUTTON_RIGHT) { if ((++selected) >= NB_NAND_DEVICES) selected = 0; } /* HOME button */ if (buttons & WPAD_BUTTON_HOME) Restart(); /* A button */ if (buttons & WPAD_BUTTON_A) break; } } else { ndev = &ndevList[gConfig.nandDeviceIndex]; } /* No NAND device */ if (!ndev->mode) return; printf("[+] Enabling NAND emulator..."); fflush(stdout); /* Mount NAND device */ ret = Nand_Mount(ndev); if (ret < 0) { printf(" ERROR! (ret = %d)\n", ret); goto err; } /* Enable NAND emulator */ ret = Nand_Enable(ndev); if (ret < 0) { printf(" ERROR! (ret = %d)\n", ret); goto err; } else printf(" OK!\n"); return; err: printf("\n"); printf(" Press any button to continue...\n"); WaitButtons(); /* Prompt menu again */ Menu_NandDevice(); }
void Menu_FatDevice(void) { s32 ret, selected = 0; /* Unmount FAT device */ if (fdev) Fat_Unmount(fdev); /* Select source device */ if (gConfig.fatDeviceIndex < 0) { for (;;) { /* Clear console */ Con_Clear(); /* Selected device */ fdev = &fdevList[selected]; printf("\t>> Select source device: < %s >\n\n", fdev->name); printf("\t Press LEFT/RIGHT to change the selected device.\n\n"); printf("\t Press A button to continue.\n"); printf("\t Press HOME button to restart.\n\n"); u32 buttons = WaitButtons(); /* LEFT/RIGHT buttons */ if (buttons & WPAD_BUTTON_LEFT) { if ((--selected) <= -1) selected = (NB_FAT_DEVICES - 1); } if (buttons & WPAD_BUTTON_RIGHT) { if ((++selected) >= NB_FAT_DEVICES) selected = 0; } /* HOME button */ if (buttons & WPAD_BUTTON_HOME) Restart(); /* A button */ if (buttons & WPAD_BUTTON_A) break; } } else { fdev = &fdevList[gConfig.fatDeviceIndex]; } printf("[+] Mounting device, please wait..."); fflush(stdout); /* Mount FAT device */ ret = Fat_Mount(fdev); if (ret < 0) { printf(" ERROR! (ret = %d)\n", ret); goto err; } else printf(" OK!\n"); return; err: WiiLightControl (WII_LIGHT_OFF); printf("\n"); printf(" Press any button to continue...\n"); WaitButtons(); /* Prompt menu again */ Menu_FatDevice(); }
void Menu_SelectIOS(void) { u8 *iosVersion = NULL; u32 iosCnt; u8 tmpVersion; u32 cnt; s32 ret, selected = 0; bool found = false; /* Get IOS versions */ ret = Title_GetIOSVersions(&iosVersion, &iosCnt); if (ret < 0) return; /* Sort list */ qsort(iosVersion, iosCnt, sizeof(u8), __Menu_IsGreater); if (gConfig.cIOSVersion < 0) tmpVersion = CIOS_VERSION; else { tmpVersion = (u8)gConfig.cIOSVersion; // For debugging only //printf ("User pre-selected cIOS: %i\n", tmpVersion); //WaitButtons(); } /* Set default version */ for (cnt = 0; cnt < iosCnt; cnt++) { u8 version = iosVersion[cnt]; /* Custom IOS available */ //if (version == CIOS_VERSION) if (version == tmpVersion) { selected = cnt; found = true; break; } /* Current IOS */ if (version == IOS_GetVersion()) selected = cnt; } /* Ask user for IOS version */ if ((gConfig.cIOSVersion < 0) || (found == false)) { for (;;) { /* Clear console */ Con_Clear(); printf("\t>> Select IOS version to use: < IOS%d >\n\n", iosVersion[selected]); printf("\t Press LEFT/RIGHT to change IOS version.\n\n"); printf("\t Press A button to continue.\n"); printf("\t Press HOME button to restart.\n\n"); u32 buttons = WaitButtons(); /* LEFT/RIGHT buttons */ if (buttons & WPAD_BUTTON_LEFT) { if ((--selected) <= -1) selected = (iosCnt - 1); } if (buttons & WPAD_BUTTON_RIGHT) { if ((++selected) >= iosCnt) selected = 0; } /* HOME button */ if (buttons & WPAD_BUTTON_HOME) Restart(); /* A button */ if (buttons & WPAD_BUTTON_A) break; } } u8 version = iosVersion[selected]; if (IOS_GetVersion() != version) { /* Shutdown subsystems */ Wpad_Disconnect(); /* Load IOS */ ret = IOS_ReloadIOS(version); /* Initialize subsystems */ Wpad_Init(); } }
void Menu_WadList(void) { char str [100]; fatFile *fileList = NULL; u32 fileCnt; s32 ret, selected = 0, start = 0; char *tmpPath = malloc (MAX_FILE_PATH_LEN); int installCnt = 0; int uninstallCnt = 0; //fatFile *installFiles = malloc(sizeof(fatFile) * 50); //int installCount = 0; // wiiNinja: check for malloc error if (tmpPath == NULL) { ret = -997; // What am I gonna use here? printf(" ERROR! Out of memory (ret = %d)\n", ret); return; } printf("[+] Retrieving file list..."); fflush(stdout); gDirLevel = 0; // wiiNinja: The root is always the primary folder // But if the user has a /wad directory, just go there. This makes // both sides of the argument win sprintf(tmpPath, "%s:" WAD_DIRECTORY, fdev->mount); PushCurrentDir(tmpPath,0,0); //if (strcmp (WAD_DIRECTORY, WAD_ROOT_DIRECTORY) != 0) if (strcmp (WAD_DIRECTORY, gConfig.startupPath) != 0) { // If the directory can be successfully opened, it must exists //DIR_ITER *tmpDirPtr = NULL; //tmpDirPtr = diropen(WAD_ROOT_DIRECTORY); //if (tmpDirPtr) //{ // dirclose (tmpDirPtr); // Now push the /wad directory as the current operating folder //sprintf(tmpPath, "%s:" WAD_ROOT_DIRECTORY, fdev->mount); sprintf(tmpPath, "%s:%s", fdev->mount, gConfig.startupPath); //printf ("\nThe final startupPath is: %s\n", tmpPath); //WaitButtons (); PushCurrentDir(tmpPath,0,0); // wiiNinja //} } /* Retrieve filelist */ getList: if (fileList) { free (fileList); fileList = NULL; } ret = __Menu_RetrieveList(tmpPath, &fileList, &fileCnt); if (ret < 0) { printf(" ERROR! (ret = %d)\n", ret); goto err; } /* No files */ if (!fileCnt) { printf(" No files found!\n"); goto err; } /* Set install-values to 0 - Leathl */ int counter; for (counter = 0; counter < fileCnt; counter++) { fatFile *file = &fileList[counter]; file->install = 0; } for (;;) { u32 cnt; s32 index; /* Clear console */ Con_Clear(); /** Print entries **/ cnt = strlen(tmpPath); if(cnt>30) index = cnt-30; else index = 0; printf("[+] WAD files on [%s]:\n\n", tmpPath+index); /* Print entries */ for (cnt = start; cnt < fileCnt; cnt++) { fatFile *file = &fileList[cnt]; f32 filesize = file->filestat.st_size / MB_SIZE; /* Entries per page limit */ if ((cnt - start) >= ENTRIES_PER_PAGE) break; strncpy(str, file->filename, 40); //Only 40 chars to fit the screen str[40]=0; /* Print filename */ //printf("\t%2s %s (%.2f MB)\n", (cnt == selected) ? ">>" : " ", file->filename, filesize); if (file->filestat.st_mode & S_IFDIR) // wiiNinja printf("\t%2s [%s]\n", (cnt == selected) ? ">>" : " ", str); else printf("\t%2s%s%s (%.2f MB)\n", (cnt == selected) ? ">>" : " ", (file->install == 1) ? "+" : ((file->install == 2) ? "-" : " "), str, filesize); } printf("\n"); printf("[+] Press A to (un)install."); if(gDirLevel>1) printf(" Press B to go up-level DIR.\n"); else printf(" Press B to select a device.\n"); printf(" Use + and - to (un)mark. Press 1 for file operations."); /** Controls **/ u32 buttons = WaitButtons(); /* DPAD buttons */ if (buttons & WPAD_BUTTON_UP) { selected--; if (selected <= -1) selected = (fileCnt - 1); } if (buttons & WPAD_BUTTON_LEFT) { selected = selected + ENTRIES_PER_PAGE; if (selected >= fileCnt) selected = 0; } if (buttons & WPAD_BUTTON_DOWN) { selected ++; if (selected >= fileCnt) selected = 0; } if (buttons & WPAD_BUTTON_RIGHT) { selected = selected - ENTRIES_PER_PAGE; if (selected <= -1) selected = (fileCnt - 1); } /* HOME button */ if (buttons & WPAD_BUTTON_HOME) Restart(); /* Plus Button - Leathl */ if (buttons & WPAD_BUTTON_PLUS) { if(Wpad_TimeButton()) { installCnt = 0; int i = 0; while( i < fileCnt) { fatFile *file = &fileList[i]; if (((file->filestat.st_mode & S_IFDIR) == false) & (file->install == 0)) { file->install = 1; installCnt += 1; } else if (((file->filestat.st_mode & S_IFDIR) == false) & (file->install == 1)) { file->install = 0; installCnt -= 1; } else if (((file->filestat.st_mode & S_IFDIR) == false) & (file->install == 2)) { file->install = 1; installCnt += 1; uninstallCnt -= 1; } i++; } } else { fatFile *file = &fileList[selected]; if (((file->filestat.st_mode & S_IFDIR) == false) & (file->install == 0)) { file->install = 1; installCnt += 1; } else if (((file->filestat.st_mode & S_IFDIR) == false) & (file->install == 1)) { file->install = 0; installCnt -= 1; } else if (((file->filestat.st_mode & S_IFDIR) == false) & (file->install == 2)) { file->install = 1; installCnt += 1; uninstallCnt -= 1; } selected++; if (selected >= fileCnt) selected = 0; } } /* Minus Button - Leathl */ if (buttons & WPAD_BUTTON_MINUS) { if(Wpad_TimeButton()) { installCnt = 0; int i = 0; while( i < fileCnt) { fatFile *file = &fileList[i]; if (((file->filestat.st_mode & S_IFDIR) == false) & (file->install == 0)) { file->install = 2; uninstallCnt += 1; } else if (((file->filestat.st_mode & S_IFDIR) == false) & (file->install == 1)) { file->install = 2; uninstallCnt += 1; installCnt -= 1; } else if (((file->filestat.st_mode & S_IFDIR) == false) & (file->install == 2)) { file->install = 0; uninstallCnt -= 1; } i++; } } else { fatFile *file = &fileList[selected]; if (((file->filestat.st_mode & S_IFDIR) == false) & (file->install == 0)) { file->install = 2; uninstallCnt += 1; } else if (((file->filestat.st_mode & S_IFDIR) == false) & (file->install == 1)) { file->install = 2; uninstallCnt += 1; installCnt -= 1; } else if (((file->filestat.st_mode & S_IFDIR) == false) & (file->install == 2)) { file->install = 0; uninstallCnt -= 1; } selected++; if (selected >= fileCnt) selected = 0; } } /* 1 Button - Leathl */ if (buttons & WPAD_BUTTON_1) { fatFile *tmpFile = &fileList[selected]; char *tmpCurPath = PeekCurrentDir (); if (tmpCurPath != NULL) { int res = Menu_FileOperations(tmpFile, tmpCurPath); if (res != 0) goto getList; } } /* A button */ if (buttons & WPAD_BUTTON_A) { fatFile *tmpFile = &fileList[selected]; char *tmpCurPath; if (tmpFile->filestat.st_mode & S_IFDIR) // wiiNinja { if (strcmp (tmpFile->filename, "..") == 0) { selected = 0; start = 0; // Previous dir tmpCurPath = PopCurrentDir(&selected, &start); if (tmpCurPath != NULL) sprintf(tmpPath, "%s", tmpCurPath); installCnt = 0; uninstallCnt = 0; goto getList; } else if (IsListFull () == true) { WaitPrompt ("Maximum number of directory levels is reached.\n"); } else { tmpCurPath = PeekCurrentDir (); if (tmpCurPath != NULL) { if(gDirLevel>1) sprintf(tmpPath, "%s/%s", tmpCurPath, tmpFile->filename); else sprintf(tmpPath, "%s%s", tmpCurPath, tmpFile->filename); } // wiiNinja: Need to PopCurrentDir PushCurrentDir (tmpPath, selected, start); selected = 0; start = 0; installCnt = 0; uninstallCnt = 0; goto getList; } } else { //If at least one WAD is marked, goto batch screen - Leathl if ((installCnt > 0) | (uninstallCnt > 0)) { char *thisCurPath = PeekCurrentDir (); if (thisCurPath != NULL) { int res = Menu_BatchProcessWads(fileList, fileCnt, thisCurPath, installCnt, uninstallCnt); if (res == 1) { int counter; for (counter = 0; counter < fileCnt; counter++) { fatFile *temp = &fileList[counter]; temp->install = 0; } installCnt = 0; uninstallCnt = 0; } } } //else use standard wadmanage menu - Leathl else { tmpCurPath = PeekCurrentDir (); if (tmpCurPath != NULL) Menu_WadManage(tmpFile, tmpCurPath); } } } /* B button */ if (buttons & WPAD_BUTTON_B) { if(gDirLevel<=1) { return; } char *tmpCurPath; selected = 0; start = 0; // Previous dir tmpCurPath = PopCurrentDir(&selected, &start); if (tmpCurPath != NULL) sprintf(tmpPath, "%s", tmpCurPath); goto getList; //return; } /** Scrolling **/ /* List scrolling */ index = (selected - start); if (index >= ENTRIES_PER_PAGE) start += index - (ENTRIES_PER_PAGE - 1); if (index <= -1) start += index; } err: printf("\n"); printf(" Press any button to continue...\n"); free (tmpPath); /* Wait for button */ WaitButtons(); }
/* Install and/or Uninstall multiple WADs - Leathl */ int Menu_BatchProcessWads(fatFile *files, int fileCount, char *inFilePath, int installCnt, int uninstallCnt) { int count; for (;;) { Con_Clear(); if ((installCnt > 0) & (uninstallCnt == 0)) { printf("[+] %d file%s marked for installation.\n", installCnt, (installCnt == 1) ? "" : "s"); printf(" Do you want to proceed?\n"); } else if ((installCnt == 0) & (uninstallCnt > 0)) { printf("[+] %d file%s marked for uninstallation.\n", uninstallCnt, (uninstallCnt == 1) ? "" : "s"); printf(" Do you want to proceed?\n"); } else { printf("[+] %d file%s marked for installation and %d file%s for uninstallation.\n", installCnt, (installCnt == 1) ? "" : "s", uninstallCnt, (uninstallCnt == 1) ? "" : "s"); printf(" Do you want to proceed?\n"); } printf("\n\n Press A to continue.\n"); printf(" Press B to go back to the menu.\n\n"); u32 buttons = WaitButtons(); if (buttons & WPAD_BUTTON_A) break; if (buttons & WPAD_BUTTON_B) return 0; } WiiLightControl (WII_LIGHT_ON); int errors = 0; int success = 0; s32 ret; for (count = 0; count < fileCount; count++) { fatFile *thisFile = &files[count]; if ((thisFile->install == 1) | (thisFile->install == 2)) { int mode = thisFile->install; Con_Clear(); printf("[+] Opening \"%s\", please wait...\n\n", thisFile->filename); sprintf(gTmpFilePath, "%s/%s", inFilePath, thisFile->filename); FILE *fp = fopen(gTmpFilePath, "rb"); if (!fp) { printf(" ERROR!\n"); errors += 1; continue; } printf("[+] %s WAD, please wait...\n", (mode == 2) ? "Uninstalling" : "Installing"); if (mode == 2) { ret = Wad_Uninstall(fp); } else { ret = Wad_Install(fp); } if (ret < 0) errors += 1; else success += 1; thisFile->installstate = ret; if (fp) fclose(fp); } } WiiLightControl (WII_LIGHT_OFF); printf("\n"); printf(" %d titles succeeded and %d failed...\n", success, errors); if (errors > 0) { printf("\n Some operations failed"); printf("\n Press A to list.\n"); printf(" Press B skip.\n"); u32 buttons = WaitButtons(); if ((buttons & WPAD_BUTTON_A)) { Con_Clear(); int i=0; for (count = 0; count < fileCount; count++) { fatFile *thisFile = &files[count]; if (thisFile->installstate <0) { char str[41]; strncpy(str, thisFile->filename, 40); //Only 40 chars to fit the screen str[40]=0; i++; if(thisFile->installstate == -999) printf(" %s BRICK BLOCKED\n", str); else if(thisFile->installstate == -998) printf(" %s Skipped\n", str); else if(thisFile->installstate == -106) printf(" %s Not installed?\n", str); else if(thisFile->installstate == -1036 ) printf(" %s Needed IOS missing\n", str); else if(thisFile->installstate == -4100 ) printf(" %s No trucha bug?\n", str); else printf(" %s error %d\n", str, thisFile->installstate); if( i == 17 ) { printf("\n Press any button to continue\n"); WaitButtons(); i = 0; } } } } } printf("\n Press any button to continue...\n"); WaitButtons(); return 1; }