Ejemplo n.º 1
0
/****************************************************************************
REMARKS:
Main program entry point
****************************************************************************/
int main(
    int argc,
    char *argv[])
{
    /* Now handle the query */
    if (argc >= 2 && stricmp(argv[1],"show") == 0)
        ShowSettings(0);
    else if (argc >= 3) {
        LoadDriver(0);
        opt.LCDPanelWidth = atoi(argv[1]);
        opt.LCDPanelHeight = atoi(argv[2]);
        init.SetOptions(&opt);
        GA_saveOptions(dc,&opt);
        ShowSettings(0);
        }
    else
        help();
    if (dc)
        GA_unloadDriver(dc);
    return 0;
}
Ejemplo n.º 2
0
/****************************************************************************
REMARKS:
Main function to do the interactive tests.
****************************************************************************/
ibool CenterTVMode(
    GC_devCtx *gc,
    N_uint32 mode)
{
    GA_options  opt,defOpt;
    GA_TVParams *tv;
    int         ch;
    event_t     evt;

    /* Obtain the mode information and set the display mode */
    GC_leave(gc);
    dc = gc->dc;
    virtualX = virtualY = bytesPerLine = -1;
    modeInfo.dwSize = sizeof(modeInfo);
    if (init.GetVideoModeInfo(mode,&modeInfo) != 0)
        return false;
    if (init.SetVideoMode(mode,&virtualX,&virtualY,&bytesPerLine,&maxMem,0,NULL) != 0)
        return false;
    cntMode = mode;
    if (!InitSoftwareRasterizer(cntDevice,1,false))
        PM_fatalError("Unable to initialize reference rasteriser!");
    opt.dwSize = sizeof(opt);
    init.GetOptions(&opt);
    defOpt = opt;

    /* Find the appropriate TV parameters block depending on current mode */
    if (modeInfo.XResolution > 640) {
        switch (opt.outputDevice & gaOUTPUT_TVCOLORMASK) {
            case gaOUTPUT_TVPAL:
            case gaOUTPUT_TVPAL_M:
            case gaOUTPUT_TVPAL_60:
            case gaOUTPUT_TVPAL_CN:
            case gaOUTPUT_TVSCART_PAL:
                if (opt.outputDevice & gaOUTPUT_TVOVERSCAN)
                    tv = &opt.TV800PALOver;
                else
                    tv = &opt.TV800PALUnder;
                break;
            case gaOUTPUT_TVNTSC:
            case gaOUTPUT_TVNTSC_J:
            default:
                if (opt.outputDevice & gaOUTPUT_TVOVERSCAN)
                    tv = &opt.TV800NTSCOver;
                else
                    tv = &opt.TV800NTSCUnder;
                break;
            }
        }
    else {
        switch (opt.outputDevice & gaOUTPUT_TVCOLORMASK) {
            case gaOUTPUT_TVPAL:
            case gaOUTPUT_TVPAL_M:
            case gaOUTPUT_TVPAL_60:
            case gaOUTPUT_TVPAL_CN:
            case gaOUTPUT_TVSCART_PAL:
                if (opt.outputDevice & gaOUTPUT_TVOVERSCAN)
                    tv = &opt.TV640PALOver;
                else
                    tv = &opt.TV640PALUnder;
                break;
            case gaOUTPUT_TVNTSC:
            case gaOUTPUT_TVNTSC_J:
            default:
                if (opt.outputDevice & gaOUTPUT_TVOVERSCAN)
                    tv = &opt.TV640NTSCOver;
                else
                    tv = &opt.TV640NTSCUnder;
                break;
            }
        }

    /* Draw the background image */
    drawBackground();

    /* Now process key events */
    for (;;) {
        EVT_halt(&evt,EVT_KEYDOWN | EVT_KEYREPEAT);
        ch = EVT_scanCode(evt.message);
        if (ch == KB_esc || ch == KB_Q) {
            opt = defOpt;
            init.SetOptions(&opt);
            break;
            }
        if (ch == KB_enter) {
            /* Save the timing changes */
            GA_saveOptions(dc,&opt);
            break;
            }

        /* Now handle the key event */
        switch (ch) {
            case KB_R:          /* Reset to initial values */
                opt = defOpt;
                init.SetOptions(&opt);
                break;
            case KB_equals:
            case KB_padPlus:    /* Increase brightness */
                tv->brightness++;
                init.SetOptions(&opt);
                break;
            case KB_minus:
            case KB_padMinus:   /* Decrease brightness */
                tv->brightness--;
                init.SetOptions(&opt);
                break;
            case KB_up:         /* Move the image up */
                tv->vPos--;
                init.SetOptions(&opt);
                break;
            case KB_down:       /* Move the image down */
                tv->vPos++;
                init.SetOptions(&opt);
                break;
            case KB_left:       /* Move the image left */
                tv->hPos--;
                init.SetOptions(&opt);
                break;
            case KB_right:      /* Move the image right */
                tv->hPos++;
                init.SetOptions(&opt);
                break;
            }
        }

    /* Return to text mode, restore the state of the console and exit */
    ExitSoftwareRasterizer();
    GC_restore(gc);
    return true;
}