void Menu_Boot() { struct discHdr *header; bool gc = false; header = &gameList[gameSelected]; s32 ret; struct Game_CFG_2 *game_cfg = NULL; /* Clear console */ if (!CFG.direct_launch) { Con_Clear(); } FgColor(CFG.color_header); printf_x(gt("Start this game?")); printf("\n\n"); DefaultColor(); game_cfg = CFG_find_game(header->id); // Get game size gc = header->magic == GC_MAGIC; bool do_skip = !CFG.confirm_start; /* SoundInfo snd; u8 banner_title[84]; memset(banner_title, 0, 84); memset(&snd, 0, sizeof(snd)); WBFS_Banner(header->id, &snd, banner_title, !do_skip, CFG_read_active_game_setting(header->id).write_playlog); */ if (do_skip) { goto skip_confirm; } printf("\n"); /* Show game info */ printf_("%s\n", get_title(header)); printf_("(%.6s)\n\n", header->id); __Menu_ShowGameInfo(true, header->id); /* load game info from XML */ printf("\n"); //Does DL warning apply to launching discs too? Not sure printf_h(gt("Press %s button to continue."), (button_names[CFG.button_confirm.num])); printf("\n"); printf_h(gt("Press %s button to go back."), (button_names[CFG.button_cancel.num])); if (!gc) { printf("\n"); printf_h(gt("Press %s button for options."), (button_names[CFG.button_other.num])); } printf("\n\n"); __console_flush(0); // play banner sound /* if (snd.dsp_data) { SND_PauseVoice(0, 1); // pause mp3 int fmt = (snd.channels == 2) ? VOICE_STEREO_16BIT : VOICE_MONO_16BIT; SND_SetVoice(1, fmt, snd.rate, 0, snd.dsp_data, snd.size, 255,255, //volume,volume, NULL); //DataTransferCallback } */ /* Wait for user answer */ u32 buttons; for (;;) { buttons = Wpad_WaitButtons(); if (buttons & CFG.button_confirm.mask) break; if (buttons & CFG.button_cancel.mask) break; if (!gc && (buttons & CFG.button_other.mask)) break; if (buttons & CFG.button_exit.mask) break; } /* // stop banner sound, resume mp3 if (snd.dsp_data) { SND_StopVoice(1); SAFE_FREE(snd.dsp_data); if (buttons & CFG.button_confirm.mask) { SND_ChangeVolumeVoice(0, 0, 0); } SND_PauseVoice(0, 0); } */ if (buttons & CFG.button_cancel.mask) goto close; if (buttons & CFG.button_exit.mask) { Handle_Home(0); return; } if (!gc && (buttons & CFG.button_other.mask)) { Menu_Boot_Options(header); return; } // A button: continue to boot skip_confirm: if (game_cfg) { CFG.game = game_cfg->curr; } if (CFG.game.write_playlog && set_playrec(header->id, (u8 *) header->title) < 0) { // banner_title) < 0) { printf_(gt("Error storing playlog file.\nStart from the Wii Menu to fix.")); printf("\n"); printf_h(gt("Press %s button to exit."), (button_names[CFG.button_exit.num])); printf("\n"); if (!Menu_Confirm(0)) return; } WBFS_OpenDisc(header->id, header->game_idx); printf("\n"); printf_x(gt("Booting Wii game, please wait...")); printf("\n\n"); // load stuff before ios reloads & services close ocarina_load_code(header->id); load_wip_patches(header->id); // Close the wode stuff WBFS_Close(); use_dvdx = 0; Disc_Init(); ret = Disc_Wait(); if (ret < 0) { printf("Cannot mount newly selected image: %d\n", ret); } Disc_Open(); // stop services (music, gui) Services_Close(); setPlayStat(header->id); //I'd rather do this after the check, but now you unmount fat before that ;) Fat_UnmountAll(); if (gc) { WII_Initialize(); ret = WII_LaunchTitle(0x0000000100000100ULL); } else { switch(CFG.game.language) { // 0 = CFG_LANG_CONSOLE case 0: configbytes[0] = 0xCD; break; case 1: configbytes[0] = 0x00; break; case 2: configbytes[0] = 0x01; break; case 3: configbytes[0] = 0x02; break; case 4: configbytes[0] = 0x03; break; case 5: configbytes[0] = 0x04; break; case 6: configbytes[0] = 0x05; break; case 7: configbytes[0] = 0x06; break; case 8: configbytes[0] = 0x07; break; case 9: configbytes[0] = 0x08; break; case 10: configbytes[0] = 0x09; break; } /* Boot Wii disc */ ret = Disc_WiiBoot(); } printf_(gt("Returned! (ret = %d)"), ret); printf("\n"); printf("\n"); printf_(gt("Press any button to exit...")); printf("\n"); /* Wait for button */ Wpad_WaitButtonsCommon(); exit(0); close: WDVD_StopMotor(); header = &gameList[gameSelected]; Gui_DrawCover(header->id); // Reopen the wode WBFS_Init(); return; }
void Menu_Install(void) { static struct discHdr header ATTRIBUTE_ALIGN(32); s32 ret; /* Clear console */ Con_Clear(); printf("[+] Are you sure you want to install a\n"); printf(" new Wii game?\n\n"); printf(" Press A button to continue.\n"); printf(" Press B button to go back.\n\n\n"); /* Wait for user answer */ for (;;) { u32 buttons = Wpad_WaitButtons(); /* A button */ if (buttons & WPAD_BUTTON_A) break; /* B button */ if (buttons & WPAD_BUTTON_B) return; } /* Disable WBFS mode */ Disc_SetWBFS(0, NULL); printf("[+] Insert the game DVD disc..."); fflush(stdout); /* Wait for disc */ ret = Disc_Wait(); if (ret < 0) { printf("\n ERROR! (ret = %d)\n", ret); goto out; } else printf(" OK!\n"); printf("[+] Opening DVD disc..."); fflush(stdout); /* Open disc */ ret = Disc_Open(); if (ret < 0) { printf("\n ERROR! (ret = %d)\n", ret); goto out; } else printf(" OK!\n\n"); /* Check disc */ ret = Disc_IsWii(); if (ret < 0) { printf("[+] ERROR: Not a Wii disc!!\n"); goto out; } /* Read header */ Disc_ReadHeader(&header); /* Check if game is already installed */ ret = WBFS_CheckGame(header.id); if (ret) { printf("[+] ERROR: Game already installed!!\n"); goto out; } printf("[+] Installing game, please wait...\n\n"); printf(" %s\n", header.title); printf(" (%c%c%c%c)\n\n", header.id[0], header.id[1], header.id[2], header.id[3]); /* Install game */ ret = WBFS_AddGame(); if (ret < 0) { printf("[+] Installation ERROR! (ret = %d)\n", ret); goto out; } /* Reload entries */ __Menu_GetEntries(); out: printf("\n"); printf(" Press any button to continue...\n"); /* Wait for any button */ Wpad_WaitButtons(); }