// Checks if devices are available, prints name of device being detected for slow init devices void populateDeviceAvailability() { DrawFrameStart(); DrawMessageBox(D_INFO, "Detecting devices ...\nThis can be skipped by holding B next time"); DrawFrameFinish(); if(PAD_ButtonsHeld(0) & PAD_BUTTON_B) { deviceHandler_setAllDevicesAvailable(); return; } const DISC_INTERFACE* carda = &__io_gcsda; const DISC_INTERFACE* cardb = &__io_gcsdb; // DVD deviceHandler_setDeviceAvailable(DVD_DISC, swissSettings.hasDVDDrive); // SD Gecko DrawFrameStart(); DrawMessageBox(D_INFO, "Detecting devices [SD] ...\nThis can be skipped by holding B next time"); DrawFrameFinish(); deviceHandler_setDeviceAvailable(SD_CARD, carda->isInserted() || cardb->isInserted()); // IDE-EXI DrawFrameStart(); DrawMessageBox(D_INFO, "Detecting devices [IDE-EXI] ...\nThis can be skipped by holding B next time"); DrawFrameFinish(); deviceHandler_setDeviceAvailable(IDEEXI, ide_exi_inserted(0) || ide_exi_inserted(1)); // Qoob deviceHandler_setDeviceAvailable(QOOB_FLASH, 0); // Hidden by default, add auto detect at some point // WODE deviceHandler_setDeviceAvailable(WODE, 0); // Hidden by default, add auto detect at some point // Memory card DrawFrameStart(); DrawMessageBox(D_INFO, "Detecting devices [Memory Card] ...\nThis can be skipped by holding B next time"); DrawFrameFinish(); deviceHandler_setDeviceAvailable(MEMCARD, (initialize_card(0)==CARD_ERROR_READY) || (initialize_card(1)==CARD_ERROR_READY)); // WKF/WASP DrawFrameStart(); DrawMessageBox(D_INFO, "Detecting devices [WKF/WASP] ...\nThis can be skipped by holding B next time"); DrawFrameFinish(); deviceHandler_setDeviceAvailable(WKF, swissSettings.hasDVDDrive && (__wkfSpiReadId() != 0 && __wkfSpiReadId() != 0xFFFFFFFF)); // USB Gecko deviceHandler_setDeviceAvailable(USBGECKO, usb_isgeckoalive(1)); // BBA/SAMBA deviceHandler_setDeviceAvailable(SAMBA, exi_bba_exists()); // System, always there deviceHandler_setDeviceAvailable(SYS, 1); }
/**************************************************************************** * Main ****************************************************************************/ int main () { // Setup defaults (if no config is found) memset(&swissSettings, 0 , sizeof(SwissSettings)); void *fb; fb = Initialise(); if(!fb) { return -1; } // Sane defaults refreshSRAM(); swissSettings.debugUSB = 1; swissSettings.gameVMode = 0; // Auto video mode swissSettings.exiSpeed = 1; // 32MHz swissSettings.uiVMode = 0; // Auto UI mode swissSettings.enableFileManagement = 0; config_copy_swiss_settings(&swissSettings); needsDeviceChange = 1; needsRefresh = 1; //debugging stuff if(swissSettings.debugUSB) { if(usb_isgeckoalive(1)) { usb_flush(1); } print_gecko("Arena Size: %iKb\r\n",(SYS_GetArena1Hi()-SYS_GetArena1Lo())/1024); print_gecko("DVD Drive Present? %s\r\n",swissSettings.hasDVDDrive?"Yes":"No"); print_gecko("GIT Commit: %s\r\n", GITREVISION); print_gecko("GIT Revision: %s\r\n", GITVERSION); } // Detect devices populateDeviceAvailability(); curDevice = -1; // Are we working with a Wiikey Fusion? if(__wkfSpiReadId() != 0 && __wkfSpiReadId() != 0xFFFFFFFF) { print_gecko("Detected Wiikey Fusion with SPI Flash ID: %08X\r\n",__wkfSpiReadId()); // Set real device back curDevice = WKF; // SlotB hack trySlotB(); } else { deviceHandler_setStatEnabled(0); // Try to init SD cards here and load config deviceHandler_initial = &initial_SD0; deviceHandler_init = deviceHandler_FAT_init; deviceHandler_deinit = deviceHandler_FAT_deinit; if(deviceHandler_init(deviceHandler_initial)) { print_gecko("Detected SDGecko in Slot A\r\n"); load_auto_dol(); curDevice = SD_CARD; } else { deviceHandler_deinit(deviceHandler_initial); deviceHandler_initial = &initial_SD1; if(deviceHandler_init(deviceHandler_initial)) { print_gecko("Detected SDGecko in Slot B\r\n"); load_auto_dol(); curDevice = SD_CARD; } } deviceHandler_setStatEnabled(1); } // If no device has been selected yet to browse .. if(curDevice < 0) { print_gecko("No default boot device detected, trying DVD!\r\n"); // Do we have a DVD drive with a ready medium we can perhaps browse then? u8 driveReallyExists[8]; drive_version(&driveReallyExists[0]); if(*(u32*)&driveReallyExists[0]) { dvd_read_id(); if(!dvd_get_error()) { print_gecko("DVD Medium is up, using it as default device\r\n"); curDevice = DVD_DISC; // If we have a GameCube (single image) bootable disc, show the banner screen here dvdDiscTypeInt = gettype_disc(); if(dvdDiscTypeInt == GAMECUBE_DISC) { select_device(1); // Setup curFile and load it memset(&curFile, 0, sizeof(file_handle)); strcpy(&curFile.name[0], "game.gcm"); curFile.size = DISC_SIZE; curFile.fileAttrib = IS_FILE; populate_meta(&curFile); load_file(); curDevice = -1; deviceHandler_initial = NULL; } } } } if(curDevice) { needsDeviceChange = 0; select_device(1); // to setup deviceHandler_ ptrs load_config(forceSlot); } // Start up the BBA if it exists init_network_thread(); init_httpd_thread(); // DVD Motor off if(swissSettings.stopMotor && swissSettings.hasDVDDrive) { dvd_motor_off(); } // Swiss video mode force GXRModeObj *forcedMode = getModeFromSwissSetting(swissSettings.uiVMode); if((forcedMode != NULL) && (forcedMode != vmode)) { initialise_video(forcedMode); vmode = forcedMode; } while(1) { main_loop(); } return 0; }
void info_draw_page(int page_num) { doBackdrop(); DrawEmptyBox(20,60, vmode->fbWidth-20, 420, COLOR_BLACK); syssram* sram = __SYS_LockSram(); __SYS_UnlockSram(0); // System Info (Page 1/3) if(!page_num) { WriteFont(30, 65, "System Info (1/3):"); // Model if(is_gamecube()) { if(*(u32*)&driveVersion[0] == 0x20010831) { sprintf(topStr, "Panasonic Q SL-GC10-S"); } else if(IPLInfo[0x55]=='M') { // MPAL 1.1 (Brazil) sprintf(topStr, "Nintendo GameCube DOL-002 (BRA)"); } else if((!IPLInfo[0x55]) // NTSC 1.0 || (IPLInfo[0x55] == 'P' && IPLInfo[0x65]=='0') // PAL 1.0 || (IPLInfo[0x55] != 'P' && IPLInfo[0x65]=='1')) { // NTSC 1.1 sprintf(topStr, "Nintendo GameCube DOL-001"); } else if((IPLInfo[0x55] == 'P' && IPLInfo[0x65]=='0') // PAL 1.1 || IPLInfo[0x65]=='2') { // NTSC 1.2 sprintf(topStr, "Nintendo GameCube DOL-101"); } } else { sprintf(topStr, "Nintendo Wii"); } WriteFontStyled(640/2, 110, topStr, 1.0f, true, defaultColor); // IPL version string if(is_gamecube()) { if(!IPLInfo[0x55]) { sprintf(topStr, "NTSC Revision 1.0"); } else { sprintf(topStr, "%s", &IPLInfo[0x55]); } } else { sprintf(topStr, "Wii IPL"); } WriteFontStyled(640/2, 140, topStr, 1.0f, true, defaultColor); if(swissSettings.hasDVDDrive) { if((!__wkfSpiReadId() || (__wkfSpiReadId() == 0xFFFFFFFF))) { sprintf(topStr, "DVD Drive %02X %02X%02X/%02X (%02X)",driveVersion[2],driveVersion[0],driveVersion[1],driveVersion[3],driveVersion[4]); } else { sprintf(topStr, "WKF Serial %s",wkfGetSerial()); } } else sprintf(topStr, "No DVD Drive present"); WriteFontStyled(640/2, 170, topStr, 1.0f, true, defaultColor); sprintf(topStr, "%s",videoStr); WriteFontStyled(640/2, 200, topStr, 1.0f, true, defaultColor); sprintf(topStr,"%s / %s",getSramLang(sram->lang), sram->flags&4 ? "Stereo":"Mono"); WriteFontStyled(640/2, 230, topStr, 1.0f, true, defaultColor); sprintf(topStr,"PVR %08X ECID %08X:%08X:%08X",mfpvr(),mfspr(0x39C),mfspr(0x39D),mfspr(0x39E)); WriteFontStyled(640/2, 260, topStr, 0.75f, true, defaultColor); } else if(page_num == 1) { WriteFont(30, 65, "Device Info (2/3):"); sprintf(topStr,"BBA: %s", bba_exists ? "Installed":"Not Present"); WriteFont(30, 110, topStr); if(exi_bba_exists()) { sprintf(topStr,"IP: %s", net_initialized ? bba_ip:"Not Available"); } else { sprintf(topStr,"IP: Not Available"); } WriteFont(270, 110, topStr); sprintf(topStr,"Component Cable Plugged in: %s",VIDEO_HaveComponentCable()?"Yes":"No"); WriteFont(30, 140, topStr); if(usb_isgeckoalive(0)||usb_isgeckoalive(1)) { sprintf(topStr,"USB Gecko: Installed in %s",usb_isgeckoalive(0)?"Slot A":"Slot B"); } else { sprintf(topStr,"USB Gecko: Not Present"); } WriteFont(30, 170, topStr); if (!deviceHandler_initial) { sprintf(topStr, "Current Device: No Device Selected"); } else if(deviceHandler_initial == &initial_SD0 || deviceHandler_initial == &initial_SD1) { int slot = (deviceHandler_initial->name[2] == 'b'); sprintf(topStr, "Current Device: %s Card in %s @ %s",!SDHCCard?"SDHC":"SD",!slot?"Slot A":"Slot B",!swissSettings.exiSpeed?"16Mhz":"32Mhz"); } else if(deviceHandler_initial == &initial_DVD) { sprintf(topStr, "Current Device: %s DVD Disc",dvdDiscTypeStr); } else if(deviceHandler_initial == &initial_IDE0 || deviceHandler_initial == &initial_IDE1) { int slot = (deviceHandler_initial->name[3] == 'b'); sprintf(topStr, "Current Device: %d GB HDD in %s",ataDriveInfo.sizeInGigaBytes,!slot?"Slot A":"Slot B"); } else if(deviceHandler_initial == &initial_Qoob) { sprintf(topStr, "Current Device: Qoob IPL Replacement"); } else if(deviceHandler_initial == &initial_WODE) { sprintf(topStr, "Current Device: Wode Jukebox"); } else if(deviceHandler_initial == &initial_CARDA || deviceHandler_initial == &initial_CARDB) { sprintf(topStr, "Current Device: Memory Card in %s",!deviceHandler_initial->fileBase?"Slot A":"Slot B"); } else if(deviceHandler_initial == &initial_USBGecko) { sprintf(topStr, "Current Device: USB Gecko"); } else if(deviceHandler_initial == &initial_WKF) { sprintf(topStr, "Current Device: Wiikey Fusion"); } else if(deviceHandler_initial == &initial_SYS) { sprintf(topStr, "Current Device: System"); } WriteFont(30, 200, topStr); } else if(page_num == 2) { WriteFont(30, 65, "Credits (3/3):"); WriteFontStyled(640/2, 115, "Swiss ver 0.4", 1.0f, true, defaultColor); WriteFontStyled(640/2, 140, "by emu_kidid 2015", 0.75f, true, defaultColor); sprintf(txtbuffer, "Commit %s Revision %s SD Gecko Slot B Cheats Mod", GITREVISION, GITVERSION); WriteFontStyled(640/2, 165, txtbuffer, 0.75f, true, defaultColor); WriteFontStyled(640/2, 210, "Thanks to", 0.75f, true, defaultColor); WriteFontStyled(640/2, 228, "Testers & libOGC/dkPPC authors", 0.75f, true, defaultColor); WriteFontStyled(640/2, 246, "sepp256 for GX / FIX94 for Audio Streaming", 0.75f, true, defaultColor); WriteFontStyled(640/2, 264, "Extrems for video patches / Megalomaniac for builds", 0.75f, true, defaultColor); WriteFontStyled(640/2, 282, "Fishaman P for cheats support with all devices", 0.75f, true, defaultColor); WriteFontStyled(640/2, 318, "Web/Support http://www.gc-forever.com/", 0.75f, true, defaultColor); WriteFontStyled(640/2, 336, "Source at https://github.com/emukidid/swiss-gc", 0.75f, true, defaultColor); WriteFontStyled(640/2, 354, "Visit us at #gc-forever on EFNet", 0.75f, true, defaultColor); } if(page_num != 2) { WriteFont(520, 390, "->"); } if(page_num != 0) { WriteFont(100, 390, "<-"); } WriteFontStyled(640/2, 400, "Press A to return", 1.0f, true, defaultColor); DrawFrameFinish(); }