Skip to content

Commit c334091

Browse files
authored
Add files via upload
1 parent 71e70b1 commit c334091

File tree

1 file changed

+70
-67
lines changed

1 file changed

+70
-67
lines changed

SingleFile/main.cpp

Lines changed: 70 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -90,28 +90,32 @@ __forceinline I v(void* iface, unsigned int index) { return (I)((*(unsigned int*
9090
using matrix_t = float[3][4];
9191
using matrix4x4_t = float[4][4];
9292
// config system
93-
unsigned long long config;
9493
bool menu_open = true;
95-
enum {
96-
BHOP = 1,
97-
AUTOPISTOL = 2,
98-
HITSOUND = 4,
99-
BOX_ESP = 8,
100-
NAME_ESP = 16,
101-
HEALTH_BAR = 32,
102-
ESP_TEAM = 64,
103-
SPECTATOR_LIST = 128,
104-
DISABLE_POSTPROCESS = 256,
105-
ESP_DORMANT = 512,
106-
NOSCOPE_CROSSHAIR = 1024,
107-
RECOIL_CROSSHAIR = 2048,
108-
DEAD_ESP = 4096,
109-
AUTO_ACCEPT = 8192,
110-
TRIGGERBOT = 16384,
111-
GAMEKEYBOARD = 32768,
112-
RADAR = 65536,
113-
BROKEN = 131702, // do not assign this to anything
114-
};
94+
struct sconfig {
95+
struct saim {
96+
bool m_bTriggerbot;
97+
bool m_bAutoPistol;
98+
}aimbot;
99+
struct svisuals {
100+
bool m_bBoxESP;
101+
bool m_bNameESP;
102+
bool m_bHealthBar;
103+
bool m_bTargetTeam;
104+
bool m_bDormanyCheck;
105+
bool m_bOnlyOnDead;
106+
bool m_bRadar;
107+
bool m_bDisablePostProcess;
108+
}visuals;
109+
struct smisc {
110+
bool m_bBhop;
111+
bool m_bHitSound;
112+
bool m_bNoScopeCrosshair;
113+
bool m_bRecoilCrosshair;
114+
bool m_bAutoAccept;
115+
bool m_bGameKeyboard;
116+
bool m_bSpectatorList;
117+
}misc;
118+
}config;
115119
class vec3 {
116120
public:
117121
float x, y, z;
@@ -422,16 +426,14 @@ bool IsMouseInRegion(int x, int y, int w, int h) {
422426
#include <iostream>
423427
#include <fstream>
424428
void load() { // not proud of using cpp here, but line count matters...
425-
std::ifstream ss;
426-
ss.open("singlefile.cfg");
427-
if (!ss.good())
428-
return;
429-
ss >> config;
429+
FILE* cfg = fopen("singlefile.cfg", "r");
430+
fread(&config, sizeof(config), 1, cfg);
431+
fclose(cfg);
430432
}
431433
void save() {
432-
std::ofstream ss;
433-
ss.open("singlefile.cfg");
434-
ss << config;
434+
FILE* cfg = fopen("singlefile.cfg", "w");
435+
fwrite(&config, sizeof(config), 1, cfg);
436+
fclose(cfg);
435437
}
436438
namespace menu {
437439
unsigned long font, esp;
@@ -468,12 +470,12 @@ namespace menu {
468470
interfaces.surface->DrawFilledRect(x_pos - 5, rpos + 26, 1, vheight - 60 + 24);
469471
y_pos = rpos + 25;
470472
}
471-
void checkbox(const wchar_t* name, unsigned long long* config, unsigned long long option) {
473+
void checkbox(const wchar_t* name, bool* option) {
472474
interfaces.surface->SetColor(27, 27, 27, 255);
473475
interfaces.surface->DrawRectOutline(x_pos, y_pos, 12, 12);
474476
interfaces.surface->SetColor(37, 37, 38, 255);
475477
interfaces.surface->DrawFilledRect(x_pos + 1, y_pos + 1, 10, 10);
476-
if (*config & option) {
478+
if (*option) {
477479
interfaces.surface->SetColor(25, 100, 255, 255);
478480
interfaces.surface->DrawFilledRect(x_pos + 1, y_pos + 1, 10, 10);
479481
}
@@ -482,7 +484,7 @@ namespace menu {
482484
interfaces.surface->SetTextFont(menu::font);
483485
interfaces.surface->DrawText(name, wcslen(name));
484486
if (IsMouseInRegion(x_pos, y_pos, 12, 12) && GetAsyncKeyState(VK_LBUTTON) & 1 && GetAsyncKeyState(VK_LBUTTON))
485-
*config ^= option;
487+
*option = !(*option);
486488
y_pos += 15;
487489
}
488490
bool button(const wchar_t* name, vec2 pos, vec2 size) {
@@ -511,25 +513,25 @@ void SetupFonts() {
511513
}
512514
void RenderMenu() {
513515
menu::window(L"singlefile csgo internal", { 50, 50 }, { 420, 260 });
514-
menu::checkbox(L"bhop", &config, BHOP);
515-
menu::checkbox(L"auto pistol", &config, AUTOPISTOL);
516-
menu::checkbox(L"hitsound", &config, HITSOUND);
517-
menu::checkbox(L"box esp", &config, BOX_ESP);
518-
menu::checkbox(L"name esp", &config, NAME_ESP);
519-
menu::checkbox(L"health bar", &config, HEALTH_BAR);
520-
menu::checkbox(L"dormant esp", &config, ESP_DORMANT);
521-
menu::checkbox(L"team esp", &config, ESP_TEAM);
522-
menu::checkbox(L"spectator list", &config, SPECTATOR_LIST);
523-
menu::checkbox(L"disable post process", &config, DISABLE_POSTPROCESS);
524-
menu::checkbox(L"noscope crosshair", &config, NOSCOPE_CROSSHAIR);
525-
menu::checkbox(L"recoil crosshair", &config, RECOIL_CROSSHAIR);
526-
menu::checkbox(L"auto accept", &config, AUTO_ACCEPT);
516+
menu::checkbox(L"bhop", &config.misc.m_bBhop);
517+
menu::checkbox(L"auto pistol", &config.aimbot.m_bAutoPistol);
518+
menu::checkbox(L"hitsound", &config.misc.m_bHitSound);
519+
menu::checkbox(L"box esp", &config.visuals.m_bBoxESP);
520+
menu::checkbox(L"name esp", &config.visuals.m_bNameESP);
521+
menu::checkbox(L"health bar", &config.visuals.m_bHealthBar);
522+
menu::checkbox(L"dormant esp", &config.visuals.m_bDormanyCheck);
523+
menu::checkbox(L"team esp", &config.visuals.m_bTargetTeam);
524+
menu::checkbox(L"spectator list", &config.misc.m_bSpectatorList);
525+
menu::checkbox(L"disable post process", &config.visuals.m_bDisablePostProcess);
526+
menu::checkbox(L"noscope crosshair", &config.misc.m_bNoScopeCrosshair);
527+
menu::checkbox(L"recoil crosshair", &config.misc.m_bRecoilCrosshair);
528+
menu::checkbox(L"auto accept", &config.misc.m_bAutoAccept);
527529

528530
menu::column(184);
529531

530-
menu::checkbox(L"triggerbot", &config, TRIGGERBOT);
531-
menu::checkbox(L"radar", &config, RADAR);
532-
menu::checkbox(L"disable keyboard in menu", &config, GAMEKEYBOARD);
532+
menu::checkbox(L"triggerbot", &config.aimbot.m_bTriggerbot);
533+
menu::checkbox(L"radar", &config.visuals.m_bRadar);
534+
menu::checkbox(L"disable keyboard in menu", &config.misc.m_bGameKeyboard);
533535

534536
if (menu::button(L"load", {60, 270}, {195, 30}))
535537
load();
@@ -581,7 +583,7 @@ enum {
581583
IN_COUNT = 1 << 26,
582584
};
583585
void bhop(CUserCmd* cmd) {
584-
if (config & BHOP) {
586+
if (config.misc.m_bBhop) {
585587
CBaseEntity* localplayer = interfaces.entitylist->GetEntity(interfaces.engine->GetLocalPlayer());
586588
if (localplayer->GetHealth() == 0)
587589
return;
@@ -593,7 +595,7 @@ void bhop(CUserCmd* cmd) {
593595
}
594596
}
595597
void autopistol(CUserCmd* cmd) {
596-
if (config & AUTOPISTOL) {
598+
if (config.aimbot.m_bAutoPistol) {
597599
CBaseEntity* localplayer = interfaces.entitylist->GetEntity(interfaces.engine->GetLocalPlayer());
598600
if (localplayer->GetHealth() == 0)
599601
return;
@@ -607,7 +609,8 @@ void autopistol(CUserCmd* cmd) {
607609
void autoaccept(const char* sound) {
608610
if (strstr(sound, "UIPanorama.popup_accept_match_beep")) {
609611
static bool(__stdcall * SetLPReady)(const char*) = (decltype(SetLPReady))PatternScan(client_dll, "55 8B EC 83 E4 F8 8B 4D 08 BA ? ? ? ? E8 ? ? ? ? 85 C0 75 12");
610-
SetLPReady("");
612+
if (config.misc.m_bAutoAccept)
613+
SetLPReady("");
611614
}
612615
}
613616
template <typename T>
@@ -699,27 +702,27 @@ void players() {
699702
if (!interfaces.engine->IsInGame())
700703
return;
701704
CBaseEntity* localplayer = interfaces.entitylist->GetEntity(interfaces.engine->GetLocalPlayer());
702-
if (localplayer->GetHealth() > 0 && (config & DEAD_ESP))
705+
if (localplayer->GetHealth() > 0 && (config.visuals.m_bOnlyOnDead))
703706
return;
704707
for (int i = 1; i <= interfaces.engine->GetMaxClients(); i++) {
705708
CBaseEntity* entity = interfaces.entitylist->GetEntity(i);
706709
if (!entity || entity->GetHealth() == 0 || entity->GetClientClass()->m_nClassID != CCSPlayer)
707710
continue;
708-
if (!(config & ESP_TEAM) && entity->GetTeamNumber() == localplayer->GetTeamNumber())
711+
if (!(config.visuals.m_bTargetTeam) && entity->GetTeamNumber() == localplayer->GetTeamNumber())
709712
continue;
710-
if (!(config & ESP_DORMANT) && entity->IsDormant())
713+
if (!(config.visuals.m_bDormanyCheck) && entity->IsDormant())
711714
continue;
712715
bbox box;
713716
if (!getbbot(entity, box))
714717
continue;
715-
if (config & BOX_ESP) {
718+
if (config.visuals.m_bBoxESP) {
716719
interfaces.surface->SetColor(255, 255, 255, 255);
717720
interfaces.surface->DrawRectOutline(box.x, box.y, box.w, box.h);
718721
interfaces.surface->SetColor(0, 0, 0, 255);
719722
interfaces.surface->DrawRectOutline(box.x + 1, box.y + 1, box.w - 2, box.h - 2);
720723
interfaces.surface->DrawRectOutline(box.x - 1, box.y - 1, box.w + 2, box.h + 2);
721724
}
722-
if (config & NAME_ESP) {
725+
if (config.visuals.m_bNameESP) {
723726
interfaces.surface->SetTextColor(255, 255, 255, 255);
724727
interfaces.surface->SetTextFont(menu::font);
725728
unsigned int o, p;
@@ -732,7 +735,7 @@ void players() {
732735
interfaces.surface->DrawText(wname, wcslen(wname));
733736
}
734737
}
735-
if (config & HEALTH_BAR) {
738+
if (config.visuals.m_bHealthBar) {
736739
rgba healthclr;
737740
if (entity->GetHealth() > 100)
738741
healthclr = rgba(0, 255, 0, 255);
@@ -743,15 +746,15 @@ void players() {
743746
interfaces.surface->SetColor(healthclr.r, healthclr.g, healthclr.b, healthclr.a);
744747
interfaces.surface->DrawFilledRect(box.x - 9, box.y + box.h - ((box.h * (entity->GetHealth() / 100.f))), 3, (box.h * entity->GetHealth() / 100.f) + (entity->GetHealth() == 100 ? 0 : 1));
745748
}
746-
if (config & RADAR)
749+
if (config.visuals.m_bRadar)
747750
entity->Spotted() = true;
748751
}
749752
}
750753
void cvars() {
751754
CBaseEntity* localplayer = interfaces.entitylist->GetEntity(interfaces.engine->GetLocalPlayer());
752-
interfaces.cvar->FindVar("mat_postprocess_enable")->SetValue(config & DISABLE_POSTPROCESS ? 0 : 1);
753-
interfaces.cvar->FindVar("cl_crosshair_recoil")->SetValue(config & RECOIL_CROSSHAIR ? 1 : 0); // i'm sure the ? 1 : 0 doesn't matter but this feels better. /shrug
754-
interfaces.cvar->FindVar("weapon_debug_spread_show")->SetValue(((config & NOSCOPE_CROSSHAIR) && !localplayer->IsScoped()) ? 2 : 0);
755+
interfaces.cvar->FindVar("mat_postprocess_enable")->SetValue(config.visuals.m_bDisablePostProcess ? 0 : 1);
756+
interfaces.cvar->FindVar("cl_crosshair_recoil")->SetValue(config.misc.m_bRecoilCrosshair ? 1 : 0); // i'm sure the ? 1 : 0 doesn't matter but this feels better. /shrug
757+
interfaces.cvar->FindVar("weapon_debug_spread_show")->SetValue(((config.misc.m_bNoScopeCrosshair) && !localplayer->IsScoped()) ? 2 : 0);
755758
if (localplayer->GetHealth() < 0 && localplayer->GetObserverTarget())
756759
localplayer->ObserverMode() = 5;
757760
else
@@ -764,7 +767,7 @@ void speclist() {
764767
CBaseEntity* localplayer = interfaces.entitylist->GetEntity(interfaces.engine->GetLocalPlayer());
765768
if (!localplayer)
766769
return;
767-
if (config & SPECTATOR_LIST) {
770+
if (config.misc.m_bSpectatorList) {
768771
for (int i = 1; i <= interfaces.engine->GetMaxClients(); i++) {
769772
CBaseEntity* entity = interfaces.entitylist->GetEntity(i);
770773
if (!entity || entity->GetHealth() > 0 || !entity->GetObserverTarget())
@@ -788,7 +791,7 @@ void speclist() {
788791
b = 0;
789792
}
790793
void triggerbot(CUserCmd* cmd) {
791-
if (!(config & TRIGGERBOT))
794+
if (!(config.aimbot.m_bTriggerbot))
792795
return;
793796
CBaseEntity* lp = interfaces.entitylist->GetEntity(interfaces.engine->GetLocalPlayer());
794797
if (!lp || (lp->GetHealth() < 1) || !lp->CrosshairTarget())
@@ -816,7 +819,7 @@ void __stdcall _EmitSound(void* filter, int entityIndex, int channel, const char
816819
return EmitSoundOriginal(filter, entityIndex, channel, soundEntry, soundEntryHash, sample, volume, seed, soundLevel, flags, pitch, origin, direction, utlVecOrigins, updatePositions, soundtime, speakerentity, soundParams);
817820
}
818821
bool __stdcall _GameEvents(IGameEvent* event) {
819-
if (config & HITSOUND) {
822+
if (config.misc.m_bHitSound) {
820823
if (strstr(event->GetName(), "player_hurt")) {
821824
SPlayerInfo player;
822825
interfaces.engine->GetPlayerInfo(interfaces.engine->GetLocalPlayer(), &player);
@@ -836,7 +839,7 @@ void __stdcall _PaintTraverse(unsigned int panel, bool m_bForceRepaint, bool m_b
836839
}
837840
if (drawing == fnv::hash("FocusOverlayPanel")) {
838841
interfaces.panel->SetInputMouseState(panel, menu_open);
839-
interfaces.panel->SetInputKeyboardState(panel, menu_open && (config & GAMEKEYBOARD));
842+
interfaces.panel->SetInputKeyboardState(panel, menu_open && (config.misc.m_bGameKeyboard));
840843
}
841844
return PaintTraverseOriginal(interfaces.panel, panel, m_bForceRepaint, m_bAllowRepaint);
842845
}
@@ -863,7 +866,7 @@ void __stdcall Init (HMODULE mod) {
863866
AllocConsole();
864867
SetConsoleTitleA("singlefile: console");
865868
freopen_s((FILE**)stdout, "CONOUT$", "w", stdout);
866-
printf("singlefile v1.1: loading... (compiled with %d lines of code)\n", GetLineCount());
869+
printf("singlefile v1.1.1: loading... (compiled with %d lines of code)\n", GetLineCount());
867870
csgo_window = FindWindowA("Valve001", nullptr);
868871
orig_proc = (WNDPROC)SetWindowLongA(csgo_window, GWLP_WNDPROC, (LONG)Wndproc);
869872
client_dll = GetModuleHandleA("client.dll");
@@ -872,7 +875,7 @@ void __stdcall Init (HMODULE mod) {
872875
void* vgui2_dll = GetModuleHandleA("vgui2.dll");
873876
void* vstdlib_dll = GetModuleHandleA("vstdlib.dll");
874877
interfaces.engine = CreateInterface<IVEngineClient*>(engine_dll, "VEngineClient014");
875-
if (!strstr(interfaces.engine->GetVersionString(), "1.37.8.5"))
878+
if (!strstr(interfaces.engine->GetVersionString(), "1.37.8.6"))
876879
printf("note: you are using an unknown cs:go client version (%s). if you are expierencing crashes, you may need to update offsets. each offset in the source code has it's netvar name, or you can find it on hazedumper.\n", interfaces.engine->GetVersionString());
877880
interfaces.entitylist = CreateInterface<CBaseEntityList*>(client_dll, "VClientEntityList003");
878881
interfaces.surface = CreateInterface<CMatSystemSurface*>(surface_dll, "VGUI_Surface031");

0 commit comments

Comments
 (0)