forked from redcode/SpecEmu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainOptions.asm
1358 lines (1092 loc) · 68.5 KB
/
MainOptions.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
; defines for CAPS+SYMBOL SHIFT mappings on keyboard
KEY_SHIFTCTRL equ 0 ; value for [KeyShiftMode] when using Shift and Ctrl keys
KEY_SHIFTSHIFT equ 1 ; value for [KeyShiftMode] when using both Shift keys
HandleOptionsDialog PROTO
DisplayDialogProc PROTO :DWORD, :DWORD, :DWORD, :DWORD
SoundDialogProc PROTO :DWORD, :DWORD, :DWORD, :DWORD
HardwareDialogProc PROTO :DWORD, :DWORD, :DWORD, :DWORD
Plus3DialogProc PROTO :DWORD, :DWORD, :DWORD, :DWORD
AssociationsDialogProc PROTO :DWORD, :DWORD, :DWORD, :DWORD
InputDevicesDialogProc PROTO :DWORD, :DWORD, :DWORD, :DWORD
TapeDialogProc PROTO :DWORD, :DWORD, :DWORD, :DWORD
SoftRomDialogProc PROTO :DWORD, :DWORD, :DWORD, :DWORD
HardDiskDialogProc PROTO :DWORD, :DWORD, :DWORD, :DWORD
SetFileAssociations PROTO
CreateFileAssociation PROTO :DWORD, :DWORD, :DWORD
CreateNewKey PROTO :DWORD
SetKeyValue PROTO :DWORD, :DWORD, :DWORD
SetHardwareStatus PROTO :DWORD
GetUserConfig PROTO
SetUserConfig PROTO
; Start of "Options" PropertySheet handler
.data?
align 4
OptionsPropertySheetHeader PROPSHEETHEADER <?>
OptionsPropSheetPage PROPSHEETPAGE <?>
.code
SetUserConfig proc uses esi edi
lea esi, OPTIONVARS
lea edi, UserConfig
mov ecx, SIZEUSERCONFIG
rep movsb
ret
SetUserConfig endp
GetUserConfig proc uses esi edi
lea esi, UserConfig
lea edi, OPTIONVARS
mov ecx, SIZEUSERCONFIG
rep movsb
ret
GetUserConfig endp
.data?
;variables set by commandline switches - not to be set/reset by userconfig settings
align 16
SnowCrash_Enabled BYTE ? ; set by "-snowcrash" commandline arg
CBI95_NMI_enabled BYTE ? ; set by "-cbi95nmi" commandline arg; CBI-95 magic button overrides the Multiface NMI
sna_is_128k_enabled BYTE ? ; set by "-sna128" commandline arg; 128K SNA files are loaded in 128K mode rather than Pentagon mode
save_z80_as_v1_enabled BYTE ? ; set by "-z80v1" commandline arg
.data?
;option variables
; ======================================================================
; These UserConfig options are saved/restored by Get/SetUserConfig functions as set by the user.
; Snapshots may override these to support the snapshot state but they will be restored
; back to the user's settings upon Reset, etc.
align 16
OPTIONVARS LABEL BYTE
HardwareMode BYTE ?
MultifaceEnabled BYTE ?
SoftRomEnabled BYTE ?
DivIDEEnabled BYTE ?
MicroSourceEnabled BYTE ?
PLUSD_Enabled BYTE ?
CBI_Enabled BYTE ?
uSpeech_Enabled BYTE ?
SpecDrum_Enabled BYTE ?
Covox_Enabled BYTE ?
ULAplus_Enabled BYTE ?
LateTimings BYTE ? ; effects the display renderer due to slightly different uOp breakdown
ENDUSERCONFIG LABEL BYTE
SIZEUSERCONFIG equ ENDUSERCONFIG-OPTIONVARS
; ======================================================================
PreloadPlusDImage BYTE ?
FrameSkipCounter BYTE ?
DirectDraw_Acceleration BYTE ?
ShowScanlines BYTE ?
RoundEdges BYTE ?
VSync_Enabled BYTE ? ; TRUE = Wait for VSync
Dodgy_TV_Enabled BYTE ?
Extremely_Dodgy_TV_Enabled BYTE ?
Display_Border_Icons BYTE ?
Snow_Enabled BYTE ?
ULA_Artifacts_Enabled BYTE ?
RoundedCorners_Enabled BYTE ?
UseMMX BYTE ? ; TRUE = Use MMX opcodes
StartFullscreen BYTE ? ; TRUE = start in Fullscreen mode
FlashLoadROMBlocks BYTE ? ; TRUE = Flashload all ROM block data
FastTapeLoading BYTE ? ; TRUE = fast tape loading enabled
AutoloadTapes BYTE ? ; TRUE = autoload tapes
AutoPlayTapes BYTE ? ; TRUE = auto start/stop tapes
BoostLoadingNoise BYTE ? ; TRUE = boost loading noise volume for direct-to-tape transfers
BoostSavingNoise BYTE ? ; TRUE = boost saving noise volume for direct-to-tape transfers
StereoOutputMode BYTE ?
HighQualityAY BYTE ?
AY_in_48_mode BYTE ?
Plus3FastDiskLoading BYTE ? ; TRUE = fast +3 disk loading
TrdosFastDiskLoading BYTE ? ; TRUE = fast TRDOS disk loading
AddOnFastDiskLoading BYTE ? ; TRUE = fast disk loading for all external disk drive systems
AutoloadPlus3DSK BYTE ? ; TRUE = autoload +3 disks
AutoloadTrdosDSK BYTE ? ; TRUE = autoload TRDOS disks
CreateRndData BYTE ? ; TRUE = generate random sector data for protected disks
KeyShiftMode BYTE ? ; 0=Shift/Ctrl, 1=Left Shift/Right Shift
Issue3Keyboard BYTE ? ; TRUE = emulate issue 3 keyboard behaviour
Associate_SZX BYTE ?
Associate_SNA BYTE ?
Associate_Z80 BYTE ?
Associate_SP BYTE ?
Associate_SNX BYTE ?
Associate_TAP BYTE ?
Associate_TZX BYTE ?
Associate_CSW BYTE ?
Associate_PZX BYTE ?
Associate_DSK BYTE ?
Associate_TRD BYTE ?
Associate_SCL BYTE ?
Associate_RZX BYTE ?
ConfirmExit BYTE ?
RZX_Pause_On_Rollback BYTE ?
RZX_Display_End_Play_Dlg BYTE ?
Pause_On_Lost_Focus BYTE ?
OPTIONVARSEND LABEL BYTE
OPTIONVARSSIZE equ OPTIONVARSEND-OPTIONVARS ;sizeof OPTIONVARS area
DSoundRestart BYTE ? ; TRUE if DirectSound buffers need restarting
NewHDFSelected BYTE ? ; TRUE if any new HDF file has been selected
UserConfig db SIZEUSERCONFIG dup (?)
.data
align 4
PropSheetStartPage dd 0 ; start page for the PropertySheet options dialogs
OverridePokedPage db FALSE ; TRUE allows user to select RAM bank for the Poke memory dialog
PokeCurrentPage db 0 ; current selection in Poke dialog
AssociationsChanged db FALSE ; TRUE if any file associations were changed in options
szHDFFilter db "Hard Disk files (*.hdf)", 0, "*.hdf", 0, 0
szAllFilter db "All files (*.*)", 0, "*.*", 0, 0
NewHardDisk_txt db "You have changed the hard disk attachments to this machine.",13,10
db "A hard reset is required for correct hard disk detection.",13,10,13,10
db "Would you like to reset this machine now?",0
BypassConfirmExit db FALSE
.code
ADDPROPSHEETPAGE MACRO @@DlgID:REQ, @@DlgProc:REQ
mov [OptionsPropSheetPage.pszTemplate], @@DlgID
mov [OptionsPropSheetPage.pfnDlgProc], offset @@DlgProc
mov [OptionsPropSheetPage.lParam], NULL
invoke CreatePropertySheetPage, addr OptionsPropSheetPage
mov [PropertyPagePtrs+(NUMPROPPAGES*4)], eax
&@@DlgProc&_Page = NUMPROPPAGES
NUMPROPPAGES = NUMPROPPAGES + 1
ENDM
HandleOptionsDialog proc uses ebx esi edi
local OldHardwareMode: BYTE,
OldDivIDEEnabled: BYTE,
OldCBIEnabled: BYTE,
OlduSpeech_Enabled: BYTE,
OldDirectDraw_Acceleration: BYTE
local TempOptionVars[OPTIONVARSSIZE]: BYTE
CLEARSOUNDBUFFERS
; make a copy of each option variable
lea esi, OPTIONVARS
lea edi, TempOptionVars
mov ecx, OPTIONVARSSIZE
rep movsb
; FIXME: can cause machine change when only some other unrelated setting was changed
; invoke GetUserConfig
memclr addr OptionsPropertySheetHeader, sizeof PROPSHEETHEADER
memclr addr OptionsPropSheetPage, sizeof PROPSHEETPAGE
; these copies are for checking if certain settings were changed if user hits Okay for changes
mov al, HardwareMode
mov OldHardwareMode, al ; preserve hardware mode setting
mov al, DivIDEEnabled
mov OldDivIDEEnabled, al ; preserve DivIDE setting
mov al, CBI_Enabled
mov OldCBIEnabled, al ; preserve CBI setting
mov al, uSpeech_Enabled
mov OlduSpeech_Enabled, al ; preserve uSpeech setting
mov al, DirectDraw_Acceleration
mov OldDirectDraw_Acceleration, al ; preserve DirectDraw Acceleration setting
mov DSoundRestart, FALSE
mov NewHDFSelected, FALSE
; setup the common default values for the PROPSHEETPAGE structure
mov [OptionsPropSheetPage.dwSize], sizeof PROPSHEETPAGE
m2m [OptionsPropSheetPage.hInstance], GlobalhInst
; now setup each PROPSHEETPAGE structure
NUMPROPPAGES = 0
ADDPROPSHEETPAGE IDD_DISPLAY, DisplayDialogProc
ADDPROPSHEETPAGE IDD_SOUND, SoundDialogProc
ADDPROPSHEETPAGE IDD_HARDWARE, HardwareDialogProc
ADDPROPSHEETPAGE IDD_INPUTDEVICES, InputDevicesDialogProc
ADDPROPSHEETPAGE IDD_TAPE, TapeDialogProc
ADDPROPSHEETPAGE IDD_PLUS3OPTIONS, Plus3DialogProc
ADDPROPSHEETPAGE IDD_HARDDISKOPTIONS, HardDiskDialogProc
ADDPROPSHEETPAGE IDD_ASSOCIATIONS, AssociationsDialogProc
; now setup the PROPSHEETHEADER structure
mov [OptionsPropertySheetHeader.dwSize], sizeof PROPSHEETHEADER
mov [OptionsPropertySheetHeader.dwFlags], PSH_NOAPPLYNOW
mov eax, hWnd
mov [OptionsPropertySheetHeader.hwndParent], eax
mov eax, GlobalhInst
mov [OptionsPropertySheetHeader.hInstance], eax
mov [OptionsPropertySheetHeader.pszCaption], CTXT ("SpecEmu Options")
mov [OptionsPropertySheetHeader.nPages], NUMPROPPAGES ; number of property sheet pages
mov eax, PropSheetStartPage
mov [OptionsPropertySheetHeader.nStartPage], eax
mov [OptionsPropertySheetHeader.phpage], offset PropertyPagePtrs
mov [OptionsPropertySheetHeader.pfnCallback], NULL
mov [AssociationsChanged], FALSE
invoke PropertySheet, addr OptionsPropertySheetHeader
.if eax == TRUE
; OK selected
invoke SetUserConfig ; store user's new machine config before resetting
.if AssociationsChanged == TRUE
invoke SetFileAssociations
.endif
mov al, OldHardwareMode
.if al != HardwareMode
mov HardReset, TRUE
call ResetSpectrum ; reset Spectrum if new model selected
.endif
mov al, OldDivIDEEnabled
.if al != DivIDEEnabled
mov HardReset, TRUE
call ResetSpectrum ; reset Spectrum if toggling DivIDE emulation
.endif
mov al, OldCBIEnabled
.if al != CBI_Enabled
mov HardReset, TRUE
call ResetSpectrum ; reset Spectrum if toggling CBI disk emulation
.endif
mov al, OlduSpeech_Enabled
.if al != uSpeech_Enabled
mov HardReset, TRUE
call ResetSpectrum ; reset Spectrum if toggling uSpeech emulation
.endif
mov al, OldDirectDraw_Acceleration
.if al != DirectDraw_Acceleration
mov SwitchingModes, TRUE
invoke FreeSurfaces
invoke ShutdownDirectDraw
invoke InitDirectDraw
invoke InitSurfaces, hWnd
mov SwitchingModes, FALSE
.endif
.if NewHDFSelected == TRUE
invoke ShowMessageBox, hWnd, addr NewHardDisk_txt, SADD ("Change in Hard Disk Configuration"), MB_YESNO or MB_ICONQUESTION or MB_DEFBUTTON1
.if eax == IDYES
mov HardReset, TRUE
call ResetSpectrum ; reset Spectrum to detect the new hard disk file(s)
.endif
.endif
invoke EnableMultifaceOrSoftRom
IFDEF WANTSOUND
.if DSoundRestart == TRUE
; ; re-initialise audio if sound options changed or video update rate changed
call ReinitAudio
.endif
ENDIF
.else
; CANCEL selected - restore all original options
lea esi, TempOptionVars
lea edi, OPTIONVARS
mov ecx, OPTIONVARSSIZE
rep movsb
.endif
ret
HandleOptionsDialog endp
.data?
align 4
PropertyPagePtrs dd NUMPROPPAGES dup(?)
.code
;########################################################################
DisplayDialogProc proc uses ebx esi edi,
hWndDlg: DWORD,
uMsg: DWORD,
wParam: DWORD,
lParam: DWORD
.if uMsg == WM_INITDIALOG
mov PropSheetStartPage, DisplayDialogProc_Page
invoke CheckDlgButton, hWndDlg, IDC_USE_DIRECTDRAW_ACCELERATION, ZeroExt (DirectDraw_Acceleration)
invoke CheckDlgButton, hWndDlg, IDC_SHOWSCANLINES, ZeroExt (ShowScanlines)
invoke CheckDlgButton, hWndDlg, IDC_ENABLESNOWEFFECT, ZeroExt (Snow_Enabled)
invoke CheckDlgButton, hWndDlg, IDC_ENABLE_ULA_ARTIFACTS, ZeroExt (ULA_Artifacts_Enabled)
invoke CheckDlgButton, hWndDlg, IDC_ENABLEVSYNC, ZeroExt (VSync_Enabled)
invoke CheckDlgButton, hWndDlg, IDC_ENABLE_DODGY_TV, ZeroExt (Dodgy_TV_Enabled)
invoke CheckDlgButton, hWndDlg, IDC_ENABLE_EXTREMELY_DODGY_TV, ZeroExt (Extremely_Dodgy_TV_Enabled)
invoke CheckDlgButton, hWndDlg, IDC_DISPLAY_BORDER_ICONS, ZeroExt (Display_Border_Icons)
invoke CheckDlgButton, hWndDlg, IDC_ROUNDED_CORNERS, ZeroExt (RoundedCorners_Enabled)
invoke CheckDlgButton, hWndDlg, IDC_ENABLEULAPLUS, ZeroExt (ULAplus_Enabled)
dsText VideoUpdateComboItems, "Display all frames", 0, \
"Display 1 in 2 frames", 0, \
"Display 1 in 4 frames", 0, 0
invoke AddComboStrings, $fnc (GetDlgItem, hWndDlg, IDC_VIDEOUPDATERATE), addr VideoUpdateComboItems
.if FrameSkipCounter == 1
xor edx, edx
.elseif FrameSkipCounter == 2
mov edx, 1
.else
mov edx, 2
.endif
invoke SendDlgItemMessage, hWndDlg, IDC_VIDEOUPDATERATE, CB_SETCURSEL, edx, 0
return TRUE
.elseif uMsg == WM_COMMAND
.if $HighWord (wParam) == BN_CLICKED
.if $LowWord (wParam) == IDC_USE_DIRECTDRAW_ACCELERATION
xor DirectDraw_Acceleration, TRUE
.elseif $LowWord (wParam) == IDC_SHOWSCANLINES
xor ShowScanlines, TRUE
.elseif $LowWord (wParam) == IDC_ENABLESNOWEFFECT
xor Snow_Enabled, TRUE
invoke SetSnowEffect
.elseif $LowWord (wParam) == IDC_ENABLEULAPLUS
xor ULAplus_Enabled, TRUE
invoke SetULAplusState
.elseif $LowWord (wParam) == IDC_ENABLE_ULA_ARTIFACTS
xor ULA_Artifacts_Enabled, TRUE
invoke SetDirtyLines
.elseif $LowWord (wParam) == IDC_ENABLEVSYNC
xor VSync_Enabled, TRUE
.elseif $LowWord (wParam) == IDC_ENABLE_DODGY_TV
xor Dodgy_TV_Enabled, TRUE
mov SPGfx.TVNoiseCounter, 0
.elseif $LowWord (wParam) == IDC_ENABLE_EXTREMELY_DODGY_TV
xor Extremely_Dodgy_TV_Enabled, TRUE
mov SPGfx.TVNoiseCounter, 0
.elseif $LowWord (wParam) == IDC_DISPLAY_BORDER_ICONS
xor Display_Border_Icons, TRUE
.elseif $LowWord (wParam) == IDC_ROUNDED_CORNERS
xor RoundedCorners_Enabled, TRUE
.endif
.elseif $HighWord (wParam) == CBN_SELCHANGE
.if $LowWord (wParam) == IDC_VIDEOUPDATERATE
invoke SendDlgItemMessage, hWndDlg, IDC_VIDEOUPDATERATE, CB_GETCURSEL, 0, 0
and eax, 3
mov cl, al
mov al, 1
shl al, cl ; = 1, 2, 4
mov FrameSkipCounter, al
; DSound buffers need restarting for a new update rate
mov DSoundRestart, TRUE
.endif
.endif
.endif
return FALSE
DisplayDialogProc endp
;########################################################################
SoundDialogProc proc uses ebx esi edi,
hWndDlg: DWORD,
uMsg: DWORD,
wParam: DWORD,
lParam: DWORD
local hwnduSPEECHFREQTRB
dsText AudioModeStrs, "Mono", 0, \
"Stereo ABC", 0, \
"Stereo ACB", 0, \
"Simulated +3 audio distortion", 0, 0
.if uMsg == WM_INITDIALOG
mov PropSheetStartPage, SoundDialogProc_Page
mov ebx, $fnc (GetDlgItem, hWndDlg, IDC_AUDIOMODE)
invoke AddComboStrings, ebx, addr AudioModeStrs
invoke SendMessage, ebx, CB_SETCURSEL, ZeroExt (StereoOutputMode), 0
invoke CheckDlgButton, hWndDlg, IDC_HIGHQUALITYAY, ZeroExt (HighQualityAY)
invoke CheckDlgButton, hWndDlg, IDC_AY_IN_48_MODE, ZeroExt (AY_in_48_mode)
invoke CheckDlgButton, hWndDlg, IDC_COVOX, ZeroExt (Covox_Enabled)
movzx edx, Sound_Effect
add edx, IDC_SOUND_NONE
invoke CheckRadioButton, hWndDlg, IDC_SOUND_NONE, IDC_SOUND_REVERB, edx
mov hwnduSPEECHFREQTRB, $fnc (GetDlgItem, hWndDlg, IDC_uSPEECHFREQTRB)
invoke SendMessage, hwnduSPEECHFREQTRB, TBM_SETRANGE, TRUE, MAKELPARAM (0, 4)
mov esi, $fnc (uSpeech_GetFrequency)
invoke SendMessage, hwnduSPEECHFREQTRB, TBM_SETPOS, TRUE, esi
invoke SetDlgItemText, hWndDlg, IDC_uSPEECHFREQSTC, [uSpeech_FreqTextPtrs+esi*4]
return TRUE
.elseif uMsg == WM_COMMAND
.if $HighWord (wParam) == CBN_SELCHANGE
.if $LowWord (wParam) == IDC_AUDIOMODE ; Stereo mode ctrl
invoke SendDlgItemMessage, hWndDlg, IDC_AUDIOMODE, CB_GETCURSEL, 0, 0
mov StereoOutputMode, al
mov DSoundRestart, TRUE
.endif
.elseif $HighWord (wParam) == BN_CLICKED
.if $LowWord (wParam) == IDC_HIGHQUALITYAY
xor HighQualityAY, TRUE
.elseif $LowWord (wParam) == IDC_AY_IN_48_MODE
xor AY_in_48_mode, TRUE
invoke Set_Emulate_AY
.elseif $LowWord (wParam) == IDC_SOUND_NONE
mov Sound_Effect, EFFECT_NONE
.elseif $LowWord (wParam) == IDC_SOUND_ECHO
mov Sound_Effect, EFFECT_ECHO
.elseif $LowWord (wParam) == IDC_SOUND_REVERB
mov Sound_Effect, EFFECT_REVERB
.elseif $LowWord (wParam) == IDC_COVOX
xor Covox_Enabled, TRUE
.endif
.endif
.elseif uMsg == WM_HSCROLL
mov hwnduSPEECHFREQTRB, $fnc (GetDlgItem, hWndDlg, IDC_uSPEECHFREQTRB)
switch lParam
case hwnduSPEECHFREQTRB
invoke SendMessage, hwnduSPEECHFREQTRB, TBM_GETPOS, 0, 0
mov esi, eax
invoke uSpeech_SetFrequency, esi
invoke SetDlgItemText, hWndDlg, IDC_uSPEECHFREQSTC, [uSpeech_FreqTextPtrs+esi*4]
endsw
.endif
return FALSE
SoundDialogProc endp
;########################################################################
.data
PD_PRELOAD_NOTHING equ 0
PD_PRELOAD_GDOS equ 1
PD_PRELOAD_BETADOS equ 2
PreloadPlusDComboItems db "No system image", 0
db "G+DOS system", 0
db "Beta DOS system", 0
db 0
.code
HardwareDialogProc proc uses ebx esi edi,
hWndDlg: DWORD,
uMsg: DWORD,
wParam: DWORD,
lParam: DWORD
local ofn: OPENFILENAME
.if uMsg == WM_INITDIALOG
mov PropSheetStartPage, HardwareDialogProc_Page
mov al, HardwareMode
push eax
mov HardwareMode, HW_FIRSTMACHINE
.while HardwareMode <= HW_LASTMACHINE
GETMODELNAME eax
invoke SendDlgItemMessage, hWndDlg, IDC_HARDWAREMODEL, CB_ADDSTRING, 0, eax
inc HardwareMode
.endw
pop eax
mov HardwareMode, al
invoke AddComboStrings, $fnc (GetDlgItem, hWndDlg, IDC_PRELOADPLUSDCB), addr PreloadPlusDComboItems
invoke SendDlgItemMessage, hWndDlg, IDC_PRELOADPLUSDCB, CB_SETCURSEL, ZeroExt (PreloadPlusDImage), 0
invoke SetHardwareStatus, hWndDlg
return TRUE
.elseif uMsg == WM_COMMAND
.if $HighWord (wParam) == CBN_SELCHANGE
.if $LowWord (wParam) == IDC_HARDWAREMODEL
invoke SendDlgItemMessage, hWndDlg, IDC_HARDWAREMODEL, CB_GETCURSEL, 0, 0
mov HardwareMode, al
invoke SetHardwareStatus, hWndDlg
.elseif $LowWord (wParam) == IDC_PRELOADPLUSDCB
invoke SendDlgItemMessage, hWndDlg, IDC_PRELOADPLUSDCB, CB_GETCURSEL, 0, 0
mov PreloadPlusDImage, al
.endif
.elseif $HighWord (wParam) == BN_CLICKED
.if $LowWord (wParam) == IDC_LATETIMINGS
xor LateTimings, TRUE
.elseif $LowWord (wParam) == IDC_ENABLEDIVIDE
xor DivIDEEnabled, TRUE
.if DivIDEEnabled == TRUE
mov SoftRomEnabled, FALSE
mov PLUSD_Enabled, FALSE
mov CBI_Enabled, FALSE
mov MicroSourceEnabled, FALSE
mov uSpeech_Enabled, FALSE
invoke SetHardwareStatus, hWndDlg
.endif
.elseif $LowWord (wParam) == IDC_ENABLEPLUSD
xor PLUSD_Enabled, TRUE
.if PLUSD_Enabled == TRUE
mov DivIDEEnabled, FALSE
mov CBI_Enabled, FALSE
mov SoftRomEnabled, FALSE
mov MicroSourceEnabled, FALSE
mov uSpeech_Enabled, FALSE
invoke SetHardwareStatus, hWndDlg
.endif
.elseif $LowWord (wParam) == IDC_ENABLE_CBI_DISK
xor CBI_Enabled, TRUE
.if CBI_Enabled == TRUE
mov DivIDEEnabled, FALSE
mov PLUSD_Enabled, FALSE
mov SoftRomEnabled, FALSE
mov MicroSourceEnabled, FALSE
mov uSpeech_Enabled, FALSE
invoke SetHardwareStatus, hWndDlg
.endif
.elseif $LowWord (wParam) == IDC_ENABLESOFTROM
xor SoftRomEnabled, TRUE
.if SoftRomEnabled == TRUE
mov DivIDEEnabled, FALSE
mov PLUSD_Enabled, FALSE
mov CBI_Enabled, FALSE
mov MicroSourceEnabled, FALSE
mov uSpeech_Enabled, FALSE
invoke SetHardwareStatus, hWndDlg
.endif
.elseif $LowWord (wParam) == IDC_ENABLEMICROSOURCE
xor MicroSourceEnabled, TRUE
.if MicroSourceEnabled == TRUE
mov DivIDEEnabled, FALSE
mov PLUSD_Enabled, FALSE
mov CBI_Enabled, FALSE
mov SoftRomEnabled, FALSE
invoke SetHardwareStatus, hWndDlg
.endif
.elseif $LowWord (wParam) == IDC_ENABLEMICROSPEECH
xor uSpeech_Enabled, TRUE
.if uSpeech_Enabled == TRUE
mov DivIDEEnabled, FALSE
mov PLUSD_Enabled, FALSE
mov CBI_Enabled, FALSE
mov SoftRomEnabled, FALSE
invoke SetHardwareStatus, hWndDlg
.endif
.elseif $LowWord (wParam) == IDC_ENABLESPECDRUM
xor SpecDrum_Enabled, TRUE
.if SpecDrum_Enabled == TRUE
; mov DivIDEEnabled, FALSE
; mov PLUSD_Enabled, FALSE
; mov SoftRomEnabled, FALSE
invoke SetHardwareStatus, hWndDlg
.endif
.elseif $LowWord (wParam) == IDC_BROWSEDIVIDEFIRMWARE
invoke GetFileName, hWndDlg, SADD ("Select DivIDE Firmware"), offset szAllFilter, addr ofn, addr DivIDEFirmwareFilename, addr NullExt
.if eax != 0
invoke SendDlgItemMessage, hWndDlg, IDC_DIVIDEFIRMWAREEDIT, WM_SETTEXT, 0, addr DivIDEFirmwareFilename
invoke DivIDE_LoadFirmware
.endif
.endif
.endif
.endif
return FALSE
HardwareDialogProc endp
NO_DIVIDE macro
invoke EnableControl, hWndDlg, IDC_ENABLEDIVIDE, FALSE
endm
NO_PLUS_D macro
invoke EnableControl, hWndDlg, IDC_ENABLEPLUSD, FALSE
endm
NO_SOFTROM macro
invoke EnableControl, hWndDlg, IDC_ENABLESOFTROM, FALSE
endm
NO_USPEECH macro
invoke EnableControl, hWndDlg, IDC_ENABLEMICROSPEECH, FALSE
endm
NO_MICROSOURCE macro
invoke EnableControl, hWndDlg, IDC_ENABLEMICROSOURCE, FALSE
endm
NO_SPECDRUM macro
invoke EnableControl, hWndDlg, IDC_ENABLESPECDRUM, FALSE
endm
NO_CBI macro
invoke EnableControl, hWndDlg, IDC_ENABLE_CBI_DISK, FALSE
endm
NO_EARLY_LATE macro
invoke EnableControl, hWndDlg, IDC_LATETIMINGS, FALSE
endm
SetHardwareStatus proc uses ebx,
hWndDlg: DWORD
mov ebx, TRUE
invoke EnableControl, hWndDlg, IDC_ENABLEDIVIDE, ebx
invoke EnableControl, hWndDlg, IDC_ENABLEPLUSD, ebx
invoke EnableControl, hWndDlg, IDC_ENABLESOFTROM, ebx
invoke EnableControl, hWndDlg, IDC_ENABLEMICROSPEECH, ebx
invoke EnableControl, hWndDlg, IDC_ENABLEMICROSOURCE, ebx
invoke EnableControl, hWndDlg, IDC_ENABLESPECDRUM, ebx
invoke EnableControl, hWndDlg, IDC_ENABLE_CBI_DISK, ebx
invoke EnableControl, hWndDlg, IDC_LATETIMINGS, ebx
call Set_Machine_Config ; in Machines.asm; enables/disables add-on hardware based on model type
switch ZeroExt (HardwareMode)
case HW_16
case HW_48
case HW_128
NO_USPEECH
NO_MICROSOURCE
NO_SPECDRUM
NO_CBI
case HW_PLUS2
NO_USPEECH
NO_MICROSOURCE
NO_SPECDRUM
NO_CBI
case HW_PLUS2A, HW_PLUS3
NO_PLUS_D
NO_SOFTROM
NO_USPEECH
NO_MICROSOURCE
NO_SPECDRUM
NO_CBI
NO_EARLY_LATE
case HW_PENTAGON128
NO_DIVIDE
NO_PLUS_D
NO_SOFTROM
NO_USPEECH
NO_MICROSOURCE
NO_SPECDRUM
NO_CBI
case HW_TC2048
case HW_TK90X
endsw
invoke SendDlgItemMessage, hWndDlg, IDC_HARDWAREMODEL, CB_SETCURSEL, ZeroExt (HardwareMode), 0
invoke CheckDlgButton, hWndDlg, IDC_LATETIMINGS, ZeroExt (LateTimings)
invoke CheckDlgButton, hWndDlg, IDC_ENABLESOFTROM, ZeroExt (SoftRomEnabled)
invoke CheckDlgButton, hWndDlg, IDC_ENABLEDIVIDE, ZeroExt (DivIDEEnabled)
invoke CheckDlgButton, hWndDlg, IDC_ENABLE_CBI_DISK, ZeroExt (CBI_Enabled)
invoke CheckDlgButton, hWndDlg, IDC_ENABLEPLUSD, ZeroExt (PLUSD_Enabled)
invoke CheckDlgButton, hWndDlg, IDC_ENABLEMICROSOURCE, ZeroExt (MicroSourceEnabled)
invoke CheckDlgButton, hWndDlg, IDC_ENABLEMICROSPEECH, ZeroExt (uSpeech_Enabled)
invoke CheckDlgButton, hWndDlg, IDC_ENABLESPECDRUM, ZeroExt (SpecDrum_Enabled)
invoke SendDlgItemMessage, hWndDlg, IDC_DIVIDEFIRMWAREEDIT, WM_SETTEXT, 0, addr DivIDEFirmwareFilename
ret
SetHardwareStatus endp
Plus3DialogProc proc uses ebx esi edi,
hWndDlg: DWORD,
uMsg: DWORD,
wParam: DWORD,
lParam: DWORD
switch uMsg
case WM_INITDIALOG
mov PropSheetStartPage, Plus3DialogProc_Page
invoke CheckDlgButton, hWndDlg, IDC_PLUS3FASTDISK, ZeroExt (Plus3FastDiskLoading)
invoke CheckDlgButton, hWndDlg, IDC_AUTOLOADPLUS3DSK, ZeroExt (AutoloadPlus3DSK)
invoke CheckDlgButton, hWndDlg, IDC_CREATERANDOMDATA, ZeroExt (CreateRndData)
invoke CheckDlgButton, hWndDlg, IDC_AUTOLOADPENTAGONDSK, ZeroExt (AutoloadTrdosDSK)
invoke CheckDlgButton, hWndDlg, IDC_PENTAGONFASTDISK, ZeroExt (TrdosFastDiskLoading)
invoke CheckDlgButton, hWndDlg, IDC_ADDONFASTDISK, ZeroExt (AddOnFastDiskLoading)
return TRUE
case WM_COMMAND
.if $HighWord (wParam) == BN_CLICKED
.if $LowWord (wParam) == IDC_PLUS3FASTDISK
xor Plus3FastDiskLoading, TRUE
.elseif $LowWord (wParam) == IDC_AUTOLOADPLUS3DSK
xor AutoloadPlus3DSK, TRUE
.elseif $LowWord (wParam) == IDC_CREATERANDOMDATA
xor CreateRndData, TRUE
setz al
neg al ; 0 for rnd, 255 for no rnd
invoke u765_SetRandomMethod, FDCHandle, al
.elseif $LowWord (wParam) == IDC_PENTAGONFASTDISK
xor TrdosFastDiskLoading, TRUE
.elseif $LowWord (wParam) == IDC_AUTOLOADPENTAGONDSK
xor AutoloadTrdosDSK, TRUE
.elseif $LowWord (wParam) == IDC_ADDONFASTDISK
xor AddOnFastDiskLoading, TRUE
.endif
.endif
endsw
return FALSE
Plus3DialogProc endp
AssociationsDialogProc proc uses ebx esi edi,
hWndDlg: DWORD,
uMsg: DWORD,
wParam: DWORD,
lParam: DWORD
.if uMsg == WM_INITDIALOG
mov PropSheetStartPage, AssociationsDialogProc_Page
mov ebx, [hWndDlg]
invoke CheckDlgButton, ebx, IDC_ASSOCIATE_SZX, ZeroExt (Associate_SZX)
invoke CheckDlgButton, ebx, IDC_ASSOCIATE_SNA, ZeroExt (Associate_SNA)
invoke CheckDlgButton, ebx, IDC_ASSOCIATE_Z80, ZeroExt (Associate_Z80)
invoke CheckDlgButton, ebx, IDC_ASSOCIATE_SP, ZeroExt (Associate_SP)
invoke CheckDlgButton, ebx, IDC_ASSOCIATE_SNX, ZeroExt (Associate_SNX)
invoke CheckDlgButton, ebx, IDC_ASSOCIATE_TAP, ZeroExt (Associate_TAP)
invoke CheckDlgButton, ebx, IDC_ASSOCIATE_TZX, ZeroExt (Associate_TZX)
invoke CheckDlgButton, ebx, IDC_ASSOCIATE_CSW, ZeroExt (Associate_CSW)
invoke CheckDlgButton, ebx, IDC_ASSOCIATE_PZX, ZeroExt (Associate_PZX)
invoke CheckDlgButton, ebx, IDC_ASSOCIATE_DSK, ZeroExt (Associate_DSK)
invoke CheckDlgButton, ebx, IDC_ASSOCIATE_TRD, ZeroExt (Associate_TRD)
invoke CheckDlgButton, ebx, IDC_ASSOCIATE_SCL, ZeroExt (Associate_SCL)
invoke CheckDlgButton, ebx, IDC_ASSOCIATE_RZX, ZeroExt (Associate_RZX)
invoke CheckDlgButton, ebx, IDC_RZX_PAUSE_ON_ROLLBACK, ZeroExt (RZX_Pause_On_Rollback)
invoke CheckDlgButton, ebx, IDC_RZX_END_PLAYBACK_DIALOG, ZeroExt (RZX_Display_End_Play_Dlg)
invoke CheckDlgButton, ebx, IDC_PAUSE_ON_LOST_FOCUS, ZeroExt (Pause_On_Lost_Focus)
invoke CheckDlgButton, ebx, IDC_CONFIRMEXIT, ZeroExt (ConfirmExit)
return TRUE
.elseif uMsg == WM_COMMAND
.if $HighWord (wParam) == BN_CLICKED
movzx eax, $LowWord (wParam)
switch eax
Case IDC_ASSOCIATE_SZX
xor [Associate_SZX], TRUE
mov [AssociationsChanged], TRUE
Case IDC_ASSOCIATE_SNA
xor [Associate_SNA], TRUE
mov [AssociationsChanged], TRUE
Case IDC_ASSOCIATE_Z80
xor [Associate_Z80], TRUE
mov [AssociationsChanged], TRUE
Case IDC_ASSOCIATE_SP
xor [Associate_SP], TRUE
mov [AssociationsChanged], TRUE
case IDC_ASSOCIATE_SNX
xor [Associate_SNX], TRUE
mov [AssociationsChanged], TRUE
Case IDC_ASSOCIATE_TAP
xor [Associate_TAP], TRUE
mov [AssociationsChanged], TRUE
Case IDC_ASSOCIATE_TZX
xor [Associate_TZX], TRUE
mov [AssociationsChanged], TRUE
Case IDC_ASSOCIATE_CSW
xor [Associate_CSW], TRUE
mov [AssociationsChanged], TRUE
Case IDC_ASSOCIATE_PZX
xor [Associate_PZX], TRUE
mov [AssociationsChanged], TRUE
Case IDC_ASSOCIATE_DSK
xor [Associate_DSK], TRUE
mov [AssociationsChanged], TRUE
Case IDC_ASSOCIATE_TRD
xor [Associate_TRD], TRUE
mov [AssociationsChanged], TRUE
Case IDC_ASSOCIATE_SCL
xor [Associate_SCL], TRUE
mov [AssociationsChanged], TRUE
case IDC_ASSOCIATE_RZX
xor [Associate_RZX], TRUE
mov [AssociationsChanged], TRUE
case IDC_RZX_PAUSE_ON_ROLLBACK
xor [RZX_Pause_On_Rollback], TRUE
case IDC_RZX_END_PLAYBACK_DIALOG
xor [RZX_Display_End_Play_Dlg], TRUE
case IDC_PAUSE_ON_LOST_FOCUS
xor [Pause_On_Lost_Focus], TRUE
case IDC_CONFIRMEXIT
xor [ConfirmExit], TRUE
Endsw
.endif
.endif
return FALSE
AssociationsDialogProc endp
InputDevicesDialogProc proc uses ebx esi edi,
hWndDlg: DWORD,
uMsg: DWORD,
wParam: DWORD,
lParam: DWORD
.if uMsg == WM_INITDIALOG
mov PropSheetStartPage, InputDevicesDialogProc_Page
.if Issue3Keyboard == FALSE
mov edx, IDC_ISSUE2KEYBOARD
.else
mov edx, IDC_ISSUE3KEYBOARD
.endif
invoke CheckRadioButton, hWndDlg, IDC_ISSUE2KEYBOARD, IDC_ISSUE3KEYBOARD, edx
invoke SendDlgItemMessage, hWndDlg, IDC_KEYSHIFTMODE, CB_ADDSTRING, 0, SADD("Use Shift and Ctrl keys")
invoke SendDlgItemMessage, hWndDlg, IDC_KEYSHIFTMODE, CB_ADDSTRING, 0, SADD("Use Shift keys only")
invoke SendDlgItemMessage, hWndDlg, IDC_KEYSHIFTMODE, CB_SETCURSEL, ZeroExt (KeyShiftMode), 0
invoke CheckDlgButton, hWndDlg, IDC_ISSUE3KEYBOARD, ZeroExt (Issue3Keyboard)
invoke AddComboStrings, $fnc (GetDlgItem, hWndDlg, IDC_CONTROLLER1TYPE), addr PreloadJoystickComboItems
invoke SendDlgItemMessage, hWndDlg, IDC_CONTROLLER1TYPE, CB_SETCURSEL, ZeroExt (Joystick1.JOYSTICKINFO.Joystick_Type), 0
invoke AddComboStrings, $fnc (GetDlgItem, hWndDlg, IDC_CONTROLLER2TYPE), addr PreloadJoystickComboItems
invoke SendDlgItemMessage, hWndDlg, IDC_CONTROLLER2TYPE, CB_SETCURSEL, ZeroExt (Joystick2.JOYSTICKINFO.Joystick_Type), 0
invoke AddComboStrings, $fnc (GetDlgItem, hWndDlg, IDC_CONTROLLER3TYPE), addr PreloadJoystickComboItems
invoke SendDlgItemMessage, hWndDlg, IDC_CONTROLLER3TYPE, CB_SETCURSEL, ZeroExt (Joystick3.JOYSTICKINFO.Joystick_Type), 0
invoke AddComboStrings, $fnc (GetDlgItem, hWndDlg, IDC_CONTROLLER4TYPE), addr PreloadJoystickComboItems
invoke SendDlgItemMessage, hWndDlg, IDC_CONTROLLER4TYPE, CB_SETCURSEL, ZeroExt (Joystick4.JOYSTICKINFO.Joystick_Type), 0
return TRUE
.elseif uMsg == WM_COMMAND
.if $HighWord (wParam) == CBN_SELCHANGE
.if $LowWord (wParam) == IDC_KEYSHIFTMODE
invoke SendDlgItemMessage, hWndDlg, IDC_KEYSHIFTMODE, CB_GETCURSEL, 0, 0
mov KeyShiftMode, al
.endif
.if $LowWord (wParam) == IDC_CONTROLLER1TYPE
invoke SendDlgItemMessage, hWndDlg, IDC_CONTROLLER1TYPE, CB_GETCURSEL, 0, 0
mov Joystick1.JOYSTICKINFO.Joystick_Type, al
.endif
.if $LowWord (wParam) == IDC_CONTROLLER2TYPE
invoke SendDlgItemMessage, hWndDlg, IDC_CONTROLLER2TYPE, CB_GETCURSEL, 0, 0
mov Joystick2.JOYSTICKINFO.Joystick_Type, al
.endif
.if $LowWord (wParam) == IDC_CONTROLLER3TYPE
invoke SendDlgItemMessage, hWndDlg, IDC_CONTROLLER3TYPE, CB_GETCURSEL, 0, 0
mov Joystick3.JOYSTICKINFO.Joystick_Type, al
.endif
.if $LowWord (wParam) == IDC_CONTROLLER4TYPE
invoke SendDlgItemMessage, hWndDlg, IDC_CONTROLLER4TYPE, CB_GETCURSEL, 0, 0
mov Joystick4.JOYSTICKINFO.Joystick_Type, al
.endif
.elseif $HighWord (wParam) == BN_CLICKED
.if $LowWord (wParam) == IDC_ISSUE2KEYBOARD
mov Issue3Keyboard, FALSE
.elseif $LowWord (wParam) == IDC_ISSUE3KEYBOARD
mov Issue3Keyboard, TRUE
.endif
.endif
.endif
return FALSE
InputDevicesDialogProc endp
TapeDialogProc proc uses ebx esi edi,
hWndDlg: DWORD,
uMsg: DWORD,
wParam: DWORD,
lParam: DWORD
.if uMsg == WM_INITDIALOG
mov PropSheetStartPage, TapeDialogProc_Page
mov ebx, hWndDlg
invoke CheckDlgButton, ebx, IDC_AUTOTAPESTARTSTOP, ZeroExt (AutoPlayTapes)
invoke CheckDlgButton, ebx, IDC_FLASHLOADROMBLOCKS, ZeroExt (FlashLoadROMBlocks)
invoke CheckDlgButton, ebx, IDC_EDGEDETECTION, ZeroExt (FastTapeLoading)
invoke CheckDlgButton, ebx, IDC_AUTOLOADTAPES, ZeroExt (AutoloadTapes)
invoke CheckDlgButton, ebx, IDC_BOOSTLOADINGNOISE, ZeroExt (BoostLoadingNoise)
invoke CheckDlgButton, ebx, IDC_BOOSTSAVINGNOISE, ZeroExt (BoostSavingNoise)
.if SaveTapeType == Type_NONE
invoke EnableControl, hWndDlg, IDC_BOOSTSAVINGNOISE, TRUE
.else
invoke EnableControl, hWndDlg, IDC_BOOSTSAVINGNOISE, FALSE
.endif
return TRUE
.elseif uMsg == WM_COMMAND
.if $HighWord (wParam) == BN_CLICKED
.if $LowWord (wParam) == IDC_FLASHLOADROMBLOCKS