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

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.16! root       76:        { SGSTOP, 0, 0, 0,0, 0,0, NULL }
1.1.1.9   root       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.16! root      139: #if WITH_SDL2
        !           140:        { SGTEXT,     0, 0, 35,4, 10,1, "resolution" },
        !           141:        { SGTEXT,     0, 0, 35,5, 13,1, "in fullscreen" },
        !           142:        { SGTEXT,     0, 0, 33,2,  1,1, "" },
        !           143:        { SGCHECKBOX, 0, 0, 33,3, 14,1, "_Keep desktop" },
        !           144: #else
1.1.1.14  root      145:        { SGTEXT,     0, 0, 33,2, 14,1, "Keep desktop" },
                    146:        { SGTEXT,     0, 0, 33,3, 14,1, "resolution:" },
1.1.1.15  root      147:        { SGCHECKBOX, 0, 0, 35,4,  8,1, "ST/ST_e" },
                    148:        { SGCHECKBOX, 0, 0, 35,5, 11,1, "_TT/Falcon" },
1.1.1.16! root      149: #endif
1.1.1.10  root      150:        { SGTEXT,     0, 0, 33,7, 15,1, "Max zoomed win:" },
1.1.1.15  root      151:        { SGBUTTON,   0, 0, 35,8,  1,1, "\x04", SG_SHORTCUT_LEFT },
1.1.1.10  root      152:        { SGTEXT,     0, 0, 37,8,  4,1, sMaxWidth },
1.1.1.15  root      153:        { SGBUTTON,   0, 0, 43,8,  1,1, "\x03", SG_SHORTCUT_RIGHT },
1.1.1.10  root      154:        { SGTEXT,     0, 0, 33,9,  1,1, "x" },
1.1.1.15  root      155:        { SGBUTTON,   0, 0, 35,9,  1,1, "\x04", SG_SHORTCUT_UP },
1.1.1.10  root      156:        { SGTEXT,     0, 0, 37,9,  4,1, sMaxHeight },
1.1.1.15  root      157:        { SGBUTTON,   0, 0, 43,9,  1,1, "\x03", SG_SHORTCUT_DOWN },
1.1.1.10  root      158: 
                    159:        { SGBOX,      0, 0,  1,12, 50,5, NULL },
                    160:        { SGTEXT,     0, 0,  7,13, 16,1, "Screen capture" },
1.1.1.15  root      161:        { SGCHECKBOX, 0, 0,  8,15, 16,1, "_Crop statusbar" },
                    162:        { SGBUTTON,   0, 0, 29,13, 14,1, " _Screenshot " },
                    163:        { SGBUTTON,   0, 0, 29,15, 14,1, NULL },      /* Record text set later */
                    164: 
                    165: #if WITH_SDL2
                    166:        { SGBOX,      0, 0,  1,18, 50,4, NULL },
                    167:        { SGTEXT,     0, 0, 20,18, 12,1, "SDL2 options" },
                    168:        { SGCHECKBOX, 0, 0,  4,20, 20,1, "Use linear scal_ing" },
                    169:        { SGCHECKBOX, 0, 0, 28,20, 11,1, "Use _VSync" },
                    170:        { SGBUTTON, SG_DEFAULT, 0, 17,23, 20,1, "Back to main menu" },
                    171: #else
1.1.1.10  root      172:        { SGBUTTON, SG_DEFAULT, 0, 17,18, 20,1, "Back to main menu" },
1.1.1.15  root      173: #endif
1.1.1.16! root      174:        { SGSTOP, 0, 0, 0,0, 0,0, NULL }
1.1       root      175: };
                    176: 
1.1.1.15  root      177: /* for record button */
                    178: #define RECORD_START "_Record AVI"
                    179: #define RECORD_STOP "Stop _record"
                    180: 
1.1       root      181: 
1.1.1.9   root      182: /* ---------------------------------------------------------------- */
1.1.1.5   root      183: 
1.1.1.9   root      184: static int nVdiStepX, nVdiStepY;   /* VDI resolution changing steps */
1.1.1.5   root      185: 
                    186: /**
                    187:  * Set width and height stepping for VDI resolution changing.
                    188:  * Depending on the color depth we can only change the VDI resolution
                    189:  * in certain steps:
                    190:  * - The screen width must be dividable by 16 bytes (i.e. 128 pixels in
                    191:  *   monochrome, 32 pixels in 16 color mode), or the text mode scrolling
                    192:  *   function of TOS will fail.
                    193:  * - The screen height must be a multiple of the character cell height
                    194:  *   (i.e. 16 pixels in monochrome, 8 pixels in color mode).
                    195:  */
1.1.1.9   root      196: static void DlgMonitor_SetVdiStepping(void)
1.1.1.5   root      197: {
1.1.1.9   root      198:        if (monitordlg[DLGSCRN_BPP1].state & SG_SELECTED)
1.1.1.5   root      199:        {
                    200:                nVdiStepX = 128;
                    201:                nVdiStepY = 16;
                    202:        }
1.1.1.9   root      203:        else if (monitordlg[DLGSCRN_BPP2].state & SG_SELECTED)
1.1.1.5   root      204:        {
                    205:                nVdiStepX = 64;
                    206:                nVdiStepY = 8;
                    207:        }
                    208:        else
                    209:        {
                    210:                nVdiStepX = 32;
                    211:                nVdiStepY = 8;
                    212:        }
                    213: }
                    214: 
                    215: 
1.1       root      216: /*-----------------------------------------------------------------------*/
1.1.1.5   root      217: /**
1.1.1.9   root      218:  * Show and process the monitor dialog.
1.1.1.5   root      219:  */
1.1.1.9   root      220: void Dialog_MonitorDlg(void)
1.1       root      221: {
1.1.1.15  root      222:        int but, vdiw, vdih;
1.1.1.5   root      223:        unsigned int i;
1.1.1.8   root      224:        MONITORTYPE     mti;
1.1       root      225: 
1.1.1.9   root      226:        SDLGui_CenterDlg(monitordlg);
1.1       root      227: 
1.1.1.9   root      228:        /* Set up general monitor options in the dialog from actual values: */
1.1.1.5   root      229: 
1.1.1.6   root      230:        if (ConfigureParams.Screen.bAllowOverscan)
1.1.1.9   root      231:                monitordlg[DLGSCRN_OVERSCAN].state |= SG_SELECTED;
1.1.1.5   root      232:        else
1.1.1.9   root      233:                monitordlg[DLGSCRN_OVERSCAN].state &= ~SG_SELECTED;
1.1.1.5   root      234: 
                    235:        for (i = DLGSCRN_MONO; i <= DLGSCRN_TV; i++)
1.1.1.9   root      236:                monitordlg[i].state &= ~SG_SELECTED;
                    237:        monitordlg[DLGSCRN_MONO+ConfigureParams.Screen.nMonitorType].state |= SG_SELECTED;
1.1.1.5   root      238: 
                    239:        /* Initialize VDI resolution options: */
                    240: 
1.1.1.6   root      241:        if (ConfigureParams.Screen.bUseExtVdiResolutions)
1.1.1.9   root      242:                monitordlg[DLGSCRN_USEVDIRES].state |= SG_SELECTED;
1.1.1.5   root      243:        else
1.1.1.9   root      244:                monitordlg[DLGSCRN_USEVDIRES].state &= ~SG_SELECTED;
1.1.1.5   root      245:        for (i=0; i<3; i++)
1.1.1.9   root      246:                monitordlg[DLGSCRN_BPP1 + i].state &= ~SG_SELECTED;
                    247:        monitordlg[DLGSCRN_BPP1 + ConfigureParams.Screen.nVdiColors - GEMCOLOR_2].state |= SG_SELECTED;
1.1.1.15  root      248: 
                    249:        vdiw = ConfigureParams.Screen.nVdiWidth;
                    250:        vdih = ConfigureParams.Screen.nVdiHeight;
                    251:        sprintf(sVdiWidth, "%4i", vdiw);
                    252:        sprintf(sVdiHeight, "%4i", vdih);
1.1.1.9   root      253:        DlgMonitor_SetVdiStepping();
1.1.1.5   root      254: 
1.1.1.9   root      255:        /* The monitor dialog main loop */
1.1.1.5   root      256:        do
                    257:        {
1.1.1.15  root      258:                but = SDLGui_DoDialog(monitordlg, NULL, false);
1.1.1.5   root      259:                switch (but)
                    260:                {
1.1.1.9   root      261:                 case DLGSCRN_VDI_WLESS:
1.1.1.15  root      262:                        vdiw = Opt_ValueAlignMinMax(vdiw - nVdiStepX, nVdiStepX, MIN_VDI_WIDTH, MAX_VDI_WIDTH);
                    263:                        sprintf(sVdiWidth, "%4i", vdiw);
1.1.1.5   root      264:                        break;
1.1.1.9   root      265:                 case DLGSCRN_VDI_WMORE:
1.1.1.15  root      266:                        vdiw = Opt_ValueAlignMinMax(vdiw + nVdiStepX, nVdiStepX, MIN_VDI_WIDTH, MAX_VDI_WIDTH);
                    267:                        sprintf(sVdiWidth, "%4i", vdiw);
1.1.1.5   root      268:                        break;
                    269: 
1.1.1.9   root      270:                 case DLGSCRN_VDI_HLESS:
1.1.1.15  root      271:                        vdih = Opt_ValueAlignMinMax(vdih - nVdiStepY, nVdiStepY, MIN_VDI_HEIGHT, MAX_VDI_HEIGHT);
                    272:                        sprintf(sVdiHeight, "%4i", vdih);
1.1.1.5   root      273:                        break;
1.1.1.9   root      274:                 case DLGSCRN_VDI_HMORE:
1.1.1.15  root      275:                        vdih = Opt_ValueAlignMinMax(vdih + nVdiStepY, nVdiStepY, MIN_VDI_HEIGHT, MAX_VDI_HEIGHT);
                    276:                        sprintf(sVdiHeight, "%4i", vdih);
1.1.1.5   root      277:                        break;
                    278: 
                    279:                 case DLGSCRN_BPP1:
                    280:                 case DLGSCRN_BPP2:
                    281:                 case DLGSCRN_BPP4:
1.1.1.9   root      282:                        DlgMonitor_SetVdiStepping();
1.1.1.5   root      283:                        /* Align resolution to actual conditions: */
1.1.1.15  root      284:                        vdiw = Opt_ValueAlignMinMax(vdiw, nVdiStepX, MIN_VDI_WIDTH, MAX_VDI_WIDTH);
                    285:                        vdih = Opt_ValueAlignMinMax(vdih, nVdiStepY, MIN_VDI_HEIGHT, MAX_VDI_HEIGHT);
                    286:                        sprintf(sVdiWidth, "%4i", vdiw);
                    287:                        sprintf(sVdiHeight, "%4i", vdih);
1.1.1.5   root      288:                        break;
1.1.1.9   root      289:                }
                    290:        }
                    291:        while (but != DLGSCRN_EXIT_MONITOR && but != SDLGUI_QUIT
                    292:                && but != SDLGUI_ERROR && !bQuitProgram);
                    293: 
                    294:        /* Read new values from dialog: */
                    295: 
                    296:        ConfigureParams.Screen.bAllowOverscan = (monitordlg[DLGSCRN_OVERSCAN].state & SG_SELECTED);
                    297: 
                    298:        for (mti = MONITOR_TYPE_MONO; mti <= MONITOR_TYPE_TV; mti++)
                    299:        {
                    300:                if (monitordlg[mti + DLGSCRN_MONO].state & SG_SELECTED)
                    301:                {
                    302:                        ConfigureParams.Screen.nMonitorType = mti;
                    303:                        break;
                    304:                }
                    305:        }
1.1.1.15  root      306:        ConfigureParams.Screen.nVdiWidth = vdiw;
                    307:        ConfigureParams.Screen.nVdiHeight = vdih;
1.1.1.9   root      308: 
                    309:        ConfigureParams.Screen.bUseExtVdiResolutions = (monitordlg[DLGSCRN_USEVDIRES].state & SG_SELECTED);
                    310:        for (i=0; i<3; i++)
                    311:        {
                    312:                if (monitordlg[DLGSCRN_BPP1 + i].state & SG_SELECTED)
                    313:                        ConfigureParams.Screen.nVdiColors = GEMCOLOR_2 + i;
                    314:        }
                    315: }
                    316: 
                    317: 
                    318: /*-----------------------------------------------------------------------*/
                    319: /**
                    320:  * Show and process the window dialog.
                    321:  */
                    322: void Dialog_WindowDlg(void)
                    323: {
1.1.1.15  root      324:        int maxw, maxh, deskw, deskh, but, skip = 0;
1.1.1.9   root      325:        unsigned int i;
                    326: 
                    327:        SDLGui_CenterDlg(windowdlg);
                    328: 
                    329:        /* Set up general window options in the dialog from actual values: */
                    330: 
                    331:        if (ConfigureParams.Screen.bFullScreen)
                    332:                windowdlg[DLGSCRN_FULLSCRN].state |= SG_SELECTED;
                    333:        else
                    334:                windowdlg[DLGSCRN_FULLSCRN].state &= ~SG_SELECTED;
                    335: 
1.1.1.10  root      336:        if (ConfigureParams.Screen.bKeepResolution)
                    337:                windowdlg[DLGSCRN_KEEP_RES].state |= SG_SELECTED;
                    338:        else
                    339:                windowdlg[DLGSCRN_KEEP_RES].state &= ~SG_SELECTED;
1.1.1.16! root      340: #if !WITH_SDL2
1.1.1.14  root      341:        if (ConfigureParams.Screen.bKeepResolutionST)
                    342:                windowdlg[DLGSCRN_KEEP_RES_ST].state |= SG_SELECTED;
                    343:        else
                    344:                windowdlg[DLGSCRN_KEEP_RES_ST].state &= ~SG_SELECTED;
1.1.1.16! root      345: #endif
1.1.1.10  root      346: 
                    347:        windowdlg[DLGSCRN_STATUSBAR].state &= ~SG_SELECTED;
                    348:        windowdlg[DLGSCRN_DRIVELED].state &= ~SG_SELECTED;
                    349:        windowdlg[DLGSCRN_NONE].state &= ~SG_SELECTED;
1.1.1.9   root      350:        if (ConfigureParams.Screen.bShowStatusbar)
                    351:                windowdlg[DLGSCRN_STATUSBAR].state |= SG_SELECTED;
1.1.1.10  root      352:        else if (ConfigureParams.Screen.bShowDriveLed)
                    353:                windowdlg[DLGSCRN_DRIVELED].state |= SG_SELECTED;
1.1.1.11  root      354:        else
                    355:                windowdlg[DLGSCRN_NONE].state |= SG_SELECTED;
1.1.1.9   root      356: 
1.1.1.16! root      357:        for (i = 0; i < ARRAY_SIZE(skip_frames); i++)
1.1.1.9   root      358:        {
                    359:                if (ConfigureParams.Screen.nFrameSkips >= skip_frames[i])
                    360:                        skip = i;
                    361:                windowdlg[i+DLGSCRN_SKIP0].state &= ~SG_SELECTED;
                    362:        }
                    363:        windowdlg[DLGSCRN_SKIP0+skip].state |= SG_SELECTED;
                    364: 
1.1.1.10  root      365:        Resolution_GetDesktopSize(&deskw, &deskh);
1.1.1.15  root      366:        maxw = ConfigureParams.Screen.nMaxWidth;
                    367:        maxh = ConfigureParams.Screen.nMaxHeight;
                    368:        sprintf(sMaxWidth, "%4i", maxw);
                    369:        sprintf(sMaxHeight, "%4i", maxh);
1.1.1.9   root      370: 
                    371:        /* Initialize window capture options: */
                    372: 
1.1.1.10  root      373:        if (ConfigureParams.Screen.bCrop)
                    374:                windowdlg[DLGSCRN_CROP].state |= SG_SELECTED;
1.1.1.9   root      375:        else
1.1.1.10  root      376:                windowdlg[DLGSCRN_CROP].state &= ~SG_SELECTED;
1.1.1.9   root      377: 
                    378:        if (Avi_AreWeRecording())
1.1.1.15  root      379:                windowdlg[DLGSCRN_RECANIM].txt = RECORD_STOP;
1.1.1.9   root      380:        else
1.1.1.15  root      381:                windowdlg[DLGSCRN_RECANIM].txt = RECORD_START;
                    382: 
                    383: #if WITH_SDL2
                    384:        /* SDL2 options */
                    385:        if (ConfigureParams.Screen.nRenderScaleQuality)
                    386:                windowdlg[DLGSCRN_LINEARSCALE].state |= SG_SELECTED;
                    387:        else
                    388:                windowdlg[DLGSCRN_LINEARSCALE].state &= ~SG_SELECTED;
                    389: 
                    390:        if (ConfigureParams.Screen.bUseVsync)
                    391:                windowdlg[DLGSCRN_VSYNC].state |= SG_SELECTED;
                    392:        else
                    393:                windowdlg[DLGSCRN_VSYNC].state &= ~SG_SELECTED;
                    394: #endif
1.1.1.9   root      395: 
                    396:        /* The window dialog main loop */
                    397:        do
                    398:        {
1.1.1.15  root      399:                but = SDLGui_DoDialog(windowdlg, NULL, false);
1.1.1.9   root      400:                switch (but)
                    401:                {
                    402:                 case DLGSCRN_MAX_WLESS:
1.1.1.15  root      403:                        maxw = Opt_ValueAlignMinMax(maxw - MAX_SIZE_STEP, MAX_SIZE_STEP, MIN_VDI_WIDTH, deskw);
                    404:                        sprintf(sMaxWidth, "%4i", maxw);
1.1.1.9   root      405:                        break;
                    406:                 case DLGSCRN_MAX_WMORE:
1.1.1.15  root      407:                        maxw = Opt_ValueAlignMinMax(maxw + MAX_SIZE_STEP, MAX_SIZE_STEP, MIN_VDI_WIDTH, deskw);
                    408:                        sprintf(sMaxWidth, "%4i", maxw);
1.1.1.9   root      409:                        break;
                    410: 
                    411:                 case DLGSCRN_MAX_HLESS:
1.1.1.15  root      412:                        maxh = Opt_ValueAlignMinMax(maxh - MAX_SIZE_STEP, MAX_SIZE_STEP, MIN_VDI_HEIGHT, deskh);
                    413:                        sprintf(sMaxHeight, "%4i", maxh);
1.1.1.9   root      414:                        break;
                    415:                 case DLGSCRN_MAX_HMORE:
1.1.1.15  root      416:                        maxh = Opt_ValueAlignMinMax(maxh + MAX_SIZE_STEP, MAX_SIZE_STEP, MIN_VDI_HEIGHT, deskh);
                    417:                        sprintf(sMaxHeight, "%4i", maxh);
1.1.1.9   root      418:                        break;
1.1.1.5   root      419: 
                    420:                 case DLGSCRN_CAPTURE:
                    421:                        SDL_UpdateRect(sdlscrn, 0,0,0,0);
1.1.1.10  root      422:                        ConfigureParams.Screen.bCrop = (windowdlg[DLGSCRN_CROP].state & SG_SELECTED);
1.1.1.5   root      423:                        ScreenSnapShot_SaveScreen();
                    424:                        break;
1.1.1.9   root      425: 
                    426:                case DLGSCRN_RECANIM:
                    427:                        if (Avi_AreWeRecording())
1.1.1.5   root      428:                        {
1.1.1.9   root      429:                                /* AVI indexing can take a while for larger files */
                    430:                                Statusbar_AddMessage("Finishing AVI file...", 100);
1.1.1.14  root      431:                                Statusbar_Update(sdlscrn, true);
1.1.1.9   root      432:                                Avi_StopRecording();
1.1.1.15  root      433:                                windowdlg[DLGSCRN_RECANIM].txt = RECORD_START;
1.1.1.9   root      434:                                Statusbar_AddMessage("Emulation paused", 100);
1.1.1.14  root      435:                                Statusbar_Update(sdlscrn, true);
1.1.1.5   root      436:                        }
                    437:                        else
                    438:                        {
1.1.1.10  root      439:                                ConfigureParams.Screen.bCrop = (windowdlg[DLGSCRN_CROP].state & SG_SELECTED);
                    440:                                Avi_StartRecording ( ConfigureParams.Video.AviRecordFile , ConfigureParams.Screen.bCrop ,
                    441:                                        ConfigureParams.Video.AviRecordFps == 0 ?
                    442:                                                ClocksTimings_GetVBLPerSec ( ConfigureParams.System.nMachineType , nScreenRefreshRate ) :
                    443:                                                (Uint32)ConfigureParams.Video.AviRecordFps << CLOCKS_TIMINGS_SHIFT_VBL ,
                    444:                                        1 << CLOCKS_TIMINGS_SHIFT_VBL ,
                    445:                                        ConfigureParams.Video.AviRecordVcodec );
1.1.1.15  root      446:                                windowdlg[DLGSCRN_RECANIM].txt = RECORD_STOP;
1.1.1.5   root      447:                        }
                    448:                        break;
                    449:                }
                    450:        }
1.1.1.9   root      451:        while (but != DLGSCRN_EXIT_WINDOW && but != SDLGUI_QUIT
1.1.1.5   root      452:                && but != SDLGUI_ERROR && !bQuitProgram);
                    453: 
                    454:        /* Read new values from dialog: */
                    455: 
1.1.1.9   root      456:        ConfigureParams.Screen.bFullScreen = (windowdlg[DLGSCRN_FULLSCRN].state & SG_SELECTED);
1.1.1.10  root      457:        ConfigureParams.Screen.bKeepResolution = (windowdlg[DLGSCRN_KEEP_RES].state & SG_SELECTED);
1.1.1.16! root      458: #if !WITH_SDL2
1.1.1.14  root      459:        ConfigureParams.Screen.bKeepResolutionST = (windowdlg[DLGSCRN_KEEP_RES_ST].state & SG_SELECTED);
1.1.1.16! root      460: #endif
1.1.1.5   root      461: 
1.1.1.15  root      462:        ConfigureParams.Screen.nMaxWidth = maxw;
                    463:        ConfigureParams.Screen.nMaxHeight = maxh;
                    464: 
1.1.1.10  root      465:        ConfigureParams.Screen.bShowStatusbar = false;
                    466:        ConfigureParams.Screen.bShowDriveLed = false;
1.1.1.9   root      467:        if (windowdlg[DLGSCRN_STATUSBAR].state & SG_SELECTED)
1.1.1.8   root      468:                ConfigureParams.Screen.bShowStatusbar = true;
1.1.1.10  root      469:        else if (windowdlg[DLGSCRN_DRIVELED].state & SG_SELECTED)
                    470:                ConfigureParams.Screen.bShowDriveLed = true;
1.1.1.5   root      471: 
                    472:        for (i = DLGSCRN_SKIP0; i <= DLGSCRN_SKIP4; i++)
                    473:        {
1.1.1.9   root      474:                if (windowdlg[i].state & SG_SELECTED)
1.1.1.5   root      475:                {
1.1.1.6   root      476:                        ConfigureParams.Screen.nFrameSkips = skip_frames[i-DLGSCRN_SKIP0];
1.1.1.5   root      477:                        break;
                    478:                }
                    479:        }
1.1.1.2   root      480: 
1.1.1.10  root      481:        ConfigureParams.Screen.bCrop = (windowdlg[DLGSCRN_CROP].state & SG_SELECTED);
1.1.1.15  root      482: 
                    483: #if WITH_SDL2
                    484:        ConfigureParams.Screen.nRenderScaleQuality = (windowdlg[DLGSCRN_LINEARSCALE].state & SG_SELECTED) ? 1 : 0;
                    485:        ConfigureParams.Screen.bUseVsync = (windowdlg[DLGSCRN_VSYNC].state & SG_SELECTED);
                    486: #endif
1.1       root      487: }

unix.superglobalmegacorp.com

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