Exemplo n.º 1
0
exitcode_t CommandLine::HandleCommandDefault()
{
    exitcode_t result = EXITCODE_CONTINUE;

    if (_about)
    {
        PrintAbout();
        result = EXITCODE_OK;
    } else
    {
        if (_verbose)
        {
            _log_levels[DIAGNOSTIC_LEVEL_VERBOSE] = true;
            PrintLaunchInformation();
        }

        if (_version)
        {
            if (!_verbose)
            {
                PrintVersion();
            }
            result = EXITCODE_OK;
        }
    }

    if (_help)
    {
        CommandLine::PrintHelp(_all);
        result = EXITCODE_OK;
    }

    gOpenRCT2Headless = _headless;
    gOpenRCT2SilentBreakpad = _silentBreakpad || _headless;

    if (_userDataPath != nullptr)
    {
        String::Set(gCustomUserDataPath, sizeof(gCustomUserDataPath), _userDataPath);
        Memory::Free(_userDataPath);
    }

    if (_openrctDataPath != nullptr)
    {
        String::Set(gCustomOpenrctDataPath, sizeof(gCustomOpenrctDataPath), _openrctDataPath);
        Memory::Free(_openrctDataPath);
    }

    if (_rct2DataPath != nullptr)
    {
        String::Set(gCustomRCT2DataPath, sizeof(gCustomRCT2DataPath), _rct2DataPath);
        Memory::Free(_rct2DataPath);
    }

    if (_password != nullptr)
    {
        String::Set(gCustomPassword, sizeof(gCustomPassword), _password);
        Memory::Free(_password);
    }

    return result;
}
Exemplo n.º 2
0
EFI_STATUS
PrintSubMenu()
{
    UINTN i,x,y;
    BOOLEAN subwait;
    UINTN                 index;
    EFI_INPUT_KEY         Key;

    ClearArea(1, 2, 10, 5, EFI_BLACK|EFI_BACKGROUND_LIGHTGRAY);
    DrawBOX(1, 2, 5, 10, EFI_BLACK|EFI_BACKGROUND_LIGHTGRAY);

    x=2;
    y=3;
    for(i=0;i<2;i++)
    {
        ST->ConOut->SetCursorPosition(ST->ConOut, x, y+i);
        Print(subMenu[i]);
    }
    //highlight submenu
    i = 0;
    
    subwait = TRUE;
    while(subwait){

        ST->ConOut->SetCursorPosition(ST->ConOut, x, y);
        ST->ConOut->SetAttribute (ST->ConOut,EFI_WHITE|EFI_BACKGROUND_BLACK);
        Print(subMenu[i]);

        BS->WaitForEvent(1, &ST->ConIn->WaitForKey, &index);
        ST->ConIn->ReadKeyStroke(ST->ConIn, &Key);

        ST->ConOut->SetCursorPosition(ST->ConOut, x, y);
        ST->ConOut->SetAttribute (ST->ConOut,EFI_BLACK|EFI_BACKGROUND_LIGHTGRAY);
        Print(subMenu[i]);

        switch(Key.ScanCode)
        {
            case SCAN_ESC:
            subwait = FALSE;
            break;
            case SCAN_DOWN:
            case SCAN_PAGE_DOWN:
                y++;
                i++;
                if (y > 4)
                {    y = 4; i = 1;}
            break;
            case SCAN_UP:
            case SCAN_PAGE_UP:
                y--;
                i--;
                if (y < 3)
                {    y = 3; i = 0;}
            break;
            case SCAN_NULL:
            switch(Key.UnicodeChar) {
              case CHAR_CARRIAGE_RETURN:
                if (i == 1)
                {    ClearArea(1, 2, 10, 5, EFI_BLACK|EFI_BACKGROUND_BLUE);
                    PrintAbout();
                    subwait = FALSE;
                }
                break;
              //case CHAR_TAB:
              //  break;
              default:
                break;
            }
            break;
            default:
            break;
        }

    }

    ClearArea(1, 2, 10, 5, EFI_BLACK|EFI_BACKGROUND_BLUE);

    return EFI_SUCCESS;

}