|
|
1.1 root 1: /*
2: Hatari - dlgSystem.c
3:
4: This file is distributed under the GNU Public License, version 2 or at
5: your option any later version. Read the file gpl.txt for details.
6: */
1.1.1.2 ! root 7: char DlgSystem_rcsid[] = "Hatari $Id: dlgSystem.c,v 1.6 2005/02/25 09:17:54 thothy Exp $";
1.1 root 8:
9: #include "main.h"
10: #include "configuration.h"
11: #include "dialog.h"
12: #include "sdlgui.h"
13:
14:
1.1.1.2 ! root 15: #define DLGSYS_68000 4
! 16: #define DLGSYS_68010 5
! 17: #define DLGSYS_68020 6
! 18: #define DLGSYS_68030 7
! 19: #define DLGSYS_68040 8
! 20: #define DLGSYS_ST 11
! 21: #define DLGSYS_STE 12
! 22: #define DLGSYS_8MHZ 14
! 23: #define DLGSYS_16MHZ 15
! 24: #define DLGSYS_32MHZ 16
! 25: #define DLGSYS_PREFETCH 17
! 26: #define DLGSYS_BLITTER 18
! 27: #define DLGSYS_RTC 19
! 28: #define DLGSYS_TIMERD 20
! 29: #define DLGSYS_SLOWFDC 21
1.1 root 30:
31:
32: /* The "System" dialog: */
33: static SGOBJ systemdlg[] =
34: {
1.1.1.2 ! root 35: { SGBOX, 0, 0, 0,0, 36,23, NULL },
! 36: { SGTEXT, 0, 0, 11,1, 14,1, "System options" },
! 37:
! 38: { SGBOX, 0, 0, 2,3, 16,9, NULL },
! 39: { SGTEXT, 0, 0, 3,4, 8,1, "CPU type:" },
! 40: { SGRADIOBUT, 0, 0, 6,6, 7,1, "68000" },
! 41: { SGRADIOBUT, 0, 0, 6,7, 7,1, "68010" },
! 42: { SGRADIOBUT, 0, 0, 6,8, 7,1, "68020" },
! 43: { SGRADIOBUT, 0, 0, 6,9, 11,1, "68020+FPU" },
! 44: { SGRADIOBUT, 0, 0, 6,10, 7,1, "68040" },
! 45:
! 46: { SGBOX, 0, 0, 19,3, 15,9, NULL },
! 47: { SGTEXT, 0, 0, 20,4, 13,1, "Machine type:" },
! 48: { SGRADIOBUT, 0, 0, 23,6, 7,1, "ST" },
! 49: { SGRADIOBUT, 0, 0, 23,7, 7,1, "STE" },
! 50:
! 51: { SGTEXT, 0, 0, 2,13, 15,1, "CPU clock (MHz):" },
! 52: { SGRADIOBUT, 0, 0, 19,13, 3,1, "8" },
! 53: { SGRADIOBUT, 0, 0, 24,13, 4,1, "16" },
! 54: { SGRADIOBUT, 0, 0, 30,13, 4,1, "32" },
! 55:
! 56: { SGCHECKBOX, 0, 0, 2,15, 32,1, "Slower but more compatible CPU" },
! 57: { SGCHECKBOX, 0, 0, 2,16, 20,1, "Blitter emulation" },
! 58: { SGCHECKBOX, 0, 0, 2,17, 27,1, "Real time clock emulation" },
! 59: { SGCHECKBOX, 0, 0, 2,18, 15,1, "Patch Timer-D" },
! 60: { SGCHECKBOX, 0, 0, 2,19, 25,1, "Slow down FDC emulation" },
! 61:
! 62: { SGTEXT, 0, 0, 20, 9, 13,1, "(STE mode is" },
! 63: { SGTEXT, 0, 0, 20,10, 13,1, " incomplete!)" },
! 64:
! 65: { SGBUTTON, 0, 0, 8,21, 20,1, "Back to main menu" },
! 66: { -1, 0, 0, 0,0, 0,0, NULL }
1.1 root 67: };
68:
69:
70: /*-----------------------------------------------------------------------*/
71: /*
72: Show and process the "System" dialog.
73: */
74: void Dialog_SystemDlg(void)
75: {
1.1.1.2 ! root 76: int i;
1.1 root 77:
1.1.1.2 ! root 78: SDLGui_CenterDlg(systemdlg);
1.1 root 79:
1.1.1.2 ! root 80: /* Set up dialog from actual values: */
1.1 root 81:
1.1.1.2 ! root 82: for (i = DLGSYS_68000; i <= DLGSYS_68040; i++)
! 83: {
! 84: systemdlg[i].state &= ~SG_SELECTED;
! 85: }
! 86: systemdlg[DLGSYS_68000+DialogParams.System.nCpuLevel].state |= SG_SELECTED;
! 87:
! 88: for (i = DLGSYS_ST; i <= DLGSYS_STE; i++)
! 89: {
! 90: systemdlg[i].state &= ~SG_SELECTED;
! 91: }
! 92: systemdlg[DLGSYS_ST + DialogParams.System.nMachineType].state |= SG_SELECTED;
! 93:
! 94: for (i = DLGSYS_8MHZ; i <= DLGSYS_16MHZ; i++)
! 95: {
! 96: systemdlg[i].state &= ~SG_SELECTED;
! 97: }
! 98: if (DialogParams.System.nCpuFreq == 32)
! 99: systemdlg[DLGSYS_32MHZ].state |= SG_SELECTED;
! 100: else if (DialogParams.System.nCpuFreq == 16)
! 101: systemdlg[DLGSYS_16MHZ].state |= SG_SELECTED;
! 102: else
! 103: systemdlg[DLGSYS_8MHZ].state |= SG_SELECTED;
! 104:
! 105: if (DialogParams.System.bCompatibleCpu)
! 106: systemdlg[DLGSYS_PREFETCH].state |= SG_SELECTED;
! 107: else
! 108: systemdlg[DLGSYS_PREFETCH].state &= ~SG_SELECTED;
! 109:
! 110: if (DialogParams.System.bBlitter)
! 111: systemdlg[DLGSYS_BLITTER].state |= SG_SELECTED;
! 112: else
! 113: systemdlg[DLGSYS_BLITTER].state &= ~SG_SELECTED;
! 114:
! 115: if (DialogParams.System.bRealTimeClock)
! 116: systemdlg[DLGSYS_RTC].state |= SG_SELECTED;
! 117: else
! 118: systemdlg[DLGSYS_RTC].state &= ~SG_SELECTED;
! 119:
! 120: if (DialogParams.System.bPatchTimerD)
! 121: systemdlg[DLGSYS_TIMERD].state |= SG_SELECTED;
! 122: else
! 123: systemdlg[DLGSYS_TIMERD].state &= ~SG_SELECTED;
! 124:
! 125: if (DialogParams.System.bSlowFDC)
! 126: systemdlg[DLGSYS_SLOWFDC].state |= SG_SELECTED;
! 127: else
! 128: systemdlg[DLGSYS_SLOWFDC].state &= ~SG_SELECTED;
! 129:
! 130: /* Show the dialog: */
! 131: SDLGui_DoDialog(systemdlg, NULL);
! 132:
! 133: /* Read values from dialog: */
! 134:
! 135: for (i = DLGSYS_68000; i <= DLGSYS_68040; i++)
! 136: {
! 137: if (systemdlg[i].state&SG_SELECTED)
! 138: {
! 139: DialogParams.System.nCpuLevel = i-DLGSYS_68000;
! 140: break;
! 141: }
! 142: }
! 143:
! 144: for (i = DLGSYS_ST; i <= DLGSYS_STE; i++)
! 145: {
! 146: if (systemdlg[i].state&SG_SELECTED)
! 147: {
! 148: DialogParams.System.nMachineType = i-DLGSYS_ST;
! 149: break;
! 150: }
! 151: }
! 152:
! 153: if (systemdlg[DLGSYS_32MHZ].state & SG_SELECTED)
! 154: DialogParams.System.nCpuFreq = 32;
! 155: else if (systemdlg[DLGSYS_16MHZ].state & SG_SELECTED)
! 156: DialogParams.System.nCpuFreq = 16;
! 157: else
! 158: DialogParams.System.nCpuFreq = 8;
! 159:
! 160: DialogParams.System.bCompatibleCpu = (systemdlg[DLGSYS_PREFETCH].state & SG_SELECTED);
! 161: DialogParams.System.bBlitter = (systemdlg[DLGSYS_BLITTER].state & SG_SELECTED);
! 162: DialogParams.System.bRealTimeClock = (systemdlg[DLGSYS_RTC].state & SG_SELECTED);
! 163: DialogParams.System.bPatchTimerD = (systemdlg[DLGSYS_TIMERD].state & SG_SELECTED);
! 164: DialogParams.System.bSlowFDC = (systemdlg[DLGSYS_SLOWFDC].state & SG_SELECTED);
1.1 root 165: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.