SFX.BAK 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. //
  2. // Handle all SFX card menus
  3. //
  4. #include "main.h"
  5. enum
  6. {
  7. DCARD_GUS,
  8. DCARD_PAS,
  9. DCARD_SB,
  10. // DCARD_PC,
  11. DCARD_NONE,
  12. DCARD_MAX
  13. };
  14. item_t idcarditems[]=
  15. {
  16. {DCARD_GUS, 27,10,25, -1,-1},
  17. {DCARD_PAS, 27,11,25, -1,-1},
  18. {DCARD_SB, 27,12,25, -1,-1},
  19. // {DCARD_PC, 27,13,25, -1,-1},
  20. {DCARD_NONE,27,13,25, -1,-1}
  21. };
  22. menu_t idcardmenu=
  23. {
  24. &idcarditems[0],
  25. DCARD_NONE,
  26. DCARD_MAX,
  27. 0x7f
  28. };
  29. int ChooseFxCard (void)
  30. {
  31. short field;
  32. short key;
  33. int rval = 0;
  34. switch ( newc.d.card )
  35. {
  36. default:
  37. case M_NONE:
  38. field = DCARD_NONE;
  39. break;
  40. // case M_PC:
  41. // field = DCARD_PC;
  42. // break;
  43. case M_GUS:
  44. field = DCARD_GUS;
  45. break;
  46. case M_SB:
  47. field = DCARD_SB;
  48. break;
  49. case M_PAS:
  50. field = DCARD_PAS;
  51. break;
  52. case M_WAVE:
  53. field = DCARD_SB;
  54. break;
  55. }
  56. SaveScreen();
  57. DrawPup(&idcard);
  58. idcardmenu.startitem = field;
  59. while(1)
  60. {
  61. SetupMenu(&idcardmenu);
  62. field = GetMenuInput();
  63. key = menukey;
  64. switch ( key )
  65. {
  66. case KEY_ESC:
  67. rval = -1;
  68. goto func_exit;
  69. case KEY_ENTER:
  70. case KEY_F10:
  71. switch ( field )
  72. {
  73. case DCARD_PAS:
  74. newc.d.card = M_PAS;
  75. goto func_exit;
  76. case DCARD_SB:
  77. newc.d.card = M_SB;
  78. goto func_exit;
  79. case DCARD_GUS:
  80. newc.d.card = M_GUS;
  81. newc.d.midiport = -1;
  82. goto func_exit;
  83. #if 0
  84. case DCARD_PC:
  85. newc.d.card = M_PC;
  86. newc.d.port = -1;
  87. newc.d.midiport = -1;
  88. newc.d.irq = -1;
  89. newc.d.dma = -1;
  90. goto func_exit;
  91. #endif
  92. case DCARD_NONE:
  93. newc.d.card = M_NONE;
  94. newc.d.port = -1;
  95. newc.d.midiport = -1;
  96. newc.d.irq = -1;
  97. newc.d.dma = -1;
  98. goto func_exit;
  99. default:
  100. break;
  101. }
  102. break;
  103. }
  104. }
  105. func_exit:
  106. RestoreScreen();
  107. return ( rval );
  108. }
  109. //
  110. // Choose SB DMA channel
  111. //
  112. enum
  113. {
  114. SB_DMA_0,
  115. SB_DMA_1,
  116. SB_DMA_3,
  117. SB_DMA_5,
  118. SB_DMA_6,
  119. SB_DMA_7,
  120. SB_DMA_MAX
  121. };
  122. item_t sbdmaitems[]=
  123. {
  124. {SB_DMA_0, 35,9,7, -1,-1},
  125. {SB_DMA_1, 35,10,7, -1,-1},
  126. {SB_DMA_3, 35,11,7, -1,-1},
  127. {SB_DMA_5, 35,12,7, -1,-1},
  128. {SB_DMA_6, 35,13,7, -1,-1},
  129. {SB_DMA_7, 35,14,7, -1,-1}
  130. };
  131. menu_t sbdmamenu=
  132. {
  133. &sbdmaitems[0],
  134. SB_DMA_5,
  135. SB_DMA_MAX,
  136. 0x7f
  137. };
  138. int ChooseSbDma (DMXCARD * card)
  139. {
  140. short key;
  141. short field;
  142. int rval = 0;
  143. switch ( card->dma )
  144. {
  145. case 0:
  146. field = SB_DMA_0;
  147. break;
  148. default:
  149. case 1:
  150. field = SB_DMA_1;
  151. break;
  152. case 3:
  153. field = SB_DMA_3;
  154. break;
  155. case 5:
  156. field = SB_DMA_5;
  157. break;
  158. case 6:
  159. field = SB_DMA_6;
  160. break;
  161. case 7:
  162. field = SB_DMA_7;
  163. break;
  164. }
  165. SaveScreen();
  166. DrawPup(&sbdma);
  167. sbdmamenu.startitem = field;
  168. while(1)
  169. {
  170. SetupMenu(&sbdmamenu);
  171. field = GetMenuInput();
  172. key = menukey;
  173. switch ( key )
  174. {
  175. case KEY_ESC:
  176. rval = -1;
  177. goto func_exit;
  178. case KEY_ENTER:
  179. case KEY_F10:
  180. switch ( field )
  181. {
  182. case SB_DMA_0:
  183. card->dma = 0;
  184. goto func_exit;
  185. case SB_DMA_1:
  186. card->dma = 1;
  187. goto func_exit;
  188. case SB_DMA_3:
  189. card->dma = 3;
  190. goto func_exit;
  191. case SB_DMA_5:
  192. card->dma = 5;
  193. goto func_exit;
  194. case SB_DMA_6:
  195. card->dma = 6;
  196. goto func_exit;
  197. case SB_DMA_7:
  198. card->dma = 7;
  199. goto func_exit;
  200. default:
  201. break;
  202. }
  203. break;
  204. }
  205. }
  206. func_exit:
  207. RestoreScreen();
  208. return ( rval );
  209. }
  210. //
  211. // Choose SB IRQ channel
  212. //
  213. enum { SB_IRQ_2, SB_IRQ_5, SB_IRQ_7, SB_IRQ_MAX };
  214. item_t sbirqitems[]=
  215. {
  216. {SB_IRQ_2, 35,11,7, -1,-1},
  217. {SB_IRQ_5, 35,12,7, -1,-1},
  218. {SB_IRQ_7, 35,13,7, -1,-1}
  219. };
  220. menu_t sbirqmenu=
  221. {
  222. &sbirqitems[0],
  223. SB_IRQ_5,
  224. SB_IRQ_MAX,
  225. 0x7f
  226. };
  227. int ChooseSbIrq (DMXCARD * card)
  228. {
  229. short field;
  230. short key;
  231. int rval = 0;
  232. if ( card->irq > 8 )
  233. ErrorWindow(&irqerr);
  234. switch ( card->irq )
  235. {
  236. case 2:
  237. field = SB_IRQ_2;
  238. break;
  239. default:
  240. case 5:
  241. field = SB_IRQ_5;
  242. break;
  243. case 7:
  244. field = SB_IRQ_7;
  245. break;
  246. }
  247. SaveScreen();
  248. DrawPup(&sbirq);
  249. sbirqmenu.startitem = field;
  250. while(1)
  251. {
  252. SetupMenu(&sbirqmenu);
  253. field = GetMenuInput();
  254. key = menukey;
  255. switch ( key )
  256. {
  257. case KEY_ESC:
  258. rval = -1;
  259. goto func_exit;
  260. case KEY_ENTER:
  261. case KEY_F10:
  262. switch ( field )
  263. {
  264. case SB_IRQ_2:
  265. card->irq = 2;
  266. goto func_exit;
  267. case SB_IRQ_5:
  268. card->irq = 5;
  269. goto func_exit;
  270. case SB_IRQ_7:
  271. card->irq = 7;
  272. goto func_exit;
  273. default:
  274. break;
  275. }
  276. break;
  277. }
  278. }
  279. func_exit:
  280. RestoreScreen();
  281. return ( rval );
  282. }
  283. //
  284. // Choose # of simultaneous digital channels
  285. //
  286. enum {DIG_1,DIG_2,DIG_3,DIG_4,DIG_5,DIG_6,DIG_7,DIG_8,DIG_MAX};
  287. item_t numdigitems[]=
  288. {
  289. {DIG_1, 36,8,7, -1,-1},
  290. {DIG_2, 36,9,7, -1,-1},
  291. {DIG_3, 36,10,7, -1,-1},
  292. {DIG_4, 36,11,7, -1,-1},
  293. {DIG_5, 36,12,7, -1,-1},
  294. {DIG_6, 36,13,7, -1,-1},
  295. {DIG_7, 36,14,7, -1,-1},
  296. {DIG_8, 36,15,7, -1,-1}
  297. };
  298. menu_t numdigmenu=
  299. {
  300. &numdigitems[0],
  301. DIG_4,
  302. DIG_MAX,
  303. 0x7f
  304. };
  305. int ChooseNumDig (void)
  306. {
  307. short key;
  308. short field;
  309. int rval = 0;
  310. SaveScreen();
  311. DrawPup(&numdig);
  312. // DEFAULT FIELD ========================================
  313. switch ( newc.numdig )
  314. {
  315. default:
  316. field = DIG_4;
  317. break;
  318. case 1:
  319. field = DIG_1;
  320. break;
  321. case 2:
  322. field = DIG_2;
  323. break;
  324. case 3:
  325. field = DIG_3;
  326. break;
  327. case 4:
  328. field = DIG_4;
  329. break;
  330. case 5:
  331. field = DIG_5;
  332. break;
  333. case 6:
  334. field = DIG_6;
  335. break;
  336. case 7:
  337. field = DIG_7;
  338. break;
  339. case 8:
  340. field = DIG_8;
  341. break;
  342. }
  343. numdigmenu.startitem = field;
  344. while(1)
  345. {
  346. SetupMenu(&numdigmenu);
  347. field = GetMenuInput();
  348. key = menukey;
  349. switch ( key )
  350. {
  351. case KEY_ESC:
  352. rval = -1;
  353. goto func_exit;
  354. case KEY_ENTER:
  355. case KEY_F10:
  356. switch ( field )
  357. {
  358. case DIG_1:
  359. newc.numdig = 1;
  360. goto func_exit;
  361. case DIG_2:
  362. newc.numdig = 2;
  363. goto func_exit;
  364. case DIG_3:
  365. newc.numdig = 3;
  366. goto func_exit;
  367. case DIG_4:
  368. newc.numdig = 4;
  369. goto func_exit;
  370. case DIG_5:
  371. newc.numdig = 5;
  372. goto func_exit;
  373. case DIG_6:
  374. newc.numdig = 6;
  375. goto func_exit;
  376. case DIG_7:
  377. newc.numdig = 7;
  378. goto func_exit;
  379. case DIG_8:
  380. newc.numdig = 8;
  381. goto func_exit;
  382. default:
  383. break;
  384. }
  385. break;
  386. }
  387. }
  388. func_exit:
  389. RestoreScreen();
  390. return ( rval );
  391. }
  392. //
  393. // Setup Sound Effects card
  394. //
  395. int SetupFX (void)
  396. {
  397. if ( ChooseFxCard() == -1 ) return ( -1 );
  398. DrawCurrentConfig();
  399. switch ( newc.d.card )
  400. {
  401. default:
  402. savefx = FALSE;
  403. break;
  404. case M_NONE:
  405. savefx = TRUE;
  406. break;
  407. // case M_PC:
  408. // savefx = TRUE;
  409. // break;
  410. case M_ADLIB:
  411. savefx = TRUE;
  412. break;
  413. case M_PAS:
  414. case M_GUS:
  415. ChooseNumDig();
  416. savefx = TRUE;
  417. break;
  418. case M_WAVE:
  419. case M_SB:
  420. if ( ChooseSbPort ( &newc.d ) == -1 ) return ( -1 );
  421. if ( ChooseSbIrq ( &newc.d ) == -1 ) return ( -1 );
  422. if ( ChooseSbDma ( &newc.d ) == -1 ) return ( -1 );
  423. ChooseNumDig();
  424. savefx = TRUE;
  425. break;
  426. case M_CANVAS:
  427. newc.d.midiport = 0x330;
  428. if ( ChooseMidiPort ( &newc.d ) == -1 ) return ( -1 );
  429. savefx = TRUE;
  430. break;
  431. case M_GMIDI:
  432. if ( ChooseMidiPort ( &newc.d ) == -1 ) return ( -1 );
  433. savefx = TRUE;
  434. break;
  435. }
  436. return 0;
  437. }