view src/win32/MainWndOptions.cpp @ 3:b05d00f19d80

fix some formatting
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:33:11 -0600
parents f9f4f1b99eed
children
line wrap: on
line source
1 #include "stdafx.h"
2 #include "resource.h"
3 #include "MainWnd.h"
4 #include "Associate.h"
5 #include "Directories.h"
6 #include "FileDlg.h"
7 #include "GBColorDlg.h"
8 #include "Joypad.h"
9 #include "MaxScale.h"
10 #include "ModeConfirm.h"
11 #include "Reg.h"
12 #include "RewindInterval.h"
13 #include "Throttle.h"
14 #include "TextOptions.h"
15 #include "WinResUtil.h"
16 #include "VBA.h"
18 #include "../gba/GBA.h"
19 #include "../gba/GBAGlobals.h"
20 #include "../gba/Flash.h"
21 #include "../gba/GBASound.h"
22 #include "../gba/agbprint.h"
23 #include "../gb/GB.h"
24 #include "../gb/gbGlobals.h"
25 #include "../gb/gbPrinter.h"
26 #include "../common/inputGlobal.h"
27 #include "../common/movie.h"
28 #include "../version.h"
30 extern int emulating;
32 #define VBA_CONFIRM_MODE WM_APP + 100
34 void MainWnd::OnOptionsFrameskipThrottleNothrottle()
35 {
36 systemSetThrottle(0);
37 }
39 void MainWnd::OnUpdateOptionsFrameskipThrottleNothrottle(CCmdUI*pCmdUI)
40 {
41 pCmdUI->SetCheck(theApp.throttle == 0);
42 }
44 void MainWnd::OnOptionsFrameskipThrottle6()
45 {
46 systemSetThrottle(6);
47 }
49 void MainWnd::OnUpdateOptionsFrameskipThrottle6(CCmdUI*pCmdUI)
50 {
51 pCmdUI->SetCheck(theApp.throttle == 6);
52 }
54 void MainWnd::OnOptionsFrameskipThrottle15()
55 {
56 systemSetThrottle(15);
57 }
59 void MainWnd::OnUpdateOptionsFrameskipThrottle15(CCmdUI*pCmdUI)
60 {
61 pCmdUI->SetCheck(theApp.throttle == 15);
62 }
64 void MainWnd::OnOptionsFrameskipThrottle25()
65 {
66 systemSetThrottle(25);
67 }
69 void MainWnd::OnUpdateOptionsFrameskipThrottle25(CCmdUI*pCmdUI)
70 {
71 pCmdUI->SetCheck(theApp.throttle == 25);
72 }
74 void MainWnd::OnOptionsFrameskipThrottle50()
75 {
76 systemSetThrottle(50);
77 }
79 void MainWnd::OnUpdateOptionsFrameskipThrottle50(CCmdUI*pCmdUI)
80 {
81 pCmdUI->SetCheck(theApp.throttle == 50);
82 }
84 void MainWnd::OnOptionsFrameskipThrottle75()
85 {
86 systemSetThrottle(75);
87 }
89 void MainWnd::OnUpdateOptionsFrameskipThrottle75(CCmdUI*pCmdUI)
90 {
91 pCmdUI->SetCheck(theApp.throttle == 75);
92 }
94 void MainWnd::OnOptionsFrameskipThrottle100()
95 {
96 systemSetThrottle(100);
97 }
99 void MainWnd::OnUpdateOptionsFrameskipThrottle100(CCmdUI*pCmdUI)
100 {
101 pCmdUI->SetCheck(theApp.throttle == 100);
102 }
104 void MainWnd::OnOptionsFrameskipThrottle125()
105 {
106 systemSetThrottle(125);
107 }
109 void MainWnd::OnUpdateOptionsFrameskipThrottle125(CCmdUI*pCmdUI)
110 {
111 pCmdUI->SetCheck(theApp.throttle == 125);
112 }
114 void MainWnd::OnOptionsFrameskipThrottle150()
115 {
116 systemSetThrottle(150);
117 }
119 void MainWnd::OnUpdateOptionsFrameskipThrottle150(CCmdUI*pCmdUI)
120 {
121 pCmdUI->SetCheck(theApp.throttle == 150);
122 }
124 void MainWnd::OnOptionsFrameskipThrottle200()
125 {
126 systemSetThrottle(200);
127 }
129 void MainWnd::OnUpdateOptionsFrameskipThrottle200(CCmdUI*pCmdUI)
130 {
131 pCmdUI->SetCheck(theApp.throttle == 200);
132 }
134 void MainWnd::OnOptionsFrameskipThrottle300()
135 {
136 systemSetThrottle(300);
137 }
139 void MainWnd::OnUpdateOptionsFrameskipThrottle300(CCmdUI*pCmdUI)
140 {
141 pCmdUI->SetCheck(theApp.throttle == 300);
142 }
144 void MainWnd::OnOptionsFrameskipThrottle400()
145 {
146 systemSetThrottle(400);
147 }
149 void MainWnd::OnUpdateOptionsFrameskipThrottle400(CCmdUI*pCmdUI)
150 {
151 pCmdUI->SetCheck(theApp.throttle == 400);
152 }
154 void MainWnd::OnOptionsFrameskipThrottle600()
155 {
156 systemSetThrottle(600);
157 }
159 void MainWnd::OnUpdateOptionsFrameskipThrottle600(CCmdUI*pCmdUI)
160 {
161 pCmdUI->SetCheck(theApp.throttle == 600);
162 }
164 void MainWnd::OnOptionsFrameskipThrottle1000()
165 {
166 systemSetThrottle(1000);
167 }
169 void MainWnd::OnUpdateOptionsFrameskipThrottle1000(CCmdUI*pCmdUI)
170 {
171 pCmdUI->SetCheck(theApp.throttle == 1000);
172 }
174 void MainWnd::OnOptionsFrameskipThrottleOther()
175 {
176 Throttle dlg;
177 int v = dlg.DoModal();
178 if (v)
179 systemSetThrottle(v);
180 }
182 void MainWnd::OnUpdateOptionsFrameskipThrottleOther(CCmdUI*pCmdUI)
183 {
184 }
186 void MainWnd::OnOptionsFrameskipThrottleIncrease()
187 {
188 systemIncreaseThrottle();
189 }
191 void MainWnd::OnUpdateOptionsFrameskipThrottleIncrease(CCmdUI*pCmdUI)
192 {
193 }
195 void MainWnd::OnOptionsFrameskipThrottleDecrease()
196 {
197 systemDecreaseThrottle();
198 }
200 void MainWnd::OnUpdateOptionsFrameskipThrottleDecrease(CCmdUI*pCmdUI)
201 {
202 }
204 /*
205 void MainWnd::OnOptionsFrameskipAutomatic()
206 {
207 theApp.autoFrameSkip = !theApp.autoFrameSkip;
208 if(!theApp.autoFrameSkip && emulating)
209 theApp.updateFrameSkip();
210 }
212 void MainWnd::OnUpdateOptionsFrameskipAutomatic(CCmdUI* pCmdUI)
213 {
214 pCmdUI->SetCheck(theApp.autoFrameSkip);
215 }
216 */
218 void MainWnd::OnOptionsFrameskipAccuratePitch()
219 {
220 theApp.accuratePitchThrottle = true;
221 }
223 void MainWnd::OnUpdateOptionsFrameskipAccuratePitch(CCmdUI*pCmdUI)
224 {
225 pCmdUI->SetCheck(theApp.accuratePitchThrottle);
226 pCmdUI->Enable(!soundOffFlag && synchronize);
227 }
229 void MainWnd::OnOptionsFrameskipAccurateSpeed()
230 {
231 theApp.accuratePitchThrottle = false;
232 }
234 void MainWnd::OnUpdateOptionsFrameskipAccurateSpeed(CCmdUI*pCmdUI)
235 {
236 pCmdUI->SetCheck(!theApp.accuratePitchThrottle);
237 pCmdUI->Enable(!soundOffFlag && synchronize);
238 }
240 BOOL MainWnd::OnOptionsFrameskip(UINT nID)
241 {
242 switch (nID)
243 {
244 case ID_OPTIONS_VIDEO_FRAMESKIP_0:
245 case ID_OPTIONS_VIDEO_FRAMESKIP_1:
246 case ID_OPTIONS_VIDEO_FRAMESKIP_2:
247 case ID_OPTIONS_VIDEO_FRAMESKIP_3:
248 case ID_OPTIONS_VIDEO_FRAMESKIP_4:
249 case ID_OPTIONS_VIDEO_FRAMESKIP_5:
250 case ID_OPTIONS_VIDEO_FRAMESKIP_6:
251 case ID_OPTIONS_VIDEO_FRAMESKIP_7:
252 case ID_OPTIONS_VIDEO_FRAMESKIP_8:
253 case ID_OPTIONS_VIDEO_FRAMESKIP_9:
254 if (systemCartridgeType == 0)
255 {
256 frameSkip = nID - ID_OPTIONS_VIDEO_FRAMESKIP_0;
257 }
258 else
259 {
260 gbFrameSkip = nID - ID_OPTIONS_VIDEO_FRAMESKIP_0;
261 }
262 if (emulating)
263 theApp.updateFrameSkip();
264 return TRUE;
265 break;
266 }
267 return FALSE;
268 }
270 void MainWnd::OnUpdateOptionsVideoFrameskip0(CCmdUI*pCmdUI)
271 {
272 pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 0 : gbFrameSkip == 0);
273 }
275 void MainWnd::OnUpdateOptionsVideoFrameskip1(CCmdUI*pCmdUI)
276 {
277 pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 1 : gbFrameSkip == 1);
278 }
280 void MainWnd::OnUpdateOptionsVideoFrameskip2(CCmdUI*pCmdUI)
281 {
282 pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 2 : gbFrameSkip == 2);
283 }
285 void MainWnd::OnUpdateOptionsVideoFrameskip3(CCmdUI*pCmdUI)
286 {
287 pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 3 : gbFrameSkip == 3);
288 }
290 void MainWnd::OnUpdateOptionsVideoFrameskip4(CCmdUI*pCmdUI)
291 {
292 pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 4 : gbFrameSkip == 4);
293 }
295 void MainWnd::OnUpdateOptionsVideoFrameskip5(CCmdUI*pCmdUI)
296 {
297 pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 5 : gbFrameSkip == 5);
298 }
300 void MainWnd::OnUpdateOptionsVideoFrameskip6(CCmdUI*pCmdUI)
301 {
302 pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 6 : gbFrameSkip == 6);
303 }
305 void MainWnd::OnUpdateOptionsVideoFrameskip7(CCmdUI*pCmdUI)
306 {
307 pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 7 : gbFrameSkip == 7);
308 }
310 void MainWnd::OnUpdateOptionsVideoFrameskip8(CCmdUI*pCmdUI)
311 {
312 pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 8 : gbFrameSkip == 8);
313 }
315 void MainWnd::OnUpdateOptionsVideoFrameskip9(CCmdUI*pCmdUI)
316 {
317 pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 9 : gbFrameSkip == 9);
318 }
320 void MainWnd::OnOptionsVideoVsync()
321 {
322 theApp.vsync = !theApp.vsync;
323 }
325 void MainWnd::OnUpdateOptionsVideoVsync(CCmdUI*pCmdUI)
326 {
327 pCmdUI->SetCheck(theApp.vsync);
328 }
330 void MainWnd::OnUpdateOptionsVideoX1(CCmdUI*pCmdUI)
331 {
332 pCmdUI->SetCheck(theApp.videoOption == VIDEO_1X);
333 }
335 void MainWnd::OnUpdateOptionsVideoX2(CCmdUI*pCmdUI)
336 {
337 pCmdUI->SetCheck(theApp.videoOption == VIDEO_2X);
338 }
340 void MainWnd::OnUpdateOptionsVideoX3(CCmdUI*pCmdUI)
341 {
342 pCmdUI->SetCheck(theApp.videoOption == VIDEO_3X);
343 }
345 void MainWnd::OnUpdateOptionsVideoX4(CCmdUI*pCmdUI)
346 {
347 pCmdUI->SetCheck(theApp.videoOption == VIDEO_4X);
348 }
350 void MainWnd::OnUpdateOptionsVideoFullscreen320x240(CCmdUI*pCmdUI)
351 {
352 pCmdUI->Enable(theApp.mode320Available);
353 pCmdUI->SetCheck(theApp.videoOption == VIDEO_320x240);
354 }
356 void MainWnd::OnUpdateOptionsVideoFullscreen640x480(CCmdUI*pCmdUI)
357 {
358 pCmdUI->Enable(theApp.mode640Available);
359 pCmdUI->SetCheck(theApp.videoOption == VIDEO_640x480);
360 }
362 void MainWnd::OnUpdateOptionsVideoFullscreen800x600(CCmdUI*pCmdUI)
363 {
364 pCmdUI->Enable(theApp.mode800Available);
365 pCmdUI->SetCheck(theApp.videoOption == VIDEO_800x600);
366 }
368 BOOL MainWnd::OnOptionVideoSize(UINT nID)
369 {
370 theApp.updateVideoSize(nID);
371 theApp.m_pMainWnd->PostMessage(VBA_CONFIRM_MODE);
372 return TRUE;
373 }
375 void MainWnd::OnOptionsVideoFullscreen320x240()
376 {
377 OnOptionVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN320X240);
378 }
380 void MainWnd::OnOptionsVideoFullscreen640x480()
381 {
382 OnOptionVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN640X480);
383 }
385 void MainWnd::OnOptionsVideoFullscreen800x600()
386 {
387 OnOptionVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN800X600);
388 }
390 void MainWnd::OnOptionsVideoFullscreen()
391 {
392 theApp.winCheckFullscreen();
393 GUID *pGUID = NULL;
394 int size = theApp.display->selectFullScreenMode(&pGUID);
395 if (size != -1)
396 {
397 int width = (size >> 12) & 4095;
398 int height = (size & 4095);
399 int colorDepth = (size >> 24);
400 if (width != theApp.fsWidth ||
401 height != theApp.fsHeight ||
402 colorDepth != theApp.fsColorDepth ||
403 pGUID != theApp.pVideoDriverGUID ||
404 theApp.videoOption != VIDEO_OTHER)
405 {
406 theApp.fsForceChange = true;
407 theApp.fsWidth = width;
408 theApp.fsHeight = height;
409 theApp.fsColorDepth = colorDepth;
410 theApp.pVideoDriverGUID = pGUID;
411 if (pGUID)
412 {
413 theApp.videoDriverGUID = *pGUID;
414 regSetDwordValue("defaultVideoDriver", FALSE);
415 regSetBinaryValue("videoDriverGUID",
416 (char *)pGUID, sizeof(GUID));
417 }
418 else
419 {
420 regSetDwordValue("defaultVideoDriver", TRUE);
421 }
422 theApp.updateVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN);
423 theApp.m_pMainWnd->PostMessage(VBA_CONFIRM_MODE);
424 }
425 }
426 }
428 void MainWnd::OnUpdateOptionsVideoFullscreen(CCmdUI*pCmdUI)
429 {
430 pCmdUI->SetCheck(theApp.videoOption == VIDEO_OTHER);
431 }
433 void MainWnd::OnOptionsVideoDisablesfx()
434 {
435 cpuDisableSfx = !cpuDisableSfx;
436 if (emulating && systemCartridgeType == 0)
437 CPUUpdateRender();
438 }
440 void MainWnd::OnUpdateOptionsVideoDisablesfx(CCmdUI*pCmdUI)
441 {
442 pCmdUI->SetCheck(cpuDisableSfx);
443 }
445 void MainWnd::OnOptionsVideoFullscreenstretchtofit()
446 {
447 theApp.fullScreenStretch = !theApp.fullScreenStretch;
448 theApp.updateWindowSize(theApp.videoOption);
449 if (theApp.display)
450 theApp.display->clear();
451 }
453 void MainWnd::OnUpdateOptionsVideoFullscreenstretchtofit(CCmdUI*pCmdUI)
454 {
455 pCmdUI->SetCheck(theApp.fullScreenStretch);
456 }
458 BOOL MainWnd::OnVideoLayer(UINT nID)
459 {
460 layerSettings ^= 0x0100 << ((nID & 0xFFFF) - ID_OPTIONS_VIDEO_LAYERS_BG0);
461 layerEnable = DISPCNT & layerSettings;
462 CPUUpdateRenderBuffers(false);
463 return TRUE;
464 }
466 void MainWnd::OnUpdateVideoLayer(CCmdUI *pCmdUI)
467 {
468 pCmdUI->SetCheck((layerSettings >> (8 + pCmdUI->m_nID - ID_OPTIONS_VIDEO_LAYERS_BG0)) & 1);
469 switch (pCmdUI->m_nID)
470 {
471 case ID_OPTIONS_VIDEO_LAYERS_BG1:
472 case ID_OPTIONS_VIDEO_LAYERS_BG2:
473 case ID_OPTIONS_VIDEO_LAYERS_BG3:
474 case ID_OPTIONS_VIDEO_LAYERS_WIN1:
475 case ID_OPTIONS_VIDEO_LAYERS_OBJWIN:
476 pCmdUI->Enable(systemCartridgeType == 0);
477 break;
478 }
479 }
481 void MainWnd::OnOptionsVideoRendermethodGdi()
482 {
483 theApp.renderMethod = GDI;
484 theApp.updateRenderMethod(false);
485 }
487 void MainWnd::OnUpdateOptionsVideoRendermethodGdi(CCmdUI*pCmdUI)
488 {
489 pCmdUI->SetCheck(theApp.renderMethod == GDI);
490 }
492 void MainWnd::OnOptionsVideoRendermethodDirectdraw()
493 {
494 theApp.renderMethod = DIRECT_DRAW;
495 theApp.updateRenderMethod(false);
496 }
498 void MainWnd::OnUpdateOptionsVideoRendermethodDirectdraw(CCmdUI*pCmdUI)
499 {
500 pCmdUI->SetCheck(theApp.renderMethod == DIRECT_DRAW);
501 }
503 void MainWnd::OnOptionsVideoRendermethodDirect3d()
504 {
505 theApp.renderMethod = DIRECT_3D;
506 theApp.updateRenderMethod(false);
507 }
509 void MainWnd::OnUpdateOptionsVideoRendermethodDirect3d(CCmdUI*pCmdUI)
510 {
511 pCmdUI->SetCheck(theApp.renderMethod == DIRECT_3D);
512 }
514 void MainWnd::OnOptionsVideoRendermethodOpengl()
515 {
516 theApp.renderMethod = OPENGL;
517 theApp.updateRenderMethod(false);
518 }
520 void MainWnd::OnUpdateOptionsVideoRendermethodOpengl(CCmdUI*pCmdUI)
521 {
522 pCmdUI->SetCheck(theApp.renderMethod == OPENGL);
523 }
525 void MainWnd::OnOptionsVideoTriplebuffering()
526 {
527 theApp.tripleBuffering = !theApp.tripleBuffering;
528 }
530 void MainWnd::OnUpdateOptionsVideoTriplebuffering(CCmdUI*pCmdUI)
531 {
532 pCmdUI->SetCheck(theApp.tripleBuffering);
533 }
535 void MainWnd::OnOptionsVideoDdrawemulationonly()
536 {
537 theApp.ddrawEmulationOnly = !theApp.ddrawEmulationOnly;
538 }
540 void MainWnd::OnUpdateOptionsVideoDdrawemulationonly(CCmdUI*pCmdUI)
541 {
542 pCmdUI->SetCheck(theApp.ddrawEmulationOnly);
543 }
545 void MainWnd::OnOptionsVideoDdrawusevideomemory()
546 {
547 theApp.ddrawUseVideoMemory = !theApp.ddrawUseVideoMemory;
548 }
550 void MainWnd::OnUpdateOptionsVideoDdrawusevideomemory(CCmdUI*pCmdUI)
551 {
552 pCmdUI->SetCheck(theApp.ddrawUseVideoMemory);
553 }
555 void MainWnd::OnOptionsVideoRenderoptionsD3dnofilter()
556 {
557 theApp.d3dFilter = 0;
558 if (theApp.display)
559 theApp.display->setOption("d3dFilter", 0);
560 }
562 void MainWnd::OnUpdateOptionsVideoRenderoptionsD3dnofilter(CCmdUI*pCmdUI)
563 {
564 pCmdUI->SetCheck(theApp.d3dFilter == 0);
565 }
567 void MainWnd::OnOptionsVideoRenderoptionsD3dbilinear()
568 {
569 theApp.d3dFilter = 1;
570 if (theApp.display)
571 theApp.display->setOption("d3dFilter", 1);
572 }
574 void MainWnd::OnUpdateOptionsVideoRenderoptionsD3dbilinear(CCmdUI*pCmdUI)
575 {
576 pCmdUI->SetCheck(theApp.d3dFilter == 1);
577 }
579 void MainWnd::OnOptionsVideoRenderoptionsGlnearest()
580 {
581 theApp.glFilter = 0;
582 if (theApp.display)
583 theApp.display->setOption("glFilter", 0);
584 }
586 void MainWnd::OnUpdateOptionsVideoRenderoptionsGlnearest(CCmdUI*pCmdUI)
587 {
588 pCmdUI->SetCheck(theApp.glFilter == 0);
589 }
591 void MainWnd::OnOptionsVideoRenderoptionsGlbilinear()
592 {
593 theApp.glFilter = 1;
594 if (theApp.display)
595 theApp.display->setOption("glFilter", 1);
596 }
598 void MainWnd::OnUpdateOptionsVideoRenderoptionsGlbilinear(CCmdUI*pCmdUI)
599 {
600 pCmdUI->SetCheck(theApp.glFilter == 1);
601 }
603 void MainWnd::OnOptionsVideoRenderoptionsGltriangle()
604 {
605 theApp.glType = 0;
606 if (theApp.display)
607 theApp.display->setOption("glType", 0);
608 }
610 void MainWnd::OnUpdateOptionsVideoRenderoptionsGltriangle(CCmdUI*pCmdUI)
611 {
612 pCmdUI->SetCheck(theApp.glType == 0);
613 }
615 void MainWnd::OnOptionsVideoRenderoptionsGlquads()
616 {
617 theApp.glType = 1;
618 if (theApp.display)
619 theApp.display->setOption("glType", 1);
620 }
622 void MainWnd::OnUpdateOptionsVideoRenderoptionsGlquads(CCmdUI*pCmdUI)
623 {
624 pCmdUI->SetCheck(theApp.glType == 1);
625 }
627 void MainWnd::OnOptionsVideoRenderoptionsSelectskin()
628 {}
630 void MainWnd::OnUpdateOptionsVideoRenderoptionsSelectskin(CCmdUI*pCmdUI)
631 {}
633 void MainWnd::OnOptionsVideoRenderoptionsSkin()
634 {}
636 void MainWnd::OnUpdateOptionsVideoRenderoptionsSkin(CCmdUI*pCmdUI)
637 {}
639 void MainWnd::OnOptionsEmulatorAssociate()
640 {
641 theApp.winCheckFullscreen();
642 Associate dlg;
643 dlg.DoModal();
644 }
646 void MainWnd::OnOptionsEmulatorDirectories()
647 {
648 theApp.winCheckFullscreen();
649 Directories dlg;
650 dlg.DoModal();
651 }
653 void MainWnd::OnOptionsEmulatorFilenamePreference(UINT nID)
654 {
655 theApp.filenamePreference = nID - ID_OPTIONS_PREFER_ARCHIVE_NAME;
656 }
658 void MainWnd::OnUpdateOptionsEmulatorFilenamePreference(CCmdUI *pCmdUI)
659 {
660 pCmdUI->SetRadio(pCmdUI->m_nID == theApp.filenamePreference + ID_OPTIONS_PREFER_ARCHIVE_NAME);
661 }
663 void MainWnd::OnOptionsVideoDisablestatusmessages()
664 {
665 theApp.disableStatusMessage = !theApp.disableStatusMessage;
666 }
668 void MainWnd::OnUpdateOptionsVideoDisablestatusmessages(CCmdUI*pCmdUI)
669 {
670 pCmdUI->SetCheck(theApp.disableStatusMessage);
671 }
673 void MainWnd::OnOptionsEmulatorSynchronize()
674 {
675 synchronize = !synchronize;
676 }
678 void MainWnd::OnUpdateOptionsEmulatorSynchronize(CCmdUI*pCmdUI)
679 {
680 pCmdUI->SetCheck(synchronize);
681 }
683 void MainWnd::OnOptionsEmulatorAlwaysOnTop()
684 {
685 theApp.alwaysOnTop = !theApp.alwaysOnTop;
686 SetWindowPos((theApp.alwaysOnTop ? &wndTopMost : &wndNoTopMost), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
687 }
689 void MainWnd::OnUpdateOptionsEmulatorAlwaysOnTop(CCmdUI*pCmdUI)
690 {
691 pCmdUI->SetCheck(theApp.alwaysOnTop);
692 }
694 void MainWnd::OnOptionsEmulatorPausewheninactive()
695 {
696 theApp.pauseWhenInactive = !theApp.pauseWhenInactive;
697 }
699 void MainWnd::OnUpdateOptionsEmulatorPausewheninactive(CCmdUI*pCmdUI)
700 {
701 pCmdUI->SetCheck(theApp.pauseWhenInactive);
702 }
704 void MainWnd::OnOptionsEmulatorEnableBackgroundInput()
705 {
706 theApp.enableBackgroundInput = !theApp.enableBackgroundInput;
707 }
709 void MainWnd::OnUpdateOptionsEmulatorEnableBackgroundInput(CCmdUI*pCmdUI)
710 {
711 pCmdUI->SetCheck(theApp.enableBackgroundInput);
712 }
714 BOOL MainWnd::OnOptionsPriority(UINT nID)
715 {
716 switch (nID)
717 {
718 case ID_OPTIONS_PRIORITY_HIGHEST:
719 theApp.threadPriority = 0;
720 break;
721 case ID_OPTIONS_PRIORITY_ABOVENORMAL:
722 theApp.threadPriority = 1;
723 break;
724 case ID_OPTIONS_PRIORITY_NORMAL:
725 theApp.threadPriority = 2;
726 break;
727 case ID_OPTIONS_PRIORITY_BELOWNORMAL:
728 theApp.threadPriority = 3;
729 break;
730 default:
731 return FALSE;
732 }
733 theApp.updatePriority();
735 return TRUE;
736 }
738 void MainWnd::OnUpdateOptionsPriority(CCmdUI *pCmdUI)
739 {
740 switch (pCmdUI->m_nID)
741 {
742 case ID_OPTIONS_PRIORITY_HIGHEST:
743 pCmdUI->SetCheck(theApp.threadPriority == 0);
744 break;
745 case ID_OPTIONS_PRIORITY_ABOVENORMAL:
746 pCmdUI->SetCheck(theApp.threadPriority == 1);
747 break;
748 case ID_OPTIONS_PRIORITY_NORMAL:
749 pCmdUI->SetCheck(theApp.threadPriority == 2);
750 break;
751 case ID_OPTIONS_PRIORITY_BELOWNORMAL:
752 pCmdUI->SetCheck(theApp.threadPriority == 3);
753 break;
754 }
755 }
757 void MainWnd::OnOptionsEmulatorSpeeduptoggle()
758 {
759 theApp.speedupToggle = !theApp.speedupToggle;
760 }
762 void MainWnd::OnUpdateOptionsEmulatorSpeeduptoggle(CCmdUI*pCmdUI)
763 {
764 pCmdUI->SetCheck(theApp.speedupToggle);
765 }
767 void MainWnd::OnOptionsEmulatorRemoveintrosgba()
768 {
769 // theApp.removeIntros = !theApp.removeIntros;
770 }
772 void MainWnd::OnUpdateOptionsEmulatorRemoveintrosgba(CCmdUI*pCmdUI)
773 {
774 pCmdUI->Enable(false);
775 // pCmdUI->SetCheck(theApp.removeIntros);
776 }
778 void MainWnd::OnOptionsEmulatorAutomaticallyipspatch()
779 {
780 theApp.autoIPS = !theApp.autoIPS;
781 }
783 void MainWnd::OnUpdateOptionsEmulatorAutomaticallyipspatch(CCmdUI*pCmdUI)
784 {
785 pCmdUI->SetCheck(theApp.autoIPS);
786 }
788 void MainWnd::OnOptionsEmulatorAgbprint()
789 {
790 agbPrintEnable(!agbPrintIsEnabled());
791 }
793 void MainWnd::OnUpdateOptionsEmulatorAgbprint(CCmdUI*pCmdUI)
794 {
795 pCmdUI->SetCheck(agbPrintIsEnabled());
796 }
798 void MainWnd::OnOptionsEmulatorRealtimeclock()
799 {
800 theApp.winRtcEnable = !theApp.winRtcEnable;
801 }
803 void MainWnd::OnUpdateOptionsEmulatorRealtimeclock(CCmdUI*pCmdUI)
804 {
805 pCmdUI->SetCheck(theApp.winRtcEnable);
806 pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
807 }
809 void MainWnd::OnOptionsEmulatorAutohidemenu()
810 {
811 theApp.autoHideMenu = !theApp.autoHideMenu;
812 }
814 void MainWnd::OnUpdateOptionsEmulatorAutohidemenu(CCmdUI*pCmdUI)
815 {
816 pCmdUI->SetCheck(theApp.autoHideMenu);
817 }
819 void MainWnd::OnOptionsEmulatorRewindinterval()
820 {
821 RewindInterval dlg((float)theApp.rewindTimer/6.0f, theApp.rewindSlots);
822 int v = dlg.DoModal();
824 if (v >= 0)
825 {
826 int interval = v & 0x0000ffff;
827 int slots = (v & 0xffff0000) >> 16;
829 int prevSlots = theApp.rewindSlots;
831 theApp.rewindTimer = interval; // already converted to a multiple of 10 frames
832 theApp.rewindSlots = slots;
833 if (interval == 0 || slots == 0)
834 {
835 theApp.rewindTimer = theApp.rewindSlots = 0;
836 regSetDwordValue("rewindTimer", interval);
837 regSetDwordValue("rewindSlots", slots);
838 if (theApp.rewindMemory)
839 free(theApp.rewindMemory);
840 theApp.rewindMemory = NULL;
841 theApp.rewindCount = 0;
842 theApp.rewindCounter = 0;
843 theApp.rewindSaveNeeded = false;
844 }
845 else
846 {
847 regSetDwordValue("rewindTimer", interval);
848 regSetDwordValue("rewindSlots", slots);
849 if (slots != prevSlots)
850 {
851 if (theApp.rewindMemory)
852 free(theApp.rewindMemory);
853 theApp.rewindMemory = NULL;
854 theApp.rewindPos = 0;
855 }
856 if (theApp.rewindMemory == NULL)
857 theApp.rewindMemory = (char *)malloc(theApp.rewindSlots*REWIND_SIZE);
858 theApp.rewindCount = 0;
859 theApp.rewindSaveNeeded = true;
860 }
861 }
862 }
864 BOOL MainWnd::OnOptionsEmulatorShowSpeed(UINT nID)
865 {
866 switch (nID)
867 {
868 case ID_OPTIONS_EMULATOR_SHOWSPEED_NONE:
869 theApp.showSpeed = 0;
870 systemSetTitle(VBA_NAME_AND_VERSION);
871 break;
872 case ID_OPTIONS_EMULATOR_SHOWSPEED_PERCENTAGE:
873 theApp.showSpeed = 1;
874 break;
875 case ID_OPTIONS_EMULATOR_SHOWSPEED_DETAILED:
876 theApp.showSpeed = 2;
877 break;
878 case ID_OPTIONS_EMULATOR_SHOWSPEED_TRANSPARENT:
879 theApp.showSpeedTransparent = !theApp.showSpeedTransparent;
880 break;
881 default:
882 return FALSE;
883 }
884 return TRUE;
885 }
887 void MainWnd::OnUpdateOptionsEmulatorShowSpeed(CCmdUI *pCmdUI)
888 {
889 switch (pCmdUI->m_nID)
890 {
891 case ID_OPTIONS_EMULATOR_SHOWSPEED_NONE:
892 pCmdUI->SetCheck(theApp.showSpeed == 0);
893 break;
894 case ID_OPTIONS_EMULATOR_SHOWSPEED_PERCENTAGE:
895 pCmdUI->SetCheck(theApp.showSpeed == 1);
896 break;
897 case ID_OPTIONS_EMULATOR_SHOWSPEED_DETAILED:
898 pCmdUI->SetCheck(theApp.showSpeed == 2);
899 break;
900 case ID_OPTIONS_EMULATOR_SHOWSPEED_TRANSPARENT:
901 pCmdUI->SetCheck(theApp.showSpeedTransparent);
902 break;
903 }
904 }
906 void MainWnd::OnOptionsEmulatorSavetypeAutomatic()
907 {
908 theApp.winSaveType = 0;
909 }
911 void MainWnd::OnUpdateOptionsEmulatorSavetypeAutomatic(CCmdUI*pCmdUI)
912 {
913 pCmdUI->SetCheck(theApp.winSaveType == 0);
914 pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
915 }
917 void MainWnd::OnOptionsEmulatorSavetypeEeprom()
918 {
919 theApp.winSaveType = 1;
920 }
922 void MainWnd::OnUpdateOptionsEmulatorSavetypeEeprom(CCmdUI*pCmdUI)
923 {
924 pCmdUI->SetCheck(theApp.winSaveType == 1);
925 pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
926 }
928 void MainWnd::OnOptionsEmulatorSavetypeSram()
929 {
930 theApp.winSaveType = 2;
931 }
933 void MainWnd::OnUpdateOptionsEmulatorSavetypeSram(CCmdUI*pCmdUI)
934 {
935 pCmdUI->SetCheck(theApp.winSaveType == 2);
936 pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
937 }
939 void MainWnd::OnOptionsEmulatorSavetypeFlash()
940 {
941 theApp.winSaveType = 3;
942 }
944 void MainWnd::OnUpdateOptionsEmulatorSavetypeFlash(CCmdUI*pCmdUI)
945 {
946 pCmdUI->SetCheck(theApp.winSaveType == 3);
947 pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
948 }
950 void MainWnd::OnOptionsEmulatorSavetypeEepromsensor()
951 {
952 theApp.winSaveType = 4;
953 }
955 void MainWnd::OnUpdateOptionsEmulatorSavetypeEepromsensor(CCmdUI*pCmdUI)
956 {
957 pCmdUI->SetCheck(theApp.winSaveType == 4);
958 pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
959 }
961 void MainWnd::OnOptionsEmulatorSavetypeNone()
962 {
963 theApp.winSaveType = 5;
964 }
966 void MainWnd::OnUpdateOptionsEmulatorSavetypeNone(CCmdUI*pCmdUI)
967 {
968 pCmdUI->SetCheck(theApp.winSaveType == 5);
969 pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
970 }
972 void MainWnd::OnOptionsEmulatorSavetypeFlash512k()
973 {
974 flashSetSize(0x10000);
975 theApp.winFlashSize = 0x10000;
976 }
978 void MainWnd::OnUpdateOptionsEmulatorSavetypeFlash512k(CCmdUI*pCmdUI)
979 {
980 pCmdUI->SetCheck(theApp.winFlashSize == 0x10000);
981 pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
982 }
984 void MainWnd::OnOptionsEmulatorSavetypeFlash1m()
985 {
986 flashSetSize(0x20000);
987 theApp.winFlashSize = 0x20000;
988 }
990 void MainWnd::OnUpdateOptionsEmulatorSavetypeFlash1m(CCmdUI*pCmdUI)
991 {
992 pCmdUI->SetCheck(theApp.winFlashSize == 0x20000);
993 pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
994 }
996 void MainWnd::OnOptionsEmulatorUsebiosfile()
997 {
998 if (!theApp.biosFileName.IsEmpty())
999 theApp.useBiosFile = !theApp.useBiosFile;
1002 void MainWnd::OnUpdateOptionsEmulatorUsebiosfile(CCmdUI*pCmdUI)
1004 pCmdUI->SetCheck(theApp.useBiosFile);
1005 pCmdUI->Enable(!theApp.biosFileName.IsEmpty() && (!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)));
1008 void MainWnd::OnOptionsEmulatorSkipbios()
1010 theApp.skipBiosFile = !theApp.skipBiosFile;
1013 void MainWnd::OnUpdateOptionsEmulatorSkipbios(CCmdUI*pCmdUI)
1015 pCmdUI->SetCheck(theApp.skipBiosFile);
1016 pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
1019 void MainWnd::OnOptionsEmulatorUseOldGBTiming()
1021 useOldFrameTiming = !useOldFrameTiming;
1024 void MainWnd::OnUpdateOptionsEmulatorUseOldGBTiming(CCmdUI*pCmdUI)
1026 pCmdUI->SetCheck(useOldFrameTiming);
1027 pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
1030 void MainWnd::OnOptionsEmulatorUseGBNullInputKludge()
1032 if (VBAMovieActive())
1033 gbNullInputHackTempEnabled = !gbNullInputHackTempEnabled;
1034 else
1035 gbNullInputHackTempEnabled = gbNullInputHackEnabled = !gbNullInputHackEnabled;
1038 void MainWnd::OnUpdateOptionsEmulatorUseGBNullInputKludge(CCmdUI*pCmdUI)
1040 pCmdUI->SetCheck(VBAMovieActive() || GetAsyncKeyState(VK_CONTROL) ? gbNullInputHackTempEnabled : gbNullInputHackEnabled);
1041 pCmdUI->Enable((!VBAMovieActive() && !useOldFrameTiming) || GetAsyncKeyState(VK_CONTROL));
1044 void MainWnd::OnOptionsEmulatorGBALag()
1046 extern void TogglePrefetchHack();
1047 TogglePrefetchHack();
1048 memLagEnabled = memLagTempEnabled; // memLagEnabled is only to hold the last value that the user chose, so temporary changes
1049 // don't get into the registry
1052 void MainWnd::OnUpdateOptionsEmulatorGBALag(CCmdUI*pCmdUI)
1054 pCmdUI->SetCheck(!memLagTempEnabled);
1055 pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
1058 void MainWnd::OnOptionsEmulatorSelectbiosfile()
1060 theApp.winCheckFullscreen();
1061 LPCTSTR exts[] = { NULL };
1062 CString filter = winResLoadFilter(IDS_FILTER_BIOS);
1063 CString title = winResLoadString(IDS_SELECT_BIOS_FILE);
1065 FileDlg dlg(this,
1066 theApp.biosFileName,
1067 filter,
1068 0,
1069 "BIOS",
1070 exts,
1071 "",
1072 title,
1073 false);
1075 if (dlg.DoModal() == IDOK)
1077 theApp.biosFileName = dlg.GetPathName();
1081 void MainWnd::OnOptionsEmulatorPngformat()
1083 theApp.captureFormat = 0;
1086 void MainWnd::OnUpdateOptionsEmulatorPngformat(CCmdUI*pCmdUI)
1088 pCmdUI->SetCheck(theApp.captureFormat == 0);
1091 void MainWnd::OnOptionsEmulatorBmpformat()
1093 theApp.captureFormat = 1;
1096 void MainWnd::OnUpdateOptionsEmulatorBmpformat(CCmdUI*pCmdUI)
1098 pCmdUI->SetCheck(theApp.captureFormat == 1);
1101 void MainWnd::OnOptionsSoundDisable()
1103 if (soundOffFlag)
1105 soundOffFlag = false;
1106 soundInit();
1108 else
1110 soundOffFlag = true;
1111 soundShutdown();
1115 void MainWnd::OnUpdateOptionsSoundDisable(CCmdUI*pCmdUI)
1117 pCmdUI->SetCheck(soundOffFlag);
1118 pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
1121 static void OnSoundToggleEnabled(int c)
1123 if (soundGetEnabledChannels() & c)
1125 soundDisableChannels(c);
1127 else
1129 soundEnableChannels(c);
1133 void MainWnd::OnOptionsSoundMute()
1135 if ((soundGetEnabledChannels() & 0x030f) == 0)
1136 soundEnableChannels(0x030f);
1137 else
1138 soundDisableChannels(0x030f);
1141 void MainWnd::OnUpdateOptionsSoundMute(CCmdUI*pCmdUI)
1143 pCmdUI->SetCheck((soundGetEnabledChannels() & 0x030f) == 0);
1146 void MainWnd::OnOptionsSoundOff()
1148 soundDisableChannels(0x030f);
1151 void MainWnd::OnUpdateOptionsSoundOff(CCmdUI*pCmdUI)
1153 pCmdUI->SetCheck((soundGetEnabledChannels() & 0x030f) == 0);
1156 void MainWnd::OnOptionsSoundOn()
1158 soundEnableChannels(0x030f);
1161 void MainWnd::OnUpdateOptionsSoundOn(CCmdUI*pCmdUI)
1163 pCmdUI->SetCheck(soundGetEnabledChannels() == 0x030f);
1166 void MainWnd::OnOptionsSoundUseoldsynchronization()
1168 theApp.useOldSync = !theApp.useOldSync;
1169 systemMessage(IDS_SETTING_WILL_BE_EFFECTIVE,
1170 "Setting will be effective the next time you start the emulator");
1173 void MainWnd::OnUpdateOptionsSoundUseoldsynchronization(CCmdUI*pCmdUI)
1175 pCmdUI->SetCheck(theApp.useOldSync);
1178 void MainWnd::OnOptionsSoundEcho()
1180 soundEcho = !soundEcho;
1183 void MainWnd::OnUpdateOptionsSoundEcho(CCmdUI*pCmdUI)
1185 pCmdUI->SetCheck(soundEcho);
1188 void MainWnd::OnOptionsSoundLowpassfilter()
1190 soundLowPass = !soundLowPass;
1193 void MainWnd::OnUpdateOptionsSoundLowpassfilter(CCmdUI*pCmdUI)
1195 pCmdUI->SetCheck(soundLowPass);
1198 void MainWnd::OnOptionsSoundReversestereo()
1200 soundReverse = !soundReverse;
1203 void MainWnd::OnUpdateOptionsSoundReversestereo(CCmdUI*pCmdUI)
1205 pCmdUI->SetCheck(soundReverse);
1208 void MainWnd::OnOptionsSoundMuteFrameAdvance()
1210 theApp.muteFrameAdvance = !theApp.muteFrameAdvance;
1213 void MainWnd::OnUpdateOptionsSoundMuteFrameAdvance(CCmdUI*pCmdUI)
1215 pCmdUI->SetCheck(theApp.muteFrameAdvance);
1218 void MainWnd::OnOptionsSoundMuteWhenInactive()
1220 theApp.muteWhenInactive = !theApp.muteWhenInactive;
1223 void MainWnd::OnUpdateOptionsSoundMuteWhenInactive(CCmdUI*pCmdUI)
1225 pCmdUI->SetCheck(theApp.muteWhenInactive);
1228 void MainWnd::OnOptionsSound11khz()
1230 if (systemCartridgeType == 0)
1231 soundSetQuality(4);
1232 else
1233 gbSoundSetQuality(4);
1236 void MainWnd::OnUpdateOptionsSound11khz(CCmdUI*pCmdUI)
1238 pCmdUI->SetCheck(soundQuality == 4);
1239 pCmdUI->Enable((!VBAMovieActive() ||
1240 GetAsyncKeyState(VK_CONTROL)) && !(theApp.soundRecording || theApp.aviRecording || theApp.nvAudioLog));
1243 void MainWnd::OnOptionsSound22khz()
1245 if (systemCartridgeType == 0)
1246 soundSetQuality(2);
1247 else
1248 gbSoundSetQuality(2);
1251 void MainWnd::OnUpdateOptionsSound22khz(CCmdUI*pCmdUI)
1253 pCmdUI->SetCheck(soundQuality == 2);
1254 pCmdUI->Enable((!VBAMovieActive() ||
1255 GetAsyncKeyState(VK_CONTROL)) && !(theApp.soundRecording || theApp.aviRecording || theApp.nvAudioLog));
1258 void MainWnd::OnOptionsSound44khz()
1260 systemSoundSetQuality(1);
1263 void MainWnd::OnUpdateOptionsSound44khz(CCmdUI*pCmdUI)
1265 pCmdUI->SetCheck(soundQuality == 1);
1266 pCmdUI->Enable(!(theApp.soundRecording || theApp.aviRecording || theApp.nvAudioLog));
1269 BOOL MainWnd::OnOptionsSoundVolume(UINT nID)
1271 soundVolume = nID - ID_OPTIONS_SOUND_VOLUME_1X;
1272 return TRUE;
1275 void MainWnd::OnUpdateOptionsSoundVolume(CCmdUI *pCmdUI)
1277 pCmdUI->SetCheck(soundVolume == (int)(pCmdUI->m_nID - ID_OPTIONS_SOUND_VOLUME_1X));
1280 void MainWnd::OnOptionsSoundVolume25x()
1282 soundVolume = 4;
1285 void MainWnd::OnUpdateOptionsSoundVolume25x(CCmdUI*pCmdUI)
1287 pCmdUI->SetCheck(soundVolume == 4);
1290 void MainWnd::OnOptionsSoundVolume5x()
1292 soundVolume = 5;
1295 void MainWnd::OnUpdateOptionsSoundVolume5x(CCmdUI*pCmdUI)
1297 pCmdUI->SetCheck(soundVolume == 5);
1300 void MainWnd::OnOptionsSoundChannel1()
1302 OnSoundToggleEnabled(0x01);
1305 void MainWnd::OnUpdateOptionsSoundChannel1(CCmdUI*pCmdUI)
1307 pCmdUI->SetCheck(soundGetEnabledChannels() & 0x01);
1310 void MainWnd::OnOptionsSoundChannel2()
1312 OnSoundToggleEnabled(0x02);
1315 void MainWnd::OnUpdateOptionsSoundChannel2(CCmdUI*pCmdUI)
1317 pCmdUI->SetCheck(soundGetEnabledChannels() & 0x02);
1320 void MainWnd::OnOptionsSoundChannel3()
1322 OnSoundToggleEnabled(0x04);
1325 void MainWnd::OnUpdateOptionsSoundChannel3(CCmdUI*pCmdUI)
1327 pCmdUI->SetCheck(soundGetEnabledChannels() & 0x04);
1330 void MainWnd::OnOptionsSoundChannel4()
1332 OnSoundToggleEnabled(0x08);
1335 void MainWnd::OnUpdateOptionsSoundChannel4(CCmdUI*pCmdUI)
1337 pCmdUI->SetCheck(soundGetEnabledChannels() & 0x08);
1340 void MainWnd::OnOptionsSoundDirectsounda()
1342 OnSoundToggleEnabled(0x0100);
1345 void MainWnd::OnUpdateOptionsSoundDirectsounda(CCmdUI*pCmdUI)
1347 pCmdUI->SetCheck(soundGetEnabledChannels() & 0x0100);
1348 //pCmdUI->Enable(systemCartridgeType == 0);
1351 void MainWnd::OnOptionsSoundDirectsoundb()
1353 OnSoundToggleEnabled(0x0200);
1356 void MainWnd::OnUpdateOptionsSoundDirectsoundb(CCmdUI*pCmdUI)
1358 pCmdUI->SetCheck(soundGetEnabledChannels() & 0x0200);
1359 //pCmdUI->Enable(systemCartridgeType == 0);
1362 void MainWnd::OnOptionsGameboyBorder()
1364 theApp.winGbBorderOn = !theApp.winGbBorderOn;
1365 gbBorderOn = theApp.winGbBorderOn;
1366 if (emulating && systemCartridgeType == 1 && gbBorderOn)
1368 gbSgbRenderBorder();
1370 theApp.updateWindowSize(theApp.videoOption);
1373 void MainWnd::OnUpdateOptionsGameboyBorder(CCmdUI*pCmdUI)
1375 pCmdUI->SetCheck(theApp.winGbBorderOn);
1378 void MainWnd::OnOptionsGameboyPrinter()
1380 theApp.winGbPrinterEnabled = !theApp.winGbPrinterEnabled;
1381 if (theApp.winGbPrinterEnabled)
1382 gbSerialFunction = gbPrinterSend;
1383 else
1384 gbSerialFunction = NULL;
1387 void MainWnd::OnUpdateOptionsGameboyPrinter(CCmdUI*pCmdUI)
1389 pCmdUI->SetCheck(gbSerialFunction == gbPrinterSend);
1392 void MainWnd::OnOptionsGameboyBorderAutomatic()
1394 gbBorderAutomatic = !gbBorderAutomatic;
1395 if (emulating && systemCartridgeType == 1 && gbBorderOn)
1397 gbSgbRenderBorder();
1398 theApp.updateWindowSize(theApp.videoOption);
1402 void MainWnd::OnUpdateOptionsGameboyBorderAutomatic(CCmdUI*pCmdUI)
1404 pCmdUI->SetCheck(gbBorderAutomatic);
1407 void MainWnd::OnOptionsGameboyAutomatic()
1409 gbEmulatorType = 0;
1412 void MainWnd::OnUpdateOptionsGameboyAutomatic(CCmdUI*pCmdUI)
1414 pCmdUI->SetCheck(gbEmulatorType == 0);
1415 pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
1418 void MainWnd::OnOptionsGameboyGba()
1420 gbEmulatorType = 4;
1423 void MainWnd::OnUpdateOptionsGameboyGba(CCmdUI*pCmdUI)
1425 pCmdUI->SetCheck(gbEmulatorType == 4);
1426 pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
1429 void MainWnd::OnOptionsGameboyCgb()
1431 gbEmulatorType = 1;
1434 void MainWnd::OnUpdateOptionsGameboyCgb(CCmdUI*pCmdUI)
1436 pCmdUI->SetCheck(gbEmulatorType == 1);
1437 pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
1440 void MainWnd::OnOptionsGameboySgb()
1442 gbEmulatorType = 2;
1445 void MainWnd::OnUpdateOptionsGameboySgb(CCmdUI*pCmdUI)
1447 pCmdUI->SetCheck(gbEmulatorType == 2);
1448 pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
1451 void MainWnd::OnOptionsGameboySgb2()
1453 gbEmulatorType = 5;
1456 void MainWnd::OnUpdateOptionsGameboySgb2(CCmdUI*pCmdUI)
1458 pCmdUI->SetCheck(gbEmulatorType == 5);
1459 pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
1462 void MainWnd::OnOptionsGameboyGb()
1464 gbEmulatorType = 3;
1467 void MainWnd::OnUpdateOptionsGameboyGb(CCmdUI*pCmdUI)
1469 pCmdUI->SetCheck(gbEmulatorType == 3);
1470 pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
1473 void MainWnd::OnOptionsGameboyRealcolors()
1475 gbColorOption = 0;
1478 void MainWnd::OnUpdateOptionsGameboyRealcolors(CCmdUI*pCmdUI)
1480 pCmdUI->SetCheck(gbColorOption == 0);
1483 void MainWnd::OnOptionsGameboyGameboycolors()
1485 gbColorOption = 1;
1488 void MainWnd::OnUpdateOptionsGameboyGameboycolors(CCmdUI*pCmdUI)
1490 pCmdUI->SetCheck(gbColorOption == 1);
1493 void MainWnd::OnOptionsGameboyColors()
1495 theApp.winCheckFullscreen();
1496 GBColorDlg dlg;
1497 if (dlg.DoModal())
1499 gbPaletteOption = dlg.getWhich();
1500 memcpy(systemGbPalette, dlg.getColors(), 24*sizeof(u16));
1501 if (emulating && systemCartridgeType == 1)
1503 memcpy(gbPalette, &systemGbPalette[dlg.getWhich()*8], 8*sizeof(u16));
1508 BOOL MainWnd::OnOptionsFilter(UINT nID)
1510 switch (nID)
1512 case ID_OPTIONS_FILTER_NORMAL:
1513 theApp.filterType = 0;
1514 break;
1515 case ID_OPTIONS_FILTER_TVMODE:
1516 theApp.filterType = 1;
1517 break;
1518 case ID_OPTIONS_FILTER_2XSAI:
1519 theApp.filterType = 2;
1520 break;
1521 case ID_OPTIONS_FILTER_SUPER2XSAI:
1522 theApp.filterType = 3;
1523 break;
1524 case ID_OPTIONS_FILTER_SUPEREAGLE:
1525 theApp.filterType = 4;
1526 break;
1527 case ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL:
1528 theApp.filterType = 5;
1529 break;
1530 case ID_OPTIONS_FILTER16BIT_MOTIONBLUREXPERIMENTAL:
1531 theApp.filterType = 6;
1532 break;
1533 case ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X:
1534 theApp.filterType = 7;
1535 break;
1536 case ID_OPTIONS_FILTER16BIT_SIMPLE2X:
1537 theApp.filterType = 8;
1538 break;
1539 case ID_OPTIONS_FILTER_BILINEAR:
1540 theApp.filterType = 9;
1541 break;
1542 case ID_OPTIONS_FILTER_BILINEARPLUS:
1543 theApp.filterType = 10;
1544 break;
1545 case ID_OPTIONS_FILTER_SCANLINES:
1546 theApp.filterType = 11;
1547 break;
1548 case ID_OPTIONS_FILTER_HQ2X2:
1549 theApp.filterType = 12;
1550 break;
1551 case ID_OPTIONS_FILTER_HQ2X:
1552 theApp.filterType = 13;
1553 break;
1554 case ID_OPTIONS_FILTER_LQ2X:
1555 theApp.filterType = 14;
1556 break;
1557 case ID_OPTIONS_FILTER_HQ3X2:
1558 theApp.filterType = 15;
1559 break;
1560 case ID_OPTIONS_FILTER_HQ3X:
1561 theApp.filterType = 16;
1562 break;
1563 case ID_OPTIONS_FILTER16BIT_SIMPLE3X:
1564 theApp.filterType = 17;
1565 break;
1566 case ID_OPTIONS_FILTER16BIT_SIMPLE4X:
1567 theApp.filterType = 18;
1568 break;
1569 case ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL3X:
1570 theApp.filterType = 19;
1571 break;
1572 case ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL4X:
1573 theApp.filterType = 20;
1574 break;
1575 default:
1576 return FALSE;
1578 theApp.updateFilter();
1579 return TRUE;
1582 void MainWnd::OnUpdateOptionsFilter(CCmdUI *pCmdUI)
1584 pCmdUI->Enable(systemColorDepth == 16 || systemColorDepth == 32);
1585 switch (pCmdUI->m_nID)
1587 case ID_OPTIONS_FILTER_NORMAL:
1588 pCmdUI->SetCheck(theApp.filterType == 0);
1589 break;
1590 case ID_OPTIONS_FILTER_TVMODE:
1591 pCmdUI->SetCheck(theApp.filterType == 1);
1592 break;
1593 case ID_OPTIONS_FILTER_2XSAI:
1594 pCmdUI->SetCheck(theApp.filterType == 2);
1595 break;
1596 case ID_OPTIONS_FILTER_SUPER2XSAI:
1597 pCmdUI->SetCheck(theApp.filterType == 3);
1598 break;
1599 case ID_OPTIONS_FILTER_SUPEREAGLE:
1600 pCmdUI->SetCheck(theApp.filterType == 4);
1601 break;
1602 case ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL:
1603 pCmdUI->SetCheck(theApp.filterType == 5);
1604 break;
1605 case ID_OPTIONS_FILTER16BIT_MOTIONBLUREXPERIMENTAL:
1606 pCmdUI->SetCheck(theApp.filterType == 6);
1607 break;
1608 case ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X:
1609 pCmdUI->SetCheck(theApp.filterType == 7);
1610 break;
1611 case ID_OPTIONS_FILTER16BIT_SIMPLE2X:
1612 pCmdUI->SetCheck(theApp.filterType == 8);
1613 break;
1614 case ID_OPTIONS_FILTER_BILINEAR:
1615 pCmdUI->SetCheck(theApp.filterType == 9);
1616 break;
1617 case ID_OPTIONS_FILTER_BILINEARPLUS:
1618 pCmdUI->SetCheck(theApp.filterType == 10);
1619 break;
1620 case ID_OPTIONS_FILTER_SCANLINES:
1621 pCmdUI->SetCheck(theApp.filterType == 11);
1622 break;
1623 case ID_OPTIONS_FILTER_HQ2X2:
1624 pCmdUI->SetCheck(theApp.filterType == 12);
1625 break;
1626 case ID_OPTIONS_FILTER_HQ2X:
1627 pCmdUI->SetCheck(theApp.filterType == 13);
1628 break;
1629 case ID_OPTIONS_FILTER_LQ2X:
1630 pCmdUI->SetCheck(theApp.filterType == 14);
1631 break;
1632 case ID_OPTIONS_FILTER_HQ3X2:
1633 pCmdUI->SetCheck(theApp.filterType == 15);
1634 break;
1635 case ID_OPTIONS_FILTER_HQ3X:
1636 pCmdUI->SetCheck(theApp.filterType == 16);
1637 break;
1638 case ID_OPTIONS_FILTER16BIT_SIMPLE3X:
1639 pCmdUI->SetCheck(theApp.filterType == 17);
1640 break;
1641 case ID_OPTIONS_FILTER16BIT_SIMPLE4X:
1642 pCmdUI->SetCheck(theApp.filterType == 18);
1643 break;
1644 case ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL3X:
1645 pCmdUI->SetCheck(theApp.filterType == 19);
1646 break;
1647 case ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL4X:
1648 pCmdUI->SetCheck(theApp.filterType == 20);
1649 break;
1653 BOOL MainWnd::OnOptionsFilterIFB(UINT nID)
1655 switch (nID)
1657 case ID_OPTIONS_FILTER_INTERFRAMEBLENDING_NONE:
1658 theApp.ifbType = 0;
1659 break;
1660 case ID_OPTIONS_FILTER_INTERFRAMEBLENDING_MOTIONBLUR:
1661 theApp.ifbType = 1;
1662 break;
1663 case ID_OPTIONS_FILTER_INTERFRAMEBLENDING_SMART:
1664 theApp.ifbType = 2;
1665 break;
1666 default:
1667 return FALSE;
1669 theApp.updateIFB();
1670 return TRUE;
1673 void MainWnd::OnUpdateOptionsFilterIFB(CCmdUI *pCmdUI)
1675 switch (pCmdUI->m_nID)
1677 case ID_OPTIONS_FILTER_INTERFRAMEBLENDING_NONE:
1678 pCmdUI->SetCheck(theApp.ifbType == 0);
1679 break;
1680 case ID_OPTIONS_FILTER_INTERFRAMEBLENDING_MOTIONBLUR:
1681 pCmdUI->SetCheck(theApp.ifbType == 1);
1682 break;
1683 case ID_OPTIONS_FILTER_INTERFRAMEBLENDING_SMART:
1684 pCmdUI->SetCheck(theApp.ifbType == 2);
1685 break;
1689 void MainWnd::OnOptionsFilterDisablemmx()
1691 theApp.disableMMX = !theApp.disableMMX;
1692 if (!theApp.disableMMX)
1693 cpu_mmx = theApp.detectMMX();
1694 else
1695 cpu_mmx = 0;
1698 void MainWnd::OnUpdateOptionsFilterDisablemmx(CCmdUI*pCmdUI)
1700 pCmdUI->SetCheck(theApp.disableMMX);
1703 void MainWnd::OnOptionsLanguageSystem()
1705 theApp.winSetLanguageOption(0, false);
1708 void MainWnd::OnUpdateOptionsLanguageSystem(CCmdUI*pCmdUI)
1710 pCmdUI->SetCheck(theApp.languageOption == 0);
1713 void MainWnd::OnOptionsLanguageEnglish()
1715 theApp.winSetLanguageOption(1, false);
1718 void MainWnd::OnUpdateOptionsLanguageEnglish(CCmdUI*pCmdUI)
1720 pCmdUI->SetCheck(theApp.languageOption == 1);
1723 void MainWnd::OnOptionsLanguageOther()
1725 theApp.winCheckFullscreen();
1726 theApp.winSetLanguageOption(2, false);
1729 void MainWnd::OnUpdateOptionsLanguageOther(CCmdUI*pCmdUI)
1731 pCmdUI->SetCheck(theApp.languageOption == 2);
1734 void MainWnd::OnOptionsJoypadConfigure1()
1736 theApp.winCheckFullscreen();
1737 JoypadConfig dlg(0);
1738 dlg.DoModal();
1741 void MainWnd::OnUpdateOptionsJoypadConfigure1(CCmdUI*pCmdUI)
1743 pCmdUI->Enable(theApp.videoOption != VIDEO_320x240);
1746 void MainWnd::OnOptionsJoypadConfigure2()
1748 theApp.winCheckFullscreen();
1749 JoypadConfig dlg(1);
1750 dlg.DoModal();
1753 void MainWnd::OnUpdateOptionsJoypadConfigure2(CCmdUI*pCmdUI)
1755 pCmdUI->Enable(theApp.videoOption != VIDEO_320x240);
1758 void MainWnd::OnOptionsJoypadConfigure3()
1760 theApp.winCheckFullscreen();
1761 JoypadConfig dlg(2);
1762 dlg.DoModal();
1765 void MainWnd::OnUpdateOptionsJoypadConfigure3(CCmdUI*pCmdUI)
1767 pCmdUI->Enable(theApp.videoOption != VIDEO_320x240);
1770 void MainWnd::OnOptionsJoypadConfigure4()
1772 theApp.winCheckFullscreen();
1773 JoypadConfig dlg(3);
1774 dlg.DoModal();
1777 void MainWnd::OnUpdateOptionsJoypadConfigure4(CCmdUI*pCmdUI)
1779 pCmdUI->Enable(theApp.videoOption != VIDEO_320x240);
1782 BOOL MainWnd::OnOptionsJoypadDefault(UINT nID)
1784 theApp.joypadDefault = nID - ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_1;
1785 return TRUE;
1788 void MainWnd::OnUpdateOptionsJoypadDefault(CCmdUI *pCmdUI)
1790 pCmdUI->SetCheck(theApp.joypadDefault == (int)(pCmdUI->m_nID - ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_1));
1793 void MainWnd::OnOptionsJoypadMotionconfigure()
1795 theApp.winCheckFullscreen();
1796 MotionConfig dlg;
1797 dlg.DoModal();
1800 void MainWnd::OnUpdateOptionsJoypadMotionconfigure(CCmdUI*pCmdUI)
1802 pCmdUI->Enable(theApp.videoOption != VIDEO_320x240);
1805 void MainWnd::OnOptionsJoypadAllowLeftRight()
1807 theApp.allowLeftRight = !theApp.allowLeftRight;
1810 void MainWnd::OnUpdateOptionsJoypadAllowLeftRight(CCmdUI*pCmdUI)
1812 pCmdUI->SetCheck(theApp.allowLeftRight);
1815 void MainWnd::OnOptionsJoypadAutofireAccountForLag()
1817 theApp.autofireAccountForLag = !theApp.autofireAccountForLag;
1820 void MainWnd::OnUpdateOptionsJoypadAutofireAccountForLag(CCmdUI*pCmdUI)
1822 pCmdUI->SetCheck(theApp.autofireAccountForLag);
1825 BOOL MainWnd::OnOptionsJoypadAutofire(UINT nID)
1827 int & autoFire = (theApp.autoFireToggle ? theApp.autoFire : theApp.autoFire2);
1828 int & autoFire2 = (theApp.autoFireToggle ? theApp.autoFire2 : theApp.autoFire);
1829 int autoFires = (theApp.autoFire | theApp.autoFire2);
1831 switch (nID)
1833 case ID_OPTIONS_JOYPAD_AUTOFIRE_A:
1834 if (autoFires & BUTTON_MASK_A)
1836 autoFire &= ~BUTTON_MASK_A;
1837 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_A_DISABLED));
1839 else
1841 autoFire |= BUTTON_MASK_A;
1842 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_A));
1844 autoFire2 &= ~BUTTON_MASK_A;
1845 theApp.autoHold &= ~BUTTON_MASK_A;
1846 break;
1847 case ID_OPTIONS_JOYPAD_AUTOFIRE_B:
1848 if (autoFires & BUTTON_MASK_B)
1850 autoFire &= ~BUTTON_MASK_B;
1851 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_B_DISABLED));
1853 else
1855 autoFire |= BUTTON_MASK_B;
1856 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_B));
1858 autoFire2 &= ~BUTTON_MASK_B;
1859 theApp.autoHold &= ~BUTTON_MASK_B;
1860 break;
1861 case ID_OPTIONS_JOYPAD_AUTOFIRE_L:
1862 if (autoFires & BUTTON_MASK_L)
1864 autoFire &= ~BUTTON_MASK_L;
1865 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_L_DISABLED));
1867 else
1869 autoFire |= BUTTON_MASK_L;
1870 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_L));
1872 autoFire2 &= ~BUTTON_MASK_L;
1873 theApp.autoHold &= ~BUTTON_MASK_L;
1874 break;
1875 case ID_OPTIONS_JOYPAD_AUTOFIRE_R:
1876 if (autoFires & BUTTON_MASK_R)
1878 autoFire &= ~BUTTON_MASK_R;
1879 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_R_DISABLED));
1881 else
1883 autoFire |= BUTTON_MASK_R;
1884 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_R));
1886 autoFire2 &= ~BUTTON_MASK_R;
1887 theApp.autoHold &= ~BUTTON_MASK_R;
1888 break;
1889 case ID_OPTIONS_JOYPAD_AUTOFIRE_START:
1890 if (autoFires & BUTTON_MASK_START)
1892 autoFire &= ~BUTTON_MASK_START;
1893 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_START_DISABLED));
1895 else
1897 autoFire |= BUTTON_MASK_START;
1898 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_START));
1900 autoFire2 &= ~BUTTON_MASK_START;
1901 theApp.autoHold &= ~BUTTON_MASK_START;
1902 break;
1903 case ID_OPTIONS_JOYPAD_AUTOFIRE_SELECT:
1904 if (autoFires & BUTTON_MASK_SELECT)
1906 autoFire &= ~BUTTON_MASK_SELECT;
1907 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_SELECT_DISABLED));
1909 else
1911 autoFire |= BUTTON_MASK_SELECT;
1912 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_SELECT));
1914 autoFire2 &= ~BUTTON_MASK_SELECT;
1915 theApp.autoHold &= ~BUTTON_MASK_SELECT;
1916 break;
1917 case ID_OPTIONS_JOYPAD_AUTOFIRE_UP:
1918 if (autoFires & BUTTON_MASK_UP)
1920 autoFire &= ~BUTTON_MASK_UP;
1921 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_UP_DISABLED));
1923 else
1925 autoFire |= BUTTON_MASK_UP;
1926 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_UP));
1928 autoFire2 &= ~BUTTON_MASK_UP;
1929 theApp.autoHold &= ~BUTTON_MASK_UP;
1930 break;
1931 case ID_OPTIONS_JOYPAD_AUTOFIRE_DOWN:
1932 if (autoFires & BUTTON_MASK_DOWN)
1934 autoFire &= ~BUTTON_MASK_DOWN;
1935 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_DOWN_DISABLED));
1937 else
1939 autoFire |= BUTTON_MASK_DOWN;
1940 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_DOWN));
1942 autoFire2 &= ~BUTTON_MASK_DOWN;
1943 theApp.autoHold &= ~BUTTON_MASK_DOWN;
1944 break;
1945 case ID_OPTIONS_JOYPAD_AUTOFIRE_LEFT:
1946 if (autoFires & BUTTON_MASK_LEFT)
1948 autoFire &= ~BUTTON_MASK_LEFT;
1949 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_LEFT_DISABLED));
1951 else
1953 autoFire |= BUTTON_MASK_LEFT;
1954 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_LEFT));
1956 autoFire2 &= ~BUTTON_MASK_LEFT;
1957 theApp.autoHold &= ~BUTTON_MASK_LEFT;
1958 break;
1959 case ID_OPTIONS_JOYPAD_AUTOFIRE_RIGHT:
1960 if (autoFires & BUTTON_MASK_RIGHT)
1962 autoFire &= ~BUTTON_MASK_RIGHT;
1963 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_RIGHT_DISABLED));
1965 else
1967 autoFire |= BUTTON_MASK_RIGHT;
1968 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_RIGHT));
1970 autoFire2 &= ~BUTTON_MASK_RIGHT;
1971 theApp.autoHold &= ~BUTTON_MASK_RIGHT;
1972 break;
1973 case ID_OPTIONS_JOYPAD_AUTOFIRE_CLEAR:
1974 if (autoFires != 0)
1976 theApp.autoFire = theApp.autoFire2 = 0;
1977 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_DISABLED));
1979 else
1981 /// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_ALREADY_DISABLED));
1982 systemScreenMessage("already cleared");
1984 break;
1985 default:
1986 return FALSE;
1989 extern void VBAUpdateButtonPressDisplay(); VBAUpdateButtonPressDisplay();
1991 return TRUE;
1994 void MainWnd::OnUpdateOptionsJoypadAutofire(CCmdUI *pCmdUI)
1996 /// pCmdUI->Enable(emulating); // FIXME: this is right, but disabling menu items screws up accelerators until you view the
1997 // menu!
1998 pCmdUI->Enable(TRUE); // TEMP
2000 int autoFires = (theApp.autoFire | theApp.autoFire2);
2002 bool check = true;
2003 switch (pCmdUI->m_nID)
2005 case ID_OPTIONS_JOYPAD_AUTOFIRE_A:
2006 check = (autoFires & BUTTON_MASK_A) != 0;
2007 break;
2008 case ID_OPTIONS_JOYPAD_AUTOFIRE_B:
2009 check = (autoFires & BUTTON_MASK_B) != 0;
2010 break;
2011 case ID_OPTIONS_JOYPAD_AUTOFIRE_L:
2012 check = (autoFires & BUTTON_MASK_L) != 0;
2013 /// extern int gbSgbMode; // from gbSGB.cpp
2014 /// if(emulating && systemCartridgeType != 0 && !gbSgbMode) // regular GB has no L button
2015 /// pCmdUI->Enable(false); // FIXME: this is right, but disabling menu items screws up accelerators until you view the
2016 // menu!
2017 break;
2018 case ID_OPTIONS_JOYPAD_AUTOFIRE_R:
2019 check = (autoFires & BUTTON_MASK_R) != 0;
2020 /// extern int gbSgbMode; // from gbSGB.cpp
2021 /// if(emulating && systemCartridgeType != 0 && !gbSgbMode) // regular GB has no R button
2022 /// pCmdUI->Enable(false); // FIXME: this is right, but disabling menu items screws up accelerators until you view the
2023 // menu!
2024 break;
2025 case ID_OPTIONS_JOYPAD_AUTOFIRE_START:
2026 check = (autoFires & BUTTON_MASK_START) != 0;
2027 break;
2028 case ID_OPTIONS_JOYPAD_AUTOFIRE_SELECT:
2029 check = (autoFires & BUTTON_MASK_SELECT) != 0;
2030 break;
2031 case ID_OPTIONS_JOYPAD_AUTOFIRE_UP:
2032 check = (autoFires & BUTTON_MASK_UP) != 0;
2033 break;
2034 case ID_OPTIONS_JOYPAD_AUTOFIRE_DOWN:
2035 check = (autoFires & BUTTON_MASK_DOWN) != 0;
2036 break;
2037 case ID_OPTIONS_JOYPAD_AUTOFIRE_LEFT:
2038 check = (autoFires & BUTTON_MASK_LEFT) != 0;
2039 break;
2040 case ID_OPTIONS_JOYPAD_AUTOFIRE_RIGHT:
2041 check = (autoFires & BUTTON_MASK_RIGHT) != 0;
2042 break;
2043 case ID_OPTIONS_JOYPAD_AUTOFIRE_CLEAR:
2044 check = (autoFires == 0);
2045 /// pCmdUI->Enable(!check); // FIXME: this is right, but disabling menu items screws up accelerators until you view the menu!
2046 break;
2048 pCmdUI->SetCheck(check);
2051 BOOL MainWnd::OnOptionsJoypadSticky(UINT nID)
2053 switch (nID)
2055 case ID_STICKY_A:
2056 if (theApp.autoHold & BUTTON_MASK_A)
2058 theApp.autoHold &= ~BUTTON_MASK_A;
2059 /// systemScreenMessage(winResLoadString(IDS_STICKY_A_DISABLED));
2061 else
2063 theApp.autoHold |= BUTTON_MASK_A;
2064 /// systemScreenMessage(winResLoadString(IDS_STICKY_A));
2066 theApp.autoFire &= ~BUTTON_MASK_A;
2067 theApp.autoFire2 &= ~BUTTON_MASK_A;
2068 break;
2069 case ID_STICKY_B:
2070 if (theApp.autoHold & BUTTON_MASK_B)
2072 theApp.autoHold &= ~BUTTON_MASK_B;
2073 /// systemScreenMessage(winResLoadString(IDS_STICKY_B_DISABLED));
2075 else
2077 theApp.autoHold |= BUTTON_MASK_B;
2078 /// systemScreenMessage(winResLoadString(IDS_STICKY_B));
2080 theApp.autoFire &= ~BUTTON_MASK_B;
2081 theApp.autoFire2 &= ~BUTTON_MASK_B;
2082 break;
2083 case ID_STICKY_L:
2084 if (theApp.autoHold & BUTTON_MASK_L)
2086 theApp.autoHold &= ~BUTTON_MASK_L;
2087 /// systemScreenMessage(winResLoadString(IDS_STICKY_L_DISABLED));
2089 else
2091 theApp.autoHold |= BUTTON_MASK_L;
2092 /// systemScreenMessage(winResLoadString(IDS_STICKY_L));
2094 theApp.autoFire &= ~BUTTON_MASK_L;
2095 theApp.autoFire2 &= ~BUTTON_MASK_L;
2096 break;
2097 case ID_STICKY_R:
2098 if (theApp.autoHold & BUTTON_MASK_R)
2100 theApp.autoHold &= ~BUTTON_MASK_R;
2101 /// systemScreenMessage(winResLoadString(IDS_STICKY_R_DISABLED));
2103 else
2105 theApp.autoHold |= BUTTON_MASK_R;
2106 /// systemScreenMessage(winResLoadString(IDS_STICKY_R));
2108 theApp.autoFire &= ~BUTTON_MASK_R;
2109 theApp.autoFire2 &= ~BUTTON_MASK_R;
2110 break;
2111 case ID_STICKY_START:
2112 if (theApp.autoHold & BUTTON_MASK_START)
2114 theApp.autoHold &= ~BUTTON_MASK_START;
2115 /// systemScreenMessage(winResLoadString(IDS_STICKY_START_DISABLED));
2117 else
2119 theApp.autoHold |= BUTTON_MASK_START;
2120 /// systemScreenMessage(winResLoadString(IDS_STICKY_START));
2122 theApp.autoFire &= ~BUTTON_MASK_START;
2123 theApp.autoFire2 &= ~BUTTON_MASK_START;
2124 break;
2125 case ID_STICKY_SELECT:
2126 if (theApp.autoHold & BUTTON_MASK_SELECT)
2128 theApp.autoHold &= ~BUTTON_MASK_SELECT;
2129 /// systemScreenMessage(winResLoadString(IDS_STICKY_SELECT_DISABLED));
2131 else
2133 theApp.autoHold |= BUTTON_MASK_SELECT;
2134 /// systemScreenMessage(winResLoadString(IDS_STICKY_SELECT));
2136 theApp.autoFire &= ~BUTTON_MASK_SELECT;
2137 theApp.autoFire2 &= ~BUTTON_MASK_SELECT;
2138 break;
2139 case ID_STICKY_UP:
2140 if (theApp.autoHold & BUTTON_MASK_UP)
2142 theApp.autoHold &= ~BUTTON_MASK_UP;
2143 /// systemScreenMessage(winResLoadString(IDS_STICKY_UP_DISABLED));
2145 else
2147 theApp.autoHold |= BUTTON_MASK_UP;
2148 /// systemScreenMessage(winResLoadString(IDS_STICKY_UP));
2150 theApp.autoFire &= ~BUTTON_MASK_UP;
2151 theApp.autoFire2 &= ~BUTTON_MASK_UP;
2152 if (!theApp.allowLeftRight)
2153 theApp.autoHold &= ~BUTTON_MASK_DOWN;
2154 break;
2155 case ID_STICKY_DOWN:
2156 if (theApp.autoHold & BUTTON_MASK_DOWN)
2158 theApp.autoHold &= ~BUTTON_MASK_DOWN;
2159 /// systemScreenMessage(winResLoadString(IDS_STICKY_DOWN_DISABLED));
2161 else
2163 theApp.autoHold |= BUTTON_MASK_DOWN;
2164 /// systemScreenMessage(winResLoadString(IDS_STICKY_DOWN));
2166 theApp.autoFire &= ~BUTTON_MASK_DOWN;
2167 theApp.autoFire2 &= ~BUTTON_MASK_DOWN;
2168 if (!theApp.allowLeftRight)
2169 theApp.autoHold &= ~BUTTON_MASK_UP;
2170 break;
2171 case ID_STICKY_LEFT:
2172 if (theApp.autoHold & BUTTON_MASK_LEFT)
2174 theApp.autoHold &= ~BUTTON_MASK_LEFT;
2175 /// systemScreenMessage(winResLoadString(IDS_STICKY_LEFT_DISABLED));
2177 else
2179 theApp.autoHold |= BUTTON_MASK_LEFT;
2180 /// systemScreenMessage(winResLoadString(IDS_STICKY_LEFT));
2182 theApp.autoFire &= ~BUTTON_MASK_LEFT;
2183 theApp.autoFire2 &= ~BUTTON_MASK_LEFT;
2184 if (!theApp.allowLeftRight)
2185 theApp.autoHold &= ~BUTTON_MASK_RIGHT;
2186 break;
2187 case ID_STICKY_RIGHT:
2188 if (theApp.autoHold & BUTTON_MASK_RIGHT)
2190 theApp.autoHold &= ~BUTTON_MASK_RIGHT;
2191 /// systemScreenMessage(winResLoadString(IDS_STICKY_RIGHT_DISABLED));
2193 else
2195 theApp.autoHold |= BUTTON_MASK_RIGHT;
2196 /// systemScreenMessage(winResLoadString(IDS_STICKY_RIGHT));
2198 theApp.autoFire &= ~BUTTON_MASK_RIGHT;
2199 theApp.autoFire2 &= ~BUTTON_MASK_RIGHT;
2200 if (!theApp.allowLeftRight)
2201 theApp.autoHold &= ~BUTTON_MASK_LEFT;
2202 break;
2203 case ID_STICKY_CLEAR:
2204 if (theApp.autoHold != 0)
2206 theApp.autoHold = 0;
2207 /// systemScreenMessage(winResLoadString(IDS_STICKY_DISABLED));
2209 else
2211 /// systemScreenMessage(winResLoadString(IDS_STICKY_ALREADY_DISABLED));
2212 systemScreenMessage("already cleared");
2214 break;
2215 default:
2216 return FALSE;
2219 extern void VBAUpdateButtonPressDisplay(); VBAUpdateButtonPressDisplay();
2221 return TRUE;
2224 void MainWnd::OnUpdateOptionsJoypadSticky(CCmdUI *pCmdUI)
2226 /// pCmdUI->Enable(emulating); // FIXME: this is right, but disabling menu items screws up accelerators until you view the
2227 // menu!
2228 pCmdUI->Enable(TRUE); // TEMP
2230 bool check = true;
2231 switch (pCmdUI->m_nID)
2233 case ID_STICKY_A:
2234 check = (theApp.autoHold & BUTTON_MASK_A) != 0;
2235 break;
2236 case ID_STICKY_B:
2237 check = (theApp.autoHold & BUTTON_MASK_B) != 0;
2238 break;
2239 case ID_STICKY_L:
2240 check = (theApp.autoHold & BUTTON_MASK_L) != 0;
2241 /// extern int gbSgbMode; // from gbSGB.cpp
2242 /// if(emulating && systemCartridgeType != 0 && !gbSgbMode) // regular GB has no L button
2243 /// pCmdUI->Enable(false); // FIXME: this is right, but disabling menu items screws up accelerators until you view the
2244 // menu!
2245 break;
2246 case ID_STICKY_R:
2247 check = (theApp.autoHold & BUTTON_MASK_R) != 0;
2248 /// extern int gbSgbMode; // from gbSGB.cpp
2249 /// if(emulating && systemCartridgeType != 0 && !gbSgbMode) // regular GB has no R button
2250 /// pCmdUI->Enable(false); // FIXME: this is right, but disabling menu items screws up accelerators until you view the
2251 // menu!
2252 break;
2253 case ID_STICKY_START:
2254 check = (theApp.autoHold & BUTTON_MASK_START) != 0;
2255 break;
2256 case ID_STICKY_SELECT:
2257 check = (theApp.autoHold & BUTTON_MASK_SELECT) != 0;
2258 break;
2259 case ID_STICKY_UP:
2260 check = (theApp.autoHold & BUTTON_MASK_UP) != 0;
2261 break;
2262 case ID_STICKY_DOWN:
2263 check = (theApp.autoHold & BUTTON_MASK_DOWN) != 0;
2264 break;
2265 case ID_STICKY_LEFT:
2266 check = (theApp.autoHold & BUTTON_MASK_LEFT) != 0;
2267 break;
2268 case ID_STICKY_RIGHT:
2269 check = (theApp.autoHold & BUTTON_MASK_RIGHT) != 0;
2270 break;
2271 case ID_STICKY_CLEAR:
2272 check = (theApp.autoHold == 0);
2273 /// pCmdUI->Enable(!check); // FIXME: this is right, but disabling menu items screws up accelerators until you view the menu!
2274 break;
2276 pCmdUI->SetCheck(check);
2279 LRESULT MainWnd::OnConfirmMode(WPARAM, LPARAM)
2281 // we need to do this separately or the window will not have the right
2282 // parent. must be related to the way MFC does modal dialogs
2283 winConfirmMode();
2284 return 0;
2287 void MainWnd::OnOptionsVideoFullscreenmaxscale()
2289 MaxScale dlg;
2291 theApp.winCheckFullscreen();
2293 dlg.DoModal();
2296 void MainWnd::OnOptionsVideoTextdisplayoptions()
2298 TextOptions dlg;
2300 theApp.winCheckFullscreen();
2302 dlg.DoModal();
2305 void MainWnd::OnUpdateOptionsVideoTextdisplayoptions(CCmdUI *pCmdUI)
2307 pCmdUI->Enable(TRUE);