void DrawArgsSelector(char *fileName) { Parameters* params = getParameters(); int param_selection = 0; int params_per_page = 6; while ((PAD_ButtonsHeld(0) & PAD_BUTTON_A)){ VIDEO_WaitVSync (); } while(1) { doBackdrop(); DrawEmptyBox(20,60, vmode->fbWidth-20, 460, COLOR_BLACK); sprintf(txtbuffer, "%s Parameters:", fileName); WriteFontStyled(25, 62, txtbuffer, GetTextScaleToFitInWidth(txtbuffer, vmode->fbWidth-50), false, defaultColor); int j = 0; int current_view_start = MIN(MAX(0,param_selection-params_per_page/2),MAX(0,params->num_params-params_per_page)); int current_view_end = MIN(params->num_params, MAX(param_selection+params_per_page/2,params_per_page)); int scrollBarHeight = 90+(params_per_page*20); int scrollBarTabHeight = (int)((float)scrollBarHeight/(float)params->num_params); DrawVertScrollBar(vmode->fbWidth-45, 120, 25, scrollBarHeight, (float)((float)param_selection/(float)(params->num_params-1)),scrollBarTabHeight); for(j = 0; current_view_start<current_view_end; ++current_view_start,++j) { drawParameterForArgsSelector(¶ms->parameters[current_view_start], 25, 120+j*35, current_view_start==param_selection); } // Write about the default if there is any DrawTransparentBox( 35, 350, vmode->fbWidth-35, 400); WriteFontStyled(33, 345, "Default values will be used by the DOL being loaded if a", 0.8f, false, defaultColor); WriteFontStyled(33, 365, "parameter is not enabled. Please check the documentation", 0.8f, false, defaultColor); WriteFontStyled(33, 385, "for this DOL if you are unsure of the default values.", 0.8f, false, defaultColor); WriteFontStyled(640/2, 440, "(A) Toggle Param - (Start) Load the DOL", 1.0f, true, defaultColor); DrawFrameFinish(); while (!(PAD_ButtonsHeld(0) & (PAD_BUTTON_RIGHT|PAD_BUTTON_LEFT|PAD_BUTTON_UP|PAD_BUTTON_DOWN|PAD_BUTTON_START|PAD_BUTTON_A))) { VIDEO_WaitVSync (); } u16 btns = PAD_ButtonsHeld(0); if((btns & (PAD_BUTTON_RIGHT|PAD_BUTTON_LEFT)) && params->parameters[param_selection].enable) { int curValIdx = params->parameters[param_selection].currentValueIdx; int maxValIdx = params->parameters[param_selection].num_values; curValIdx = btns & PAD_BUTTON_LEFT ? ((--curValIdx < 0) ? maxValIdx-1 : curValIdx):((curValIdx + 1) % maxValIdx); params->parameters[param_selection].currentValueIdx = curValIdx; } if(btns & (PAD_BUTTON_UP|PAD_BUTTON_DOWN)) { param_selection = btns & PAD_BUTTON_UP ? ((--param_selection < 0) ? params->num_params-1 : param_selection) :((param_selection + 1) % params->num_params); } if(btns & PAD_BUTTON_A) { params->parameters[param_selection].enable ^= 1; } if(btns & PAD_BUTTON_START) { break; } while (PAD_ButtonsHeld(0) & (PAD_BUTTON_RIGHT|PAD_BUTTON_LEFT|PAD_BUTTON_UP|PAD_BUTTON_DOWN|PAD_BUTTON_START|PAD_BUTTON_A)) { VIDEO_WaitVSync (); } } }
uiDrawObj_t* updatescreen_mp3(file_handle *file, int state, int numFiles, int curMP3) { uiDrawObj_t* player = DrawEmptyBox(10,100, getVideoMode()->fbWidth-10, 400); sprintf(txtbuffer, "%s - Volume (%i%%)", (state == PLAYER_PAUSE ? "Paused":"Playing"), (int)(((float)volume/(float)255)*100)); DrawAddChild(player, DrawStyledLabel(640/2, 130, txtbuffer, 1.0f, true, defaultColor)); sprintf(txtbuffer, "(%i/%i) %s",curMP3, numFiles,getRelativeName(file->name)); float scale = GetTextScaleToFitInWidth(txtbuffer, getVideoMode()->fbWidth-10-10); DrawAddChild(player, DrawStyledLabel(640/2, 160, txtbuffer, scale, true, defaultColor)); memset(txtbuffer, 0, 256); sprintf(txtbuffer, "------------------------------"); float percentPlayed = (float)(((float)file->offset / (float)file->size) * 30); txtbuffer[(int)percentPlayed] = '*'; DrawAddChild(player, DrawStyledLabel(640/2, 210, txtbuffer, 1.0f, true, defaultColor)); DrawAddChild(player, DrawStyledLabel(640/2, 300, "(<-) Rewind (->) Forward (X) Vol+ (Y) Vol-", 1.0f, true, defaultColor)); DrawAddChild(player, DrawStyledLabel(640/2, 330, "(B) Stop (L) Prev (R) Next (Start) Pause", 1.0f, true, defaultColor)); sprintf(txtbuffer, "Shuffle is currently %s press (Z) to toggle", (useShuffle ? "on":"off")); DrawAddChild(player, DrawStyledLabel(640/2, 360, txtbuffer, 1.0f, true, defaultColor)); return player; }
int DrawYesNoDialog(char *message) { int sel = 0; while ((PAD_ButtonsHeld(0) & PAD_BUTTON_A)){ VIDEO_WaitVSync (); } while(1) { doBackdrop(); DrawEmptyBox(75,190, vmode->fbWidth-78, 330, COLOR_BLACK); WriteFontStyled(640/2, 215, message, 1.0f, true, defaultColor); DrawSelectableButton(100, 280, -1, 310, "Yes", (sel==1) ? B_SELECTED:B_NOSELECT,-1); DrawSelectableButton(380, 280, -1, 310, "No", (!sel) ? B_SELECTED:B_NOSELECT,-1); DrawFrameFinish(); while (!(PAD_ButtonsHeld(0) & PAD_BUTTON_RIGHT) && !(PAD_ButtonsHeld(0) & PAD_BUTTON_LEFT) && !(PAD_ButtonsHeld(0) & PAD_BUTTON_B)&& !(PAD_ButtonsHeld(0) & PAD_BUTTON_A)) { VIDEO_WaitVSync (); } u16 btns = PAD_ButtonsHeld(0); if((btns & PAD_BUTTON_RIGHT) || (btns & PAD_BUTTON_LEFT)) { sel^=1; } if((btns & PAD_BUTTON_A) || (btns & PAD_BUTTON_B)) break; while (!(!(PAD_ButtonsHeld(0) & PAD_BUTTON_RIGHT) && !(PAD_ButtonsHeld(0) & PAD_BUTTON_LEFT) && !(PAD_ButtonsHeld(0) & PAD_BUTTON_B) && !(PAD_ButtonsHeld(0) & PAD_BUTTON_A))) { VIDEO_WaitVSync (); } } while ((PAD_ButtonsHeld(0) & PAD_BUTTON_A)){ VIDEO_WaitVSync (); } return sel; }
void DrawCheatsSelector(char *fileName) { CheatEntries* cheats = getCheats(); int cheat_selection = 0; int cheats_per_page = 6; while ((PAD_ButtonsHeld(0) & PAD_BUTTON_A)){ VIDEO_WaitVSync (); } while(1) { doBackdrop(); DrawEmptyBox(20,60, vmode->fbWidth-20, 460, COLOR_BLACK); sprintf(txtbuffer, "%s Cheats:", fileName); WriteFontStyled(25, 62, txtbuffer, GetTextScaleToFitInWidth(txtbuffer, vmode->fbWidth-50), false, defaultColor); int j = 0; int current_view_start = MIN(MAX(0,cheat_selection-cheats_per_page/2),MAX(0,cheats->num_cheats-cheats_per_page)); int current_view_end = MIN(cheats->num_cheats, MAX(cheat_selection+cheats_per_page/2,cheats_per_page)); int scrollBarHeight = 90+(cheats_per_page*20); int scrollBarTabHeight = (int)((float)scrollBarHeight/(float)cheats->num_cheats); DrawVertScrollBar(vmode->fbWidth-45, 120, 25, scrollBarHeight, (float)((float)cheat_selection/(float)(cheats->num_cheats-1)),scrollBarTabHeight); for(j = 0; current_view_start<current_view_end; ++current_view_start,++j) { drawCheatForCheatsSelector(&cheats->cheat[current_view_start], 25, 120+j*35, current_view_start==cheat_selection); } // Write about how many cheats are enabled DrawTransparentBox( 35, 350, vmode->fbWidth-35, 410); WriteFontStyled(33, 345, "Space taken by cheats:", 0.8f, false, defaultColor); GXColor noColor = (GXColor) {0,0,0,0}; //blank GXColor borderColor = (GXColor) {200,200,200,GUI_MSGBOX_ALPHA}; //silver GXColor progressBarColor = (GXColor) {255,128,0,GUI_MSGBOX_ALPHA}; //orange float multiplier = (float)getEnabledCheatsSize() / (float)kenobi_get_maxsize(); DrawSimpleBox( 33, 370, vmode->fbWidth-66, 20, 0, noColor, borderColor); DrawSimpleBox( 33, 370, (int)((vmode->fbWidth-66)*multiplier), 20, 0, progressBarColor, noColor); sprintf(txtbuffer, "WiiRD Debug %s", swissSettings.wiirdDebug ? "Enabled":"Disabled"); WriteFontStyled(33, 395, txtbuffer, 0.8f, false, defaultColor); WriteFontStyled(640/2, 440, "(A) Toggle Cheat - (X) WiiRD Debug - (B) Return", 0.9f, true, defaultColor); DrawFrameFinish(); while (!(PAD_ButtonsHeld(0) & (PAD_BUTTON_UP|PAD_BUTTON_DOWN|PAD_BUTTON_B|PAD_BUTTON_A|PAD_BUTTON_X))) { VIDEO_WaitVSync (); } u16 btns = PAD_ButtonsHeld(0); if(btns & (PAD_BUTTON_UP|PAD_BUTTON_DOWN)) { cheat_selection = btns & PAD_BUTTON_UP ? ((--cheat_selection < 0) ? cheats->num_cheats-1 : cheat_selection) :((cheat_selection + 1) % cheats->num_cheats); } if(btns & PAD_BUTTON_A) { cheats->cheat[cheat_selection].enabled ^= 1; if(getEnabledCheatsSize() > kenobi_get_maxsize()) // No room cheats->cheat[cheat_selection].enabled = 0; } if(btns & PAD_BUTTON_X) { swissSettings.wiirdDebug ^=1; } if(btns & PAD_BUTTON_B) { break; } while (PAD_ButtonsHeld(0) & (PAD_BUTTON_UP|PAD_BUTTON_DOWN|PAD_BUTTON_B|PAD_BUTTON_A|PAD_BUTTON_X)) { VIDEO_WaitVSync (); } } }
void settings_draw_page(int page_num, int option, file_handle *file) { doBackdrop(); DrawEmptyBox(20,60, vmode->fbWidth-20, 460, COLOR_BLACK); // Save Settings to current device (**Shown on all tabs**) /** Global Settings (Page 1/) */ // IPL/Game Language [English/German/French/Spanish/Italian/Dutch] // IPL/Game Audio [Mono/Stereo] // SD/IDE Speed [16/32 MHz] // Swiss Video Mode [576i (PAL 50Hz), 480i (NTSC 60Hz), 480p (NTSC 60Hz)] // Stop DVD Motor on startup [Yes/No] /** Advanced Settings (Page 2/) */ // Enable USB Gecko Debug via Slot B [Yes/No] // Force No DVD Drive Mode [Yes/No] // Hide Unknown file types [Yes/No] // TO BE IMPLEMENTED /** Current Game Settings - only if a valid GCM file is highlighted (Page 3/) */ // Force Video Mode [576i (PAL 50Hz), 480i (NTSC 60Hz), 480p (NTSC 60Hz), Auto] // Mute Audio Streaming [Yes/No] // Try to mute audio stutter [Yes/No] if(!page_num) { WriteFont(30, 65, "Global Settings (1/3):"); WriteFontStyled(30, 120, "IPL/Game Language:", 1.0f, false, defaultColor); DrawSelectableButton(400, 120, -1, 150, getSramLang(swissSettings.sramLanguage), option == 0 ? B_SELECTED:B_NOSELECT,-1); WriteFontStyled(30, 160, "IPL/Game Audio:", 1.0f, false, defaultColor); DrawSelectableButton(400, 160, -1, 190, swissSettings.sramStereo ? "Stereo":"Mono", option == 1 ? B_SELECTED:B_NOSELECT,-1); WriteFontStyled(30, 200, "SD/IDE Speed:", 1.0f, false, defaultColor); DrawSelectableButton(400, 200, -1, 230, swissSettings.exiSpeed ? "32 MHz":"16 MHz", option == 2 ? B_SELECTED:B_NOSELECT,-1); WriteFontStyled(30, 240, "Swiss Video Mode:", 1.0f, false, defaultColor); DrawSelectableButton(400, 240, -1, 270, uiVModeStr[swissSettings.uiVMode], option == 3 ? B_SELECTED:B_NOSELECT,-1); } else if(page_num == 1) { WriteFont(30, 65, "Advanced Settings (2/3):"); WriteFontStyled(30, 120, "Enable USB Gecko Debug via Slot B:", 1.0f, false, defaultColor); DrawSelectableButton(500, 120, -1, 150, swissSettings.debugUSB ? "Yes":"No", option == 0 ? B_SELECTED:B_NOSELECT,-1); WriteFontStyled(30, 160, "Force No DVD Drive Mode:", 1.0f, false, defaultColor); DrawSelectableButton(500, 160, -1, 190, swissSettings.hasDVDDrive ? "No":"Yes", option == 1 ? B_SELECTED:B_NOSELECT,-1); WriteFontStyled(30, 200, "Hide Unknown file types:", 1.0f, false, defaultColor); DrawSelectableButton(500, 200, -1, 230, swissSettings.hideUnknownFileTypes ? "Yes":"No", option == 2 ? B_SELECTED:B_NOSELECT,-1); WriteFontStyled(30, 240, "Stop DVD Motor on startup:", 1.0f, false, defaultColor); DrawSelectableButton(500, 240, -1, 270, swissSettings.stopMotor ? "Yes":"No", option == 3 ? B_SELECTED:B_NOSELECT,-1); WriteFontStyled(30, 280, "Enable WiiRD debugging in Games:", 1.0f, false, defaultColor); DrawSelectableButton(500, 280, -1, 310, swissSettings.wiirdDebug ? "Yes":"No", option == 4 ? B_SELECTED:B_NOSELECT,-1); WriteFontStyled(30, 320, "Enable File Management:", 1.0f, false, defaultColor); DrawSelectableButton(500, 320, -1, 350, swissSettings.enableFileManagement ? "Yes":"No", option == 5 ? B_SELECTED:B_NOSELECT,-1); } else if(page_num == 2) { WriteFont(30, 65, "Current Game Settings (3/3):"); WriteFontStyled(30, 110, "Force Video Mode:", 1.0f, false, file != NULL ? defaultColor : disabledColor); DrawSelectableButton(480, 110, -1, 135, gameVModeStr[swissSettings.gameVMode], option == 0 ? B_SELECTED:B_NOSELECT,-1); WriteFontStyled(30, 140, "If Progressive, Soften:", 1.0f, false, file != NULL ? defaultColor : disabledColor); DrawSelectableButton(480, 140, -1, 165, softProgressiveStr[swissSettings.softProgressive], option == 1 ? B_SELECTED:B_NOSELECT,-1); WriteFontStyled(30, 170, "Force Widescreen:", 1.0f, false, file != NULL ? defaultColor : disabledColor); DrawSelectableButton(480, 170, -1, 195, forceWidescreenStr[swissSettings.forceWidescreen], option == 2 ? B_SELECTED:B_NOSELECT,-1); WriteFontStyled(30, 200, "Force Anisotropy:", 1.0f, false, file != NULL ? defaultColor : disabledColor); DrawSelectableButton(480, 200, -1, 225, swissSettings.forceAnisotropy ? "Yes":"No", option == 3 ? B_SELECTED:B_NOSELECT,-1); WriteFontStyled(30, 230, "Disable Audio Streaming:", 1.0f, false, file != NULL ? defaultColor : disabledColor); DrawSelectableButton(480, 230, -1, 255, swissSettings.muteAudioStreaming ? "Yes":"No", option == 4 ? B_SELECTED:B_NOSELECT,-1); WriteFontStyled(30, 260, "Force Encoding:", 1.0f, false, file != NULL ? defaultColor : disabledColor); DrawSelectableButton(480, 260, -1, 285, forceEncodingStr[swissSettings.forceEncoding], option == 5 ? B_SELECTED:B_NOSELECT,-1); } if(page_num != 0) { DrawSelectableButton(40, 390, -1, 420, "Back", option == settings_count_pp[page_num]-(page_num != 2 ? 3:2) ? B_SELECTED:B_NOSELECT,-1); } if(page_num != 2) { DrawSelectableButton(510, 390, -1, 420, "Next", option == settings_count_pp[page_num]-2 ? B_SELECTED:B_NOSELECT,-1); } DrawSelectableButton(100, 425, -1, 455, "Save & Exit", option == settings_count_pp[page_num]-1 ? B_SELECTED:B_NOSELECT,-1); DrawSelectableButton(320, 425, -1, 455, "Discard & Exit", option == settings_count_pp[page_num] ? B_SELECTED:B_NOSELECT,-1); DrawFrameFinish(); }
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(); }