-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
NotCPUCores.au3
1755 lines (1488 loc) · 63.1 KB
/
NotCPUCores.au3
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
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Version=Beta
#AutoIt3Wrapper_Icon=Assets/icon.ico
#AutoIt3Wrapper_Outfile=NotCPUCores_x86.exe
#AutoIt3Wrapper_Outfile_x64=NotCPUCores.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_UseX64=y
#AutoIt3Wrapper_Res_Comment=Compiled 4/6/2022 @ ~16:20 EST
#AutoIt3Wrapper_Res_Description=NotCPUCores
#AutoIt3Wrapper_Res_Fileversion=1.7.3.3
#AutoIt3Wrapper_Res_ProductVersion=1.7.3.3
#AutoIt3Wrapper_Res_LegalCopyright=Robert Maehl, using LGPL 3 License
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Res_requestedExecutionLevel=highestAvailable
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/pe /sf
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
FileChangeDir(@SystemDir)
#include <Misc.au3>
#include <Array.au3>
#include <String.au3>
#include <Process.au3>
#include <Constants.au3>
#include <GUIListView.au3>
#include <GuiComboBox.au3>
#include <WinAPISysWin.au3>
#include <EditConstants.au3>
#include <FileConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <AutoItConstants.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ListViewConstants.au3>
#include ".\Includes\_Core.au3"
#include ".\Includes\_WMIC.au3"
#include ".\Includes\_Bitwise64.au3"
;#include ".\Includes\_ModeSelect.au3"
#include ".\Includes\_GetLanguage.au3"
#include ".\Includes\_ExtendedFunctions.au3"
#include ".\Includes\_GetSteam\_GetSteam.au3"
Opt("TrayIconHide", 1)
Opt("TrayMenuMode", 1)
Opt("TrayAutoPause", 0)
Opt("GUICloseOnESC", 0)
Opt("GUIResizeMode", $GUI_DOCKALL)
; Disable Scaling
If @OSVersion = 'WIN_10' Or @OSVersion = 'WIN_11' Then DllCall(@SystemDir & "\User32.dll", "bool", "SetProcessDpiAwarenessContext", "HWND", "DPI_AWARENESS_CONTEXT" - 1)
_LoadLanguage()
PreFlightCheck()
; Allow any function to set
Global $bInterrupt = False
; Reduce unneeded variable setting or function calls
If Not IsDeclared("bAdmin") Then Global Static $bAdmin = IsAdmin()
Global Static $iCores = _GetCPUInfo(0)
Global Static $iThreads = _GetCPUInfo(1)
Global Static $sSocket = _GetCPUInfo(3)
Main()
Func Main()
; One Time Variable Setting
Local $aExclusions[0]
Local $aExclusionsOverride[0]
Local $aCores
Local $bHPET = False
Local $bInit = True
Local $bReset = False
Local $iSleep = 100
Local $aActive[2] = [False, ""]
Local $aUnload[0]
Local $hLibrary = ""
Local $hProfile = "Autoload.ncc"
Local $sVersion = "1.7.3.2"
Local $iAllCores
Local $sPriority = "High"
Local $sBPriority = "High"
Local $aProcesses[3] = [$aUnload, "", $aExclusions]
Local $iProcesses = 0
Local $iProcessCores = 1
Local $iBroadcasterCores = 0
Local $iOtherProcessCores = 1
If $iThreads > 64 Then $iThreads = 64
For $iLoop = 0 To $iThreads - 1
$iAllCores += 2^$iLoop
Next
Local $hGUI = GUICreate("NotCPUCores", 640, 480, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_CAPTION, $WS_SYSMENU))
GUISetOnEvent($GUI_EVENT_CLOSE, "OnInterrupt")
GUISetFont($_sLang_GUIFontSize, $_sLang_GUIFontWeight, 0, $_sLang_GUIFontName)
#Region ; Dummy Controls
Local $hClear = GUICtrlCreateDummy()
Local $hRefresh = GUICtrlCreateDummy()
Local $hInterrupt = GUICtrlCreateDummy()
GUICtrlSetOnEvent(-1, "OnInterrupt")
#EndRegion
Local $aHotkeys[4][2] = [["{F5}", $hRefresh], ["{PAUSE}", $hInterrupt], ["{BREAK}", $hInterrupt], ["{DEL}", $hClear]]
GUISetAccelerators($aHotkeys)
#Region ; File Menu
Local $hMenu1 = GUICtrlCreateMenu($_sLang_FileMenu)
Local $hLoad = GUICtrlCreateMenuItem($_sLang_FileLoad, $hMenu1)
Local $hSave = GUICtrlCreateMenuItem($_sLang_FileSave, $hMenu1)
GUICtrlCreateMenuItem("", $hMenu1)
Local $hQuit = GUICtrlCreateMenuItem($_sLang_FileQuit, $hMenu1)
GUICtrlSetOnEvent(-1, "OnInterrupt")
#EndRegion
#Region ; Options Menu
Local $hMenu2 = GUICtrlCreateMenu($_sLang_OptionsMenu)
Local $hLang = GUICtrlCreateMenu($_sLang_TextMenu, $hMenu2)
Local $hCLang = GUICtrlCreateMenuItem($_sLang_TextCurrent & ": " & $_sLang_Language, $hLang)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateMenuItem("", $hLang)
Local $hLoadLanguage = GUICtrlCreateMenuItem($_sLang_TextLoad, $hLang)
Local $hResetLanguage = GUICtrlCreateMenuItem("Reset to Default Language", $hLang)
Local $hTimer = GUICtrlCreateMenu($_sLang_SleepMenu, $hMenu2)
Local $hGetTimer = GUICtrlCreateMenuItem($_sLang_SleepCurrent & ": " & $iSleep & "ms", $hTimer)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateMenuItem("", $hTimer)
Local $hSetTimer = GUICtrlCreateMenuItem($_sLang_SleepSet, $hTimer)
Local $hSteam = GUICtrlCreateMenu("Steam", $hMenu2)
Local $hSetLibrary = GUICtrlCreateMenuItem($_sLang_SetLibrary, $hSteam)
Local $hRemLibrary = GUICtrlCreateMenuItem($_sLang_RemLibrary, $hSteam)
#EndRegion
#Region ; Help Menu
Local $hMenu3 = GUICtrlCreateMenu($_sLang_HelpMenu)
Local $hGithub = GUICtrlCreateMenuItem($_sLang_HelpSite, $hMenu3)
Local $hDiscord = GUICtrlCreateMenuItem($_sLang_HelpCord, $hMenu3)
GUICtrlCreateMenuItem("", $hMenu3)
Local $hHowTo = GUICtrlCreateMenuItem($_sLang_HelpHowTo, $hMenu3)
Local $hDonate = GUICtrlCreateMenuItem($_sLang_HelpDonate, $hMenu3)
GUICtrlCreateMenuItem("", $hMenu3)
Local $hUpdate = GUICtrlCreateMenuItem($_sLang_HelpUpdate, $hMenu3)
#EndRegion
GUICtrlCreateTab(0, 0, 280, 275)
#Region ; Work Tab
;GUICtrlCreateTabItem($_sLang_WorkTab)
#EndRegion
#Region ; Play Tab
GUICtrlCreateTabItem($_sLang_PlayTab)
GUICtrlCreateLabel($_sLang_PlayText, 5, 25, 250, 15, $SS_CENTER + $SS_SUNKEN)
GUICtrlSetBkColor(-1, 0xF0F0F0)
Local $hDToggle = GUICtrlCreateButton("D", 250, 25, 20, 15)
GUICtrlSetTip($hDToggle, $_sLang_DebugTip)
GUICtrlCreateLabel($_sLang_OptimizeProcess & ":", 10, 50, 140, 15)
Local $hTask = GUICtrlCreateInput("", 150, 45, 100, 20, $ES_UPPERCASE + $ES_RIGHT + $ES_AUTOHSCROLL)
GUICtrlSetTip(-1, $_sLang_OptimizeTip & @CRLF & _
$_sLang_Example & ": NOTEPAD.EXE" & @CRLF & _
$_sLang_Example & ": NOTEPAD.EXE|CHROME.EXE" , $_sLang_Usage, $TIP_NOICON)
Local $hSearch = GUICtrlCreateButton(ChrW(8678), 250, 45, 20, 20)
GUICtrlSetFont(-1, 12)
GUICtrlSetTip(-1, $_sLang_ImportTip, $_sLang_Usage, $TIP_NOICON)
GUICtrlCreateLabel($_sLang_IncludeChildren, 10, 75, 140, 20)
Local $hChildren = GUICtrlCreateCheckbox("", 150, 70, 120, 20, $BS_RIGHTBUTTON)
GUICtrlSetTip(-1, $_sLang_ChildrenTip, $_sLang_Usage, $TIP_NOICON)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateLabel($_sLang_AllocationMode & ":", 10, 100, 140, 15)
Local $hAssignMode = GUICtrlCreateCombo("", 150, 95, 120, 20, $CBS_DROPDOWNLIST)
If $iCores = $iThreads Then
GUICtrlSetData(-1, _
$_sLang_AllocAll & "|" & _
$_sLang_AllocFirst & "|" & _
$_sLang_AllocFirstTwo & "|" & _
$_sLang_AllocFirstFour & "|" & _
$_sLang_AllocFirstHalf & "|" & _
$_sLang_AllocEven & "|" & _
$_sLang_AllocOdd & "|" & _
$_sLang_AllocPairs & "|" & _
$_sLang_AllocFirstAMD & "|" & _
$_sLang_AllocCustom, $_sLang_AllocAll)
Else
GUICtrlSetData(-1, _
$_sLang_AllocAll & "|" & _
$_sLang_AllocFirst & "|" & _
$_sLang_AllocFirstTwo & "|" & _
$_sLang_AllocFirstFour & "|" & _
$_sLang_AllocFirstHalf & "|" & _
$_sLang_AllocPhysical & "|" & _
$_sLang_AllocVirtual & "|" & _
$_sLang_AllocPairs & "|" & _
$_sLang_AllocFirstAMD & "|" & _
$_sLang_AllocCustom, $_sLang_AllocAll)
EndIf
GUICtrlCreateLabel($_sLang_Assignments & ":", 10, 125, 140, 15)
Local $hCores = GUICtrlCreateInput("", 150, 120, 120, 20, $ES_UPPERCASE + $ES_RIGHT + $ES_AUTOHSCROLL)
GUICtrlSetTip(-1, $_sLang_AssignTip1 & @CRLF & _
$_sLang_AssignTip2 & @CRLF & _
$_sLang_AssignTip3 & @CRLF & _
$_sLang_Example & ": 1,3,4-6" & @TAB & @TAB & $_sLang_AssignTip4 & ": " & $iThreads, $_sLang_Usage, $TIP_NOICON)
If $iThreads <= 4 Then
GUICtrlSetData(-1, "1-" & $iThreads)
ElseIf $iThreads <= 6 Then
GUICtrlSetData(-1, "1-4")
Else
GUICtrlSetData(-1, "1-" & Ceiling($iThreads/2))
EndIf
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateLabel($_sLang_OptimizePriority & ":", 10, 150, 140, 15)
Local $hPPriority = GUICtrlCreateCombo("", 150, 145, 120, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, _
$_sLang_PriorityLow & "|" & _
$_sLang_PriorityBNormal & "|" & _
$_sLang_PriorityNormal & "|" & _
$_sLang_PriorityANormal & "|" & _
$_sLang_PriorityHigh & "|" & _
$_sLang_PriorityRealtime, $_sLang_PriorityHigh)
#EndRegion
#Region ; Stream Tab
GUICtrlCreateTabItem($_sLang_StreamTab)
GUICtrlCreateLabel($_sLang_StreamText, 5, 25, 270, 15, $SS_CENTER + $SS_SUNKEN)
GUICtrlSetBkColor(-1, 0xF0F0F0)
GUICtrlCreateLabel($_sLang_StreamSoftware & ":", 10, 50, 140, 15)
Local $hBroadcaster = GUICtrlCreateCombo("", 150, 45, 120, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "-|LightStream|OBS|ReLive|StreamLabs|ShadowPlay|vMix|Wirecast|XSplit", "-")
GUICtrlCreateLabel($_sLang_IncludeChildren, 10, 75, 140, 20)
Local $hBroChild = GUICtrlCreateCheckbox("", 150, 70, 120, 20, $BS_RIGHTBUTTON)
GUICtrlSetTip(-1, $_sLang_ChildrenTip, $_sLang_Usage, $TIP_NOICON)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateLabel($_sLang_AllocationMode & ":", 10, 100, 140, 15)
Local $hSplitMode = GUICtrlCreateCombo("", 150, 95, 120, 20, $CBS_DROPDOWNLIST)
If $iCores = $iThreads Then
GUICtrlSetData(-1, _
$_sLang_AllocAll & "|" & _
$_sLang_AllocLast & "|" & _
$_sLang_AllocLastTwo & "|" & _
$_sLang_AllocLastFour & "|" & _
$_sLang_AllocLastHalf & "|" & _
$_sLang_AllocEven & "|" & _
$_sLang_AllocOdd & "|" & _
$_sLang_AllocPairs & "|" & _
$_sLang_AllocLastAMD & "|" & _
$_sLang_AllocCustom, $_sLang_AllocLastHalf)
Else
GUICtrlSetData(-1, _
$_sLang_AllocAll & "|" & _
$_sLang_AllocLast & "|" & _
$_sLang_AllocLastTwo & "|" & _
$_sLang_AllocLastFour & "|" & _
$_sLang_AllocLastHalf & "|" & _
$_sLang_AllocPhysical & "|" & _
$_sLang_AllocVirtual & "|" & _
$_sLang_AllocPairs & "|" & _
$_sLang_AllocLastAMD & "|" & _
$_sLang_AllocCustom, $_sLang_AllocLastHalf)
EndIf
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateLabel($_sLang_Assignments & ":", 10, 125, 140, 15)
Local $hBCores = GUICtrlCreateInput("2", 150, 120, 120, 20, $ES_UPPERCASE + $ES_RIGHT + $ES_AUTOHSCROLL)
GUICtrlSetTip(-1, $_sLang_AssignTip1 & @CRLF & _
$_sLang_AssignTip2 & @CRLF & _
$_sLang_AssignTip3 & @CRLF & _
$_sLang_Example & ": 1,3,4-6" & @TAB & @TAB & $_sLang_AssignTip4 & ": " & $iThreads, $_sLang_Usage, $TIP_NOICON)
GUICtrlSetState(-1, $GUI_DISABLE)
If $iThreads > 2 Then
If $iThreads = 3 Then
GUICtrlSetData(-1, "3")
Else
GUICtrlSetData(-1, Ceiling($iThreads/2) + 1 & "-" & $iThreads)
EndIf
EndIf
GUICtrlCreateLabel($_sLang_OptimizePriority & ":", 10, 150, 140, 15)
Local $hBPriority = GUICtrlCreateCombo("", 150, 145, 120, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, _
$_sLang_PriorityLow & "|" & _
$_sLang_PriorityBNormal & "|" & _
$_sLang_PriorityNormal & "|" & _
$_sLang_PriorityANormal & "|" & _
$_sLang_PriorityHigh & "|" & _
$_sLang_PriorityRealtime, $_sLang_PriorityHigh)
GUICtrlCreateLabel($_sLang_StreamOtherAssign & ":", 10, 175, 140, 20)
Local $hOAssign = GUICtrlCreateCombo("", 150, 170, 120, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, _
$_sLang_AllocBroadcaster & "|" & _
$_sLang_AllocProcess & "|" & _
$_sLang_AllocRemaining & "|", $_sLang_AllocRemaining)
GUICtrlSetState(-1, $GUI_DISABLE)
#EndRegion
#Region ; Tools Tab
GUICtrlCreateTabItem($_sLang_ToolTab)
GUICtrlCreateLabel($_sLang_GameSection, 5, 25, 80, 15, $SS_CENTER + $SS_SUNKEN)
GUICtrlSetBkColor(-1, 0xF0F0F0)
Local $hGameM = GUICtrlCreateButton($_sLang_GameMode, 5, 40, 80, 40, $BS_MULTILINE)
GUICtrlSetImage(-1, "shell32.dll", -208)
If @OSVersion = "WIN_10" Then
If @OSBuild < 15007 Then GUICtrlSetState(-1, $GUI_DISABLE)
Else
GUICtrlSetState(-1, $GUI_DISABLE)
EndIf
Local $hHAGS = GUICtrlCreateButton($_sLang_HAGS, 5, 85, 80, 40, $BS_MULTILINE)
GUICtrlSetImage(-1, "imageres.dll", -30)
If @OSVersion = "WIN_10" Then
If @OSBuild < 19041 Then GUICtrlSetState(-1, $GUI_DISABLE)
If StringInStr(_GetGPUInfo(0), "nvidia") Then
Select
Case FileExists("C:\Program Files\NVIDIA Corporation\NVSMI\nvml.dll") ; Older Drivers
If StringReplace(FileGetVersion("C:\Program Files\NVIDIA Corporation\NVSMI\nvml.dll", $FV_FILEDESCRIPTION), "NVIDIA Management Library ", "") < 451.48 Then GUICtrlSetState(-1, $GUI_DISABLE)
Case FileExists("C:\Windows\System32\nvml.dll") ; Newer Drivers
If StringReplace(FileGetVersion("C:\Windows\System32\nvml.dll", $FV_FILEDESCRIPTION), "NVIDIA Management Library ", "") < 451.48 Then GUICtrlSetState(-1, $GUI_DISABLE)
Case FileExists("C:\Windows\System32\nvcuda.dll") ; May Fail if Nvidia Ever Stops using CUDA
If StringReplace(FileGetVersion("C:\Windows\System32\nvcuda.dll", $FV_FILEDESCRIPTION), "NVIDIA CUDA Driver, Version ", "") < 451.48 Then GUICtrlSetState(-1, $GUI_DISABLE)
EndSelect
Else
GUICtrlSetState(-1, $GUI_DISABLE)
EndIf
Else
GUICtrlSetState(-1, $GUI_DISABLE)
EndIf
Local $hHPET = GUICtrlCreateButton($_sLang_HPET, 5, 130, 80, 40, $BS_MULTILINE)
GUICtrlSetImage(-1, "imageres.dll", -30)
GUICtrlCreateLabel($_sLang_DiskSection, 100, 25, 80, 15, $SS_CENTER + $SS_SUNKEN)
GUICtrlSetBkColor(-1, 0xF0F0F0)
Local $hDefrag = GUICtrlCreateButton($_sLang_DiskDefrag, 100, 40, 80, 40, $BS_MULTILINE)
GUICtrlSetImage(-1, "shell32.dll", -81)
Local $hCleanup = GUICtrlCreateButton($_sLang_DiskCleanup, 100, 85, 80, 40, $BS_MULTILINE)
GUICtrlSetImage(-1, "shell32.dll", -32)
Local $hCheck = GUICtrlCreateButton($_sLang_DiskCheck, 100, 130, 80, 40, $BS_MULTILINE)
GUICtrlSetImage(-1, "shell32.dll", -271)
Local $hSSense = GUICtrlCreateButton($_sLang_StorageSense, 100, 175, 80, 40, $BS_MULTILINE)
If @OSVersion = "WIN_10" Then
If @OSBuild < 16299 Then GUICtrlSetState(-1, $GUI_DISABLE)
Else
GUICtrlSetState(-1, $GUI_DISABLE)
EndIf
GUICtrlSetImage(-1, "shell32.dll", -167)
GUICtrlCreateLabel($_sLang_ReliabilitySection, 195, 25, 80, 15, $SS_CENTER + $SS_SUNKEN)
GUICtrlSetBkColor(-1, 0xF0F0F0)
Local $hEvents = GUICtrlCreateButton($_sLang_RecentEvents, 195, 40, 80, 40, $BS_MULTILINE)
GUICtrlSetImage(-1, "shell32.dll", -208)
Local $hActions = GUICtrlCreateButton($_sLang_ActionCenter, 195, 85, 80, 40, $BS_MULTILINE)
If @OSVersion = "Win_Vista" Then
GUICtrlSetImage(-1, "imageres.dll", -73)
Else
GUICtrlSetImage(-1, "ActionCenter.dll", 1)
EndIf
Local $hPower = GUICtrlCreateButton($_sLang_PowerOptions, 195, 130, 80, 40, $BS_MULTILINE)
GUICtrlSetImage(-1, "powercpl.dll", 1)
#EndRegion
#Region ; Specs Tab
GUICtrlCreateTabItem($_sLang_SpecsTab)
GUICtrlCreateLabel($_sLang_SpecsOSSection, 5, 25, 270, 15, $SS_CENTER + $SS_SUNKEN)
GUICtrlSetBkColor(-1, 0xF0F0F0)
GUICtrlCreateLabel($_sLang_SpecsOS & ":", 10, 45, 70, 15)
GUICtrlCreateLabel(StringReplace(_GetOSInfo(0), "Microsoft ", "") & " " & _GetOSInfo(1), 40, 45, 230, 20, $ES_RIGHT)
GUICtrlCreateLabel($_sLang_SpecsLanguage & ":", 10, 65, 70, 15)
GUICtrlCreateLabel(_GetLanguage(), 80, 65, 190, 20, $ES_RIGHT)
GUICtrlCreateLabel($_sLang_SpecsHardwareSection, 5, 90, 270, 15, $SS_CENTER + $SS_SUNKEN)
GUICtrlSetBkColor(-1, 0xF0F0F0)
GUICtrlCreateLabel($_sLang_SpecsMobo & ":", 10, 110, 70, 15)
GUICtrlCreateLabel(_GetMotherboardInfo(0) & " " & _GetMotherboardInfo(1), 10, 125, 260, 20, $ES_RIGHT)
GUICtrlCreateLabel($_sLang_SpecsCPU & ":", 10, 145, 50, 15)
GUICtrlCreateLabel(_GetCPUInfo(2), 10, 160, 260, 20, $ES_RIGHT)
GUICtrlCreateLabel($_sLang_SpecsRAM & ":", 10, 180, 70, 15)
GUICtrlCreateLabel(Round(MemGetStats()[1]/1048576) & " GB @ " & _GetRAMInfo(0) & " MHz", 10, 195, 260, 20, $ES_RIGHT)
GUICtrlCreateLabel($_sLang_SpecsGPU & ":", 10, 215, 70, 15)
GUICtrlCreateLabel(_GetGPUInfo(0), 10, 230, 260, 30, $ES_RIGHT)
#EndRegion
#Region ; About Tab
GUICtrlCreateTabItem($_sLang_AboutTab)
GUICtrlCreateLabel(@CRLF & "NotCPUCores" & @TAB & "v" & $sVersion & @CRLF & _
$_sLang_AboutLicense & " LGPL-3.0" & @CRLF & _
$_sLang_AboutDeveloper & " Robert Maehl" & @CRLF & _
$_sLang_AboutIcon & " /u/ImRealNow" & @CRLF & _
$_sLang_AboutLanguage & " " & $_sLang_Translator, 5, 25, 270, 80, $SS_CENTER)
GUICtrlSetBkColor(-1, 0xF0F0F0)
#EndRegion
GUICtrlCreateTabItem("")
Local $hReset = GUICtrlCreateButton($_sLang_Restore, 5, 275, 135, 20)
Local $hOptimize = GUICtrlCreateButton($_sLang_Optimize, 140, 275, 135, 20)
$hQuickTabs = GUICreate("", 360, 300, 280, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)
GUISetAccelerators($aHotkeys)
GUISetFont($_sLang_GUIFontSize, $_sLang_GUIFontWeight, 0, $_sLang_GUIFontName)
$hTabs = GUICtrlCreateTab(0, 0, 360, 300)
#Region ; Process List
GUICtrlCreateTabItem($_sLang_RunningTab)
Local $bPHidden = False
Local $hProcesses = GUICtrlCreateListView($_sLang_ProcessList & "|" & $_sLang_ProcessTitle, 0, 20, 360, 280, $LVS_REPORT+$LVS_SINGLESEL, $LVS_EX_GRIDLINES+$LVS_EX_FULLROWSELECT+$LVS_EX_DOUBLEBUFFER+$LVS_EX_FLATSB)
_GUICtrlListView_RegisterSortCallBack($hProcesses)
GUICtrlSetTip(-1, $_sLang_RefreshTip, $_sLang_Usage)
_GetProcessList($hProcesses)
_GUICtrlListView_SortItems($hProcesses, 0)
#EndRegion
#Region ; Games List
GUICtrlCreateTabItem($_sLang_GamesTab)
Local $hGames = GUICtrlCreateListView($_sLang_GameID & "|" & $_sLang_GameName, 0, 20, 360, 280, $LVS_REPORT+$LVS_SINGLESEL, $LVS_EX_GRIDLINES+$LVS_EX_FULLROWSELECT+$LVS_EX_DOUBLEBUFFER)
_GUICtrlListView_RegisterSortCallBack($hGames)
GUICtrlSetTip(-1, $_sLang_RefreshTip, $_sLang_Usage)
_AddSteamGames($hGames, $hLibrary)
_GUICtrlListView_SortItems($hGames, 1)
#EndRegion
$bPHidden = True
#Region ; Exclusion List
GUICtrlCreateTabItem($_sLang_ExclusionsTab)
Local $hExclusions = GUICtrlCreateListView($_sLang_ProcessList, 0, 20, 360, 280, $LVS_REPORT+$LVS_SINGLESEL, $LVS_EX_GRIDLINES+$LVS_EX_FULLROWSELECT+$LVS_EX_DOUBLEBUFFER)
_GUICtrlListView_RegisterSortCallBack($hExclusions)
GUICtrlSetTip(-1, $_sLang_RefreshTip, $_sLang_Usage)
$aExclusions = _GetExclusionsList($hExclusions, $aExclusionsOverride)
_GUICtrlListView_SortItems($hExclusions, 0)
#EndRegion
GUICtrlCreateTabItem("")
GUISwitch($hGUI)
#Region ; Debug Console
Local $bCHidden = False
$hConsole = GUICtrlCreateEdit($_sLang_DebugStart & @CRLF & "---" & @CRLF, 0, 300, 640, 160, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY))
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetState($hConsole, $GUI_HIDE)
$bCHidden = True
#EndRegion
WinMove($hGUI, "", Default, Default, 285, 345, 1)
GUISetState(@SW_SHOW, $hGUI)
#Region ; Sleep Timer GUI
$hTimerGUI = GUICreate($_sLang_SleepSet, 240, 120, -1, -1, $WS_POPUP + $WS_CAPTION, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
GUISetFont($_sLang_GUIFontSize, $_sLang_GUIFontWeight, 0, $_sLang_GUIFontName)
GUICtrlCreateLabel($_sLang_SleepText, 10, 5, 220, 45)
GUICtrlCreateLabel($_sLang_NewSleep & ":", 10, 60, 110, 20)
$hSleepTime = GUICtrlCreateInput($iSleep, 120, 55, 40, 20, $ES_RIGHT + $ES_NUMBER)
GUICtrlSetLimit(-1, 3, 1)
GUICtrlCreateLabel("ms", 165, 60, 20, 15)
$hSleepOK = GUICtrlCreateButton("OK", 170, 90, 60, 20)
#EndRegion
#cs
#Region ; Settings UI
$hSettingsGUI = GUICreate("Settings", 360, 120, -1, -1, $WS_VISIBLE + $WS_POPUP + $WS_CAPTION, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
$hSettingsOK = GUICtrlCreateButton("OK", 290, 90, 60, 20)
#EndRegion
#ce
While 1
; Optimize first, always
If Not $iProcesses = 0 Then
If $bInterrupt = True Then
$bInterrupt = False
$iProcesses = 1
_ConsoleWrite($_sLang_Interrupt, $hConsole)
ContinueLoop
ElseIf $iProcesses = 1 Then
Opt("GUIOnEventMode", 0)
_ConsoleWrite($_sLang_RestoringState & @CRLF, $hConsole)
_Restore($aExclusions, $iThreads, $hConsole) ; Do Clean Up
_ConsoleWrite($_sLang_Done & @CRLF, $hConsole)
_ConsoleWrite("---" & @CRLF, $hConsole)
GUICtrlSetData($hReset, $_sLang_Restore)
GUICtrlSetData($hOptimize, $_sLang_Optimize)
GUICtrlSetState($hMenu1, $GUI_ENABLE)
GUICtrlSetState($hMenu2, $GUI_ENABLE)
GUICtrlSetState($hMenu3, $GUI_ENABLE)
For $iLoop = $hTask - 1 to $hBPriority + 1 Step 1
If $iLoop = $hChildren Then ContinueLoop
If $iLoop = $hBroChild Then ContinueLoop
GUICtrlSetState($iLoop, $GUI_ENABLE)
Next
GUICtrlSetState($hReset , $GUI_ENABLE)
GUICtrlSetState($hOptimize, $GUI_ENABLE)
$iProcesses = 0
$aActive[0] = False
$aActive[1] = ""
$bReset = True
Else
Select
; Case Not $aActive[1] = _ProcessGetName(WinGetProcess("[ACTIVE]"))
; ContinueCase
Case UBound(ProcessList()) <> $iProcesses
If $aActive[0] Then
$aProcesses[0] = GUICtrlRead($hTask)
$aProcesses[0] = StringSplit($aProcesses[0], "|", $STR_NOCOUNT)
$aUnload = $aProcesses[0] ; Unload $aProcesses[0]
For $iLoop = 0 To UBound($aUnload) - 1 Step 1
Switch $aUnload[$iLoop]
Case "ACTIVE"
$aUnload[$iLoop] = _ProcessGetName(WinGetProcess("[ACTIVE]"))
$aActive[1] = $aUnload[$iLoop]
EndSwitch
Next
$aProcesses[0] = $aUnload ; Reload $aProcesses[0]
EndIf
$iProcesses = _Optimize($iProcesses,$aProcesses[0],$iProcessCores,$iSleep,$sPriority,$hConsole)
Switch $iProcesses
Case 1
Switch @error
Case 0
Switch @extended
Case 1
_ConsoleWrite(_ArrayToString($aProcesses[0], " & ") & " " & $_sLang_RestoringState & @CRLF, $hConsole)
EndSwitch
Case 1
Switch @extended
Case 1
_ConsoleWrite("!> " & _ArrayToString($aProcesses[0], " & ") & " " & $_sLang_NotRunning & @CRLF, $hConsole)
Case 2
_ConsoleWrite("!> " & $_sLang_InvalidProcessCores & @CRLF, $hConsole)
Case 3
_ConsoleWrite("!> " & $_sLang_TooManyCores & @CRLF, $hConsole)
Case 4
_ConsoleWrite("!> " & $sPriority & " - " & $_sLang_InvalidPriority & @CRLF, $hConsole)
EndSwitch
EndSwitch
Case Else
Switch @extended
Case 0
_ConsoleWrite(_ArrayToString($aProcesses[0], " & ") & " " & $_sLang_Optimizing & @CRLF, $hConsole)
Case 1
_ConsoleWrite($_sLang_ReOptimizing & @CRLF, $hConsole)
Case 2
_ConsoleWrite("!> " & $_sLang_MaxPerformance & @CRLF, $hConsole)
_ConsoleWrite(_ArrayToString($aProcesses[0], " & ") & " " & $_sLang_Optimizing & @CRLF, $hConsole)
EndSwitch
EndSwitch
Switch _OptimizeOthers($aProcesses, $iOtherProcessCores, $iSleep, $hConsole)
Case 1
$iProcesses = 1
Switch @error
Case 1
_ConsoleWrite("!> " & $_sLang_InvalidProcessCores & @CRLF, $hConsole)
Case 2
_ConsoleWrite("!> " & $_sLang_TooManyCores & @CRLF, $hConsole)
EndSwitch
EndSwitch
Switch _OptimizeBroadcaster($aProcesses, $iBroadcasterCores, $iSleep, $sBPriority, $hConsole)
Case 0
Switch @extended
Case 1
_ConsoleWrite("!> " & $_sLang_MaxCores & @CRLF, $hConsole)
EndSwitch
Case 1
$iProcesses = 1
Switch @error
Case 1
_ConsoleWrite("!> " & $_sLang_TooManyTotalCores & @CRLF, $hConsole)
EndSwitch
EndSwitch
EndSelect
EndIf
EndIf
If Opt("GUIOnEventMode") Then
Sleep($iSleep)
Else
$hMsg = GUIGetMsg()
$hTMsg = TrayGetMsg()
Select
Case $hMsg = $GUI_EVENT_CLOSE or $hMsg = $hQuit
_GUICtrlListView_UnRegisterSortCallBack($hGames)
_GUICtrlListView_UnRegisterSortCallBack($hProcesses)
_GUICtrlListView_UnRegisterSortCallBack($hExclusions)
GUIDelete($hQuickTabs)
GUIDelete($hTimerGUI)
GUIDelete($hGUI)
Exit
Case $hMsg = $hClear
GUICtrlSetData($hConsole, "")
Case $hMsg = $GUI_EVENT_MINIMIZE
Opt("TrayIconHide", 0)
TraySetToolTip("NotCPUCores")
GUISetState(@SW_HIDE, $hGUI)
Case $hTMsg = $TRAY_EVENT_PRIMARYUP
Opt("TrayIconHide", 1)
GUISetState(@SW_SHOW, $hGUI)
Case $hMsg = $hLoadLanguage ; LAZINESS... but saves a couple hundred lines of code
$hFile = FileOpenDialog($_sLang_LoadProfile, @WorkingDir, "Language File (*.ini)", $FD_FILEMUSTEXIST, StringRight(@OSLang,2) & ".ini", $hGUI)
If Not @error Then ContinueCase
Case $hMsg = $hResetLanguage
_LoadLanguage($hFile)
_GUICtrlListView_UnRegisterSortCallBack($hGames)
_GUICtrlListView_UnRegisterSortCallBack($hProcesses)
_GUICtrlListView_UnRegisterSortCallBack($hExclusions)
GUIDelete($hQuickTabs)
GUIDelete($hTimerGUI)
GUIDelete($hGUI)
$hFile = ""
Main()
Case $hMsg = $hDToggle
If $bCHidden Or $bPHidden Then
$aPos = WinGetPos($hGUI)
WinMove($hGUI, "", $aPos[0], $aPos[1], 640, 480)
$aPos = WinGetPos($hQuickTabs)
WinMove($hQuickTabs, "", $aPos[0], $aPos[1], 355, 300)
GUICtrlSetState($hConsole, $GUI_SHOW)
GUISetState(@SW_SHOW, $hQuickTabs)
; GUICtrlSetPos($hGames, 0, 20, 355, 280)
GUICtrlSetPos($hConsole, 0, 300, 635, 135)
; GUICtrlSetPos($hProcesses, 0, 20, 355, 280)
$bCHidden = False
$bPHidden = False
Else
GUICtrlSetState($hConsole, $GUI_HIDE)
GUISetState(@SW_HIDE, $hQuickTabs)
$aPos = WinGetPos($hGUI)
WinMove($hGUI, "", $aPos[0], $aPos[1], 285, 345)
$bCHidden = True
$bPHidden = True
EndIf
Case $hMsg = $hSetTimer
GUISetState(@SW_SHOW, $hTimerGUI)
Case $hMsg = $hSleepOK
$iSleep = GUICtrlRead($hSleepTime)
GUICtrlSetData($hGetTimer, $_sLang_SleepCurrent & ": " & $iSleep & "ms")
GUISetState(@SW_HIDE, $hTimerGUI)
Case $hMsg = $hSetLibrary
$hFile = FileOpenDialog($_sLang_LoadProfile, @WorkingDir, "SteamLibrary (*.vdf)", $FD_FILEMUSTEXIST, "libraryfolders.vdf", $hGUI)
If @error Then
;;;
Else
$hLibrary = $hFile
_AddSteamGames($hGames, $hLibrary)
_GUICtrlListView_SortItems($hGames, GUICtrlGetState($hGames))
EndIf
Case $hMsg = $hRemLibrary
$hLibrary = ""
_AddSteamGames($hGames, $hLibrary)
_GUICtrlListView_SortItems($hGames, GUICtrlGetState($hGames))
; Case $hMsg = $hSettingsOK
; GUISetState(@SW_HIDE, $hSettingsGUI)
Case $hMsg = $hSave
$hFile = FileSaveDialog($_sLang_SaveProfile, @WorkingDir, "NotCPUCores Profile (*.ncc)", $FD_PROMPTOVERWRITE, "", $hGUI)
If @error Then
;;;
Else
IniWrite($hFile, "Meta" , "Version" , "1")
IniWrite($hFile, "General" , "Process" , GUICtrlRead($hTask ))
IniWrite($hFile, "General" , "SplitAs" , _GUICtrlComboBox_GetCurSel($hAssignMode ))
IniWrite($hFile, "General" , "Threads" , GUICtrlRead($hCores ))
IniWrite($hFile, "General" , "Children" , GUICtrlRead($hChildren ))
IniWrite($hFile, "General" , "Priority" , _GUICtrlComboBox_GetCurSel($hPPriority ))
IniWrite($hFile, "Streaming", "SplitAs" , _GUICtrlComboBox_GetCurSel($hSplitMode ))
IniWrite($hFile, "Streaming", "Threads" , GUICtrlRead($hBCores ))
IniWrite($hFile, "Streaming", "Software" , GUICtrlRead($hBroadcaster))
IniWrite($hFile, "Streaming", "Children" , GUICtrlRead($hBroChild ))
IniWrite($hFile, "Streaming", "Priority" , _GUICtrlComboBox_GetCurSel($hBPriority ))
IniWrite($hFile, "Streaming", "Assignment" , _GUICtrlComboBox_GetCurSel($hOAssign ))
EndIf
Case $hMsg = $hProcesses
_GetProcessList($hProcesses)
_GUICtrlListView_SortItems($hProcesses, GUICtrlGetState($hProcesses))
Case $hMsg = $hGames
_AddSteamGames($hGames, $hLibrary)
_GUICtrlListView_SortItems($hGames, GUICtrlGetState($hGames))
Case $hMsg = $hExclusions
$aExclusions = _GetExclusionsList($hExclusions, $aExclusionsOverride)
_GUICtrlListView_SortItems($hExclusions, GUICtrlGetState($hExclusions))
Case $hMsg = $hRefresh
Switch GUICtrlRead($hTabs)
Case 0
_GetProcessList($hProcesses)
_GUICtrlListView_SortItems($hProcesses, 0)
Case 1
_AddSteamGames($hGames, $hLibrary)
_GUICtrlListView_SortItems($hGames, 1)
Case 2
$aExclusions = _GetExclusionsList($hExclusions, $aExclusionsOverride)
EndSwitch
Case $hMsg = $hSearch
GUICtrlSetState($hDToggle, $GUI_DISABLE)
If $bPHidden Then
GUICtrlSetState($hGames, $GUI_SHOW)
GUICtrlSetState($hProcesses, $GUI_SHOW)
$aPos = WinGetPos($hGUI)
WinMove($hGUI, "", $aPos[0], $aPos[1], 640)
$aPos = WinGetPos($hQuickTabs)
WinMove($hQuickTabs, "", $aPos[0], $aPos[1], 355, 300)
GUISetState(@SW_SHOW, $hQuickTabs)
GUICtrlSetPos($hGames, 0, 20, 355, 280)
GUICtrlSetPos($hProcesses, 0, 20, 355, 280)
$bPHidden = False
Else
Switch GUICtrlRead($hTabs)
Case 0
$aTask = StringSplit(GUICtrlRead(GUICtrlRead($hProcesses)), "|", $STR_NOCOUNT)
Case 1
$aTask = StringSplit(GUICtrlRead(GUICtrlRead($hGames)), "|", $STR_NOCOUNT)
Case 2
$aTask = StringSplit(GUICtrlRead(GUICtrlRead($hExclusions)), "|", $STR_NOCOUNT)
EndSwitch
If $aTask[0] = "0" Then
;;;
Else
GUICtrlSetData($hTask, $aTask[0])
EndIf
$aTask = ""
EndIf
GUICtrlSetState($hDToggle, $GUI_ENABLE)
Case $bInit = True
ContinueCase
Case $hMsg = $hLoad
If $bInit Then
$bInit = False
$hFile = "Autoload.ncc"
If FileExists(@WorkingDir & "\Settings.ini") Then
$hLibrary = IniRead(@WorkingDir & "\Settings.ini", "Steam" , "Library Path" , "Auto")
$hFile = IniRead(@WorkingDir & "\Settings.ini", "General", "Default Profile", "Autoload.ncc")
If Not FileExists($hFile) Then $hFile = ""
EndIf
Else
$hFile = FileOpenDialog($_sLang_LoadProfile, @WorkingDir, "NotCPUCores Profile (*.ncc)", $FD_FILEMUSTEXIST, "profile.ncc", $hGUI)
If @error Then ContinueCase
EndIf
If Not FileExists($hFile) Then
ContinueCase
Else
_UpdateProfile($hFile)
GUICtrlSetData( $hTask , String(_IniRead($hFile, "General" , "Process" , "", "")))
GUICtrlSetState( $hChildren , Number(_IniRead($hFile, "General" , "Children" , "", $GUI_UNCHECKED)))
_GUICtrlComboBox_SetCurSel($hAssignMode , Number(_IniRead($hFile, "General" , "SplitAs" , "0|1|2|3|4|5|6|7|8|9", "9")))
GUICtrlSetData( $hCores , String(_IniRead($hFile, "General" , "Threads" , "", "1")))
_GUICtrlComboBox_SetCurSel($hPPriority , Number(_IniRead($hFile, "General" , "Priority" , "0|1|2|3|4|5", "4")))
_GUICtrlComboBox_SetCurSel($hSplitMode , Number(_IniRead($hFile, "Streaming", "SplitAs" , "0|1|2|3|4|5|6|7|8|9", "9")))
GUICtrlSetData( $hBCores , String(_IniRead($hFile, "Streaming", "Threads" , "", "2")))
GUICtrlSetData( $hBroadcaster, String(_IniRead($hFile, "Streaming", "Software" , _GUICtrlComboBox_GetList($hBroadcaster), "-")))
GUICtrlSetState( $hBroChild , Number(_IniRead($hFile, "Streaming", "Children" , "", $GUI_UNCHECKED)))
_GUICtrlComboBox_SetCurSel($hBPriority , Number(_IniRead($hFile, "Streaming", "Priority" , "0|1|2|3|4|5", "4")))
_GUICtrlComboBox_SetCurSel($hOAssign , Number(_IniRead($hFile, "Streaming", "Assignment", "0|1|2", "2")))
$aExclusionsOverride = StringSplit( _IniRead($hFile, "General" , "Exclusions", "", ""), ",", $STR_NOCOUNT)
EndIf
ContinueCase
Case $bReset = True
$bReset = False
ContinueCase
Case $hMsg = $hBCores
$iBroadcasterCores = 0
If Not StringRegExp(GUICtrlRead($hBCores), "^(?:[1-9]\d*-?(?!\d+-)(?:[1-9]\d*)?(?!,$),?)+$") Then ;\A[0-9]+?(,[0-9]+)*\Z
GUICtrlSetColor($hBCores, 0xFF0000)
GUICtrlSetState($hOptimize, $GUI_DISABLE)
Else
GUICtrlSetColor($hBCores, 0x000000)
If StringRegExp(GUICtrlRead($hCores), "^(?:[1-9]\d*-?(?!\d+-)(?:[1-9]\d*)?(?!,$),?)+$") Then GUICtrlSetState($hOptimize, $GUI_ENABLE)
If StringInStr(GUICtrlRead($hBCores), ",") Or StringInStr(GUICtrlRead($hBCores), "-") Then ; Convert Multiple Cores if Declared to Magic Number
$aBCores = StringSplit(GUICtrlRead($hBCores), ",", $STR_NOCOUNT)
For $iLoop1 = 0 To UBound($aBCores) - 1 Step 1
If StringInStr($aBCores[$iLoop1], "-") Then
$aRange = StringSplit($aBCores[$iLoop1], "-", $STR_NOCOUNT)
If Number($aRange[0]) < Number($aRange[1]) Then
For $iLoop2 = $aRange[0] To $aRange[1] Step 1
$iBroadcasterCores += 2^($iLoop2-1)
Next
Else
For $iLoop2 = $aRange[1] To $aRange[0] Step 1
$iBroadcasterCores += 2^($iLoop2-1)
Next
EndIf
Else
$iBroadcasterCores += 2^($aBCores[$iLoop1]-1)
EndIf
Next
Else
$iBroadcasterCores = 2^(GUICtrlRead($hBCores)-1)
EndIf
EndIf
ContinueCase
Case $hMsg = $hBroadcaster
For $iLoop = $hSplitMode To $hOAssign Step 2
If $iLoop = $hBroChild Then ContinueLoop
GUICtrlSetState($iLoop, $GUI_ENABLE)
Next
$aProcesses[0] = GUICtrlRead($hTask)
Switch GUICtrlRead($hBroadcaster)
Case "-"
ReDim $aProcesses[3]
$aProcesses[1] = ""
For $iLoop = $hSplitMode To $hOAssign Step 2
GUICtrlSetState($iLoop, $GUI_DISABLE)
Next
_GUICtrlComboBox_SetCurSel($hOAssign, 2)
Case "LightStream"
ReDim $aProcesses[7]
$aProcesses[1] = "iexplore.exe"
$aProcesses[2] = "msedge.exe"
$aProcesses[3] = "chrome.exe"
$aProcesses[4] = "firefox.exe"
$aProcesses[5] = "opera.exe"
Case "OBS"
ReDim $aProcesses[6]
$aProcesses[1] = "obs.exe"
$aProcesses[2] = "obs32.exe"
$aProcesses[3] = "obs64.exe"
$aProcesses[4] = "obs-ffmpeg-mux.exe"
Case "ReLive"
ReDim $aProcesses[13]
$aProcesses[1] = "RadeonSoftware.exe"
$aProcesses[2] = "FacebookClient.exe"
$aProcesses[3] = "GfycatWrapper.exe"
$aProcesses[4] = "QuanminTVWrapper.exe"
$aProcesses[5] = "RestreamAPIWrapper.exe"
$aProcesses[6] = "SinaWeiboWrapper.exe"
$aProcesses[7] = "StreamableAPIWrapper.exe"
$aProcesses[8] = "TwitchClient.exe"
$aProcesses[9] = "TwitterWrapperClient.exe"
$aProcesses[10] = "YoukuWrapper.exe"
$aProcesses[11] = "YoutubeAPIWrapper.exe"
Case "StreamLabs"
ReDim $aProcesses[6]
$aProcesses[1] = "Streamlabs OBS.exe"
$aProcesses[2] = "obs32.exe"
$aProcesses[3] = "obs64.exe"
$aProcesses[4] = "obs-ffmpeg-mux.exe"
Case "ShadowPlay"
ReDim $aProcesses[7]
$aProcesses[1] = "nvcontainer.exe"
$aProcesses[2] = "nvscaphelper.exe"
$aProcesses[3] = "nvsphelper.exe"
$aProcesses[4] = "nvsphelper64.exe"
$aProcesses[5] = "GFExperience.exe"
Case "vMix"
ReDim $aProcesses[8]
$aProcesses[1] = "vMixService.exe"
$aProcesses[2] = "vMix.exe"
$aProcesses[3] = "vMix64.exe"
$aProcesses[4] = "vMixDesktopCapture.exe"
$aProcesses[5] = "vMixNDIHelper.exe"
$aProcesses[6] = "ffmpeg.exe"
Case "Wirecast"
ReDim $aProcesses[5]
$aProcesses[1] = "CEFChildProcess.exe"
$aProcesses[2] = "Wirecast.exe"
$aProcesses[3] = "wirecastd.exe"
Case "XSplit"
ReDim $aProcesses[6]
$aProcesses[1] = "XGS32.exe"
$aProcesses[2] = "XGS64.exe"
$aProcesses[3] = "XSplit.Core.exe"
$aProcesses[4] = "XSplit.xbcbp.exe"
Case Else
ReDim $aProcesses[3]
$aProcesses[1] = ""
For $iLoop = $hSplitMode To $hOAssign Step 2
GUICtrlSetState($iLoop, $GUI_DISABLE)
Next
_GUICtrlComboBox_SetCurSel($hOAssign, 2)
_ConsoleWrite("!> " & $_sLang_InvalidBroadcast & @CRLF, $hConsole)
EndSwitch
$aProcesses[UBound($aProcesses) - 1] = $aExclusions
ContinueCase
Case $hMsg = $hBPriority
$sBPriority = $PROCESS_HIGH
$aPriorities = StringSplit(_GUICtrlComboBox_GetList($hBPriority), Opt("GUIDataSeparatorChar"), $STR_NOCOUNT)
Switch GUICtrlRead($hBPriority)
Case $aPriorities[0] ; Low
$sBPriority = $PROCESS_LOW
Case $aPriorities[1] ; Below Normal
$sBPriority = $PROCESS_BELOWNORMAL
Case $aPriorities[2] ; Normal
$sBPriority = $PROCESS_NORMAL
Case $aPriorities[3] ; Above Normal
$sBPriority = $PROCESS_ABOVENORMAL
Case $aPriorities[4] ; High
$sBPriority = $PROCESS_HIGH
Case $aPriorities[5] ; Realtime
$sBPriority = $PROCESS_REALTIME
Case Else
$sBPriority = $PROCESS_HIGH
_ConsoleWrite("!> " & $_sLang_InvalidPriority & @CRLF, $hConsole)
EndSwitch
ContinueCase
Case $hMsg = $hPPriority
$sPriority = $PROCESS_HIGH
$aPriorities = StringSplit(_GUICtrlComboBox_GetList($hPPriority), Opt("GUIDataSeparatorChar"), $STR_NOCOUNT)
Switch GUICtrlRead($hPPriority)
Case $aPriorities[0] ; Low
$sPriority = $PROCESS_LOW
Case $aPriorities[1] ; Below Normal