forked from febradc-github/CS2-GFusion-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGFusion.py
More file actions
5395 lines (4446 loc) · 203 KB
/
GFusion.py
File metadata and controls
5395 lines (4446 loc) · 203 KB
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
import atexit
import ctypes
import ctypes.wintypes
import datetime
import Features.esp
import importlib
import json
import keyboard
import os
import os, re, json, math
import os, sys, json
import platform
import requests
import subprocess
import sys
import threading
import time
from Features.aimbot import start_aim_rcs
from Features.auto_pistol import run_auto_pistol
from Features.bhop import BHopProcess
from Features.fov import FOVChanger
from Features.glow import CS2GlowManager
from Features.triggerbot import TriggerBot
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
from Process import offsets
from Process.config import Config
from PyQt5.QtCore import Qt
from PyQt5.QtCore import Qt, QPoint, QTimer, QThread, pyqtSignal, QEasingCurve, QPropertyAnimation
from PyQt5.QtCore import Qt, QTimer
from PyQt5.QtCore import Qt, QTimer, pyqtSignal
from PyQt5.QtGui import QColor, QFont, QPalette, QFontDatabase
from PyQt5.QtGui import QIcon
from PyQt5.QtGui import QWindow
from PyQt5.QtWidgets import (
QWidget, QGroupBox, QFrame, QVBoxLayout, QHBoxLayout, QLabel, QComboBox,
QPushButton, QScrollArea, QMessageBox, QInputDialog, QFileDialog
)
from PyQt5.QtWidgets import (
QWidget, QVBoxLayout, QHBoxLayout, QLabel, QComboBox,
QCheckBox, QScrollArea
)
from PyQt5.QtWidgets import (
QWidget, QVBoxLayout, QPushButton, QTabWidget, QApplication,
QCheckBox, QComboBox, QSlider, QGroupBox, QLineEdit
)
from PyQt5.QtWidgets import (
QApplication, QWidget, QVBoxLayout, QHBoxLayout, QCheckBox, QSlider,
QLabel, QPushButton, QLineEdit, QComboBox, QTabWidget, QColorDialog,
QGridLayout, QFrame, QScrollArea, QTextEdit, QMessageBox, QGroupBox,
QTableWidget, QDoubleSpinBox, QTableWidgetItem
)
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QTabWidget, QApplication
from PyQt5.QtWidgets import QTabWidget, QGraphicsOpacityEffect
from PyQt5.QtCore import QPropertyAnimation, QEasingCurve
from PyQt5.QtGui import QFontDatabase
try:
from Process.config import Config
except Exception:
class _F: pass
Config = _F()
setattr(Config, "learn_dir", "learn")
setattr(Config, "sensitivity", 0.022)
setattr(Config, "invert_y", -1)
# ========================================
# CRASH PREVENTION & LOGGING SYSTEM
# ========================================
import logging
from logging.handlers import RotatingFileHandler
from PyQt5.QtCore import QObject, pyqtSignal, QMutex, QMutexLocker
class GFusionLogger(QObject):
"""
Thread-safe centralized logging system.
Writes to:
- gfusion_debug.log (rotating file, max 10MB, 3 backups)
- Console tab (if available)
- stdout (for debugging)
"""
log_signal = pyqtSignal(str, str) # (level, message)
_instance = None
_lock = threading.Lock()
def __new__(cls):
if cls._instance is None:
with cls._lock:
if cls._instance is None:
cls._instance = super().__new__(cls)
return cls._instance
def __init__(self):
if '_initialized' in self.__dict__:
return
super().__init__()
self._initialized = True
self._console_tab = None
self._qt_mutex = QMutex()
# Setup file logging
self.logger = logging.getLogger('GFusion')
self.logger.setLevel(logging.DEBUG)
# Rotating file handler (10MB max, 3 backups)
try:
file_handler = RotatingFileHandler(
'gfusion_debug.log',
maxBytes=10*1024*1024, # 10MB
backupCount=3,
encoding='utf-8'
)
file_handler.setLevel(logging.DEBUG)
file_formatter = logging.Formatter(
'[%(asctime)s] [%(levelname)s] [%(threadName)s] %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'
)
file_handler.setFormatter(file_formatter)
self.logger.addHandler(file_handler)
except Exception as e:
print(f"[LOGGER] Failed to create log file: {e}")
# Console handler (for development)
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.INFO)
console_formatter = logging.Formatter('[%(levelname)s] %(message)s')
console_handler.setFormatter(console_formatter)
self.logger.addHandler(console_handler)
self.logger.info("="*60)
self.logger.info("GFusion Logger Initialized")
self.logger.info("="*60)
def set_console_tab(self, console_tab):
"""Register the Console tab for GUI logging."""
with QMutexLocker(self._qt_mutex):
self._console_tab = console_tab
self.logger.info("Console tab registered for GUI logging")
def _format_message(self, level, message, category=""):
"""Format message with category prefix."""
if category:
return f"[{category}] {message}"
return message
def _log_to_console_tab(self, level, message):
"""Send log to Console tab if available (thread-safe)."""
try:
with QMutexLocker(self._qt_mutex):
if self._console_tab and hasattr(self._console_tab, '_log'):
# Use signal to safely cross thread boundary
self.log_signal.emit(level, message)
except Exception as e:
print(f"[LOGGER] Failed to log to console tab: {e}")
def debug(self, message, category=""):
msg = self._format_message("DEBUG", message, category)
self.logger.debug(msg)
self._log_to_console_tab("DEBUG", msg)
def info(self, message, category=""):
msg = self._format_message("INFO", message, category)
self.logger.info(msg)
self._log_to_console_tab("INFO", msg)
def warning(self, message, category=""):
msg = self._format_message("WARNING", message, category)
self.logger.warning(msg)
self._log_to_console_tab("WARNING", msg)
def error(self, message, category="", exc_info=False):
msg = self._format_message("ERROR", message, category)
self.logger.error(msg, exc_info=exc_info)
self._log_to_console_tab("ERROR", msg)
def critical(self, message, category="", exc_info=False):
msg = self._format_message("CRITICAL", message, category)
self.logger.critical(msg, exc_info=exc_info)
self._log_to_console_tab("CRITICAL", msg)
def exception(self, message, category=""):
"""Log exception with full traceback."""
msg = self._format_message("EXCEPTION", message, category)
self.logger.exception(msg)
self._log_to_console_tab("EXCEPTION", msg)
# Global logger instance
logger = GFusionLogger()
# ----------------------------------------
# UI refresher: safely update all tabs
# ----------------------------------------
class UIRefresher(QObject):
"""
Small helper that exposes a Qt signal we can emit from anywhere
(console commands, background threads, etc.) and then perform
a safe, main-thread UI refresh of all registered tabs.
"""
trigger_refresh = pyqtSignal()
def __init__(self, parent=None):
super().__init__(parent)
self.trigger_refresh.connect(self._on_trigger_refresh)
def _on_trigger_refresh(self):
try:
# Uses global TAB_REGISTRY / refresh_all_tabs
refresh_all_tabs()
except Exception as e:
print(f"[UIRefresher] UI refresh failed: {e}")
# Global instance used by console / other helpers
ui_refresher = UIRefresher()
class MenuToggleBridge(QObject):
toggle_menu = pyqtSignal()
def __init__(self, parent=None):
super().__init__(parent)
menu_toggle_bridge = MenuToggleBridge()
def safe_thread_wrapper(func, thread_name="UnknownThread"):
"""
Wrapper for thread functions to catch and log all exceptions.
Prevents threads from silently crashing.
"""
def wrapper(*args, **kwargs):
logger.info(f"Thread started", category=thread_name)
try:
return func(*args, **kwargs)
except Exception as e:
logger.exception(f"Thread crashed: {e}", category=thread_name)
return None
finally:
logger.info(f"Thread stopped", category=thread_name)
return wrapper
def safe_call(func, *args, error_msg="Operation failed", category="", **kwargs):
"""
Safely call a function with error handling and logging.
Returns (success: bool, result: any)
"""
try:
result = func(*args, **kwargs)
return True, result
except Exception as e:
logger.error(f"{error_msg}: {e}", category=category, exc_info=True)
return False, None
def _apply_global_qss(app, font_family=None, font_size=None):
"""
Apply a modern dark + red global stylesheet.
All custom widgets rely on this instead of per-widget Win95 QSS.
This version slightly increases spacing, adds nicer scrollbars,
and cleans up the tab / header look.
Supports runtime font customization via:
- passed params: font_family / font_size
- config fields: cfg.ui_font_family / cfg.ui_font_size (or Config.*)
"""
# --- UI font customization (SAFE: do Python work outside the CSS string) ---
_cfg = globals().get("cfg", None) or globals().get("Config", None)
try:
ff = font_family or getattr(_cfg, "ui_font_family", None) or "Segoe UI"
except Exception:
ff = font_family or "Segoe UI"
try:
fs = int(font_size or getattr(_cfg, "ui_font_size", 11) or 11)
except Exception:
fs = int(font_size or 11)
fs = max(7, min(24, fs)) # clamp
ff_esc = str(ff).replace('"', r'\"') # avoid breaking the CSS string
qss = f"""
/* === Global base === */
QWidget {{
background-color: #080812;
color: #f5f5f7;
font-family: "{ff_esc}", "Segoe UI", "Inter", "Tahoma", sans-serif;
font-size: {fs}px;
}}
QLabel {{
color: #f5f5f7;
}}
/* === Outer shell === */
#outerPanel {{
background-color: qlineargradient(
x1:0, y1:0, x2:1, y2:1,
stop:0 #151520,
stop:1 #11111c
);
border-radius: 14px;
border: 1px solid #26263a;
}}
/* Small header tweaks (safe even if IDs don't exist) */
#headerTitle {{
font-size: 12pt;
font-weight: 700;
letter-spacing: 0.5px;
}}
#headerSubtitle {{
font-size: 8.5pt;
color: #a3a5c0;
}}
/* === Tabs === */
QTabWidget::pane {{
border: none;
top: 0px;
}}
QTabBar {{
qproperty-drawBase: 0;
}}
QTabBar::tab {{
background: transparent;
padding: 8px 16px;
margin-right: 4px;
color: #8a8fa2;
border-bottom: 2px solid transparent;
}}
QTabBar::tab:selected {{
color: #ffffff;
border-bottom: 2px solid #ff3b4a;
}}
QTabBar::tab:hover {{
color: #ffffff;
border-bottom: 2px solid #ff3b4a88;
}}
/* === Group boxes / cards === */
QGroupBox {{
background-color: #181828;
border-radius: 10px;
border: 1px solid #26263a;
margin-top: 10px;
padding: 10px;
font-weight: 600;
}}
QGroupBox::title {{
subcontrol-origin: margin;
left: 12px;
padding: 0 4px;
color: #ffffff;
background-color: transparent;
}}
/* === Buttons === */
QPushButton {{
background-color: #1f1f2b;
border-radius: 9px;
border: 1px solid #2b2b3c;
padding: 7px 10px;
min-height: 22px;
color: #f5f5f7;
}}
QPushButton:hover {{
background-color: #282838;
border-color: #ff3b4a;
}}
QPushButton:pressed {{
background-color: #ff3b4a;
border-color: #ff3b4a;
color: #ffffff;
}}
QPushButton:disabled {{
background-color: #101018;
color: #5c5f74;
border-color: #202030;
}}
/* === Checkboxes === */
QCheckBox {{
spacing: 6px;
}}
QCheckBox::indicator {{
width: 16px;
height: 16px;
border-radius: 4px;
border: 1px solid #3a3a4d;
background-color: #151520;
}}
QCheckBox::indicator:hover {{
border-color: #ff3b4a;
}}
QCheckBox::indicator:checked {{
background-color: #ff3b4a;
border-color: #ff3b4a;
}}
/* === Combobox === */
QComboBox {{
background-color: #151520;
border-radius: 6px;
border: 1px solid #2b2b3c;
padding: 4px 8px;
color: #f5f5f7;
}}
QComboBox:hover {{
border-color: #ff3b4a;
}}
QComboBox::drop-down {{
border: none;
width: 18px;
}}
QComboBox::down-arrow {{
image: none;
width: 0;
height: 0;
border-left: 5px solid #f5f5f7;
border-top: 4px solid transparent;
border-bottom: 4px solid transparent;
margin-right: 4px;
}}
/* === Sliders === */
QSlider::groove:horizontal {{
height: 6px;
background: #2a2a3a;
border-radius: 3px;
margin: 0px 0;
}}
QSlider::sub-page:horizontal {{
background: qlineargradient(
x1:0, y1:0, x2:1, y2:0,
stop:0 #ff3b4a,
stop:1 #ff5164
);
border-radius: 3px;
}}
QSlider::add-page:horizontal {{
background: #202030;
border-radius: 3px;
}}
QSlider::handle:horizontal {{
width: 16px;
height: 16px;
margin: -6px 0;
border-radius: 8px;
background-color: #ff3b4a;
border: 1px solid #ff6b75;
}}
QSlider::handle:horizontal:hover {{
background-color: #ff4e5c;
border: 1px solid #ff7f89;
}}
QSlider::handle:horizontal:pressed {{
background-color: #ff2e3b;
border: 1px solid #ff606b;
}}
/* === Scroll areas === */
QScrollArea {{
background: transparent;
border: none;
}}
/* === Scrollbars === */
QScrollBar:vertical {{
width: 10px;
background: transparent;
margin: 0px;
}}
QScrollBar::handle:vertical {{
background: #2a2a3a;
border-radius: 5px;
min-height: 30px;
}}
QScrollBar::handle:vertical:hover {{
background: #343449;
}}
QScrollBar::add-line:vertical,
QScrollBar::sub-line:vertical {{
height: 0px;
border: none;
background: transparent;
}}
QScrollBar:horizontal {{
height: 10px;
background: transparent;
margin: 0px;
}}
QScrollBar::handle:horizontal {{
background: #2a2a3a;
border-radius: 5px;
min-width: 30px;
}}
QScrollBar::handle:horizontal:hover {{
background: #343449;
}}
QScrollBar::add-line:horizontal,
QScrollBar::sub-line:horizontal {{
width: 0px;
border: none;
background: transparent;
}}
/* === Edits === */
QLineEdit, QTextEdit, QPlainTextEdit {{
background-color: #151520;
border-radius: 6px;
border: 1px solid #2b2b3c;
padding: 4px 8px;
color: #f5f5f7;
}}
QLineEdit:focus, QTextEdit:focus, QPlainTextEdit:focus {{
border-color: #ff3b4a;
}}
/* === Tables === */
QTableWidget {{
background-color: #151520;
gridline-color: #26263a;
border-radius: 8px;
border: 1px solid #26263a;
}}
QHeaderView::section {{
background-color: #1c1c28;
color: #f5f5f7;
padding: 4px 8px;
border: none;
border-bottom: 1px solid #26263a;
}}
/* Startup overlay */
#startupOverlay {{
background-color: rgba(7, 7, 12, 230);
border-radius: 14px;
}}
#startupTitle {{
font-size: 20px;
font-weight: 700;
}}
#startupSubtitle {{
font-size: 11px;
color: #b0b2c8;
}}
/* Tiny square ESP color buttons */
#espColorButton {{
min-width: 16px;
max-width: 16px;
min-height: 16px;
max-height: 16px;
padding: 0; /* overrides the global 7px padding */
border-radius: 4px;
border: 1px solid #3a3a4d;
}}
#espColorButton:hover {{
border-color: #ff3b4a;
}}
#espColorButton:pressed {{
border-color: #ff3b4a;
}}
"""
app.setStyleSheet(qss)
# Force re-polish so runtime font changes actually propagate even for widgets
# that cache font metrics or were created before the stylesheet update.
try:
for w in app.allWidgets():
try:
st = w.style()
st.unpolish(w)
st.polish(w)
w.update()
except Exception:
pass
app.processEvents()
except Exception:
pass
def check_admin_privileges():
"""Check if running as administrator and request elevation if not"""
import ctypes
import sys
import os
try:
is_admin = ctypes.windll.shell32.IsUserAnAdmin()
except:
is_admin = False
if not is_admin:
try:
print("GFusion requires Administrator privileges for kernel mode support...")
print("Requesting elevation...")
ctypes.windll.shell32.ShellExecuteW(
None,
"runas",
sys.executable,
f'"{os.path.abspath(__file__)}"',
None,
1
)
sys.exit(0)
except Exception as e:
print(f"Failed to elevate privileges: {e}")
print("Continuing without administrator rights (kernel mode unavailable)")
return False
print("[OK] Running with Administrator privileges - Kernel mode available")
return True
def create_section_separator():
"""Create a horizontal line separator"""
line = QFrame()
line.setFrameShape(QFrame.HLine)
line.setFrameShadow(QFrame.Sunken)
return line
def get_offsets():
from Process import offsets
return offsets.Offsets
def handle_console_command(cmd_line: str):
"""Parse and execute console commands"""
try:
parts = cmd_line.strip().split()
if not parts:
return
cmd = parts[0].lower()
args = parts[1:]
if cmd == "toggle" and len(args) >= 2:
feature, state_str = args[0].lower(), args[1].lower()
state = state_str in ("1", "true", "on", "enable")
def update_feature_state():
if feature == "aimbot":
cfg.enabled = state
if state: start_aimbot_thread()
else: stop_aimbot_thread()
elif feature == "glow":
cfg.glow = state
if state: start_glow_thread()
else: stop_glow_thread()
elif feature == "bhop":
cfg.bhop_enabled = state
if state: start_bhop_thread()
else: stop_bhop_thread()
elif feature == "triggerbot":
cfg.triggerbot_enabled = state
if state: start_triggerbot_thread()
else: stop_triggerbot_thread()
elif feature == "walkbot":
cfg.walkbot_enabled = state
if state: start_walkbot_thread()
else: stop_walkbot_thread()
print(f"[Console] {feature} set to {state}")
QTimer.singleShot(0, update_feature_state)
elif cmd == "set" and len(args) >= 2:
key, value = args[0], " ".join(args[1:])
if hasattr(cfg, key):
old_val = getattr(cfg, key)
try:
if isinstance(old_val, bool):
new_val = value.lower() in ("1", "true", "on", "enable")
elif isinstance(old_val, int):
new_val = int(value)
elif isinstance(old_val, float):
new_val = float(value)
else:
new_val = value
QTimer.singleShot(0, lambda k=key, v=new_val: setattr(cfg, k, v))
print(f"[Console] {key} scheduled update to {new_val}")
except Exception as e:
print(f"[Console] Failed to set {key}: {e}")
else:
print(f"[Console] Unknown config key: {key}")
else:
print(f"[Console] Unknown command: {cmd}")
finally:
# Always try to refresh the UI after a console command,
# but never let a refresh failure crash the app.
try:
refresher = globals().get("ui_refresher", None)
if refresher is not None and hasattr(refresher, "trigger_refresh"):
refresher.trigger_refresh.emit()
except Exception as e:
print(f"[Console] UI refresh failed: {e}")
def key_to_vk(key_name):
return VK_CODES.get(key_name.lower(), 0x7B)
def refresh_all_tabs():
for tab in TAB_REGISTRY:
try:
if hasattr(tab, "refresh_ui"):
tab.refresh_ui()
except Exception as e:
print(f"[UI] Refresh failed for {tab}: {e}")
def register_tab(tab):
if tab not in TAB_REGISTRY:
TAB_REGISTRY.append(tab)
def reload_offsets_and_restart_threads():
"""Reload offsets.py and restart feature threads safely."""
try:
importlib.reload(offsets)
print("[Offsets] Reloaded offsets.py")
except Exception as e:
print(f"[Offsets] Failed to reload: {e}")
return
def restart():
time.sleep(2)
try:
stop_esp_thread()
stop_aimbot_thread()
stop_triggerbot_thread()
stop_glow_thread()
stop_bhop_thread()
except Exception as e:
print(f"[Offsets] Error stopping threads: {e}")
try:
start_esp_thread()
start_aimbot_thread()
start_triggerbot_thread()
start_glow_thread()
start_bhop_thread()
print("[Offsets] All threads restarted")
except Exception as e:
print(f"[Offsets] Error restarting threads: {e}")
threading.Thread(target=restart, daemon=True).start()
def run():
logger.info("="*60, category="System")
logger.info("GFusion Starting", category="System")
logger.info("="*60, category="System")
is_admin = check_admin_privileges()
print("Made by GitHub.com/Cr0mb/")
if is_admin:
print("[ADMIN] Administrator Mode - Full kernel access enabled")
logger.info("Running with administrator privileges", category="System")
else:
print("[WARNING] User Mode - Limited to usermode memory access")
logger.warning("Running without administrator privileges", category="System")
app = QApplication(sys.argv)
# Install global exception handler for Qt
def qt_exception_handler(exc_type, exc_value, exc_traceback):
"""Global exception handler for unhandled Qt exceptions."""
if issubclass(exc_type, KeyboardInterrupt):
sys.__excepthook__(exc_type, exc_value, exc_traceback)
return
logger.critical(
f"Unhandled exception: {exc_type.__name__}: {exc_value}",
category="System",
exc_info=(exc_type, exc_value, exc_traceback)
)
sys.excepthook = qt_exception_handler
logger.info("Global exception handler installed", category="System")
# Apply global stylesheet
_apply_global_qss(app, getattr(cfg, 'ui_font_family', None), getattr(cfg, 'ui_font_size', None))
try:
win = MainWindow()
logger.info("MainWindow created successfully", category="System")
except Exception as e:
logger.critical(f"Failed to create MainWindow: {e}", category="System", exc_info=True)
return
base_title = "GFusion V1 - Paint Edition"
if is_admin:
win.setWindowTitle(f"{base_title} - Administrator")
else:
win.setWindowTitle(f"{base_title} - User Mode")
win.show()
logger.info("MainWindow shown", category="System")
# Start feature threads
logger.info("Starting feature threads", category="System")
start_aimbot_thread()
start_esp_thread()
start_triggerbot_thread()
start_auto_pistol_thread()
logger.info("Feature threads started", category="System")
start_toggle_listener(win)
# Register shutdown handler to prevent daemon thread errors
def cleanup_on_exit():
"""Suppress daemon thread output during shutdown"""
logger.info("Application shutting down", category="System")
try:
sys.stdout = open(os.devnull, 'w')
sys.stderr = open(os.devnull, 'w')
except:
pass
atexit.register(cleanup_on_exit)
logger.info("Entering Qt event loop", category="System")
app.exec_()
def run_aimbot():
logger.info("Starting aimbot", category="Aimbot")
try:
start_aim_rcs(cfg)
except Exception as e:
logger.exception(f"Aimbot crashed: {e}", category="Aimbot")
def run_bhop():
global bhop_instance
logger.info("Starting bhop", category="BHop")
try:
bhop_instance = BHopProcess()
bhop_instance.run()
except Exception as e:
logger.exception(f"BHop crashed: {e}", category="BHop")
def run_esp():
global esp_running
if esp_running:
logger.warning("ESP already running, skipping duplicate start", category="ESP")
return
esp_running = True
logger.info("Starting ESP", category="ESP")
try:
Features.esp.main()
except Exception as e:
logger.exception(f"ESP crashed: {e}", category="ESP")
finally:
esp_running = False
logger.info("ESP stopped", category="ESP")
def run_fov():
global fov_changer
logger.info("Starting FOV changer", category="FOV")
try:
fov_changer = FOVChanger(cfg)
fov_changer.run()
except Exception as e:
logger.exception(f"FOV changer crashed: {e}", category="FOV")
def run_glow():
global glow_manager
logger.info("Starting glow", category="Glow")
try:
glow_manager = CS2GlowManager(cfg)
glow_manager.run()
except Exception as e:
logger.exception(f"Glow crashed: {e}", category="Glow")
def run_radar():
global radar_app
logger.info("Starting radar overlay", category="Radar")
try:
# local import so GFusion still launches even if radar.py isn't present
from radar import RadarApp # type: ignore
except Exception:
try:
from Features.radar import RadarApp # type: ignore
except Exception as e:
logger.error(f"Radar module not found: {e}", category="Radar", exc_info=True)
return
try:
radar_app = RadarApp(title="GFusion Radar", cfg_ref=Config)
radar_app.start()
except Exception as e:
logger.exception(f"Radar crashed: {e}", category="Radar")
def run_triggerbot():
global triggerbot_instance
logger.info("Starting triggerbot", category="Triggerbot")
try:
triggerbot_instance = TriggerBot(shared_config=cfg)
triggerbot_instance.run()
except Exception as e:
logger.exception(f"Triggerbot crashed: {e}", category="Triggerbot")
def run_walkbot():
logger.info("Starting walkbot", category="Walkbot")
try:
from Features.walk_bot import walk_in_circle
walk_in_circle()
except Exception as e:
logger.exception(f"Walkbot crashed: {e}", category="Walkbot")
def start_aimbot_thread():
global aimbot_thread
try:
if aimbot_thread is None or not aimbot_thread.is_alive():
cfg.aim_stop = False
aimbot_thread = threading.Thread(target=run_aimbot, daemon=True, name="AimbotThread")
aimbot_thread.start()
logger.info("Aimbot thread started", category="Threading")
else:
logger.debug("Aimbot thread already running", category="Threading")
except Exception as e:
logger.error(f"Failed to start aimbot thread: {e}", category="Threading", exc_info=True)
def start_auto_pistol_thread():
global auto_pistol_thread
try:
if not cfg.auto_pistol_enabled:
logger.debug("Auto pistol not enabled", category="Threading")
return
if auto_pistol_thread is None or not auto_pistol_thread.is_alive():
auto_pistol_thread = threading.Thread(target=run_auto_pistol, args=(cfg,), daemon=True, name="AutoPistolThread")
auto_pistol_thread.start()
logger.info("Auto pistol thread started", category="Threading")
except Exception as e:
logger.error(f"Failed to start auto pistol thread: {e}", category="Threading", exc_info=True)
def start_bhop_thread():
global bhop_thread
try:
if bhop_thread is None or not bhop_thread.is_alive():
Config.bhop_stop = False
Config.bhop_enabled = True
bhop_thread = threading.Thread(target=run_bhop, daemon=True, name="BHopThread")
bhop_thread.start()
logger.info("BHop thread started", category="Threading")
except Exception as e:
logger.error(f"Failed to start bhop thread: {e}", category="Threading", exc_info=True)
def start_esp_thread():
global esp_thread
try:
if esp_thread is None or not esp_thread.is_alive():
esp_thread = threading.Thread(target=run_esp, daemon=True, name="ESPThread")
esp_thread.start()
logger.info("ESP thread started", category="Threading")
except Exception as e:
logger.error(f"Failed to start ESP thread: {e}", category="Threading", exc_info=True)
def start_fov_thread():
global fov_thread
try:
if fov_thread is None or not fov_thread.is_alive():
cfg.fov_changer_enabled = True
fov_thread = threading.Thread(target=run_fov, daemon=True, name="FOVThread")
fov_thread.start()
logger.info("FOV thread started", category="Threading")
except Exception as e:
logger.error(f"Failed to start FOV thread: {e}", category="Threading", exc_info=True)
def start_glow_thread():