s32 Disc_OpenPartitionO(u32 mode, u8 *id, u64 *offset) { if (Disc_Open() < 0) return -2; if (__Disc_FindPartition(offset) < 0) return -3; if (WDVD_OpenPartition(*offset, 0, 0, 0, Tmd_Buffer) < 0) return -4; return 0; }
s32 Disc_WiiBoot(u8 vidMode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio) { u64 offset; /* Find game partition offset */ s32 ret = __Disc_FindPartition(&offset); if (ret < 0) return ret; /* Boot partition */ return Disc_BootPartition(offset, vidMode, vipatch, countryString, patchVidModes, aspectRatio); }
s32 Disc_WiiBoot(u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, u32 rtrn) { u64 offset; s32 ret; /* Find game partition offset */ ret = __Disc_FindPartition(&offset); if (ret < 0) return ret; /* Boot partition */ return Disc_BootPartition(offset, videoselected, cheat, vipatch, patchcountrystring, rtrn); }
s32 Disc_WiiBoot(LoaderConfig loaderConfig) { u64 offset; s32 ret; /* Find game partition offset */ ret = __Disc_FindPartition(&offset); if (ret < 0) return ret; /* Boot partition */ return Disc_BootPartition(loaderConfig, offset); }
s32 Disc_WiiBoot(u8 vidMode, const u8 *cheat, u32 cheatSize, bool vipatch, bool countryString, u8 patchVidModes) { u64 offset; s32 ret; /* Find game partition offset */ ret = __Disc_FindPartition(&offset); if (ret < 0) { gprintf("Cannot find partition offset: %d\n", ret); return ret; } /* Boot partition */ return Disc_BootPartition(offset, vidMode, cheat, cheatSize, vipatch, countryString, patchVidModes); }
s32 dump_openingbnr(u8 *discID, const char * dest) { // Mount the disc Disc_SetUSB(discID); Disc_Open(); u64 offset; s32 ret; ret = __Disc_FindPartition(&offset); if (ret < 0) return ret; ret = WDVD_OpenPartition(offset); if (ret < 0) { return ret; } // Read where to find the fst.bin u32 *buffer = memalign(32, 0x20); if (buffer == NULL) { //Out of memory return -1; } ret = WDVD_Read(buffer, 0x20, 0x420); if (ret < 0) return ret; // Read fst.bin void *fstbuffer = memalign(32, buffer[2]*4); FST_ENTRY *fst = (FST_ENTRY *)fstbuffer; if (fst == NULL) { //Out of memory free(buffer); return -1; } ret = WDVD_Read(fstbuffer, buffer[2]*4, buffer[1]*4); if (ret < 0) return ret; free(buffer); // Search the fst.bin u32 count = fst[0].filelen; int i; u32 index = 0; for (i=1;i<count;i++) { if (strstr(fstfiles(fst, i), "opening.bnr") != NULL) { index = i; } } if (index == 0) { //opening.bnr not found free(fstbuffer); return -1; } // Load the .bnr u8 *banner = memalign(32, fst[index].filelen); if (banner == NULL) { //Out of memory free(fstbuffer); return -1; } ret = WDVD_Read((void *)banner, fst[index].filelen, fst[index].fileoffset * 4); if (ret < 0) return ret; FILE *fp = NULL; fp = fopen(dest, "wb"); fwrite(banner, 1, fst[index].filelen, fp); fclose(fp); free(fstbuffer); free(banner); return 1; }
s32 dump_banner(const u8* discid,const char * dest) { // Mount the disc //Disc_SetWBFS(1, (u8*)discid); Disc_SetUSB(discid); Disc_Open(); u64 offset; s32 ret; ret = __Disc_FindPartition(&offset); if (ret < 0) return ret; ret = WDVD_OpenPartition(offset, NULL); if (ret < 0) { //printf("ERROR: OpenPartition(0x%llx) %d\n", offset, ret); return ret; } // Read where to find the fst.bin u32 *buffer = memalign(32, 0x20); if (buffer == NULL) { //Out of memory return -1; } ret = WDVD_Read(buffer, 0x20, 0x420); if (ret < 0) return ret; // Read fst.bin void *fstbuffer = memalign(32, buffer[2]*4); FST_ENTRY *fst = (FST_ENTRY *)fstbuffer; if (fst == NULL) { //Out of memory free(buffer); return -1; } ret = WDVD_Read(fstbuffer, buffer[2]*4, buffer[1]*4); if (ret < 0) return ret; free(buffer); // Search the fst.bin u32 count = fst[0].filelen; int i; u32 index = 0; for (i=1;i<count;i++) { if (strstr(fstfiles(fst, i), "opening.bnr") != NULL) { index = i; } } if (index == 0) { //opening.bnr not found free(fstbuffer); return -1; } // Load the .bnr u8 *banner = memalign(32, fst[index].filelen); if (banner == NULL) { //Out of memory free(fstbuffer); return -1; } ret = WDVD_Read((void *)banner, fst[index].filelen, fst[index].fileoffset * 4); if (ret < 0) return ret; WDVD_Reset(); WDVD_ClosePartition(); //fatInitDefault(); //SDCard_Init(); WDVD_SetUSBMode(NULL, 0); FILE *fp = fopen(dest, "wb"); if(fp) { fwrite(banner, 1, fst[index].filelen, fp); fclose(fp); } free(fstbuffer); free(banner); return 1; }