Skip to content
Newer
Older
100644 555 lines (455 sloc) 8.03 KB
b126e26 @tbradshaw The source of the setup program included with DOOM, Final DOOM, Strif…
tbradshaw authored Jan 31, 2012
1 #include "main.h"
2 #include "menu.h"
3 #include "default.h"
4 #include "keys.h"
5
6 //
7 // Choose MIDI port
8 //
9 enum
10 {
11 MIDI_220,
12 MIDI_230,
13 MIDI_240,
14 MIDI_250,
15 MIDI_300,
16 MIDI_320,
17 MIDI_330,
18 MIDI_332,
19 MIDI_334,
20 MIDI_336,
21 MIDI_340,
22 MIDI_360,
23 MIDI_MAX
24 };
25
26 item_t midiportitems[]=
27 {
28 {MIDI_220, 32,6,13, -1,-1},
29 {MIDI_230, 32,7,13, -1,-1},
30 {MIDI_240, 32,8,13, -1,-1},
31 {MIDI_250, 32,9,13, -1,-1},
32 {MIDI_300, 32,10,13, -1,-1},
33 {MIDI_320, 32,11,13, -1,-1},
34 {MIDI_330, 32,12,13, -1,-1},
35 {MIDI_332, 32,13,13, -1,-1},
36 {MIDI_334, 32,14,13, -1,-1},
37 {MIDI_336, 32,15,13, -1,-1},
38 {MIDI_340, 32,16,13, -1,-1},
39 {MIDI_360, 32,17,13, -1,-1}
40 };
41
42 menu_t midiportmenu=
43 {
44 &midiportitems[0],
45 MIDI_330,
46 MIDI_MAX,
47 0x7f
48 };
49
50 int ChooseMidiPort (DMXCARD * card)
51 {
52 short field;
53 short key;
54 int rval = 0;
55
56 SaveScreen();
57 DrawPup(&midiport);
58
59 // DEFAULT FIELD ========================================
60
61 switch ( card->midiport )
62 {
63 default:
64 case 0x220:
65 field = MIDI_220;
66 break;
67
68 case 0x230:
69 field = MIDI_230;
70 break;
71
72 case 0x240:
73 field = MIDI_240;
74 break;
75
76 case 0x250:
77 field = MIDI_250;
78 break;
79
80 case 0x300:
81 field = MIDI_300;
82 break;
83
84 case 0x320:
85 field = MIDI_320;
86 break;
87
88 case 0x330:
89 field = MIDI_330;
90 break;
91
92 case 0x332:
93 field = MIDI_332;
94 break;
95
96 case 0x334:
97 field = MIDI_334;
98 break;
99
100 case 0x336:
101 field = MIDI_336;
102 break;
103
104 case 0x340:
105 field = MIDI_340;
106 break;
107
108 case 0x360:
109 field = MIDI_360;
110 break;
111 }
112
113 while(1)
114 {
115 SetupMenu(&midiportmenu);
116 field = GetMenuInput();
117 key = menukey;
118 switch ( key )
119 {
120 case KEY_ESC:
121 rval = -1;
122 goto func_exit;
123
124 case KEY_ENTER:
125 case KEY_F10:
126 switch ( field )
127 {
128 case MIDI_220:
129 card->midiport = 0x220;
130 goto func_exit;
131
132 case MIDI_230:
133 card->midiport = 0x230;
134 goto func_exit;
135
136 case MIDI_240:
137 card->midiport = 0x240;
138 goto func_exit;
139
140 case MIDI_250:
141 card->midiport = 0x250;
142 goto func_exit;
143
144 case MIDI_300:
145 card->midiport = 0x300;
146 goto func_exit;
147
148 case MIDI_320:
149 card->midiport = 0x320;
150 goto func_exit;
151
152 case MIDI_330:
153 card->midiport = 0x330;
154 goto func_exit;
155
156 case MIDI_332:
157 card->midiport = 0x332;
158 goto func_exit;
159
160 case MIDI_334:
161 card->midiport = 0x334;
162 goto func_exit;
163
164 case MIDI_336:
165 card->midiport = 0x336;
166 goto func_exit;
167
168 case MIDI_340:
169 card->midiport = 0x340;
170 goto func_exit;
171
172 case MIDI_360:
173 card->midiport = 0x360;
174 goto func_exit;
175
176 default:
177 break;
178 }
179 break;
180 }
181 }
182
183 func_exit:
184
185 RestoreScreen();
186 return ( rval );
187 }
188
189 //
190 // Choose which SoundBlaster port to use (or any port!)
191 //
192 enum
193 {
194 SB_PORT_210,
195 SB_PORT_220,
196 SB_PORT_230,
197 SB_PORT_240,
198 SB_PORT_250,
199 SB_PORT_260,
200 SB_PORT_280,
201 SB_PORT_MAX
202 };
203
204 item_t sbportitems[]=
205 {
206 {SB_PORT_210, 32,9,13, -1,-1},
207 {SB_PORT_220, 32,10,13, -1,-1},
208 {SB_PORT_230, 32,11,13, -1,-1},
209 {SB_PORT_240, 32,12,13, -1,-1},
210 {SB_PORT_250, 32,13,13, -1,-1},
211 {SB_PORT_260, 32,14,13, -1,-1},
212 {SB_PORT_280, 32,15,13, -1,-1}
213 };
214
215 menu_t sbportmenu =
216 {
217 &sbportitems[0],
218 SB_PORT_220,
219 SB_PORT_MAX,
220 0x7f
221 };
222
223 int ChooseSbPort (DMXCARD * card) // RETURN: 0 = OK, -1 == ABORT
224 {
225 short field;
226 short key;
227 int rval = 0;
228
229 SaveScreen();
230 DrawPup(&sbport);
231
232 // DEFAULT FIELD ========================================
233
234 switch ( card->port )
235 {
236 default:
237 field = SB_PORT_220;
238 break;
239
240 case 0x210:
241 field = SB_PORT_210;
242 break;
243
244 case 0x220:
245 field = SB_PORT_220;
246 break;
247
248 case 0x230:
249 field = SB_PORT_230;
250 break;
251
252 case 0x240:
253 field = SB_PORT_240;
254 break;
255
256 case 0x250:
257 field = SB_PORT_250;
258 break;
259
260 case 0x260:
261 field = SB_PORT_260;
262 break;
263
264 case 0x280:
265 field = SB_PORT_280;
266 break;
267 }
268
269 sbportmenu.startitem = field;
270 while(1)
271 {
272 SetupMenu(&sbportmenu);
273 field = GetMenuInput();
274 key = menukey;
275 switch ( key )
276 {
277 case KEY_ESC:
278 rval = -1;
279 goto func_exit;
280
281 case KEY_ENTER:
282 case KEY_F10:
283 switch ( field )
284 {
285 case SB_PORT_210:
286 card->port = 0x210;
287 goto func_exit;
288
289 case SB_PORT_220:
290 card->port = 0x220;
291 goto func_exit;
292
293 case SB_PORT_230:
294 card->port = 0x230;
295 goto func_exit;
296
297 case SB_PORT_240:
298 card->port = 0x240;
299 goto func_exit;
300
301 case SB_PORT_250:
302 card->port = 0x250;
303 goto func_exit;
304
305 case SB_PORT_260:
306 card->port = 0x260;
307 goto func_exit;
308
309 case SB_PORT_280:
310 card->port = 0x280;
311 goto func_exit;
312
313 default:
314 break;
315 }
316 break;
317 }
318 }
319
320 func_exit:
321
322 RestoreScreen();
323 return ( rval );
324 }
325
326 //
327 // Menu for choosing Music Card
328 //
329 enum
330 {
331 MCARD_GMIDI,
332 MCARD_SBAWE32,
333 MCARD_CANVAS,
334 MCARD_WAVE,
335 MCARD_GUS,
336 MCARD_PAS,
337 MCARD_SB,
338 MCARD_ADLIB,
339 MCARD_NONE,
340 MCARD_MAX
341 };
342
343 item_t mcarditems[]=
344 {
345 {MCARD_GMIDI, 26,8,28, -1,-1},
346 {MCARD_SBAWE32,26,9,28, -1,-1},
347 {MCARD_CANVAS, 26,10,28, -1,-1},
348 {MCARD_WAVE, 26,11,28, -1,-1},
349 {MCARD_GUS, 26,12,28, -1,-1},
350 {MCARD_PAS, 26,13,28, -1,-1},
351 {MCARD_SB, 26,14,28, -1,-1},
352 {MCARD_ADLIB, 26,15,28, -1,-1},
353 {MCARD_NONE, 26,16,28, -1,-1}
354 };
355
356 menu_t mcardmenu =
357 {
358 &mcarditems[0],
359 MCARD_NONE,
360 MCARD_MAX,
361 0x7f
362 };
363
364 int ChooseMusicCard (void) // RETURN: 0 = OK, -1 == ABORT
365 {
366 short key;
367 short field;
368 int rval = 0;
369
370 switch ( newc.m.card )
371 {
372 default:
373 case M_NONE:
374 field = MCARD_NONE;
375 break;
376
377 case M_ADLIB:
378 field = MCARD_ADLIB;
379 break;
380
381 case M_PAS:
382 field = MCARD_PAS;
383 break;
384
385 case M_GUS:
386 field = MCARD_GUS;
387 break;
388
389 case M_SB:
390 field = MCARD_SB;
391 break;
392
393 case M_WAVE:
394 field = MCARD_WAVE;
395 break;
396
397 case M_CANVAS:
398 field = MCARD_CANVAS;
399 break;
400
401 case M_SBAWE32:
402 field = MCARD_SBAWE32;
403 break;
404
405 case M_GMIDI:
406 field = MCARD_GMIDI;
407 break;
408 }
409
410 mcardmenu.startitem = field;
411 SaveScreen();
412 DrawPup(&mcard);
413
414 while(1)
415 {
416 SetupMenu(&mcardmenu);
417 field = GetMenuInput();
418 key = menukey;
419
420 switch ( key )
421 {
422 case KEY_ESC:
423 rval = -1;
424 goto func_exit;
425
426 case KEY_ENTER:
427 case KEY_F10:
428 switch ( field )
429 {
430 case MCARD_SBAWE32:
431 newc.m.card = M_SBAWE32;
432 newc.m.port = -1;
433 newc.m.irq = -1;
434 newc.m.dma = -1;
435 goto func_exit;
436
437 case MCARD_GMIDI:
438 newc.m.card = M_GMIDI;
439 newc.m.port = -1;
440 newc.m.irq = -1;
441 newc.m.dma = -1;
442 goto func_exit;
443
444 case MCARD_CANVAS:
445 newc.m.card = M_CANVAS;
446 newc.m.port = -1;
447 newc.m.irq = -1;
448 newc.m.dma = -1;
449 goto func_exit;
450
451 case MCARD_WAVE:
452 newc.m.card = M_WAVE;
453 newc.m.port = -1;
454 newc.m.irq = -1;
455 newc.m.dma = -1;
456 goto func_exit;
457
458 case MCARD_SB:
459 newc.m.card = M_SB;
460 goto func_exit;
461
462 case MCARD_PAS:
463 newc.m.card = M_PAS;
464 newc.m.midiport = -1;
465 goto func_exit;
466
467 case MCARD_GUS:
468 newc.m.card = M_GUS;
469 newc.m.midiport = -1;
470 goto func_exit;
471
472 case MCARD_ADLIB:
473 newc.m.card = M_ADLIB;
474 newc.m.port = -1;
475 newc.m.midiport = -1;
476 newc.m.irq = -1;
477 newc.m.dma = -1;
478 goto func_exit;
479
480 case MCARD_NONE:
481 newc.m.card = M_NONE;
482 newc.m.port = -1;
483 newc.m.midiport = -1;
484 newc.m.irq = -1;
485 newc.m.dma = -1;
486 goto func_exit;
487
488 default:
489 break;
490 }
491 break;
492 }
493 }
494
495 func_exit:
496
497 RestoreScreen();
498 return ( rval );
499 }
500
501
502 //
503 // Choose Music Card menu
504 //
505 int SetupMusic (void)
506 {
507 if ( ChooseMusicCard() == -1 ) return ( -1 );
508
509 DrawCurrentConfig();
510
511 switch ( newc.m.card )
512 {
513 default:
514 savemusic = FALSE;
515 break;
516
517 case M_NONE:
518 savemusic = TRUE;
519 break;
520
521 case M_ADLIB:
522 savemusic = TRUE;
523 break;
524
525 case M_PAS:
526 case M_GUS:
527 savemusic = TRUE;
528 break;
529
530
531 case M_SB:
532 if ( ChooseSbPort( &newc.m ) == -1 ) return ( -1 );
533 savemusic = TRUE;
534 break;
535
536 case M_WAVE:
537 if ( ChooseMidiPort( &newc.m ) == -1 ) return ( -1 );
538 savemusic = TRUE;
539 break;
540
541 case M_SBAWE32:
542 case M_CANVAS:
543 newc.m.midiport = 0x330;
544 if ( ChooseMidiPort( &newc.m ) == -1 ) return ( -1 );
545 savemusic = TRUE;
546 break;
547
548 case M_GMIDI:
549 if ( ChooseMidiPort( &newc.m ) == -1 ) return ( -1 );
550 savemusic = TRUE;
551 break;
552 }
553 return 0;
554 }
Something went wrong with that request. Please try again.