Annotation of hatari/src/gui-sdl/dlgScreen.c, revision 1.1.1.15

1.1       root        1: /*
                      2:   Hatari - dlgScreen.c
                      3: 
1.1.1.13  root        4:   This file is distributed under the GNU General Public License, version 2
                      5:   or at your option any later version. Read the file gpl.txt for details.
1.1.1.9   root        6: 
                      7:  Atari monitor and Hatari window settings.
1.1       root        8: */
1.1.1.8   root        9: const char DlgScreen_fileid[] = "Hatari dlgScreen.c : " __DATE__ " " __TIME__;
1.1       root       10: 
                     11: #include "main.h"
                     12: #include "configuration.h"
                     13: #include "dialog.h"
                     14: #include "sdlgui.h"
1.1.1.15! root       15: #include "options.h"
1.1       root       16: #include "screen.h"
                     17: #include "screenSnapShot.h"
1.1.1.10  root       18: #include "resolution.h"
1.1.1.2   root       19: #include "vdi.h"
1.1.1.6   root       20: #include "video.h"
1.1.1.9   root       21: #include "avi_record.h"
                     22: #include "statusbar.h"
1.1.1.10  root       23: #include "clocks_timings.h"
1.1.1.5   root       24: 
1.1.1.9   root       25: 
                     26: /* The Monitor dialog: */
                     27: #define DLGSCRN_MONO         3
                     28: #define DLGSCRN_RGB          4
                     29: #define DLGSCRN_VGA          5
                     30: #define DLGSCRN_TV           6
                     31: #define DLGSCRN_OVERSCAN     7
                     32: #define DLGSCRN_USEVDIRES    9
                     33: #define DLGSCRN_VDI_WLESS    11
                     34: #define DLGSCRN_VDI_WTEXT    12
                     35: #define DLGSCRN_VDI_WMORE    13
                     36: #define DLGSCRN_VDI_HLESS    15
                     37: #define DLGSCRN_VDI_HTEXT    16
                     38: #define DLGSCRN_VDI_HMORE    17
                     39: #define DLGSCRN_BPP1         18
                     40: #define DLGSCRN_BPP2         19
                     41: #define DLGSCRN_BPP4         20
                     42: #define DLGSCRN_EXIT_MONITOR 21
1.1.1.5   root       43: 
                     44: /* Strings for VDI resolution width and height */
                     45: static char sVdiWidth[5];
                     46: static char sVdiHeight[5];
1.1       root       47: 
1.1.1.9   root       48: static SGOBJ monitordlg[] =
1.1       root       49: {
1.1.1.10  root       50:        { SGBOX, 0, 0, 0,0, 34,18, NULL },
1.1.1.9   root       51: 
1.1.1.10  root       52:        { SGBOX,      0, 0,  1,1, 32,6, NULL },
                     53:        { SGTEXT,     0, 0, 10,1, 14,1, "Atari monitor" },
1.1.1.15! root       54:        { SGRADIOBUT, 0, 0,  4,3,  6,1, "_Mono" },
        !            55:        { SGRADIOBUT, 0, 0, 12,3,  5,1, "_RGB" },
        !            56:        { SGRADIOBUT, 0, 0, 19,3,  5,1, "_VGA" },
        !            57:        { SGRADIOBUT, 0, 0, 26,3,  4,1, "_TV" },
        !            58:        { SGCHECKBOX, 0, 0, 12,5, 14,1, "Show _borders" },
1.1.1.10  root       59: 
                     60:        { SGBOX,      0, 0,  1,8, 32,7, NULL },
1.1.1.15! root       61:        { SGCHECKBOX, 0, 0,  4,9, 25,1, "Use _extended VDI screen" },
1.1.1.10  root       62:        { SGTEXT,     0, 0,  4,11, 5,1, "Size:" },
1.1.1.15! root       63:        { SGBUTTON,   0, 0,  6,12, 1,1, "\x04", SG_SHORTCUT_LEFT },
1.1.1.10  root       64:        { SGTEXT,     0, 0,  8,12, 4,1, sVdiWidth },
1.1.1.15! root       65:        { SGBUTTON,   0, 0, 13,12, 1,1, "\x03", SG_SHORTCUT_RIGHT },
1.1.1.10  root       66:        { SGTEXT,     0, 0,  4,13, 1,1, "x" },
1.1.1.15! root       67:        { SGBUTTON,   0, 0,  6,13, 1,1, "\x04", SG_SHORTCUT_UP },
1.1.1.10  root       68:        { SGTEXT,     0, 0,  8,13, 4,1, sVdiHeight },
1.1.1.15! root       69:        { SGBUTTON,   0, 0, 13,13, 1,1, "\x03", SG_SHORTCUT_DOWN },
1.1.1.9   root       70: 
1.1.1.15! root       71:        { SGRADIOBUT, SG_EXIT, 0, 18,11, 11,1, " _2 colors" },
        !            72:        { SGRADIOBUT, SG_EXIT, 0, 18,12, 11,1, " _4 colors" },
        !            73:        { SGRADIOBUT, SG_EXIT, 0, 18,13, 11,1, "1_6 colors" },
1.1.1.9   root       74: 
1.1.1.10  root       75:        { SGBUTTON, SG_DEFAULT, 0, 7,16, 20,1, "Back to main menu" },
1.1.1.9   root       76:        { -1, 0, 0, 0,0, 0,0, NULL }
                     77: };
                     78: 
                     79: 
                     80: /* The window dialog: */
                     81: #define DLGSCRN_FULLSCRN    3
1.1.1.10  root       82: #define DLGSCRN_STATUSBAR   5
1.1.1.15! root       83: #define DLGSCRN_DRIVELED    6
1.1.1.10  root       84: #define DLGSCRN_NONE        7
                     85: #define DLGSCRN_SKIP0       9
                     86: #define DLGSCRN_SKIP1       10
                     87: #define DLGSCRN_SKIP2       11
                     88: #define DLGSCRN_SKIP3       12
                     89: #define DLGSCRN_SKIP4       13
1.1.1.14  root       90: #define DLGSCRN_KEEP_RES_ST 16
                     91: #define DLGSCRN_KEEP_RES    17
                     92: #define DLGSCRN_MAX_WLESS   19
                     93: #define DLGSCRN_MAX_WTEXT   20
                     94: #define DLGSCRN_MAX_WMORE   21
                     95: #define DLGSCRN_MAX_HLESS   23
                     96: #define DLGSCRN_MAX_HTEXT   24
                     97: #define DLGSCRN_MAX_HMORE   25
                     98: #define DLGSCRN_CROP        28
                     99: #define DLGSCRN_CAPTURE     29
                    100: #define DLGSCRN_RECANIM     30
1.1.1.15! root      101: #if WITH_SDL2
        !           102: #define DLGSCRN_LINEARSCALE 33
        !           103: #define DLGSCRN_VSYNC       34
        !           104: #define DLGSCRN_EXIT_WINDOW 35
        !           105: #else
1.1.1.14  root      106: #define DLGSCRN_EXIT_WINDOW 31
1.1.1.15! root      107: #endif
1.1.1.9   root      108: 
                    109: /* needs to match Frame skip values in windowdlg[]! */
                    110: static const int skip_frames[] = { 0, 1, 2, 4, AUTO_FRAMESKIP_LIMIT };
                    111: 
                    112: /* Strings for doubled resolution max width and height */
                    113: static char sMaxWidth[5];
                    114: static char sMaxHeight[5];
                    115: 
                    116: #define MAX_SIZE_STEP 8
1.1.1.2   root      117: 
1.1.1.9   root      118: /* The window dialog: */
                    119: static SGOBJ windowdlg[] =
                    120: {
1.1.1.15! root      121: #if WITH_SDL2
        !           122:        { SGBOX, 0, 0, 0,0, 52,25, NULL },
        !           123: #else
1.1.1.10  root      124:        { SGBOX, 0, 0, 0,0, 52,20, NULL },
1.1.1.15! root      125: #endif
1.1.1.10  root      126:        { SGBOX,      0, 0,  1,1, 50,10, NULL },
                    127:        { SGTEXT,     0, 0,  4,2, 20,1, "Hatari screen options" },
1.1.1.15! root      128:        { SGCHECKBOX, 0, 0,  4,4, 12,1, "_Fullscreen" },
1.1.1.10  root      129:        { SGTEXT,     0, 0,  4,6, 12,1, "Indicators:" },
1.1.1.15! root      130:        { SGRADIOBUT, 0, 0,  6,7, 11,1, "Status_bar" },
        !           131:        { SGRADIOBUT, 0, 0,  6,8, 11,1, "Drive _led" },
        !           132:        { SGRADIOBUT, 0, 0,  6,9,  6,1, "_None" },
1.1.1.10  root      133:        { SGTEXT,     0, 0, 19,4, 12,1, "Frame skip:" },
1.1.1.15! root      134:        { SGRADIOBUT, 0, 0, 21,5,  5,1, "_Off" },
        !           135:        { SGRADIOBUT, 0, 0, 21,6,  3,1, "_1" },
        !           136:        { SGRADIOBUT, 0, 0, 21,7,  3,1, "_2" },
        !           137:        { SGRADIOBUT, 0, 0, 21,8,  3,1, "_4" },
        !           138:        { SGRADIOBUT, 0, 0, 21,9,  6,1, "_Auto" },
1.1.1.14  root      139:        { SGTEXT,     0, 0, 33,2, 14,1, "Keep desktop" },
                    140:        { SGTEXT,     0, 0, 33,3, 14,1, "resolution:" },
1.1.1.15! root      141:        { SGCHECKBOX, 0, 0, 35,4,  8,1, "ST/ST_e" },
        !           142:        { SGCHECKBOX, 0, 0, 35,5, 11,1, "_TT/Falcon" },
1.1.1.10  root      143:        { SGTEXT,     0, 0, 33,7, 15,1, "Max zoomed win:" },
1.1.1.15! root      144:        { SGBUTTON,   0, 0, 35,8,  1,1, "\x04", SG_SHORTCUT_LEFT },
1.1.1.10  root      145:        { SGTEXT,     0, 0, 37,8,  4,1, sMaxWidth },
1.1.1.15! root      146:        { SGBUTTON,   0, 0, 43,8,  1,1, "\x03", SG_SHORTCUT_RIGHT },
1.1.1.10  root      147:        { SGTEXT,     0, 0, 33,9,  1,1, "x" },
1.1.1.15! root      148:        { SGBUTTON,   0, 0, 35,9,  1,1, "\x04", SG_SHORTCUT_UP },
1.1.1.10  root      149:        { SGTEXT,     0, 0, 37,9,  4,1, sMaxHeight },
1.1.1.15! root      150:        { SGBUTTON,   0, 0, 43,9,  1,1, "\x03", SG_SHORTCUT_DOWN },
1.1.1.10  root      151: 
                    152:        { SGBOX,      0, 0,  1,12, 50,5, NULL },
                    153:        { SGTEXT,     0, 0,  7,13, 16,1, "Screen capture" },
1.1.1.15! root      154:        { SGCHECKBOX, 0, 0,  8,15, 16,1, "_Crop statusbar" },
        !           155:        { SGBUTTON,   0, 0, 29,13, 14,1, " _Screenshot " },
        !           156:        { SGBUTTON,   0, 0, 29,15, 14,1, NULL },      /* Record text set later */
        !           157: 
        !           158: #if WITH_SDL2
        !           159:        { SGBOX,      0, 0,  1,18, 50,4, NULL },
        !           160:        { SGTEXT,     0, 0, 20,18, 12,1, "SDL2 options" },
        !           161:        { SGCHECKBOX, 0, 0,  4,20, 20,1, "Use linear scal_ing" },
        !           162:        { SGCHECKBOX, 0, 0, 28,20, 11,1, "Use _VSync" },
        !           163:        { SGBUTTON, SG_DEFAULT, 0, 17,23, 20,1, "Back to main menu" },
        !           164: #else
1.1.1.10  root      165:        { SGBUTTON, SG_DEFAULT, 0, 17,18, 20,1, "Back to main menu" },
1.1.1.15! root      166: #endif
1.1.1.5   root      167:        { -1, 0, 0, 0,0, 0,0, NULL }
1.1       root      168: };
                    169: 
1.1.1.15! root      170: /* for record button */
        !           171: #define RECORD_START "_Record AVI"
        !           172: #define RECORD_STOP "Stop _record"
        !           173: 
1.1       root      174: 
1.1.1.9   root      175: /* ---------------------------------------------------------------- */
1.1.1.5   root      176: 
1.1.1.9   root      177: static int nVdiStepX, nVdiStepY;   /* VDI resolution changing steps */
1.1.1.5   root      178: 
                    179: /**
                    180:  * Set width and height stepping for VDI resolution changing.
                    181:  * Depending on the color depth we can only change the VDI resolution
                    182:  * in certain steps:
                    183:  * - The screen width must be dividable by 16 bytes (i.e. 128 pixels in
                    184:  *   monochrome, 32 pixels in 16 color mode), or the text mode scrolling
                    185:  *   function of TOS will fail.
                    186:  * - The screen height must be a multiple of the character cell height
                    187:  *   (i.e. 16 pixels in monochrome, 8 pixels in color mode).
                    188:  */
1.1.1.9   root      189: static void DlgMonitor_SetVdiStepping(void)
1.1.1.5   root      190: {
1.1.1.9   root      191:        if (monitordlg[DLGSCRN_BPP1].state & SG_SELECTED)
1.1.1.5   root      192:        {
                    193:                nVdiStepX = 128;
                    194:                nVdiStepY = 16;
                    195:        }
1.1.1.9   root      196:        else if (monitordlg[DLGSCRN_BPP2].state & SG_SELECTED)
1.1.1.5   root      197:        {
                    198:                nVdiStepX = 64;
                    199:                nVdiStepY = 8;
                    200:        }
                    201:        else
                    202:        {
                    203:                nVdiStepX = 32;
                    204:                nVdiStepY = 8;
                    205:        }
                    206: }
                    207: 
                    208: 
1.1       root      209: /*-----------------------------------------------------------------------*/
1.1.1.5   root      210: /**
1.1.1.9   root      211:  * Show and process the monitor dialog.
1.1.1.5   root      212:  */
1.1.1.9   root      213: void Dialog_MonitorDlg(void)
1.1       root      214: {
1.1.1.15! root      215:        int but, vdiw, vdih;
1.1.1.5   root      216:        unsigned int i;
1.1.1.8   root      217:        MONITORTYPE     mti;
1.1       root      218: 
1.1.1.9   root      219:        SDLGui_CenterDlg(monitordlg);
1.1       root      220: 
1.1.1.9   root      221:        /* Set up general monitor options in the dialog from actual values: */
1.1.1.5   root      222: 
1.1.1.6   root      223:        if (ConfigureParams.Screen.bAllowOverscan)
1.1.1.9   root      224:                monitordlg[DLGSCRN_OVERSCAN].state |= SG_SELECTED;
1.1.1.5   root      225:        else
1.1.1.9   root      226:                monitordlg[DLGSCRN_OVERSCAN].state &= ~SG_SELECTED;
1.1.1.5   root      227: 
                    228:        for (i = DLGSCRN_MONO; i <= DLGSCRN_TV; i++)
1.1.1.9   root      229:                monitordlg[i].state &= ~SG_SELECTED;
                    230:        monitordlg[DLGSCRN_MONO+ConfigureParams.Screen.nMonitorType].state |= SG_SELECTED;
1.1.1.5   root      231: 
                    232:        /* Initialize VDI resolution options: */
                    233: 
1.1.1.6   root      234:        if (ConfigureParams.Screen.bUseExtVdiResolutions)
1.1.1.9   root      235:                monitordlg[DLGSCRN_USEVDIRES].state |= SG_SELECTED;
1.1.1.5   root      236:        else
1.1.1.9   root      237:                monitordlg[DLGSCRN_USEVDIRES].state &= ~SG_SELECTED;
1.1.1.5   root      238:        for (i=0; i<3; i++)
1.1.1.9   root      239:                monitordlg[DLGSCRN_BPP1 + i].state &= ~SG_SELECTED;
                    240:        monitordlg[DLGSCRN_BPP1 + ConfigureParams.Screen.nVdiColors - GEMCOLOR_2].state |= SG_SELECTED;
1.1.1.15! root      241: 
        !           242:        vdiw = ConfigureParams.Screen.nVdiWidth;
        !           243:        vdih = ConfigureParams.Screen.nVdiHeight;
        !           244:        sprintf(sVdiWidth, "%4i", vdiw);
        !           245:        sprintf(sVdiHeight, "%4i", vdih);
1.1.1.9   root      246:        DlgMonitor_SetVdiStepping();
1.1.1.5   root      247: 
1.1.1.9   root      248:        /* The monitor dialog main loop */
1.1.1.5   root      249:        do
                    250:        {
1.1.1.15! root      251:                but = SDLGui_DoDialog(monitordlg, NULL, false);
1.1.1.5   root      252:                switch (but)
                    253:                {
1.1.1.9   root      254:                 case DLGSCRN_VDI_WLESS:
1.1.1.15! root      255:                        vdiw = Opt_ValueAlignMinMax(vdiw - nVdiStepX, nVdiStepX, MIN_VDI_WIDTH, MAX_VDI_WIDTH);
        !           256:                        sprintf(sVdiWidth, "%4i", vdiw);
1.1.1.5   root      257:                        break;
1.1.1.9   root      258:                 case DLGSCRN_VDI_WMORE:
1.1.1.15! root      259:                        vdiw = Opt_ValueAlignMinMax(vdiw + nVdiStepX, nVdiStepX, MIN_VDI_WIDTH, MAX_VDI_WIDTH);
        !           260:                        sprintf(sVdiWidth, "%4i", vdiw);
1.1.1.5   root      261:                        break;
                    262: 
1.1.1.9   root      263:                 case DLGSCRN_VDI_HLESS:
1.1.1.15! root      264:                        vdih = Opt_ValueAlignMinMax(vdih - nVdiStepY, nVdiStepY, MIN_VDI_HEIGHT, MAX_VDI_HEIGHT);
        !           265:                        sprintf(sVdiHeight, "%4i", vdih);
1.1.1.5   root      266:                        break;
1.1.1.9   root      267:                 case DLGSCRN_VDI_HMORE:
1.1.1.15! root      268:                        vdih = Opt_ValueAlignMinMax(vdih + nVdiStepY, nVdiStepY, MIN_VDI_HEIGHT, MAX_VDI_HEIGHT);
        !           269:                        sprintf(sVdiHeight, "%4i", vdih);
1.1.1.5   root      270:                        break;
                    271: 
                    272:                 case DLGSCRN_BPP1:
                    273:                 case DLGSCRN_BPP2:
                    274:                 case DLGSCRN_BPP4:
1.1.1.9   root      275:                        DlgMonitor_SetVdiStepping();
1.1.1.5   root      276:                        /* Align resolution to actual conditions: */
1.1.1.15! root      277:                        vdiw = Opt_ValueAlignMinMax(vdiw, nVdiStepX, MIN_VDI_WIDTH, MAX_VDI_WIDTH);
        !           278:                        vdih = Opt_ValueAlignMinMax(vdih, nVdiStepY, MIN_VDI_HEIGHT, MAX_VDI_HEIGHT);
        !           279:                        sprintf(sVdiWidth, "%4i", vdiw);
        !           280:                        sprintf(sVdiHeight, "%4i", vdih);
1.1.1.5   root      281:                        break;
1.1.1.9   root      282:                }
                    283:        }
                    284:        while (but != DLGSCRN_EXIT_MONITOR && but != SDLGUI_QUIT
                    285:                && but != SDLGUI_ERROR && !bQuitProgram);
                    286: 
                    287:        /* Read new values from dialog: */
                    288: 
                    289:        ConfigureParams.Screen.bAllowOverscan = (monitordlg[DLGSCRN_OVERSCAN].state & SG_SELECTED);
                    290: 
                    291:        for (mti = MONITOR_TYPE_MONO; mti <= MONITOR_TYPE_TV; mti++)
                    292:        {
                    293:                if (monitordlg[mti + DLGSCRN_MONO].state & SG_SELECTED)
                    294:                {
                    295:                        ConfigureParams.Screen.nMonitorType = mti;
                    296:                        break;
                    297:                }
                    298:        }
1.1.1.15! root      299:        ConfigureParams.Screen.nVdiWidth = vdiw;
        !           300:        ConfigureParams.Screen.nVdiHeight = vdih;
1.1.1.9   root      301: 
                    302:        ConfigureParams.Screen.bUseExtVdiResolutions = (monitordlg[DLGSCRN_USEVDIRES].state & SG_SELECTED);
                    303:        for (i=0; i<3; i++)
                    304:        {
                    305:                if (monitordlg[DLGSCRN_BPP1 + i].state & SG_SELECTED)
                    306:                        ConfigureParams.Screen.nVdiColors = GEMCOLOR_2 + i;
                    307:        }
                    308: }
                    309: 
                    310: 
                    311: /*-----------------------------------------------------------------------*/
                    312: /**
                    313:  * Show and process the window dialog.
                    314:  */
                    315: void Dialog_WindowDlg(void)
                    316: {
1.1.1.15! root      317:        int maxw, maxh, deskw, deskh, but, skip = 0;
1.1.1.9   root      318:        unsigned int i;
                    319: 
                    320:        SDLGui_CenterDlg(windowdlg);
                    321: 
                    322:        /* Set up general window options in the dialog from actual values: */
                    323: 
                    324:        if (ConfigureParams.Screen.bFullScreen)
                    325:                windowdlg[DLGSCRN_FULLSCRN].state |= SG_SELECTED;
                    326:        else
                    327:                windowdlg[DLGSCRN_FULLSCRN].state &= ~SG_SELECTED;
                    328: 
1.1.1.10  root      329:        if (ConfigureParams.Screen.bKeepResolution)
                    330:                windowdlg[DLGSCRN_KEEP_RES].state |= SG_SELECTED;
                    331:        else
                    332:                windowdlg[DLGSCRN_KEEP_RES].state &= ~SG_SELECTED;
1.1.1.14  root      333:        if (ConfigureParams.Screen.bKeepResolutionST)
                    334:                windowdlg[DLGSCRN_KEEP_RES_ST].state |= SG_SELECTED;
                    335:        else
                    336:                windowdlg[DLGSCRN_KEEP_RES_ST].state &= ~SG_SELECTED;
1.1.1.10  root      337: 
                    338:        windowdlg[DLGSCRN_STATUSBAR].state &= ~SG_SELECTED;
                    339:        windowdlg[DLGSCRN_DRIVELED].state &= ~SG_SELECTED;
                    340:        windowdlg[DLGSCRN_NONE].state &= ~SG_SELECTED;
1.1.1.9   root      341:        if (ConfigureParams.Screen.bShowStatusbar)
                    342:                windowdlg[DLGSCRN_STATUSBAR].state |= SG_SELECTED;
1.1.1.10  root      343:        else if (ConfigureParams.Screen.bShowDriveLed)
                    344:                windowdlg[DLGSCRN_DRIVELED].state |= SG_SELECTED;
1.1.1.11  root      345:        else
                    346:                windowdlg[DLGSCRN_NONE].state |= SG_SELECTED;
1.1.1.9   root      347: 
1.1.1.15! root      348:        for (i = 0; i < ARRAYSIZE(skip_frames); i++)
1.1.1.9   root      349:        {
                    350:                if (ConfigureParams.Screen.nFrameSkips >= skip_frames[i])
                    351:                        skip = i;
                    352:                windowdlg[i+DLGSCRN_SKIP0].state &= ~SG_SELECTED;
                    353:        }
                    354:        windowdlg[DLGSCRN_SKIP0+skip].state |= SG_SELECTED;
                    355: 
1.1.1.10  root      356:        Resolution_GetDesktopSize(&deskw, &deskh);
1.1.1.15! root      357:        maxw = ConfigureParams.Screen.nMaxWidth;
        !           358:        maxh = ConfigureParams.Screen.nMaxHeight;
        !           359:        sprintf(sMaxWidth, "%4i", maxw);
        !           360:        sprintf(sMaxHeight, "%4i", maxh);
1.1.1.9   root      361: 
                    362:        /* Initialize window capture options: */
                    363: 
1.1.1.10  root      364:        if (ConfigureParams.Screen.bCrop)
                    365:                windowdlg[DLGSCRN_CROP].state |= SG_SELECTED;
1.1.1.9   root      366:        else
1.1.1.10  root      367:                windowdlg[DLGSCRN_CROP].state &= ~SG_SELECTED;
1.1.1.9   root      368: 
                    369:        if (Avi_AreWeRecording())
1.1.1.15! root      370:                windowdlg[DLGSCRN_RECANIM].txt = RECORD_STOP;
1.1.1.9   root      371:        else
1.1.1.15! root      372:                windowdlg[DLGSCRN_RECANIM].txt = RECORD_START;
        !           373: 
        !           374: #if WITH_SDL2
        !           375:        /* SDL2 options */
        !           376:        if (ConfigureParams.Screen.nRenderScaleQuality)
        !           377:                windowdlg[DLGSCRN_LINEARSCALE].state |= SG_SELECTED;
        !           378:        else
        !           379:                windowdlg[DLGSCRN_LINEARSCALE].state &= ~SG_SELECTED;
        !           380: 
        !           381:        if (ConfigureParams.Screen.bUseVsync)
        !           382:                windowdlg[DLGSCRN_VSYNC].state |= SG_SELECTED;
        !           383:        else
        !           384:                windowdlg[DLGSCRN_VSYNC].state &= ~SG_SELECTED;
        !           385: #endif
1.1.1.9   root      386: 
                    387:        /* The window dialog main loop */
                    388:        do
                    389:        {
1.1.1.15! root      390:                but = SDLGui_DoDialog(windowdlg, NULL, false);
1.1.1.9   root      391:                switch (but)
                    392:                {
                    393:                 case DLGSCRN_MAX_WLESS:
1.1.1.15! root      394:                        maxw = Opt_ValueAlignMinMax(maxw - MAX_SIZE_STEP, MAX_SIZE_STEP, MIN_VDI_WIDTH, deskw);
        !           395:                        sprintf(sMaxWidth, "%4i", maxw);
1.1.1.9   root      396:                        break;
                    397:                 case DLGSCRN_MAX_WMORE:
1.1.1.15! root      398:                        maxw = Opt_ValueAlignMinMax(maxw + MAX_SIZE_STEP, MAX_SIZE_STEP, MIN_VDI_WIDTH, deskw);
        !           399:                        sprintf(sMaxWidth, "%4i", maxw);
1.1.1.9   root      400:                        break;
                    401: 
                    402:                 case DLGSCRN_MAX_HLESS:
1.1.1.15! root      403:                        maxh = Opt_ValueAlignMinMax(maxh - MAX_SIZE_STEP, MAX_SIZE_STEP, MIN_VDI_HEIGHT, deskh);
        !           404:                        sprintf(sMaxHeight, "%4i", maxh);
1.1.1.9   root      405:                        break;
                    406:                 case DLGSCRN_MAX_HMORE:
1.1.1.15! root      407:                        maxh = Opt_ValueAlignMinMax(maxh + MAX_SIZE_STEP, MAX_SIZE_STEP, MIN_VDI_HEIGHT, deskh);
        !           408:                        sprintf(sMaxHeight, "%4i", maxh);
1.1.1.9   root      409:                        break;
1.1.1.5   root      410: 
                    411:                 case DLGSCRN_CAPTURE:
                    412:                        SDL_UpdateRect(sdlscrn, 0,0,0,0);
1.1.1.10  root      413:                        ConfigureParams.Screen.bCrop = (windowdlg[DLGSCRN_CROP].state & SG_SELECTED);
1.1.1.5   root      414:                        ScreenSnapShot_SaveScreen();
                    415:                        break;
1.1.1.9   root      416: 
                    417:                case DLGSCRN_RECANIM:
                    418:                        if (Avi_AreWeRecording())
1.1.1.5   root      419:                        {
1.1.1.9   root      420:                                /* AVI indexing can take a while for larger files */
                    421:                                Statusbar_AddMessage("Finishing AVI file...", 100);
1.1.1.14  root      422:                                Statusbar_Update(sdlscrn, true);
1.1.1.9   root      423:                                Avi_StopRecording();
1.1.1.15! root      424:                                windowdlg[DLGSCRN_RECANIM].txt = RECORD_START;
1.1.1.9   root      425:                                Statusbar_AddMessage("Emulation paused", 100);
1.1.1.14  root      426:                                Statusbar_Update(sdlscrn, true);
1.1.1.5   root      427:                        }
                    428:                        else
                    429:                        {
1.1.1.10  root      430:                                ConfigureParams.Screen.bCrop = (windowdlg[DLGSCRN_CROP].state & SG_SELECTED);
                    431:                                Avi_StartRecording ( ConfigureParams.Video.AviRecordFile , ConfigureParams.Screen.bCrop ,
                    432:                                        ConfigureParams.Video.AviRecordFps == 0 ?
                    433:                                                ClocksTimings_GetVBLPerSec ( ConfigureParams.System.nMachineType , nScreenRefreshRate ) :
                    434:                                                (Uint32)ConfigureParams.Video.AviRecordFps << CLOCKS_TIMINGS_SHIFT_VBL ,
                    435:                                        1 << CLOCKS_TIMINGS_SHIFT_VBL ,
                    436:                                        ConfigureParams.Video.AviRecordVcodec );
1.1.1.15! root      437:                                windowdlg[DLGSCRN_RECANIM].txt = RECORD_STOP;
1.1.1.5   root      438:                        }
                    439:                        break;
                    440:                }
                    441:        }
1.1.1.9   root      442:        while (but != DLGSCRN_EXIT_WINDOW && but != SDLGUI_QUIT
1.1.1.5   root      443:                && but != SDLGUI_ERROR && !bQuitProgram);
                    444: 
                    445:        /* Read new values from dialog: */
                    446: 
1.1.1.9   root      447:        ConfigureParams.Screen.bFullScreen = (windowdlg[DLGSCRN_FULLSCRN].state & SG_SELECTED);
1.1.1.10  root      448:        ConfigureParams.Screen.bKeepResolution = (windowdlg[DLGSCRN_KEEP_RES].state & SG_SELECTED);
1.1.1.14  root      449:        ConfigureParams.Screen.bKeepResolutionST = (windowdlg[DLGSCRN_KEEP_RES_ST].state & SG_SELECTED);
1.1.1.5   root      450: 
1.1.1.15! root      451:        ConfigureParams.Screen.nMaxWidth = maxw;
        !           452:        ConfigureParams.Screen.nMaxHeight = maxh;
        !           453: 
1.1.1.10  root      454:        ConfigureParams.Screen.bShowStatusbar = false;
                    455:        ConfigureParams.Screen.bShowDriveLed = false;
1.1.1.9   root      456:        if (windowdlg[DLGSCRN_STATUSBAR].state & SG_SELECTED)
1.1.1.8   root      457:                ConfigureParams.Screen.bShowStatusbar = true;
1.1.1.10  root      458:        else if (windowdlg[DLGSCRN_DRIVELED].state & SG_SELECTED)
                    459:                ConfigureParams.Screen.bShowDriveLed = true;
1.1.1.5   root      460: 
                    461:        for (i = DLGSCRN_SKIP0; i <= DLGSCRN_SKIP4; i++)
                    462:        {
1.1.1.9   root      463:                if (windowdlg[i].state & SG_SELECTED)
1.1.1.5   root      464:                {
1.1.1.6   root      465:                        ConfigureParams.Screen.nFrameSkips = skip_frames[i-DLGSCRN_SKIP0];
1.1.1.5   root      466:                        break;
                    467:                }
                    468:        }
1.1.1.2   root      469: 
1.1.1.10  root      470:        ConfigureParams.Screen.bCrop = (windowdlg[DLGSCRN_CROP].state & SG_SELECTED);
1.1.1.15! root      471: 
        !           472: #if WITH_SDL2
        !           473:        ConfigureParams.Screen.nRenderScaleQuality = (windowdlg[DLGSCRN_LINEARSCALE].state & SG_SELECTED) ? 1 : 0;
        !           474:        ConfigureParams.Screen.bUseVsync = (windowdlg[DLGSCRN_VSYNC].state & SG_SELECTED);
        !           475: #endif
1.1       root      476: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.