void showHelp(void) { if (bootArgs->Video.v_display == GRAPHICS_MODE) { showInfoBox("Help. Press q to quit.\n", (char *)BootHelp_txt); } else { showTextBuffer((char *)BootHelp_txt, BootHelp_txt_len); } }
void showHelp(void) { #if 1 #define BOOT_HELP_PATH "/Extra/BootHelp.txt" #ifdef EMBED_THEME if( bootArgs->Video.v_display == GRAPHICS_MODE ) { showInfoBox( "Help. Press q to quit.\n" , (char *)BootHelp_txt ); return; } #endif showTextFile(BOOT_HELP_PATH); #else if (bootArgs->Video.v_display == GRAPHICS_MODE) { showInfoBox("Help. Press q to quit.\n", (char *)BootHelp_txt); } else { showTextBuffer((char *)BootHelp_txt, BootHelp_txt_len); } #endif }
MissionElevationDisplay::MissionElevationDisplay(QWidget *parent) : QWidget(parent), ui(new Ui::MissionElevationDisplay), m_uasInterface(NULL), m_uasWaypointMgr(NULL), m_totalDistance(0), m_elevationData(NULL), m_useHomeAltOffset(false), m_homeAltOffset(0.0), m_elevationShown(false) { ui->setupUi(this); ui->sampleSpinBox->setEnabled(false); QCustomPlot* customPlot = ui->customPlot; customPlot->addGraph(); // Mission Elevation Graph (ElevationGraphMissionId) customPlot->graph(ElevationGraphMissionId)->setPen(QPen(Qt::blue)); // line color blue for mission data customPlot->graph(ElevationGraphMissionId)->setBrush(QBrush(QColor(0, 0, 255, 20))); // first graph will be filled with translucent blue customPlot->addGraph(); // Google Elevation Graph (ElevationGraphElevationId) customPlot->graph(ElevationGraphElevationId)->setPen(QPen(Qt::red)); // line color red for elevation data customPlot->graph(ElevationGraphElevationId)->setBrush(QBrush(QColor(255, 0, 0, 20))); // first graph will be filled with translucent blue customPlot->graph(ElevationGraphElevationId)->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDiamond, 10)); customPlot->xAxis->setLabel("distance (m)"); customPlot->yAxis->setLabel("altitude (m)"); // set default ranges for Alt and distance customPlot->xAxis->setRange(0,ElevationDefaultDistanceMax); //m customPlot->yAxis->setRange(ElevationDefaultAltMin,ElevationDefaultAltMax); //m QFont legendFont = font(); legendFont.setPointSize(9); customPlot->legend->setFont(legendFont); // set a more compact font size for bottom and left axis tick labels: customPlot->xAxis->setTickLabelFont(QFont(QFont().family(), 9)); customPlot->xAxis->setLabelFont(QFont(QFont().family(), 9)); customPlot->yAxis->setTickLabelFont(QFont(QFont().family(), 9)); customPlot->yAxis->setLabelFont(QFont(QFont().family(), 9)); customPlot->replot(); connect(UASManager::instance(),SIGNAL(activeUASSet(UASInterface*)),this,SLOT(activeUASSet(UASInterface*))); activeUASSet(UASManager::instance()->getActiveUAS()); connect(ui->infoButton, SIGNAL(clicked()), this, SLOT(showInfoBox())); }
int getBootOptions(bool firstRun) { int i; int key; int nextRow; int timeout; int bvCount; BVRef bvr; BVRef menuBVR; bool showPrompt, newShowPrompt, isCDROM; // Initialize default menu selection entry. gBootVolume = menuBVR = selectBootVolume(bvChain); if (biosDevIsCDROM(gBIOSDev)) { isCDROM = true; } else { isCDROM = false; } // ensure we're in graphics mode if gui is setup if (gui.initialised && bootArgs->Video.v_display == VGA_TEXT_MODE) { setVideoMode(GRAPHICS_MODE, 0); } // Clear command line boot arguments clearBootArgs(); // Allow user to override default timeout. if (multiboot_timeout_set) { timeout = multiboot_timeout; } else if (!getIntForKey(kTimeoutKey, &timeout, &bootInfo->bootConfig)) { /* If there is no timeout key in the file use the default timeout which is different for CDs vs. hard disks. However, if not booting a CD and no config file could be loaded set the timeout to zero which causes the menu to display immediately. This way, if no partitions can be found, that is the disk is unpartitioned or simply cannot be read) then an empty menu is displayed. If some partitions are found, for example a Windows partition, then these will be displayed in the menu as foreign partitions. */ if (isCDROM) { timeout = kCDBootTimeout; } else { timeout = sysConfigValid ? kBootTimeout : 0; } } if (timeout < 0) { gBootMode |= kBootModeQuiet; } // If the user is holding down a modifier key, enter safe mode. if ((readKeyboardShiftFlags() & 0x0F) != 0) { gBootMode |= kBootModeSafe; } // 18seven's Quick-args macro bool f8 = false, altf = false, shiftf = false, alts = false, altv = false, altx = false; // x32 = false, x64 = false; while (readKeyboardStatus()) { key = bgetc (); if (key == 0x4200) f8 = true; if (key == 0x2100) altf = true; if (key == 0x0046) shiftf = true; if (key == 0x1F00) alts = true; if (key == 0x2F00) altv = true; if (key == 0x2D00) altx = true; /* if (key == 0x0004) x32 = true; if (key == 0x0007) x64 = true; */ } // If user typed F8, abort quiet mode, and display the menu. if (f8) { gBootMode &= ~kBootModeQuiet; timeout = 0; } // If user typed 'alt-v', boot in verbose mode. if ((gBootMode & kBootModeQuiet) && firstRun && altv) { addBootArg(kVerboseModeFlag); } // If user typed 'alt-s', boot in single user mode. if ((gBootMode & kBootModeQuiet) && firstRun && alts) { addBootArg(kSingleUserModeFlag); } if ((gBootMode & kBootModeQuiet) && firstRun && altf) { addBootArg(kIgnoreCachesFlag); } if ((gBootMode & kBootModeQuiet) && firstRun && shiftf) { addBootArg(kIgnoreBootFileFlag); } if ((gBootMode & kBootModeQuiet) && firstRun && altx) { addBootArg(kSafeModeFlag); } /* if ((gBootMode & kBootModeQuiet) && firstRun && x32) { addBootArg(k32BitModeFlag); } if ((gBootMode & kBootModeQuiet) && firstRun && x64) { addBootArg(k64BitModeFlag); } */ if (bootArgs->Video.v_display == VGA_TEXT_MODE) { setCursorPosition(0, 0, 0); clearScreenRows(0, kScreenLastRow); if (!(gBootMode & kBootModeQuiet)) { // Display banner and show hardware info. printf(bootBanner, (bootInfo->convmem + bootInfo->extmem) / 1024); printf(getVBEInfoString()); } changeCursor(0, kMenuTopRow, kCursorTypeUnderline, 0); verbose("Scanning device %x...", gBIOSDev); } // When booting from CD, default to hard drive boot when possible. if (isCDROM && firstRun) { const char *val; char *prompt = NULL; char *name = NULL; int cnt; int optionKey; if (getValueForKey(kCDROMPromptKey, &val, &cnt, &bootInfo->bootConfig)) { prompt = malloc(cnt + 1); strncat(prompt, val, cnt); } else { name = malloc(80); getBootVolumeDescription(gBootVolume, name, 79, false); prompt = malloc(256); sprintf(prompt, "Press any key to start up from %s, or press F8 to enter startup options.", name); free(name); } if (getIntForKey( kCDROMOptionKey, &optionKey, &bootInfo->bootConfig )) { // The key specified is a special key. } else { // Default to F8. optionKey = 0x4200; } // If the timeout is zero then it must have been set above due to the // early catch of F8 which means the user wants to set boot options // which we ought to interpret as meaning he wants to boot the CD. if (timeout != 0) { key = countdown(prompt, kMenuTopRow, timeout); } else { key = optionKey; } if (prompt != NULL) { free(prompt); } clearScreenRows( kMenuTopRow, kMenuTopRow + 2 ); // Hit the option key ? if (key == optionKey) { gBootMode &= ~kBootModeQuiet; timeout = 0; } else { key = key & 0xFF; // Try booting hard disk if user pressed 'h' if (biosDevIsCDROM(gBIOSDev) && key == 'h') { BVRef bvr; // Look at partitions hosting OS X other than the CD-ROM for (bvr = bvChain; bvr; bvr=bvr->next) { if ((bvr->flags & kBVFlagSystemVolume) && bvr->biosdev != gBIOSDev) { gBootVolume = bvr; } } } goto done; } } if (gBootMode & kBootModeQuiet) { // No input allowed from user. goto done; } if (firstRun && timeout > 0 && countdown("Press any key to enter startup options.", kMenuTopRow, timeout) == 0) { // If the user is holding down a modifier key, // enter safe mode. if ((readKeyboardShiftFlags() & 0x0F) != 0) { gBootMode |= kBootModeSafe; } goto done; } if (gDeviceCount) { // Allocate memory for an array of menu items. menuItems = malloc(sizeof(MenuItem) * gDeviceCount); if (menuItems == NULL) { goto done; } // Associate a menu item for each BVRef. for (bvr=bvChain, i=gDeviceCount-1, selectIndex=0; bvr; bvr=bvr->next) { if (bvr->visible) { getBootVolumeDescription(bvr, menuItems[i].name, sizeof(menuItems[i].name) - 1, true); menuItems[i].param = (void *) bvr; if (bvr == menuBVR) { selectIndex = i; } i--; } } } if (bootArgs->Video.v_display == GRAPHICS_MODE) { // redraw the background buffer gui.logo.draw = true; drawBackground(); gui.devicelist.draw = true; gui.redraw = true; if (!(gBootMode & kBootModeQuiet)) { bool showBootBanner = true; // Check if "Boot Banner"=N switch is present in config file. getBoolForKey(kBootBannerKey, &showBootBanner, &bootInfo->bootConfig); if (showBootBanner) { // Display banner and show hardware info. gprintf(&gui.screen, bootBanner + 1, (bootInfo->convmem + bootInfo->extmem) / 1024); } // redraw background memcpy(gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4); } } else { // Clear screen and hide the blinking cursor. clearScreenRows(kMenuTopRow, kMenuTopRow + 2); changeCursor(0, kMenuTopRow, kCursorTypeHidden, 0); } nextRow = kMenuTopRow; showPrompt = true; if (gDeviceCount) { if( bootArgs->Video.v_display == VGA_TEXT_MODE ) { printf("Use \30\31 keys to select the startup volume."); } showMenu( menuItems, gDeviceCount, selectIndex, kMenuTopRow + 2, kMenuMaxItems ); nextRow += min( gDeviceCount, kMenuMaxItems ) + 3; } // Show the boot prompt. showPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot); showBootPrompt( nextRow, showPrompt ); do { if (bootArgs->Video.v_display == GRAPHICS_MODE) { // redraw background memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 ); // reset cursor co-ords gui.debug.cursor = pos( gui.screen.width - 160 , 10 ); } key = getc(); updateMenu( key, (void **) &menuBVR ); newShowPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot); if (newShowPrompt != showPrompt) { showPrompt = newShowPrompt; showBootPrompt( nextRow, showPrompt ); } if (showPrompt) { updateBootArgs(key); } switch (key) { case kReturnKey: if (gui.menu.draw) { key=0; break; } if (*gBootArgs == '?') { char * argPtr = gBootArgs; // Skip the leading "?" character. argPtr++; getNextArg(&argPtr, booterCommand); getNextArg(&argPtr, booterParam); /* * TODO: this needs to be refactored. */ if (strcmp( booterCommand, "video" ) == 0) { if (bootArgs->Video.v_display == GRAPHICS_MODE) { showInfoBox(getVBEInfoString(), getVBEModeInfoString()); } else { printVBEModeInfo(); } } else if ( strcmp( booterCommand, "memory" ) == 0) { if (bootArgs->Video.v_display == GRAPHICS_MODE ) { showInfoBox("Memory Map", getMemoryInfoString()); } else { printMemoryInfo(); } } else if (strcmp(booterCommand, "lspci") == 0) { lspci(); } else if (strcmp(booterCommand, "more") == 0) { showTextFile(booterParam); } else if (strcmp(booterCommand, "rd") == 0) { processRAMDiskCommand(&argPtr, booterParam); } else if (strcmp(booterCommand, "norescan") == 0) { if (gEnableCDROMRescan) { gEnableCDROMRescan = false; break; } } else { showHelp(); } key = 0; showBootPrompt(nextRow, showPrompt); break; } gBootVolume = menuBVR; setRootVolume(menuBVR); gBIOSDev = menuBVR->biosdev; break; case kEscapeKey: clearBootArgs(); break; case kF2Key: /* * AutoResolution - Reapply the patch if Graphics Mode was incorrect or EDID Info was insane */ if ((gAutoResolution == TRUE) && map) { // get the new Graphics Mode key processBootOptions(); UInt32 params[4]; params[3] = 0; //Has the target Resolution Changed ? int count = getNumberArrayFromProperty(kGraphicsModeKey, params, 4); if ( count < 3 ) getResolution(params); if ((params[0] != 0) && (params[1] != 0) && (params[0] != map->currentX) && (params[1] != map->currentY)) { //Go back to TEXT mode while we change the mode if (bootArgs->Video.v_display == GRAPHICS_MODE) { CursorState cursorState; setVideoMode(VGA_TEXT_MODE, 0); setCursorPosition(0, 0, 0); clearScreenRows(0, kScreenLastRow); changeCursor( 0, 0, kCursorTypeHidden, &cursorState ); //Reapply patch in case resolution have changed patchVbios(map, params[0], params[1], params[2], 0, 0); if (useGUI && (gui.initialised == true)) initGUI(); // Make sure all values are set if (bootArgs->Video.v_display != GRAPHICS_MODE) bootArgs->Video.v_display = GRAPHICS_MODE; if (!useGUI) useGUI = true; // redraw the background buffer drawBackground(); gui.devicelist.draw = true; gui.redraw = true; if (!(gBootMode & kBootModeQuiet)) { bool showBootBanner = true; // Check config file. getBoolForKey(kBootBannerKey, &showBootBanner, &bootInfo->bootConfig); if (showBootBanner) // Display banner and show hardware info. gprintf(&gui.screen, bootBanner + 1, (bootInfo->convmem + bootInfo->extmem) / 1024); // redraw background memcpy(gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4); } nextRow = kMenuTopRow; showPrompt = true; if (gDeviceCount) { showMenu( menuItems, gDeviceCount, selectIndex, kMenuTopRow + 2, kMenuMaxItems ); nextRow += min( gDeviceCount, kMenuMaxItems ) + 3; } // Show the boot prompt. showPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot); showBootPrompt( nextRow, showPrompt ); //this is used to avoid resetting the incorrect mode while quiting the boot menu map->hasSwitched = true; } } clearBootArgs(); key = 0; } break; case kF5Key: // New behavior: // Clear gBootVolume to restart the loop // if the user enabled rescanning the optical drive. // Otherwise boot the default boot volume. if (gEnableCDROMRescan) { gBootVolume = NULL; clearBootArgs(); } break; case kF10Key: gScanSingleDrive = false; scanDisks(gBIOSDev, &bvCount); gBootVolume = NULL; clearBootArgs(); break; case kTabKey: // New behavior: // Switch between text & graphic interfaces // Only Permitted if started in graphics interface if (useGUI) { setVideoMode(VGA_TEXT_MODE, 0); setCursorPosition(0, 0, 0); clearScreenRows(0, kScreenLastRow); // Display banner and show hardware info. printf(bootBanner, (bootInfo->convmem + bootInfo->extmem) / 1024); printf(getVBEInfoString()); clearScreenRows(kMenuTopRow, kMenuTopRow + 2); changeCursor(0, kMenuTopRow, kCursorTypeHidden, 0); nextRow = kMenuTopRow; showPrompt = true; if (gDeviceCount) { printf("Use \30\31 keys to select the startup volume."); showMenu(menuItems, gDeviceCount, selectIndex, kMenuTopRow + 2, kMenuMaxItems); nextRow += min(gDeviceCount, kMenuMaxItems) + 3; } showPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot); showBootPrompt(nextRow, showPrompt); //changeCursor( 0, kMenuTopRow, kCursorTypeUnderline, 0 ); /* * AutoResolution - make sure all values are set */ bootArgs->Video.v_display = VGA_TEXT_MODE; useGUI = false; } else { gui.redraw = true; setVideoMode(GRAPHICS_MODE, 0); /* * AutoResolution - make sure all values are set */ bootArgs->Video.v_display = GRAPHICS_MODE; useGUI = true; updateVRAM(); } key = 0; break; default: key = 0; break; } } while (0 == key); done: if (bootArgs->Video.v_display == VGA_TEXT_MODE) { clearScreenRows(kMenuTopRow, kScreenLastRow); changeCursor(0, kMenuTopRow, kCursorTypeUnderline, 0); } shouldboot = false; gui.menu.draw = false; if (menuItems) { free(menuItems); menuItems = NULL; } return 0; }
static void showTextBuffer(char *buf, int size) { char *bp; int line; int line_offset; int c; if (bootArgs->Video.v_display == GRAPHICS_MODE) { showInfoBox( "Press q to quit\n",buf ); return; } bp = buf; while (size-- > 0) { if (*bp == '\n') { *bp = '\0'; } bp++; } *bp = '\1'; line_offset = 0; setActiveDisplayPage(1); while (1) { clearScreenRows(0, 24); setCursorPosition(0, 0, 1); bp = buf; for (line = 0; *bp != '\1' && line < line_offset; line++) { while (*bp != '\0') { bp++; } bp++; } for (line = 0; *bp != '\1' && line < 23; line++) { setCursorPosition(0, line, 1); printf("%s\n", bp); while (*bp != '\0') { bp++; } bp++; } setCursorPosition(0, 23, 1); if (*bp == '\1') { printf("[Type %sq or space to quit viewer]", (line_offset > 0) ? "p for previous page, " : ""); } else { printf("[Type %s%sq to quit viewer]", (line_offset > 0) ? "p for previous page, " : "", (*bp != '\1') ? "space for next page, " : ""); } c = getc(); if (c == 'q' || c == 'Q') { break; } if ((c == 'p' || c == 'P') && line_offset > 0) { line_offset -= 23; } if (c == ' ') { if (*bp == '\1') { break; } else { line_offset += 23; } } } setActiveDisplayPage(0); }
int getBootOptions(bool firstRun) { int i; int key; int nextRow; int timeout; int bvCount; BVRef bvr; BVRef menuBVR; bool showPrompt, newShowPrompt, isCDROM; // Initialize default menu selection entry. gBootVolume = menuBVR = selectBootVolume(bvChain); if (biosDevIsCDROM(gBIOSDev)) { isCDROM = true; } else { isCDROM = false; } // ensure we're in graphics mode if gui is setup if (firstRun && gui.initialised && bootArgs->Video.v_display == VGA_TEXT_MODE) { setVideoMode(GRAPHICS_MODE, 0); } // Clear command line boot arguments clearBootArgs(); // Allow user to override default timeout. if (multiboot_timeout_set) { timeout = multiboot_timeout; } else if (!getIntForKey(kTimeoutKey, &timeout, &bootInfo->chameleonConfig)) { /* If there is no timeout key in the file use the default timeout which is different for CDs vs. hard disks. However, if not booting a CD and no config file could be loaded set the timeout to zero which causes the menu to display immediately. This way, if no partitions can be found, that is the disk is unpartitioned or simply cannot be read) then an empty menu is displayed. If some partitions are found, for example a Windows partition, then these will be displayed in the menu as foreign partitions. */ if (isCDROM) { timeout = kCDBootTimeout; } else { timeout = sysConfigValid ? kBootTimeout : 0; } } if (timeout < 0) { gBootMode |= kBootModeQuiet; } // If the user is holding down a modifier key, enter safe mode. if ((readKeyboardShiftFlags() & 0x0F) != 0) { gBootMode |= kBootModeSafe; } // Checking user pressed keys bool f8press = false, spress = false, vpress = false; while (readKeyboardStatus()) { key = bgetc (); if (key == 0x4200) f8press = true; if ((key & 0xff) == 's' || (key & 0xff) == 'S') spress = true; if ((key & 0xff) == 'v' || (key & 0xff) == 'V') vpress = true; } // If user typed F8, abort quiet mode, and display the menu. if (f8press) { gBootMode &= ~kBootModeQuiet; timeout = 0; } // If user typed 'v' or 'V', boot in verbose mode. if ((gBootMode & kBootModeQuiet) && firstRun && vpress) { addBootArg(kVerboseModeFlag); } // If user typed 's' or 'S', boot in single user mode. if ((gBootMode & kBootModeQuiet) && firstRun && spress) { addBootArg(kSingleUserModeFlag); } if (bootArgs->Video.v_display == VGA_TEXT_MODE) { setCursorPosition(0, 0, 0); clearScreenRows(0, kScreenLastRow); if (!(gBootMode & kBootModeQuiet)) { // Display banner and show hardware info. printf(bootBanner, (bootInfo->convmem + bootInfo->extmem) / 1024); printf(getVBEInfoString()); } changeCursor(0, kMenuTopRow, kCursorTypeUnderline, 0); verbose("Scanning device %x...", gBIOSDev); } // When booting from CD, default to hard drive boot when possible. if (isCDROM && firstRun) { const char *val; char *prompt = NULL; char *name = NULL; int cnt; int optionKey; if (getValueForKey(kCDROMPromptKey, &val, &cnt, &bootInfo->chameleonConfig)) { prompt = malloc(cnt + 1); strncat(prompt, val, cnt); } else { name = malloc(80); getBootVolumeDescription(gBootVolume, name, 79, false); prompt = malloc(256); sprintf(prompt, "Press any key to start up from %s, or press F8 to enter startup options.", name); free(name); } if (getIntForKey( kCDROMOptionKey, &optionKey, &bootInfo->chameleonConfig )) { // The key specified is a special key. } else { // Default to F8. optionKey = 0x4200; } // If the timeout is zero then it must have been set above due to the // early catch of F8 which means the user wants to set boot options // which we ought to interpret as meaning he wants to boot the CD. if (timeout != 0) { key = countdown(prompt, kMenuTopRow, timeout); } else { key = optionKey; } if (prompt != NULL) { free(prompt); } clearScreenRows( kMenuTopRow, kMenuTopRow + 2 ); // Hit the option key ? if (key == optionKey) { gBootMode &= ~kBootModeQuiet; timeout = 0; } else { key = key & 0xFF; // Try booting hard disk if user pressed 'h' if (biosDevIsCDROM(gBIOSDev) && key == 'h') { BVRef bvr; // Look at partitions hosting OS X other than the CD-ROM for (bvr = bvChain; bvr; bvr=bvr->next) { if ((bvr->flags & kBVFlagSystemVolume) && bvr->biosdev != gBIOSDev) { gBootVolume = bvr; } } } goto done; } } if (gBootMode & kBootModeQuiet) { // No input allowed from user. goto done; } if (firstRun && timeout > 0 && countdown("Press any key to enter startup options.", kMenuTopRow, timeout) == 0) { // If the user is holding down a modifier key, // enter safe mode. if ((readKeyboardShiftFlags() & 0x0F) != 0) { gBootMode |= kBootModeSafe; } goto done; } if (gDeviceCount > 0) { // Allocate memory for an array of menu items. menuItems = malloc(sizeof(MenuItem) * gDeviceCount); if (menuItems == NULL) { goto done; } // Associate a menu item for each BVRef. for (bvr=bvChain, i=gDeviceCount-1, selectIndex=-1; bvr; bvr=bvr->next) { if (bvr->visible) { getBootVolumeDescription(bvr, menuItems[i].name, sizeof(menuItems[i].name) - 1, true); menuItems[i].param = (void *) bvr; if (bvr == menuBVR) { selectIndex = i; } i--; } } // Jief : In case the default partition (returned by selectBootVolume) is not in the menu if ( selectIndex == -1 ) { selectIndex = 0; // gDeviceCount is actually > 0, so menuItems[selectIndex] exists menuBVR = (BVRef)(menuItems[selectIndex].param); // what happen is bvChain is empty ? } } if (bootArgs->Video.v_display != VGA_TEXT_MODE) { // redraw the background buffer gui.logo.draw = true; drawBackground(); gui.devicelist.draw = true; gui.redraw = true; if (!(gBootMode & kBootModeQuiet)) { // Check if "Boot Banner"=N switch is present in config file. getBoolForKey(kBootBannerKey, &showBootBanner, &bootInfo->chameleonConfig); if (showBootBanner) { // Display banner and show hardware info. gprintf(&gui.screen, bootBanner + 1, (bootInfo->convmem + bootInfo->extmem) / 1024); } // redraw background memcpy(gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4); } } else { // Clear screen and hide the blinking cursor. clearScreenRows(kMenuTopRow, kMenuTopRow + 2); changeCursor(0, kMenuTopRow, kCursorTypeHidden, 0); } nextRow = kMenuTopRow; showPrompt = true; if (gDeviceCount) { if( bootArgs->Video.v_display == VGA_TEXT_MODE ) { printf("Use \30\31 keys to select the startup volume."); } showMenu( menuItems, gDeviceCount, selectIndex, kMenuTopRow + 2, kMenuMaxItems ); nextRow += MIN( gDeviceCount, kMenuMaxItems ) + 3; } // Show the boot prompt. showPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot); showBootPrompt( nextRow, showPrompt ); do { if (bootArgs->Video.v_display != VGA_TEXT_MODE) { // redraw background memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 ); // reset cursor co-ords gui.debug.cursor = pos( gui.screen.width - 160 , 10 ); } key = getchar(); updateMenu( key, (void **) &menuBVR ); newShowPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot); if (newShowPrompt != showPrompt) { showPrompt = newShowPrompt; showBootPrompt( nextRow, showPrompt ); } if (showPrompt) { updateBootArgs(key); } switch (key) { case KEY_ENTER: if (gui.menu.draw) { key=0; break; } if (*gBootArgs == '?') { char * argPtr = gBootArgs; // Skip the leading "?" character. argPtr++; getNextArg(&argPtr, booterCommand); getNextArg(&argPtr, booterParam); /* * TODO: this needs to be refactored. */ if (strcmp( booterCommand, "video" ) == 0) { if (bootArgs->Video.v_display != VGA_TEXT_MODE) { showInfoBox(getVBEInfoString(), getVBEModeInfoString()); } else { printVBEModeInfo(); } } else if ( strcmp( booterCommand, "memory" ) == 0) { if (bootArgs->Video.v_display != VGA_TEXT_MODE ) { showInfoBox("Memory Map", getMemoryInfoString()); } else { printMemoryInfo(); } } else if (strcmp(booterCommand, "lspci") == 0) { lspci(); } else if (strcmp(booterCommand, "log") == 0) { showTextBuffer(msgbuf, strlen(msgbuf)); } else if (strcmp(booterCommand, "more") == 0) { showTextFile(booterParam); } else if (strcmp(booterCommand, "rd") == 0) { processRAMDiskCommand(&argPtr, booterParam); } else if (strcmp(booterCommand, "norescan") == 0) { if (gEnableCDROMRescan) { gEnableCDROMRescan = false; break; } } else { showHelp(); } key = 0; showBootPrompt(nextRow, showPrompt); break; } gBootVolume = menuBVR; setRootVolume(menuBVR); gBIOSDev = menuBVR->biosdev; break; case KEY_ESC: clearBootArgs(); break; case KEY_F5: // New behavior: // Clear gBootVolume to restart the loop // if the user enabled rescanning the optical drive. // Otherwise boot the default boot volume. if (gEnableCDROMRescan) { gBootVolume = NULL; clearBootArgs(); } break; case KEY_F10: gScanSingleDrive = false; scanDisks(gBIOSDev, &bvCount); gBootVolume = NULL; clearBootArgs(); break; case KEY_TAB: // New behavior: // Switch between text & graphic interfaces // Only Permitted if started in graphics interface if (useGUI) { if (bootArgs->Video.v_display != VGA_TEXT_MODE) { setVideoMode(VGA_TEXT_MODE, 0); setCursorPosition(0, 0, 0); clearScreenRows(0, kScreenLastRow); // Display banner and show hardware info. printf(bootBanner, (bootInfo->convmem + bootInfo->extmem) / 1024); printf(getVBEInfoString()); clearScreenRows(kMenuTopRow, kMenuTopRow + 2); changeCursor(0, kMenuTopRow, kCursorTypeHidden, 0); nextRow = kMenuTopRow; showPrompt = true; if (gDeviceCount) { printf("Use \30\31 keys to select the startup volume."); showMenu(menuItems, gDeviceCount, selectIndex, kMenuTopRow + 2, kMenuMaxItems); nextRow += MIN(gDeviceCount, kMenuMaxItems) + 3; } showPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot); showBootPrompt(nextRow, showPrompt); //changeCursor( 0, kMenuTopRow, kCursorTypeUnderline, 0 ); } else { gui.redraw = true; setVideoMode(GRAPHICS_MODE, 0); updateVRAM(); updateGraphicBootPrompt(); } } key = 0; break; default: key = 0; break; } } while (0 == key); done: if (bootArgs->Video.v_display == VGA_TEXT_MODE) { clearScreenRows(kMenuTopRow, kScreenLastRow); changeCursor(0, kMenuTopRow, kCursorTypeUnderline, 0); } shouldboot = false; gui.menu.draw = false; if (menuItems) { free(menuItems); menuItems = NULL; } execute_hook("BootOptions", gBootArgs, gBootArgsPtr, NULL, NULL); return 0; }
void showTextBuffer(char *buf_orig, int size) { char *bp; char* buf; int line; int line_offset; int c; if (bootArgs->Video.v_display != VGA_TEXT_MODE) { showInfoBox( "Press q to continue, space for next page.\n",buf_orig ); return; } // Create a copy so that we don't mangle the original buf = malloc(size + 1); memcpy(buf, buf_orig, size); bp = buf; while (size-- > 0) { if (*bp == '\n') { *bp = '\0'; } bp++; } *bp = '\1'; line_offset = 0; setActiveDisplayPage(1); while (1) { clearScreenRows(0, 24); setCursorPosition(0, 0, 1); bp = buf; for (line = 0; *bp != '\1' && line < line_offset; line++) { while (*bp != '\0') { bp++; } bp++; } for (line = 0; *bp != '\1' && line < 23; line++) { setCursorPosition(0, line, 1); printf("%s\n", bp); while (*bp != '\0') { bp++; } bp++; } setCursorPosition(0, 23, 1); if (*bp == '\1') { printf("[Type %sq or space to quit viewer]", (line_offset > 0) ? "p for previous page, " : ""); } else { printf("[Type %s%sq to quit viewer]", (line_offset > 0) ? "p for previous page, " : "", (*bp != '\1') ? "space for next page, " : ""); } c = getchar(); if (c == 'q' || c == 'Q') { break; } if ((c == 'p' || c == 'P') && line_offset > 0) { line_offset -= 23; } if (c == ' ') { if (*bp == '\1') { break; } else { line_offset += 23; } } } setActiveDisplayPage(0); }
void CLCD::setMode(const MODES m, const char * const title) { mode = m; menutitle = title; setlcdparameter(); switch (m) { case MODE_TVRADIO: case MODE_MOVIE: switch (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME]) { case STATUSLINE_PLAYTIME: display.load_screen(&(background[BACKGROUND_LCD2])); showPercentOver(percentOver, false, mode); break; case STATUSLINE_VOLUME: display.load_screen(&(background[BACKGROUND_LCD])); showVolume(volume, false); break; case STATUSLINE_BOTH: display.load_screen(&(background[BACKGROUND_LCD3])); showVolume(volume, false); showPercentOver(percentOver, false, mode); break; case STATUSLINE_BOTH_AUDIO: display.load_screen(&(background[BACKGROUND_LCD4])); showVolume(volume, false); showPercentOver(percentOver, false, mode); break; default: break; } if (mode == MODE_TVRADIO) showServicename(servicename); else { setMoviePlaymode(movie_playmode); setMovieInfo(movie_big, movie_small); setMovieAudio(movie_is_ac3); } showclock = true; showTime(); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ break; case MODE_AUDIO: { display.load_screen(&(background[BACKGROUND_LCD])); display.draw_fill_rect(0, 14, LCD_COLS, 48, CLCDDisplay::PIXEL_OFF); showAudioPlayMode(PLAYMODE_STOP); showVolume(volume, false); showclock = true; showTime(); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ break; } case MODE_SCART: display.load_screen(&(background[BACKGROUND_LCD])); showVolume(volume, false); showclock = true; showTime(); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ break; case MODE_MENU_UTF8: showclock = false; display.load_screen(&(background[BACKGROUND_SETUP])); fonts.menutitle->RenderString(0, 28, LCD_COLS + 20, title, CLCDDisplay::PIXEL_ON, 0, true); // UTF-8 displayUpdate(); break; case MODE_SHUTDOWN: showclock = false; display.load_screen(&(background[BACKGROUND_POWER])); displayUpdate(); break; case MODE_STANDBY: showclock = true; showTime(); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ /* "showTime()" clears the whole lcd in MODE_STANDBY */ break; #ifdef LCD_UPDATE case MODE_FILEBROWSER: showclock = true; display.draw_fill_rect(-1, -1, LCD_COLS, 64, CLCDDisplay::PIXEL_OFF); // clear lcd showFilelist(); break; case MODE_PROGRESSBAR: showclock = false; display.load_screen(&(background[BACKGROUND_SETUP])); showProgressBar(); break; case MODE_PROGRESSBAR2: showclock = false; display.load_screen(&(background[BACKGROUND_SETUP])); showProgressBar2(); break; case MODE_INFOBOX: showclock = false; showInfoBox(); break; #endif // LCD_UPDATE } wake_up(); }
void CVFD::setMode(const MODES m, const char * const title) { if(!has_lcd) return; if(mode == MODE_AUDIO) ShowIcon(VFD_ICON_MP3, false); #if 0 else if(mode == MODE_STANDBY) { ShowIcon(VFD_ICON_COL1, false); ShowIcon(VFD_ICON_COL2, false); } #endif if(strlen(title)) ShowText((char *) title); mode = m; setlcdparameter(); switch (m) { case MODE_TVRADIO: switch (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME]) { case 0: showPercentOver(percentOver, false); break; case 1: showVolume(volume, false); break; #if 0 case 2: showVolume(volume, false); showPercentOver(percentOver, false); break; #endif } showServicename(servicename); showclock = true; //showTime(); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ break; case MODE_AUDIO: { ShowIcon(VFD_ICON_MP3, true); showAudioPlayMode(AUDIO_MODE_STOP); showVolume(volume, false); showclock = true; //showTime(); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ break; } case MODE_SCART: showVolume(volume, false); showclock = true; //showTime(); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ break; case MODE_MENU_UTF8: showclock = false; //fonts.menutitle->RenderString(0,28, 140, title, CLCDDisplay::PIXEL_ON, 0, true); // UTF-8 break; case MODE_SHUTDOWN: showclock = false; break; case MODE_STANDBY: #if 0 ShowIcon(VFD_ICON_COL1, true); ShowIcon(VFD_ICON_COL2, true); #endif showclock = true; showTime(true); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ /* "showTime()" clears the whole lcd in MODE_STANDBY */ break; #ifdef VFD_UPDATE case MODE_FILEBROWSER: showclock = true; display.draw_fill_rect(-1, -1, 120, 64, CLCDDisplay::PIXEL_OFF); // clear lcd showFilelist(); break; case MODE_PROGRESSBAR: showclock = false; display.load_screen(&(background[BACKGROUND_SETUP])); showProgressBar(); break; case MODE_PROGRESSBAR2: showclock = false; display.load_screen(&(background[BACKGROUND_SETUP])); showProgressBar2(); break; case MODE_INFOBOX: showclock = false; showInfoBox(); break; #endif // VFD_UPDATE } wake_up(); }
void CVFD::setMode(const MODES m, const char * const title) { if(fd < 0) return; // Clear colon in display if it is still there #ifdef BOXMODEL_APOLLO if (support_numbers && has_led_segment) ioctl(fd, IOC_FP_SET_COLON, 0x00); #endif if(mode == MODE_AUDIO) ShowIcon(FP_ICON_MP3, false); #if 0 else if(mode == MODE_STANDBY) { ShowIcon(FP_ICON_COL1, false); ShowIcon(FP_ICON_COL2, false); } #endif if(strlen(title)) ShowText(title); mode = m; setlcdparameter(); switch (m) { case MODE_TVRADIO: switch (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME]) { case 0: showPercentOver(percentOver, false); break; case 1: showVolume(volume, false); break; #if 0 case 2: showVolume(volume, false); showPercentOver(percentOver, false); break; #endif } showServicename(servicename); showclock = true; if(g_settings.lcd_info_line) switch_name_time_cnt = g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR] + 10; break; case MODE_AUDIO: { ShowIcon(FP_ICON_MP3, true); showAudioPlayMode(AUDIO_MODE_STOP); showVolume(volume, false); showclock = true; //showTime(); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ break; } case MODE_SCART: showVolume(volume, false); showclock = true; //showTime(); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ break; case MODE_MENU_UTF8: showclock = false; //fonts.menutitle->RenderString(0,28, 140, title, CLCDDisplay::PIXEL_ON); break; case MODE_SHUTDOWN: showclock = false; Clear(); break; case MODE_STANDBY: #if 0 ShowIcon(FP_ICON_COL1, true); ShowIcon(FP_ICON_COL2, true); #endif ClearIcons(); ShowIcon(FP_ICON_USB, false); ShowIcon(FP_ICON_HDD, false); showclock = true; showTime(true); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ /* "showTime()" clears the whole lcd in MODE_STANDBY */ break; #ifdef VFD_UPDATE case MODE_FILEBROWSER: showclock = true; display.draw_fill_rect(-1, -1, 120, 64, CLCDDisplay::PIXEL_OFF); // clear lcd showFilelist(); break; case MODE_PROGRESSBAR: showclock = false; display.load_screen(&(background[BACKGROUND_SETUP])); showProgressBar(); break; case MODE_PROGRESSBAR2: showclock = false; display.load_screen(&(background[BACKGROUND_SETUP])); showProgressBar2(); break; case MODE_INFOBOX: showclock = false; showInfoBox(); break; #endif // VFD_UPDATE } wake_up(); #if !HAVE_DUCKBOX_HARDWARE setled(); #endif }