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

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

unix.superglobalmegacorp.com

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