-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.cs
217 lines (211 loc) · 8.81 KB
/
MainWindow.cs
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
using System;
using System.Windows.Forms;
namespace UnifySensitivity {
internal partial class MainWindow : Form {
internal MainWindow() {
InitializeComponent();
NumBoxOWSense.MouseEnter += new EventHandler(NumBoxOWSense_MouseEnter);
NumBoxSourceSense.MouseEnter += new EventHandler(NumBoxSourceSense_MouseEnter);
NumBoxSourceYaw.MouseEnter += new EventHandler(NumBoxSourceYaw_MouseEnter);
NumBoxPubgSense.MouseEnter += new EventHandler(NumBoxPubgSense_MouseEnter);
NumBoxPubgConv.MouseEnter += new EventHandler(NumBoxPubgConv_MouseEnter);
NumBoxPubgFov.MouseEnter += new EventHandler(NumBoxPubgFov_MouseEnter);
NumBoxDPI.MouseEnter += new EventHandler(NumBoxDPI_MouseEnter);
NumBoxCmPer360.MouseEnter += new EventHandler(NumBoxCmPer360_MouseEnter);
NumBoxInPer360.MouseEnter += new EventHandler(NumBoxInPer360_MouseEnter);
NumBoxDePerCm.MouseEnter += new EventHandler(NumBoxDePerCm_MouseEnter);
NumBoxDePerIn.MouseEnter += new EventHandler(NumBoxDePerIn_MouseEnter);
}
/*
All controls are calculated from cm/360 so:
-> Calculate cm/360 from the _changed_ control
-> Check active control to prevent infinite loop
-> Update all other controls using the cm/360 value
m_yaw, mouse dpi, and pubg fov are essenitally constants only changed by the user
*/
private void UpdateAllNumBoxes(decimal cm) {
// Constant short hands
decimal dpi = NumBoxDPI.Value;
decimal yaw = NumBoxSourceYaw.Value;
decimal pfov = NumBoxPubgFov.Value;
try {
// Overwatch
if (NumBoxOWSense != ActiveControl) {
NumBoxOWSense.Value = Overwatch.SenseFromCm(cm, dpi);
}
// Source
if (NumBoxSourceSense != ActiveControl) {
NumBoxSourceSense.Value = Quake.SenseFromCm(cm, dpi, yaw);
}
// PUBG
if (NumBoxPubgSense != ActiveControl) {
NumBoxPubgSense.Value = PUBG.SenseFromCm(cm, dpi, pfov);
}
// PUBG (Converted)
if (NumBoxPubgConv != ActiveControl) {
NumBoxPubgConv.Value = PUBG.ConvFromCm(cm, dpi, pfov);
}
// Measurements
if (NumBoxCmPer360 != ActiveControl) {
NumBoxCmPer360.Value = cm;
}
if (NumBoxInPer360 != ActiveControl) {
NumBoxInPer360.Value = cm / 2.54M;
}
if (NumBoxDePerCm != ActiveControl) {
NumBoxDePerCm.Value = 360 / cm;
}
if (NumBoxDePerIn != ActiveControl) {
NumBoxDePerIn.Value = 914.4M / cm;
}
} catch (ArgumentOutOfRangeException) {
MessageBox.Show(
"Went out of range you pleblord.",
"WARNING",
MessageBoxButtons.OK,
MessageBoxIcon.Warning
);
}
}
// Box change events
// OVERWATCH
private void NumBoxOWSense_ValueChanged(object sender, EventArgs e) {
if (NumBoxOWSense != ActiveControl) {
return;
}
decimal cm = Overwatch.CmFromSense(
NumBoxOWSense.Value,
NumBoxDPI.Value
);
UpdateAllNumBoxes(cm);
}
// SOURCE/QUAKE ENGINE
private void NumBoxSourceSense_ValueChanged(object sender, EventArgs e) {
if (NumBoxSourceSense != ActiveControl) {
return;
}
decimal cm = Quake.CmFromSense(
NumBoxSourceSense.Value,
NumBoxDPI.Value,
NumBoxSourceYaw.Value
);
UpdateAllNumBoxes(cm);
}
private void NumBoxSourceYaw_ValueChanged(object sender, EventArgs e) {
if (NumBoxSourceYaw != ActiveControl) {
return;
}
decimal cm = Quake.CmFromSense(
NumBoxSourceSense.Value,
NumBoxDPI.Value,
NumBoxSourceYaw.Value
);
UpdateAllNumBoxes(cm);
}
// PUBG
private void NumBoxPubgSense_ValueChanged(object sender, EventArgs e) {
if (NumBoxPubgSense != ActiveControl) {
return;
}
decimal p = PUBG.CmFromSense(
NumBoxPubgSense.Value,
NumBoxDPI.Value,
NumBoxPubgFov.Value
);
UpdateAllNumBoxes(p);
}
private void NumBoxPubgConv_ValueChanged(object sender, EventArgs e) {
if (NumBoxPubgConv != ActiveControl) {
return;
}
decimal p = PUBG.CmFromConv(
NumBoxPubgConv.Value,
NumBoxDPI.Value,
NumBoxPubgFov.Value
);
UpdateAllNumBoxes(p);
}
private void NumBoxPubgFov_ValueChanged(object sender, EventArgs e) {
if (NumBoxPubgFov != ActiveControl) {
return;
}
decimal p = PUBG.CmFromConv(
NumBoxPubgConv.Value,
NumBoxDPI.Value,
NumBoxPubgFov.Value
);
UpdateAllNumBoxes(p);
}
// MOUSE SETTINGS
private void NumBoxDPI_ValueChanged(object sender, EventArgs e) {
if (NumBoxDPI != ActiveControl) {
return;
}
// Just recalculate using Overwatch value
decimal cm = Overwatch.CmFromSense(
NumBoxOWSense.Value,
NumBoxDPI.Value
);
UpdateAllNumBoxes(cm);
}
// MEASUREMENTS
private void NumBoxCmPer360_ValueChanged(object sender, EventArgs e) {
if (NumBoxCmPer360 != ActiveControl) {
return;
}
UpdateAllNumBoxes(NumBoxCmPer360.Value);
}
private void NumBoxInPer360_ValueChanged(object sender, EventArgs e) {
if (NumBoxInPer360 != ActiveControl) {
return;
}
UpdateAllNumBoxes(NumBoxInPer360.Value * 2.54M);
}
private void NumBoxDePerCm_ValueChanged(object sender, EventArgs e) {
if (NumBoxDePerCm != ActiveControl) {
return;
}
UpdateAllNumBoxes(360 / NumBoxDePerCm.Value);
}
private void NumBoxDePerIn_ValueChanged(object sender, EventArgs e) {
if (NumBoxDePerIn != ActiveControl) {
return;
}
UpdateAllNumBoxes(914.4M / NumBoxDePerIn.Value);
}
// Mouse hover events
private void NumBoxOWSense_MouseEnter(object sender, EventArgs e) {
statusText.Text = "Overwatch in game sensitivity value.";
}
private void NumBoxSourceSense_MouseEnter(object sender, EventArgs e) {
statusText.Text = "Quake engine based games (Source, CSGO, ect) game sensitivity value.";
}
private void NumBoxSourceYaw_MouseEnter(object sender, EventArgs e) {
statusText.Text = "m_yaw value in quake engine games, typically left at 0.022.";
}
private void NumBoxPubgSense_MouseEnter(object sender, EventArgs e) {
statusText.Text = "PUBG in game sensitivity value (0-100).";
}
private void NumBoxPubgConv_MouseEnter(object sender, EventArgs e) {
statusText.Text = "PUBG config file 'converted' value.";
}
private void NumBoxPubgFov_MouseEnter(object sender, EventArgs e) {
statusText.Text = "PUBG FOV setting, TPP is set to 80, FPP has a slider from 80-103.";
}
private void NumBoxDPI_MouseEnter(object sender, EventArgs e) {
statusText.Text = "The hardware DPI of your mouse (ie 400, 800, 1600).";
}
private void NumBoxCmPer360_MouseEnter(object sender, EventArgs e) {
statusText.Text = "The number of centimeters it takes to do a full 360 degree turn in game.";
}
private void NumBoxInPer360_MouseEnter(object sender, EventArgs e) {
statusText.Text = "The number of inches it takes to do a full 360 degree turn in game.";
}
private void NumBoxDePerCm_MouseEnter(object sender, EventArgs e) {
statusText.Text = "The number of degrees you turn in game over one centimeter of mouse movement.";
}
private void NumBoxDePerIn_MouseEnter(object sender, EventArgs e) {
statusText.Text = "The number of degrees you turn in game over one inch of mouse movement.";
}
}
}