66using BizHawk . Client . Common ;
77using BizHawk . Client . Common . Filters ;
88using BizHawk . Common ;
9+ using BizHawk . Common . NumberExtensions ;
10+ using BizHawk . Emulation . Common ;
11+ using BizHawk . WinForms . Controls ;
912
1013namespace BizHawk . Client . EmuHawk
1114{
@@ -21,6 +24,28 @@ public partial class DisplayConfig : Form, IDialogParent
2124
2225 private string _pathSelection ;
2326
27+ private readonly RadioButtonGroupTracker _snowRadioTracker ;
28+
29+ private readonly SzNUDEx nudSnowBias = new ( )
30+ {
31+ DecimalPlaces = 2 ,
32+ Increment = 0.25m ,
33+ Maximum = 2.0m ,
34+ Minimum = - 2.0m ,
35+ Size = new ( 48 , 23 ) ,
36+ } ;
37+
38+ private readonly SzNUDEx nudSnowIntensity = new ( )
39+ {
40+ DecimalPlaces = 1 ,
41+ Increment = 0.1m ,
42+ Maximum = 1.0m ,
43+ Minimum = 0.1m ,
44+ Size = new ( 48 , 23 ) ,
45+ } ;
46+
47+ private readonly TransparentTrackBar tbSnowFramerate = new ( ) { Maximum = 20 , Minimum = 1 , Size = new ( 160 , 45 ) } ;
48+
2449 public IDialogController DialogController { get ; }
2550
2651 public bool NeedReset { get ; set ; }
@@ -30,8 +55,61 @@ public DisplayConfig(Config config, IDialogController dialogController, IGL gl)
3055 _config = config ;
3156 _gl = gl ;
3257 DialogController = dialogController ;
58+ var snowSettings = _config . GetCoreSettings < NullEmulator , SnowyNullVideo . Settings > ( ) ?? new ( ) ;
3359
3460 InitializeComponent ( ) ;
61+ LocSzGroupBoxEx grpSnow = new ( ) { Location = new ( 6 , 200 ) , Size = new ( 371 , 160 ) , Text = "Snowy NullHawk" } ;
62+ _snowRadioTracker = grpSnow . Tracker ;
63+ RadioButtonEx rbSnowAlways = new ( _snowRadioTracker )
64+ {
65+ Checked = config . SnowyNullHawk is SnowyNullVideo . TriggerCriterion . Always ,
66+ Name = nameof ( rbSnowAlways ) ,
67+ Tag = SnowyNullVideo . TriggerCriterion . Always ,
68+ Text = "Always" ,
69+ } ;
70+ RadioButtonEx rbSnowForChristmas = new ( _snowRadioTracker )
71+ {
72+ Checked = config . SnowyNullHawk is SnowyNullVideo . TriggerCriterion . WeekOfChristmas ,
73+ Name = nameof ( rbSnowForChristmas ) ,
74+ Tag = SnowyNullVideo . TriggerCriterion . WeekOfChristmas ,
75+ Text = "During Christmas (Dec. 20th through 26th)" ,
76+ } ;
77+ RadioButtonEx rbSnowNever = new ( _snowRadioTracker )
78+ {
79+ Checked = config . SnowyNullHawk is SnowyNullVideo . TriggerCriterion . Never ,
80+ Name = nameof ( rbSnowNever ) ,
81+ Tag = SnowyNullVideo . TriggerCriterion . Never ,
82+ Text = "Never" ,
83+ } ;
84+ LabelEx lblFramerate = new ( ) ;
85+ tbSnowFramerate . ValueChanged += ( changedSender , _ ) =>
86+ {
87+ var val = ( ( TrackBar ) changedSender ) . Value ;
88+ lblFramerate . Text = $ "Framerate: { 60.0 / val : F1} Hz";
89+ } ;
90+ tbSnowFramerate . Value = snowSettings . FramerateScalar ;
91+ nudSnowIntensity . Value = new ( snowSettings . Intensity ) ;
92+ nudSnowBias . Value = new ( snowSettings . Bias ) ;
93+ grpSnow . Controls . Add ( new LocSzSingleColumnFLP
94+ {
95+ Controls =
96+ {
97+ new LabelEx { Text = "When no rom loaded, draw \" snow\" (white noise):" } ,
98+ new SingleRowFLP { Controls = { rbSnowAlways , rbSnowNever } } ,
99+ rbSnowForChristmas ,
100+ new SingleRowFLP { Controls =
101+ {
102+ new LabelEx { Text = "Brightness multiplier:" } ,
103+ nudSnowIntensity ,
104+ new LabelEx { Text = "RNG bias:" } ,
105+ nudSnowBias ,
106+ } } ,
107+ new SingleRowFLP { Controls = { lblFramerate , tbSnowFramerate } } ,
108+ } ,
109+ Location = new ( 5 , 15 ) ,
110+ Size = new ( 320 , 144 ) ,
111+ } ) ;
112+ tpMisc . Controls . Add ( grpSnow ) ;
35113
36114 rbNone . Checked = _config . TargetDisplayFilter == 0 ;
37115 rbHq2x . Checked = _config . TargetDisplayFilter == 1 ;
@@ -170,6 +248,15 @@ private void BtnOk_Click(object sender, EventArgs e)
170248
171249 _config . UseStaticWindowTitles = cbStaticWindowTitles . Checked ;
172250
251+ _config . SnowyNullHawk = _snowRadioTracker . GetSelectionTagAs < SnowyNullVideo . TriggerCriterion > ( )
252+ ?? SnowyNullVideo . TriggerCriterion . WeekOfChristmas ;
253+ _config . PutCoreSettings (
254+ new SnowyNullVideo . Settings (
255+ Bias : nudSnowBias . Value . ConvertToF32 ( ) ,
256+ FramerateScalar : tbSnowFramerate . Value ,
257+ Intensity : nudSnowIntensity . Value . ConvertToF32 ( ) ) ,
258+ typeof ( NullEmulator ) ) ;
259+
173260 if ( rbUseRaw . Checked )
174261 _config . DispManagerAR = EDispManagerAR . None ;
175262 else if ( rbUseSystem . Checked )
0 commit comments