Annotation of hatari/src/dialog.c, revision 1.1.1.4

1.1       root        1: /*
1.1.1.4 ! root        2:   Hatari - dialog.c
        !             3: 
        !             4:   This file is distributed under the GNU Public License, version 2 or at
        !             5:   your option any later version. Read the file gpl.txt for details.
1.1       root        6: 
                      7:   This is normal 'C' code to handle our options dialog. We keep all our configuration details
                      8:   in a variable 'ConfigureParams'. When we open our dialog we copy this and then when we 'OK'
1.1.1.2   root        9:   or 'Cancel' the dialog we can compare and makes the necessary changes.
1.1       root       10: */
1.1.1.4 ! root       11: static char rcsid[] = "Hatari $Id: dialog.c,v 1.21 2003/03/06 17:41:27 thothy Exp $";
1.1       root       12: 
1.1.1.3   root       13: #include <unistd.h>
                     14: 
1.1       root       15: #include "main.h"
                     16: #include "configuration.h"
                     17: #include "audio.h"
                     18: #include "debug.h"
                     19: #include "dialog.h"
                     20: #include "file.h"
                     21: #include "floppy.h"
1.1.1.2   root       22: #include "gemdos.h"
                     23: #include "hdc.h"
1.1       root       24: #include "joy.h"
                     25: #include "keymap.h"
                     26: #include "m68000.h"
                     27: #include "memAlloc.h"
                     28: #include "memorySnapShot.h"
                     29: #include "misc.h"
                     30: #include "printer.h"
1.1.1.3   root       31: #include "reset.h"
1.1       root       32: #include "rs232.h"
                     33: #include "screen.h"
1.1.1.3   root       34: #include "screenSnapShot.h"
1.1       root       35: #include "sound.h"
                     36: #include "tos.h"
                     37: #include "vdi.h"
                     38: #include "video.h"
1.1.1.2   root       39: #include "sdlgui.h"
1.1.1.3   root       40: #include "uae-cpu/hatari-glue.h"
                     41: #include "intercept.h"
                     42: 
1.1       root       43: 
                     44: 
1.1.1.2   root       45: /* The main dialog: */
                     46: #define MAINDLG_ABOUT    2
                     47: #define MAINDLG_DISCS    3
                     48: #define MAINDLG_TOSGEM   4
                     49: #define MAINDLG_SCREEN   5
                     50: #define MAINDLG_SOUND    6
                     51: #define MAINDLG_CPU      7
                     52: #define MAINDLG_MEMORY   8
                     53: #define MAINDLG_JOY      9
                     54: #define MAINDLG_KEYBD    10
                     55: #define MAINDLG_DEVICES  11
                     56: #define MAINDLG_NORESET  12
                     57: #define MAINDLG_RESET    13
                     58: #define MAINDLG_OK       14
                     59: #define MAINDLG_CANCEL   15
                     60: #define MAINDLG_QUIT     16
                     61: SGOBJ maindlg[] =
                     62: {
                     63:   { SGBOX, 0, 0, 0,0, 36,20, NULL },
                     64:   { SGTEXT, 0, 0, 10,1, 16,1, "Hatari main menu" },
                     65:   { SGBUTTON, 0, 0, 4,4, 12,1, "About" },
                     66:   { SGBUTTON, 0, 0, 4,6, 12,1, "Discs" },
                     67:   { SGBUTTON, 0, 0, 4,8, 12,1, "TOS/GEM" },
                     68:   { SGBUTTON, 0, 0, 4,10, 12,1, "Screen" },
                     69:   { SGBUTTON, 0, 0, 4,12, 12,1, "Sound" },
1.1.1.3   root       70:   { SGBUTTON, 0, 0, 20,4, 12,1, "System" },
1.1.1.2   root       71:   { SGBUTTON, 0, 0, 20,6, 12,1, "Memory" },
                     72:   { SGBUTTON, 0, 0, 20,8, 12,1, "Joysticks" },
                     73:   { SGBUTTON, 0, 0, 20,10, 12,1, "Keyboard" },
                     74:   { SGBUTTON, 0, 0, 20,12, 12,1, "Devices" },
                     75:   { SGRADIOBUT, 0, 0, 2,16, 10,1, "No Reset" },
                     76:   { SGRADIOBUT, 0, 0, 2,18, 10,1, "Reset ST" },
                     77:   { SGBUTTON, 0, 0, 14,16, 8,3, "Okay" },
                     78:   { SGBUTTON, 0, 0, 25,18, 8,1, "Cancel" },
                     79:   { SGBUTTON, 0, 0, 25,16, 8,1, "Quit" },
                     80:   { -1, 0, 0, 0,0, 0,0, NULL }
                     81: };
                     82: 
                     83: 
                     84: /* The "About"-dialog: */
                     85: SGOBJ aboutdlg[] =
                     86: {
                     87:   { SGBOX, 0, 0, 0,0, 40,25, NULL },
                     88:   { SGTEXT, 0, 0, 14,1, 12,1, PROG_NAME },
                     89:   { SGTEXT, 0, 0, 14,2, 12,1, "============" },
                     90:   { SGTEXT, 0, 0, 1,4, 38,1, "Hatari has been written by:  T. Huth," },
                     91:   { SGTEXT, 0, 0, 1,5, 38,1, "S. Marothy, S. Berndtsson, P. Bates," },
                     92:   { SGTEXT, 0, 0, 1,6, 38,1, "B. Schmidt and many others." },
                     93:   { SGTEXT, 0, 0, 1,7, 38,1, "Please see the docs for more info." },
                     94:   { SGTEXT, 0, 0, 1,9, 38,1, "This program is free software; you can" },
                     95:   { SGTEXT, 0, 0, 1,10, 38,1, "redistribute it and/or modify it under" },
                     96:   { SGTEXT, 0, 0, 1,11, 38,1, "the terms of the GNU General Public" },
                     97:   { SGTEXT, 0, 0, 1,12, 38,1, "License as published by the Free Soft-" },
                     98:   { SGTEXT, 0, 0, 1,13, 38,1, "ware Foundation; either version 2 of" },
                     99:   { SGTEXT, 0, 0, 1,14, 38,1, "the License, or (at your option) any" },
                    100:   { SGTEXT, 0, 0, 1,15, 38,1, "later version." },
                    101:   { SGTEXT, 0, 0, 1,17, 38,1, "This program is distributed in the" },
                    102:   { SGTEXT, 0, 0, 1,18, 38,1, "hope that it will be useful, but" },
                    103:   { SGTEXT, 0, 0, 1,19, 38,1, "WITHOUT ANY WARRANTY. See the GNU Ge-" },
                    104:   { SGTEXT, 0, 0, 1,20, 38,1, "neral Public License for more details." },
                    105:   { SGBUTTON, 0, 0, 16,23, 8,1, "Okay" },
                    106:   { -1, 0, 0, 0,0, 0,0, NULL }
                    107: };
                    108: 
                    109: 
                    110: /* The discs dialog: */
                    111: #define DISCDLG_DISCA       4
                    112: #define DISCDLG_BROWSEA     5
                    113: #define DISCDLG_DISCB       7
                    114: #define DISCDLG_BROWSEB     8
                    115: #define DISCDLG_IMGDIR      10
                    116: #define DISCDLG_BROWSEIMG   11
                    117: #define DISCDLG_AUTOB       12
                    118: #define DISCDLG_CREATEIMG   13
                    119: #define DISCDLG_BROWSEHDIMG 17
                    120: #define DISCDLG_DISCHDIMG   18
                    121: #define DISCDLG_UNMOUNTGDOS 20
                    122: #define DISCDLG_BROWSEGDOS  21
                    123: #define DISCDLG_DISCGDOS    22
                    124: #define DISCDLG_BOOTHD      23
                    125: #define DISCDLG_EXIT        24
                    126: SGOBJ discdlg[] =
                    127: {
                    128:   { SGBOX, 0, 0, 0,0, 40,25, NULL },
                    129:   { SGBOX, 0, 0, 1,1, 38,11, NULL },
                    130:   { SGTEXT, 0, 0, 14,1, 12,1, "Floppy discs" },
                    131:   { SGTEXT, 0, 0, 2,3, 2,1, "A:" },
                    132:   { SGTEXT, 0, 0, 5,3, 26,1, NULL },
                    133:   { SGBUTTON, 0, 0, 32,3, 6,1, "Browse" },
                    134:   { SGTEXT, 0, 0, 2,5, 2,1, "B:" },
                    135:   { SGTEXT, 0, 0, 5,5, 26,1, NULL },
                    136:   { SGBUTTON, 0, 0, 32,5, 6,1, "Browse" },
                    137:   { SGTEXT, 0, 0, 2,7, 30,1, "Default disk images directory:" },
                    138:   { SGTEXT, 0, 0, 2,8, 28,1, NULL },
                    139:   { SGBUTTON, 0, 0, 32,8, 6,1, "Browse" },
                    140:   { SGCHECKBOX, 0, 0, 2,10, 18,1, "Auto insert B" },
                    141:   { SGTEXT/*SGBUTTON*/, 0, 0, 20,10, 18,1, ""/*"Create blank image"*/ }, /* Not yet supported */
                    142:   { SGBOX, 0, 0, 1,13, 38,9, NULL },
                    143:   { SGTEXT, 0, 0, 15,13, 10,1, "Hard discs" },
                    144:   { SGTEXT, 0, 0, 2,14, 9,1, "HD image:" },
                    145:   { SGBUTTON, 0, 0, 32,14, 6,1, "Browse" },
                    146:   { SGTEXT, 0, 0, 2,15, 36,1, NULL },
                    147:   { SGTEXT, 0, 0, 2,17, 13,1, "GEMDOS drive:" },
                    148:   { SGBUTTON, 0, 0, 30,17, 1,1, "\x01" },         /* Up-arrow button for unmounting */
                    149:   { SGBUTTON, 0, 0, 32,17, 6,1, "Browse" },
                    150:   { SGTEXT, 0, 0, 2,18, 36,1, NULL },
                    151:   { SGCHECKBOX, 0, 0, 2,20, 14,1, "Boot from HD" },
                    152:   { SGBUTTON, 0, 0, 10,23, 20,1, "Back to main menu" },
                    153:   { -1, 0, 0, 0,0, 0,0, NULL }
                    154: };
                    155: 
                    156: 
                    157: /* The TOS/GEM dialog: */
1.1.1.3   root      158: #define DLGTOSGEM_ROMNAME    4
                    159: #define DLGTOSGEM_ROMBROWSE  5
                    160: #define DLGTOSGEM_GEMRES     8
                    161: #define DLGTOSGEM_RES640     10
                    162: #define DLGTOSGEM_RES800     11
                    163: #define DLGTOSGEM_RES1024    12
                    164: #define DLGTOSGEM_BPP1       14
                    165: #define DLGTOSGEM_BPP2       15
                    166: #define DLGTOSGEM_BPP4       16
                    167: #define DLGTOSGEM_EXIT       17
1.1.1.2   root      168: SGOBJ tosgemdlg[] =
                    169: {
1.1.1.3   root      170:   { SGBOX, 0, 0, 0,0, 40,24, NULL },
                    171:   { SGBOX, 0, 0, 1,1, 38,8, NULL },
                    172:   { SGTEXT, 0, 0, 16,2, 9,1, "TOS setup" },
                    173:   { SGTEXT, 0, 0, 2,5, 25,1, "ROM image (needs reset!):" },
                    174:   { SGTEXT, 0, 0, 2,7, 34,1, NULL },
                    175:   { SGBUTTON, 0, 0, 30,5, 8,1, "Browse" },
                    176:   { SGBOX, 0, 0, 1,10, 38,10, NULL },
                    177:   { SGTEXT, 0, 0, 16,11, 9,1, "GEM setup" },
                    178:   { SGCHECKBOX, 0, 0, 2,13, 25,1, "Use extended resolution" },
                    179:   { SGTEXT, 0, 0, 2,15, 11,1, "Resolution:" },
                    180:   { SGRADIOBUT, 0, 0, 4,16, 9,1, "640x480" },
                    181:   { SGRADIOBUT, 0, 0, 16,16, 9,1, "800x600" },
                    182:   { SGRADIOBUT, 0, 0, 28,16, 10,1, "1024x768" },
                    183:   { SGTEXT, 0, 0, 2,18, 6,1, "Depth:" },
                    184:   { SGRADIOBUT, 0, 0, 11,18, 6,1, "1bpp" },
                    185:   { SGRADIOBUT, 0, 0, 20,18, 6,1, "2bpp" },
                    186:   { SGRADIOBUT, 0, 0, 29,18, 6,1, "4bpp" },
                    187:   { SGBUTTON, 0, 0, 10,22, 20,1, "Back to main menu" },
1.1.1.2   root      188:   { -1, 0, 0, 0,0, 0,0, NULL }
                    189: };
                    190: 
                    191: 
                    192: /* The screen dialog: */
1.1.1.4 ! root      193: #define DLGSCRN_FULLSCRN   3
        !           194: #define DLGSCRN_INTERLACE  4
        !           195: #define DLGSCRN_FRAMESKIP  5
        !           196: #define DLGSCRN_COLOR      7
        !           197: #define DLGSCRN_MONO       8
        !           198: #define DLGSCRN_8BPP       10
        !           199: #define DLGSCRN_LOW320     11
        !           200: #define DLGSCRN_LOW640     12
        !           201: #define DLGSCRN_LOW800     13
        !           202: #define DLGSCRN_ONCHANGE   16
        !           203: #define DLGSCRN_FPSPOPUP   18
        !           204: #define DLGSCRN_CAPTURE    19
        !           205: #define DLGSCRN_RECANIM    20
        !           206: #define DLGSCRN_EXIT       21
1.1.1.2   root      207: SGOBJ screendlg[] =
                    208: {
                    209:   { SGBOX, 0, 0, 0,0, 40,25, NULL },
1.1.1.4 ! root      210:   { SGBOX, 0, 0, 1,1, 38,13, NULL },
1.1.1.2   root      211:   { SGTEXT, 0, 0, 13,2, 14,1, "Screen options" },
1.1.1.4 ! root      212:   { SGCHECKBOX, 0, 0, 4,4, 12,1, "Fullscreen" },
        !           213:   { SGCHECKBOX, 0, 0, 4,5, 23,1, "Interlaced mode (in fullscreen)" },
        !           214:   { SGCHECKBOX, 0, 0, 4,6, 10,1, "Frame skip" },
        !           215:   /*{ SGCHECKBOX, 0, 0, 4,7, 13,1, "Use borders" },*/
        !           216:   { SGTEXT, 0, 0, 4,8, 8,1, "Monitor:" },
        !           217:   { SGRADIOBUT, 0, 0, 15,8, 7,1, "Color" },
        !           218:   { SGRADIOBUT, 0, 0, 25,8, 6,1, "Mono" },
        !           219:   { SGTEXT, 0, 0, 4,10, 23,1, "ST-Low fullscreen mode:" },
        !           220:   { SGCHECKBOX, 0, 0, 30,10, 7,1, "8 bpp" },
        !           221:   { SGRADIOBUT, 0, 0, 5,12, 9,1, "320x240" },
        !           222:   { SGRADIOBUT, 0, 0, 16,12, 9,1, "640x480" },
        !           223:   { SGRADIOBUT, 0, 0, 27,12, 9,1, "800x600" },
        !           224:   { SGBOX, 0, 0, 1,15, 38,7, NULL },
        !           225:   { SGTEXT, 0, 0, 13,16, 14,1, "Screen capture" },
        !           226:   { SGCHECKBOX, 0, 0, 3,18, 27,1, "Only when display changes" },
        !           227:   { SGTEXT, 0, 0, 31,18, 4,1, ""/*"FPS:"*/ },
        !           228:   { SGTEXT/*SGPOPUP*/, 0, 0, 36,18, 3,1, ""/*"25"*/ },
1.1.1.2   root      229:   { SGBUTTON, 0, 0, 3,20, 16,1, "Capture screen" },
                    230:   { SGBUTTON, 0, 0, 20,20, 18,1, NULL },
                    231:   { SGBUTTON, 0, 0, 10,23, 20,1, "Back to main menu" },
                    232:   { -1, 0, 0, 0,0, 0,0, NULL }
                    233: };
                    234: 
                    235: 
                    236: /* The sound dialog: */
                    237: #define DLGSOUND_ENABLE  3
                    238: #define DLGSOUND_LOW     5
                    239: #define DLGSOUND_MEDIUM  6
                    240: #define DLGSOUND_HIGH    7
1.1.1.3   root      241: #define DLGSOUND_YM      10
                    242: #define DLGSOUND_WAV     11
                    243: #define DLGSOUND_RECORD  12
                    244: #define DLGSOUND_EXIT    13
1.1.1.2   root      245: SGOBJ sounddlg[] =
                    246: {
1.1.1.3   root      247:   { SGBOX, 0, 0, 0,0, 38,24, NULL },
1.1.1.2   root      248:   { SGBOX, 0, 0, 1,1, 36,11, NULL },
                    249:   { SGTEXT, 0, 0, 13,2, 13,1, "Sound options" },
                    250:   { SGCHECKBOX, 0, 0, 12,4, 14,1, "Enable sound" },
                    251:   { SGTEXT, 0, 0, 11,6, 14,1, "Playback quality:" },
                    252:   { SGRADIOBUT, 0, 0, 12,8, 15,1, "Low (11kHz)" },
                    253:   { SGRADIOBUT, 0, 0, 12,9, 19,1, "Medium (22kHz)" },
                    254:   { SGRADIOBUT, 0, 0, 12,10, 14,1, "High (44kHz)" },
                    255:   { SGBOX, 0, 0, 1,13, 36,7, NULL },
                    256:   { SGTEXT, 0, 0, 13,14, 14,1, "Capture YM/WAV" },
1.1.1.3   root      257:   { SGRADIOBUT, 0, SG_SELECTED, 7,16, 11,1, "hatari.ym" },
                    258:   { SGRADIOBUT, 0, 0, 20,16, 12,1, "hatari.wav" },
                    259:   { SGBUTTON, 0, 0, 12,18, 16,1, NULL },
                    260:   { SGBUTTON, 0, 0, 10,22, 20,1, "Back to main menu" },
1.1.1.2   root      261:   { -1, 0, 0, 0,0, 0,0, NULL }
                    262: };
                    263: 
                    264: 
1.1.1.3   root      265: /* The "System" dialog: */
                    266: #define DLGSYS_68000 3
                    267: #define DLGSYS_68010 4
                    268: #define DLGSYS_68020 5
                    269: #define DLGSYS_68030 6
                    270: #define DLGSYS_68040 7
                    271: #define DLGSYS_PREFETCH 8
                    272: #define DLGSYS_BLITTER 9
                    273: SGOBJ systemdlg[] =
1.1.1.2   root      274: {
1.1.1.3   root      275:   { SGBOX, 0, 0, 0,0, 30,17, NULL },
                    276:   { SGTEXT, 0, 0, 8,1, 14,1, "System options" },
1.1.1.2   root      277:   { SGTEXT, 0, 0, 3,4, 8,1, "CPU Type:" },
                    278:   { SGRADIOBUT, 0, 0, 16,4, 7,1, "68000" },
                    279:   { SGRADIOBUT, 0, 0, 16,5, 7,1, "68010" },
                    280:   { SGRADIOBUT, 0, 0, 16,6, 7,1, "68020" },
                    281:   { SGRADIOBUT, 0, 0, 16,7, 11,1, "68020+FPU" },
                    282:   { SGRADIOBUT, 0, 0, 16,8, 7,1, "68040" },
1.1.1.3   root      283:   { SGCHECKBOX, 0, 0, 3,10, 24,1, "Use CPU prefetch mode" },
                    284:   { SGCHECKBOX, 0, 0, 3,12, 20,1, "Blitter emulation" },
                    285:   { SGBUTTON, 0, 0, 5,15, 20,1, "Back to main menu" },
1.1.1.2   root      286:   { -1, 0, 0, 0,0, 0,0, NULL }
                    287: };
                    288: 
                    289: 
                    290: /* The memory dialog: */
1.1.1.3   root      291: #define DLGMEM_512KB   4
                    292: #define DLGMEM_1MB     5
                    293: #define DLGMEM_2MB     6
                    294: #define DLGMEM_4MB     7
                    295: #define DLGMEM_EXIT    8/*14*/
1.1.1.2   root      296: SGOBJ memorydlg[] =
                    297: {
1.1.1.3   root      298:   { SGBOX, 0, 0, 0,0, 40,11/*21*/, NULL },
1.1.1.2   root      299:   { SGBOX, 0, 0, 1,1, 38,7, NULL },
                    300:   { SGTEXT, 0, 0, 15,2, 12,1, "Memory setup" },
                    301:   { SGTEXT, 0, 0, 4,4, 12,1, "ST-RAM size:" },
                    302:   { SGRADIOBUT, 0, 0, 19,4, 8,1, "512 kB" },
                    303:   { SGRADIOBUT, 0, 0, 30,4, 6,1, "1 MB" },
                    304:   { SGRADIOBUT, 0, 0, 19,6, 6,1, "2 MB" },
                    305:   { SGRADIOBUT, 0, 0, 30,6, 6,1, "4 MB" },
                    306: /*
1.1.1.3   root      307:   { SGBOX, 0, 0, 1,11, 38,7, NULL },
                    308:   { SGTEXT, 0, 0, 12,12, 17,1, "Memory state save" },
                    309:   { SGTEXT, 0, 0, 2,14, 28,1, "/Sorry/Not/yet/supported" },
                    310:   { SGBUTTON, 0, 0, 32,14, 6,1, "Browse" },
                    311:   { SGBUTTON, 0, 0, 8,16, 10,1, "Save" },
                    312:   { SGBUTTON, 0, 0, 22,16, 10,1, "Restore" },
1.1.1.2   root      313: */
1.1.1.3   root      314:   { SGBUTTON, 0, 0, 10,9/*19*/, 20,1, "Back to main menu" },
1.1.1.2   root      315:   { -1, 0, 0, 0,0, 0,0, NULL }
                    316: };
                    317: 
                    318: 
                    319: /* The joysticks dialog: */
                    320: #define DLGJOY_J1CURSOR    4
                    321: #define DLGJOY_J1AUTOFIRE  5
                    322: #define DLGJOY_J0CURSOR    8
                    323: #define DLGJOY_J0AUTOFIRE  9
                    324: #define DLGJOY_EXIT        10
                    325: SGOBJ joystickdlg[] =
                    326: {
                    327:   { SGBOX, 0, 0, 0,0, 30,19, NULL },
                    328:   { SGTEXT, 0, 0, 7,1, 15,1, "Joysticks setup" },
                    329:   { SGBOX, 0, 0, 1,3, 28,6, NULL },
                    330:   { SGTEXT, 0, 0, 2,4, 11,1, "Joystick 1:" },
                    331:   { SGCHECKBOX, 0, 0, 5,6, 22,1, "Use cursor emulation" },
                    332:   { SGCHECKBOX, 0, 0, 5,7, 17,1, "Enable autofire" },
                    333:   { SGBOX, 0, 0, 1,10, 28,6, NULL },
                    334:   { SGTEXT, 0, 0, 2,11, 11,1, "Joystick 0:" },
                    335:   { SGCHECKBOX, 0, 0, 5,13, 22,1, "Use cursor emulation" },
                    336:   { SGCHECKBOX, 0, 0, 5,14, 17,1, "Enable autofire" },
                    337:   { SGBUTTON, 0, 0, 5,17, 20,1, "Back to main menu" },
                    338:   { -1, 0, 0, 0,0, 0,0, NULL }
                    339: };
                    340: 
                    341: 
                    342: /* The keyboard dialog: */
                    343: SGOBJ keyboarddlg[] =
                    344: {
                    345:   { SGBOX, 0, 0, 0,0, 30,8, NULL },
                    346:   { SGTEXT, 0, 0, 8,2, 14,1, "Keyboard setup" },
                    347:   { SGTEXT, 0, 0, 2,4, 25,1, "Sorry, not yet supported." },
                    348:   { SGBUTTON, 0, 0, 5,6, 20,1, "Back to main menu" },
                    349:   { -1, 0, 0, 0,0, 0,0, NULL }
                    350: };
                    351: 
                    352: 
                    353: /* The devices dialog: */
                    354: SGOBJ devicedlg[] =
                    355: {
                    356:   { SGBOX, 0, 0, 0,0, 30,8, NULL },
                    357:   { SGTEXT, 0, 0, 8,2, 13,1, "Devices setup" },
                    358:   { SGTEXT, 0, 0, 2,4, 25,1, "Sorry, not yet supported." },
                    359:   { SGBUTTON, 0, 0, 5,6, 20,1, "Back to main menu" },
                    360:   { -1, 0, 0, 0,0, 0,0, NULL }
                    361: };
1.1       root      362: 
                    363: 
                    364: 
1.1.1.2   root      365: DLG_PARAMS ConfigureParams, DialogParams;   /* List of configuration for system and dialog (so can choose 'Cancel') */
                    366: 
                    367: 
                    368: 
                    369: /*-----------------------------------------------------------------------*/
1.1       root      370: /*
                    371:   Check if need to warn user that changes will take place after reset
                    372:   Return TRUE if wants to reset
                    373: */
                    374: BOOL Dialog_DoNeedReset(void)
                    375: {
1.1.1.2   root      376:   /* Did we change colour/mono monitor? If so, must reset */
1.1       root      377:   if (ConfigureParams.Screen.bUseHighRes!=DialogParams.Screen.bUseHighRes)
                    378:     return(TRUE);
1.1.1.2   root      379:   /* Did change to GEM VDI display? */
1.1       root      380:   if (ConfigureParams.TOSGEM.bUseExtGEMResolutions!=DialogParams.TOSGEM.bUseExtGEMResolutions)
                    381:     return(TRUE);
1.1.1.2   root      382:   /* Did change GEM resolution or colour depth? */
1.1.1.3   root      383:   if ( DialogParams.TOSGEM.bUseExtGEMResolutions &&
                    384:       ((ConfigureParams.TOSGEM.nGEMResolution!=DialogParams.TOSGEM.nGEMResolution)
                    385:        || (ConfigureParams.TOSGEM.nGEMColours!=DialogParams.TOSGEM.nGEMColours)) )
1.1       root      386:     return(TRUE);
1.1.1.2   root      387:   /* Did change TOS ROM image? */
                    388:   if (strcmp(DialogParams.TOSGEM.szTOSImageFileName, ConfigureParams.TOSGEM.szTOSImageFileName))
                    389:     return(TRUE);
                    390:   /* Did change HD image? */
                    391:   if (strcmp(DialogParams.HardDisc.szHardDiscImage, ConfigureParams.HardDisc.szHardDiscImage))
                    392:     return(TRUE);
                    393:   /* Did change GEMDOS drive? */
                    394:   if (strcmp(DialogParams.HardDisc.szHardDiscDirectories[0], ConfigureParams.HardDisc.szHardDiscDirectories[0]))
                    395:     return(TRUE);
1.1       root      396: 
                    397:   return(FALSE);
                    398: }
                    399: 
1.1.1.2   root      400: 
                    401: /*-----------------------------------------------------------------------*/
1.1       root      402: /*
                    403:   Copy details back to configuration and perform reset
                    404: */
                    405: void Dialog_CopyDialogParamsToConfiguration(BOOL bForceReset)
                    406: {
                    407:   BOOL NeedReset;
1.1.1.2   root      408:   BOOL newGemdosDrive;
1.1       root      409: 
1.1.1.2   root      410:   /* Do we need to warn user of that changes will only take effect after reset? */
1.1       root      411:   if (bForceReset)
                    412:     NeedReset = bForceReset;
                    413:   else
                    414:     NeedReset = Dialog_DoNeedReset();
                    415: 
1.1.1.2   root      416:   /* Do need to change resolution? Need if change display/overscan settings */
                    417:   /*(if switch between Colour/Mono cause reset later) */
                    418:   if(bInFullScreen)
                    419:   {
                    420:     if( (DialogParams.Screen.ChosenDisplayMode!=ConfigureParams.Screen.ChosenDisplayMode)
                    421:        || (DialogParams.Screen.Advanced.bAllowOverscan!=ConfigureParams.Screen.Advanced.bAllowOverscan) )
                    422:     {
1.1       root      423:       Screen_ReturnFromFullScreen();
                    424:       ConfigureParams.Screen.ChosenDisplayMode = DialogParams.Screen.ChosenDisplayMode;
                    425:       ConfigureParams.Screen.Advanced.bAllowOverscan = DialogParams.Screen.Advanced.bAllowOverscan;
                    426:       Screen_EnterFullScreen();
                    427:     }
                    428:   }
1.1.1.2   root      429: 
                    430:   /* Did set new printer parameters? */
                    431:   if( (DialogParams.Printer.bEnablePrinting!=ConfigureParams.Printer.bEnablePrinting)
                    432:      || (DialogParams.Printer.bPrintToFile!=ConfigureParams.Printer.bPrintToFile)
                    433:      || (strcmp(DialogParams.Printer.szPrintToFileName,ConfigureParams.Printer.szPrintToFileName)) )
1.1       root      434:     Printer_CloseAllConnections();
1.1.1.2   root      435: 
                    436:   /* Did set new RS232 parameters? */
                    437:   if( (DialogParams.RS232.bEnableRS232!=ConfigureParams.RS232.bEnableRS232)
                    438:      || (DialogParams.RS232.nCOMPort!=ConfigureParams.RS232.nCOMPort) )
1.1       root      439:     RS232_CloseCOMPort();
1.1.1.2   root      440: 
                    441:   /* Did stop sound? Or change playback Hz. If so, also stop sound recording */
                    442:   if( (!DialogParams.Sound.bEnableSound)
                    443:      || (DialogParams.Sound.nPlaybackQuality!=ConfigureParams.Sound.nPlaybackQuality) )
                    444:   {
                    445:     if(Sound_AreWeRecording())
1.1       root      446:       Sound_EndRecording(NULL);
                    447:   }
                    448: 
1.1.1.2   root      449:   /* Did change GEMDOS drive? */
                    450:   if( strcmp(DialogParams.HardDisc.szHardDiscDirectories[0], ConfigureParams.HardDisc.szHardDiscDirectories[0])!=0 )
                    451:   {
                    452:     GemDOS_UnInitDrives();
                    453:     newGemdosDrive = TRUE;
                    454:   }
                    455:   else
                    456:   {
                    457:     newGemdosDrive = FALSE;
                    458:   }
                    459: 
                    460:   /* Did change HD image? */
                    461:   if( strcmp(DialogParams.HardDisc.szHardDiscImage, ConfigureParams.HardDisc.szHardDiscImage)!=0
                    462:      && ACSI_EMU_ON )
                    463:   {
                    464:     HDC_UnInit();
                    465:   }
                    466: 
1.1.1.3   root      467: 
1.1.1.2   root      468:   /* Copy details to configuration, so can be saved out or set on reset */
1.1       root      469:   ConfigureParams = DialogParams;
1.1.1.2   root      470:   /* And write to configuration now, so don't loose */
1.1       root      471:   Configuration_UnInit();
                    472: 
1.1.1.2   root      473:   /* Copy details to global, if we reset copy them all */
1.1       root      474:   Dialog_CopyDetailsFromConfiguration(NeedReset);
                    475: 
1.1.1.2   root      476:   /* Set keyboard remap file */
                    477:   /*Keymap_LoadRemapFile(ConfigureParams.Keyboard.szMappingFileName);*/
                    478: 
                    479:   /* Resize window if need */
                    480:   /*if(!ConfigureParams.TOSGEM.bUseExtGEMResolutions)
                    481:     View_ResizeWindowToFull();*/
                    482: 
                    483:   /* Did the user changed the CPU mode? */
1.1.1.3   root      484:   check_prefs_changed_cpu(DialogParams.System.nCpuLevel, DialogParams.System.bCompatibleCpu);
1.1.1.2   root      485: 
                    486:   /* Mount a new HD image: */
                    487:   if( !ACSI_EMU_ON && !File_DoesFileNameEndWithSlash(ConfigureParams.HardDisc.szHardDiscImage)
                    488:       && File_Exists(ConfigureParams.HardDisc.szHardDiscImage) )
                    489:   {
                    490:     HDC_Init(ConfigureParams.HardDisc.szHardDiscImage);
                    491:   }
                    492: 
                    493:   /* Mount a new GEMDOS drive? */
                    494:   if( newGemdosDrive )
                    495:   {
                    496:     GemDOS_InitDrives();
                    497:   }
                    498: 
1.1.1.3   root      499:   /* Did change blitter status? */
                    500:   Intercept_EnableBlitter(ConfigureParams.System.bBlitter);
                    501: 
1.1.1.2   root      502:   /* Do we need to perform reset? */
                    503:   if (NeedReset)
                    504:   {
1.1       root      505:     Reset_Cold();
1.1.1.2   root      506:     /*FM  View_ToggleWindowsMouse(MOUSE_ST);*/
1.1       root      507:   }
                    508: 
1.1.1.2   root      509:   /* Go into/return from full screen if flagged */
1.1       root      510:   if ( (!bInFullScreen) && (DialogParams.Screen.bFullScreen) )
                    511:     Screen_EnterFullScreen();
                    512:   else if ( bInFullScreen && (!DialogParams.Screen.bFullScreen) )
                    513:     Screen_ReturnFromFullScreen();
                    514: }
                    515: 
                    516: 
                    517: 
1.1.1.2   root      518: /*-----------------------------------------------------------------------*/
1.1       root      519: /*
                    520:   Copy details from configuration structure into global variables for system
                    521: */
                    522: void Dialog_CopyDetailsFromConfiguration(BOOL bReset)
                    523: {
1.1.1.2   root      524:   /* Set new timer thread */
                    525: /*FM  Main_SetSpeedThreadTimer(ConfigureParams.Configure.nMinMaxSpeed);*/
                    526:   /* Set resolution change */
1.1.1.3   root      527:   if (bReset)
                    528:   {
1.1       root      529:     bUseVDIRes = ConfigureParams.TOSGEM.bUseExtGEMResolutions;
1.1.1.3   root      530:     bUseHighRes = (!bUseVDIRes && ConfigureParams.Screen.bUseHighRes)
                    531:                      || (bUseVDIRes && ConfigureParams.TOSGEM.nGEMColours==GEMCOLOUR_2);
                    532:     VDI_SetResolution(ConfigureParams.TOSGEM.nGEMResolution, ConfigureParams.TOSGEM.nGEMColours);
1.1       root      533:   }
                    534: 
1.1.1.2   root      535:   /* Set playback frequency */
                    536:   if( ConfigureParams.Sound.bEnableSound )
                    537:     Audio_SetOutputAudioFreq(ConfigureParams.Sound.nPlaybackQuality);
                    538: 
1.1.1.3   root      539:   /* Remove slashes, etc.. from names */
1.1       root      540:   File_CleanFileName(ConfigureParams.TOSGEM.szTOSImageFileName);
                    541: }
                    542: 
1.1.1.2   root      543: 
                    544: 
                    545: /*-----------------------------------------------------------------------*/
1.1       root      546: /*
1.1.1.2   root      547:   Show and process the disc image dialog.
1.1       root      548: */
1.1.1.2   root      549: void Dialog_DiscDlg(void)
1.1       root      550: {
1.1.1.2   root      551:   int but;
                    552:   char tmpname[MAX_FILENAME_LENGTH];
                    553:   char dlgnamea[40], dlgnameb[40], dlgdiscdir[40];
                    554:   char dlgnamegdos[40], dlgnamehdimg[40];
1.1       root      555: 
1.1.1.2   root      556:   SDLGui_CenterDlg(discdlg);
1.1       root      557: 
1.1.1.2   root      558:   /* Set up dialog to actual values: */
1.1       root      559: 
1.1.1.2   root      560:   /* Disc name A: */
                    561:   if( EmulationDrives[0].bDiscInserted )
                    562:     File_ShrinkName(dlgnamea, EmulationDrives[0].szFileName, discdlg[DISCDLG_DISCA].w);
                    563:   else
                    564:     dlgnamea[0] = 0;
                    565:   discdlg[DISCDLG_DISCA].txt = dlgnamea;
1.1       root      566: 
1.1.1.2   root      567:   /* Disc name B: */
                    568:   if( EmulationDrives[1].bDiscInserted )
                    569:     File_ShrinkName(dlgnameb, EmulationDrives[1].szFileName, discdlg[DISCDLG_DISCB].w);
                    570:   else
                    571:     dlgnameb[0] = 0;
                    572:   discdlg[DISCDLG_DISCB].txt = dlgnameb;
1.1       root      573: 
1.1.1.2   root      574:   /* Default image directory: */
                    575:   File_ShrinkName(dlgdiscdir, DialogParams.DiscImage.szDiscImageDirectory, discdlg[DISCDLG_IMGDIR].w);
                    576:   discdlg[DISCDLG_IMGDIR].txt = dlgdiscdir;
                    577: 
                    578:   /* Auto insert disc B: */
                    579:   if( DialogParams.DiscImage.bAutoInsertDiscB )
                    580:     discdlg[DISCDLG_AUTOB].state |= SG_SELECTED;
                    581:    else
                    582:     discdlg[DISCDLG_AUTOB].state &= ~SG_SELECTED;
                    583: 
                    584:   /* Boot from harddisk? */
                    585:   if( DialogParams.HardDisc.bBootFromHardDisc )
                    586:     discdlg[DISCDLG_BOOTHD].state |= SG_SELECTED;
                    587:    else
                    588:     discdlg[DISCDLG_BOOTHD].state &= ~SG_SELECTED;
                    589: 
                    590:   /* GEMDOS Hard disc directory: */
                    591:   if( strcmp(DialogParams.HardDisc.szHardDiscDirectories[0], ConfigureParams.HardDisc.szHardDiscDirectories[0])!=0
                    592:       || GEMDOS_EMU_ON )
                    593:     File_ShrinkName(dlgnamegdos, DialogParams.HardDisc.szHardDiscDirectories[0], discdlg[DISCDLG_DISCGDOS].w);
                    594:   else
                    595:     dlgnamegdos[0] = 0;
                    596:   discdlg[DISCDLG_DISCGDOS].txt = dlgnamegdos;
1.1       root      597: 
1.1.1.2   root      598:   /* Hard disc image: */
                    599:   if( ACSI_EMU_ON )
                    600:     File_ShrinkName(dlgnamehdimg, DialogParams.HardDisc.szHardDiscImage, discdlg[DISCDLG_DISCHDIMG].w);
                    601:   else
                    602:     dlgnamehdimg[0] = 0;
                    603:   discdlg[DISCDLG_DISCHDIMG].txt = dlgnamehdimg;
1.1       root      604: 
1.1.1.2   root      605:   /* Draw and process the dialog */
                    606:   do
                    607:   {
                    608:     but = SDLGui_DoDialog(discdlg);
                    609:     switch(but)
                    610:     {
                    611:       case DISCDLG_BROWSEA:                       /* Choose a new disc A: */
                    612:         if( EmulationDrives[0].bDiscInserted )
                    613:           strcpy(tmpname, EmulationDrives[0].szFileName);
                    614:          else
                    615:           strcpy(tmpname, DialogParams.DiscImage.szDiscImageDirectory);
                    616:         if( SDLGui_FileSelect(tmpname) )
                    617:         {
                    618:           if( !File_DoesFileNameEndWithSlash(tmpname) && File_Exists(tmpname) )
                    619:           {
                    620:             Floppy_InsertDiscIntoDrive(0, tmpname); /* FIXME: This shouldn't be done here but in Dialog_CopyDialogParamsToConfiguration */
                    621:             File_ShrinkName(dlgnamea, tmpname, discdlg[DISCDLG_DISCA].w);
                    622:           }
                    623:           else
                    624:           {
                    625:             Floppy_EjectDiscFromDrive(0, FALSE); /* FIXME: This shouldn't be done here but in Dialog_CopyDialogParamsToConfiguration */
                    626:             dlgnamea[0] = 0;
                    627:           }
                    628:         }
                    629:         break;
                    630:       case DISCDLG_BROWSEB:                       /* Choose a new disc B: */
                    631:         if( EmulationDrives[1].bDiscInserted )
                    632:           strcpy(tmpname, EmulationDrives[1].szFileName);
                    633:          else
                    634:           strcpy(tmpname, DialogParams.DiscImage.szDiscImageDirectory);
                    635:         if( SDLGui_FileSelect(tmpname) )
                    636:         {
                    637:           if( !File_DoesFileNameEndWithSlash(tmpname) && File_Exists(tmpname) )
                    638:           {
                    639:             Floppy_InsertDiscIntoDrive(1, tmpname); /* FIXME: This shouldn't be done here but in Dialog_CopyDialogParamsToConfiguration */
                    640:             File_ShrinkName(dlgnameb, tmpname, discdlg[DISCDLG_DISCB].w);
                    641:           }
                    642:           else
                    643:           {
                    644:             Floppy_EjectDiscFromDrive(1, FALSE); /* FIXME: This shouldn't be done here but in Dialog_CopyDialogParamsToConfiguration */
                    645:             dlgnameb[0] = 0;
                    646:           }
                    647:         }
                    648:         break;
                    649:       case DISCDLG_BROWSEIMG:
                    650:         strcpy(tmpname, DialogParams.DiscImage.szDiscImageDirectory);
                    651:         if( SDLGui_FileSelect(tmpname) )
                    652:         {
                    653:           char *ptr;
                    654:           ptr = strrchr(tmpname, '/');
                    655:           if( ptr!=NULL )  ptr[1]=0;
                    656:           strcpy(DialogParams.DiscImage.szDiscImageDirectory, tmpname);
                    657:           File_ShrinkName(dlgdiscdir, DialogParams.DiscImage.szDiscImageDirectory, discdlg[DISCDLG_IMGDIR].w);
                    658:         }
                    659:         break;
                    660:       case DISCDLG_CREATEIMG:
                    661:         fprintf(stderr,"Sorry, creating disc images not yet supported\n");
                    662:         break;
                    663:       case DISCDLG_UNMOUNTGDOS:
                    664:         GemDOS_UnInitDrives();   /* FIXME: This shouldn't be done here but it's the only quick solution I could think of */
                    665:         strcpy(DialogParams.HardDisc.szHardDiscDirectories[0], ConfigureParams.HardDisc.szHardDiscDirectories[0]);
                    666:         dlgnamegdos[0] = 0;
                    667:         break;
                    668:       case DISCDLG_BROWSEGDOS:
                    669:         strcpy(tmpname, DialogParams.HardDisc.szHardDiscDirectories[0]);
                    670:         if( SDLGui_FileSelect(tmpname) )
                    671:         {
                    672:           char *ptr;
                    673:           ptr = strrchr(tmpname, '/');
                    674:           if( ptr!=NULL )  ptr[1]=0;        /* Remove file name from path */
                    675:           strcpy(DialogParams.HardDisc.szHardDiscDirectories[0], tmpname);
                    676:           File_ShrinkName(dlgnamegdos, DialogParams.HardDisc.szHardDiscDirectories[0], discdlg[DISCDLG_DISCGDOS].w);
                    677:         }
                    678:         break;
                    679:       case DISCDLG_BROWSEHDIMG:
                    680:         strcpy(tmpname, DialogParams.HardDisc.szHardDiscImage);
                    681:         if( SDLGui_FileSelect(tmpname) )
                    682:         {
                    683:           strcpy(DialogParams.HardDisc.szHardDiscImage, tmpname);
                    684:           if( !File_DoesFileNameEndWithSlash(tmpname) && File_Exists(tmpname) )
                    685:           {
                    686:             File_ShrinkName(dlgnamehdimg, tmpname, discdlg[DISCDLG_DISCHDIMG].w);
                    687:           }
                    688:           else
                    689:           {
                    690:             dlgnamehdimg[0] = 0;
                    691:           }
                    692:         }
                    693:         break;
                    694:     }
                    695:   }
                    696:   while(but!=DISCDLG_EXIT && !bQuitProgram);
                    697: 
                    698:   /* Read values from dialog */
                    699:   DialogParams.DiscImage.bAutoInsertDiscB = (discdlg[DISCDLG_AUTOB].state & SG_SELECTED);
                    700:   DialogParams.HardDisc.bBootFromHardDisc = (discdlg[DISCDLG_BOOTHD].state & SG_SELECTED);
1.1       root      701: }
                    702: 
1.1.1.2   root      703: 
                    704: /*-----------------------------------------------------------------------*/
                    705: /*
                    706:   Show and process the TOS/GEM dialog.
                    707: */
                    708: void Dialog_TosGemDlg(void)
                    709: {
                    710:   char tmpname[MAX_FILENAME_LENGTH];
                    711:   char dlgromname[35];
                    712:   int but;
1.1.1.3   root      713:   int i;
1.1.1.2   root      714: 
                    715:   SDLGui_CenterDlg(tosgemdlg);
                    716:   File_ShrinkName(dlgromname, DialogParams.TOSGEM.szTOSImageFileName, 34);
                    717:   tosgemdlg[DLGTOSGEM_ROMNAME].txt = dlgromname;
                    718: 
1.1.1.3   root      719:   if( DialogParams.TOSGEM.bUseExtGEMResolutions )
                    720:     tosgemdlg[DLGTOSGEM_GEMRES].state |= SG_SELECTED;
                    721:    else
                    722:     tosgemdlg[DLGTOSGEM_GEMRES].state &= ~SG_SELECTED;
                    723: 
                    724:   for(i=0; i<3; i++)
                    725:   {
                    726:     tosgemdlg[DLGTOSGEM_RES640 + i].state &= ~SG_SELECTED;
                    727:     tosgemdlg[DLGTOSGEM_BPP1 + i].state &= ~SG_SELECTED;
                    728:   }
                    729:   tosgemdlg[DLGTOSGEM_RES640+DialogParams.TOSGEM.nGEMResolution-GEMRES_640x480].state |= SG_SELECTED;
                    730:   tosgemdlg[DLGTOSGEM_BPP1+DialogParams.TOSGEM.nGEMColours-GEMCOLOUR_2].state |= SG_SELECTED;
                    731: 
1.1.1.2   root      732:   do
                    733:   {
                    734:     but = SDLGui_DoDialog(tosgemdlg);
                    735:     switch( but )
                    736:     {
                    737:       case DLGTOSGEM_ROMBROWSE:
                    738:         strcpy(tmpname, DialogParams.TOSGEM.szTOSImageFileName);
                    739:         if(tmpname[0]=='.' && tmpname[1]=='/')  /* Is it in the actual working directory? */
                    740:         {
                    741:           getcwd(tmpname, MAX_FILENAME_LENGTH);
                    742:           File_AddSlashToEndFileName(tmpname);
                    743:           strcat(tmpname, &DialogParams.TOSGEM.szTOSImageFileName[2]);
                    744:         }
                    745:         if( SDLGui_FileSelect(tmpname) )        /* Show and process the file selection dlg */
                    746:         {
                    747:           strcpy(DialogParams.TOSGEM.szTOSImageFileName, tmpname);
                    748:           File_ShrinkName(dlgromname, DialogParams.TOSGEM.szTOSImageFileName, 34);
                    749:         }
                    750:         Screen_SetFullUpdate();
                    751:         Screen_Draw();
                    752:         break;
                    753:     }
1.1       root      754:   }
1.1.1.2   root      755:   while(but!=DLGTOSGEM_EXIT && !bQuitProgram);
                    756: 
1.1.1.3   root      757:   DialogParams.TOSGEM.bUseExtGEMResolutions = (tosgemdlg[DLGTOSGEM_GEMRES].state & SG_SELECTED);
                    758:   for(i=0; i<3; i++)
                    759:   {
                    760:     if(tosgemdlg[DLGTOSGEM_RES640 + i].state & SG_SELECTED)
                    761:          DialogParams.TOSGEM.nGEMResolution = GEMRES_640x480 + i;
                    762:     if(tosgemdlg[DLGTOSGEM_BPP1 + i].state & SG_SELECTED)
                    763:          DialogParams.TOSGEM.nGEMColours = GEMCOLOUR_2 + i;
                    764:   }
                    765: 
1.1       root      766: }
                    767: 
1.1.1.2   root      768: 
                    769: /*-----------------------------------------------------------------------*/
1.1       root      770: /*
1.1.1.2   root      771:   Show and process the screen dialog.
1.1       root      772: */
1.1.1.2   root      773: void Dialog_ScreenDlg(void)
1.1       root      774: {
1.1.1.4 ! root      775:   int but, i;
1.1.1.2   root      776: 
                    777:   SDLGui_CenterDlg(screendlg);
                    778: 
                    779:   /* Set up dialog from actual values: */
                    780: 
                    781:   if( DialogParams.Screen.bFullScreen )
                    782:     screendlg[DLGSCRN_FULLSCRN].state |= SG_SELECTED;
1.1       root      783:   else
1.1.1.2   root      784:     screendlg[DLGSCRN_FULLSCRN].state &= ~SG_SELECTED;
1.1       root      785: 
1.1.1.2   root      786:   if( DialogParams.Screen.Advanced.bInterlacedFullScreen )
                    787:     screendlg[DLGSCRN_INTERLACE].state |= SG_SELECTED;
                    788:   else
                    789:     screendlg[DLGSCRN_INTERLACE].state &= ~SG_SELECTED;
1.1       root      790: 
1.1.1.2   root      791:   if( DialogParams.Screen.Advanced.bFrameSkip )
                    792:     screendlg[DLGSCRN_FRAMESKIP].state |= SG_SELECTED;
                    793:   else
                    794:     screendlg[DLGSCRN_FRAMESKIP].state &= ~SG_SELECTED;
1.1       root      795: 
1.1.1.2   root      796:   if( DialogParams.Screen.bUseHighRes )
                    797:   {
                    798:     screendlg[DLGSCRN_COLOR].state &= ~SG_SELECTED;
                    799:     screendlg[DLGSCRN_MONO].state |= SG_SELECTED;
                    800:   }
                    801:   else
                    802:   {
                    803:     screendlg[DLGSCRN_COLOR].state |= SG_SELECTED;
                    804:     screendlg[DLGSCRN_MONO].state &= ~SG_SELECTED;
1.1       root      805:   }
                    806: 
1.1.1.4 ! root      807:   for(i=0; i<3; i++)
        !           808:     screendlg[DLGSCRN_LOW320 + i].state &= ~SG_SELECTED;
        !           809: 
        !           810:   if(DialogParams.Screen.ChosenDisplayMode <= DISPLAYMODE_16COL_FULL)
        !           811:   {
        !           812:     screendlg[DLGSCRN_8BPP].state |= SG_SELECTED;
        !           813:     screendlg[DLGSCRN_LOW320 + DialogParams.Screen.ChosenDisplayMode].state |= SG_SELECTED;
        !           814:   }
        !           815:   else
        !           816:   {
        !           817:     screendlg[DLGSCRN_8BPP].state &= ~SG_SELECTED;
        !           818:     screendlg[DLGSCRN_LOW320 + DialogParams.Screen.ChosenDisplayMode 
        !           819:               - DISPLAYMODE_HICOL_LOWRES].state |= SG_SELECTED;
        !           820:   }
        !           821: 
1.1.1.2   root      822:   if( DialogParams.Screen.bCaptureChange )
                    823:     screendlg[DLGSCRN_ONCHANGE].state |= SG_SELECTED;
                    824:   else
                    825:     screendlg[DLGSCRN_ONCHANGE].state &= ~SG_SELECTED;
1.1       root      826: 
1.1.1.2   root      827:   if( ScreenSnapShot_AreWeRecording() )
                    828:     screendlg[DLGSCRN_RECANIM].txt = "Stop recording";
                    829:   else
                    830:     screendlg[DLGSCRN_RECANIM].txt = "Record animation";
1.1       root      831: 
1.1.1.2   root      832:   /* The screen dialog main loop */
                    833:   do
                    834:   {
                    835:     but = SDLGui_DoDialog(screendlg);
                    836:     switch( but )
                    837:     {
                    838:       case DLGSCRN_FPSPOPUP:
                    839:         fprintf(stderr,"Sorry, popup menus don't work yet\n");
                    840:         break;
                    841:       case DLGSCRN_CAPTURE:
                    842:         Screen_SetFullUpdate();
                    843:         Screen_Draw();
                    844:         ScreenSnapShot_SaveScreen();
                    845:         break;
                    846:       case DLGSCRN_RECANIM:
                    847:         if( ScreenSnapShot_AreWeRecording() )
                    848:         {
                    849:           screendlg[DLGSCRN_RECANIM].txt = "Record animation";
                    850:           ScreenSnapShot_EndRecording();
                    851:         }
                    852:         else
                    853:         {
                    854:           screendlg[DLGSCRN_RECANIM].txt = "Stop recording";
                    855:           DialogParams.Screen.bCaptureChange = (screendlg[DLGSCRN_ONCHANGE].state & SG_SELECTED);
                    856:           ScreenSnapShot_BeginRecording(DialogParams.Screen.bCaptureChange, 25);
                    857:         }
                    858:         break;
                    859:     }
                    860:   }
                    861:   while( but!=DLGSCRN_EXIT && !bQuitProgram );
1.1       root      862: 
1.1.1.2   root      863:   /* Read values from dialog */
                    864:   DialogParams.Screen.bFullScreen = (screendlg[DLGSCRN_FULLSCRN].state & SG_SELECTED);
                    865:   DialogParams.Screen.Advanced.bInterlacedFullScreen = (screendlg[DLGSCRN_INTERLACE].state & SG_SELECTED);
                    866:   DialogParams.Screen.Advanced.bFrameSkip = (screendlg[DLGSCRN_FRAMESKIP].state & SG_SELECTED);
                    867:   DialogParams.Screen.bUseHighRes = (screendlg[DLGSCRN_MONO].state & SG_SELECTED);
                    868:   DialogParams.Screen.bCaptureChange = (screendlg[DLGSCRN_ONCHANGE].state & SG_SELECTED);
1.1.1.4 ! root      869: 
        !           870:   for(i=0; i<3; i++)
        !           871:   {
        !           872:     if(screendlg[DLGSCRN_LOW320 + i].state & SG_SELECTED)
        !           873:     {
        !           874:       DialogParams.Screen.ChosenDisplayMode = DISPLAYMODE_16COL_LOWRES + i
        !           875:         + ((screendlg[DLGSCRN_8BPP].state&SG_SELECTED) ? 0 : DISPLAYMODE_HICOL_LOWRES);
        !           876:       break;
        !           877:     }
        !           878:   }
        !           879: 
1.1       root      880: }
                    881: 
                    882: 
1.1.1.2   root      883: /*-----------------------------------------------------------------------*/
1.1       root      884: /*
1.1.1.2   root      885:   Show and process the sound dialog.
1.1       root      886: */
1.1.1.2   root      887: void Dialog_SoundDlg(void)
1.1       root      888: {
1.1.1.2   root      889:   int but;
1.1       root      890: 
1.1.1.2   root      891:   SDLGui_CenterDlg(sounddlg);
1.1       root      892: 
1.1.1.2   root      893:   /* Set up dialog from actual values: */
1.1       root      894: 
1.1.1.2   root      895:   if( DialogParams.Sound.bEnableSound )
                    896:     sounddlg[DLGSOUND_ENABLE].state |= SG_SELECTED;
                    897:   else
                    898:     sounddlg[DLGSOUND_ENABLE].state &= ~SG_SELECTED;
                    899: 
                    900:   sounddlg[DLGSOUND_LOW].state &= ~SG_SELECTED;
                    901:   sounddlg[DLGSOUND_MEDIUM].state &= ~SG_SELECTED;
                    902:   sounddlg[DLGSOUND_HIGH].state &= ~SG_SELECTED;
                    903:   if( DialogParams.Sound.nPlaybackQuality==PLAYBACK_LOW )
                    904:     sounddlg[DLGSOUND_LOW].state |= SG_SELECTED;
                    905:   else if( DialogParams.Sound.nPlaybackQuality==PLAYBACK_MEDIUM )
                    906:     sounddlg[DLGSOUND_MEDIUM].state |= SG_SELECTED;
                    907:   else
                    908:     sounddlg[DLGSOUND_HIGH].state |= SG_SELECTED;
1.1       root      909: 
1.1.1.3   root      910:   if( Sound_AreWeRecording() )
                    911:     sounddlg[DLGSOUND_RECORD].txt = "Stop recording";
                    912:   else
                    913:     sounddlg[DLGSOUND_RECORD].txt = "Record sound";
                    914: 
1.1.1.2   root      915:   /* The sound dialog main loop */
                    916:   do
                    917:   {
                    918:     but = SDLGui_DoDialog(sounddlg);
1.1.1.3   root      919:     if(but == DLGSOUND_RECORD)
                    920:     {
                    921:       if(Sound_AreWeRecording())
                    922:       {
                    923:         sounddlg[DLGSOUND_RECORD].txt = "Record sound";
                    924:         Sound_EndRecording();
                    925:       }
                    926:       else
                    927:       {
                    928:         sounddlg[DLGSOUND_RECORD].txt = "Stop recording";
                    929:         if(sounddlg[DLGSOUND_YM].state & SG_SELECTED)
                    930:         {
                    931:           strcpy(DialogParams.Sound.szYMCaptureFileName, "hatari.ym");
                    932:           Sound_BeginRecording("hatari.ym");
                    933:         }
                    934:         else
                    935:         {
                    936:           Sound_BeginRecording("hatari.wav");
                    937:         }
                    938:       }
                    939:     }
1.1       root      940:   }
1.1.1.2   root      941:   while( but!=DLGSOUND_EXIT && !bQuitProgram );
1.1       root      942: 
1.1.1.2   root      943:   /* Read values from dialog */
                    944:   DialogParams.Sound.bEnableSound = (sounddlg[DLGSOUND_ENABLE].state & SG_SELECTED);
                    945:   if( sounddlg[DLGSOUND_LOW].state & SG_SELECTED )
                    946:     DialogParams.Sound.nPlaybackQuality = PLAYBACK_LOW;
                    947:   else if( sounddlg[DLGSOUND_MEDIUM].state & SG_SELECTED )
                    948:     DialogParams.Sound.nPlaybackQuality = PLAYBACK_MEDIUM;
                    949:   else
                    950:     DialogParams.Sound.nPlaybackQuality = PLAYBACK_HIGH;
1.1       root      951: 
                    952: }
                    953: 
1.1.1.2   root      954: 
                    955: /*-----------------------------------------------------------------------*/
1.1       root      956: /*
1.1.1.2   root      957:   Show and process the memory dialog.
1.1       root      958: */
1.1.1.2   root      959: void Dialog_MemDlg(void)
1.1       root      960: {
1.1.1.2   root      961:   int but;
1.1       root      962: 
1.1.1.2   root      963:   SDLGui_CenterDlg(memorydlg);
1.1       root      964: 
1.1.1.2   root      965:   memorydlg[DLGMEM_512KB].state &= ~SG_SELECTED;
                    966:   memorydlg[DLGMEM_1MB].state &= ~SG_SELECTED;
                    967:   memorydlg[DLGMEM_2MB].state &= ~SG_SELECTED;
                    968:   memorydlg[DLGMEM_4MB].state &= ~SG_SELECTED;
                    969:   if( DialogParams.Memory.nMemorySize == MEMORY_SIZE_512Kb )
                    970:     memorydlg[DLGMEM_512KB].state |= SG_SELECTED;
                    971:   else if( DialogParams.Memory.nMemorySize == MEMORY_SIZE_1Mb )
                    972:     memorydlg[DLGMEM_1MB].state |= SG_SELECTED;
                    973:   else if( DialogParams.Memory.nMemorySize == MEMORY_SIZE_2Mb )
                    974:     memorydlg[DLGMEM_2MB].state |= SG_SELECTED;
                    975:   else
                    976:     memorydlg[DLGMEM_4MB].state |= SG_SELECTED;
1.1       root      977: 
1.1.1.2   root      978:   do
                    979:   {
                    980:     but = SDLGui_DoDialog(memorydlg);
1.1       root      981:   }
1.1.1.2   root      982:   while( but!=DLGMEM_EXIT && !bQuitProgram );
1.1       root      983: 
1.1.1.2   root      984:   if( memorydlg[DLGMEM_512KB].state & SG_SELECTED )
                    985:     DialogParams.Memory.nMemorySize = MEMORY_SIZE_512Kb;
                    986:   else if( memorydlg[DLGMEM_1MB].state & SG_SELECTED )
                    987:     DialogParams.Memory.nMemorySize = MEMORY_SIZE_1Mb;
                    988:   else if( memorydlg[DLGMEM_2MB].state & SG_SELECTED )
                    989:     DialogParams.Memory.nMemorySize = MEMORY_SIZE_2Mb;
                    990:   else
                    991:     DialogParams.Memory.nMemorySize = MEMORY_SIZE_4Mb;
1.1.1.3   root      992: 
1.1       root      993: }
                    994: 
1.1.1.2   root      995: 
                    996: /*-----------------------------------------------------------------------*/
1.1       root      997: /*
1.1.1.2   root      998:   Show and process the joystick dialog.
1.1       root      999: */
1.1.1.2   root     1000: void Dialog_JoyDlg(void)
1.1       root     1001: {
1.1.1.2   root     1002:   int but;
                   1003: 
                   1004:   SDLGui_CenterDlg(joystickdlg);
1.1       root     1005: 
1.1.1.2   root     1006:   /* Set up dialog from actual values: */
                   1007: 
                   1008:   if( DialogParams.Joysticks.Joy[1].bCursorEmulation )
                   1009:     joystickdlg[DLGJOY_J1CURSOR].state |= SG_SELECTED;
                   1010:   else
                   1011:     joystickdlg[DLGJOY_J1CURSOR].state &= ~SG_SELECTED;
1.1       root     1012: 
1.1.1.2   root     1013:   if( DialogParams.Joysticks.Joy[1].bEnableAutoFire )
                   1014:     joystickdlg[DLGJOY_J1AUTOFIRE].state |= SG_SELECTED;
                   1015:   else
                   1016:     joystickdlg[DLGJOY_J1AUTOFIRE].state &= ~SG_SELECTED;
                   1017: 
                   1018:   if( DialogParams.Joysticks.Joy[0].bCursorEmulation )
                   1019:     joystickdlg[DLGJOY_J0CURSOR].state |= SG_SELECTED;
                   1020:   else
                   1021:     joystickdlg[DLGJOY_J0CURSOR].state &= ~SG_SELECTED;
                   1022: 
                   1023:   if( DialogParams.Joysticks.Joy[0].bEnableAutoFire )
                   1024:     joystickdlg[DLGJOY_J0AUTOFIRE].state |= SG_SELECTED;
                   1025:   else
                   1026:     joystickdlg[DLGJOY_J0AUTOFIRE].state &= ~SG_SELECTED;
                   1027: 
                   1028:   do
                   1029:   {
                   1030:     but = SDLGui_DoDialog(joystickdlg);
                   1031:   }
                   1032:   while( but!=DLGJOY_EXIT && !bQuitProgram );
                   1033: 
                   1034:   /* Read values from dialog */
                   1035:   DialogParams.Joysticks.Joy[1].bCursorEmulation = (joystickdlg[DLGJOY_J1CURSOR].state & SG_SELECTED);
                   1036:   DialogParams.Joysticks.Joy[1].bEnableAutoFire = (joystickdlg[DLGJOY_J1AUTOFIRE].state & SG_SELECTED);
                   1037:   DialogParams.Joysticks.Joy[0].bCursorEmulation = (joystickdlg[DLGJOY_J0CURSOR].state & SG_SELECTED);
                   1038:   DialogParams.Joysticks.Joy[0].bEnableAutoFire = (joystickdlg[DLGJOY_J0AUTOFIRE].state & SG_SELECTED);
1.1       root     1039: }
                   1040: 
1.1.1.2   root     1041: 
                   1042: /*-----------------------------------------------------------------------*/
1.1       root     1043: /*
1.1.1.3   root     1044:   Show and process the "System" dialog.
1.1       root     1045: */
1.1.1.3   root     1046: void Dialog_SystemDlg(void)
1.1       root     1047: {
1.1.1.2   root     1048:   int i;
                   1049: 
1.1.1.3   root     1050:   SDLGui_CenterDlg(systemdlg);
1.1       root     1051: 
1.1.1.2   root     1052:   /* Set up dialog from actual values: */
                   1053: 
1.1.1.3   root     1054:   for(i=DLGSYS_68000; i<=DLGSYS_68040; i++)
1.1.1.2   root     1055:   {
1.1.1.3   root     1056:     systemdlg[i].state &= ~SG_SELECTED;
1.1       root     1057:   }
1.1.1.2   root     1058: 
1.1.1.3   root     1059:   systemdlg[DLGSYS_68000+DialogParams.System.nCpuLevel].state |= SG_SELECTED;
                   1060: 
                   1061:   if( DialogParams.System.bCompatibleCpu )
                   1062:     systemdlg[DLGSYS_PREFETCH].state |= SG_SELECTED;
                   1063:   else
                   1064:     systemdlg[DLGSYS_PREFETCH].state &= ~SG_SELECTED;
1.1.1.2   root     1065: 
1.1.1.3   root     1066:   if( DialogParams.System.bBlitter )
                   1067:     systemdlg[DLGSYS_BLITTER].state |= SG_SELECTED;
1.1.1.2   root     1068:   else
1.1.1.3   root     1069:     systemdlg[DLGSYS_BLITTER].state &= ~SG_SELECTED;
1.1.1.2   root     1070: 
                   1071:   /* Show the dialog: */
1.1.1.3   root     1072:   SDLGui_DoDialog(systemdlg);
1.1.1.2   root     1073: 
                   1074:   /* Read values from dialog: */
                   1075: 
1.1.1.3   root     1076:   for(i=DLGSYS_68000; i<=DLGSYS_68040; i++)
1.1.1.2   root     1077:   {
1.1.1.3   root     1078:     if( systemdlg[i].state&SG_SELECTED )
1.1.1.2   root     1079:     {
1.1.1.3   root     1080:       DialogParams.System.nCpuLevel = i-DLGSYS_68000;
1.1.1.2   root     1081:       break;
                   1082:     }
1.1       root     1083:   }
                   1084: 
1.1.1.3   root     1085:   DialogParams.System.bCompatibleCpu = (systemdlg[DLGSYS_PREFETCH].state & SG_SELECTED);
                   1086:   DialogParams.System.bBlitter = ( systemdlg[DLGSYS_BLITTER].state & SG_SELECTED );
1.1       root     1087: }
                   1088: 
                   1089: 
1.1.1.2   root     1090: /*-----------------------------------------------------------------------*/
1.1       root     1091: /*
1.1.1.2   root     1092:   This functions sets up the actual font and then displays the main dialog.
1.1       root     1093: */
1.1.1.2   root     1094: int Dialog_MainDlg(BOOL *bReset)
                   1095: {
                   1096:   int retbut;
                   1097: 
1.1.1.3   root     1098:   if( SDLGui_PrepareFont() )
                   1099:     return FALSE;
                   1100: 
1.1.1.2   root     1101:   SDLGui_CenterDlg(maindlg);
                   1102:   SDL_ShowCursor(SDL_ENABLE);
                   1103: 
                   1104:   maindlg[MAINDLG_NORESET].state |= SG_SELECTED;
                   1105:   maindlg[MAINDLG_RESET].state &= ~SG_SELECTED;
                   1106: 
                   1107:   do
                   1108:   {
                   1109:     retbut = SDLGui_DoDialog(maindlg);
                   1110:     switch(retbut)
                   1111:     {
                   1112:       case MAINDLG_ABOUT:
                   1113:         SDLGui_CenterDlg(aboutdlg);
                   1114:         SDLGui_DoDialog(aboutdlg);
                   1115:         break;
                   1116:       case MAINDLG_DISCS:
                   1117:         Dialog_DiscDlg();
                   1118:         break;
                   1119:       case MAINDLG_TOSGEM:
                   1120:         Dialog_TosGemDlg();
                   1121:         break;
                   1122:       case MAINDLG_SCREEN:
                   1123:         Dialog_ScreenDlg();
                   1124:         break;
                   1125:       case MAINDLG_SOUND:
                   1126:         Dialog_SoundDlg();
                   1127:         break;
                   1128:       case MAINDLG_CPU:
1.1.1.3   root     1129:         Dialog_SystemDlg();
1.1.1.2   root     1130:         break;
                   1131:       case MAINDLG_MEMORY:
                   1132:         Dialog_MemDlg();
                   1133:         break;
                   1134:       case MAINDLG_JOY:
                   1135:         Dialog_JoyDlg();
                   1136:         break;
                   1137:       case MAINDLG_KEYBD:
                   1138:         SDLGui_CenterDlg(keyboarddlg);
                   1139:         SDLGui_DoDialog(keyboarddlg);
                   1140:         break;
                   1141:       case MAINDLG_DEVICES:
                   1142:         SDLGui_CenterDlg(devicedlg);
                   1143:         SDLGui_DoDialog(devicedlg);
                   1144:         break;
                   1145:       case MAINDLG_QUIT:
                   1146:         bQuitProgram = TRUE;
                   1147:         break;
                   1148:     }
                   1149:     Screen_SetFullUpdate();
                   1150:     Screen_Draw();
                   1151:   }
                   1152:   while(retbut!=MAINDLG_OK && retbut!=MAINDLG_CANCEL && !bQuitProgram);
1.1       root     1153: 
1.1.1.2   root     1154:   SDL_ShowCursor(SDL_DISABLE);
1.1       root     1155: 
1.1.1.2   root     1156:   if( maindlg[MAINDLG_RESET].state & SG_SELECTED )
                   1157:     *bReset = TRUE;
                   1158:   else
                   1159:     *bReset = FALSE;
1.1       root     1160: 
1.1.1.2   root     1161:   return(retbut==MAINDLG_OK);
1.1       root     1162: }
                   1163: 
1.1.1.2   root     1164: 
                   1165: /*-----------------------------------------------------------------------*/
1.1       root     1166: /*
1.1.1.2   root     1167:   Open Property sheet Options dialog
                   1168:   Return TRUE if user choses OK, or FALSE if cancel!
1.1       root     1169: */
1.1.1.2   root     1170: BOOL Dialog_DoProperty(void)
1.1       root     1171: {
1.1.1.2   root     1172:   BOOL bOKDialog;  /* Did user 'OK' dialog? */
                   1173:   BOOL bForceReset;
1.1       root     1174: 
1.1.1.2   root     1175:   Main_PauseEmulation();
1.1       root     1176: 
1.1.1.2   root     1177:   /* Copy details to DialogParams (this is so can restore if 'Cancel' dialog) */
                   1178:   ConfigureParams.Screen.bFullScreen = bInFullScreen;
                   1179:   DialogParams = ConfigureParams;
1.1       root     1180: 
1.1.1.2   root     1181:   bSaveMemoryState = FALSE;
                   1182:   bRestoreMemoryState = FALSE;
                   1183:   bForceReset = FALSE;
1.1       root     1184: 
1.1.1.2   root     1185:   bOKDialog = Dialog_MainDlg(&bForceReset);
1.1       root     1186: 
1.1.1.2   root     1187:   /* Copy details to configuration, and ask user if wishes to reset */
                   1188:   if (bOKDialog)
                   1189:     Dialog_CopyDialogParamsToConfiguration(bForceReset);
                   1190:   /* Did want to save/restore memory save? If did, need to re-enter emulation mode so can save in 'safe-zone' */
                   1191:   if (bSaveMemoryState || bRestoreMemoryState) {
                   1192:     /* Back into emulation mode, when next VBL occurs state will be safed - otherwise registers are unknown */
                   1193:     /*FM  View_ToggleWindowsMouse(MOUSE_ST);*/
                   1194:   }
                   1195: 
                   1196:   Main_UnPauseEmulation();
                   1197: 
                   1198:   return(bOKDialog);
1.1       root     1199: }
1.1.1.2   root     1200: 

unix.superglobalmegacorp.com

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