@@ -10,6 +10,7 @@ namespace QuantumOfSolace
10
10
{
11
11
public partial class Form1 : Form
12
12
{
13
+ UserPreferences userPreferences ;
13
14
// Base address value for pointers.
14
15
int baseAddress = 0x0 ;
15
16
@@ -39,28 +40,59 @@ public partial class Form1 : Form
39
40
bool disableBalancing ;
40
41
41
42
string labelUrl = "www.pcgamingwiki.com" ;
42
- string DonateURL = "https://www.twitchalerts.com/donate/suicidemachine" ;
43
43
44
44
//Keyboard hook
45
45
KeyboardHook . LowLevelKeyboardHook keyboardHook ;
46
46
Keys toggleKey ;
47
47
48
+ bool initialized = false ;
49
+
48
50
49
51
/*------------------
50
52
-- INITIALIZATION --
51
53
------------------*/
52
54
public Form1 ( )
53
55
{
56
+ userPreferences = UserPreferences . Load ( ) ;
54
57
InitializeComponent ( ) ;
55
58
processName = "JB_LiveEngine_s" ;
56
- toggleKey = Keys . F5 ;
59
+ LoadUserPreferences ( ) ;
60
+ }
61
+
62
+ private void LoadUserPreferences ( )
63
+ {
64
+ fov = userPreferences . DesiredFOV ;
65
+ autoModeFOV = userPreferences . DesiredFOVHackEnabled ;
66
+
67
+ fps = userPreferences . DesiredFPS ;
68
+ autoModeFPS = userPreferences . DesiredFPSHackEnabled ;
69
+
70
+ if ( ! userPreferences . FullScreenMode )
71
+ {
72
+ autoModeFullscreen = true ;
73
+ fullscreen = 0 ;
74
+ }
75
+
76
+ disableBalancing = userPreferences . NoBalancingMiniGame ;
77
+ toggleKey = userPreferences . DesiredFPSToggleKey ;
57
78
}
58
79
59
80
private void Form1_Shown ( object sender , EventArgs e )
60
81
{
61
82
keyboardHook = new KeyboardHook . LowLevelKeyboardHook ( ) ;
62
83
RegisterHotkeys ( ) ;
63
84
keyboardHook . KeyPressed += KeyboardHook_KeyPressed ;
85
+
86
+ //Set toggles, textboxes
87
+ C_AutoModeFOV . Checked = autoModeFOV ;
88
+ T_InputFOV . Text = fov . ToString ( ) ;
89
+
90
+ C_AutoModeFPS . Checked = autoModeFPS ;
91
+ T_InputFPS . Text = fps . ToString ( ) ;
92
+
93
+ C_balance . Checked = disableBalancing ;
94
+ C_fullscreen . Checked = fullscreen != 0 ;
95
+ initialized = true ;
64
96
}
65
97
66
98
private void RegisterHotkeys ( )
@@ -73,10 +105,10 @@ private void RegisterHotkeys()
73
105
74
106
private void KeyboardHook_KeyPressed ( object sender , KeyEventArgs e )
75
107
{
76
- if ( C_AutoModeFOV . InvokeRequired )
108
+ if ( C_AutoModeFOV . InvokeRequired )
77
109
{
78
110
KeyboardHook_KeyPressedDelagate d = new KeyboardHook_KeyPressedDelagate ( ToggleFPSLock ) ;
79
- this . Invoke ( d , e ) ;
111
+ this . Invoke ( d , e ) ;
80
112
}
81
113
else
82
114
{
@@ -118,7 +150,6 @@ private void Timer_Tick(object sender, EventArgs e)
118
150
{
119
151
System . Threading . Thread . Sleep ( 100 ) ;
120
152
//baseAddress = myProcess[0].MainModule.BaseAddress.ToInt32();
121
- //var lenght = myProcess[0].MainModule.ModuleMemorySize;
122
153
}
123
154
foundProcess = true ;
124
155
@@ -242,18 +273,21 @@ void freezeBalance()
242
273
private void Form1_FormClosing ( object sender , FormClosingEventArgs e )
243
274
{
244
275
keyboardHook . KeyPressed -= KeyboardHook_KeyPressed ;
276
+ userPreferences . Save ( ) ;
245
277
}
246
278
247
279
private void C_AutoModeFOV_CheckedChanged ( object sender , EventArgs e )
248
280
{
249
281
autoModeFOV = C_AutoModeFOV . Checked ;
282
+ userPreferences . DesiredFOVHackEnabled = autoModeFOV ;
250
283
}
251
284
252
285
private void B_set_Click ( object sender , EventArgs e )
253
286
{
254
287
if ( float . TryParse ( T_InputFOV . Text , out float res ) )
255
288
{
256
289
fov = res ;
290
+ userPreferences . DesiredFOV = fov ;
257
291
}
258
292
}
259
293
@@ -262,6 +296,7 @@ private void B_setFPS_Click(object sender, EventArgs e)
262
296
if ( int . TryParse ( T_InputFPS . Text , out int resFPS ) )
263
297
{
264
298
fps = resFPS ;
299
+ userPreferences . DesiredFPS = fps ;
265
300
}
266
301
}
267
302
@@ -273,6 +308,7 @@ private void linkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs
273
308
private void C_AutoModeFPS_CheckedChanged ( object sender , EventArgs e )
274
309
{
275
310
autoModeFPS = C_AutoModeFPS . Checked ;
311
+ userPreferences . DesiredFPSHackEnabled = autoModeFPS ;
276
312
}
277
313
278
314
private void C_windowed_CheckedChanged ( object sender , EventArgs e )
@@ -285,20 +321,18 @@ private void C_windowed_CheckedChanged(object sender, EventArgs e)
285
321
else
286
322
{
287
323
autoModeFullscreen = true ;
288
- MessageBox . Show ( "The game will not run in proper windowed mode! The feature is buggy.\n Basically the game, will always remain on top, no matter what." , "Warning" , MessageBoxButtons . OK , MessageBoxIcon . Warning ) ;
324
+ if ( initialized )
325
+ MessageBox . Show ( "The game will not run in proper windowed mode! The feature is buggy.\n Basically the game, will always remain on top, no matter what." , "Warning" , MessageBoxButtons . OK , MessageBoxIcon . Warning ) ;
289
326
fullscreen = 0 ;
290
327
}
328
+ userPreferences . FullScreenMode = fullscreen != 0 ;
291
329
}
292
330
293
331
294
332
private void C_balance_CheckedChanged ( object sender , EventArgs e )
295
333
{
296
334
disableBalancing = C_balance . Checked ;
297
- }
298
-
299
- private void pictureBox1_Click ( object sender , EventArgs e )
300
- {
301
- Process . Start ( DonateURL ) ;
335
+ userPreferences . NoBalancingMiniGame = disableBalancing ;
302
336
}
303
337
304
338
private void TB_ToggleKey_KeyDown ( object sender , KeyEventArgs e )
0 commit comments