|
|
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: */
7: const char DlgSystem_fileid[] = "Hatari dlgSystem.c : " __DATE__ " " __TIME__;
8:
9: #include "main.h"
10: #include "configuration.h"
11: #include "dialog.h"
12: #include "sdlgui.h"
13:
14:
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_TT 13
23: #define DLGSYS_FALCON 14
24: #define DLGSYS_8MHZ 17
25: #define DLGSYS_16MHZ 18
26: #define DLGSYS_32MHZ 19
27: #define DLGSYS_DSPOFF 21
28: #define DLGSYS_DSPDUMMY 22
29: #define DLGSYS_DSPON 23
30: #define DLGSYS_PREFETCH 24
31: #define DLGSYS_BLITTER 25
32: #define DLGSYS_RTC 26
33: #define DLGSYS_TIMERD 27
34:
35:
36: /* The "System" dialog: */
37: static SGOBJ systemdlg[] =
38: {
39: { SGBOX, 0, 0, 0,0, 36,24, NULL },
40: { SGTEXT, 0, 0, 11,1, 14,1, "System options" },
41:
42: { SGBOX, 0, 0, 2,3, 16,9, NULL },
43: { SGTEXT, 0, 0, 3,4, 8,1, "CPU type:" },
44: { SGRADIOBUT, 0, 0, 4,6, 7,1, "68000" },
45: { SGRADIOBUT, 0, 0, 4,7, 7,1, "68010" },
46: { SGRADIOBUT, 0, 0, 4,8, 7,1, "68020" },
47: { SGRADIOBUT, 0, 0, 4,9, 13,1, "68EC030+FPU" },
48: { SGRADIOBUT, 0, 0, 4,10, 7,1, "68040" },
49:
50: { SGBOX, 0, 0, 19,3, 15,9, NULL },
51: { SGTEXT, 0, 0, 20,4, 13,1, "Machine type:" },
52: { SGRADIOBUT, 0, 0, 23,6, 8,1, "ST" },
53: { SGRADIOBUT, 0, 0, 23,7, 8,1, "STE" },
54: { SGRADIOBUT, 0, 0, 23,8, 8,1, "TT *" },
55: { SGRADIOBUT, 0, 0, 23,9, 8,1, "Falcon *" },
56: { SGTEXT, 0, 0, 21,11, 12,1, "* incomplete" },
57:
58: { SGTEXT, 0, 0, 2,13, 15,1, "CPU clock (MHz):" },
59: { SGRADIOBUT, 0, 0, 19,13, 3,1, "8" },
60: { SGRADIOBUT, 0, 0, 24,13, 4,1, "16" },
61: { SGRADIOBUT, 0, 0, 30,13, 4,1, "32" },
62:
63: { SGTEXT, 0, 0, 2,15, 11,1, "Falcon DSP:" },
64: { SGRADIOBUT, 0, 0, 14,15, 5,1, "off" },
65: { SGRADIOBUT, 0, 0, 21,15, 7,1, "dummy" },
66: { SGRADIOBUT, 0, 0, 30,15, 4,1, "on" },
67:
68: { SGCHECKBOX, 0, 0, 2,17, 32,1, "Slower but more compatible CPU" },
69: { SGCHECKBOX, 0, 0, 2,18, 20,1, "Blitter emulation" },
70: { SGCHECKBOX, 0, 0, 2,19, 27,1, "Real time clock emulation" },
71: { SGCHECKBOX, 0, 0, 2,20, 15,1, "Patch Timer-D" },
72:
73: { SGBUTTON, SG_DEFAULT, 0, 8,22, 20,1, "Back to main menu" },
74: { -1, 0, 0, 0,0, 0,0, NULL }
75: };
76:
77:
78: /*-----------------------------------------------------------------------*/
79: /**
80: * Show and process the "System" dialog.
81: */
82: void Dialog_SystemDlg(void)
83: {
84: int i;
85: MACHINETYPE mti;
86:
87: SDLGui_CenterDlg(systemdlg);
88:
89: /* Set up dialog from actual values: */
90:
91: for (i = DLGSYS_68000; i <= DLGSYS_68040; i++)
92: {
93: systemdlg[i].state &= ~SG_SELECTED;
94: }
95: systemdlg[DLGSYS_68000+ConfigureParams.System.nCpuLevel].state |= SG_SELECTED;
96:
97: for (i = DLGSYS_ST; i <= DLGSYS_FALCON; i++)
98: {
99: systemdlg[i].state &= ~SG_SELECTED;
100: }
101: systemdlg[DLGSYS_ST + ConfigureParams.System.nMachineType].state |= SG_SELECTED;
102:
103: /* CPU frequency: */
104: for (i = DLGSYS_8MHZ; i <= DLGSYS_16MHZ; i++)
105: {
106: systemdlg[i].state &= ~SG_SELECTED;
107: }
108: if (ConfigureParams.System.nCpuFreq == 32)
109: systemdlg[DLGSYS_32MHZ].state |= SG_SELECTED;
110: else if (ConfigureParams.System.nCpuFreq == 16)
111: systemdlg[DLGSYS_16MHZ].state |= SG_SELECTED;
112: else
113: systemdlg[DLGSYS_8MHZ].state |= SG_SELECTED;
114:
115: /* DSP mode: */
116: for (i = DLGSYS_DSPOFF; i <= DLGSYS_DSPON; i++)
117: {
118: systemdlg[i].state &= ~SG_SELECTED;
119: }
120: if (ConfigureParams.System.nDSPType == DSP_TYPE_NONE)
121: systemdlg[DLGSYS_DSPOFF].state |= SG_SELECTED;
122: else if (ConfigureParams.System.nDSPType == DSP_TYPE_DUMMY)
123: systemdlg[DLGSYS_DSPDUMMY].state |= SG_SELECTED;
124: else
125: systemdlg[DLGSYS_DSPON].state |= SG_SELECTED;
126:
127:
128: if (ConfigureParams.System.bCompatibleCpu)
129: systemdlg[DLGSYS_PREFETCH].state |= SG_SELECTED;
130: else
131: systemdlg[DLGSYS_PREFETCH].state &= ~SG_SELECTED;
132:
133: if (ConfigureParams.System.bBlitter)
134: systemdlg[DLGSYS_BLITTER].state |= SG_SELECTED;
135: else
136: systemdlg[DLGSYS_BLITTER].state &= ~SG_SELECTED;
137:
138: if (ConfigureParams.System.bRealTimeClock)
139: systemdlg[DLGSYS_RTC].state |= SG_SELECTED;
140: else
141: systemdlg[DLGSYS_RTC].state &= ~SG_SELECTED;
142:
143: if (ConfigureParams.System.bPatchTimerD)
144: systemdlg[DLGSYS_TIMERD].state |= SG_SELECTED;
145: else
146: systemdlg[DLGSYS_TIMERD].state &= ~SG_SELECTED;
147:
148: /* Show the dialog: */
149: SDLGui_DoDialog(systemdlg, NULL);
150:
151: /* Read values from dialog: */
152:
153: for (i = DLGSYS_68000; i <= DLGSYS_68040; i++)
154: {
155: if (systemdlg[i].state&SG_SELECTED)
156: {
157: ConfigureParams.System.nCpuLevel = i-DLGSYS_68000;
158: break;
159: }
160: }
161:
162: for (mti = MACHINE_ST; mti <= MACHINE_FALCON; mti++)
163: {
164: if (systemdlg[mti + DLGSYS_ST].state&SG_SELECTED)
165: {
166: ConfigureParams.System.nMachineType = mti;
167: break;
168: }
169: }
170:
171: if (systemdlg[DLGSYS_32MHZ].state & SG_SELECTED)
172: ConfigureParams.System.nCpuFreq = 32;
173: else if (systemdlg[DLGSYS_16MHZ].state & SG_SELECTED)
174: ConfigureParams.System.nCpuFreq = 16;
175: else
176: ConfigureParams.System.nCpuFreq = 8;
177:
178: if (systemdlg[DLGSYS_DSPOFF].state & SG_SELECTED)
179: ConfigureParams.System.nDSPType = DSP_TYPE_NONE;
180: else if (systemdlg[DLGSYS_DSPDUMMY].state & SG_SELECTED)
181: ConfigureParams.System.nDSPType = DSP_TYPE_DUMMY;
182: else
183: ConfigureParams.System.nDSPType = DSP_TYPE_EMU;
184:
185: ConfigureParams.System.bCompatibleCpu = (systemdlg[DLGSYS_PREFETCH].state & SG_SELECTED);
186: ConfigureParams.System.bBlitter = (systemdlg[DLGSYS_BLITTER].state & SG_SELECTED);
187: ConfigureParams.System.bRealTimeClock = (systemdlg[DLGSYS_RTC].state & SG_SELECTED);
188: ConfigureParams.System.bPatchTimerD = (systemdlg[DLGSYS_TIMERD].state & SG_SELECTED);
189: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.