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