int init_dvd() { // Gamecube Mode #ifdef HW_DOL if(mfpvr()!=GC_CPU_VERSION) //GC mode on Wii, modchip required { DVD_Reset(DVD_RESETHARD); dvd_read_id(); if(!dvd_get_error()) { return 0; //we're ok } } else //GC, no modchip even required :) { DVD_Reset(DVD_RESETHARD); DVD_Mount (); if(!dvd_get_error()) { return 0; //we're ok } } if(dvd_get_error()>>24) { return NO_DISC; } return -1; #endif // Wii (Wii mode) #ifdef HW_RVL if(!have_hw_access()) { return NO_HW_ACCESS; } if((dvd_get_error()>>24) == 1) { return NO_DISC; } if((!dvd_hard_init) || (dvd_get_error())) { DI_Mount(); while(DI_GetStatus() & DVD_INIT) usleep(20000); dvd_hard_init=1; } if((dvd_get_error()&0xFFFFFF)==0x053000) { read_cmd = DVDR; } else { read_cmd = NORMAL; } return 0; #endif }
static void dvdprobe(callout_t *co, void *aux) { disc_scanner_t *ds = aux; callout_arm(&ds->ds_timer, dvdprobe, ds, 1); if(ds->ds_disc_inserted == 0) { DI_Mount(); if(DI_GetStatus() == DVD_NO_DISC) return; TRACE(TRACE_INFO, "DVD", "DVD inserted"); ds->ds_disc_inserted = 1; ds->ds_disc_ready = 0; } else { uint32_t s = DI_GetStatus(); if(s == DVD_UNKNOWN) { ds->ds_disc_inserted = 0; notify_add(NOTIFY_ERROR, NULL, 5, "Unknown disc inserted, ejecting..."); DI_Eject(); return; } if(!(s & DVD_READY)) { TRACE(TRACE_DEBUG, "DVD", "Waiting for disc ready state = %x", s); return; } if(!ds->ds_disc_ready) check_disc_type(ds); if(DI_GetCoverRegister(&s) || !(s & DVD_COVER_DISC_INSERTED)) { ds->ds_disc_inserted = 0; TRACE(TRACE_INFO, "DVD", "DVD no longer present"); if(ds->ds_service != NULL) { service_destroy(ds->ds_service); ds->ds_service = NULL; } } } }
/**************************************************************************** * OpenDVD * * Function to load a DVD directory and display to user. ****************************************************************************/ int OpenDVD (int method) { if (!getpvd()) { ShowAction((char*) "Loading DVD..."); #ifdef HW_DOL DVD_Mount(); // mount the DVD unit again #elif WII_DVD u32 val; DI_GetCoverRegister(&val); if(val & 0x1) // True if no disc inside, use (val & 0x2) for true if disc inside. { WaitPrompt((char *)"No disc inserted!"); return 0; } DI_Mount(); while(DI_GetStatus() & DVD_INIT); #endif if (!getpvd()) { WaitPrompt ((char *)"Invalid DVD."); return 0; // not a ISO9660 DVD } } maxfiles = ParseDVDdirectory(); // load root folder // switch to rom folder SwitchDVDFolder(GCSettings.LoadFolder); if (maxfiles > 0) { return FileSelector (method); } else { // no entries found WaitPrompt ((char *)"No Files Found!"); return 0; } }
int setDevice (fatdev device) { unmountDevice(); if (!(device.io->isInserted())) { return 0; } if (matchStr(device.root, "dvd")) { DI_Mount(); if (!(ISO9660_Mount())) { setError(1); return 0; } } else { if (!fatMount(device.root, device.io, 0, 8, 512)) { setError(2); return 0; } } inuse = &device; memset(&bPath, 0, sizeof(bPath)); sprintf(bPath, "%s:/", inuse->root); getFiles(); return 1; }
int main(int argc, char *argv[]) { s32 res; #ifdef USE_WII_DI DI_Init(); #endif VIDEO_Init(); PAD_Init(); AUDIO_Init(NULL); #ifdef DEBUG_WII_USBGECKO CON_EnableGecko(1, false); #endif #ifdef DEBUG_WII_GDB DEBUG_Init(GDBSTUB_DEVICE_USB, 1); #endif printf("startup as "); if (argc > 0) printf("'%s'\n", argv[0]); else printf("<unknown>\n"); SYS_SetResetCallback(reset_cb); #ifndef GAMECUBE SYS_SetPowerCallback(power_cb); #endif #ifdef USE_WII_DI // initial async mount for the browser, see wii-fs.cpp DI_Mount(); #endif if (!fatInitDefault()) { printf("fatInitDefault failed\n"); } else { // set the default path if libfat couldnt set it // this allows loading over tcp/usbgecko char cwd[MAXPATHLEN]; if (getcwd(cwd, MAXPATHLEN)) { size_t len = strlen(cwd); if (len > 2 && (cwd[len - 1] == ':' || cwd[len - 2] == ':')) { printf("chdir to default\n"); chdir("/apps/scummvm"); } } } g_system = new OSystem_Wii(); assert(g_system); res = scummvm_main(argc, argv); g_system->quit(); printf("shutdown\n"); fatUnmountDefault(); #ifdef USE_WII_DI DI_Close(); #endif if (power_btn_pressed) { printf("shutting down\n"); SYS_ResetSystem(SYS_POWEROFF, 0, 0); } printf("reloading\n"); return res; }