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

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

unix.superglobalmegacorp.com

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