Debian Codegraph @

src/gui/sysConf.cpp

raw
1 /**
2 * Furnace Tracker - multi-system chiptune tracker
3 * Copyright (C) 2021-2025 tildearrow and contributors
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #include "../engine/chipUtils.h"
21 #include "../engine/platform/gbaminmod.h"
22 #include "gui.h"
23 #include "misc/cpp/imgui_stdlib.h"
24 #include <imgui.h>
25
26 bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& flags, bool modifyOnChange, bool fromMenu) {
27 bool altered=false;
28 bool mustRender=false;
29 bool restart=modifyOnChange;
30 bool supportsCustomRate=true;
31
32 switch (type) {
33 case DIV_SYSTEM_YM2612:
34 case DIV_SYSTEM_YM2612_EXT:
35 case DIV_SYSTEM_YM2612_DUALPCM:
36 case DIV_SYSTEM_YM2612_DUALPCM_EXT:
37 case DIV_SYSTEM_YM2612_CSM: {
38 int clockSel=flags.getInt("clockSel",0);
39 int chipType=1;
40 if (flags.has("chipType")) {
41 chipType=flags.getInt("chipType",1);
42 } else if (flags.has("ladderEffect")) {
43 chipType=flags.getBool("ladderEffect",0)?1:0;
44 }
45 int interruptSimCycles=flags.getInt("interruptSimCycles",0);
46 bool noExtMacros=flags.getBool("noExtMacros",false);
47 bool fbAllOps=flags.getBool("fbAllOps",false);
48 bool msw=flags.getBool("msw",false);
49
50 ImGui::Text(_("Clock rate:"));
51 ImGui::Indent();
52 if (ImGui::RadioButton("NTSC (7.67MHz)",clockSel==0)) {
53 clockSel=0;
54 altered=true;
55 }
56 if (ImGui::RadioButton("PAL (7.61MHz)",clockSel==1)) {
57 clockSel=1;
58 altered=true;
59 }
60 if (ImGui::RadioButton("FM Towns (8MHz)",clockSel==2)) {
61 clockSel=2;
62 altered=true;
63 }
64 if (ImGui::RadioButton("AtGames Genesis (6.13MHz)",clockSel==3)) {
65 clockSel=3;
66 altered=true;
67 }
68 if (ImGui::RadioButton("Sega System 32 (8.05MHz)",clockSel==4)) {
69 clockSel=4;
70 altered=true;
71 }
72 ImGui::Unindent();
73
74 ImGui::Text(_("Chip type:"));
75 ImGui::Indent();
76 if (ImGui::RadioButton(_("YM2612 (9-bit DAC with distortion)"),chipType==1)) {
77 chipType=1;
78 altered=true;
79 }
80 if (ImGui::RadioButton(_("YM3438 (9-bit DAC)"),chipType==0)) {
81 chipType=0;
82 altered=true;
83 }
84 if (ImGui::RadioButton(_("YMF276 (external DAC)"),chipType==2)) {
85 chipType=2;
86 altered=true;
87 }
88 ImGui::Unindent();
89
90 if (type==DIV_SYSTEM_YM2612_EXT || type==DIV_SYSTEM_YM2612_DUALPCM_EXT || type==DIV_SYSTEM_YM2612_CSM) {
91 if (ImGui::Checkbox(_("Disable ExtCh FM macros (compatibility)"),&noExtMacros)) {
92 altered=true;
93 }
94 if (ImGui::Checkbox(_("Ins change in ExtCh operator 2-4 affects FB (compatibility)"),&fbAllOps)) {
95 altered=true;
96 }
97 }
98
99 if (msw || settings.mswEnabled) {
100 if (ImGui::Checkbox(_("Modified sine wave (joke)"),&msw)) {
101 altered=true;
102 }
103 }
104
105 ImGui::Text(_("DAC interrupt simulation:"));
106 if (CWSliderInt(_("cycles##InterruptSim"),&interruptSimCycles,0,256)) {
107 if (interruptSimCycles<0) interruptSimCycles=0;
108 if (interruptSimCycles>256) interruptSimCycles=256;
109 altered=true;
110 } rightClickable
111
112 if (altered) {
113 e->lockSave([&]() {
114 flags.set("clockSel",clockSel);
115 flags.set("chipType",chipType);
116 flags.set("noExtMacros",noExtMacros);
117 flags.set("fbAllOps",fbAllOps);
118 flags.set("msw",msw);
119 flags.set("interruptSimCycles",interruptSimCycles);
120 });
121 }
122 break;
123 }
124 case DIV_SYSTEM_SMS: {
125 int clockSel=flags.getInt("clockSel",0);
126 int chipType=flags.getInt("chipType",0);
127 bool noPhaseReset=flags.getBool("noPhaseReset",false);
128 bool noEasyNoise=flags.getBool("noEasyNoise",false);
129
130 ImGui::Text(_("Clock rate:"));
131 ImGui::Indent();
132 if (ImGui::RadioButton(_("3.58MHz (NTSC)"),clockSel==0)) {
133 clockSel=0;
134 altered=true;
135 }
136 if (ImGui::RadioButton(_("3.55MHz (PAL)"),clockSel==1)) {
137 clockSel=1;
138 altered=true;
139 }
140 if (ImGui::RadioButton(_("4MHz (BBC Micro)"),clockSel==2)) {
141 clockSel=2;
142 altered=true;
143 }
144 if (ImGui::RadioButton(_("1.79MHz (Half NTSC)"),clockSel==3)) {
145 clockSel=3;
146 altered=true;
147 }
148 if (ImGui::RadioButton(_("3MHz (Exed Exes)"),clockSel==4)) {
149 clockSel=4;
150 altered=true;
151 }
152 if (ImGui::RadioButton(_("2MHz (Sega System 1)"),clockSel==5)) {
153 clockSel=5;
154 altered=true;
155 }
156 if (ImGui::RadioButton(_("447KHz (TI-99/4A)"),clockSel==6)) {
157 clockSel=6;
158 altered=true;
159 }
160 ImGui::Unindent();
161 ImGui::Text(_("Chip type:"));
162 ImGui::Indent();
163 if (ImGui::RadioButton(_("Sega VDP/Master System"),chipType==0)) {
164 chipType=0;
165 altered=true;
166 }
167 if (ImGui::RadioButton(_("TI SN76489"),chipType==1)) {
168 chipType=1;
169 altered=true;
170 }
171 if (ImGui::RadioButton(_("TI SN76489 with Atari-like short noise"),chipType==2)) {
172 chipType=2;
173 altered=true;
174 }
175 if (ImGui::RadioButton(_("Game Gear"),chipType==3)) {
176 chipType=3;
177 altered=true;
178 }
179 if (ImGui::RadioButton(_("TI SN76489A"),chipType==4)) {
180 chipType=4;
181 altered=true;
182 }
183 if (ImGui::RadioButton(_("TI SN76496"),chipType==5)) {
184 chipType=5;
185 altered=true;
186 }
187 if (ImGui::RadioButton(_("NCR 8496"),chipType==6)) {
188 chipType=6;
189 altered=true;
190 }
191 if (ImGui::RadioButton(_("Tandy PSSJ 3-voice sound"),chipType==7)) {
192 chipType=7;
193 altered=true;
194 }
195 if (ImGui::RadioButton(_("TI SN94624"),chipType==8)) {
196 chipType=8;
197 altered=true;
198 }
199 if (ImGui::RadioButton(_("TI SN76494"),chipType==9)) {
200 chipType=9;
201 altered=true;
202 }
203 ImGui::Unindent();
204
205 if (ImGui::Checkbox(_("Disable noise period change phase reset"),&noPhaseReset)) {
206 altered=true;
207 }
208
209 if (ImGui::Checkbox(_("Disable easy period to note mapping on upper octaves"),&noEasyNoise)) {
210 altered=true;
211 }
212
213 if (altered) {
214 e->lockSave([&]() {
215 flags.set("clockSel",clockSel);
216 flags.set("chipType",chipType);
217 flags.set("noPhaseReset",noPhaseReset);
218 flags.set("noEasyNoise",noEasyNoise);
219 });
220 }
221 break;
222 }
223 case DIV_SYSTEM_PCE: {
224 bool clockSel=flags.getInt("clockSel",0);
225 int chipType=flags.getInt("chipType",0);
226 bool noAntiClick=flags.getBool("noAntiClick",false);
227
228 if (ImGui::Checkbox(_("Pseudo-PAL"),&clockSel)) {
229 altered=true;
230 }
231 if (ImGui::Checkbox(_("Disable anti-click"),&noAntiClick)) {
232 altered=true;
233 }
234 ImGui::Text(_("Chip revision:"));
235 ImGui::Indent();
236 if (ImGui::RadioButton(_("HuC6280 (original)"),chipType==0)) {
237 chipType=0;
238 altered=true;
239 }
240 if (ImGui::RadioButton(_("HuC6280A (SuperGrafx)"),chipType==1)) {
241 chipType=1;
242 altered=true;
243 }
244 ImGui::Unindent();
245
246 if (altered) {
247 e->lockSave([&]() {
248 flags.set("clockSel",(int)clockSel);
249 flags.set("chipType",chipType);
250 flags.set("noAntiClick",noAntiClick);
251 });
252 }
253 break;
254 }
255 case DIV_SYSTEM_SOUND_UNIT: {
256 int clockSel=flags.getInt("clockSel",0);
257 bool echo=flags.getBool("echo",false);
258 bool swapEcho=flags.getBool("swapEcho",false);
259 int sampleMemSize=flags.getInt("sampleMemSize",0);
260 bool pdm=flags.getBool("pdm",false);
261 int echoDelay=flags.getInt("echoDelay",0);
262 int echoFeedback=flags.getInt("echoFeedback",0);
263 int echoResolution=flags.getInt("echoResolution",0);
264 int echoVol=(signed char)flags.getInt("echoVol",0);
265
266 ImGui::Text(_("CPU rate:"));
267 ImGui::Indent();
268 if (ImGui::RadioButton(_("6.18MHz (NTSC)"),clockSel==0)) {
269 clockSel=0;
270 altered=true;
271 }
272 if (ImGui::RadioButton(_("5.95MHz (PAL)"),clockSel==1)) {
273 clockSel=1;
274 altered=true;
275 }
276 ImGui::Unindent();
277 ImGui::Text(_("Sample memory:"));
278 ImGui::Indent();
279 if (ImGui::RadioButton(_("8K (rev A/B/E)"),sampleMemSize==0)) {
280 sampleMemSize=0;
281 altered=true;
282 }
283 if (ImGui::RadioButton(_("64K (rev D/F)"),sampleMemSize==1)) {
284 sampleMemSize=1;
285 altered=true;
286 }
287 ImGui::Unindent();
288 ImGui::Text(_("DAC resolution:"));
289 ImGui::Indent();
290 if (ImGui::RadioButton(_("16-bit (rev A/B/D/F)"),pdm==0)) {
291 pdm=false;
292 altered=true;
293 }
294 if (ImGui::RadioButton(_("8-bit + TDM (rev C/E)"),pdm==1)) {
295 pdm=true;
296 altered=true;
297 }
298 ImGui::Unindent();
299 if (ImGui::Checkbox(_("Enable echo"),&echo)) {
300 altered=true;
301 }
302 if (ImGui::Checkbox(_("Swap echo channels"),&swapEcho)) {
303 altered=true;
304 }
305 ImGui::Text(_("Echo delay:"));
306 if (CWSliderInt("##EchoBufSize",&echoDelay,0,63)) {
307 if (echoDelay<0) echoDelay=0;
308 if (echoDelay>63) echoDelay=63;
309 altered=true;
310 } rightClickable
311 ImGui::Text(_("Echo resolution:"));
312 if (CWSliderInt("##EchoResolution",&echoResolution,0,15)) {
313 if (echoResolution<0) echoResolution=0;
314 if (echoResolution>15) echoResolution=15;
315 altered=true;
316 } rightClickable
317 ImGui::Text(_("Echo feedback:"));
318 if (CWSliderInt("##EchoFeedback",&echoFeedback,0,15)) {
319 if (echoFeedback<0) echoFeedback=0;
320 if (echoFeedback>15) echoFeedback=15;
321 altered=true;
322 } rightClickable
323 ImGui::Text(_("Echo volume:"));
324 if (CWSliderInt("##EchoVolume",&echoVol,-128,127)) {
325 if (echoVol<-128) echoVol=-128;
326 if (echoVol>127) echoVol=127;
327 altered=true;
328 } rightClickable
329
330 if (altered) {
331 e->lockSave([&]() {
332 flags.set("clockSel",clockSel);
333 flags.set("echo",echo);
334 flags.set("swapEcho",swapEcho);
335 flags.set("sampleMemSize",sampleMemSize);
336 flags.set("pdm",pdm);
337 flags.set("echoDelay",echoDelay);
338 flags.set("echoFeedback",echoFeedback);
339 flags.set("echoResolution",echoResolution);
340 flags.set("echoVol",(unsigned char)echoVol);
341 });
342 }
343 break;
344 }
345 case DIV_SYSTEM_GB: {
346 int chipType=flags.getInt("chipType",0);
347 bool noAntiClick=flags.getBool("noAntiClick",false);
348 bool invertWave=flags.getBool("invertWave",true);
349 bool enoughAlready=flags.getBool("enoughAlready",false);
350
351 if (ImGui::Checkbox(_("Disable anti-click"),&noAntiClick)) {
352 altered=true;
353 }
354 ImGui::Text(_("Chip revision:"));
355 ImGui::Indent();
356 if (ImGui::RadioButton(_("Original (DMG)"),chipType==0)) {
357 chipType=0;
358 altered=true;
359 }
360 if (ImGui::RadioButton(_("Game Boy Color (rev C)"),chipType==1)) {
361 chipType=1;
362 altered=true;
363 }
364 if (ImGui::RadioButton(_("Game Boy Color (rev E)"),chipType==2)) {
365 chipType=2;
366 altered=true;
367 }
368 if (ImGui::RadioButton(_("Game Boy Advance"),chipType==3)) {
369 chipType=3;
370 altered=true;
371 }
372 ImGui::Unindent();
373 ImGui::Text(_("Wave channel orientation:"));
374 if (chipType==3) {
375 ImGui::Indent();
376 if (ImGui::RadioButton(_("Normal"),!invertWave)) {
377 invertWave=false;
378 altered=true;
379 }
380 if (ImGui::RadioButton(_("Inverted"),invertWave)) {
381 invertWave=true;
382 altered=true;
383 }
384 ImGui::Unindent();
385 } else {
386 ImGui::Indent();
387 if (ImGui::RadioButton(_("Exact data (inverted)"),!invertWave)) {
388 invertWave=false;
389 altered=true;
390 }
391 if (ImGui::RadioButton(_("Exact output (normal)"),invertWave)) {
392 invertWave=true;
393 altered=true;
394 }
395 ImGui::Unindent();
396 }
397 if (enoughAlready) {
398 if (ImGui::Checkbox(_("Pretty please one more compat flag when I use arpeggio and my sound length"),&enoughAlready)) {
399 altered=true;
400 }
401 }
402
403 if (altered) {
404 e->lockSave([&]() {
405 flags.set("chipType",chipType);
406 flags.set("noAntiClick",noAntiClick);
407 flags.set("invertWave",invertWave);
408 flags.set("enoughAlready",enoughAlready);
409 });
410 }
411 break;
412 }
413 case DIV_SYSTEM_GBA_DMA: {
414 int dacDepth=flags.getInt("dacDepth",9);
415
416 ImGui::Text(_("DAC bit depth (reduces output rate):"));
417 if (CWSliderInt("##DACDepth",&dacDepth,6,9)) {
418 if (dacDepth<6) dacDepth=6;
419 if (dacDepth>9) dacDepth=9;
420 altered=true;
421 }
422
423 if (altered) {
424 e->lockSave([&]() {
425 flags.set("dacDepth",dacDepth);
426 });
427 }
428 break;
429 }
430 case DIV_SYSTEM_GBA_MINMOD: {
431 supportsCustomRate=false;
432 int volScale=flags.getInt("volScale",4096);
433 int mixBufs=flags.getInt("mixBufs",15);
434 int dacDepth=flags.getInt("dacDepth",9);
435 int channels=flags.getInt("channels",16);
436 int sampRate=flags.getInt("sampRate",21845);
437 ImGui::Text(_("Volume scale:"));
438 if (CWSliderInt("##VolScale",&volScale,0,32768)) {
439 if (volScale<0) volScale=0;
440 if (volScale>32768) volScale=32768;
441 altered=true;
442 } rightClickable
443 ImGui::Text(_("Mix buffers (allows longer echo delay):"));
444 if (CWSliderInt("##MixBufs",&mixBufs,2,15)) {
445 if (mixBufs<2) mixBufs=2;
446 if (mixBufs>16) mixBufs=16;
447 altered=true;
448 } rightClickable
449 ImGui::Text(_("DAC bit depth (reduces output rate):"));
450 if (CWSliderInt("##DACDepth",&dacDepth,6,9)) {
451 if (dacDepth<6) dacDepth=6;
452 if (dacDepth>9) dacDepth=9;
453 altered=true;
454 } rightClickable
455 ImGui::Text(_("Channel limit:"));
456 if (CWSliderInt("##Channels",&channels,1,16)) {
457 if (channels<1) channels=1;
458 if (channels>16) channels=16;
459 altered=true;
460 } rightClickable
461 ImGui::Text(_("Sample rate:"));
462 if (CWSliderInt("##SampRate",&sampRate,256,65536)) {
463 if (sampRate<1) sampRate=21845;
464 if (sampRate>65536) sampRate=65536;
465 altered=true;
466 } rightClickable
467 if (chan>=0) {
468 DivPlatformGBAMinMod* dispatch=(DivPlatformGBAMinMod*)e->getDispatch(chan);
469 if (dispatch!=NULL) {
470 float maxCPU=dispatch->maxCPU*100;
471 ImGui::Text(_("Actual sample rate: %d Hz"), dispatch->chipClock);
472 if (maxCPU>90) ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_WARNING]);
473 ImGui::Text(_("Max mixer CPU usage: %.0f%%"),maxCPU);
474 if (maxCPU>90) ImGui::PopStyleColor();
475 FurnaceGUI::popWarningColor();
476 }
477 }
478 if (altered) {
479 e->lockSave([&]() {
480 flags.set("volScale",volScale);
481 flags.set("mixBufs",mixBufs);
482 flags.set("dacDepth",dacDepth);
483 flags.set("channels",channels);
484 flags.set("sampRate",sampRate);
485 });
486 }
487 break;
488 }
489 case DIV_SYSTEM_OPLL:
490 case DIV_SYSTEM_OPLL_DRUMS:
491 case DIV_SYSTEM_VRC7: {
492 int clockSel=flags.getInt("clockSel",0);
493 int patchSet=flags.getInt("patchSet",0);
494 bool noTopHatFreq=flags.getBool("noTopHatFreq",false);
495 bool fixedAll=flags.getBool("fixedAll",true);
496
497 ImGui::Text(_("Clock rate:"));
498 ImGui::Indent();
499 if (ImGui::RadioButton(_("NTSC (3.58MHz)"),clockSel==0)) {
500 clockSel=0;
501 altered=true;
502 }
503 if (ImGui::RadioButton(_("PAL (3.55MHz)"),clockSel==1)) {
504 clockSel=1;
505 altered=true;
506 }
507 if (ImGui::RadioButton(_("Arcade (4MHz)"),clockSel==2)) {
508 clockSel=2;
509 altered=true;
510 }
511 if (ImGui::RadioButton(_("Half NTSC (1.79MHz)"),clockSel==3)) {
512 clockSel=3;
513 altered=true;
514 }
515 ImGui::Unindent();
516 if (type!=DIV_SYSTEM_VRC7) {
517 ImGui::Text(_("Patch set:"));
518 ImGui::Indent();
519 if (ImGui::RadioButton("Yamaha YM2413",patchSet==0)) {
520 patchSet=0;
521 altered=true;
522 }
523 if (ImGui::RadioButton("Yamaha YMF281",patchSet==1)) {
524 patchSet=1;
525 altered=true;
526 }
527 if (ImGui::RadioButton("Yamaha YM2423",patchSet==2)) {
528 patchSet=2;
529 altered=true;
530 }
531 if (ImGui::RadioButton("Konami VRC7",patchSet==3)) {
532 patchSet=3;
533 altered=true;
534 }
535 ImGui::Unindent();
536 }
537
538 if (type==DIV_SYSTEM_OPLL_DRUMS) {
539 if (ImGui::Checkbox(_("Ignore top/hi-hat frequency changes"),&noTopHatFreq)) {
540 altered=true;
541 }
542 if (ImGui::Checkbox(_("Apply fixed frequency to all drums at once"),&fixedAll)) {
543 altered=true;
544 }
545 }
546
547 if (altered) {
548 e->lockSave([&]() {
549 flags.set("clockSel",clockSel);
550 if (type!=DIV_SYSTEM_VRC7) {
551 flags.set("patchSet",patchSet);
552 }
553 flags.set("noTopHatFreq",noTopHatFreq);
554 flags.set("fixedAll",fixedAll);
555 });
556 }
557 break;
558 }
559 case DIV_SYSTEM_YM2151: {
560 int clockSel=flags.getInt("clockSel",0);
561 bool brokenPitch=flags.getBool("brokenPitch",false);
562
563 ImGui::Indent();
564 if (ImGui::RadioButton(_("NTSC/X16 (3.58MHz)"),clockSel==0)) {
565 clockSel=0;
566 altered=true;
567 }
568 if (ImGui::RadioButton(_("PAL (3.55MHz)"),clockSel==1)) {
569 clockSel=1;
570 altered=true;
571 }
572 if (ImGui::RadioButton(_("X1/X68000 (4MHz)"),clockSel==2)) {
573 clockSel=2;
574 altered=true;
575 }
576 ImGui::Unindent();
577
578 if (ImGui::Checkbox(_("Broken pitch macro/slides (compatibility)"),&brokenPitch)) {
579 altered=true;
580 }
581
582 if (altered) {
583 e->lockSave([&]() {
584 flags.set("clockSel",clockSel);
585 flags.set("brokenPitch",brokenPitch);
586 });
587 }
588 break;
589 }
590 case DIV_SYSTEM_OPZ: {
591 bool clockSel=flags.getInt("clockSel",0);
592 bool brokenPitch=flags.getBool("brokenPitch",false);
593
594 if (ImGui::Checkbox(_("Pseudo-PAL"),&clockSel)) {
595 altered=true;
596 }
597
598 if (ImGui::Checkbox(_("Broken pitch macro/slides (compatibility)"),&brokenPitch)) {
599 altered=true;
600 }
601
602 if (altered) {
603 e->lockSave([&]() {
604 flags.set("clockSel",(int)clockSel);
605 flags.set("brokenPitch",brokenPitch);
606 });
607 }
608 break;
609 }
610 case DIV_SYSTEM_NES:
611 case DIV_SYSTEM_5E01: {
612 int clockSel=flags.getInt("clockSel",0);
613 bool dpcmMode=flags.getBool("dpcmMode",true);
614 bool resetSweep=flags.getBool("resetSweep",false);
615
616 ImGui::Text(_("Clock rate:"));
617
618 ImGui::Indent();
619 if (ImGui::RadioButton(_("NTSC (1.79MHz)"),clockSel==0)) {
620 clockSel=0;
621 altered=true;
622 }
623 if (ImGui::RadioButton(_("PAL (1.67MHz)"),clockSel==1)) {
624 clockSel=1;
625 altered=true;
626 }
627 if (ImGui::RadioButton(_("Dendy (1.77MHz)"),clockSel==2)) {
628 clockSel=2;
629 altered=true;
630 }
631 ImGui::Unindent();
632
633 ImGui::Text(_("DPCM channel mode:"));
634
635 ImGui::Indent();
636 if (ImGui::RadioButton(_("DPCM (muffled samples; low CPU usage)"),dpcmMode)) {
637 dpcmMode=true;
638 altered=true;
639 }
640 if (ImGui::RadioButton(_("PCM (crisp samples; high CPU usage)"),!dpcmMode)) {
641 dpcmMode=false;
642 altered=true;
643 }
644 ImGui::Unindent();
645
646 if (ImGui::Checkbox(_("Reset sweep on new note"),&resetSweep)) {
647 altered=true;
648 }
649
650 if (altered) {
651 e->lockSave([&]() {
652 flags.set("clockSel",clockSel);
653 flags.set("dpcmMode",dpcmMode);
654 flags.set("resetSweep",resetSweep);
655 });
656 }
657 break;
658 }
659 case DIV_SYSTEM_VRC6:
660 case DIV_SYSTEM_FDS:
661 case DIV_SYSTEM_MMC5: {
662 int clockSel=flags.getInt("clockSel",0);
663
664 ImGui::Text(_("Clock rate:"));
665
666 ImGui::Indent();
667 if (ImGui::RadioButton(_("NTSC (1.79MHz)"),clockSel==0)) {
668 clockSel=0;
669 altered=true;
670 }
671 if (ImGui::RadioButton(_("PAL (1.67MHz)"),clockSel==1)) {
672 clockSel=1;
673 altered=true;
674 }
675 if (ImGui::RadioButton(_("Dendy (1.77MHz)"),clockSel==2)) {
676 clockSel=2;
677 altered=true;
678 }
679 ImGui::Unindent();
680
681 if (altered) {
682 e->lockSave([&]() {
683 flags.set("clockSel",clockSel);
684 });
685 }
686 break;
687 }
688 case DIV_SYSTEM_C64_8580:
689 case DIV_SYSTEM_C64_6581:
690 case DIV_SYSTEM_C64_PCM: {
691 int clockSel=flags.getInt("clockSel",0);
692 bool keyPriority=flags.getBool("keyPriority",true);
693 bool no1EUpdate=flags.getBool("no1EUpdate",false);
694 bool multiplyRel=flags.getBool("multiplyRel",false);
695 bool macroRace=flags.getBool("macroRace",false);
696 int testAttack=flags.getInt("testAttack",0);
697 int testDecay=flags.getInt("testDecay",0);
698 int testSustain=flags.getInt("testSustain",0);
699 int testRelease=flags.getInt("testRelease",0);
700 int initResetTime=flags.getInt("initResetTime",2);
701
702 ImGui::Text(_("Clock rate:"));
703
704 ImGui::Indent();
705 if (ImGui::RadioButton(_("NTSC (1.02MHz)"),clockSel==0)) {
706 clockSel=0;
707 altered=true;
708 }
709 if (ImGui::RadioButton(_("PAL (0.99MHz)"),clockSel==1)) {
710 clockSel=1;
711 altered=true;
712 }
713 if (ImGui::RadioButton(_("SSI 2001 (0.89MHz)"),clockSel==2)) {
714 clockSel=2;
715 altered=true;
716 }
717 ImGui::Unindent();
718
719 ImGui::Text(_("Global parameter priority:"));
720
721 ImGui::Indent();
722 if (ImGui::RadioButton(_("Left to right"),!keyPriority)) {
723 keyPriority=false;
724 altered=true;
725 }
726 if (ImGui::RadioButton(_("Last used channel"),keyPriority)) {
727 keyPriority=true;
728 altered=true;
729 }
730 ImGui::Unindent();
731
732 ImGui::Text(_("Hard reset envelope:"));
733
734 if (CWSliderInt(_("Attack"),&testAttack,0,15)) {
735 if (testAttack<0) testAttack=0;
736 if (testAttack>15) testAttack=15;
737 altered=true;
738 }
739 if (CWSliderInt(_("Decay"),&testDecay,0,15)) {
740 if (testDecay<0) testDecay=0;
741 if (testDecay>15) testDecay=15;
742 altered=true;
743 }
744 if (CWSliderInt(_("Sustain"),&testSustain,0,15)) {
745 if (testSustain<0) testSustain=0;
746 if (testSustain>15) testSustain=15;
747 altered=true;
748 }
749 if (CWSliderInt(_("Release"),&testRelease,0,15)) {
750 if (testRelease<0) testRelease=0;
751 if (testRelease>15) testRelease=15;
752 altered=true;
753 }
754
755 ImGui::Text(_("Envelope reset time:"));
756
757 pushWarningColor(initResetTime<1 || initResetTime>4);
758 if (CWSliderInt("##InitReset",&initResetTime,0,16)) {
759 if (initResetTime<0) initResetTime=0;
760 if (initResetTime>16) initResetTime=16;
761 altered=true;
762 }
763 popWarningColor();
764
765 ImGui::Text(_("- 0 disables envelope reset. not recommended!\n- 1 may trigger SID envelope bugs.\n- values that are too high may result in notes being skipped."));
766
767 if (ImGui::Checkbox(_("Disable 1Exy env update (compatibility)"),&no1EUpdate)) {
768 altered=true;
769 }
770
771 if (multiplyRel) {
772 if (ImGui::Checkbox(_("Relative duty and cutoff macros are coarse (compatibility)"),&multiplyRel)) {
773 altered=true;
774 }
775 }
776
777 if (ImGui::Checkbox(_("Cutoff macro race conditions (compatibility)"),&macroRace)) {
778 altered=true;
779 }
780
781
782 if (altered) {
783 e->lockSave([&]() {
784 flags.set("clockSel",clockSel);
785 flags.set("keyPriority",keyPriority);
786 flags.set("no1EUpdate",no1EUpdate);
787 flags.set("multiplyRel",multiplyRel);
788 flags.set("macroRace",macroRace);
789 flags.set("testAttack",testAttack);
790 flags.set("testDecay",testDecay);
791 flags.set("testSustain",testSustain);
792 flags.set("testRelease",testRelease);
793 flags.set("initResetTime",initResetTime);
794 });
795 }
796 break;
797 }
798 case DIV_SYSTEM_YM2610:
799 case DIV_SYSTEM_YM2610_EXT:
800 case DIV_SYSTEM_YM2610_CSM:
801 case DIV_SYSTEM_YM2610_FULL:
802 case DIV_SYSTEM_YM2610_FULL_EXT:
803 case DIV_SYSTEM_YM2610B:
804 case DIV_SYSTEM_YM2610B_EXT:
805 case DIV_SYSTEM_YM2610B_CSM: {
806 int clockSel=flags.getInt("clockSel",0);
807 bool noExtMacros=flags.getBool("noExtMacros",false);
808 bool fbAllOps=flags.getBool("fbAllOps",false);
809 int ssgVol=flags.getInt("ssgVol",128);
810 int fmVol=flags.getInt("fmVol",256);
811
812 ImGui::Indent();
813 if (ImGui::RadioButton(_("8MHz (Neo Geo MVS)"),clockSel==0)) {
814 clockSel=0;
815 altered=true;
816 }
817 if (ImGui::RadioButton(_("8.06MHz (Neo Geo AES)"),clockSel==1)) {
818 clockSel=1;
819 altered=true;
820 }
821 ImGui::Unindent();
822
823 if (type==DIV_SYSTEM_YM2610_EXT || type==DIV_SYSTEM_YM2610_FULL_EXT || type==DIV_SYSTEM_YM2610B_EXT || type==DIV_SYSTEM_YM2610_CSM || type==DIV_SYSTEM_YM2610B_CSM) {
824 if (ImGui::Checkbox(_("Disable ExtCh FM macros (compatibility)"),&noExtMacros)) {
825 altered=true;
826 }
827 if (ImGui::Checkbox(_("Ins change in ExtCh operator 2-4 affects FB (compatibility)"),&fbAllOps)) {
828 altered=true;
829 }
830 }
831
832 if (CWSliderInt(_("SSG Volume"),&ssgVol,0,256)) {
833 if (ssgVol<0) ssgVol=0;
834 if (ssgVol>256) ssgVol=256;
835 altered=true;
836 } rightClickable
837
838 if (CWSliderInt(_("FM/ADPCM Volume"),&fmVol,0,256)) {
839 if (fmVol<0) fmVol=0;
840 if (fmVol>256) fmVol=256;
841 altered=true;
842 } rightClickable
843
844 if (altered) {
845 e->lockSave([&]() {
846 flags.set("clockSel",clockSel);
847 flags.set("noExtMacros",noExtMacros);
848 flags.set("fbAllOps",fbAllOps);
849 flags.set("ssgVol",ssgVol);
850 flags.set("fmVol",fmVol);
851 });
852 }
853 break;
854 }
855 case DIV_SYSTEM_AY8910:
856 case DIV_SYSTEM_AY8930: {
857 int clockSel=flags.getInt("clockSel",0);
858 int chipType=flags.getInt("chipType",0);
859 bool halfClock=flags.getBool("halfClock",false);
860 bool stereo=flags.getBool("stereo",false);
861 int stereoSep=flags.getInt("stereoSep",0);
862
863 ImGui::Text(_("Clock rate:"));
864 ImGui::Indent();
865 if (ImGui::RadioButton(_("1.79MHz (ZX Spectrum NTSC/MSX)"),clockSel==0)) {
866 clockSel=0;
867 altered=true;
868 }
869 if (ImGui::RadioButton(_("1.77MHz (ZX Spectrum PAL)"),clockSel==1)) {
870 clockSel=1;
871 altered=true;
872 }
873 if (ImGui::RadioButton(_("0.83MHz (Pre-divided Sunsoft 5B on PAL)"),clockSel==8)) {
874 clockSel=8;
875 altered=true;
876 }
877 if (ImGui::RadioButton(_("0.89MHz (Pre-divided Sunsoft 5B)"),clockSel==6)) {
878 clockSel=6;
879 altered=true;
880 }
881 if (ImGui::RadioButton(_("1MHz (Amstrad CPC)"),clockSel==5)) {
882 clockSel=5;
883 altered=true;
884 }
885 if (ImGui::RadioButton(_("1.10MHz (Gamate/VIC-20 PAL)"),clockSel==9)) {
886 clockSel=9;
887 altered=true;
888 }
889 if (ImGui::RadioButton(_("1.25MHz (Mag Max)"),clockSel==13)) {
890 clockSel=13;
891 altered=true;
892 }
893 if (ImGui::RadioButton(_("1.5MHz (Vectrex)"),clockSel==4)) {
894 clockSel=4;
895 altered=true;
896 }
897 if (ImGui::RadioButton(_("1.536MHz (Kyugo)"),clockSel==14)) {
898 clockSel=14;
899 altered=true;
900 }
901 if (ImGui::RadioButton(_("1.67MHz (?)"),clockSel==7)) {
902 clockSel=7;
903 altered=true;
904 }
905 if (ImGui::RadioButton(_("1.75MHz (ZX Spectrum 48K)"),clockSel==2)) {
906 clockSel=2;
907 altered=true;
908 }
909 if (ImGui::RadioButton(_("1.99MHz (PC-88)"),clockSel==15)) {
910 clockSel=15;
911 altered=true;
912 }
913 if (ImGui::RadioButton(_("2MHz (Atari ST/Sharp X1)"),clockSel==3)) {
914 clockSel=3;
915 altered=true;
916 }
917 if (ImGui::RadioButton(_("2^21Hz (Game Boy)"),clockSel==10)) {
918 clockSel=10;
919 altered=true;
920 }
921 if (ImGui::RadioButton(_("3.58MHz (Darky)"),clockSel==11)) {
922 clockSel=11;
923 altered=true;
924 }
925 if (ImGui::RadioButton(_("3.6MHz (Darky)"),clockSel==12)) {
926 clockSel=12;
927 altered=true;
928 }
929 ImGui::Unindent();
930 if (type==DIV_SYSTEM_AY8910) {
931 ImGui::Text(_("Chip type:"));
932 ImGui::Indent();
933 if (ImGui::RadioButton(_("AY-3-8910"),chipType==0)) {
934 chipType=0;
935 altered=true;
936 }
937 if (ImGui::RadioButton(_("YM2149(F)"),chipType==1)) {
938 chipType=1;
939 altered=true;
940 }
941 if (ImGui::RadioButton(_("Sunsoft 5B"),chipType==2)) {
942 chipType=2;
943 altered=true;
944 }
945 pushWarningColor(chipType==3 && settings.ayCore==1);
946 if (ImGui::RadioButton(_("AY-3-8914"),chipType==3)) {
947 chipType=3;
948 altered=true;
949 }
950 popWarningColor();
951 ImGui::Unindent();
952 if (ImGui::IsItemHovered()) {
953 if (ImGui::BeginTooltip()) {
954 ImGui::TextUnformatted(_("note: AY-3-8914 is not supported by the VGM format!"));
955 if (settings.ayCore==1) {
956 ImGui::TextUnformatted(_("AtomicSSG will not emulate AY-3-8914. falling back to MAME!"));
957 }
958 ImGui::EndTooltip();
959 }
960 }
961 }
962 ImGui::BeginDisabled(type==DIV_SYSTEM_AY8910 && chipType==2);
963 if (ImGui::Checkbox(_("Stereo##_AY_STEREO"),&stereo)) {
964 altered=true;
965 }
966 if (stereo) {
967 int sep=256-(stereoSep&255);
968 if (CWSliderInt(_("Separation"),&sep,1,256)) {
969 if (sep<1) sep=1;
970 if (sep>256) sep=256;
971 stereoSep=256-sep;
972 altered=true;
973 }
974 }
975 ImGui::EndDisabled();
976 ImGui::BeginDisabled(type==DIV_SYSTEM_AY8910 && chipType!=1);
977 if (ImGui::Checkbox(_("Half Clock divider##_AY_CLKSEL"),&halfClock)) {
978 altered=true;
979 }
980 ImGui::EndDisabled();
981
982 if (altered) {
983 e->lockSave([&]() {
984 flags.set("clockSel",clockSel);
985 if (type==DIV_SYSTEM_AY8910) {
986 flags.set("chipType",chipType);
987 }
988 flags.set("halfClock",halfClock);
989 flags.set("stereo",stereo);
990 flags.set("stereoSep",stereoSep);
991 });
992 }
993 break;
994 }
995 case DIV_SYSTEM_SAA1099: {
996 int clockSel=flags.getInt("clockSel",0);
997
998 ImGui::Indent();
999 if (ImGui::RadioButton(_("SAM Coupé (8MHz)"),clockSel==0)) {
1000 clockSel=0;
1001 altered=true;
1002 }
1003 if (ImGui::RadioButton(_("NTSC (7.15MHz)"),clockSel==1)) {
1004 clockSel=1;
1005 altered=true;
1006 }
1007 if (ImGui::RadioButton(_("PAL (7.09MHz)"),clockSel==2)) {
1008 clockSel=2;
1009 altered=true;
1010 }
1011 ImGui::Unindent();
1012
1013 if (altered) {
1014 e->lockSave([&]() {
1015 flags.set("clockSel",clockSel);
1016 });
1017 }
1018 break;
1019 }
1020 case DIV_SYSTEM_AMIGA: {
1021 bool clockSel=flags.getInt("clockSel",0);
1022 int chipType=flags.getInt("chipType",0);
1023 int chipMem=flags.getInt("chipMem",21);
1024 int stereoSep=flags.getInt("stereoSep",0);
1025 bool bypassLimits=flags.getBool("bypassLimits",false);
1026
1027 ImGui::Text(_("Stereo separation:"));
1028 if (CWSliderInt("##StereoSep",&stereoSep,0,127)) {
1029 if (stereoSep<0) stereoSep=0;
1030 if (stereoSep>127) stereoSep=127;
1031 altered=true;
1032 } rightClickable
1033
1034 ImGui::Text(_("Model:"));
1035 ImGui::Indent();
1036 if (ImGui::RadioButton(_("Amiga 500 (OCS)"),chipType==0)) {
1037 chipType=0;
1038 altered=true;
1039 }
1040 if (ImGui::RadioButton(_("Amiga 1200 (AGA)"),chipType==1)) {
1041 chipType=1;
1042 altered=true;
1043 }
1044 ImGui::Unindent();
1045
1046 ImGui::Text(_("Chip memory:"));
1047 ImGui::Indent();
1048 if (ImGui::RadioButton(_("2MB (ECS/AGA max)"),chipMem==21)) {
1049 chipMem=21;
1050 altered=true;
1051 mustRender=true;
1052 }
1053 if (ImGui::RadioButton("1MB",chipMem==20)) {
1054 chipMem=20;
1055 altered=true;
1056 mustRender=true;
1057 }
1058 if (ImGui::RadioButton(_("512KB (OCS max)"),chipMem==19)) {
1059 chipMem=19;
1060 altered=true;
1061 mustRender=true;
1062 }
1063 if (ImGui::RadioButton("256KB",chipMem==18)) {
1064 chipMem=18;
1065 altered=true;
1066 mustRender=true;
1067 }
1068 ImGui::Unindent();
1069
1070
1071 if (ImGui::Checkbox(_("PAL"),&clockSel)) {
1072 altered=true;
1073 }
1074 if (ImGui::Checkbox(_("Bypass frequency limits"),&bypassLimits)) {
1075 altered=true;
1076 }
1077
1078 if (altered) {
1079 e->lockSave([&]() {
1080 flags.set("clockSel",(int)clockSel);
1081 flags.set("chipType",chipType);
1082 flags.set("chipMem",chipMem);
1083 flags.set("stereoSep",stereoSep);
1084 flags.set("bypassLimits",bypassLimits);
1085 });
1086 }
1087 break;
1088 }
1089 case DIV_SYSTEM_TIA: {
1090 bool clockSel=flags.getInt("clockSel",0);
1091 int mixingType=flags.getInt("mixingType",0);
1092 bool softwarePitch=flags.getBool("softwarePitch",false);
1093 bool oldPitch=flags.getBool("oldPitch",false);
1094
1095 ImGui::BeginDisabled(oldPitch);
1096 if (ImGui::Checkbox(_("Software pitch driver"),&softwarePitch)) {
1097 altered=true;
1098 }
1099 ImGui::EndDisabled();
1100 if (ImGui::Checkbox(_("Old pitch table (compatibility)"),&oldPitch)) {
1101 if (oldPitch) softwarePitch=false;
1102 altered=true;
1103 }
1104
1105 ImGui::Text(_("Mixing mode:"));
1106 ImGui::Indent();
1107 if (ImGui::RadioButton(_("Mono"),mixingType==0)) {
1108 mixingType=0;
1109 altered=true;
1110 }
1111 if (ImGui::RadioButton(_("Mono (no distortion)"),mixingType==1)) {
1112 mixingType=1;
1113 altered=true;
1114 }
1115 if (ImGui::RadioButton(_("Stereo"),mixingType==2)) {
1116 mixingType=2;
1117 altered=true;
1118 }
1119 ImGui::Unindent();
1120
1121 if (ImGui::Checkbox(_("PAL"),&clockSel)) {
1122 altered=true;
1123 }
1124
1125 if (altered) {
1126 e->lockSave([&]() {
1127 flags.set("clockSel",(int)clockSel);
1128 flags.set("mixingType",mixingType);
1129 flags.set("softwarePitch",softwarePitch);
1130 flags.set("oldPitch",oldPitch);
1131 });
1132 }
1133 break;
1134 }
1135 case DIV_SYSTEM_PCSPKR: {
1136 int clockSel=flags.getInt("clockSel",0);
1137 int speakerType=flags.getInt("speakerType",0);
1138 bool resetPhase=flags.getBool("resetPhase",false);
1139
1140 ImGui::Text(_("Clock rate:"));
1141 ImGui::Indent();
1142 if (ImGui::RadioButton(_("1.19MHz (PC)"),clockSel==0)) {
1143 clockSel=0;
1144 altered=true;
1145 }
1146 if (ImGui::RadioButton(_("1.99MHz (PC-98)"),clockSel==1)) {
1147 clockSel=1;
1148 altered=true;
1149 }
1150 if (ImGui::RadioButton(_("2.46MHz (PC-98)"),clockSel==2)) {
1151 clockSel=2;
1152 altered=true;
1153 }
1154 ImGui::Unindent();
1155
1156 ImGui::Text(_("Speaker type:"));
1157 ImGui::Indent();
1158 if (ImGui::RadioButton(_("Unfiltered"),speakerType==0)) {
1159 speakerType=0;
1160 altered=true;
1161 }
1162 if (ImGui::RadioButton(_("Cone"),speakerType==1)) {
1163 speakerType=1;
1164 altered=true;
1165 }
1166 if (ImGui::RadioButton(_("Piezo"),speakerType==2)) {
1167 speakerType=2;
1168 altered=true;
1169 }
1170 if (ImGui::RadioButton(_("Use system beeper (Linux only!)"),speakerType==3)) {
1171 speakerType=3;
1172 altered=true;
1173 }
1174 ImGui::Unindent();
1175
1176 if (ImGui::Checkbox(_("Reset phase on frequency change"),&resetPhase)) {
1177 altered=true;
1178 }
1179
1180 if (altered) {
1181 e->lockSave([&]() {
1182 flags.set("clockSel",clockSel);
1183 flags.set("speakerType",speakerType);
1184 flags.set("resetPhase",resetPhase);
1185 });
1186 }
1187 break;
1188 }
1189 case DIV_SYSTEM_QSOUND: {
1190 int echoDelay=flags.getInt("echoDelay",0);
1191 int echoFeedback=flags.getInt("echoFeedback",0)&255;
1192
1193 ImGui::Text(_("Echo delay:"));
1194 int echoBufSize1=2725-echoDelay;
1195 if (CWSliderInt("##EchoBufSize",&echoBufSize1,0,2725)) {
1196 if (echoBufSize1<0) echoBufSize1=0;
1197 if (echoBufSize1>2725) echoBufSize1=2725;
1198 echoDelay=2725-echoBufSize1;
1199 altered=true;
1200 } rightClickable
1201 ImGui::Text(_("Echo feedback:"));
1202 if (CWSliderInt("##EchoFeedback",&echoFeedback,0,255)) {
1203 if (echoFeedback<0) echoFeedback=0;
1204 if (echoFeedback>255) echoFeedback=255;
1205 altered=true;
1206 } rightClickable
1207
1208 if (altered) {
1209 e->lockSave([&]() {
1210 flags.set("echoDelay",echoDelay);
1211 flags.set("echoFeedback",echoFeedback);
1212 });
1213 }
1214
1215 supportsCustomRate=false;
1216 break;
1217 }
1218 case DIV_SYSTEM_X1_010: {
1219 int clockSel=flags.getInt("clockSel",0);
1220 bool stereo=flags.getBool("stereo",false);
1221 bool isBanked=flags.getBool("isBanked",false);
1222
1223 ImGui::Text(_("Clock rate:"));
1224 ImGui::Indent();
1225 if (ImGui::RadioButton(_("16MHz (Seta 1)"),clockSel==0)) {
1226 clockSel=0;
1227 altered=true;
1228 }
1229 if (ImGui::RadioButton(_("16.67MHz (Seta 2)"),clockSel==1)) {
1230 clockSel=1;
1231 altered=true;
1232 }
1233 if (ImGui::RadioButton(_("14.32MHz (NTSC)"),clockSel==2)) {
1234 clockSel=2;
1235 altered=true;
1236 }
1237 ImGui::Unindent();
1238
1239 if (ImGui::Checkbox(_("Stereo"),&stereo)) {
1240 altered=true;
1241 }
1242
1243 if (ImGui::Checkbox(_("Bankswitched (Seta 2)"),&isBanked)) {
1244 altered=true;
1245 }
1246
1247 if (altered) {
1248 e->lockSave([&]() {
1249 flags.set("clockSel",clockSel);
1250 flags.set("stereo",stereo);
1251 flags.set("isBanked",isBanked);
1252 });
1253 }
1254 break;
1255 }
1256 case DIV_SYSTEM_N163: {
1257 int clockSel=flags.getInt("clockSel",0);
1258 int channels=flags.getInt("channels",0)+1;
1259 bool multiplex=flags.getBool("multiplex",false);
1260 bool lenCompensate=flags.getBool("lenCompensate",false);
1261
1262 ImGui::Text(_("Clock rate:"));
1263 ImGui::Indent();
1264 if (ImGui::RadioButton(_("NTSC (1.79MHz)"),clockSel==0)) {
1265 clockSel=0;
1266 altered=true;
1267 }
1268 if (ImGui::RadioButton(_("PAL (1.67MHz)"),clockSel==1)) {
1269 clockSel=1;
1270 altered=true;
1271 }
1272 if (ImGui::RadioButton(_("Dendy (1.77MHz)"),clockSel==2)) {
1273 clockSel=2;
1274 altered=true;
1275 }
1276 ImGui::Unindent();
1277 ImGui::Text(_("Initial channel limit:"));
1278 if (CWSliderInt("##N163_InitialChannelLimit",&channels,1,8)) {
1279 if (channels<1) channels=1;
1280 if (channels>8) channels=8;
1281 altered=true;
1282 } rightClickable
1283 if (ImGui::Checkbox(_("Disable hissing"),&multiplex)) {
1284 altered=true;
1285 }
1286 if (ImGui::Checkbox(_("Scale frequency to wave length"),&lenCompensate)) {
1287 altered=true;
1288 }
1289
1290 if (altered) {
1291 e->lockSave([&]() {
1292 flags.set("clockSel",clockSel);
1293 flags.set("channels",channels-1);
1294 flags.set("multiplex",multiplex);
1295 flags.set("lenCompensate",lenCompensate);
1296 });
1297 }
1298 break;
1299 }
1300 case DIV_SYSTEM_ES5506: {
1301 int channels=flags.getInt("channels",0x1f)+1;
1302 int volScale=flags.getInt("volScale",4095);
1303 bool amigaVol=flags.getBool("amigaVol",false);
1304 bool amigaPitch=flags.getBool("amigaPitch",false);
1305 ImGui::Text(_("Initial channel limit:"));
1306 if (CWSliderInt("##OTTO_InitialChannelLimit",&channels,5,32)) {
1307 if (channels<5) channels=5;
1308 if (channels>32) channels=32;
1309 altered=true;
1310 } rightClickable
1311
1312 ImGui::Text(_("Volume scale:"));
1313
1314 if (CWSliderInt("##VolScaleO",&volScale,0,4095)) {
1315 if (volScale<0) volScale=0;
1316 if (volScale>4095) volScale=4095;
1317 altered=true;
1318 } rightClickable
1319
1320 if (ImGui::Checkbox(_("Amiga channel volumes (64)"),&amigaVol)) {
1321 altered=true;
1322 }
1323 pushWarningColor(amigaPitch && e->song.linearPitch==2);
1324 if (ImGui::Checkbox(_("Amiga-like pitch (non-linear pitch only)"),&amigaPitch)) {
1325 altered=true;
1326 }
1327 if (amigaPitch && e->song.linearPitch==2) {
1328 if (ImGui::IsItemHovered()) {
1329 ImGui::SetTooltip("pitch linearity is set to linear. this won't do anything!");
1330 }
1331 }
1332 popWarningColor();
1333
1334 if (altered) {
1335 e->lockSave([&]() {
1336 flags.set("channels",channels-1);
1337 flags.set("volScale",volScale);
1338 flags.set("amigaVol",amigaVol);
1339 flags.set("amigaPitch",amigaPitch);
1340 });
1341 }
1342 break;
1343 }
1344 case DIV_SYSTEM_YM2203:
1345 case DIV_SYSTEM_YM2203_EXT:
1346 case DIV_SYSTEM_YM2203_CSM: {
1347 int clockSel=flags.getInt("clockSel",0);
1348 int prescale=flags.getInt("prescale",0);
1349 bool noExtMacros=flags.getBool("noExtMacros",false);
1350 bool fbAllOps=flags.getBool("fbAllOps",false);
1351 int ssgVol=flags.getInt("ssgVol",128);
1352 int fmVol=flags.getInt("fmVol",256);
1353
1354 ImGui::Text(_("Clock rate:"));
1355 ImGui::Indent();
1356 if (ImGui::RadioButton(_("3.58MHz (NTSC)"),clockSel==0)) {
1357 clockSel=0;
1358 altered=true;
1359 }
1360 if (ImGui::RadioButton(_("3.54MHz (PAL)"),clockSel==1)) {
1361 clockSel=1;
1362 altered=true;
1363 }
1364 if (ImGui::RadioButton(_("4MHz"),clockSel==2)) {
1365 clockSel=2;
1366 altered=true;
1367 }
1368 if (ImGui::RadioButton(_("3MHz"),clockSel==3)) {
1369 clockSel=3;
1370 altered=true;
1371 }
1372 if (ImGui::RadioButton(_("3.9936MHz (PC-88/PC-98)"),clockSel==4)) {
1373 clockSel=4;
1374 altered=true;
1375 }
1376 if (ImGui::RadioButton(_("1.5MHz"),clockSel==5)) {
1377 clockSel=5;
1378 altered=true;
1379 }
1380 ImGui::Unindent();
1381 ImGui::Text(_("Output rate:"));
1382 ImGui::Indent();
1383 if (ImGui::RadioButton(_("FM: clock / 72, SSG: clock / 16"),prescale==0)) {
1384 prescale=0;
1385 altered=true;
1386 }
1387 if (ImGui::RadioButton(_("FM: clock / 36, SSG: clock / 8"),prescale==1)) {
1388 prescale=1;
1389 altered=true;
1390 }
1391 if (ImGui::RadioButton(_("FM: clock / 24, SSG: clock / 4"),prescale==2)) {
1392 prescale=2;
1393 altered=true;
1394 }
1395 ImGui::Unindent();
1396
1397 if (CWSliderInt(_("SSG Volume"),&ssgVol,0,256)) {
1398 if (ssgVol<0) ssgVol=0;
1399 if (ssgVol>256) ssgVol=256;
1400 altered=true;
1401 } rightClickable
1402
1403 if (CWSliderInt(_("FM Volume"),&fmVol,0,256)) {
1404 if (fmVol<0) fmVol=0;
1405 if (fmVol>256) fmVol=256;
1406 altered=true;
1407 } rightClickable
1408
1409 if (type==DIV_SYSTEM_YM2203_EXT || type==DIV_SYSTEM_YM2203_CSM) {
1410 if (ImGui::Checkbox(_("Disable ExtCh FM macros (compatibility)"),&noExtMacros)) {
1411 altered=true;
1412 }
1413 if (ImGui::Checkbox(_("Ins change in ExtCh operator 2-4 affects FB (compatibility)"),&fbAllOps)) {
1414 altered=true;
1415 }
1416 }
1417
1418 if (altered) {
1419 e->lockSave([&]() {
1420 flags.set("clockSel",clockSel);
1421 flags.set("prescale",prescale);
1422 flags.set("noExtMacros",noExtMacros);
1423 flags.set("fbAllOps",fbAllOps);
1424 flags.set("ssgVol",ssgVol);
1425 flags.set("fmVol",fmVol);
1426 });
1427 }
1428 break;
1429 }
1430 case DIV_SYSTEM_YM2608:
1431 case DIV_SYSTEM_YM2608_EXT:
1432 case DIV_SYSTEM_YM2608_CSM: {
1433 int clockSel=flags.getInt("clockSel",0);
1434 int prescale=flags.getInt("prescale",0);
1435 bool noExtMacros=flags.getBool("noExtMacros",false);
1436 bool fbAllOps=flags.getBool("fbAllOps",false);
1437 bool memROM=flags.getBool("memROM",false);
1438 bool memParallel=flags.getBool("memParallel",true);
1439 int ssgVol=flags.getInt("ssgVol",128);
1440 int fmVol=flags.getInt("fmVol",256);
1441
1442 ImGui::Text(_("Clock rate:"));
1443 ImGui::Indent();
1444 if (ImGui::RadioButton(_("8MHz (Arcade)"),clockSel==0)) {
1445 clockSel=0;
1446 altered=true;
1447 }
1448 if (ImGui::RadioButton(_("7.987MHz (PC-88/PC-98)"),clockSel==1)) {
1449 clockSel=1;
1450 altered=true;
1451 }
1452 ImGui::Unindent();
1453 ImGui::Text(_("Output rate:"));
1454 ImGui::Indent();
1455 if (ImGui::RadioButton(_("FM: clock / 144, SSG: clock / 32"),prescale==0)) {
1456 prescale=0;
1457 altered=true;
1458 }
1459 if (ImGui::RadioButton(_("FM: clock / 72, SSG: clock / 16"),prescale==1)) {
1460 prescale=1;
1461 altered=true;
1462 }
1463 if (ImGui::RadioButton(_("FM: clock / 48, SSG: clock / 8"),prescale==2)) {
1464 prescale=2;
1465 altered=true;
1466 }
1467 ImGui::Unindent();
1468
1469 if (CWSliderInt(_("SSG Volume"),&ssgVol,0,256)) {
1470 if (ssgVol<0) ssgVol=0;
1471 if (ssgVol>256) ssgVol=256;
1472 altered=true;
1473 } rightClickable
1474
1475 if (CWSliderInt(_("FM/ADPCM Volume"),&fmVol,0,256)) {
1476 if (fmVol<0) fmVol=0;
1477 if (fmVol>256) fmVol=256;
1478 altered=true;
1479 } rightClickable
1480
1481 ImGui::TextUnformatted(_("Memory type:"));
1482 ImGui::Indent();
1483 if (ImGui::RadioButton(_("Parallel RAM (8-bit)"),(!memROM && memParallel))) {
1484 memROM=false;
1485 memParallel=true;
1486 altered=true;
1487 mustRender=true;
1488 }
1489 /*
1490 if (ImGui::RadioButton(_("Serial RAM (1-bit)"),(!memROM && !memParallel))) {
1491 memROM=false;
1492 memParallel=false;
1493 altered=true;
1494 mustRender=true;
1495 }*/
1496 if (ImGui::RadioButton(_("ROM"),(memROM && !memParallel))) {
1497 memROM=true;
1498 memParallel=false;
1499 altered=true;
1500 mustRender=true;
1501 }
1502 if (!memROM && !memParallel) {
1503 ImGui::Text(_("I have not implemented serial memory yet!"));
1504 }
1505 if (memROM && memParallel) {
1506 ImGui::Text(_("Congratulations! You found the invalid option!"));
1507 }
1508 ImGui::Unindent();
1509
1510 if (type==DIV_SYSTEM_YM2608_EXT || type==DIV_SYSTEM_YM2608_CSM) {
1511 if (ImGui::Checkbox(_("Disable ExtCh FM macros (compatibility)"),&noExtMacros)) {
1512 altered=true;
1513 }
1514 if (ImGui::Checkbox(_("Ins change in ExtCh operator 2-4 affects FB (compatibility)"),&fbAllOps)) {
1515 altered=true;
1516 }
1517 }
1518
1519 if (altered) {
1520 e->lockSave([&]() {
1521 flags.set("clockSel",clockSel);
1522 flags.set("prescale",prescale);
1523 flags.set("noExtMacros",noExtMacros);
1524 flags.set("fbAllOps",fbAllOps);
1525 flags.set("memROM",memROM);
1526 flags.set("memParallel",memParallel);
1527 flags.set("ssgVol",ssgVol);
1528 flags.set("fmVol",fmVol);
1529 });
1530 }
1531 break;
1532 }
1533 case DIV_SYSTEM_RF5C68: {
1534 int clockSel=flags.getInt("clockSel",0);
1535 int chipType=flags.getInt("chipType",0);
1536
1537 ImGui::Text(_("Clock rate:"));
1538 ImGui::Indent();
1539 if (ImGui::RadioButton(_("8MHz (FM Towns)"),clockSel==0)) {
1540 clockSel=0;
1541 altered=true;
1542 }
1543 if (ImGui::RadioButton(_("10MHz (Sega System 18)"),clockSel==1)) {
1544 clockSel=1;
1545 altered=true;
1546 }
1547 if (ImGui::RadioButton(_("12.5MHz (Sega CD/System 32)"),clockSel==2)) {
1548 clockSel=2;
1549 altered=true;
1550 }
1551 ImGui::Unindent();
1552 ImGui::Text(_("Chip type:"));
1553 ImGui::Indent();
1554 if (ImGui::RadioButton(_("RF5C68 (10-bit output)"),chipType==0)) {
1555 chipType=0;
1556 altered=true;
1557 }
1558 if (ImGui::RadioButton(_("RF5C164 (16-bit output)"),chipType==1)) {
1559 chipType=1;
1560 altered=true;
1561 }
1562 ImGui::Unindent();
1563
1564 if (altered) {
1565 e->lockSave([&]() {
1566 flags.set("clockSel",clockSel);
1567 flags.set("chipType",chipType);
1568 });
1569 }
1570 break;
1571 }
1572 case DIV_SYSTEM_MSM6258: {
1573 int clockSel=flags.getInt("clockSel",0);
1574
1575 ImGui::Text(_("Clock rate:"));
1576 ImGui::Indent();
1577 if (ImGui::RadioButton("4MHz",clockSel==0)) {
1578 clockSel=0;
1579 altered=true;
1580 }
1581 if (ImGui::RadioButton("4.096MHz",clockSel==1)) {
1582 clockSel=1;
1583 altered=true;
1584 }
1585 if (ImGui::RadioButton("8MHz (X68000)",clockSel==2)) {
1586 clockSel=2;
1587 altered=true;
1588 }
1589 if (ImGui::RadioButton("8.192MHz",clockSel==3)) {
1590 clockSel=3;
1591 altered=true;
1592 }
1593 ImGui::Unindent();
1594
1595 int chipClock=flags.getInt("customClock",0);
1596 if (!chipClock) {
1597 switch (clockSel) {
1598 case 0:
1599 chipClock=4000000;
1600 break;
1601 case 1:
1602 chipClock=4096000;
1603 break;
1604 case 2:
1605 chipClock=8000000;
1606 break;
1607 case 3:
1608 chipClock=8192000;
1609 break;
1610 }
1611 }
1612
1613 ImGui::Text(_("Sample rate table:"));
1614 if (ImGui::BeginTable("6258Rate",3)) {
1615 ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
1616 ImGui::TableNextColumn();
1617 ImGui::Text(_("divider \\ clock"));
1618 ImGui::TableNextColumn();
1619 ImGui::Text(_("full"));
1620 ImGui::TableNextColumn();
1621 ImGui::Text(_("half"));
1622
1623 ImGui::TableNextRow();
1624 ImGui::TableNextColumn();
1625 ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg,ImGui::GetColorU32(ImGuiCol_TableHeaderBg));
1626 ImGui::Text("/512");
1627 ImGui::TableNextColumn();
1628 ImGui::Text("%dHz",chipClock/512);
1629 ImGui::TableNextColumn();
1630 ImGui::Text("%dHz",chipClock/1024);
1631
1632 ImGui::TableNextRow();
1633 ImGui::TableNextColumn();
1634 ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg,ImGui::GetColorU32(ImGuiCol_TableHeaderBg));
1635 ImGui::Text("/768");
1636 ImGui::TableNextColumn();
1637 ImGui::Text("%dHz",chipClock/768);
1638 ImGui::TableNextColumn();
1639 ImGui::Text("%dHz",chipClock/1536);
1640
1641 ImGui::TableNextRow();
1642 ImGui::TableNextColumn();
1643 ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg,ImGui::GetColorU32(ImGuiCol_TableHeaderBg));
1644 ImGui::Text("/1024");
1645 ImGui::TableNextColumn();
1646 ImGui::Text("%dHz",chipClock/1024);
1647 ImGui::TableNextColumn();
1648 ImGui::Text("%dHz",chipClock/2048);
1649
1650 ImGui::EndTable();
1651 }
1652
1653 if (altered) {
1654 e->lockSave([&]() {
1655 flags.set("clockSel",clockSel);
1656 });
1657 }
1658 break;
1659 }
1660 case DIV_SYSTEM_MSM6295: {
1661 int clockSel=flags.getInt("clockSel",0);
1662 bool rateSel=flags.getBool("rateSel",false);
1663 bool isBanked=flags.getBool("isBanked",false);
1664
1665 ImGui::Text(_("Clock rate:"));
1666 ImGui::Indent();
1667 if (ImGui::RadioButton("0.875MHz",clockSel==10)) {
1668 clockSel=10;
1669 altered=true;
1670 }
1671 if (ImGui::RadioButton("0.89MHz",clockSel==7)) {
1672 clockSel=7;
1673 altered=true;
1674 }
1675 if (ImGui::RadioButton("0.9375MHz",clockSel==11)) {
1676 clockSel=11;
1677 altered=true;
1678 }
1679 if (ImGui::RadioButton("1MHz",clockSel==0)) {
1680 clockSel=0;
1681 altered=true;
1682 }
1683 if (ImGui::RadioButton("1.02MHz",clockSel==6)) {
1684 clockSel=6;
1685 altered=true;
1686 }
1687 if (ImGui::RadioButton("1.056MHz",clockSel==1)) {
1688 clockSel=1;
1689 altered=true;
1690 }
1691 if (ImGui::RadioButton("1.193MHz (Atari)",clockSel==14)) {
1692 clockSel=14;
1693 altered=true;
1694 }
1695 if (ImGui::RadioButton("1.5MHz",clockSel==12)) {
1696 clockSel=12;
1697 altered=true;
1698 }
1699 if (ImGui::RadioButton("1.79MHz",clockSel==5)) {
1700 clockSel=5;
1701 altered=true;
1702 }
1703 if (ImGui::RadioButton("2MHz",clockSel==8)) {
1704 clockSel=8;
1705 altered=true;
1706 }
1707 if (ImGui::RadioButton("2.112MHz",clockSel==9)) {
1708 clockSel=9;
1709 altered=true;
1710 }
1711 if (ImGui::RadioButton("3MHz",clockSel==13)) {
1712 clockSel=13;
1713 altered=true;
1714 }
1715 if (ImGui::RadioButton("3.2MHz",clockSel==15)) {
1716 clockSel=15;
1717 altered=true;
1718 }
1719 if (ImGui::RadioButton("3.58MHz",clockSel==4)) {
1720 clockSel=4;
1721 altered=true;
1722 }
1723 if (ImGui::RadioButton("4MHz",clockSel==2)) {
1724 clockSel=2;
1725 altered=true;
1726 }
1727 if (ImGui::RadioButton("4.224MHz",clockSel==3)) {
1728 clockSel=3;
1729 altered=true;
1730 }
1731 ImGui::Unindent();
1732 ImGui::Text(_("Output rate:"));
1733 ImGui::Indent();
1734 if (ImGui::RadioButton(_("clock / 132"),rateSel==0)) {
1735 rateSel=false;
1736 altered=true;
1737 }
1738 if (ImGui::RadioButton(_("clock / 165"),rateSel==1)) {
1739 rateSel=true;
1740 altered=true;
1741 }
1742 ImGui::Unindent();
1743
1744 if (ImGui::Checkbox(_("Bankswitched (NMK112)"),&isBanked)) {
1745 altered=true;
1746 }
1747
1748 if (altered) {
1749 e->lockSave([&]() {
1750 flags.set("clockSel",clockSel);
1751 flags.set("rateSel",rateSel);
1752 flags.set("isBanked",isBanked);
1753 });
1754 }
1755 break;
1756 }
1757 case DIV_SYSTEM_SCC:
1758 case DIV_SYSTEM_SCC_PLUS: {
1759 int clockSel=flags.getInt("clockSel",0);
1760
1761 ImGui::Text(_("Clock rate:"));
1762 ImGui::Indent();
1763 if (ImGui::RadioButton(_("1.79MHz (NTSC/MSX)"),clockSel==0)) {
1764 clockSel=0;
1765 altered=true;
1766 }
1767 if (ImGui::RadioButton(_("1.77MHz (PAL)"),clockSel==1)) {
1768 clockSel=1;
1769 altered=true;
1770 }
1771 if (ImGui::RadioButton(_("1.5MHz (Arcade)"),clockSel==2)) {
1772 clockSel=2;
1773 altered=true;
1774 }
1775 if (ImGui::RadioButton(_("2MHz"),clockSel==3)) {
1776 clockSel=3;
1777 altered=true;
1778 }
1779 ImGui::Unindent();
1780
1781 if (altered) {
1782 e->lockSave([&]() {
1783 flags.set("clockSel",clockSel);
1784 });
1785 }
1786 break;
1787 }
1788 case DIV_SYSTEM_LYNX: {
1789 bool tuned=flags.getBool("tuned",false);
1790 if (ImGui::Checkbox(_("Consistent frequency across all duties"),&tuned)) {
1791 altered=true;
1792 e->lockSave([&]() {
1793 flags.set("tuned",tuned);
1794 });
1795 }
1796 if (ImGui::IsItemHovered()) {
1797 ImGui::SetTooltip(_("note: only works for an initial LFSR value of 0!"));
1798 }
1799 break;
1800 }
1801 case DIV_SYSTEM_OPL:
1802 case DIV_SYSTEM_OPL_DRUMS:
1803 case DIV_SYSTEM_OPL2:
1804 case DIV_SYSTEM_OPL2_DRUMS:
1805 case DIV_SYSTEM_Y8950:
1806 case DIV_SYSTEM_Y8950_DRUMS: {
1807 int clockSel=flags.getInt("clockSel",0);
1808 bool compatYPitch=flags.getBool("compatYPitch",false);
1809
1810 ImGui::Text(_("Clock rate:"));
1811 ImGui::Indent();
1812 if (ImGui::RadioButton(_("3.58MHz (NTSC)"),clockSel==0)) {
1813 clockSel=0;
1814 altered=true;
1815 }
1816 if (ImGui::RadioButton(_("3.54MHz (PAL)"),clockSel==1)) {
1817 clockSel=1;
1818 altered=true;
1819 }
1820 if (ImGui::RadioButton(_("4MHz"),clockSel==2)) {
1821 clockSel=2;
1822 altered=true;
1823 }
1824 if (ImGui::RadioButton(_("3MHz"),clockSel==3)) {
1825 clockSel=3;
1826 altered=true;
1827 }
1828 if (ImGui::RadioButton(_("3.9936MHz (PC-88/PC-98)"),clockSel==4)) {
1829 clockSel=4;
1830 altered=true;
1831 }
1832 if (ImGui::RadioButton(_("3.5MHz"),clockSel==5)) {
1833 clockSel=5;
1834 altered=true;
1835 }
1836 ImGui::Unindent();
1837
1838 if ((type==DIV_SYSTEM_Y8950 || type==DIV_SYSTEM_Y8950_DRUMS) && compatYPitch) {
1839 if (ImGui::Checkbox(_("ADPCM channel one octave up (compatibility)"),&compatYPitch)) {
1840 altered=true;
1841 }
1842 }
1843
1844 if (altered) {
1845 e->lockSave([&]() {
1846 flags.set("clockSel",clockSel);
1847 flags.set("compatYPitch",compatYPitch);
1848 });
1849 }
1850 break;
1851 }
1852 case DIV_SYSTEM_OPL3:
1853 case DIV_SYSTEM_OPL3_DRUMS: {
1854 int clockSel=flags.getInt("clockSel",0);
1855 int chipType=flags.getInt("chipType",0);
1856 bool compatPan=flags.getBool("compatPan",false);
1857
1858 ImGui::Text(_("Clock rate:"));
1859 ImGui::Indent();
1860 if (ImGui::RadioButton(_("14.32MHz (NTSC)"),clockSel==0)) {
1861 clockSel=0;
1862 altered=true;
1863 }
1864 if (ImGui::RadioButton(_("14.19MHz (PAL)"),clockSel==1)) {
1865 clockSel=1;
1866 altered=true;
1867 }
1868 if (ImGui::RadioButton(_("14MHz"),clockSel==2)) {
1869 clockSel=2;
1870 altered=true;
1871 }
1872 if (ImGui::RadioButton(_("16MHz"),clockSel==3)) {
1873 clockSel=3;
1874 altered=true;
1875 }
1876 if (ImGui::RadioButton(_("15MHz"),clockSel==4)) {
1877 clockSel=4;
1878 altered=true;
1879 }
1880 if (ImGui::RadioButton(_("33.8688MHz (OPL3-L)"),clockSel==5)) {
1881 clockSel=5;
1882 altered=true;
1883 }
1884 ImGui::Text(_("Chip type:"));
1885 if (ImGui::RadioButton(_("OPL3 (YMF262)"),chipType==0)) {
1886 chipType=0;
1887 altered=true;
1888 }
1889 if (ImGui::RadioButton(_("OPL3-L (YMF289B)"),chipType==1)) {
1890 chipType=1;
1891 altered=true;
1892 }
1893 ImGui::Unindent();
1894
1895 if (ImGui::Checkbox(_("Compatible panning (0800)"),&compatPan)) {
1896 altered=true;
1897 }
1898
1899 if (altered) {
1900 e->lockSave([&]() {
1901 flags.set("clockSel",clockSel);
1902 flags.set("chipType",chipType);
1903 flags.set("compatPan",compatPan);
1904 });
1905 }
1906 break;
1907 }
1908 case DIV_SYSTEM_YMZ280B: {
1909 int clockSel=flags.getInt("clockSel",0);
1910
1911 ImGui::Text(_("Clock rate:"));
1912 ImGui::Indent();
1913 if (ImGui::RadioButton("16.9344MHz",clockSel==0)) {
1914 clockSel=0;
1915 altered=true;
1916 }
1917 if (ImGui::RadioButton("14.32MHz (NTSC)",clockSel==1)) {
1918 clockSel=1;
1919 altered=true;
1920 }
1921 if (ImGui::RadioButton("14.19MHz (PAL)",clockSel==2)) {
1922 clockSel=2;
1923 altered=true;
1924 }
1925 if (ImGui::RadioButton("16MHz",clockSel==3)) {
1926 clockSel=3;
1927 altered=true;
1928 }
1929 if (ImGui::RadioButton("16.67MHz",clockSel==4)) {
1930 clockSel=4;
1931 altered=true;
1932 }
1933 if (ImGui::RadioButton("14MHz",clockSel==5)) {
1934 clockSel=5;
1935 altered=true;
1936 }
1937 ImGui::Unindent();
1938
1939 if (altered) {
1940 e->lockSave([&]() {
1941 flags.set("clockSel",clockSel);
1942 });
1943 }
1944 break;
1945 }
1946 case DIV_SYSTEM_PCM_DAC: {
1947 supportsCustomRate=false;
1948 // default to 44100Hz 16-bit stereo
1949 int sampRate=flags.getInt("rate",44100);
1950 int bitDepth=flags.getInt("outDepth",15)+1;
1951 int interpolation=flags.getInt("interpolation",0);
1952 int volMax=flags.getInt("volMax",255);
1953 bool stereo=flags.getBool("stereo",false);
1954
1955 ImGui::Text(_("Output rate:"));
1956 if (CWSliderInt("##SampRate",&sampRate,1000,96000)) {
1957 if (sampRate<1000) sampRate=1000;
1958 if (sampRate>96000) sampRate=96000;
1959 altered=true;
1960 } rightClickable
1961 ImGui::Text(_("Output bit depth:"));
1962 if (CWSliderInt("##BitDepth",&bitDepth,1,16)) {
1963 if (bitDepth<1) bitDepth=1;
1964 if (bitDepth>16) bitDepth=16;
1965 altered=true;
1966 } rightClickable
1967 ImGui::Text(_("Maximum volume:"));
1968 if (CWSliderInt("##VolMax",&volMax,1,255)) {
1969 if (volMax<1) volMax=1;
1970 if (volMax>255) volMax=255;
1971 altered=true;
1972 } rightClickable
1973 if (ImGui::Checkbox(_("Stereo"),&stereo)) {
1974 altered=true;
1975 }
1976
1977 ImGui::Text(_("Interpolation:"));
1978 ImGui::Indent();
1979 if (ImGui::RadioButton(_("None"),interpolation==0)) {
1980 interpolation=0;
1981 altered=true;
1982 }
1983 if (ImGui::RadioButton(_("Linear"),interpolation==1)) {
1984 interpolation=1;
1985 altered=true;
1986 }
1987 if (ImGui::RadioButton(_("Cubic"),interpolation==2)) {
1988 interpolation=2;
1989 altered=true;
1990 }
1991 if (ImGui::RadioButton(_("Sinc"),interpolation==3)) {
1992 interpolation=3;
1993 altered=true;
1994 }
1995 ImGui::Unindent();
1996
1997 if (altered) {
1998 e->lockSave([&]() {
1999 flags.set("rate",sampRate);
2000 flags.set("outDepth",bitDepth-1);
2001 flags.set("stereo",stereo);
2002 flags.set("interpolation",interpolation);
2003 flags.set("volMax",volMax);
2004 });
2005 }
2006 break;
2007 }
2008 case DIV_SYSTEM_SNES: {
2009 char temp[64];
2010 int vsL=127-(flags.getInt("volScaleL",0)&127);
2011 int vsR=127-(flags.getInt("volScaleR",0)&127);
2012 bool echo=flags.getBool("echo",false);
2013 int echoVolL=flags.getInt("echoVolL",127);
2014 int echoVolR=flags.getInt("echoVolR",127);
2015 int echoDelay=flags.getInt("echoDelay",0)&15;
2016 int echoFeedback=flags.getInt("echoFeedback",0);
2017 int echoMask=flags.getInt("echoMask",0);
2018
2019 int echoFilter[8];
2020 echoFilter[0]=flags.getInt("echoFilter0",127);
2021 echoFilter[1]=flags.getInt("echoFilter1",0);
2022 echoFilter[2]=flags.getInt("echoFilter2",0);
2023 echoFilter[3]=flags.getInt("echoFilter3",0);
2024 echoFilter[4]=flags.getInt("echoFilter4",0);
2025 echoFilter[5]=flags.getInt("echoFilter5",0);
2026 echoFilter[6]=flags.getInt("echoFilter6",0);
2027 echoFilter[7]=flags.getInt("echoFilter7",0);
2028
2029 bool interpolationOff=flags.getBool("interpolationOff",false);
2030 bool antiClick=flags.getBool("antiClick",true);
2031
2032 ImGui::Text(_("Volume scale:"));
2033 if (CWSliderInt(_("Left##VolScaleL"),&vsL,0,127)) {
2034 if (vsL<0) vsL=0;
2035 if (vsL>127) vsL=127;
2036 altered=true;
2037 } rightClickable
2038 if (CWSliderInt(_("Right##VolScaleL"),&vsR,0,127)) {
2039 if (vsR<0) vsR=0;
2040 if (vsR>127) vsR=127;
2041 altered=true;
2042 } rightClickable
2043
2044 if (ImGui::Checkbox(_("Enable echo"),&echo)) {
2045 altered=true;
2046 }
2047
2048 ImGui::Text(_("Initial echo state:"));
2049 for (int i=0; i<8; i++) {
2050 bool echoChan=(bool)(echoMask&(1<<i));
2051 snprintf(temp,63,"%d##EON%d",i+1,i);
2052 if (ImGui::Checkbox(temp,&echoChan)) {
2053 echoMask&=~(1<<i);
2054 if (echoChan) {
2055 echoMask|=1<<i;
2056 }
2057 altered=true;
2058 }
2059 if (i<7) {
2060 if (fromMenu) {
2061 ImGui::SameLine();
2062 } else {
2063 sameLineMaybe();
2064 }
2065 }
2066 }
2067
2068 if (CWSliderInt(_("Delay##EchoDelay"),&echoDelay,0,15)) {
2069 if (echoDelay<0) echoDelay=0;
2070 if (echoDelay>15) echoDelay=15;
2071 altered=true;
2072 } rightClickable
2073
2074 if (CWSliderInt(_("Feedback##EchoFeedback"),&echoFeedback,-128,127)) {
2075 if (echoFeedback<-128) echoFeedback=-128;
2076 if (echoFeedback>127) echoFeedback=127;
2077 altered=true;
2078 } rightClickable
2079
2080 ImGui::Text(_("Echo volume:"));
2081 if (CWSliderInt(_("Left##EchoVolL"),&echoVolL,-128,127)) {
2082 if (echoVolL<-128) echoVolL=-128;
2083 if (echoVolL>127) echoVolL=127;
2084 altered=true;
2085 } rightClickable
2086 if (CWSliderInt(_("Right##EchoVolL"),&echoVolR,-128,127)) {
2087 if (echoVolR<-128) echoVolR=-128;
2088 if (echoVolR>127) echoVolR=127;
2089 altered=true;
2090 } rightClickable
2091
2092 ImGui::Text(_("Echo filter:"));
2093 for (int i=0; i<8; i++) {
2094 snprintf(temp,63,"%d##FIR%d",i+1,i);
2095 if (CWSliderInt(temp,&echoFilter[i],-128,127)) {
2096 if (echoFilter[i]<-128) echoFilter[i]=-128;
2097 if (echoFilter[i]>127) echoFilter[i]=127;
2098 altered=true;
2099 } rightClickable
2100 }
2101
2102 if (ImGui::Button(snesFilterHex?_("Hex##SNESFHex"):_("Dec##SNESFHex"))) {
2103 snesFilterHex=!snesFilterHex;
2104 }
2105 ImGui::SameLine();
2106 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); // wavetable text input size found here
2107 if (ImGui::InputText("##MMLWave",&mmlStringSNES[sysPos])) {
2108 int actualData[256];
2109 int discardIt=0;
2110 memset(actualData,0,256*sizeof(int));
2111 decodeMMLStrW(mmlStringSNES[sysPos],actualData,discardIt,snesFilterHex?0:-128,snesFilterHex?255:127,snesFilterHex);
2112 if (snesFilterHex) {
2113 for (int i=0; i<8; i++) {
2114 if (actualData[i]>=128) actualData[i]-=256;
2115 }
2116 }
2117 memcpy(echoFilter,actualData,8*sizeof(int));
2118 altered=true;
2119 }
2120 if (!ImGui::IsItemActive()) {
2121 int actualData[8];
2122 for (int i=0; i<8; i++) {
2123 if (echoFilter[i]<0 && snesFilterHex) {
2124 actualData[i]=echoFilter[i]+256;
2125 } else {
2126 actualData[i]=echoFilter[i];
2127 }
2128 }
2129 encodeMMLStr(mmlStringSNES[sysPos],actualData,8,-1,-1,snesFilterHex);
2130 }
2131
2132 int filterSum=(
2133 echoFilter[0]+
2134 echoFilter[1]+
2135 echoFilter[2]+
2136 echoFilter[3]+
2137 echoFilter[4]+
2138 echoFilter[5]+
2139 echoFilter[6]+
2140 echoFilter[7]
2141 );
2142
2143 ImGui::PushStyleColor(ImGuiCol_Text,(filterSum<-128 || filterSum>127)?uiColors[GUI_COLOR_LOGLEVEL_WARNING]:uiColors[GUI_COLOR_TEXT]);
2144 ImGui::Text(_("sum: %d"),filterSum);
2145 ImGui::PopStyleColor();
2146
2147 if (ImGui::Checkbox(_("Disable Gaussian interpolation"),&interpolationOff)) {
2148 altered=true;
2149 }
2150
2151 if (ImGui::Checkbox(_("Anti-click"),&antiClick)) {
2152 altered=true;
2153 }
2154
2155 if (altered) {
2156 e->lockSave([&]() {
2157 flags.set("volScaleL",127-vsL);
2158 flags.set("volScaleR",127-vsR);
2159 flags.set("echo",echo);
2160 flags.set("echoVolL",echoVolL);
2161 flags.set("echoVolR",echoVolR);
2162 flags.set("echoDelay",echoDelay);
2163 flags.set("echoFeedback",echoFeedback);
2164 flags.set("echoFilter0",echoFilter[0]);
2165 flags.set("echoFilter1",echoFilter[1]);
2166 flags.set("echoFilter2",echoFilter[2]);
2167 flags.set("echoFilter3",echoFilter[3]);
2168 flags.set("echoFilter4",echoFilter[4]);
2169 flags.set("echoFilter5",echoFilter[5]);
2170 flags.set("echoFilter6",echoFilter[6]);
2171 flags.set("echoFilter7",echoFilter[7]);
2172 flags.set("echoMask",echoMask);
2173 flags.set("interpolationOff",interpolationOff);
2174 flags.set("antiClick",antiClick);
2175 });
2176 }
2177
2178 supportsCustomRate=false;
2179
2180 break;
2181 }
2182 case DIV_SYSTEM_MSM5232: {
2183 int detune=flags.getInt("detune",0);
2184 int vibSpeed=flags.getInt("vibSpeed",0);
2185 float vibDepth=flags.getFloat("vibDepth",0.0f);
2186 bool groupEnv[2];
2187 int groupVol[8];
2188 float capValue[8];
2189 char temp[64];
2190 groupEnv[0]=flags.getBool("groupEnv0",true);
2191 groupEnv[1]=flags.getBool("groupEnv1",true);
2192 groupVol[0]=flags.getInt("partVolume0",255);
2193 groupVol[1]=flags.getInt("partVolume1",255);
2194 groupVol[2]=flags.getInt("partVolume2",255);
2195 groupVol[3]=flags.getInt("partVolume3",255);
2196 groupVol[4]=flags.getInt("partVolume4",255);
2197 groupVol[5]=flags.getInt("partVolume5",255);
2198 groupVol[6]=flags.getInt("partVolume6",255);
2199 groupVol[7]=flags.getInt("partVolume7",255);
2200 capValue[0]=flags.getFloat("capValue0",390.0f);
2201 capValue[1]=flags.getFloat("capValue1",390.0f);
2202 capValue[2]=flags.getFloat("capValue2",390.0f);
2203 capValue[3]=flags.getFloat("capValue3",390.0f);
2204 capValue[4]=flags.getFloat("capValue4",390.0f);
2205 capValue[5]=flags.getFloat("capValue5",390.0f);
2206 capValue[6]=flags.getFloat("capValue6",390.0f);
2207 capValue[7]=flags.getFloat("capValue7",390.0f);
2208
2209 if (CWSliderInt(_("Detune"),&detune,-127,127)) {
2210 if (detune<-127) detune=-127;
2211 if (detune>127) detune=127;
2212 altered=true;
2213 } rightClickable
2214
2215 ImGui::Text(_("Capacitor values (nF):"));
2216 for (int i=0; i<8; i++) {
2217 snprintf(temp,63,"%d##CAPV%d",i+1,i);
2218 if (CWSliderFloat(temp,&capValue[i],1.0f,1000.0f)) {
2219 if (capValue[i]<0) capValue[i]=0;
2220 if (capValue[i]>1000) capValue[i]=1000;
2221 altered=true;
2222 } rightClickable
2223 }
2224
2225 ImGui::Text(_("Initial part volume (channel 1-4):"));
2226 for (int i=0; i<4; i++) {
2227 snprintf(temp,63,"%d'##GRPV%d",2<<i,i);
2228 if (CWSliderInt(temp,&groupVol[i],0,255)) {
2229 if (groupVol[i]<0) groupVol[i]=0;
2230 if (groupVol[i]>255) groupVol[i]=255;
2231 altered=true;
2232 } rightClickable
2233 }
2234
2235 ImGui::Text(_("Initial part volume (channel 5-8):"));
2236 for (int i=4; i<8; i++) {
2237 snprintf(temp,63,"%d'##GRPV%d",2<<(i-4),i);
2238 if (CWSliderInt(temp,&groupVol[i],0,255)) {
2239 if (groupVol[i]<0) groupVol[i]=0;
2240 if (groupVol[i]>255) groupVol[i]=255;
2241 altered=true;
2242 } rightClickable
2243 }
2244
2245 ImGui::Text(_("Envelope mode (channel 1-4):"));
2246 ImGui::Indent();
2247 if (ImGui::RadioButton(_("Capacitor (attack/decay)##EM00"),groupEnv[0])) {
2248 groupEnv[0]=true;
2249 altered=true;
2250 }
2251 if (ImGui::RadioButton(_("External (volume macro)##EM01"),!groupEnv[0])) {
2252 groupEnv[0]=false;
2253 altered=true;
2254 }
2255 ImGui::Unindent();
2256
2257 ImGui::Text(_("Envelope mode (channel 5-8):"));
2258 ImGui::Indent();
2259 if (ImGui::RadioButton(_("Capacitor (attack/decay)##EM10"),groupEnv[1])) {
2260 groupEnv[1]=true;
2261 altered=true;
2262 }
2263 if (ImGui::RadioButton(_("External (volume macro)##EM11"),!groupEnv[1])) {
2264 groupEnv[1]=false;
2265 altered=true;
2266 }
2267 ImGui::Unindent();
2268
2269 ImGui::Text(_("Global vibrato:"));
2270
2271 if (CWSliderInt(_("Speed"),&vibSpeed,0,256)) {
2272 if (vibSpeed<0) vibSpeed=0;
2273 if (vibSpeed>256) vibSpeed=256;
2274 altered=true;
2275 } rightClickable
2276 if (CWSliderFloat(_("Depth"),&vibDepth,0.0f,256.0f)) {
2277 if (vibDepth<0) vibDepth=0;
2278 if (vibDepth>256) vibDepth=256;
2279 altered=true;
2280 } rightClickable
2281
2282 if (altered) {
2283 flags.set("detune",detune);
2284 flags.set("vibSpeed",vibSpeed);
2285 flags.set("vibDepth",vibDepth);
2286
2287 flags.set("capValue0",capValue[0]);
2288 flags.set("capValue1",capValue[1]);
2289 flags.set("capValue2",capValue[2]);
2290 flags.set("capValue3",capValue[3]);
2291 flags.set("capValue4",capValue[4]);
2292 flags.set("capValue5",capValue[5]);
2293 flags.set("capValue6",capValue[6]);
2294 flags.set("capValue7",capValue[7]);
2295
2296 flags.set("partVolume0",groupVol[0]);
2297 flags.set("partVolume1",groupVol[1]);
2298 flags.set("partVolume2",groupVol[2]);
2299 flags.set("partVolume3",groupVol[3]);
2300 flags.set("partVolume4",groupVol[4]);
2301 flags.set("partVolume5",groupVol[5]);
2302 flags.set("partVolume6",groupVol[6]);
2303 flags.set("partVolume7",groupVol[7]);
2304
2305 flags.set("groupEnv0",groupEnv[0]);
2306 flags.set("groupEnv1",groupEnv[1]);
2307 }
2308 break;
2309 }
2310 case DIV_SYSTEM_T6W28: {
2311 bool noEasyNoise=flags.getBool("noEasyNoise",false);
2312
2313 if (ImGui::Checkbox(_("Disable easy period to note mapping on upper octaves"),&noEasyNoise)) {
2314 altered=true;
2315 }
2316
2317 if (altered) {
2318 e->lockSave([&]() {
2319 flags.set("noEasyNoise",noEasyNoise);
2320 });
2321 }
2322 break;
2323 }
2324 case DIV_SYSTEM_K007232: {
2325 bool stereo=flags.getBool("stereo",false);
2326
2327 if (ImGui::Checkbox(_("Stereo"),&stereo)) {
2328 altered=true;
2329 }
2330
2331 if (altered) {
2332 e->lockSave([&]() {
2333 flags.set("stereo",stereo);
2334 });
2335 }
2336 break;
2337 }
2338 case DIV_SYSTEM_NAMCO:
2339 case DIV_SYSTEM_NAMCO_15XX: {
2340 bool romMode=flags.getBool("romMode",false);
2341
2342 ImGui::Text(_("Waveform storage mode:"));
2343 ImGui::Indent();
2344 if (ImGui::RadioButton(_("RAM"),!romMode)) {
2345 romMode=false;
2346 altered=true;
2347 }
2348 if (ImGui::RadioButton(_("ROM (up to 8 waves)"),romMode)) {
2349 romMode=true;
2350 altered=true;
2351 }
2352 ImGui::Unindent();
2353
2354 if (altered) {
2355 e->lockSave([&]() {
2356 flags.set("romMode",romMode);
2357 });
2358 }
2359 break;
2360 }
2361 case DIV_SYSTEM_NAMCO_CUS30: {
2362 bool newNoise=flags.getBool("newNoise",true);
2363
2364 if (InvCheckbox(_("Compatible noise frequencies"),&newNoise)) {
2365 altered=true;
2366 }
2367
2368 if (altered) {
2369 e->lockSave([&]() {
2370 flags.set("newNoise",newNoise);
2371 });
2372 }
2373 break;
2374 }
2375 case DIV_SYSTEM_SEGAPCM:
2376 case DIV_SYSTEM_SEGAPCM_COMPAT: {
2377 bool oldSlides=flags.getBool("oldSlides",false);
2378
2379 if (ImGui::Checkbox(_("Legacy slides and pitch (compatibility)"),&oldSlides)) {
2380 altered=true;
2381 }
2382
2383 if (altered) {
2384 e->lockSave([&]() {
2385 flags.set("oldSlides",oldSlides);
2386 });
2387 }
2388 break;
2389 }
2390 case DIV_SYSTEM_SUPERVISION: {
2391 bool swapDuty=flags.getInt("swapDuty",true);
2392
2393 if (ImGui::Checkbox(_("Swap noise duty cycles"),&swapDuty)) {
2394 altered=true;
2395 }
2396
2397 bool sqStereo=flags.getInt("sqStereo",false);
2398
2399 if (ImGui::Checkbox(_("Stereo pulse waves"),&sqStereo)) {
2400 altered=true;
2401 }
2402
2403 if (altered) {
2404 e->lockSave([&]() {
2405 flags.set("swapDuty",(int)swapDuty);
2406 });
2407 e->lockSave([&]() {
2408 flags.set("sqStereo",(int)sqStereo);
2409 });
2410 }
2411 break;
2412 }
2413 case DIV_SYSTEM_SM8521:/* {
2414 bool noAntiClick=flags.getBool("noAntiClick",false);
2415
2416 if (ImGui::Checkbox(_("Disable anti-click"),&noAntiClick)) {
2417 altered=true;
2418 }
2419
2420 if (altered) {
2421 e->lockSave([&]() {
2422 flags.set("noAntiClick",noAntiClick);
2423 });
2424 }
2425 break;
2426 }*/
2427 case DIV_SYSTEM_K053260: {
2428 int clockSel=flags.getInt("clockSel",0);
2429
2430 ImGui::Text(_("Clock rate:"));
2431 ImGui::Indent();
2432 if (ImGui::RadioButton(_("3.58MHz (NTSC)"),clockSel==0)) {
2433 clockSel=0;
2434 altered=true;
2435 }
2436 if (ImGui::RadioButton(_("4MHz"),clockSel==1)) {
2437 clockSel=1;
2438 altered=true;
2439 }
2440 ImGui::Unindent();
2441
2442 if (altered) {
2443 e->lockSave([&]() {
2444 flags.set("clockSel",clockSel);
2445 });
2446 }
2447 break;
2448 }
2449 case DIV_SYSTEM_TED: {
2450 int clockSel=flags.getInt("clockSel",0);
2451 bool keyPriority=flags.getBool("keyPriority",true);
2452
2453 ImGui::Text(_("Clock rate:"));
2454
2455 ImGui::Indent();
2456 if (ImGui::RadioButton(_("NTSC (1.79MHz)"),clockSel==0)) {
2457 clockSel=0;
2458 altered=true;
2459 }
2460 if (ImGui::RadioButton(_("PAL (1.77MHz)"),clockSel==1)) {
2461 clockSel=1;
2462 altered=true;
2463 }
2464 ImGui::Unindent();
2465
2466 ImGui::Text(_("Global parameter priority:"));
2467
2468 ImGui::Indent();
2469 if (ImGui::RadioButton(_("Left to right"),!keyPriority)) {
2470 keyPriority=false;
2471 altered=true;
2472 }
2473 if (ImGui::RadioButton(_("Last used channel"),keyPriority)) {
2474 keyPriority=true;
2475 altered=true;
2476 }
2477 ImGui::Unindent();
2478
2479 if (altered) {
2480 e->lockSave([&]() {
2481 flags.set("clockSel",clockSel);
2482 flags.set("keyPriority",keyPriority);
2483 });
2484 }
2485 break;
2486 }
2487 case DIV_SYSTEM_C140: {
2488 int bankType=flags.getInt("bankType",0);
2489
2490 ImGui::Text(_("Banking style:"));
2491 ImGui::Indent();
2492 if (ImGui::RadioButton(_("Namco System 2 (2MB)"),bankType==0)) {
2493 bankType=0;
2494 altered=true;
2495 mustRender=true;
2496 }
2497 if (ImGui::RadioButton(_("Namco System 21 (4MB)"),bankType==1)) {
2498 bankType=1;
2499 altered=true;
2500 mustRender=true;
2501 }
2502 if (ImGui::RadioButton(_("Raw (16MB; no VGM export!)"),bankType==2)) {
2503 bankType=2;
2504 altered=true;
2505 mustRender=true;
2506 }
2507 ImGui::Unindent();
2508
2509 if (altered) {
2510 e->lockSave([&]() {
2511 flags.set("bankType",bankType);
2512 });
2513 }
2514 break;
2515 }
2516 case DIV_SYSTEM_VBOY: {
2517 bool romMode=flags.getBool("romMode",false);
2518 bool noAntiClick=flags.getBool("noAntiClick",false);
2519 bool screwThis=flags.getBool("screwThis",false);
2520
2521 ImGui::Text(_("Waveform storage mode:"));
2522 ImGui::Indent();
2523 if (ImGui::RadioButton(_("Static (up to 5 waves)"),romMode)) {
2524 romMode=true;
2525 altered=true;
2526 }
2527 if (ImGui::RadioButton(_("Dynamic (phase reset on wave change!)"),!romMode)) {
2528 romMode=false;
2529 altered=true;
2530 }
2531 ImGui::Unindent();
2532
2533 if (!romMode) {
2534 if (ImGui::Checkbox(_("Disable anti-phase-reset"),&noAntiClick)) {
2535 altered=true;
2536 }
2537 if (ImGui::Checkbox(_("I don't care about hardware"),&screwThis)) {
2538 altered=true;
2539 }
2540 if (ImGui::IsItemHovered()) {
2541 ImGui::SetTooltip(_("Virtual Boy hardware requires all channels to be disabled before writing to wave memory.\nif the clicks that arise from this annoy you, use this option.\nnote that your song won't play on hardware if you do so!"));
2542 }
2543 }
2544
2545 if (altered) {
2546 e->lockSave([&]() {
2547 flags.set("romMode",romMode);
2548 flags.set("noAntiClick",noAntiClick);
2549 flags.set("screwThis",screwThis);
2550 });
2551 }
2552 break;
2553 }
2554 case DIV_SYSTEM_SFX_BEEPER_QUADTONE: {
2555 bool sysPal=flags.getInt("clockSel",0);
2556 bool noHiss=flags.getBool("noHiss",false);
2557 if (ImGui::Checkbox(_("PAL"),&sysPal)) {
2558 altered=true;
2559 }
2560 if (ImGui::Checkbox(_("Disable hissing"),&noHiss)) {
2561 altered=true;
2562 }
2563 if (altered) {
2564 e->lockSave([&]() {
2565 flags.set("clockSel",(int)sysPal);
2566 flags.set("noHiss",noHiss);
2567 });
2568 }
2569 break;
2570 }
2571 case DIV_SYSTEM_NDS: {
2572 int chipType=flags.getInt("chipType",0);
2573
2574 ImGui::Text(_("Model:"));
2575 ImGui::Indent();
2576 if (ImGui::RadioButton(_("DS (4MB RAM)"),chipType==0)) {
2577 chipType=0;
2578 altered=true;
2579 }
2580 if (ImGui::RadioButton(_("DSi (16MB RAM)"),chipType==1)) {
2581 chipType=1;
2582 altered=true;
2583 }
2584 ImGui::Unindent();
2585
2586 if (altered) {
2587 e->lockSave([&]() {
2588 flags.set("chipType",chipType);
2589 });
2590 }
2591 break;
2592 }
2593 case DIV_SYSTEM_VERA: {
2594 int chipType=flags.getInt("chipType",3);
2595
2596 ImGui::Text(_("Chip revision:"));
2597 ImGui::Indent();
2598 if (ImGui::RadioButton(_("Initial release"),chipType==0)) {
2599 chipType=0;
2600 altered=true;
2601 }
2602 if (ImGui::RadioButton(_("V 47.0.2 (9-bit volume)"),chipType==1)) {
2603 chipType=1;
2604 altered=true;
2605 }
2606 if (ImGui::RadioButton(_("V 48.0.1 (Tri/Saw PW XOR)"),chipType==2)) {
2607 chipType=2;
2608 altered=true;
2609 }
2610 if (ImGui::RadioButton(_("X16 Emu R49 (Noise freq fix)"),chipType==3)) {
2611 chipType=3;
2612 altered=true;
2613 }
2614 ImGui::Unindent();
2615
2616 if (altered) {
2617 e->lockSave([&]() {
2618 flags.set("chipType",chipType);
2619 });
2620 }
2621 break;
2622 }
2623 case DIV_SYSTEM_OPL4:
2624 case DIV_SYSTEM_OPL4_DRUMS: {
2625 int clockSel=flags.getInt("clockSel",0);
2626 int ramSize=flags.getInt("ramSize",0);
2627
2628 ImGui::Text(_("Clock rate:"));
2629 ImGui::Indent();
2630 if (ImGui::RadioButton(_("33.8688MHz"),clockSel==0)) {
2631 clockSel=0;
2632 altered=true;
2633 }
2634 if (ImGui::RadioButton(_("28.64MHz (NTSC)"),clockSel==1)) {
2635 clockSel=1;
2636 altered=true;
2637 }
2638 if (ImGui::RadioButton(_("28.38MHz (PAL)"),clockSel==2)) {
2639 clockSel=2;
2640 altered=true;
2641 }
2642 ImGui::Unindent();
2643
2644 ImGui::Text(_("RAM size:"));
2645 ImGui::Indent();
2646 if (ImGui::RadioButton(_("4MB"),ramSize==0)) {
2647 ramSize=0;
2648 altered=true;
2649 mustRender=true;
2650 }
2651 if (ImGui::RadioButton(_("2MB"),ramSize==1)) {
2652 ramSize=1;
2653 altered=true;
2654 mustRender=true;
2655 }
2656 if (ImGui::RadioButton(_("1MB"),ramSize==2)) {
2657 ramSize=2;
2658 altered=true;
2659 mustRender=true;
2660 }
2661 if (ImGui::RadioButton(_("640KB"),ramSize==3)) {
2662 ramSize=3;
2663 altered=true;
2664 mustRender=true;
2665 }
2666 if (ImGui::RadioButton(_("512KB"),ramSize==4)) {
2667 ramSize=4;
2668 altered=true;
2669 mustRender=true;
2670 }
2671 if (ImGui::RadioButton(_("256KB"),ramSize==5)) {
2672 ramSize=5;
2673 altered=true;
2674 mustRender=true;
2675 }
2676 if (ImGui::RadioButton(_("128KB"),ramSize==6)) {
2677 ramSize=6;
2678 altered=true;
2679 mustRender=true;
2680 }
2681 ImGui::Unindent();
2682
2683 if (altered) {
2684 e->lockSave([&]() {
2685 flags.set("clockSel",clockSel);
2686 flags.set("ramSize",ramSize);
2687 });
2688 }
2689 break;
2690 }
2691 case DIV_SYSTEM_VIC20: {
2692 bool sysPal=flags.getInt("clockSel",0);
2693 bool filterOff=flags.getBool("filterOff",false);
2694
2695 if (ImGui::Checkbox(_("PAL"),&sysPal)) {
2696 altered=true;
2697 }
2698 if (ImGui::Checkbox(_("Disable filtering"),&filterOff)) {
2699 altered=true;
2700 }
2701
2702 if (altered) {
2703 e->lockSave([&]() {
2704 flags.set("clockSel",(int)sysPal);
2705 flags.set("filterOff",filterOff);
2706 });
2707 }
2708 break;
2709 }
2710 case DIV_SYSTEM_SWAN: {
2711 bool stereo=flags.getBool("stereo",true);
2712 if (ImGui::Checkbox(_("Headphone output##_SWAN_STEREO"),&stereo)) {
2713 altered=true;
2714 }
2715
2716 if (altered) {
2717 e->lockSave([&]() {
2718 flags.set("stereo",stereo);
2719 });
2720 }
2721 break;
2722 }
2723 case DIV_SYSTEM_BUBSYS_WSG:
2724 case DIV_SYSTEM_PET:
2725 case DIV_SYSTEM_GA20:
2726 case DIV_SYSTEM_PV1000:
2727 case DIV_SYSTEM_C219:
2728 case DIV_SYSTEM_BIFURCATOR:
2729 case DIV_SYSTEM_POWERNOISE:
2730 case DIV_SYSTEM_UPD1771C:
2731 break;
2732 case DIV_SYSTEM_YMU759:
2733 case DIV_SYSTEM_ESFM:
2734 supportsCustomRate=false;
2735 ImGui::Text(_("nothing to configure"));
2736 break;
2737 case DIV_SYSTEM_SID3: {
2738 bool quarterClock=flags.getBool("quarterClock",false);
2739 if (ImGui::Checkbox(_("Quarter clock speed"),&quarterClock)) {
2740 altered=true;
2741 }
2742 if (ImGui::IsItemHovered()) {
2743 ImGui::SetTooltip(_("Decreases clock speed and CPU audio load by 4 times.\nCan be used if your CPU is too slow for the chip."
2744 "\nDoes not affect clock speed during export!\n\n"
2745
2746 "Warning! Filters may become unstable at high cutoff and resonance\nif this option or lower clock speed are used!\n"
2747 "Also filters' timbre may be different near these values.\n\n"
2748
2749 "Default clock speed is 1MHz (1000000Hz)."));
2750 }
2751
2752 if (altered) {
2753 e->lockSave([&]() {
2754 flags.set("quarterClock",(int)quarterClock);
2755 });
2756 }
2757 break;
2758 }
2759 default: {
2760 bool sysPal=flags.getInt("clockSel",0);
2761
2762 if (ImGui::Checkbox(_("PAL"),&sysPal)) {
2763 altered=true;
2764 }
2765
2766 if (altered) {
2767 e->lockSave([&]() {
2768 flags.set("clockSel",(int)sysPal);
2769 });
2770 }
2771 break;
2772 }
2773 }
2774
2775 if (supportsCustomRate) {
2776 ImGui::Separator();
2777 int customClock=flags.getInt("customClock",0);
2778 bool usingCustomClock=customClock>=MIN_CUSTOM_CLOCK;
2779
2780 if (ImGui::Checkbox(_("Custom clock rate"),&usingCustomClock)) {
2781 if (usingCustomClock) {
2782 customClock=MIN_CUSTOM_CLOCK;
2783 } else {
2784 customClock=0;
2785 }
2786 altered=true;
2787 }
2788 ImGui::Indent();
2789 if (ImGui::InputInt("Hz",&customClock,100,10000)) {
2790 if (customClock<MIN_CUSTOM_CLOCK) customClock=0;
2791 if (customClock>MAX_CUSTOM_CLOCK) customClock=MAX_CUSTOM_CLOCK;
2792 altered=true;
2793 }
2794 ImGui::Unindent();
2795
2796 if (altered) {
2797 e->lockSave([&]() {
2798 flags.set("customClock",customClock);
2799 });
2800 }
2801 }
2802
2803 if (altered) {
2804 if (chan>=0) {
2805 e->updateSysFlags(chan,restart,mustRender);
2806 if (e->song.autoSystem) {
2807 autoDetectSystem();
2808 }
2809 updateWindowTitle();
2810 }
2811 MARK_MODIFIED;
2812 }
2813
2814 return altered;
2815 }