loader/screen.c
VOID SetupScreen(VOID)
{
    UINTN NewWidth, NewHeight;

    // Convert mode number to horizontal & vertical resolution values
    if ((GlobalConfig.RequestedScreenWidth > 0) && (GlobalConfig.RequestedScreenHeight == 0))
       egGetResFromMode(&(GlobalConfig.RequestedScreenWidth), &(GlobalConfig.RequestedScreenHeight));

    // Set the believed-to-be current resolution to the LOWER of the current
    // believed-to-be resolution and the requested resolution. This is done to
    // enable setting a lower-than-default resolution.
    if ((GlobalConfig.RequestedScreenWidth > 0) && (GlobalConfig.RequestedScreenHeight > 0)) {
       UGAWidth = (UGAWidth < GlobalConfig.RequestedScreenWidth) ? UGAWidth : GlobalConfig.RequestedScreenWidth;
       UGAHeight = (UGAHeight < GlobalConfig.RequestedScreenHeight) ? UGAHeight : GlobalConfig.RequestedScreenHeight;
    }

    // Set text mode. If this requires increasing the size of the graphics mode, do so.
    if (egSetTextMode(GlobalConfig.RequestedTextMode)) {
       egGetScreenSize(&NewWidth, &NewHeight);
       if ((NewWidth > UGAWidth) || (NewHeight > UGAHeight)) {
          UGAWidth = NewWidth;
          UGAHeight = NewHeight;
       }
       if ((UGAWidth > GlobalConfig.RequestedScreenWidth) || (UGAHeight > GlobalConfig.RequestedScreenHeight)) {
           // Requested text mode forces us to use a bigger graphics mode
           GlobalConfig.RequestedScreenWidth = UGAWidth;
           GlobalConfig.RequestedScreenHeight = UGAHeight;
       } // if
    }

    if (GlobalConfig.RequestedScreenWidth > 0) {
       egSetScreenSize(&(GlobalConfig.RequestedScreenWidth), &(GlobalConfig.RequestedScreenHeight));
       egGetScreenSize(&UGAWidth, &UGAHeight);
    } // if user requested a particular screen resolution

    if (GlobalConfig.TextOnly) {
        // switch to text mode if requested
        AllowGraphicsMode = FALSE;
        SwitchToText(FALSE);
    } else if (AllowGraphicsMode) {
        // clear screen and show banner
        // (now we know we'll stay in graphics mode)
        if ((UGAWidth >= HIDPI_MIN) && !HaveResized) {
            GlobalConfig.IconSizes[ICON_SIZE_BADGE] *= 2;
            GlobalConfig.IconSizes[ICON_SIZE_SMALL] *= 2;
            GlobalConfig.IconSizes[ICON_SIZE_BIG] *= 2;
            GlobalConfig.IconSizes[ICON_SIZE_MOUSE] *= 2;
            HaveResized = TRUE;
        } // if
        SwitchToGraphics();
        if (GlobalConfig.ScreensaverTime != -1) {
           BltClearScreen(TRUE);
        } else { // start with screen blanked
           GraphicsScreenDirty = TRUE;
        }
    }
}
// Set the screen resolution and mode (text vs. graphics).
Set the screen resolution and mode (text vs. graphics).
Set the screen resolution and mode ( text vs . graphics ) .
VOID SetupScreen(VOID)
{
    UINTN NewWidth, NewHeight;
    if ((GlobalConfig.RequestedScreenWidth > 0) && (GlobalConfig.RequestedScreenHeight == 0))
       egGetResFromMode(&(GlobalConfig.RequestedScreenWidth), &(GlobalConfig.RequestedScreenHeight));
    if ((GlobalConfig.RequestedScreenWidth > 0) && (GlobalConfig.RequestedScreenHeight > 0)) {
       UGAWidth = (UGAWidth < GlobalConfig.RequestedScreenWidth) ? UGAWidth : GlobalConfig.RequestedScreenWidth;
       UGAHeight = (UGAHeight < GlobalConfig.RequestedScreenHeight) ? UGAHeight : GlobalConfig.RequestedScreenHeight;
    }
    if (egSetTextMode(GlobalConfig.RequestedTextMode)) {
       egGetScreenSize(&NewWidth, &NewHeight);
       if ((NewWidth > UGAWidth) || (NewHeight > UGAHeight)) {
          UGAWidth = NewWidth;
          UGAHeight = NewHeight;
       }
       if ((UGAWidth > GlobalConfig.RequestedScreenWidth) || (UGAHeight > GlobalConfig.RequestedScreenHeight)) {
           GlobalConfig.RequestedScreenWidth = UGAWidth;
           GlobalConfig.RequestedScreenHeight = UGAHeight;
       } 
    }
    if (GlobalConfig.RequestedScreenWidth > 0) {
       egSetScreenSize(&(GlobalConfig.RequestedScreenWidth), &(GlobalConfig.RequestedScreenHeight));
       egGetScreenSize(&UGAWidth, &UGAHeight);
    }  user requested a particular screen resolution
    if (GlobalConfig.TextOnly) {
        AllowGraphicsMode = FALSE;
        SwitchToText(FALSE);
    } else if (AllowGraphicsMode) {
        if ((UGAWidth >= HIDPI_MIN) && !HaveResized) {
            GlobalConfig.IconSizes[ICON_SIZE_BADGE] *= 2;
            GlobalConfig.IconSizes[ICON_SIZE_SMALL] *= 2;
            GlobalConfig.IconSizes[ICON_SIZE_BIG] *= 2;
            GlobalConfig.IconSizes[ICON_SIZE_MOUSE] *= 2;
            HaveResized = TRUE;
        } 
        SwitchToGraphics();
        if (GlobalConfig.ScreensaverTime != -1) {
           BltClearScreen(TRUE);
        } else { 
           GraphicsScreenDirty = TRUE;
        }
    }
}
VOID SetupScreen ( VOID ) { UINTN NewWidth , NewHeight ; if ( ( GlobalConfig . RequestedScreenWidth > 0 ) && ( GlobalConfig . RequestedScreenHeight == 0 ) ) egGetResFromMode ( & ( GlobalConfig . RequestedScreenWidth ) , & ( GlobalConfig . RequestedScreenHeight ) ) ; if ( ( GlobalConfig . RequestedScreenWidth > 0 ) && ( GlobalConfig . RequestedScreenHeight > 0 ) ) { UGAWidth = ( UGAWidth < GlobalConfig . RequestedScreenWidth ) ? UGAWidth : GlobalConfig . RequestedScreenWidth ; UGAHeight = ( UGAHeight < GlobalConfig . RequestedScreenHeight ) ? UGAHeight : GlobalConfig . RequestedScreenHeight ; } if ( egSetTextMode ( GlobalConfig . RequestedTextMode ) ) { egGetScreenSize ( & NewWidth , & NewHeight ) ; if ( ( NewWidth > UGAWidth ) || ( NewHeight > UGAHeight ) ) { UGAWidth = NewWidth ; UGAHeight = NewHeight ; } if ( ( UGAWidth > GlobalConfig . RequestedScreenWidth ) || ( UGAHeight > GlobalConfig . RequestedScreenHeight ) ) { GlobalConfig . RequestedScreenWidth = UGAWidth ; GlobalConfig . RequestedScreenHeight = UGAHeight ; } } if ( GlobalConfig . RequestedScreenWidth > 0 ) { egSetScreenSize ( & ( GlobalConfig . RequestedScreenWidth ) , & ( GlobalConfig . RequestedScreenHeight ) ) ; egGetScreenSize ( & UGAWidth , & UGAHeight ) ; } if ( GlobalConfig . TextOnly ) { AllowGraphicsMode = FALSE ; SwitchToText ( FALSE ) ; } else if ( AllowGraphicsMode ) { if ( ( UGAWidth >= HIDPI_MIN ) && ! HaveResized ) { GlobalConfig . IconSizes [ ICON_SIZE_BADGE ] *= 2 ; GlobalConfig . IconSizes [ ICON_SIZE_SMALL ] *= 2 ; GlobalConfig . IconSizes [ ICON_SIZE_BIG ] *= 2 ; GlobalConfig . IconSizes [ ICON_SIZE_MOUSE ] *= 2 ; HaveResized = TRUE ; } SwitchToGraphics ( ) ; if ( GlobalConfig . ScreensaverTime != -1 ) { BltClearScreen ( TRUE ) ; } else { GraphicsScreenDirty = TRUE ; } } }
Set the screen resolution and mode (text vs. graphics).
Set the screen resolution and mode ( text vs . graphics ) .
// Convert mode number to horizontal & vertical resolution values // Set the believed-to-be current resolution to the LOWER of the current // believed-to-be resolution and the requested resolution. This is done to // enable setting a lower-than-default resolution. // Set text mode. If this requires increasing the size of the graphics mode, do so. // Requested text mode forces us to use a bigger graphics mode // if // if user requested a particular screen resolution // switch to text mode if requested // clear screen and show banner // (now we know we'll stay in graphics mode) // if // start with screen blanked