├── .gitignore ├── CSGOSimple.DotSettings ├── CSGOSimple.sln ├── CSGOSimple.sln.DotSettings ├── CSGOSimple ├── CSGOSimple.vcxproj ├── CSGOSimple.vcxproj.filters ├── UI.cpp ├── config.hpp ├── features │ ├── bhop.cpp │ ├── bhop.hpp │ ├── chams.cpp │ ├── chams.hpp │ ├── glow.cpp │ ├── glow.hpp │ ├── visuals.cpp │ └── visuals.hpp ├── fonts │ ├── cousine.hpp │ ├── droid.hpp │ └── fonts.hpp ├── helpers │ ├── input.cpp │ ├── input.hpp │ ├── math.cpp │ ├── math.hpp │ ├── utils.cpp │ ├── utils.hpp │ ├── vfunc_hook.cpp │ └── vfunc_hook.hpp ├── hooks.cpp ├── hooks.hpp ├── imgui │ ├── LICENSE.txt │ ├── imconfig.h │ ├── imgui.cpp │ ├── imgui.h │ ├── imgui_draw.cpp │ ├── imgui_internal.h │ ├── imgui_widgets.cpp │ ├── impl │ │ ├── imgui_impl_dx9.cpp │ │ ├── imgui_impl_dx9.h │ │ ├── imgui_impl_win32.cpp │ │ └── imgui_impl_win32.h │ ├── imstb_rectpack.h │ ├── imstb_textedit.h │ └── imstb_truetype.h ├── main.cpp ├── menu.cpp ├── menu.hpp ├── options.cpp ├── options.hpp ├── render.cpp ├── render.hpp ├── singleton.hpp ├── ui.hpp └── valve_sdk │ ├── csgostructs.cpp │ ├── csgostructs.hpp │ ├── interfaces │ ├── CClientState.hpp │ ├── CInput.hpp │ ├── IAppSystem.hpp │ ├── IBaseClientDll.hpp │ ├── IClientEntity.hpp │ ├── IClientEntityList.hpp │ ├── IClientMode.hpp │ ├── IClientNetworkable.hpp │ ├── IClientRenderable.hpp │ ├── IClientThinkable.hpp │ ├── IClientUnknown.hpp │ ├── ICollideable.hpp │ ├── IConVar.hpp │ ├── ICvar.hpp │ ├── IEngineSound.hpp │ ├── IEngineTrace.hpp │ ├── IGameEventmanager.hpp │ ├── IInputSystem.hpp │ ├── IMDLCache.hpp │ ├── IMaterialSystem.hpp │ ├── IMoveHelper.hpp │ ├── IPanel.hpp │ ├── IPhysics.hpp │ ├── IPrediction.hpp │ ├── IRefCounted.hpp │ ├── IRenderView.hpp │ ├── ISurface.hpp │ ├── IVDebugOverlay.hpp │ ├── IVEngineClient.hpp │ ├── IVModelInfoClient.hpp │ ├── IVModelRender.hpp │ └── IViewRender.hpp │ ├── math │ ├── QAngle.hpp │ ├── VMatrix.cpp │ ├── VMatrix.hpp │ ├── Vector.hpp │ ├── Vector2D.cpp │ ├── Vector2D.hpp │ ├── Vector4D.cpp │ └── Vector4D.hpp │ ├── misc │ ├── BaseHandle.hpp │ ├── CUserCmd.hpp │ ├── ClientClass.hpp │ ├── Color.cpp │ ├── Color.hpp │ ├── Convar.cpp │ ├── Convar.hpp │ ├── EHandle.hpp │ ├── Enums.hpp │ ├── GlobalVars.hpp │ ├── IHandleEntity.hpp │ ├── Recv.hpp │ ├── Studio.hpp │ ├── UtlBuffer.cpp │ ├── UtlBuffer.hpp │ ├── UtlMemory.hpp │ ├── UtlString.cpp │ ├── UtlString.hpp │ ├── UtlVector.hpp │ ├── characterset.cpp │ ├── characterset.hpp │ ├── checksum_crc.cpp │ ├── checksum_crc.hpp │ ├── checksum_md5.cpp │ ├── checksum_md5.hpp │ ├── datamap.hpp │ ├── glow_outline_effect.hpp │ ├── platform.hpp │ └── vfunc.hpp │ ├── netvars.cpp │ ├── netvars.hpp │ ├── sdk.cpp │ └── sdk.hpp ├── LICENSE ├── README.md └── SimpleInjector ├── README.md ├── SimpleInjector.vcxproj ├── SimpleInjector.vcxproj.filters └── main.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]elease(debug)/ 20 | [Rr]eleases/ 21 | x64/ 22 | x86/ 23 | bld/ 24 | [Bb]in/ 25 | [Oo]bj/ 26 | [Ll]og/ 27 | 28 | # Visual Studio 2015 cache/options directory 29 | .vs/ 30 | # Uncomment if you have tasks that create the project's static files in wwwroot 31 | #wwwroot/ 32 | 33 | # MSTest test Results 34 | [Tt]est[Rr]esult*/ 35 | [Bb]uild[Ll]og.* 36 | 37 | # NUNIT 38 | *.VisualState.xml 39 | TestResult.xml 40 | 41 | # Build Results of an ATL Project 42 | [Dd]ebugPS/ 43 | [Rr]eleasePS/ 44 | dlldata.c 45 | 46 | # Benchmark Results 47 | BenchmarkDotNet.Artifacts/ 48 | 49 | # .NET Core 50 | project.lock.json 51 | project.fragment.lock.json 52 | artifacts/ 53 | **/Properties/launchSettings.json 54 | 55 | *_i.c 56 | *_p.c 57 | *_i.h 58 | *.ilk 59 | *.meta 60 | *.obj 61 | *.pch 62 | *.pdb 63 | *.pgc 64 | *.pgd 65 | *.rsp 66 | *.sbr 67 | *.tlb 68 | *.tli 69 | *.tlh 70 | *.tmp 71 | *.tmp_proj 72 | *.log 73 | *.vspscc 74 | *.vssscc 75 | .builds 76 | *.pidb 77 | *.svclog 78 | *.scc 79 | 80 | # Chutzpah Test files 81 | _Chutzpah* 82 | 83 | # Visual C++ cache files 84 | ipch/ 85 | *.aps 86 | *.ncb 87 | *.opendb 88 | *.opensdf 89 | *.sdf 90 | *.cachefile 91 | *.VC.db 92 | *.VC.VC.opendb 93 | 94 | # Visual Studio profiler 95 | *.psess 96 | *.vsp 97 | *.vspx 98 | *.sap 99 | 100 | # TFS 2012 Local Workspace 101 | $tf/ 102 | 103 | # Guidance Automation Toolkit 104 | *.gpState 105 | 106 | # ReSharper is a .NET coding add-in 107 | _ReSharper*/ 108 | *.[Rr]e[Ss]harper 109 | *.DotSettings.user 110 | 111 | # JustCode is a .NET coding add-in 112 | .JustCode 113 | 114 | # TeamCity is a build add-in 115 | _TeamCity* 116 | 117 | # DotCover is a Code Coverage Tool 118 | *.dotCover 119 | 120 | # Visual Studio code coverage results 121 | *.coverage 122 | *.coveragexml 123 | 124 | # NCrunch 125 | _NCrunch_* 126 | .*crunch*.local.xml 127 | nCrunchTemp_* 128 | 129 | # MightyMoose 130 | *.mm.* 131 | AutoTest.Net/ 132 | 133 | # Web workbench (sass) 134 | .sass-cache/ 135 | 136 | # Installshield output folder 137 | [Ee]xpress/ 138 | 139 | # DocProject is a documentation generator add-in 140 | DocProject/buildhelp/ 141 | DocProject/Help/*.HxT 142 | DocProject/Help/*.HxC 143 | DocProject/Help/*.hhc 144 | DocProject/Help/*.hhk 145 | DocProject/Help/*.hhp 146 | DocProject/Help/Html2 147 | DocProject/Help/html 148 | 149 | # Click-Once directory 150 | publish/ 151 | 152 | # Publish Web Output 153 | *.[Pp]ublish.xml 154 | *.azurePubxml 155 | # TODO: Comment the next line if you want to checkin your web deploy settings 156 | # but database connection strings (with potential passwords) will be unencrypted 157 | *.pubxml 158 | *.publishproj 159 | 160 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 161 | # checkin your Azure Web App publish settings, but sensitive information contained 162 | # in these scripts will be unencrypted 163 | PublishScripts/ 164 | 165 | # NuGet Packages 166 | *.nupkg 167 | # The packages folder can be ignored because of Package Restore 168 | **/packages/* 169 | # except build/, which is used as an MSBuild target. 170 | !**/packages/build/ 171 | # Uncomment if necessary however generally it will be regenerated when needed 172 | #!**/packages/repositories.config 173 | # NuGet v3's project.json files produces more ignorable files 174 | *.nuget.props 175 | *.nuget.targets 176 | 177 | # Microsoft Azure Build Output 178 | csx/ 179 | *.build.csdef 180 | 181 | # Microsoft Azure Emulator 182 | ecf/ 183 | rcf/ 184 | 185 | # Windows Store app package directories and files 186 | AppPackages/ 187 | BundleArtifacts/ 188 | Package.StoreAssociation.xml 189 | _pkginfo.txt 190 | *.appx 191 | 192 | # Visual Studio cache files 193 | # files ending in .cache can be ignored 194 | *.[Cc]ache 195 | # but keep track of directories ending in .cache 196 | !*.[Cc]ache/ 197 | 198 | # Others 199 | ClientBin/ 200 | ~$* 201 | *~ 202 | *.dbmdl 203 | *.dbproj.schemaview 204 | *.jfm 205 | *.pfx 206 | *.publishsettings 207 | orleans.codegen.cs 208 | 209 | # Since there are multiple workflows, uncomment next line to ignore bower_components 210 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 211 | #bower_components/ 212 | 213 | # RIA/Silverlight projects 214 | Generated_Code/ 215 | 216 | # Backup & report files from converting an old project file 217 | # to a newer Visual Studio version. Backup files are not needed, 218 | # because we have git ;-) 219 | _UpgradeReport_Files/ 220 | Backup*/ 221 | UpgradeLog*.XML 222 | UpgradeLog*.htm 223 | 224 | # SQL Server files 225 | *.mdf 226 | *.ldf 227 | *.ndf 228 | 229 | # Business Intelligence projects 230 | *.rdl.data 231 | *.bim.layout 232 | *.bim_*.settings 233 | 234 | # Microsoft Fakes 235 | FakesAssemblies/ 236 | 237 | # GhostDoc plugin setting file 238 | *.GhostDoc.xml 239 | 240 | # Node.js Tools for Visual Studio 241 | .ntvs_analysis.dat 242 | node_modules/ 243 | 244 | # Typescript v1 declaration files 245 | typings/ 246 | 247 | # Visual Studio 6 build log 248 | *.plg 249 | 250 | # Visual Studio 6 workspace options file 251 | *.opt 252 | 253 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 254 | *.vbw 255 | 256 | # Visual Studio LightSwitch build output 257 | **/*.HTMLClient/GeneratedArtifacts 258 | **/*.DesktopClient/GeneratedArtifacts 259 | **/*.DesktopClient/ModelManifest.xml 260 | **/*.Server/GeneratedArtifacts 261 | **/*.Server/ModelManifest.xml 262 | _Pvt_Extensions 263 | 264 | # Paket dependency manager 265 | .paket/paket.exe 266 | paket-files/ 267 | 268 | # FAKE - F# Make 269 | .fake/ 270 | 271 | # JetBrains Rider 272 | .idea/ 273 | *.sln.iml 274 | 275 | # CodeRush 276 | .cr/ 277 | 278 | # Python Tools for Visual Studio (PTVS) 279 | __pycache__/ 280 | *.pyc 281 | 282 | # Cake - Uncomment if you are using it 283 | # tools/** 284 | # !tools/packages.config 285 | 286 | # Tabs Studio 287 | *.tss 288 | 289 | # Telerik's JustMock configuration file 290 | *.jmconfig 291 | 292 | # BizTalk build output 293 | *.btp.cs 294 | *.btm.cs 295 | *.odx.cs 296 | *.xsd.cs -------------------------------------------------------------------------------- /CSGOSimple.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | NEXT_LINE 3 | True 4 | END_OF_LINE 5 | False 6 | False 7 | False 8 | False 9 | True -------------------------------------------------------------------------------- /CSGOSimple.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSGOSimple", "CSGOSimple\CSGOSimple.vcxproj", "{F3E42845-8D56-4BB3-821D-8163AB1337F0}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleInjector", "SimpleInjector\SimpleInjector.vcxproj", "{D6A5475A-A3D9-4971-B971-A94520CB0354}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|x64 = Debug|x64 13 | Debug|x86 = Debug|x86 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {F3E42845-8D56-4BB3-821D-8163AB1337F0}.Debug|x64.ActiveCfg = Debug|Win32 19 | {F3E42845-8D56-4BB3-821D-8163AB1337F0}.Debug|x86.ActiveCfg = Debug|Win32 20 | {F3E42845-8D56-4BB3-821D-8163AB1337F0}.Debug|x86.Build.0 = Debug|Win32 21 | {F3E42845-8D56-4BB3-821D-8163AB1337F0}.Release|x64.ActiveCfg = Release|Win32 22 | {F3E42845-8D56-4BB3-821D-8163AB1337F0}.Release|x86.ActiveCfg = Release|Win32 23 | {F3E42845-8D56-4BB3-821D-8163AB1337F0}.Release|x86.Build.0 = Release|Win32 24 | {D6A5475A-A3D9-4971-B971-A94520CB0354}.Debug|x64.ActiveCfg = Debug|x64 25 | {D6A5475A-A3D9-4971-B971-A94520CB0354}.Debug|x64.Build.0 = Debug|x64 26 | {D6A5475A-A3D9-4971-B971-A94520CB0354}.Debug|x86.ActiveCfg = Debug|Win32 27 | {D6A5475A-A3D9-4971-B971-A94520CB0354}.Debug|x86.Build.0 = Debug|Win32 28 | {D6A5475A-A3D9-4971-B971-A94520CB0354}.Release|x64.ActiveCfg = Release|x64 29 | {D6A5475A-A3D9-4971-B971-A94520CB0354}.Release|x64.Build.0 = Release|x64 30 | {D6A5475A-A3D9-4971-B971-A94520CB0354}.Release|x86.ActiveCfg = Release|Win32 31 | {D6A5475A-A3D9-4971-B971-A94520CB0354}.Release|x86.Build.0 = Release|Win32 32 | EndGlobalSection 33 | GlobalSection(SolutionProperties) = preSolution 34 | HideSolutionNode = FALSE 35 | EndGlobalSection 36 | EndGlobal 37 | -------------------------------------------------------------------------------- /CSGOSimple.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | C:\Users\Marcelo\Documents\Development\Sources\CSGOSimple\CSGOSimple.DotSettings 3 | ..\CSGOSimple.DotSettings 4 | True 5 | True 6 | 1 -------------------------------------------------------------------------------- /CSGOSimple/config.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "options.hpp" 3 | #include "singleton.hpp" 4 | 5 | #include 6 | 7 | 8 | 9 | 10 | class Config : public Singleton { 11 | public: 12 | void Save() { 13 | std::ofstream fout("csgosimple.cfg", std::ios::binary); 14 | const auto sz = sizeof(Options); 15 | const auto var_sz = sizeof(Var); 16 | const auto cnt = sz / var_sz; 17 | for (auto i = 0; i < cnt; i++) { 18 | const auto el = &(*(Var*)(&g_Options)) + i; 19 | auto name = el->name; 20 | auto val = el->value; 21 | auto sizeof_val = el->size; 22 | fout << name << "\t" << Utils::BytesToString((unsigned char*)*(int*)&val, sizeof_val) << std::endl; 23 | } 24 | fout.close(); 25 | } 26 | 27 | 28 | void Load() { 29 | std::ifstream fin("csgosimple.cfg", std::ios::binary); 30 | std::stringstream ss; 31 | ss << fin.rdbuf(); 32 | 33 | 34 | auto lines = Utils::Split(ss.str(), "\n"); 35 | 36 | for (auto line : lines) { 37 | auto data = Utils::Split(line, "\t"); 38 | const auto sz = sizeof(Options); 39 | const auto var_sz = sizeof(Var); 40 | const auto cnt = sz / var_sz; 41 | for (auto i = 0; i < cnt; i++) { 42 | const auto &el = &(*(Var*)(&g_Options)) + i; 43 | if (data[0] == el->name) { 44 | auto bytes = Utils::HexToBytes(data[1]); 45 | memcpy(*(void**)&el->value, bytes.data(), el->size); 46 | } 47 | } 48 | } 49 | fin.close(); 50 | } 51 | }; -------------------------------------------------------------------------------- /CSGOSimple/features/bhop.cpp: -------------------------------------------------------------------------------- 1 | #include "bhop.hpp" 2 | 3 | #include "../valve_sdk/csgostructs.hpp" 4 | 5 | void BunnyHop::OnCreateMove(CUserCmd* cmd) 6 | { 7 | static bool jumped_last_tick = false; 8 | static bool should_fake_jump = false; 9 | 10 | if (!g_LocalPlayer) 11 | return; 12 | 13 | if (!g_LocalPlayer->IsAlive()) 14 | return; 15 | 16 | if (g_LocalPlayer->m_nMoveType() == MOVETYPE_LADDER || g_LocalPlayer->m_nMoveType() == MOVETYPE_NOCLIP) 17 | return; 18 | 19 | if (g_LocalPlayer->m_fFlags() & FL_INWATER) 20 | return; 21 | 22 | if(!jumped_last_tick && should_fake_jump) { 23 | should_fake_jump = false; 24 | cmd->buttons |= IN_JUMP; 25 | } else if(cmd->buttons & IN_JUMP) { 26 | if(g_LocalPlayer->m_fFlags() & FL_ONGROUND) { 27 | jumped_last_tick = true; 28 | should_fake_jump = true; 29 | } else { 30 | cmd->buttons &= ~IN_JUMP; 31 | jumped_last_tick = false; 32 | } 33 | } else { 34 | jumped_last_tick = false; 35 | should_fake_jump = false; 36 | } 37 | } -------------------------------------------------------------------------------- /CSGOSimple/features/bhop.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class C_BasePlayer; 4 | class CUserCmd; 5 | 6 | namespace BunnyHop 7 | { 8 | void OnCreateMove(CUserCmd* cmd); 9 | } -------------------------------------------------------------------------------- /CSGOSimple/features/chams.cpp: -------------------------------------------------------------------------------- 1 | #include "chams.hpp" 2 | #include 3 | 4 | #include "../valve_sdk/csgostructs.hpp" 5 | #include "../options.hpp" 6 | #include "../hooks.hpp" 7 | #include "../helpers/input.hpp" 8 | 9 | 10 | Chams::Chams() { 11 | materialRegular = g_MatSystem->FindMaterial("debug/debugambientcube"); 12 | materialFlat = g_MatSystem->FindMaterial("debug/debugdrawflat"); 13 | } 14 | 15 | Chams::~Chams() { 16 | } 17 | 18 | 19 | void Chams::OverrideMaterial(bool ignoreZ, bool flat, bool wireframe, bool glass, const Color& rgba) { 20 | IMaterial* material = nullptr; 21 | 22 | if (flat) { 23 | material = materialFlat; 24 | } 25 | else { 26 | material = materialRegular; 27 | } 28 | 29 | material->SetMaterialVarFlag(MATERIAL_VAR_IGNOREZ, ignoreZ); 30 | 31 | 32 | if (glass) { 33 | material = materialFlat; 34 | material->AlphaModulate(0.45f); 35 | } 36 | else { 37 | material->AlphaModulate( 38 | rgba.a() / 255.0f); 39 | } 40 | 41 | material->SetMaterialVarFlag(MATERIAL_VAR_WIREFRAME, wireframe); 42 | material->ColorModulate( 43 | rgba.r() / 255.0f, 44 | rgba.g() / 255.0f, 45 | rgba.b() / 255.0f); 46 | 47 | g_MdlRender->ForcedMaterialOverride(material); 48 | } 49 | 50 | 51 | void Chams::OnDrawModelExecute( 52 | IMatRenderContext* ctx, 53 | const DrawModelState_t& state, 54 | const ModelRenderInfo_t& info, 55 | matrix3x4_t* matrix) 56 | { 57 | static auto fnDME = Hooks::mdlrender_hook.get_original(index::DrawModelExecute); 58 | 59 | const auto mdl = info.pModel; 60 | 61 | bool is_arm = strstr(mdl->szName, "arms") != nullptr; 62 | bool is_player = strstr(mdl->szName, "models/player") != nullptr; 63 | bool is_sleeve = strstr(mdl->szName, "sleeve") != nullptr; 64 | //bool is_weapon = strstr(mdl->szName, "weapons/v_") != nullptr; 65 | 66 | if (is_player && g_Options.chams_player_enabled) { 67 | // 68 | // Draw player Chams. 69 | // 70 | auto ent = C_BasePlayer::GetPlayerByIndex(info.entity_index); 71 | 72 | if (ent && g_LocalPlayer && ent->IsAlive()) { 73 | const auto enemy = ent->m_iTeamNum() != g_LocalPlayer->m_iTeamNum(); 74 | if (!enemy && g_Options.chams_player_enemies_only) 75 | return; 76 | 77 | const auto clr_front = enemy ? g_Options.color_chams_player_enemy_visible : g_Options.color_chams_player_ally_visible; 78 | const auto clr_back = enemy ? g_Options.color_chams_player_enemy_occluded : g_Options.color_chams_player_ally_occluded; 79 | 80 | if (g_Options.chams_player_ignorez) { 81 | OverrideMaterial( 82 | true, 83 | g_Options.chams_player_flat, 84 | g_Options.chams_player_wireframe, 85 | false, 86 | clr_back); 87 | fnDME(g_MdlRender, 0, ctx, state, info, matrix); 88 | OverrideMaterial( 89 | false, 90 | g_Options.chams_player_flat, 91 | g_Options.chams_player_wireframe, 92 | false, 93 | clr_front); 94 | } 95 | else { 96 | OverrideMaterial( 97 | false, 98 | g_Options.chams_player_flat, 99 | g_Options.chams_player_wireframe, 100 | g_Options.chams_player_glass, 101 | clr_front); 102 | } 103 | } 104 | } 105 | else if (is_sleeve && g_Options.chams_arms_enabled) { 106 | auto material = g_MatSystem->FindMaterial(mdl->szName, TEXTURE_GROUP_MODEL); 107 | if (!material) 108 | return; 109 | // 110 | // Remove sleeves when drawing Chams. 111 | // 112 | material->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true); 113 | g_MdlRender->ForcedMaterialOverride(material); 114 | } 115 | else if (is_arm) { 116 | auto material = g_MatSystem->FindMaterial(mdl->szName, TEXTURE_GROUP_MODEL); 117 | if (!material) 118 | return; 119 | if (g_Options.misc_no_hands) { 120 | // 121 | // No hands. 122 | // 123 | material->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true); 124 | g_MdlRender->ForcedMaterialOverride(material); 125 | } 126 | else if (g_Options.chams_arms_enabled) { 127 | if (g_Options.chams_arms_ignorez) { 128 | OverrideMaterial( 129 | true, 130 | g_Options.chams_arms_flat, 131 | g_Options.chams_arms_wireframe, 132 | false, 133 | g_Options.color_chams_arms_occluded); 134 | fnDME(g_MdlRender, 0, ctx, state, info, matrix); 135 | OverrideMaterial( 136 | false, 137 | g_Options.chams_arms_flat, 138 | g_Options.chams_arms_wireframe, 139 | false, 140 | g_Options.color_chams_arms_visible); 141 | } 142 | else { 143 | OverrideMaterial( 144 | false, 145 | g_Options.chams_arms_flat, 146 | g_Options.chams_arms_wireframe, 147 | g_Options.chams_arms_glass, 148 | g_Options.color_chams_arms_visible); 149 | } 150 | } 151 | } 152 | } -------------------------------------------------------------------------------- /CSGOSimple/features/chams.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../singleton.hpp" 4 | 5 | class IMatRenderContext; 6 | struct DrawModelState_t; 7 | struct ModelRenderInfo_t; 8 | class matrix3x4_t; 9 | class IMaterial; 10 | class Color; 11 | 12 | class Chams 13 | : public Singleton 14 | { 15 | friend class Singleton; 16 | 17 | Chams(); 18 | ~Chams(); 19 | 20 | public: 21 | void OnDrawModelExecute( 22 | IMatRenderContext* ctx, 23 | const DrawModelState_t &state, 24 | const ModelRenderInfo_t &pInfo, 25 | matrix3x4_t *pCustomBoneToWorld); 26 | 27 | private: 28 | void OverrideMaterial(bool ignoreZ, bool flat, bool wireframe, bool glass, const Color& rgba); 29 | 30 | IMaterial* materialRegular = nullptr; 31 | IMaterial* materialFlat = nullptr; 32 | }; -------------------------------------------------------------------------------- /CSGOSimple/features/glow.cpp: -------------------------------------------------------------------------------- 1 | #include "glow.hpp" 2 | 3 | #include "../valve_sdk/csgostructs.hpp" 4 | #include "../options.hpp" 5 | 6 | Glow::Glow() 7 | { 8 | } 9 | 10 | Glow::~Glow() 11 | { 12 | // We cannot call shutdown here unfortunately. 13 | // Reason is not very straightforward but anyways: 14 | // - This destructor will be called when the dll unloads 15 | // but it cannot distinguish between manual unload 16 | // (pressing the Unload button or calling FreeLibrary) 17 | // or unload due to game exit. 18 | // What that means is that this destructor will be called 19 | // when the game exits. 20 | // - When the game is exiting, other dlls might already 21 | // have been unloaded before us, so it is not safe to 22 | // access intermodular variables or functions. 23 | // 24 | // Trying to call Shutdown here will crash CSGO when it is 25 | // exiting (because we try to access g_GlowObjManager). 26 | // 27 | } 28 | 29 | void Glow::Shutdown() 30 | { 31 | // Remove glow from all entities 32 | for(auto i = 0; i < g_GlowObjManager->m_GlowObjectDefinitions.Count(); i++) { 33 | auto& glowObject = g_GlowObjManager->m_GlowObjectDefinitions[i]; 34 | auto entity = reinterpret_cast(glowObject.m_pEntity); 35 | 36 | if(glowObject.IsUnused()) 37 | continue; 38 | 39 | if(!entity || entity->IsDormant()) 40 | continue; 41 | 42 | glowObject.m_flAlpha = 0.0f; 43 | } 44 | } 45 | 46 | void Glow::Run() 47 | { 48 | for(auto i = 0; i < g_GlowObjManager->m_GlowObjectDefinitions.Count(); i++) { 49 | auto& glowObject = g_GlowObjManager->m_GlowObjectDefinitions[i]; 50 | auto entity = reinterpret_cast(glowObject.m_pEntity); 51 | 52 | if(glowObject.IsUnused()) 53 | continue; 54 | 55 | if(!entity || entity->IsDormant()) 56 | continue; 57 | 58 | auto class_id = entity->GetClientClass()->m_ClassID; 59 | auto color = Color{}; 60 | 61 | switch(class_id) { 62 | case ClassId_CCSPlayer: 63 | { 64 | auto is_enemy = entity->m_iTeamNum() != g_LocalPlayer->m_iTeamNum(); 65 | 66 | if(entity->HasC4() && is_enemy && g_Options.glow_c4_carrier) { 67 | color = g_Options.color_glow_c4_carrier; 68 | break; 69 | } 70 | 71 | if(!g_Options.glow_players || !entity->IsAlive()) 72 | continue; 73 | 74 | if(!is_enemy && g_Options.glow_enemies_only) 75 | continue; 76 | 77 | color = is_enemy ? g_Options.color_glow_enemy : g_Options.color_glow_ally; 78 | 79 | break; 80 | } 81 | case ClassId_CChicken: 82 | if(!g_Options.glow_chickens) 83 | continue; 84 | entity->m_bShouldGlow() = true; 85 | color = g_Options.color_glow_chickens; 86 | break; 87 | case ClassId_CBaseAnimating: 88 | if(!g_Options.glow_defuse_kits) 89 | continue; 90 | color = g_Options.color_glow_defuse; 91 | break; 92 | case ClassId_CPlantedC4: 93 | if(!g_Options.glow_planted_c4) 94 | continue; 95 | color = g_Options.color_glow_planted_c4; 96 | break; 97 | default: 98 | { 99 | if(entity->IsWeapon()) { 100 | if(!g_Options.glow_weapons) 101 | continue; 102 | color = g_Options.color_glow_weapons; 103 | } 104 | } 105 | } 106 | 107 | glowObject.m_flRed = color.r() / 255.0f; 108 | glowObject.m_flGreen = color.g() / 255.0f; 109 | glowObject.m_flBlue = color.b() / 255.0f; 110 | glowObject.m_flAlpha = color.a() / 255.0f; 111 | glowObject.m_bRenderWhenOccluded = true; 112 | glowObject.m_bRenderWhenUnoccluded = false; 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /CSGOSimple/features/glow.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Singleton.hpp" 3 | 4 | class Glow 5 | : public Singleton 6 | { 7 | friend class Singleton; 8 | 9 | Glow(); 10 | ~Glow(); 11 | 12 | public: 13 | void Run(); 14 | void Shutdown(); 15 | }; -------------------------------------------------------------------------------- /CSGOSimple/features/visuals.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../singleton.hpp" 4 | 5 | #include "../render.hpp" 6 | #include "../helpers/math.hpp" 7 | #include "../valve_sdk/csgostructs.hpp" 8 | 9 | 10 | 11 | 12 | class Visuals : public Singleton 13 | { 14 | friend class Singleton; 15 | 16 | CRITICAL_SECTION cs; 17 | 18 | Visuals(); 19 | ~Visuals(); 20 | public: 21 | class Player 22 | { 23 | public: 24 | struct 25 | { 26 | C_BasePlayer* pl; 27 | bool is_enemy; 28 | bool is_visible; 29 | Color clr; 30 | Vector head_pos; 31 | Vector feet_pos; 32 | RECT bbox; 33 | } ctx; 34 | 35 | bool Begin(C_BasePlayer * pl); 36 | void RenderBox(); 37 | void RenderName(); 38 | void RenderWeaponName(); 39 | void RenderHealth(); 40 | void RenderArmour(); 41 | void RenderSnapline(); 42 | }; 43 | void RenderCrosshair(); 44 | void RenderWeapon(C_BaseCombatWeapon* ent); 45 | void RenderDefuseKit(C_BaseEntity* ent); 46 | void RenderPlantedC4(C_BaseEntity* ent); 47 | void RenderItemEsp(C_BaseEntity* ent); 48 | void ThirdPerson(); 49 | public: 50 | void AddToDrawList(); 51 | void Render(); 52 | }; 53 | -------------------------------------------------------------------------------- /CSGOSimple/fonts/fonts.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | namespace Fonts { 3 | #include "droid.hpp" 4 | #include "cousine.hpp" 5 | } -------------------------------------------------------------------------------- /CSGOSimple/helpers/input.cpp: -------------------------------------------------------------------------------- 1 | #include "input.hpp" 2 | 3 | #include "../valve_sdk/sdk.hpp" 4 | #include "../imgui/imgui.h" 5 | #include "../imgui/impl/imgui_impl_win32.h" 6 | #include "../menu.hpp" 7 | 8 | InputSys::InputSys() 9 | : m_hTargetWindow(nullptr), m_ulOldWndProc(0) 10 | { 11 | } 12 | 13 | InputSys::~InputSys() 14 | { 15 | if (m_ulOldWndProc) 16 | SetWindowLongPtr(m_hTargetWindow, GWLP_WNDPROC, m_ulOldWndProc); 17 | m_ulOldWndProc = 0; 18 | } 19 | void InputSys::Initialize() 20 | { 21 | D3DDEVICE_CREATION_PARAMETERS params; 22 | 23 | if (FAILED(g_D3DDevice9->GetCreationParameters(¶ms))) 24 | throw std::runtime_error("[InputSys] GetCreationParameters failed."); 25 | 26 | m_hTargetWindow = params.hFocusWindow; 27 | m_ulOldWndProc = SetWindowLongPtr(m_hTargetWindow, GWLP_WNDPROC, (LONG_PTR)WndProc); 28 | 29 | if (!m_ulOldWndProc) 30 | throw std::runtime_error("[InputSys] SetWindowLongPtr failed."); 31 | } 32 | 33 | LRESULT __stdcall InputSys::WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) 34 | { 35 | Get().ProcessMessage(msg, wParam, lParam); 36 | 37 | if (ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam) && Menu::Get().IsVisible()) 38 | return true; 39 | 40 | return CallWindowProc((WNDPROC)Get().m_ulOldWndProc, hWnd, msg, wParam, lParam); 41 | } 42 | 43 | bool InputSys::ProcessMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) 44 | { 45 | switch (uMsg) { 46 | case WM_MBUTTONDBLCLK: 47 | case WM_RBUTTONDBLCLK: 48 | case WM_LBUTTONDBLCLK: 49 | case WM_XBUTTONDBLCLK: 50 | case WM_MBUTTONDOWN: 51 | case WM_RBUTTONDOWN: 52 | case WM_LBUTTONDOWN: 53 | case WM_XBUTTONDOWN: 54 | case WM_MBUTTONUP: 55 | case WM_RBUTTONUP: 56 | case WM_LBUTTONUP: 57 | case WM_XBUTTONUP: 58 | return ProcessMouseMessage(uMsg, wParam, lParam); 59 | case WM_KEYDOWN: 60 | case WM_KEYUP: 61 | case WM_SYSKEYDOWN: 62 | case WM_SYSKEYUP: 63 | return ProcessKeybdMessage(uMsg, wParam, lParam); 64 | default: 65 | return false; 66 | } 67 | } 68 | 69 | bool InputSys::ProcessMouseMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) 70 | { 71 | auto key = VK_LBUTTON; 72 | auto state = KeyState::None; 73 | switch (uMsg) { 74 | case WM_MBUTTONDOWN: 75 | case WM_MBUTTONUP: 76 | case WM_MBUTTONDBLCLK: 77 | state = uMsg == WM_MBUTTONUP ? KeyState::Up : KeyState::Down; 78 | key = VK_MBUTTON; 79 | break; 80 | case WM_RBUTTONDOWN: 81 | case WM_RBUTTONUP: 82 | case WM_RBUTTONDBLCLK: 83 | state = uMsg == WM_RBUTTONUP ? KeyState::Up : KeyState::Down; 84 | key = VK_RBUTTON; 85 | break; 86 | case WM_LBUTTONDOWN: 87 | case WM_LBUTTONUP: 88 | case WM_LBUTTONDBLCLK: 89 | state = uMsg == WM_LBUTTONUP ? KeyState::Up : KeyState::Down; 90 | key = VK_LBUTTON; 91 | break; 92 | case WM_XBUTTONDOWN: 93 | case WM_XBUTTONUP: 94 | case WM_XBUTTONDBLCLK: 95 | state = uMsg == WM_XBUTTONUP ? KeyState::Up : KeyState::Down; 96 | key = (HIWORD(wParam) == XBUTTON1 ? VK_XBUTTON1 : VK_XBUTTON2); 97 | break; 98 | default: 99 | return false; 100 | } 101 | 102 | if (state == KeyState::Up && m_iKeyMap[key] == KeyState::Down) 103 | m_iKeyMap[key] = KeyState::Pressed; 104 | else 105 | m_iKeyMap[key] = state; 106 | return true; 107 | } 108 | 109 | bool InputSys::ProcessKeybdMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) 110 | { 111 | auto key = wParam; 112 | auto state = KeyState::None; 113 | 114 | switch (uMsg) { 115 | case WM_KEYDOWN: 116 | case WM_SYSKEYDOWN: 117 | state = KeyState::Down; 118 | break; 119 | case WM_KEYUP: 120 | case WM_SYSKEYUP: 121 | state = KeyState::Up; 122 | break; 123 | default: 124 | return false; 125 | } 126 | 127 | if (state == KeyState::Up && m_iKeyMap[int(key)] == KeyState::Down) { 128 | m_iKeyMap[int(key)] = KeyState::Pressed; 129 | 130 | auto& hotkey_callback = m_Hotkeys[key]; 131 | 132 | if (hotkey_callback) 133 | hotkey_callback(); 134 | 135 | } 136 | else { 137 | m_iKeyMap[int(key)] = state; 138 | } 139 | 140 | return true; 141 | } 142 | KeyState InputSys::GetKeyState(std::uint32_t vk) 143 | { 144 | return m_iKeyMap[vk]; 145 | } 146 | bool InputSys::IsKeyDown(std::uint32_t vk) 147 | { 148 | return m_iKeyMap[vk] == KeyState::Down; 149 | } 150 | bool InputSys::WasKeyPressed(std::uint32_t vk) 151 | { 152 | if (m_iKeyMap[vk] == KeyState::Pressed) { 153 | m_iKeyMap[vk] = KeyState::Up; 154 | return true; 155 | } 156 | return false; 157 | } 158 | 159 | void InputSys::RegisterHotkey(std::uint32_t vk, std::function f) 160 | { 161 | m_Hotkeys[vk] = f; 162 | } 163 | void InputSys::RemoveHotkey(std::uint32_t vk) 164 | { 165 | m_Hotkeys[vk] = nullptr; 166 | } 167 | -------------------------------------------------------------------------------- /CSGOSimple/helpers/input.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define NOMINMAX 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "../singleton.hpp" 13 | 14 | enum class KeyState 15 | { 16 | None = 1, 17 | Down, 18 | Up, 19 | Pressed /*Down and then up*/ 20 | }; 21 | 22 | DEFINE_ENUM_FLAG_OPERATORS(KeyState); 23 | 24 | class InputSys 25 | : public Singleton 26 | { 27 | friend class Singleton; 28 | 29 | InputSys(); 30 | ~InputSys(); 31 | 32 | public: 33 | void Initialize(); 34 | 35 | HWND GetMainWindow() const { return m_hTargetWindow; } 36 | 37 | KeyState GetKeyState(uint32_t vk); 38 | bool IsKeyDown(uint32_t vk); 39 | bool WasKeyPressed(uint32_t vk); 40 | 41 | void RegisterHotkey(uint32_t vk, std::function f); 42 | void RemoveHotkey(uint32_t vk); 43 | 44 | private: 45 | static LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 46 | 47 | bool ProcessMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); 48 | bool ProcessMouseMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); 49 | bool ProcessKeybdMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); 50 | 51 | 52 | HWND m_hTargetWindow; 53 | LONG_PTR m_ulOldWndProc; 54 | KeyState m_iKeyMap[256]; 55 | 56 | std::function m_Hotkeys[256]; 57 | }; -------------------------------------------------------------------------------- /CSGOSimple/helpers/math.cpp: -------------------------------------------------------------------------------- 1 | #include "Math.hpp" 2 | 3 | namespace Math 4 | { 5 | //-------------------------------------------------------------------------------- 6 | float VectorDistance(const Vector& v1, const Vector& v2) 7 | { 8 | return FASTSQRT(pow(v1.x - v2.x, 2) + pow(v1.y - v2.y, 2) + pow(v1.z - v2.z, 2)); 9 | } 10 | //-------------------------------------------------------------------------------- 11 | QAngle CalcAngle(const Vector& src, const Vector& dst) 12 | { 13 | QAngle vAngle; 14 | Vector delta((src.x - dst.x), (src.y - dst.y), (src.z - dst.z)); 15 | double hyp = sqrt(delta.x*delta.x + delta.y*delta.y); 16 | 17 | vAngle.pitch = float(atanf(float(delta.z / hyp)) * 57.295779513082f); 18 | vAngle.yaw = float(atanf(float(delta.y / delta.x)) * 57.295779513082f); 19 | vAngle.roll = 0.0f; 20 | 21 | if (delta.x >= 0.0) 22 | vAngle.yaw += 180.0f; 23 | 24 | return vAngle; 25 | } 26 | //-------------------------------------------------------------------------------- 27 | float GetFOV(const QAngle& viewAngle, const QAngle& aimAngle) 28 | { 29 | Vector ang, aim; 30 | 31 | AngleVectors(viewAngle, aim); 32 | AngleVectors(aimAngle, ang); 33 | 34 | auto res = RAD2DEG(acos(aim.Dot(ang) / aim.LengthSqr())); 35 | if (std::isnan(res)) 36 | res = 0.f; 37 | return res; 38 | } 39 | //-------------------------------------------------------------------------------- 40 | void ClampAngles(QAngle& angles) 41 | { 42 | if(angles.pitch > 89.0f) angles.pitch = 89.0f; 43 | else if(angles.pitch < -89.0f) angles.pitch = -89.0f; 44 | 45 | if(angles.yaw > 180.0f) angles.yaw = 180.0f; 46 | else if(angles.yaw < -180.0f) angles.yaw = -180.0f; 47 | 48 | angles.roll = 0; 49 | } 50 | //-------------------------------------------------------------------------------- 51 | void VectorTransform(const Vector& in1, const matrix3x4_t& in2, Vector& out) 52 | { 53 | out[0] = in1.Dot(in2[0]) + in2[0][3]; 54 | out[1] = in1.Dot(in2[1]) + in2[1][3]; 55 | out[2] = in1.Dot(in2[2]) + in2[2][3]; 56 | } 57 | //-------------------------------------------------------------------------------- 58 | void AngleVectors(const QAngle &angles, Vector& forward) 59 | { 60 | float sp, sy, cp, cy; 61 | 62 | DirectX::XMScalarSinCos(&sp, &cp, DEG2RAD(angles[0])); 63 | DirectX::XMScalarSinCos(&sy, &cy, DEG2RAD(angles[1])); 64 | 65 | forward.x = cp*cy; 66 | forward.y = cp*sy; 67 | forward.z = -sp; 68 | } 69 | //-------------------------------------------------------------------------------- 70 | void AngleVectors(const QAngle &angles, Vector& forward, Vector& right, Vector& up) 71 | { 72 | float sr, sp, sy, cr, cp, cy; 73 | 74 | DirectX::XMScalarSinCos(&sp, &cp, DEG2RAD(angles[0])); 75 | DirectX::XMScalarSinCos(&sy, &cy, DEG2RAD(angles[1])); 76 | DirectX::XMScalarSinCos(&sr, &cr, DEG2RAD(angles[2])); 77 | 78 | forward.x = (cp * cy); 79 | forward.y = (cp * sy); 80 | forward.z = (-sp); 81 | right.x = (-1 * sr * sp * cy + -1 * cr * -sy); 82 | right.y = (-1 * sr * sp * sy + -1 * cr * cy); 83 | right.z = (-1 * sr * cp); 84 | up.x = (cr * sp * cy + -sr*-sy); 85 | up.y = (cr * sp * sy + -sr*cy); 86 | up.z = (cr * cp); 87 | } 88 | //-------------------------------------------------------------------------------- 89 | void VectorAngles(const Vector& forward, QAngle& angles) 90 | { 91 | float tmp, yaw, pitch; 92 | 93 | if(forward[1] == 0 && forward[0] == 0) { 94 | yaw = 0; 95 | if(forward[2] > 0) 96 | pitch = 270; 97 | else 98 | pitch = 90; 99 | } else { 100 | yaw = (atan2(forward[1], forward[0]) * 180 / DirectX::XM_PI); 101 | if(yaw < 0) 102 | yaw += 360; 103 | 104 | tmp = sqrt(forward[0] * forward[0] + forward[1] * forward[1]); 105 | pitch = (atan2(-forward[2], tmp) * 180 / DirectX::XM_PI); 106 | if(pitch < 0) 107 | pitch += 360; 108 | } 109 | 110 | angles[0] = pitch; 111 | angles[1] = yaw; 112 | angles[2] = 0; 113 | } 114 | //-------------------------------------------------------------------------------- 115 | static bool screen_transform(const Vector& in, Vector& out) 116 | { 117 | static auto& w2sMatrix = g_EngineClient->WorldToScreenMatrix(); 118 | 119 | out.x = w2sMatrix.m[0][0] * in.x + w2sMatrix.m[0][1] * in.y + w2sMatrix.m[0][2] * in.z + w2sMatrix.m[0][3]; 120 | out.y = w2sMatrix.m[1][0] * in.x + w2sMatrix.m[1][1] * in.y + w2sMatrix.m[1][2] * in.z + w2sMatrix.m[1][3]; 121 | out.z = 0.0f; 122 | 123 | float w = w2sMatrix.m[3][0] * in.x + w2sMatrix.m[3][1] * in.y + w2sMatrix.m[3][2] * in.z + w2sMatrix.m[3][3]; 124 | 125 | if(w < 0.001f) { 126 | out.x *= 100000; 127 | out.y *= 100000; 128 | return false; 129 | } 130 | 131 | out.x /= w; 132 | out.y /= w; 133 | 134 | return true; 135 | } 136 | //-------------------------------------------------------------------------------- 137 | bool WorldToScreen(const Vector& in, Vector& out) 138 | { 139 | if(screen_transform(in, out)) { 140 | int w, h; 141 | g_EngineClient->GetScreenSize(w, h); 142 | 143 | out.x = (w / 2.0f) + (out.x * w) / 2.0f; 144 | out.y = (h / 2.0f) - (out.y * h) / 2.0f; 145 | 146 | return true; 147 | } 148 | return false; 149 | } 150 | //-------------------------------------------------------------------------------- 151 | } 152 | -------------------------------------------------------------------------------- /CSGOSimple/helpers/math.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../valve_sdk/sdk.hpp" 4 | 5 | #include 6 | 7 | #define RAD2DEG(x) DirectX::XMConvertToDegrees(x) 8 | #define DEG2RAD(x) DirectX::XMConvertToRadians(x) 9 | #define M_PI 3.14159265358979323846 10 | #define PI_F ((float)(M_PI)) 11 | 12 | namespace Math 13 | { 14 | inline float FASTSQRT(float x) 15 | { 16 | unsigned int i = *(unsigned int*)&x; 17 | 18 | i += 127 << 23; 19 | // approximation of square root 20 | i >>= 1; 21 | return *(float*)&i; 22 | } 23 | float VectorDistance(const Vector& v1, const Vector& v2); 24 | QAngle CalcAngle(const Vector& src, const Vector& dst); 25 | float GetFOV(const QAngle& viewAngle, const QAngle& aimAngle); 26 | template 27 | void Normalize3(T& vec) 28 | { 29 | for (auto i = 0; i < 2; i++) { 30 | while (vec[i] < -180.0f) vec[i] += 360.0f; 31 | while (vec[i] > 180.0f) vec[i] -= 360.0f; 32 | } 33 | vec[2] = 0.f; 34 | } 35 | void ClampAngles(QAngle& angles); 36 | void VectorTransform(const Vector& in1, const matrix3x4_t& in2, Vector& out); 37 | void AngleVectors(const QAngle &angles, Vector& forward); 38 | void AngleVectors(const QAngle &angles, Vector& forward, Vector& right, Vector& up); 39 | void VectorAngles(const Vector& forward, QAngle& angles); 40 | bool WorldToScreen(const Vector& in, Vector& out); 41 | } -------------------------------------------------------------------------------- /CSGOSimple/helpers/utils.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define NOMINMAX 4 | #include 5 | #include 6 | #include 7 | #include "../valve_sdk/sdk.hpp" 8 | 9 | namespace Utils { 10 | std::vector HexToBytes(const std::string& hex); 11 | std::string BytesToString(unsigned char* data, int len); 12 | std::vector Split(const std::string& str, const char* delim); 13 | unsigned int FindInDataMap(datamap_t * pMap, const char * name); 14 | /* 15 | * @brief Create console 16 | * 17 | * Create and attach a console window to the current process 18 | */ 19 | void AttachConsole(); 20 | 21 | /* 22 | * @brief Detach console 23 | * 24 | * Detach and destroy the attached console 25 | */ 26 | void DetachConsole(); 27 | 28 | /* 29 | * @brief Print to console 30 | * 31 | * Replacement to printf that works with the newly created console 32 | */ 33 | bool ConsolePrint(const char* fmt, ...); 34 | 35 | /* 36 | * @brief Blocks execution until a key is pressed on the console window 37 | * 38 | */ 39 | char ConsoleReadKey(); 40 | 41 | /* 42 | * @brief Wait for all the given modules to be loaded 43 | * 44 | * @param timeout How long to wait 45 | * @param modules List of modules to wait for 46 | * 47 | * @returns See WaitForSingleObject return values. 48 | */ 49 | int WaitForModules(std::int32_t timeout, const std::initializer_list& modules); 50 | 51 | /* 52 | * @brief Scan for a given byte pattern on a module 53 | * 54 | * @param module Base of the module to search 55 | * @param signature IDA-style byte array pattern 56 | * 57 | * @returns Address of the first occurence 58 | */ 59 | std::uint8_t* PatternScan(void* module, const char* signature); 60 | 61 | /* 62 | * @brief Set player clantag 63 | * 64 | * @param tag New clantag 65 | */ 66 | void SetClantag(const char* tag); 67 | 68 | /* 69 | * @brief Set player name 70 | * 71 | * @param name New name 72 | */ 73 | void SetName(const char* name); 74 | } 75 | -------------------------------------------------------------------------------- /CSGOSimple/helpers/vfunc_hook.cpp: -------------------------------------------------------------------------------- 1 | #include "vfunc_hook.hpp" 2 | 3 | vfunc_hook::vfunc_hook() 4 | : class_base(nullptr), vftbl_len(0), new_vftbl(nullptr), old_vftbl(nullptr) 5 | { 6 | } 7 | vfunc_hook::vfunc_hook(void* base) 8 | : class_base(base), vftbl_len(0), new_vftbl(nullptr), old_vftbl(nullptr) 9 | { 10 | } 11 | vfunc_hook::~vfunc_hook() 12 | { 13 | unhook_all(); 14 | 15 | delete[] new_vftbl; 16 | } 17 | 18 | bool vfunc_hook::setup(void* base /*= nullptr*/) 19 | { 20 | if(base != nullptr) 21 | class_base = base; 22 | 23 | if(class_base == nullptr) 24 | return false; 25 | 26 | old_vftbl = *(std::uintptr_t**)class_base; 27 | vftbl_len = estimate_vftbl_length(old_vftbl) * sizeof(std::uintptr_t); 28 | 29 | if(vftbl_len == 0) 30 | return false; 31 | 32 | new_vftbl = new std::uintptr_t[vftbl_len + 1](); 33 | 34 | std::memcpy(&new_vftbl[1], old_vftbl, vftbl_len * sizeof(std::uintptr_t)); 35 | 36 | try { 37 | auto guard = detail::protect_guard{ class_base, sizeof(std::uintptr_t), PAGE_READWRITE }; 38 | new_vftbl[0] = old_vftbl[-1]; 39 | *(std::uintptr_t**)class_base = &new_vftbl[1]; 40 | } catch(...) { 41 | delete[] new_vftbl; 42 | return false; 43 | } 44 | 45 | return true; 46 | } 47 | std::size_t vfunc_hook::estimate_vftbl_length(std::uintptr_t* vftbl_start) 48 | { 49 | MEMORY_BASIC_INFORMATION memInfo = { NULL }; 50 | int m_nSize = -1; 51 | do { 52 | m_nSize++; 53 | VirtualQuery(reinterpret_cast(vftbl_start[m_nSize]), &memInfo, sizeof(memInfo)); 54 | } while (memInfo.Protect == PAGE_EXECUTE_READ || memInfo.Protect == PAGE_EXECUTE_READWRITE); 55 | 56 | return m_nSize; 57 | } -------------------------------------------------------------------------------- /CSGOSimple/helpers/vfunc_hook.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #define NOMINMAX 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | namespace detail 9 | { 10 | class protect_guard 11 | { 12 | public: 13 | protect_guard(void* base, size_t len, std::uint32_t flags) 14 | { 15 | _base = base; 16 | _length = len; 17 | if (!VirtualProtect(base, len, flags, (PDWORD)&_old)) 18 | throw std::runtime_error("Failed to protect region."); 19 | } 20 | ~protect_guard() 21 | { 22 | VirtualProtect(_base, _length, _old, (PDWORD)&_old); 23 | } 24 | 25 | private: 26 | void* _base; 27 | size_t _length; 28 | std::uint32_t _old; 29 | }; 30 | } 31 | 32 | class vfunc_hook 33 | { 34 | public: 35 | vfunc_hook(); 36 | vfunc_hook(void* base); 37 | ~vfunc_hook(); 38 | 39 | bool setup(void* class_base = nullptr); 40 | 41 | template 42 | void hook_index(int index, T fun) 43 | { 44 | assert(index >= 0 && index <= (int)vftbl_len); 45 | new_vftbl[index + 1] = reinterpret_cast(fun); 46 | } 47 | void unhook_index(int index) 48 | { 49 | new_vftbl[index] = old_vftbl[index]; 50 | } 51 | void unhook_all() 52 | { 53 | try { 54 | if (old_vftbl != nullptr) { 55 | auto guard = detail::protect_guard{ class_base, sizeof(std::uintptr_t), PAGE_READWRITE }; 56 | *(std::uintptr_t**)class_base = old_vftbl; 57 | old_vftbl = nullptr; 58 | } 59 | } 60 | catch (...) { 61 | } 62 | } 63 | 64 | template 65 | T get_original(int index) 66 | { 67 | return (T)old_vftbl[index]; 68 | } 69 | 70 | private: 71 | static inline std::size_t estimate_vftbl_length(std::uintptr_t* vftbl_start); 72 | 73 | void* class_base; 74 | std::size_t vftbl_len; 75 | std::uintptr_t* new_vftbl; 76 | std::uintptr_t* old_vftbl; 77 | }; -------------------------------------------------------------------------------- /CSGOSimple/hooks.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "valve_sdk/csgostructs.hpp" 4 | #include "helpers/vfunc_hook.hpp" 5 | #include 6 | 7 | namespace index 8 | { 9 | constexpr auto EmitSound1 = 5; 10 | constexpr auto EmitSound2 = 6; 11 | constexpr auto EndScene = 42; 12 | constexpr auto Reset = 16; 13 | constexpr auto PaintTraverse = 41; 14 | constexpr auto CreateMove = 22; 15 | constexpr auto PlaySound = 82; 16 | constexpr auto FrameStageNotify = 37; 17 | constexpr auto DrawModelExecute = 21; 18 | constexpr auto DoPostScreenSpaceEffects = 44; 19 | constexpr auto SvCheatsGetBool = 13; 20 | constexpr auto OverrideView = 18; 21 | constexpr auto LockCursor = 67; 22 | } 23 | 24 | namespace Hooks 25 | { 26 | void Initialize(); 27 | void Shutdown(); 28 | 29 | inline vfunc_hook hlclient_hook; 30 | inline vfunc_hook direct3d_hook; 31 | inline vfunc_hook vguipanel_hook; 32 | inline vfunc_hook vguisurf_hook; 33 | inline vfunc_hook mdlrender_hook; 34 | inline vfunc_hook viewrender_hook; 35 | inline vfunc_hook sound_hook; 36 | inline vfunc_hook clientmode_hook; 37 | inline vfunc_hook sv_cheats; 38 | 39 | 40 | long __stdcall hkEndScene(IDirect3DDevice9* device); 41 | long __stdcall hkReset(IDirect3DDevice9* device, D3DPRESENT_PARAMETERS* pPresentationParameters); 42 | void __stdcall hkCreateMove(int sequence_number, float input_sample_frametime, bool active, bool& bSendPacket); 43 | void __fastcall hkCreateMove_Proxy(void* _this, int, int sequence_number, float input_sample_frametime, bool active); 44 | void __fastcall hkPaintTraverse(void* _this, int edx, vgui::VPANEL panel, bool forceRepaint, bool allowForce); 45 | void __fastcall hkEmitSound1(void* _this, int, IRecipientFilter & filter, int iEntIndex, int iChannel, const char * pSoundEntry, unsigned int nSoundEntryHash, const char * pSample, float flVolume, int nSeed, float flAttenuation, int iFlags, int iPitch, const Vector * pOrigin, const Vector * pDirection, void * pUtlVecOrigins, bool bUpdatePositions, float soundtime, int speakerentity, int unk); 46 | void __fastcall hkDrawModelExecute(void* _this, int, IMatRenderContext* ctx, const DrawModelState_t& state, const ModelRenderInfo_t& pInfo, matrix3x4_t* pCustomBoneToWorld); 47 | void __fastcall hkFrameStageNotify(void* _this, int, ClientFrameStage_t stage); 48 | void __fastcall hkOverrideView(void* _this, int, CViewSetup * vsView); 49 | void __fastcall hkLockCursor(void* _this); 50 | int __fastcall hkDoPostScreenEffects(void* _this, int, int a1); 51 | bool __fastcall hkSvCheatsGetBool(void* pConVar, void* edx); 52 | } 53 | -------------------------------------------------------------------------------- /CSGOSimple/imgui/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2019 Omar Cornut 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /CSGOSimple/imgui/imconfig.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // COMPILE-TIME OPTIONS FOR DEAR IMGUI 3 | // Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure. 4 | // You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions. 5 | //----------------------------------------------------------------------------- 6 | // A) You may edit imconfig.h (and not overwrite it when updating imgui, or maintain a patch/branch with your modifications to imconfig.h) 7 | // B) or add configuration directives in your own file and compile with #define IMGUI_USER_CONFIG "myfilename.h" 8 | // If you do so you need to make sure that configuration settings are defined consistently _everywhere_ dear imgui is used, which include 9 | // the imgui*.cpp files but also _any_ of your code that uses imgui. This is because some compile-time options have an affect on data structures. 10 | // Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts. 11 | // Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using. 12 | //----------------------------------------------------------------------------- 13 | 14 | #pragma once 15 | 16 | //---- Define assertion handler. Defaults to calling assert(). 17 | //#define IM_ASSERT(_EXPR) MyAssert(_EXPR) 18 | //#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts 19 | 20 | //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows. 21 | //#define IMGUI_API __declspec( dllexport ) 22 | //#define IMGUI_API __declspec( dllimport ) 23 | 24 | //---- Don't define obsolete functions/enums names. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names. 25 | //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 26 | 27 | //---- Don't implement demo windows functionality (ShowDemoWindow()/ShowStyleEditor()/ShowUserGuide() methods will be empty) 28 | //---- It is very strongly recommended to NOT disable the demo windows during development. Please read the comments in imgui_demo.cpp. 29 | //#define IMGUI_DISABLE_DEMO_WINDOWS 30 | 31 | //---- Don't implement some functions to reduce linkage requirements. 32 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. 33 | //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] Don't implement default IME handler. Won't use and link with ImmGetContext/ImmSetCompositionWindow. 34 | //#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function. 35 | //#define IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself if you don't want to link with vsnprintf. 36 | //#define IMGUI_DISABLE_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 wrapper so you can implement them yourself. Declare your prototypes in imconfig.h. 37 | //#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions(). 38 | 39 | //---- Include imgui_user.h at the end of imgui.h as a convenience 40 | //#define IMGUI_INCLUDE_IMGUI_USER_H 41 | 42 | //---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another) 43 | //#define IMGUI_USE_BGRA_PACKED_COLOR 44 | 45 | //---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version 46 | // By default the embedded implementations are declared static and not available outside of imgui cpp files. 47 | //#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h" 48 | //#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h" 49 | //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION 50 | //#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION 51 | 52 | //---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4. 53 | // This will be inlined as part of ImVec2 and ImVec4 class declarations. 54 | /* 55 | #define IM_VEC2_CLASS_EXTRA \ 56 | ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \ 57 | operator MyVec2() const { return MyVec2(x,y); } 58 | 59 | #define IM_VEC4_CLASS_EXTRA \ 60 | ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \ 61 | operator MyVec4() const { return MyVec4(x,y,z,w); } 62 | */ 63 | 64 | //---- Use 32-bit vertex indices (default is 16-bit) to allow meshes with more than 64K vertices. Render function needs to support it. 65 | //#define ImDrawIdx unsigned int 66 | 67 | //---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files. 68 | /* 69 | namespace ImGui 70 | { 71 | void MyFunction(const char* name, const MyMatrix44& v); 72 | } 73 | */ 74 | -------------------------------------------------------------------------------- /CSGOSimple/imgui/impl/imgui_impl_dx9.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer for DirectX9 2 | // This needs to be used along with a Platform Binding (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 6 | 7 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 8 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 9 | // https://github.com/ocornut/imgui 10 | 11 | #pragma once 12 | 13 | struct IDirect3DDevice9; 14 | 15 | IMGUI_IMPL_API bool ImGui_ImplDX9_Init(IDirect3DDevice9* device); 16 | IMGUI_IMPL_API void ImGui_ImplDX9_Shutdown(); 17 | IMGUI_IMPL_API void ImGui_ImplDX9_NewFrame(); 18 | IMGUI_IMPL_API void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data); 19 | 20 | // Use if you want to reset your rendering device without losing ImGui state. 21 | IMGUI_IMPL_API void ImGui_ImplDX9_InvalidateDeviceObjects(); 22 | IMGUI_IMPL_API bool ImGui_ImplDX9_CreateDeviceObjects(); 23 | -------------------------------------------------------------------------------- /CSGOSimple/imgui/impl/imgui_impl_win32.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Binding for Windows (standard windows API for 32 and 64 bits applications) 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | 4 | // Implemented features: 5 | // [X] Platform: Clipboard support (for Win32 this is actually part of core imgui) 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: Keyboard arrays indexed using VK_* Virtual Key Codes, e.g. ImGui::IsKeyPressed(VK_SPACE). 8 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 9 | 10 | #pragma once 11 | 12 | #include 13 | 14 | IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd); 15 | IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown(); 16 | IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame(); 17 | 18 | // Handler for Win32 messages, update mouse/keyboard data. 19 | // You may or not need this for your implementation, but it can serve as reference for handling inputs. 20 | // Intentionally commented out to avoid dragging dependencies on types. You can COPY this line into your .cpp code instead. 21 | 22 | IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 23 | 24 | -------------------------------------------------------------------------------- /CSGOSimple/main.cpp: -------------------------------------------------------------------------------- 1 | #define NOMINMAX 2 | #include 3 | 4 | #include "valve_sdk/sdk.hpp" 5 | #include "helpers/utils.hpp" 6 | #include "helpers/input.hpp" 7 | 8 | #include "hooks.hpp" 9 | #include "menu.hpp" 10 | #include "options.hpp" 11 | #include "render.hpp" 12 | 13 | DWORD WINAPI OnDllAttach(LPVOID base) 14 | { 15 | while (!GetModuleHandleA("serverbrowser.dll")) 16 | Sleep(1000); 17 | 18 | #ifdef _DEBUG 19 | Utils::AttachConsole(); 20 | #endif 21 | 22 | try { 23 | Utils::ConsolePrint("Initializing...\n"); 24 | 25 | Interfaces::Initialize(); 26 | Interfaces::Dump(); 27 | 28 | NetvarSys::Get().Initialize(); 29 | InputSys::Get().Initialize(); 30 | Render::Get().Initialize(); 31 | Menu::Get().Initialize(); 32 | 33 | Hooks::Initialize(); 34 | 35 | // Register some hotkeys. 36 | // - Note: The function that is called when the hotkey is pressed 37 | // is called from the WndProc thread, not this thread. 38 | // 39 | 40 | // Panic button 41 | InputSys::Get().RegisterHotkey(VK_DELETE, [base]() { 42 | g_Unload = true; 43 | }); 44 | 45 | // Menu Toggle 46 | InputSys::Get().RegisterHotkey(VK_INSERT, [base]() { 47 | Menu::Get().Toggle(); 48 | }); 49 | 50 | Utils::ConsolePrint("Finished.\n"); 51 | Utils::ConsolePrint("Built on: %s %s\n", __DATE__, __TIME__); 52 | 53 | while(!g_Unload) 54 | Sleep(1000); 55 | 56 | g_CVar->FindVar("crosshair")->SetValue(true); 57 | 58 | FreeLibraryAndExitThread(static_cast(base), 1); 59 | 60 | } catch(const std::exception& ex) { 61 | Utils::ConsolePrint("An error occured during initialization:\n"); 62 | Utils::ConsolePrint("%s\n", ex.what()); 63 | Utils::ConsolePrint("Press any key to exit.\n"); 64 | Utils::ConsoleReadKey(); 65 | Utils::DetachConsole(); 66 | 67 | FreeLibraryAndExitThread(static_cast(base), 1); 68 | } 69 | 70 | // unreachable 71 | //return TRUE; 72 | } 73 | 74 | BOOL WINAPI OnDllDetach() 75 | { 76 | #ifdef _DEBUG 77 | Utils::DetachConsole(); 78 | #endif 79 | 80 | Hooks::Shutdown(); 81 | 82 | Menu::Get().Shutdown(); 83 | return TRUE; 84 | } 85 | 86 | BOOL WINAPI DllMain( 87 | _In_ HINSTANCE hinstDll, 88 | _In_ DWORD fdwReason, 89 | _In_opt_ LPVOID lpvReserved 90 | ) 91 | { 92 | switch(fdwReason) { 93 | case DLL_PROCESS_ATTACH: 94 | DisableThreadLibraryCalls(hinstDll); 95 | CreateThread(nullptr, 0, OnDllAttach, hinstDll, 0, nullptr); 96 | return TRUE; 97 | case DLL_PROCESS_DETACH: 98 | if(lpvReserved == nullptr) 99 | return OnDllDetach(); 100 | return TRUE; 101 | default: 102 | return TRUE; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /CSGOSimple/menu.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "singleton.hpp" 5 | #include "imgui/imgui.h" 6 | 7 | struct IDirect3DDevice9; 8 | 9 | class Menu 10 | : public Singleton 11 | { 12 | public: 13 | void Initialize(); 14 | void Shutdown(); 15 | 16 | void OnDeviceLost(); 17 | void OnDeviceReset(); 18 | 19 | void Render(); 20 | 21 | void Toggle(); 22 | 23 | bool IsVisible() const { return _visible; } 24 | 25 | private: 26 | void CreateStyle(); 27 | 28 | ImGuiStyle _style; 29 | bool _visible; 30 | }; -------------------------------------------------------------------------------- /CSGOSimple/options.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spirthack/CSGOSimple/c37d4bc36efe99c621eb288fd34299c1692ee1dd/CSGOSimple/options.cpp -------------------------------------------------------------------------------- /CSGOSimple/options.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "valve_sdk/Misc/Color.hpp" 8 | 9 | #define A( s ) #s 10 | #define OPTION(type, var, val) Var var = {A(var), val} 11 | 12 | template 13 | class Var { 14 | public: 15 | std::string name; 16 | std::shared_ptr value; 17 | int32_t size; 18 | Var(std::string name, T v) : name(name) { 19 | value = std::make_shared(v); 20 | size = sizeof(T); 21 | } 22 | operator T() { return *value; } 23 | operator T*() { return &*value; } 24 | operator T() const { return *value; } 25 | //operator T*() const { return value; } 26 | }; 27 | 28 | class Options 29 | { 30 | public: 31 | // 32 | // ESP 33 | // 34 | OPTION(bool, esp_enabled, false); 35 | OPTION(bool, esp_enemies_only, false); 36 | OPTION(bool, esp_player_boxes, false); 37 | OPTION(bool, esp_player_names, false); 38 | OPTION(bool, esp_player_health, false); 39 | OPTION(bool, esp_player_armour, false); 40 | OPTION(bool, esp_player_weapons, false); 41 | OPTION(bool, esp_player_snaplines, false); 42 | OPTION(bool, esp_crosshair, false); 43 | OPTION(bool, esp_dropped_weapons, false); 44 | OPTION(bool, esp_defuse_kit, false); 45 | OPTION(bool, esp_planted_c4, false); 46 | OPTION(bool, esp_items, false); 47 | 48 | // 49 | // GLOW 50 | // 51 | OPTION(bool, glow_enabled, false); 52 | OPTION(bool, glow_enemies_only, false); 53 | OPTION(bool, glow_players, false); 54 | OPTION(bool, glow_chickens, false); 55 | OPTION(bool, glow_c4_carrier, false); 56 | OPTION(bool, glow_planted_c4, false); 57 | OPTION(bool, glow_defuse_kits, false); 58 | OPTION(bool, glow_weapons, false); 59 | 60 | // 61 | // CHAMS 62 | // 63 | OPTION(bool, chams_player_enabled, false); 64 | OPTION(bool, chams_player_enemies_only, false); 65 | OPTION(bool, chams_player_wireframe, false); 66 | OPTION(bool, chams_player_flat, false); 67 | OPTION(bool, chams_player_ignorez, false); 68 | OPTION(bool, chams_player_glass, false); 69 | OPTION(bool, chams_arms_enabled, false); 70 | OPTION(bool, chams_arms_wireframe, false); 71 | OPTION(bool, chams_arms_flat, false); 72 | OPTION(bool, chams_arms_ignorez, false); 73 | OPTION(bool, chams_arms_glass, false); 74 | 75 | // 76 | // MISC 77 | // 78 | OPTION(bool, misc_bhop, false); 79 | OPTION(bool, misc_no_hands, false); 80 | OPTION(bool, misc_thirdperson, false); 81 | OPTION(bool, misc_showranks, true); 82 | OPTION(bool, misc_watermark, true); 83 | OPTION(float, misc_thirdperson_dist, 50.f); 84 | OPTION(int, viewmodel_fov, 68); 85 | OPTION(float, mat_ambient_light_r, 0.0f); 86 | OPTION(float, mat_ambient_light_g, 0.0f); 87 | OPTION(float, mat_ambient_light_b, 0.0f); 88 | 89 | // 90 | // COLORS 91 | // 92 | OPTION(Color, color_esp_ally_visible, Color(0, 128, 255)); 93 | OPTION(Color, color_esp_enemy_visible, Color(255, 0, 0)); 94 | OPTION(Color, color_esp_ally_occluded, Color(0, 128, 255)); 95 | OPTION(Color, color_esp_enemy_occluded, Color(255, 0, 0)); 96 | OPTION(Color, color_esp_crosshair, Color(255, 255, 255)); 97 | OPTION(Color, color_esp_weapons, Color(128, 0, 128)); 98 | OPTION(Color, color_esp_defuse, Color(0, 128, 255)); 99 | OPTION(Color, color_esp_c4, Color(255, 255, 0)); 100 | OPTION(Color, color_esp_item, Color(255, 255, 255)); 101 | 102 | OPTION(Color, color_glow_ally, Color(0, 128, 255)); 103 | OPTION(Color, color_glow_enemy, Color(255, 0, 0)); 104 | OPTION(Color, color_glow_chickens, Color(0, 128, 0)); 105 | OPTION(Color, color_glow_c4_carrier, Color(255, 255, 0)); 106 | OPTION(Color, color_glow_planted_c4, Color(128, 0, 128)); 107 | OPTION(Color, color_glow_defuse, Color(255, 255, 255)); 108 | OPTION(Color, color_glow_weapons, Color(255, 128, 0)); 109 | 110 | OPTION(Color, color_chams_player_ally_visible, Color(0, 128, 255)); 111 | OPTION(Color, color_chams_player_ally_occluded, Color(0, 255, 128)); 112 | OPTION(Color, color_chams_player_enemy_visible, Color(255, 0, 0)); 113 | OPTION(Color, color_chams_player_enemy_occluded, Color(255, 128, 0)); 114 | OPTION(Color, color_chams_arms_visible, Color(0, 128, 255)); 115 | OPTION(Color, color_chams_arms_occluded, Color(0, 128, 255)); 116 | OPTION(Color, color_watermark, Color(0, 128, 255)); // no menu config cuz its useless 117 | }; 118 | 119 | inline Options g_Options; 120 | inline bool g_Unload; 121 | -------------------------------------------------------------------------------- /CSGOSimple/render.cpp: -------------------------------------------------------------------------------- 1 | #include "render.hpp" 2 | 3 | #include 4 | 5 | #include "features/visuals.hpp" 6 | #include "valve_sdk/csgostructs.hpp" 7 | #include "helpers/input.hpp" 8 | #include "menu.hpp" 9 | #include "options.hpp" 10 | #include "fonts/fonts.hpp" 11 | #include "helpers/math.hpp" 12 | 13 | ImFont* g_pDefaultFont; 14 | ImFont* g_pSecondFont; 15 | 16 | ImDrawListSharedData _data; 17 | 18 | std::mutex render_mutex; 19 | 20 | void Render::Initialize() 21 | { 22 | ImGui::CreateContext(); 23 | 24 | 25 | ImGui_ImplWin32_Init(InputSys::Get().GetMainWindow()); 26 | ImGui_ImplDX9_Init(g_D3DDevice9); 27 | 28 | draw_list = new ImDrawList(ImGui::GetDrawListSharedData()); 29 | draw_list_act = new ImDrawList(ImGui::GetDrawListSharedData()); 30 | draw_list_rendering = new ImDrawList(ImGui::GetDrawListSharedData()); 31 | 32 | GetFonts(); 33 | } 34 | 35 | void Render::GetFonts() { 36 | 37 | // menu font 38 | ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF( 39 | Fonts::Droid_compressed_data, 40 | Fonts::Droid_compressed_size, 41 | 14.f); 42 | 43 | // esp font 44 | g_pDefaultFont = ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF( 45 | Fonts::Droid_compressed_data, 46 | Fonts::Droid_compressed_size, 47 | 18.f); 48 | 49 | 50 | // font for watermark; just example 51 | g_pSecondFont = ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF( 52 | Fonts::Cousine_compressed_data, 53 | Fonts::Cousine_compressed_size, 54 | 18.f); 55 | } 56 | 57 | void Render::ClearDrawList() { 58 | render_mutex.lock(); 59 | draw_list_act->Clear(); 60 | render_mutex.unlock(); 61 | } 62 | 63 | void Render::BeginScene() { 64 | draw_list->Clear(); 65 | draw_list->PushClipRectFullScreen(); 66 | 67 | 68 | if (g_Options.misc_watermark) 69 | Render::Get().RenderText("CSGOSimple", 10, 5, 18.f, g_Options.color_watermark, false, true, g_pSecondFont); 70 | 71 | if (g_EngineClient->IsInGame() && g_LocalPlayer && g_Options.esp_enabled) 72 | Visuals::Get().AddToDrawList(); 73 | 74 | 75 | render_mutex.lock(); 76 | *draw_list_act = *draw_list; 77 | render_mutex.unlock(); 78 | } 79 | 80 | ImDrawList* Render::RenderScene() { 81 | 82 | if (render_mutex.try_lock()) { 83 | *draw_list_rendering = *draw_list_act; 84 | render_mutex.unlock(); 85 | } 86 | 87 | return draw_list_rendering; 88 | } 89 | 90 | 91 | float Render::RenderText(const std::string& text, ImVec2 pos, float size, Color color, bool center, bool outline, ImFont* pFont) 92 | { 93 | ImVec2 textSize = pFont->CalcTextSizeA(size, FLT_MAX, 0.0f, text.c_str()); 94 | if (!pFont->ContainerAtlas) return 0.f; 95 | draw_list->PushTextureID(pFont->ContainerAtlas->TexID); 96 | 97 | if (center) 98 | pos.x -= textSize.x / 2.0f; 99 | 100 | if (outline) { 101 | draw_list->AddText(pFont, size, ImVec2(pos.x + 1, pos.y + 1), GetU32(Color(0, 0, 0, color.a())), text.c_str()); 102 | draw_list->AddText(pFont, size, ImVec2(pos.x - 1, pos.y - 1), GetU32(Color(0, 0, 0, color.a())), text.c_str()); 103 | draw_list->AddText(pFont, size, ImVec2(pos.x + 1, pos.y - 1), GetU32(Color(0, 0, 0, color.a())), text.c_str()); 104 | draw_list->AddText(pFont, size, ImVec2(pos.x - 1, pos.y + 1), GetU32(Color(0, 0, 0, color.a())), text.c_str()); 105 | } 106 | 107 | draw_list->AddText(pFont, size, pos, GetU32(color), text.c_str()); 108 | 109 | draw_list->PopTextureID(); 110 | 111 | return pos.y + textSize.y; 112 | } 113 | 114 | void Render::RenderCircle3D(Vector position, float points, float radius, Color color) 115 | { 116 | float step = (float)M_PI * 2.0f / points; 117 | 118 | for (float a = 0; a < (M_PI * 2.0f); a += step) 119 | { 120 | Vector start(radius * cosf(a) + position.x, radius * sinf(a) + position.y, position.z); 121 | Vector end(radius * cosf(a + step) + position.x, radius * sinf(a + step) + position.y, position.z); 122 | 123 | Vector start2d, end2d; 124 | if (g_DebugOverlay->ScreenPosition(start, start2d) || g_DebugOverlay->ScreenPosition(end, end2d)) 125 | return; 126 | 127 | RenderLine(start2d.x, start2d.y, end2d.x, end2d.y, color); 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /CSGOSimple/render.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #pragma comment(lib,"d3d9.lib") 8 | #pragma comment(lib,"d3dx9.lib") 9 | 10 | #include "singleton.hpp" 11 | #include "imgui/imgui.h" 12 | #include "imgui/imgui_internal.h" 13 | #include "imgui/impl/imgui_impl_dx9.h" 14 | #include "imgui/impl/imgui_impl_win32.h" 15 | 16 | #include "valve_sdk/misc/Color.hpp" 17 | 18 | extern ImFont* g_pDefaultFont; 19 | extern ImFont* g_pSecondFont; 20 | 21 | 22 | class Vector; 23 | 24 | class Render 25 | : public Singleton 26 | { 27 | friend class Singleton; 28 | 29 | private: 30 | ImDrawList * draw_list_act; 31 | ImDrawList * draw_list_rendering; 32 | ImDrawList* draw_list; 33 | ImDrawData draw_data; 34 | 35 | ImU32 GetU32(Color _color) 36 | { 37 | return ((_color[3] & 0xff) << 24) + ((_color[2] & 0xff) << 16) + ((_color[1] & 0xff) << 8) 38 | + (_color[0] & 0xff); 39 | } 40 | public: 41 | void Initialize(); 42 | void GetFonts(); 43 | void ClearDrawList(); 44 | void BeginScene(); 45 | ImDrawList* RenderScene(); 46 | 47 | float RenderText(const std::string& text, ImVec2 position, float size, Color color, bool center = false, bool outline = true, ImFont* pFont = g_pDefaultFont); 48 | 49 | void RenderCircle3D(Vector position, float points, float radius, Color color); 50 | 51 | void RenderImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a = ImVec2(0, 0), const ImVec2& uv_b = ImVec2(1, 1), ImU32 col = 0xFFFFFFFF) { 52 | draw_list->AddImage(user_texture_id, a, b, uv_a, uv_b, col); 53 | } 54 | 55 | template 56 | inline void RenderBoxByType(T x1, T y1, T x2, T y2, Color color, float thickness = 1.f, int type = 0) { 57 | if (type == 0) 58 | RenderBox(x1, y1, x2, y2, color, thickness); 59 | else if (type == 1) 60 | RenderCoalBox(x1, y1, x2, y2, color); 61 | else if (type == 2) 62 | RenderBox(x1, y1, x2, y2, color, thickness, 8.f); 63 | } 64 | 65 | template 66 | inline void RenderBoxFilledByType(T x1, T y1, T x2, T y2, Color color, float thickness = 1.f, int type = 0) { 67 | if (type == 0 || type == 1) 68 | RenderBoxFilled(x1, y1, x2, y2, color, thickness); 69 | else if (type == 2) 70 | RenderBoxFilled(x1, y1, x2, y2, color, thickness, 8.f); 71 | } 72 | 73 | template 74 | inline void RenderCoalBox(T x1, T y1, T x2, T y2, Color color, float th = 1.f) { 75 | int w = x2 - x1; 76 | int h = y2 - y1; 77 | 78 | int iw = w / 4; 79 | int ih = h / 4; 80 | // top 81 | RenderLine(x1, y1, x1 + iw, y1, color, th); // left 82 | RenderLine(x1 + w - iw, y1, x1 + w, y1, color, th); // right 83 | RenderLine(x1, y1, x1, y1 + ih, color, th); // top left 84 | RenderLine(x1 + w - 1, y1, x1 + w - 1, y1 + ih, color, th); // top right 85 | // bottom 86 | RenderLine(x1, y1 + h, x1 + iw, y1 + h, color, th); // left 87 | RenderLine(x1 + w - iw, y1 + h, x1 + w, y1 + h, color, th); // right 88 | RenderLine(x1, y1 + h - ih, x1, y1 + h, color, th); // bottom left 89 | RenderLine(x1 + w - 1, y1 + h - ih, x1 + w - 1, y1 + h, color, th); // bottom right 90 | } 91 | 92 | template 93 | inline void RenderBox(T x1, T y1, T x2, T y2, Color color, float thickness = 1.f, float rounding = 0.f) { 94 | draw_list->AddRect(ImVec2(x1, y1), ImVec2(x2, y2), GetU32(color), rounding, 15, thickness); 95 | } 96 | inline void RenderBox(RECT r, Color color,float thickness = 1.f, float rounding = 0.f) { 97 | RenderBox(r.left, r.top, r.right, r.bottom, color, thickness, rounding); 98 | } 99 | template 100 | inline void RenderBoxFilled(T x1, T y1, T x2, T y2, Color color, float thickness = 1.f, float rounding = 0.f) { 101 | draw_list->AddRectFilled(ImVec2(x1, y1), ImVec2(x2, y2), GetU32(color), rounding, 15); 102 | } 103 | template 104 | inline void RenderLine(T x1, T y1, T x2, T y2, Color color, float thickness = 1.f) { 105 | draw_list->AddLine(ImVec2(x1, y1), ImVec2(x2, y2), GetU32(color), thickness); 106 | } 107 | template 108 | inline float RenderText(const std::string& text, T x, T y, float size, Color clr, bool center = false, bool outline = true, ImFont* pFont = g_pDefaultFont) { 109 | return RenderText(text, ImVec2(x, y), size, clr, center, outline, pFont); 110 | } 111 | template 112 | inline void RenderCircle(T x, T y, float radius, int points, Color color, float thickness = 1.f) { 113 | draw_list->AddCircle(ImVec2(x, y), radius, GetU32(color), points, thickness); 114 | } 115 | template 116 | inline void RenderCircleFilled(T x, T y, float radius, int points, Color color) { 117 | draw_list->AddCircleFilled(ImVec2(x, y), radius, GetU32(color), points); 118 | } 119 | }; -------------------------------------------------------------------------------- /CSGOSimple/singleton.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | template 4 | class Singleton 5 | { 6 | protected: 7 | Singleton() {} 8 | ~Singleton() {} 9 | 10 | Singleton(const Singleton&) = delete; 11 | Singleton& operator=(const Singleton&) = delete; 12 | 13 | Singleton(Singleton&&) = delete; 14 | Singleton& operator=(Singleton&&) = delete; 15 | 16 | public: 17 | static T& Get() 18 | { 19 | static T inst{}; 20 | return inst; 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /CSGOSimple/ui.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 3 | #include "imgui/imgui.h" 4 | #define IMGUI_DEFINE_MATH_OPERATORS 5 | //#define IMGUI_DEFINE_PLACEMENT_NEW 6 | #include "imgui/imgui_internal.h" 7 | //#include "imgui/directx9/imgui_impl_dx9.h" 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace ImGui { 14 | bool ToggleButton(const char * label, bool * v, const ImVec2 & size_arg = ImVec2(0, 0)); 15 | // Combo box helper allowing to pass an array of strings. 16 | bool Combo(const char * label, int * currIndex, std::vector& values); 17 | bool BeginGroupBox(const char * name, const ImVec2 & size_arg = ImVec2(0, 0)); 18 | void EndGroupBox(); 19 | bool Hotkey(const char * label, int * k, const ImVec2 & size_arg = ImVec2(0, 0)); 20 | bool ListBox(const char * label, int * current_item, std::string items[], int items_count, int height_items); 21 | bool ListBox(const char * label, int * current_item, std::function lambda, int items_count, int height_in_items); 22 | bool Combo(const char * label, int * current_item, std::function lambda, int items_count, int height_in_items); 23 | } -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/CClientState.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | // Created with ReClass.NET by KN4CK3R 6 | #pragma pack(push, 1) 7 | class INetChannel 8 | { 9 | public: 10 | char pad_0000[20]; //0x0000 11 | bool m_bProcessingMessages; //0x0014 12 | bool m_bShouldDelete; //0x0015 13 | char pad_0016[2]; //0x0016 14 | int32_t m_nOutSequenceNr; //0x0018 last send outgoing sequence number 15 | int32_t m_nInSequenceNr; //0x001C last received incoming sequnec number 16 | int32_t m_nOutSequenceNrAck; //0x0020 last received acknowledge outgoing sequnce number 17 | int32_t m_nOutReliableState; //0x0024 state of outgoing reliable data (0/1) flip flop used for loss detection 18 | int32_t m_nInReliableState; //0x0028 state of incoming reliable data 19 | int32_t m_nChokedPackets; //0x002C number of choked packets 20 | char pad_0030[1044]; //0x0030 21 | }; //Size: 0x0444 22 | 23 | class CClockDriftMgr 24 | { 25 | public: 26 | float m_ClockOffsets[16]; //0x0000 27 | uint32_t m_iCurClockOffset; //0x0044 28 | uint32_t m_nServerTick; //0x0048 29 | uint32_t m_nClientTick; //0x004C 30 | }; //Size: 0x0050 31 | 32 | class CEventInfo 33 | { 34 | public: 35 | enum 36 | { 37 | EVENT_INDEX_BITS = 8, 38 | EVENT_DATA_LEN_BITS = 11, 39 | MAX_EVENT_DATA = 192, // ( 1<<8 bits == 256, but only using 192 below ) 40 | }; 41 | 42 | inline CEventInfo() 43 | { 44 | classID = 0; 45 | fire_delay = 0.0f; 46 | flags = 0; 47 | pSendTable = NULL; 48 | pClientClass = NULL; 49 | m_Packed = 0; 50 | } 51 | 52 | short classID; 53 | short pad; 54 | float fire_delay; 55 | const void* pSendTable; 56 | const ClientClass* pClientClass; 57 | int m_Packed; 58 | int flags; 59 | int filter[8]; 60 | CEventInfo* next; 61 | }; 62 | 63 | // Thanks soufiw 64 | class CClientState 65 | { 66 | public: 67 | void ForceFullUpdate() 68 | { 69 | m_nDeltaTick = -1; 70 | } 71 | 72 | char pad_0000[156]; 73 | INetChannel* m_NetChannel; 74 | int m_nChallengeNr; 75 | char pad_00A4[100]; 76 | int m_nSignonState; 77 | int signon_pads[2]; 78 | float m_flNextCmdTime; 79 | int m_nServerCount; 80 | int m_nCurrentSequence; 81 | int musor_pads[2]; 82 | CClockDriftMgr m_ClockDriftMgr; 83 | int m_nDeltaTick; 84 | bool m_bPaused; 85 | char paused_align[3]; 86 | int m_nViewEntity; 87 | int m_nPlayerSlot; 88 | int bruh; 89 | char m_szLevelName[260]; 90 | char m_szLevelNameShort[80]; 91 | char m_szGroupName[80]; 92 | char pad_032[92]; 93 | int m_nMaxClients; 94 | char pad_0314[18828]; 95 | float m_nLastServerTickTime; 96 | bool m_bInSimulation; 97 | char pad_4C9D[3]; 98 | int m_nOldTickCount; 99 | float m_flTickReminder; 100 | float m_flFrametime; 101 | int m_nLastOutgoingCommand; 102 | int m_nChokedCommands; 103 | int m_nLastCommandAck; 104 | int m_nPacketEndTickUpdate; 105 | int m_nCommandAck; 106 | int m_nSoundSequence; 107 | char pad_4CCD[76]; 108 | QAngle viewangles; 109 | int pads[54]; 110 | CEventInfo* m_pEvents; 111 | }; 112 | 113 | #pragma pack(pop) 114 | 115 | static_assert(FIELD_OFFSET(CClientState, m_NetChannel) == 0x009C, "Wrong struct offset"); 116 | static_assert(FIELD_OFFSET(CClientState, m_nCurrentSequence) == 0x011C, "Wrong struct offset"); 117 | static_assert(FIELD_OFFSET(CClientState, m_nDeltaTick) == 0x0174, "Wrong struct offset"); 118 | static_assert(FIELD_OFFSET(CClientState, m_nMaxClients) == 0x0388, "Wrong struct offset"); 119 | static_assert(FIELD_OFFSET(CClientState, viewangles) == 0x4D90, "Wrong struct offset"); -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/CInput.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Misc/CUserCmd.hpp" 4 | 5 | #define MULTIPLAYER_BACKUP 150 6 | 7 | class bf_write; 8 | class bf_read; 9 | 10 | class CInput 11 | { 12 | public: 13 | char pad_0x00[0x0C]; 14 | bool m_trackir_available; 15 | bool m_mouse_initiated; 16 | bool m_mouse_active; 17 | bool m_fJoystickAdvancedInit; 18 | char pad_0x08[0x2C]; 19 | void* m_pKeys; 20 | char pad_0x38[0x6C]; 21 | bool m_fCameraInterceptingMouse; 22 | bool m_fCameraInThirdPerson; 23 | bool m_fCameraMovingWithMouse; 24 | Vector m_vecCameraOffset; 25 | bool m_fCameraDistanceMove; 26 | int m_nCameraOldX; 27 | int m_nCameraOldY; 28 | int m_nCameraX; 29 | int m_nCameraY; 30 | bool m_CameraIsOrthographic; 31 | Vector m_angPreviousViewAngles; 32 | Vector m_angPreviousViewAnglesTilt; 33 | float m_flLastForwardMove; 34 | int m_nClearInputState; 35 | char pad_0xE4[0x8]; 36 | CUserCmd* m_pCommands; 37 | CVerifiedUserCmd* m_pVerifiedCommands; 38 | 39 | inline CUserCmd* GetUserCmd(int sequence_number); 40 | inline CUserCmd * GetUserCmd(int nSlot, int sequence_number); 41 | inline CVerifiedUserCmd* GetVerifiedCmd(int sequence_number); 42 | }; 43 | 44 | CUserCmd* CInput::GetUserCmd(int sequence_number) 45 | { 46 | using OriginalFn = CUserCmd * (__thiscall *)(void *, int, int); 47 | return CallVFunction(this, 8)(this, 0, sequence_number); 48 | } 49 | 50 | CUserCmd *CInput::GetUserCmd(int nSlot, int sequence_number) 51 | { 52 | typedef CUserCmd*(__thiscall *GetUserCmd_t)(void*, int, int); 53 | return CallVFunction(this, 8)(this, nSlot, sequence_number); 54 | } 55 | 56 | CVerifiedUserCmd* CInput::GetVerifiedCmd(int sequence_number) 57 | { 58 | auto verifiedCommands = *(CVerifiedUserCmd **)(reinterpret_cast(this) + 0xF8); 59 | return &verifiedCommands[sequence_number % MULTIPLAYER_BACKUP]; 60 | } 61 | -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IAppSystem.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef void* (*CreateInterfaceFn)(const char *pName, int *pReturnCode); 4 | typedef void* (*InstantiateInterfaceFn)(); 5 | 6 | class IAppSystem 7 | { 8 | public: 9 | virtual bool Connect(CreateInterfaceFn factory) = 0; // 0 10 | virtual void Disconnect() = 0; // 1 11 | virtual void* QueryInterface(const char *pInterfaceName) = 0; // 2 12 | virtual int /*InitReturnVal_t*/ Init() = 0; // 3 13 | virtual void Shutdown() = 0; // 4 14 | virtual const void* /*AppSystemInfo_t*/ GetDependencies() = 0; // 5 15 | virtual int /*AppSystemTier_t*/ GetTier() = 0; // 6 16 | virtual void Reconnect(CreateInterfaceFn factory, const char *pInterfaceName) = 0; // 7 17 | virtual void UnkFunc() = 0; // 8 18 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IBaseClientDll.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Misc/GlobalVars.hpp" 4 | #include "../Misc/ClientClass.hpp" 5 | 6 | enum ClientFrameStage_t 7 | { 8 | FRAME_UNDEFINED = -1, 9 | FRAME_START, 10 | FRAME_NET_UPDATE_START, 11 | FRAME_NET_UPDATE_POSTDATAUPDATE_START, 12 | FRAME_NET_UPDATE_POSTDATAUPDATE_END, 13 | FRAME_NET_UPDATE_END, 14 | FRAME_RENDER_START, 15 | FRAME_RENDER_END 16 | }; 17 | 18 | // Used by RenderView 19 | enum RenderViewInfo_t 20 | { 21 | RENDERVIEW_UNSPECIFIED = 0, 22 | RENDERVIEW_DRAWVIEWMODEL = (1 << 0), 23 | RENDERVIEW_DRAWHUD = (1 << 1), 24 | RENDERVIEW_SUPPRESSMONITORRENDERING = (1 << 2), 25 | }; 26 | 27 | class IBaseClientDLL 28 | { 29 | public: 30 | virtual int Connect(CreateInterfaceFn appSystemFactory, CGlobalVarsBase *pGlobals) = 0; 31 | virtual int Disconnect(void) = 0; 32 | virtual int Init(CreateInterfaceFn appSystemFactory, CGlobalVarsBase *pGlobals) = 0; 33 | virtual void PostInit() = 0; 34 | virtual void Shutdown(void) = 0; 35 | virtual void LevelInitPreEntity(char const* pMapName) = 0; 36 | virtual void LevelInitPostEntity() = 0; 37 | virtual void LevelShutdown(void) = 0; 38 | virtual ClientClass* GetAllClasses(void) = 0; 39 | 40 | bool DispatchUserMessage(int messageType, int arg, int arg1, void* data) 41 | { 42 | using DispatchUserMessage_t = bool* (__thiscall*)(void*, int, int, int, void*); 43 | return CallVFunction(this, 38)(this, messageType, arg, arg1, data); 44 | } 45 | }; 46 | -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IClientEntity.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "IClientNetworkable.hpp" 4 | #include "IClientRenderable.hpp" 5 | #include "IClientUnknown.hpp" 6 | #include "IClientThinkable.hpp" 7 | 8 | struct SpatializationInfo_t; 9 | 10 | class IClientEntity : public IClientUnknown, public IClientRenderable, public IClientNetworkable, public IClientThinkable 11 | { 12 | public: 13 | virtual void Release(void) = 0; 14 | }; 15 | 16 | #pragma pack(push, 1) 17 | class CCSWeaponInfo { //xSeeker 18 | public: 19 | int8_t pad0[20]; 20 | int32_t iMaxClip1; 21 | int8_t pad1[12]; 22 | int32_t iMaxReservedAmmo; 23 | int8_t pad2[96]; 24 | char* szHudName; 25 | char* szWeaponName; 26 | int8_t pad3[56]; 27 | int32_t iWeaponType; 28 | int8_t pad4[4]; 29 | int32_t iWeaponPrice; 30 | int32_t iKillAward; 31 | int8_t pad5[20]; 32 | uint8_t bFullAuto; 33 | int8_t pad6[3]; 34 | int32_t iDamage; 35 | float_t flArmorRatio; 36 | int32_t iBullets; 37 | float_t flPenetration; 38 | int8_t pad7[8]; 39 | float_t flRange; 40 | float_t flRangeModifier; 41 | int8_t pad8[16]; 42 | uint8_t bHasSilencer; 43 | int8_t pad9[15]; 44 | float_t flSpread; 45 | float_t flSpreadAlt; 46 | int8_t pad10[76]; 47 | int32_t iRecoilSeed; 48 | int8_t pad11[32]; 49 | }; 50 | #pragma pack(pop) 51 | 52 | class IWeaponSystem 53 | { 54 | virtual void unused0() = 0; 55 | virtual void unused1() = 0; 56 | public: 57 | virtual CCSWeaponInfo* GetWpnData(unsigned ItemDefinitionIndex) = 0; 58 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IClientEntityList.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Misc/IHandleEntity.hpp" 4 | 5 | class IClientNetworkable; 6 | class IClientEntity; 7 | 8 | class IClientEntityList 9 | { 10 | public: 11 | virtual IClientNetworkable* GetClientNetworkable(int entnum) = 0; 12 | virtual void* vtablepad0x1(void) = 0; 13 | virtual void* vtablepad0x2(void) = 0; 14 | virtual IClientEntity* GetClientEntity(int entNum) = 0; 15 | virtual IClientEntity* GetClientEntityFromHandle(CBaseHandle hEnt) = 0; 16 | virtual int NumberOfEntities(bool bIncludeNonNetworkable) = 0; 17 | virtual int GetHighestEntityIndex(void) = 0; 18 | virtual void SetMaxEntities(int maxEnts) = 0; 19 | virtual int GetMaxEntities() = 0; 20 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IClientMode.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Math/VMatrix.hpp" 4 | 5 | class IPanel; 6 | class C_BaseEntity; 7 | 8 | enum class ClearFlags_t 9 | { 10 | VIEW_CLEAR_COLOR = 0x1, 11 | VIEW_CLEAR_DEPTH = 0x2, 12 | VIEW_CLEAR_FULL_TARGET = 0x4, 13 | VIEW_NO_DRAW = 0x8, 14 | VIEW_CLEAR_OBEY_STENCIL = 0x10, 15 | VIEW_CLEAR_STENCIL = 0x20, 16 | }; 17 | 18 | 19 | enum class MotionBlurMode_t 20 | { 21 | MOTION_BLUR_DISABLE = 1, 22 | MOTION_BLUR_GAME = 2, 23 | MOTION_BLUR_SFM = 3 24 | }; 25 | 26 | class CViewSetup 27 | { 28 | public: 29 | __int32 x; //0x0000 30 | __int32 x_old; //0x0004 31 | __int32 y; //0x0008 32 | __int32 y_old; //0x000C 33 | __int32 width; //0x0010 34 | __int32 width_old; //0x0014 35 | __int32 height; //0x0018 36 | __int32 height_old; //0x001C 37 | char pad_0x0020[0x90]; //0x0020 38 | float fov; //0x00B0 39 | float viewmodel_fov; //0x00B4 40 | Vector origin; //0x00B8 41 | Vector angles; //0x00C4 42 | char pad_0x00D0[0x7C]; //0x00D0 43 | 44 | };//Size=0x014C 45 | 46 | class IClientMode 47 | { 48 | public: 49 | virtual ~IClientMode() {} 50 | virtual int ClientModeCSNormal(void *) = 0; 51 | virtual void Init() = 0; 52 | virtual void InitViewport() = 0; 53 | virtual void Shutdown() = 0; 54 | virtual void Enable() = 0; 55 | virtual void Disable() = 0; 56 | virtual void Layout() = 0; 57 | virtual IPanel* GetViewport() = 0; 58 | virtual void* GetViewportAnimationController() = 0; 59 | virtual void ProcessInput(bool bActive) = 0; 60 | virtual bool ShouldDrawDetailObjects() = 0; 61 | virtual bool ShouldDrawEntity(C_BaseEntity *pEnt) = 0; 62 | virtual bool ShouldDrawLocalPlayer(C_BaseEntity *pPlayer) = 0; 63 | virtual bool ShouldDrawParticles() = 0; 64 | virtual bool ShouldDrawFog(void) = 0; 65 | virtual void OverrideView(CViewSetup *pSetup) = 0; 66 | virtual int KeyInput(int down, int keynum, const char *pszCurrentBinding) = 0; 67 | virtual void StartMessageMode(int iMessageModeType) = 0; 68 | virtual IPanel* GetMessagePanel() = 0; 69 | virtual void OverrideMouseInput(float *x, float *y) = 0; 70 | virtual bool CreateMove(float flInputSampleTime, void* usercmd) = 0; 71 | virtual void LevelInit(const char *newmap) = 0; 72 | virtual void LevelShutdown(void) = 0; 73 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IClientNetworkable.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class IClientUnknown; 4 | class ClientClass; 5 | class bf_read; 6 | 7 | class IClientNetworkable 8 | { 9 | public: 10 | virtual IClientUnknown* GetIClientUnknown() = 0; 11 | virtual void Release() = 0; 12 | virtual ClientClass* GetClientClass() = 0; 13 | virtual void NotifyShouldTransmit(int state) = 0; 14 | virtual void OnPreDataChanged(int updateType) = 0; 15 | virtual void OnDataChanged(int updateType) = 0; 16 | virtual void PreDataUpdate(int updateType) = 0; 17 | virtual void PostDataUpdate(int updateType) = 0; 18 | virtual void __unkn(void) = 0; 19 | virtual bool IsDormant(void) = 0; 20 | virtual int EntIndex(void) const = 0; 21 | virtual void ReceiveMessage(int classID, bf_read& msg) = 0; 22 | virtual void* GetDataTableBasePtr() = 0; 23 | virtual void SetDestroyedOnRecreateEntities(void) = 0; 24 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IClientRenderable.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../math/Vector.hpp" 4 | #include "../math/QAngle.hpp" 5 | 6 | typedef unsigned short ClientShadowHandle_t; 7 | typedef unsigned short ClientRenderHandle_t; 8 | typedef unsigned short ModelInstanceHandle_t; 9 | typedef unsigned char uint8_t; 10 | 11 | class matrix3x4_t; 12 | class IClientUnknown; 13 | struct model_t; 14 | 15 | class IClientRenderable 16 | { 17 | public: 18 | virtual IClientUnknown* GetIClientUnknown() = 0; 19 | virtual Vector const& GetRenderOrigin(void) = 0; 20 | virtual QAngle const& GetRenderAngles(void) = 0; 21 | virtual bool ShouldDraw(void) = 0; 22 | virtual int GetRenderFlags(void) = 0; // ERENDERFLAGS_xxx 23 | virtual void Unused(void) const {} 24 | virtual ClientShadowHandle_t GetShadowHandle() const = 0; 25 | virtual ClientRenderHandle_t& RenderHandle() = 0; 26 | virtual const model_t* GetModel() const = 0; 27 | virtual int DrawModel(int flags, const int /*RenderableInstance_t*/ &instance) = 0; 28 | virtual int GetBody() = 0; 29 | virtual void GetColorModulation(float* color) = 0; 30 | virtual bool LODTest() = 0; 31 | virtual bool SetupBones(matrix3x4_t *pBoneToWorldOut, int nMaxBones, int boneMask, float currentTime) = 0; 32 | virtual void SetupWeights(const matrix3x4_t *pBoneToWorld, int nFlexWeightCount, float *pFlexWeights, float *pFlexDelayedWeights) = 0; 33 | virtual void DoAnimationEvents(void) = 0; 34 | virtual void* /*IPVSNotify*/ GetPVSNotifyInterface() = 0; 35 | virtual void GetRenderBounds(Vector& mins, Vector& maxs) = 0; 36 | virtual void GetRenderBoundsWorldspace(Vector& mins, Vector& maxs) = 0; 37 | virtual void GetShadowRenderBounds(Vector &mins, Vector &maxs, int /*ShadowType_t*/ shadowType) = 0; 38 | virtual bool ShouldReceiveProjectedTextures(int flags) = 0; 39 | virtual bool GetShadowCastDistance(float *pDist, int /*ShadowType_t*/ shadowType) const = 0; 40 | virtual bool GetShadowCastDirection(Vector *pDirection, int /*ShadowType_t*/ shadowType) const = 0; 41 | virtual bool IsShadowDirty() = 0; 42 | virtual void MarkShadowDirty(bool bDirty) = 0; 43 | virtual IClientRenderable* GetShadowParent() = 0; 44 | virtual IClientRenderable* FirstShadowChild() = 0; 45 | virtual IClientRenderable* NextShadowPeer() = 0; 46 | virtual int /*ShadowType_t*/ ShadowCastType() = 0; 47 | virtual void CreateModelInstance() = 0; 48 | virtual ModelInstanceHandle_t GetModelInstance() = 0; 49 | virtual const matrix3x4_t& RenderableToWorldTransform() = 0; 50 | virtual int LookupAttachment(const char *pAttachmentName) = 0; 51 | virtual bool GetAttachment(int number, Vector &origin, QAngle &angles) = 0; 52 | virtual bool GetAttachment(int number, matrix3x4_t &matrix) = 0; 53 | virtual float* GetRenderClipPlane(void) = 0; 54 | virtual int GetSkin() = 0; 55 | virtual void OnThreadedDrawSetup() = 0; 56 | virtual bool UsesFlexDelayedWeights() = 0; 57 | virtual void RecordToolMessage() = 0; 58 | virtual bool ShouldDrawForSplitScreenUser(int nSlot) = 0; 59 | virtual uint8_t OverrideAlphaModulation(uint8_t nAlpha) = 0; 60 | virtual uint8_t OverrideShadowAlphaModulation(uint8_t nAlpha) = 0; 61 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IClientThinkable.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class IClientUnknown; 4 | class CClientThinkHandlePtr; 5 | typedef CClientThinkHandlePtr* ClientThinkHandle_t; 6 | 7 | class IClientThinkable 8 | { 9 | public: 10 | virtual IClientUnknown* GetIClientUnknown() = 0; 11 | virtual void ClientThink() = 0; 12 | virtual ClientThinkHandle_t GetThinkHandle() = 0; 13 | virtual void SetThinkHandle(ClientThinkHandle_t hThink) = 0; 14 | virtual void Release() = 0; 15 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IClientUnknown.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Misc/IHandleEntity.hpp" 4 | #include "ICollideable.hpp" 5 | 6 | //class ICollideable; 7 | class IClientNetworkable; 8 | class IClientRenderable; 9 | class IClientEntity; 10 | class C_BaseEntity; 11 | class IClientThinkable; 12 | class IClientAlphaProperty; 13 | 14 | class IClientUnknown : public IHandleEntity 15 | { 16 | public: 17 | virtual ICollideable* GetCollideable() = 0; 18 | virtual IClientNetworkable* GetClientNetworkable() = 0; 19 | virtual IClientRenderable* GetClientRenderable() = 0; 20 | virtual IClientEntity* GetIClientEntity() = 0; 21 | virtual C_BaseEntity* GetBaseEntity() = 0; 22 | virtual IClientThinkable* GetClientThinkable() = 0; 23 | //virtual IClientModelRenderable* GetClientModelRenderable() = 0; 24 | virtual IClientAlphaProperty* GetClientAlphaProperty() = 0; 25 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/ICollideable.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum SolidType_t; 4 | class IHandleEntity; 5 | struct Ray_t; 6 | struct model_t; 7 | class CGameTrace; 8 | typedef CGameTrace trace_t; 9 | class IClientUnknown; 10 | class matrix3x4_t; 11 | 12 | class ICollideable 13 | { 14 | public: 15 | virtual IHandleEntity* GetEntityHandle() = 0; 16 | virtual const Vector& OBBMins() const = 0; 17 | virtual const Vector& OBBMaxs() const = 0; 18 | virtual void WorldSpaceTriggerBounds(Vector *pVecWorldMins, Vector *pVecWorldMaxs) const = 0; 19 | virtual bool TestCollision(const Ray_t &ray, unsigned int fContentsMask, trace_t& tr) = 0; 20 | virtual bool TestHitboxes(const Ray_t &ray, unsigned int fContentsMask, trace_t& tr) = 0; 21 | virtual int GetCollisionModelIndex() = 0; 22 | virtual const model_t* GetCollisionModel() = 0; 23 | virtual const Vector& GetCollisionOrigin() const = 0; 24 | virtual const QAngle& GetCollisionAngles() const = 0; 25 | virtual const matrix3x4_t& CollisionToWorldTransform() const = 0; 26 | virtual SolidType_t GetSolid() const = 0; 27 | virtual int GetSolidFlags() const = 0; 28 | virtual IClientUnknown* GetIClientUnknown() = 0; 29 | virtual int GetCollisionGroup() const = 0; 30 | virtual void WorldSpaceSurroundingBounds(Vector *pVecMins, Vector *pVecMaxs) = 0; 31 | virtual bool ShouldTouchTrigger(int triggerSolidFlags) const = 0; 32 | virtual const matrix3x4_t* GetRootParentToWorldTransform() const = 0; 33 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IConVar.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Misc/Color.hpp" 4 | 5 | //----------------------------------------------------------------------------- 6 | // Forward declarations 7 | //----------------------------------------------------------------------------- 8 | class IConVar; 9 | class CCommand; 10 | 11 | 12 | //----------------------------------------------------------------------------- 13 | // ConVar flags 14 | //----------------------------------------------------------------------------- 15 | // The default, no flags at all 16 | #define FCVAR_NONE 0 17 | 18 | // Command to ConVars and ConCommands 19 | // ConVar Systems 20 | #define FCVAR_UNREGISTERED (1<<0) // If this is Set, don't add to linked list, etc. 21 | #define FCVAR_DEVELOPMENTONLY (1<<1) // Hidden in released products. Flag is removed automatically if ALLOW_DEVELOPMENT_CVARS is defined. 22 | #define FCVAR_GAMEDLL (1<<2) // defined by the game DLL 23 | #define FCVAR_CLIENTDLL (1<<3) // defined by the client DLL 24 | #define FCVAR_HIDDEN (1<<4) // Hidden. Doesn't appear in GetOffset or auto complete. Like DEVELOPMENTONLY, but can't be compiled out. 25 | 26 | // ConVar only 27 | #define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value 28 | #define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server. 29 | #define FCVAR_ARCHIVE (1<<7) // Set to cause it to be saved to vars.rc 30 | #define FCVAR_NOTIFY (1<<8) // notifies players when changed 31 | #define FCVAR_USERINFO (1<<9) // changes the client's info string 32 | 33 | #define FCVAR_PRINTABLEONLY (1<<10) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ). 34 | #define FCVAR_UNLOGGED (1<<11) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log 35 | #define FCVAR_NEVER_AS_STRING (1<<12) // never try to print that cvar 36 | #define FCVAR_REPLICATED (1<<13) // server setting enforced on clients, TODO rename to FCAR_SERVER at some time 37 | #define FCVAR_CHEAT (1<<14) // Only useable in singleplayer / debug / multiplayer & sv_cheats 38 | #define FCVAR_SS (1<<15) // causes varnameN where N == 2 through max splitscreen slots for mod to be autogenerated 39 | #define FCVAR_DEMO (1<<16) // record this cvar when starting a demo file 40 | #define FCVAR_DONTRECORD (1<<17) // don't record these command in demofiles 41 | #define FCVAR_SS_ADDED (1<<18) // This is one of the "added" FCVAR_SS variables for the splitscreen players 42 | #define FCVAR_RELEASE (1<<19) // Cvars tagged with this are the only cvars avaliable to customers 43 | #define FCVAR_RELOAD_MATERIALS (1<<20) // If this cvar changes, it forces a material reload 44 | #define FCVAR_RELOAD_TEXTURES (1<<21) // If this cvar changes, if forces a texture reload 45 | #define FCVAR_NOT_CONNECTED (1<<22) // cvar cannot be changed by a client that is connected to a server 46 | #define FCVAR_MATERIAL_SYSTEM_THREAD (1<<23) // Indicates this cvar is read from the material system thread 47 | #define FCVAR_ARCHIVE_XBOX (1<<24) // cvar written to config.cfg on the Xbox 48 | #define FCVAR_ACCESSIBLE_FROM_THREADS (1<<25) // used as a debugging tool necessary to check material system thread convars 49 | //#define FCVAR_AVAILABLE (1<<26) 50 | //#define FCVAR_AVAILABLE (1<<27) 51 | #define FCVAR_SERVER_CAN_EXECUTE (1<<28) // the server is allowed to execute this command on clients via ClientCommand/NET_StringCmd/CBaseClientState::ProcessStringCmd. 52 | #define FCVAR_SERVER_CANNOT_QUERY (1<<29) // If this is Set, then the server is not allowed to query this cvar's value (via IServerPluginHelpers::StartQueryCvarValue). 53 | #define FCVAR_CLIENTCMD_CAN_EXECUTE (1<<30) // IVEngineClient::ClientCmd is allowed to execute this command. 54 | #define FCVAR_MEME_DLL (1<<31) 55 | 56 | #define FCVAR_MATERIAL_THREAD_MASK ( FCVAR_RELOAD_MATERIALS | FCVAR_RELOAD_TEXTURES | FCVAR_MATERIAL_SYSTEM_THREAD ) 57 | 58 | //----------------------------------------------------------------------------- 59 | // Called when a ConVar changes value 60 | // NOTE: For FCVAR_NEVER_AS_STRING ConVars, pOldValue == NULL 61 | //----------------------------------------------------------------------------- 62 | typedef void(*FnChangeCallback_t)(IConVar *var, const char *pOldValue, float flOldValue); 63 | 64 | 65 | //----------------------------------------------------------------------------- 66 | // Abstract interface for ConVars 67 | //----------------------------------------------------------------------------- 68 | class IConVar 69 | { 70 | public: 71 | virtual void SetValue(const char *pValue) = 0; 72 | virtual void SetValue(float flValue) = 0; 73 | virtual void SetValue(int nValue) = 0; 74 | virtual void SetValue(Color value) = 0; 75 | virtual const char *GetName(void) const = 0; 76 | virtual const char *GetBaseName(void) const = 0; 77 | virtual bool IsFlagSet(int nFlag) const = 0; 78 | virtual int GetSplitScreenPlayerSlot() const = 0; 79 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/ICvar.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "IAppSystem.hpp" 4 | #include "IConVar.hpp" 5 | 6 | class ConCommandBase; 7 | class ConCommand; 8 | class ConVar; 9 | 10 | typedef int CVarDLLIdentifier_t; 11 | 12 | class IConsoleDisplayFunc 13 | { 14 | public: 15 | virtual void ColorPrint(const uint8_t* clr, const char *pMessage) = 0; 16 | virtual void Print(const char *pMessage) = 0; 17 | virtual void DPrint(const char *pMessage) = 0; 18 | }; 19 | 20 | class ICvar : public IAppSystem 21 | { 22 | public: 23 | virtual CVarDLLIdentifier_t AllocateDLLIdentifier() = 0; // 9 24 | virtual void RegisterConCommand(ConCommandBase *pCommandBase) = 0; //10 25 | virtual void UnregisterConCommand(ConCommandBase *pCommandBase) = 0; 26 | virtual void UnregisterConCommands(CVarDLLIdentifier_t id) = 0; 27 | virtual const char* GetCommandLineValue(const char *pVariableName) = 0; 28 | virtual ConCommandBase* FindCommandBase(const char *name) = 0; 29 | virtual const ConCommandBase* FindCommandBase(const char *name) const = 0; 30 | virtual ConVar* FindVar(const char *var_name) = 0; //16 31 | virtual const ConVar* FindVar(const char *var_name) const = 0; 32 | virtual ConCommand* FindCommand(const char *name) = 0; 33 | virtual const ConCommand* FindCommand(const char *name) const = 0; 34 | virtual void InstallGlobalChangeCallback(FnChangeCallback_t callback) = 0; 35 | virtual void RemoveGlobalChangeCallback(FnChangeCallback_t callback) = 0; 36 | virtual void CallGlobalChangeCallbacks(ConVar *var, const char *pOldString, float flOldValue) = 0; 37 | virtual void InstallConsoleDisplayFunc(IConsoleDisplayFunc* pDisplayFunc) = 0; 38 | virtual void RemoveConsoleDisplayFunc(IConsoleDisplayFunc* pDisplayFunc) = 0; 39 | virtual void ConsoleColorPrintf(const uint8_t* clr, const char *pFormat, ...) const = 0; 40 | virtual void ConsolePrintf(const char *pFormat, ...) const = 0; 41 | virtual void ConsoleDPrintf(const char *pFormat, ...) const = 0; 42 | virtual void RevertFlaggedConVars(int nFlag) = 0; 43 | }; 44 | -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IEngineSound.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Math/Vector.hpp" 4 | #include "../Misc/UtlVector.hpp" 5 | 6 | struct SndInfo_t; 7 | class IRecipientFilter; 8 | 9 | enum soundlevel_t 10 | { 11 | SNDLVL_NONE = 0, 12 | SNDLVL_20dB = 20, // rustling leaves 13 | SNDLVL_25dB = 25, // whispering 14 | SNDLVL_30dB = 30, // library 15 | SNDLVL_35dB = 35, 16 | SNDLVL_40dB = 40, 17 | SNDLVL_45dB = 45, // refrigerator 18 | SNDLVL_50dB = 50, // 3.9 // average home 19 | SNDLVL_55dB = 55, // 3.0 20 | SNDLVL_IDLE = 60, // 2.0 21 | SNDLVL_60dB = 60, // 2.0 // normal conversation, clothes dryer 22 | SNDLVL_65dB = 65, // 1.5 // washing machine, dishwasher 23 | SNDLVL_STATIC = 66, // 1.25 24 | SNDLVL_70dB = 70, // 1.0 // car, vacuum cleaner, mixer, electric sewing machine 25 | SNDLVL_NORM = 75, 26 | SNDLVL_75dB = 75, // 0.8 // busy traffic 27 | SNDLVL_80dB = 80, // 0.7 // mini-bike, alarm clock, noisy restaurant, office tabulator, outboard motor, passing snowmobile 28 | SNDLVL_TALKING = 80, // 0.7 29 | SNDLVL_85dB = 85, // 0.6 // average factory, electric shaver 30 | SNDLVL_90dB = 90, // 0.5 // screaming child, passing motorcycle, convertible ride on frw 31 | SNDLVL_95dB = 95, 32 | SNDLVL_100dB = 100, // 0.4 // subway train, diesel truck, woodworking shop, pneumatic drill, boiler shop, jackhammer 33 | SNDLVL_105dB = 105, // helicopter, power mower 34 | SNDLVL_110dB = 110, // snowmobile drvrs seat, inboard motorboat, sandblasting 35 | SNDLVL_120dB = 120, // auto horn, propeller aircraft 36 | SNDLVL_130dB = 130, // air raid siren 37 | SNDLVL_GUNFIRE = 140, // 0.27 // THRESHOLD OF PAIN, gunshot, jet engine 38 | SNDLVL_140dB = 140, // 0.2 39 | SNDLVL_150dB = 150, // 0.2 40 | SNDLVL_180dB = 180, // rocket launching 41 | 42 | // NOTE: Valid soundlevel_t values are 0-255. 43 | // 256-511 are reserved for sounds using goldsrc compatibility attenuation. 44 | }; 45 | 46 | //----------------------------------------------------------------------------- 47 | // common pitch values 48 | //----------------------------------------------------------------------------- 49 | #define PITCH_NORM 100 // non-pitch shifted 50 | #define PITCH_LOW 95 // other values are possible - 0-255, where 255 is very high 51 | #define PITCH_HIGH 120 52 | 53 | class IEngineSound 54 | { 55 | public: 56 | // Precache a particular sample 57 | virtual bool PrecacheSound(const char *pSample, bool bPreload = false, bool bIsUISound = false) = 0; 58 | virtual bool IsSoundPrecached(const char *pSample) = 0; 59 | virtual void PrefetchSound(const char *pSample) = 0; 60 | virtual bool IsLoopingSound(const char *pSample) = 0; 61 | 62 | // Just loads the file header and checks for duration (not hooked up for .mp3's yet) 63 | // Is accessible to server and client though 64 | virtual float GetSoundDuration(const char *pSample) = 0; 65 | 66 | // Pitch of 100 is no pitch shift. Pitch > 100 up to 255 is a higher pitch, pitch < 100 67 | // down to 1 is a lower pitch. 150 to 70 is the realistic range. 68 | // EmitSound with pitch != 100 should be used sparingly, as it's not quite as 69 | // fast (the pitchshift mixer is not native coded). 70 | 71 | // NOTE: setting iEntIndex to -1 will cause the sound to be emitted from the local 72 | // player (client-side only) 73 | virtual int EmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash, const char *pSample, 74 | float flVolume, float flAttenuation, int nSeed, int iFlags = 0, int iPitch = PITCH_NORM, 75 | const Vector *pOrigin = NULL, const Vector *pDirection = NULL, CUtlVector< Vector >* pUtlVecOrigins = NULL, bool bUpdatePositions = true, float soundtime = 0.0f, int speakerentity = -1) = 0; 76 | 77 | virtual int EmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash, const char *pSample, 78 | float flVolume, soundlevel_t iSoundlevel, int nSeed, int iFlags = 0, int iPitch = PITCH_NORM, 79 | const Vector *pOrigin = NULL, const Vector *pDirection = NULL, CUtlVector< Vector >* pUtlVecOrigins = NULL, bool bUpdatePositions = true, float soundtime = 0.0f, int speakerentity = -1) = 0; 80 | 81 | virtual void EmitSentenceByIndex(IRecipientFilter& filter, int iEntIndex, int iChannel, int iSentenceIndex, 82 | float flVolume, soundlevel_t iSoundlevel, int nSeed, int iFlags = 0, int iPitch = PITCH_NORM, 83 | const Vector *pOrigin = NULL, const Vector *pDirection = NULL, CUtlVector< Vector >* pUtlVecOrigins = NULL, bool bUpdatePositions = true, float soundtime = 0.0f, int speakerentity = -1) = 0; 84 | 85 | virtual void StopSound(int iEntIndex, int iChannel, const char *pSample, unsigned int nSoundEntryHash) = 0; 86 | virtual void StopAllSounds(bool bClearBuffers) = 0; 87 | virtual void SetRoomType(IRecipientFilter& filter, int roomType) = 0; 88 | virtual void SetPlayerDSP(IRecipientFilter& filter, int dspType, bool fastReset) = 0; 89 | virtual int EmitAmbientSound(const char *pSample, float flVolume, int iPitch = PITCH_NORM, int flags = 0, float soundtime = 0.0f) = 0; 90 | virtual float GetDistGainFromSoundLevel(soundlevel_t soundlevel, float dist) = 0; 91 | virtual int GetGuidForLastSoundEmitted() = 0; 92 | virtual bool IsSoundStillPlaying(int guid) = 0; 93 | virtual void StopSoundByGuid(int guid, bool bForceSync) = 0; 94 | virtual void SetVolumeByGuid(int guid, float fvol) = 0; 95 | virtual void unk() = 0; 96 | virtual void GetActiveSounds(CUtlVector& sndlist) = 0; 97 | virtual void PrecacheSentenceGroup(const char *pGroupName) = 0; 98 | virtual void NotifyBeginMoviePlayback() = 0; 99 | virtual void NotifyEndMoviePlayback() = 0; 100 | virtual bool GetSoundChannelVolume(const char* sound, float &flVolumeLeft, float &flVolumeRight) = 0; 101 | virtual float GetElapsedTimeByGuid(int guid) = 0; 102 | }; 103 | -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IGameEventmanager.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #define EVENT_DEBUG_ID_INIT 42 6 | #define EVENT_DEBUG_ID_SHUTDOWN 13 7 | 8 | class bf_write; 9 | class bf_read; 10 | class IGameEvent 11 | { 12 | public: 13 | virtual ~IGameEvent() = 0; 14 | virtual const char* GetName() const = 0; 15 | 16 | virtual bool IsReliable() const = 0; 17 | virtual bool IsLocal() const = 0; 18 | virtual bool IsEmpty(const char *keyName = nullptr) = 0; 19 | 20 | virtual bool GetBool(const char *keyName = nullptr, bool defaultValue = false) = 0; 21 | virtual int GetInt(const char *keyName = nullptr, int defaultValue = 0) = 0; 22 | virtual uint64_t GetUint64(const char *keyName = nullptr, unsigned long defaultValue = 0) = 0; 23 | virtual float GetFloat(const char *keyName = nullptr, float defaultValue = 0.0f) = 0; 24 | virtual const char* GetString(const char *keyName = nullptr, const char *defaultValue = "") = 0; 25 | virtual const wchar_t* GetWString(const char *keyName, const wchar_t *defaultValue = L"") = 0; 26 | 27 | virtual void SetBool(const char *keyName, bool value) = 0; 28 | virtual void SetInt(const char *keyName, int value) = 0; 29 | virtual void SetUint64(const char *keyName, unsigned long value) = 0; 30 | virtual void SetFloat(const char *keyName, float value) = 0; 31 | virtual void SetString(const char *keyName, const char *value) = 0; 32 | virtual void SetWString(const char *keyName, const wchar_t *value) = 0; 33 | }; 34 | 35 | class IGameEventListener2 36 | { 37 | public: 38 | virtual ~IGameEventListener2(void) {} 39 | 40 | virtual void FireGameEvent(IGameEvent *event) = 0; 41 | virtual int GetEventDebugID(void) = 0; 42 | 43 | public: 44 | int m_iDebugId; 45 | }; 46 | 47 | class IGameEventManager2 48 | { 49 | public: 50 | virtual ~IGameEventManager2() = 0; 51 | virtual int LoadEventsFromFile(const char *filename) = 0; 52 | virtual void Reset() = 0; 53 | virtual bool AddListener(IGameEventListener2 *listener, const char *name, bool bServerSide) = 0; 54 | virtual bool FindListener(IGameEventListener2 *listener, const char *name) = 0; 55 | virtual int RemoveListener(IGameEventListener2 *listener) = 0; 56 | virtual IGameEvent* CreateEvent(const char *name, bool bForce, unsigned int dwUnknown) = 0; 57 | virtual bool FireEvent(IGameEvent *event, bool bDontBroadcast = false) = 0; 58 | virtual bool FireEventClientSide(IGameEvent *event) = 0; 59 | virtual IGameEvent* DuplicateEvent(IGameEvent *event) = 0; 60 | virtual void FreeEvent(IGameEvent *event) = 0; 61 | virtual bool SerializeEvent(IGameEvent *event, bf_write *buf) = 0; 62 | virtual IGameEvent* UnserializeEvent(bf_read *buf) = 0; 63 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IMDLCache.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "IAppSystem.hpp" 4 | #include "../Misc/Studio.hpp" 5 | 6 | class studiohdr_t; 7 | struct studiohwdata_t; 8 | struct vcollide_t; 9 | struct virtualmodel_t; 10 | struct vertexFileHeader_t; 11 | 12 | enum MDLCacheDataType_t 13 | { 14 | // Callbacks to Get called when data is loaded or unloaded for these: 15 | MDLCACHE_STUDIOHDR = 0, 16 | MDLCACHE_STUDIOHWDATA, 17 | MDLCACHE_VCOLLIDE, 18 | 19 | // Callbacks NOT called when data is loaded or unloaded for these: 20 | MDLCACHE_ANIMBLOCK, 21 | MDLCACHE_VIRTUALMODEL, 22 | MDLCACHE_VERTEXES, 23 | MDLCACHE_DECODEDANIMBLOCK 24 | }; 25 | 26 | enum MDLCacheFlush_t 27 | { 28 | MDLCACHE_FLUSH_STUDIOHDR = 0x01, 29 | MDLCACHE_FLUSH_STUDIOHWDATA = 0x02, 30 | MDLCACHE_FLUSH_VCOLLIDE = 0x04, 31 | MDLCACHE_FLUSH_ANIMBLOCK = 0x08, 32 | MDLCACHE_FLUSH_VIRTUALMODEL = 0x10, 33 | MDLCACHE_FLUSH_AUTOPLAY = 0x20, 34 | MDLCACHE_FLUSH_VERTEXES = 0x40, 35 | 36 | MDLCACHE_FLUSH_IGNORELOCK = 0x80000000, 37 | MDLCACHE_FLUSH_ALL = 0xFFFFFFFF 38 | }; 39 | 40 | class IMDLCacheNotify 41 | { 42 | public: 43 | virtual void OnDataLoaded(MDLCacheDataType_t type, MDLHandle_t handle) = 0; 44 | virtual void OnDataUnloaded(MDLCacheDataType_t type, MDLHandle_t handle) = 0; 45 | }; 46 | 47 | class IMDLCache : public IAppSystem 48 | { 49 | public: 50 | virtual void SetCacheNotify(IMDLCacheNotify *pNotify) = 0; 51 | virtual MDLHandle_t FindMDL(const char *pMDLRelativePath) = 0; 52 | virtual int AddRef(MDLHandle_t handle) = 0; 53 | virtual int Release(MDLHandle_t handle) = 0; 54 | virtual int GetRef(MDLHandle_t handle) = 0; 55 | virtual studiohdr_t* GetStudioHdr(MDLHandle_t handle) = 0; 56 | virtual studiohwdata_t* GetHardwareData(MDLHandle_t handle) = 0; 57 | virtual vcollide_t* GetVCollide(MDLHandle_t handle) = 0; 58 | virtual unsigned char* GetAnimBlock(MDLHandle_t handle, int nBlock) = 0; 59 | virtual virtualmodel_t* GetVirtualModel(MDLHandle_t handle) = 0; 60 | virtual int GetAutoplayList(MDLHandle_t handle, unsigned short **pOut) = 0; 61 | virtual vertexFileHeader_t* GetVertexData(MDLHandle_t handle) = 0; 62 | virtual void TouchAllData(MDLHandle_t handle) = 0; 63 | virtual void SetUserData(MDLHandle_t handle, void* pData) = 0; 64 | virtual void* GetUserData(MDLHandle_t handle) = 0; 65 | virtual bool IsErrorModel(MDLHandle_t handle) = 0; 66 | virtual void Flush(MDLCacheFlush_t nFlushFlags = MDLCACHE_FLUSH_ALL) = 0; 67 | virtual void Flush(MDLHandle_t handle, int nFlushFlags = MDLCACHE_FLUSH_ALL) = 0; 68 | virtual const char* GetModelName(MDLHandle_t handle) = 0; 69 | virtual virtualmodel_t* GetVirtualModelFast(const studiohdr_t *pStudioHdr, MDLHandle_t handle) = 0; 70 | virtual void BeginLock() = 0; 71 | virtual void EndLock() = 0; 72 | virtual int* GetFrameUnlockCounterPtrOLD() = 0; 73 | virtual void FinishPendingLoads() = 0; 74 | virtual vcollide_t* GetVCollideEx(MDLHandle_t handle, bool synchronousLoad = true) = 0; 75 | virtual bool GetVCollideSize(MDLHandle_t handle, int *pVCollideSize) = 0; 76 | virtual bool GetAsyncLoad(MDLCacheDataType_t type) = 0; 77 | virtual bool SetAsyncLoad(MDLCacheDataType_t type, bool bAsync) = 0; 78 | virtual void BeginMapLoad() = 0; 79 | virtual void EndMapLoad() = 0; 80 | virtual void MarkAsLoaded(MDLHandle_t handle) = 0; 81 | virtual void InitPreloadData(bool rebuild) = 0; 82 | virtual void ShutdownPreloadData() = 0; 83 | virtual bool IsDataLoaded(MDLHandle_t handle, MDLCacheDataType_t type) = 0; 84 | virtual int* GetFrameUnlockCounterPtr(MDLCacheDataType_t type) = 0; 85 | virtual studiohdr_t* LockStudioHdr(MDLHandle_t handle) = 0; 86 | virtual void UnlockStudioHdr(MDLHandle_t handle) = 0; 87 | virtual bool PreloadModel(MDLHandle_t handle) = 0; 88 | virtual void ResetErrorModelStatus(MDLHandle_t handle) = 0; 89 | virtual void MarkFrame() = 0; 90 | virtual void BeginCoarseLock() = 0; 91 | virtual void EndCoarseLock() = 0; 92 | virtual void ReloadVCollide(MDLHandle_t handle) = 0; 93 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IMoveHelper.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class IClientEntity; 4 | 5 | class IMoveHelper 6 | { 7 | public: 8 | virtual void _vpad() = 0; 9 | virtual void SetHost(IClientEntity* host) = 0; 10 | }; 11 | -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IPanel.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class IPanel 4 | { 5 | public: 6 | const char *GetName(unsigned int vguiPanel) 7 | { 8 | typedef const char *(__thiscall* tGetName)(void*, unsigned int); 9 | return CallVFunction(this, 36)(this, vguiPanel); 10 | } 11 | #ifdef GetClassName 12 | #undef GetClassName 13 | #endif 14 | const char *GetClassName(unsigned int vguiPanel) 15 | { 16 | typedef const char *(__thiscall* tGetClassName)(void*, unsigned int); 17 | return CallVFunction(this, 37)(this, vguiPanel); 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IPhysics.hpp: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | struct surfacephysicsparams_t 5 | { 6 | float friction; 7 | float elasticity; 8 | float density; 9 | float thickness; 10 | float dampening; 11 | }; 12 | 13 | struct surfaceaudioparams_t 14 | { 15 | float reflectivity; // like elasticity, but how much sound should be reflected by this surface 16 | float hardnessFactor; // like elasticity, but only affects impact sound choices 17 | float roughnessFactor; // like friction, but only affects scrape sound choices 18 | float roughThreshold; // surface roughness > this causes "rough" scrapes, < this causes "smooth" scrapes 19 | float hardThreshold; // surface hardness > this causes "hard" impacts, < this causes "soft" impacts 20 | float hardVelocityThreshold; // collision velocity > this causes "hard" impacts, < this causes "soft" impacts 21 | float highPitchOcclusion; //a value betweeen 0 and 100 where 0 is not occluded at all and 100 is silent (except for any additional reflected sound) 22 | float midPitchOcclusion; 23 | float lowPitchOcclusion; 24 | }; 25 | 26 | struct surfacesoundnames_t 27 | { 28 | unsigned short walkStepLeft; 29 | unsigned short walkStepRight; 30 | unsigned short runStepLeft; 31 | unsigned short runStepRight; 32 | unsigned short impactSoft; 33 | unsigned short impactHard; 34 | unsigned short scrapeSmooth; 35 | unsigned short scrapeRough; 36 | unsigned short bulletImpact; 37 | unsigned short rolling; 38 | unsigned short breakSound; 39 | unsigned short strainSound; 40 | }; 41 | 42 | struct surfacegameprops_t 43 | { 44 | public: 45 | float maxSpeedFactor; 46 | float jumpFactor; 47 | float flPenetrationModifier; 48 | float flDamageModifier; 49 | unsigned short material; 50 | byte climbable; 51 | }; 52 | 53 | struct surfacedata_t 54 | { 55 | surfacephysicsparams_t physics; 56 | surfaceaudioparams_t audio; 57 | surfacesoundnames_t sounds; 58 | surfacegameprops_t game; 59 | }; 60 | 61 | class IPhysicsSurfaceProps 62 | { 63 | public: 64 | virtual ~IPhysicsSurfaceProps(void) {} 65 | virtual int ParseSurfaceData(const char *pFilename, const char *pTextfile) = 0; 66 | virtual int SurfacePropCount(void) const = 0; 67 | virtual int GetSurfaceIndex(const char *pSurfacePropName) const = 0; 68 | virtual void GetPhysicsProperties(int surfaceDataIndex, float *density, float thickness, float friction, float elasticity) const = 0; 69 | virtual surfacedata_t* GetSurfaceData(int surfaceDataIndex) = 0; 70 | virtual const char GetString(unsigned short stringTableIndex) const = 0; 71 | virtual const char GetPropName(int surfaceDataIndex) const = 0; 72 | virtual void SetWorldMaterialIndexTable(int *pMapArray, int mapSize) = 0; 73 | virtual void GetPhysicsParameters(int surfaceDataIndex, surfacephysicsparams_t *pParamsOut) const = 0; 74 | }; 75 | -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IPrediction.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Math/QAngle.hpp" 4 | #include "../Misc/CUserCmd.hpp" 5 | #include "IMoveHelper.hpp" 6 | 7 | class CMoveData 8 | { 9 | public: 10 | bool m_bFirstRunOfFunctions : 1; 11 | bool m_bGameCodeMovedPlayer : 1; 12 | int m_nPlayerHandle; // edict index on server, client entity handle on client= 13 | int m_nImpulseCommand; // Impulse command issued. 14 | Vector m_vecViewAngles; // Command view angles (local space) 15 | Vector m_vecAbsViewAngles; // Command view angles (world space) 16 | int m_nButtons; // Attack buttons. 17 | int m_nOldButtons; // From host_client->oldbuttons; 18 | float m_flForwardMove; 19 | float m_flSideMove; 20 | float m_flUpMove; 21 | float m_flMaxSpeed; 22 | float m_flClientMaxSpeed; 23 | Vector m_vecVelocity; // edict::velocity // Current movement direction. 24 | Vector m_vecAngles; // edict::angles 25 | Vector m_vecOldAngles; 26 | float m_outStepHeight; // how much you climbed this move 27 | Vector m_outWishVel; // This is where you tried 28 | Vector m_outJumpVel; // This is your jump velocity 29 | Vector m_vecConstraintCenter; 30 | float m_flConstraintRadius; 31 | float m_flConstraintWidth; 32 | float m_flConstraintSpeedFactor; 33 | float m_flUnknown[5]; 34 | Vector m_vecAbsOrigin; 35 | }; 36 | 37 | class C_BasePlayer; 38 | 39 | class IGameMovement 40 | { 41 | public: 42 | virtual ~IGameMovement(void) {} 43 | 44 | virtual void ProcessMovement(C_BasePlayer *pPlayer, CMoveData *pMove) = 0; 45 | virtual void Reset(void) = 0; 46 | virtual void StartTrackPredictionErrors(C_BasePlayer *pPlayer) = 0; 47 | virtual void FinishTrackPredictionErrors(C_BasePlayer *pPlayer) = 0; 48 | virtual void DiffPrint(char const *fmt, ...) = 0; 49 | virtual Vector const& GetPlayerMins(bool ducked) const = 0; 50 | virtual Vector const& GetPlayerMaxs(bool ducked) const = 0; 51 | virtual Vector const& GetPlayerViewOffset(bool ducked) const = 0; 52 | virtual bool IsMovingPlayerStuck(void) const = 0; 53 | virtual C_BasePlayer* GetMovingPlayer(void) const = 0; 54 | virtual void UnblockPusher(C_BasePlayer *pPlayer, C_BasePlayer *pPusher) = 0; 55 | virtual void SetupMovementBounds(CMoveData *pMove) = 0; 56 | }; 57 | 58 | class CGameMovement 59 | : public IGameMovement 60 | { 61 | public: 62 | virtual ~CGameMovement(void) {} 63 | }; 64 | 65 | class IPrediction 66 | { 67 | public: 68 | bool InPrediction() 69 | { 70 | typedef bool(__thiscall* oInPrediction)(void*); 71 | return CallVFunction(this, 14)(this); 72 | } 73 | 74 | void RunCommand(C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper *moveHelper) 75 | { 76 | typedef void(__thiscall* oRunCommand)(void*, C_BasePlayer*, CUserCmd*, IMoveHelper*); 77 | return CallVFunction(this, 19)(this, player, ucmd, moveHelper); 78 | } 79 | 80 | void SetupMove(C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper *moveHelper, void* pMoveData) 81 | { 82 | typedef void(__thiscall* oSetupMove)(void*, C_BasePlayer*, CUserCmd*, IMoveHelper*, void*); 83 | return CallVFunction(this, 20)(this, player, ucmd, moveHelper, pMoveData); 84 | } 85 | 86 | void FinishMove(C_BasePlayer *player, CUserCmd *ucmd, void*pMoveData) 87 | { 88 | typedef void(__thiscall* oFinishMove)(void*, C_BasePlayer*, CUserCmd*, void*); 89 | return CallVFunction(this, 21)(this, player, ucmd, pMoveData); 90 | } 91 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IRefCounted.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | class IRefCounted { 3 | private: 4 | volatile long refCount; 5 | 6 | public: 7 | virtual void destructor(char bDelete) = 0; 8 | virtual bool OnFinalRelease() = 0; 9 | 10 | void unreference() { 11 | if (InterlockedDecrement(&refCount) == 0 && OnFinalRelease()) { 12 | destructor(1); 13 | } 14 | } 15 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IVDebugOverlay.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Math/Vector.hpp" 4 | #include "../Math/QAngle.hpp" 5 | #include "../Math/VMatrix.hpp" 6 | 7 | class OverlayText_t; 8 | 9 | class IVDebugOverlay 10 | { 11 | public: 12 | virtual void __unkn() = 0; 13 | virtual void AddEntityTextOverlay(int ent_index, int line_offset, float duration, int r, int g, int b, int a, const char *format, ...) = 0; 14 | virtual void AddBoxOverlay(const Vector& origin, const Vector& mins, const Vector& max, QAngle const& orientation, int r, int g, int b, int a, float duration) = 0; 15 | virtual void AddSphereOverlay(const Vector& vOrigin, float flRadius, int nTheta, int nPhi, int r, int g, int b, int a, float flDuration) = 0; 16 | virtual void AddTriangleOverlay(const Vector& p1, const Vector& p2, const Vector& p3, int r, int g, int b, int a, bool noDepthTest, float duration) = 0; 17 | virtual void AddLineOverlay(const Vector& origin, const Vector& dest, int r, int g, int b, bool noDepthTest, float duration) = 0; 18 | virtual void AddTextOverlay(const Vector& origin, float duration, const char *format, ...) = 0; 19 | virtual void AddTextOverlay(const Vector& origin, int line_offset, float duration, const char *format, ...) = 0; 20 | virtual void AddScreenTextOverlay(float flXPos, float flYPos, float flDuration, int r, int g, int b, int a, const char *text) = 0; 21 | virtual void AddSweptBoxOverlay(const Vector& start, const Vector& end, const Vector& mins, const Vector& max, const QAngle & angles, int r, int g, int b, int a, float flDuration) = 0; 22 | virtual void AddGridOverlay(const Vector& origin) = 0; 23 | virtual void AddCoordFrameOverlay(const matrix3x4_t& frame, float flScale, int vColorTable[3][3] = NULL) = 0; 24 | virtual int ScreenPosition(const Vector& point, Vector& screen) = 0; 25 | virtual int ScreenPosition(float flXPos, float flYPos, Vector& screen) = 0; 26 | virtual OverlayText_t* GetFirst(void) = 0; 27 | virtual OverlayText_t* GetNext(OverlayText_t *current) = 0; 28 | virtual void ClearDeadOverlays(void) = 0; 29 | virtual void ClearAllOverlays() = 0; 30 | virtual void AddTextOverlayRGB(const Vector& origin, int line_offset, float duration, float r, float g, float b, float alpha, const char *format, ...) = 0; 31 | virtual void AddTextOverlayRGB(const Vector& origin, int line_offset, float duration, int r, int g, int b, int a, const char *format, ...) = 0; 32 | virtual void AddLineOverlayAlpha(const Vector& origin, const Vector& dest, int r, int g, int b, int a, bool noDepthTest, float duration) = 0; 33 | virtual void AddBoxOverlay2(const Vector& origin, const Vector& mins, const Vector& max, QAngle const& orientation, const uint8_t* faceColor, const uint8_t* edgeColor, float duration) = 0; 34 | virtual void PurgeTextOverlays() = 0; 35 | virtual void DrawPill(const Vector& mins, const Vector& max, float& diameter, int r, int g, int b, int a, float duration) = 0; 36 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IVModelInfoClient.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../math/QAngle.hpp" 4 | #include "../misc/Studio.hpp" 5 | #include "IEngineTrace.hpp" //Has some structs we need here 6 | 7 | class CPhysCollide; 8 | class CUtlBuffer; 9 | class IClientRenderable; 10 | class CStudioHdr; 11 | struct virtualmodel_t; 12 | 13 | enum RenderableTranslucencyType_t 14 | { 15 | RENDERABLE_IS_OPAQUE = 0, 16 | RENDERABLE_IS_TRANSLUCENT, 17 | RENDERABLE_IS_TWO_PASS, // has both translucent and opaque sub-partsa 18 | }; 19 | 20 | class IVModelInfo 21 | { 22 | public: 23 | virtual ~IVModelInfo(void) {} 24 | virtual const model_t* GetModel(int modelindex) const = 0; 25 | virtual int GetModelIndex(const char *name) const = 0; 26 | virtual const char* GetModelName(const model_t *model) const = 0; 27 | virtual vcollide_t* GetVCollide(const model_t *model) const = 0; 28 | virtual vcollide_t* GetVCollide(int modelindex) const = 0; 29 | virtual void GetModelBounds(const model_t *model, Vector& mins, Vector& maxs) const = 0; 30 | virtual void GetModelRenderBounds(const model_t *model, Vector& mins, Vector& maxs) const = 0; 31 | virtual int GetModelFrameCount(const model_t *model) const = 0; 32 | virtual int GetModelType(const model_t *model) const = 0; 33 | virtual void* GetModelExtraData(const model_t *model) = 0; 34 | virtual bool ModelHasMaterialProxy(const model_t *model) const = 0; 35 | virtual bool IsTranslucent(model_t const* model) const = 0; 36 | virtual bool IsTranslucentTwoPass(const model_t *model) const = 0; 37 | virtual void Unused0() {}; 38 | virtual void UNUSED() = 0; 39 | virtual void UNUSE11D() = 0; 40 | virtual RenderableTranslucencyType_t ComputeTranslucencyType(const model_t *model, int nSkin, int nBody) = 0; 41 | virtual int GetModelMaterialCount(const model_t* model) const = 0; 42 | virtual void GetModelMaterials(const model_t *model, int count, IMaterial** ppMaterial) = 0; 43 | virtual bool IsModelVertexLit(const model_t *model) const = 0; 44 | virtual const char* GetModelKeyValueText(const model_t *model) = 0; 45 | virtual bool GetModelKeyValue(const model_t *model, CUtlBuffer &buf) = 0; 46 | virtual float GetModelRadius(const model_t *model) = 0; 47 | virtual CStudioHdr* GetStudioHdr(MDLHandle_t handle) = 0; 48 | virtual const studiohdr_t* FindModel(const studiohdr_t *pStudioHdr, void **cache, const char *modelname) const = 0; 49 | virtual const studiohdr_t* FindModel(void *cache) const = 0; 50 | virtual virtualmodel_t* GetVirtualModel(const studiohdr_t *pStudioHdr) const = 0; 51 | virtual uint8_t* GetAnimBlock(const studiohdr_t *pStudioHdr, int iBlock) const = 0; 52 | virtual void GetModelMaterialColorAndLighting(const model_t *model, Vector const& origin, QAngle const& angles, trace_t* pTrace, Vector& lighting, Vector& matColor) = 0; 53 | virtual void GetIlluminationPoint(const model_t *model, IClientRenderable *pRenderable, Vector const& origin, QAngle const& angles, Vector* pLightingCenter) = 0; 54 | virtual int GetModelContents(int modelIndex) const = 0; 55 | virtual studiohdr_t* GetStudiomodel(const model_t *mod) = 0; 56 | virtual int GetModelSpriteWidth(const model_t *model) const = 0; 57 | virtual int GetModelSpriteHeight(const model_t *model) const = 0; 58 | virtual void SetLevelScreenFadeRange(float flMinSize, float flMaxSize) = 0; 59 | virtual void GetLevelScreenFadeRange(float *pMinArea, float *pMaxArea) const = 0; 60 | virtual void SetViewScreenFadeRange(float flMinSize, float flMaxSize) = 0; 61 | virtual unsigned char ComputeLevelScreenFade(const Vector &vecAbsOrigin, float flRadius, float flFadeScale) const = 0; 62 | virtual unsigned char ComputeViewScreenFade(const Vector &vecAbsOrigin, float flRadius, float flFadeScale) const = 0; 63 | virtual int GetAutoplayList(const studiohdr_t *pStudioHdr, unsigned short **pAutoplayList) const = 0; 64 | virtual CPhysCollide* GetCollideForVirtualTerrain(int index) = 0; 65 | virtual bool IsUsingFBTexture(const model_t *model, int nSkin, int nBody, IClientRenderable* *pClientRenderable) const = 0; 66 | virtual const model_t* FindOrLoadModel(const char *name) const = 0; 67 | virtual MDLHandle_t GetCacheHandle(const model_t *model) const = 0; 68 | virtual int GetBrushModelPlaneCount(const model_t *model) const = 0; 69 | virtual void GetBrushModelPlane(const model_t *model, int nIndex, cplane_t &plane, Vector *pOrigin) const = 0; 70 | virtual int GetSurfacepropsForVirtualTerrain(int index) = 0; 71 | virtual bool UsesEnvCubemap(const model_t *model) const = 0; 72 | virtual bool UsesStaticLighting(const model_t *model) const = 0; 73 | }; 74 | 75 | class IVModelInfoClient : public IVModelInfo 76 | { 77 | public: 78 | }; 79 | -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/interfaces/IViewRender.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum DrawFlags_t 4 | { 5 | DF_RENDER_REFRACTION = 0x1, 6 | DF_RENDER_REFLECTION = 0x2, 7 | DF_CLIP_Z = 0x4, 8 | DF_CLIP_BELOW = 0x8, 9 | DF_RENDER_UNDERWATER = 0x10, 10 | DF_RENDER_ABOVEWATER = 0x20, 11 | DF_RENDER_WATER = 0x40, 12 | DF_UNUSED1 = 0x100, 13 | DF_WATERHEIGHT = 0x200, 14 | DF_UNUSED2 = 0x400, 15 | DF_DRAWSKYBOX = 0x800, 16 | DF_FUDGE_UP = 0x1000, 17 | DF_DRAW_ENTITITES = 0x2000, 18 | DF_UNUSED3 = 0x4000, 19 | DF_UNUSED4 = 0x8000, 20 | DF_UNUSED5 = 0x10000, 21 | DF_SAVEGAMESCREENSHOT = 0x20000, 22 | DF_CLIP_SKYBOX = 0x40000, 23 | DF_SHADOW_DEPTH_MAP = 0x100000 // Currently rendering a shadow depth map 24 | }; 25 | 26 | 27 | //----------------------------------------------------------------------------- 28 | // Purpose: View setup and rendering 29 | //----------------------------------------------------------------------------- 30 | class CViewSetup; 31 | class C_BaseEntity; 32 | struct vrect_t; 33 | class C_BaseViewModel; 34 | class IMaterial; 35 | 36 | class IViewRender 37 | { 38 | public: 39 | virtual void Init(void) = 0; 40 | virtual void LevelInit(void) = 0; 41 | virtual void LevelShutdown(void) = 0; 42 | virtual void Shutdown(void) = 0; 43 | virtual void OnRenderStart() = 0; 44 | virtual void Render(vrect_t *rect) = 0; 45 | virtual void RenderView(const CViewSetup &view, int nClearFlags, int whatToDraw) = 0; 46 | virtual int GetDrawFlags() = 0; 47 | virtual void StartPitchDrift(void) = 0; 48 | virtual void StopPitchDrift(void) = 0; 49 | virtual void* GetFrustum() = 0; 50 | virtual bool ShouldDrawBrushModels(void) = 0; 51 | virtual const CViewSetup* GetPlayerViewSetup(void) const = 0; 52 | virtual const CViewSetup* GetViewSetup(void) const = 0; 53 | virtual void DisableVis(void) = 0; 54 | virtual int BuildWorldListsNumber() const = 0; 55 | virtual void SetCheapWaterStartDistance(float flCheapWaterStartDistance) = 0; 56 | virtual void SetCheapWaterEndDistance(float flCheapWaterEndDistance) = 0; 57 | virtual void GetWaterLODParams(float &flCheapWaterStartDistance, float &flCheapWaterEndDistance) = 0; 58 | virtual void DriftPitch(void) = 0; 59 | virtual void SetScreenOverlayMaterial(IMaterial *pMaterial) = 0; 60 | virtual IMaterial* GetScreenOverlayMaterial() = 0; 61 | virtual void WriteSaveGameScreenshot(const char *pFilename) = 0; 62 | virtual void WriteSaveGameScreenshotOfSize(const char *pFilename, int width, int height) = 0; 63 | virtual void QueueOverlayRenderView(const CViewSetup &view, int nClearFlags, int whatToDraw) = 0; 64 | virtual float GetZNear() = 0; 65 | virtual float GetZFar() = 0; 66 | virtual void GetScreenFadeDistances(float *min, float *max) = 0; 67 | virtual C_BaseEntity* GetCurrentlyDrawingEntity() = 0; 68 | virtual void SetCurrentlyDrawingEntity(C_BaseEntity *pEnt) = 0; 69 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/math/QAngle.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class QAngle 4 | { 5 | public: 6 | QAngle(void) 7 | { 8 | Init(); 9 | } 10 | QAngle(float X, float Y, float Z) 11 | { 12 | Init(X, Y, Z); 13 | } 14 | QAngle(const float* clr) 15 | { 16 | Init(clr[0], clr[1], clr[2]); 17 | } 18 | 19 | void Init(float ix = 0.0f, float iy = 0.0f, float iz = 0.0f) 20 | { 21 | pitch = ix; 22 | yaw = iy; 23 | roll = iz; 24 | } 25 | 26 | float operator[](int i) const 27 | { 28 | return ((float*)this)[i]; 29 | } 30 | float& operator[](int i) 31 | { 32 | return ((float*)this)[i]; 33 | } 34 | 35 | QAngle& operator+=(const QAngle& v) 36 | { 37 | pitch += v.pitch; yaw += v.yaw; roll += v.roll; 38 | return *this; 39 | } 40 | QAngle& operator-=(const QAngle& v) 41 | { 42 | pitch -= v.pitch; yaw -= v.yaw; roll -= v.roll; 43 | return *this; 44 | } 45 | QAngle& operator*=(float fl) 46 | { 47 | pitch *= fl; 48 | yaw *= fl; 49 | roll *= fl; 50 | return *this; 51 | } 52 | QAngle& operator*=(const QAngle& v) 53 | { 54 | pitch *= v.pitch; 55 | yaw *= v.yaw; 56 | roll *= v.roll; 57 | return *this; 58 | } 59 | QAngle& operator/=(const QAngle& v) 60 | { 61 | pitch /= v.pitch; 62 | yaw /= v.yaw; 63 | roll /= v.roll; 64 | return *this; 65 | } 66 | QAngle& operator+=(float fl) 67 | { 68 | pitch += fl; 69 | yaw += fl; 70 | roll += fl; 71 | return *this; 72 | } 73 | QAngle& operator/=(float fl) 74 | { 75 | pitch /= fl; 76 | yaw /= fl; 77 | roll /= fl; 78 | return *this; 79 | } 80 | QAngle& operator-=(float fl) 81 | { 82 | pitch -= fl; 83 | yaw -= fl; 84 | roll -= fl; 85 | return *this; 86 | } 87 | 88 | QAngle& operator=(const QAngle &vOther) 89 | { 90 | pitch = vOther.pitch; yaw = vOther.yaw; roll = vOther.roll; 91 | return *this; 92 | } 93 | 94 | QAngle operator-(void) const 95 | { 96 | return QAngle(-pitch, -yaw, -roll); 97 | } 98 | QAngle operator+(const QAngle& v) const 99 | { 100 | return QAngle(pitch + v.pitch, yaw + v.yaw, roll + v.roll); 101 | } 102 | QAngle operator-(const QAngle& v) const 103 | { 104 | return QAngle(pitch - v.pitch, yaw - v.yaw, roll - v.roll); 105 | } 106 | QAngle operator*(float fl) const 107 | { 108 | return QAngle(pitch * fl, yaw * fl, roll * fl); 109 | } 110 | QAngle operator*(const QAngle& v) const 111 | { 112 | return QAngle(pitch * v.pitch, yaw * v.yaw, roll * v.roll); 113 | } 114 | QAngle operator/(float fl) const 115 | { 116 | return QAngle(pitch / fl, yaw / fl, roll / fl); 117 | } 118 | QAngle operator/(const QAngle& v) const 119 | { 120 | return QAngle(pitch / v.pitch, yaw / v.yaw, roll / v.roll); 121 | } 122 | 123 | float Length() const 124 | { 125 | return sqrt(pitch*pitch + yaw*yaw + roll*roll); 126 | } 127 | float LengthSqr(void) const 128 | { 129 | return (pitch*pitch + yaw*yaw + roll*roll); 130 | } 131 | bool IsZero(float tolerance = 0.01f) const 132 | { 133 | return (pitch > -tolerance && pitch < tolerance && 134 | yaw > -tolerance && yaw < tolerance && 135 | roll > -tolerance && roll < tolerance); 136 | } 137 | 138 | float Normalize() const 139 | { 140 | QAngle res = *this; 141 | float l = res.Length(); 142 | if (l != 0.0f) 143 | { 144 | res /= l; 145 | } 146 | else 147 | { 148 | res[0] = res[1] = res[2] = 0.0f; 149 | } 150 | return l; 151 | } 152 | 153 | float pitch; 154 | float yaw; 155 | float roll; 156 | }; 157 | 158 | inline QAngle operator*(float lhs, const QAngle& rhs) 159 | { 160 | return rhs * lhs; 161 | } 162 | inline QAngle operator/(float lhs, const QAngle& rhs) 163 | { 164 | return rhs / lhs; 165 | } 166 | -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/math/Vector.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class Vector 6 | { 7 | public: 8 | Vector(void) 9 | { 10 | Invalidate(); 11 | } 12 | Vector(float X, float Y, float Z) 13 | { 14 | x = X; 15 | y = Y; 16 | z = Z; 17 | } 18 | Vector(const float* clr) 19 | { 20 | x = clr[0]; 21 | y = clr[1]; 22 | z = clr[2]; 23 | } 24 | 25 | void Init(float ix = 0.0f, float iy = 0.0f, float iz = 0.0f) 26 | { 27 | x = ix; y = iy; z = iz; 28 | } 29 | bool IsValid() const 30 | { 31 | return std::isfinite(x) && std::isfinite(y) && std::isfinite(z); 32 | } 33 | void Invalidate() 34 | { 35 | x = y = z = std::numeric_limits::infinity(); 36 | } 37 | 38 | float& operator[](int i) 39 | { 40 | return ((float*)this)[i]; 41 | } 42 | float operator[](int i) const 43 | { 44 | return ((float*)this)[i]; 45 | } 46 | 47 | void Zero() 48 | { 49 | x = y = z = 0.0f; 50 | } 51 | 52 | bool operator==(const Vector& src) const 53 | { 54 | return (src.x == x) && (src.y == y) && (src.z == z); 55 | } 56 | bool operator!=(const Vector& src) const 57 | { 58 | return (src.x != x) || (src.y != y) || (src.z != z); 59 | } 60 | 61 | Vector& operator+=(const Vector& v) 62 | { 63 | x += v.x; y += v.y; z += v.z; 64 | return *this; 65 | } 66 | Vector& operator-=(const Vector& v) 67 | { 68 | x -= v.x; y -= v.y; z -= v.z; 69 | return *this; 70 | } 71 | Vector& operator*=(float fl) 72 | { 73 | x *= fl; 74 | y *= fl; 75 | z *= fl; 76 | return *this; 77 | } 78 | Vector& operator*=(const Vector& v) 79 | { 80 | x *= v.x; 81 | y *= v.y; 82 | z *= v.z; 83 | return *this; 84 | } 85 | Vector& operator/=(const Vector& v) 86 | { 87 | x /= v.x; 88 | y /= v.y; 89 | z /= v.z; 90 | return *this; 91 | } 92 | Vector& operator+=(float fl) 93 | { 94 | x += fl; 95 | y += fl; 96 | z += fl; 97 | return *this; 98 | } 99 | Vector& operator/=(float fl) 100 | { 101 | x /= fl; 102 | y /= fl; 103 | z /= fl; 104 | return *this; 105 | } 106 | Vector& operator-=(float fl) 107 | { 108 | x -= fl; 109 | y -= fl; 110 | z -= fl; 111 | return *this; 112 | } 113 | 114 | void NormalizeInPlace() 115 | { 116 | *this = Normalized(); 117 | } 118 | Vector Normalized() const 119 | { 120 | Vector res = *this; 121 | float l = res.Length(); 122 | if(l != 0.0f) { 123 | res /= l; 124 | } else { 125 | res.x = res.y = res.z = 0.0f; 126 | } 127 | return res; 128 | } 129 | 130 | float DistTo(const Vector &vOther) const 131 | { 132 | Vector delta; 133 | 134 | delta.x = x - vOther.x; 135 | delta.y = y - vOther.y; 136 | delta.z = z - vOther.z; 137 | 138 | return delta.Length(); 139 | } 140 | float DistToSqr(const Vector &vOther) const 141 | { 142 | Vector delta; 143 | 144 | delta.x = x - vOther.x; 145 | delta.y = y - vOther.y; 146 | delta.z = z - vOther.z; 147 | 148 | return delta.LengthSqr(); 149 | } 150 | float Dot(const Vector& vOther) const 151 | { 152 | return (x*vOther.x + y*vOther.y + z*vOther.z); 153 | } 154 | float Length() const 155 | { 156 | return sqrt(x*x + y*y + z*z); 157 | } 158 | float LengthSqr(void) const 159 | { 160 | return (x*x + y*y + z*z); 161 | } 162 | float Length2D() const 163 | { 164 | return sqrt(x*x + y*y); 165 | } 166 | 167 | Vector& operator=(const Vector &vOther) 168 | { 169 | x = vOther.x; y = vOther.y; z = vOther.z; 170 | return *this; 171 | } 172 | 173 | Vector Vector::operator-(void) const 174 | { 175 | return Vector(-x, -y, -z); 176 | } 177 | Vector Vector::operator+(const Vector& v) const 178 | { 179 | return Vector(x + v.x, y + v.y, z + v.z); 180 | } 181 | Vector Vector::operator-(const Vector& v) const 182 | { 183 | return Vector(x - v.x, y - v.y, z - v.z); 184 | } 185 | Vector Vector::operator*(float fl) const 186 | { 187 | return Vector(x * fl, y * fl, z * fl); 188 | } 189 | Vector Vector::operator*(const Vector& v) const 190 | { 191 | return Vector(x * v.x, y * v.y, z * v.z); 192 | } 193 | Vector Vector::operator/(float fl) const 194 | { 195 | return Vector(x / fl, y / fl, z / fl); 196 | } 197 | Vector Vector::operator/(const Vector& v) const 198 | { 199 | return Vector(x / v.x, y / v.y, z / v.z); 200 | } 201 | 202 | float x, y, z; 203 | }; 204 | 205 | inline Vector operator*(float lhs, const Vector& rhs) 206 | { 207 | return rhs * lhs; 208 | } 209 | inline Vector operator/(float lhs, const Vector& rhs) 210 | { 211 | return rhs / lhs; 212 | } 213 | 214 | class __declspec(align(16)) VectorAligned : public Vector 215 | { 216 | public: 217 | inline VectorAligned(void) {}; 218 | inline VectorAligned(float X, float Y, float Z) 219 | { 220 | Init(X, Y, Z); 221 | } 222 | 223 | public: 224 | explicit VectorAligned(const Vector &vOther) 225 | { 226 | Init(vOther.x, vOther.y, vOther.z); 227 | } 228 | 229 | VectorAligned& operator=(const Vector &vOther) 230 | { 231 | Init(vOther.x, vOther.y, vOther.z); 232 | return *this; 233 | } 234 | 235 | VectorAligned& operator=(const VectorAligned &vOther) 236 | { 237 | Init(vOther.x, vOther.y, vOther.z); 238 | return *this; 239 | } 240 | 241 | float w; 242 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/math/Vector2D.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef float vec_t; 4 | // 2D Vector 5 | class Vector2D 6 | { 7 | public: 8 | // Members 9 | vec_t x, y; 10 | 11 | // Construction/destruction: 12 | Vector2D(void); 13 | Vector2D(vec_t X, vec_t Y); 14 | Vector2D(vec_t* clr); 15 | 16 | Vector2D::Vector2D(const Vector2D &vOther) 17 | { 18 | x = vOther.x; y = vOther.y; 19 | } 20 | 21 | // Initialization 22 | void Init(vec_t ix = 0.0f, vec_t iy = 0.0f); 23 | // TODO (Ilya): Should there be an init that takes a single float for consistency? 24 | 25 | // Got any nasty NAN's? 26 | bool IsValid() const; 27 | void Invalidate(); 28 | 29 | // array access... 30 | vec_t operator[](int i) const; 31 | vec_t& operator[](int i); 32 | 33 | // Base address... 34 | vec_t* Base(); 35 | vec_t const* Base() const; 36 | 37 | // Initialization methods 38 | void Random(vec_t minVal, vec_t maxVal); 39 | void Zero(); ///< zero out a vector 40 | 41 | // equality 42 | bool operator==(const Vector2D& v) const; 43 | bool operator!=(const Vector2D& v) const; 44 | 45 | // arithmetic operations 46 | Vector2D& operator+=(const Vector2D& v) 47 | { 48 | x += v.x; y += v.y; 49 | return *this; 50 | } 51 | 52 | Vector2D& operator-=(const Vector2D& v) 53 | { 54 | x -= v.x; y -= v.y; 55 | return *this; 56 | } 57 | 58 | Vector2D& operator*=(float fl) 59 | { 60 | x *= fl; 61 | y *= fl; 62 | return *this; 63 | } 64 | 65 | Vector2D& operator*=(const Vector2D& v) 66 | { 67 | x *= v.x; 68 | y *= v.y; 69 | return *this; 70 | } 71 | 72 | Vector2D& operator/=(const Vector2D& v) 73 | { 74 | x /= v.x; 75 | y /= v.y; 76 | return *this; 77 | } 78 | 79 | // this ought to be an opcode. 80 | Vector2D& operator+=(float fl) 81 | { 82 | x += fl; 83 | y += fl; 84 | return *this; 85 | } 86 | 87 | // this ought to be an opcode. 88 | Vector2D& operator/=(float fl) 89 | { 90 | x /= fl; 91 | y /= fl; 92 | return *this; 93 | } 94 | Vector2D& operator-=(float fl) 95 | { 96 | x -= fl; 97 | y -= fl; 98 | return *this; 99 | } 100 | 101 | // negate the vector components 102 | void Negate(); 103 | 104 | // Get the vector's magnitude. 105 | vec_t Length() const; 106 | 107 | // Get the vector's magnitude squared. 108 | vec_t LengthSqr(void) const 109 | { 110 | return (x*x + y*y); 111 | } 112 | 113 | // return true if this vector is (0,0,0) within tolerance 114 | bool IsZero(float tolerance = 0.01f) const 115 | { 116 | return (x > -tolerance && x < tolerance && 117 | y > -tolerance && y < tolerance); 118 | } 119 | 120 | vec_t NormalizeInPlace(); 121 | Vector2D Normalized() const; 122 | bool IsLengthGreaterThan(float val) const; 123 | bool IsLengthLessThan(float val) const; 124 | 125 | // check if a vector is within the box defined by two other vectors 126 | bool WithinAABox(Vector2D const &boxmin, Vector2D const &boxmax); 127 | 128 | // Get the distance from this vector to the other one. 129 | vec_t DistTo(const Vector2D &vOther) const; 130 | 131 | // Get the distance from this vector to the other one squared. 132 | // NJS: note, VC wasn't inlining it correctly in several deeply nested inlines due to being an 'out of line' . 133 | // may be able to tidy this up after switching to VC7 134 | vec_t DistToSqr(const Vector2D &vOther) const 135 | { 136 | Vector2D delta; 137 | 138 | delta.x = x - vOther.x; 139 | delta.y = y - vOther.y; 140 | 141 | return delta.LengthSqr(); 142 | } 143 | 144 | // Copy 145 | void CopyToArray(float* rgfl) const; 146 | 147 | // Multiply, add, and assign to this (ie: *this = a + b * scalar). This 148 | // is about 12% faster than the actual vector equation (because it's done per-component 149 | // rather than per-vector). 150 | void MulAdd(const Vector2D& a, const Vector2D& b, float scalar); 151 | 152 | // Dot product. 153 | vec_t Dot(const Vector2D& vOther) const; 154 | 155 | // assignment 156 | Vector2D& operator=(const Vector2D &vOther); 157 | 158 | // 2d 159 | vec_t Length2D(void) const; 160 | vec_t Length2DSqr(void) const; 161 | 162 | /// Get the component of this vector parallel to some other given vector 163 | Vector2D ProjectOnto(const Vector2D& onto); 164 | 165 | // copy constructors 166 | // Vector2D(const Vector2D &vOther); 167 | 168 | // arithmetic operations 169 | Vector2D operator-(void) const; 170 | 171 | Vector2D operator+(const Vector2D& v) const; 172 | Vector2D operator-(const Vector2D& v) const; 173 | Vector2D operator*(const Vector2D& v) const; 174 | Vector2D operator/(const Vector2D& v) const; 175 | Vector2D operator*(float fl) const; 176 | Vector2D operator/(float fl) const; 177 | 178 | // Cross product between two vectors. 179 | Vector2D Cross(const Vector2D &vOther) const; 180 | 181 | // Returns a vector with the min or max in X, Y, and Z. 182 | Vector2D Min(const Vector2D &vOther) const; 183 | Vector2D Max(const Vector2D &vOther) const; 184 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/math/Vector4D.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef float vec_t; 4 | // 3D Vector4D 5 | class Vector4D 6 | { 7 | public: 8 | // Members 9 | vec_t x, y, z, w; 10 | 11 | // Construction/destruction: 12 | Vector4D(void); 13 | Vector4D(vec_t X, vec_t Y, vec_t Z, vec_t W); 14 | Vector4D(vec_t* clr); 15 | 16 | // Initialization 17 | void Init(vec_t ix = 0.0f, vec_t iy = 0.0f, vec_t iz = 0.0f, vec_t iw = 0.0f); 18 | // TODO (Ilya): Should there be an init that takes a single float for consistency? 19 | 20 | // Got any nasty NAN's? 21 | bool IsValid() const; 22 | void Invalidate(); 23 | 24 | // array access... 25 | vec_t operator[](int i) const; 26 | vec_t& operator[](int i); 27 | 28 | // Base address... 29 | vec_t* Base(); 30 | vec_t const* Base() const; 31 | 32 | // Initialization methods 33 | void Random(vec_t minVal, vec_t maxVal); 34 | void Zero(); ///< zero out a vector 35 | 36 | // equality 37 | bool operator==(const Vector4D& v) const; 38 | bool operator!=(const Vector4D& v) const; 39 | 40 | // arithmetic operations 41 | Vector4D& operator+=(const Vector4D& v) 42 | { 43 | x += v.x; y += v.y; z += v.z; w += v.w; 44 | return *this; 45 | } 46 | 47 | Vector4D& operator-=(const Vector4D& v) 48 | { 49 | x -= v.x; y -= v.y; z -= v.z; w -= v.w; 50 | return *this; 51 | } 52 | 53 | Vector4D& operator*=(float fl) 54 | { 55 | x *= fl; 56 | y *= fl; 57 | z *= fl; 58 | w *= fl; 59 | return *this; 60 | } 61 | 62 | Vector4D& operator*=(const Vector4D& v) 63 | { 64 | x *= v.x; 65 | y *= v.y; 66 | z *= v.z; 67 | w *= v.w; 68 | return *this; 69 | } 70 | 71 | Vector4D& operator/=(const Vector4D& v) 72 | { 73 | x /= v.x; 74 | y /= v.y; 75 | z /= v.z; 76 | w /= v.w; 77 | return *this; 78 | } 79 | 80 | // this ought to be an opcode. 81 | Vector4D& operator+=(float fl) 82 | { 83 | x += fl; 84 | y += fl; 85 | z += fl; 86 | w += fl; 87 | return *this; 88 | } 89 | 90 | // this ought to be an opcode. 91 | Vector4D& operator/=(float fl) 92 | { 93 | x /= fl; 94 | y /= fl; 95 | z /= fl; 96 | w /= fl; 97 | return *this; 98 | } 99 | Vector4D& operator-=(float fl) 100 | { 101 | x -= fl; 102 | y -= fl; 103 | z -= fl; 104 | w -= fl; 105 | return *this; 106 | } 107 | 108 | // negate the vector components 109 | void Negate(); 110 | 111 | // Get the vector's magnitude. 112 | vec_t Length() const; 113 | 114 | // Get the vector's magnitude squared. 115 | vec_t LengthSqr(void) const 116 | { 117 | return (x*x + y*y + z*z); 118 | } 119 | 120 | // return true if this vector is (0,0,0) within tolerance 121 | bool IsZero(float tolerance = 0.01f) const 122 | { 123 | return (x > -tolerance && x < tolerance && 124 | y > -tolerance && y < tolerance && 125 | z > -tolerance && z < tolerance && 126 | w > -tolerance && w < tolerance); 127 | } 128 | 129 | vec_t NormalizeInPlace(); 130 | Vector4D Normalized() const; 131 | bool IsLengthGreaterThan(float val) const; 132 | bool IsLengthLessThan(float val) const; 133 | 134 | // check if a vector is within the box defined by two other vectors 135 | bool WithinAABox(Vector4D const &boxmin, Vector4D const &boxmax); 136 | 137 | // Get the distance from this vector to the other one. 138 | vec_t DistTo(const Vector4D &vOther) const; 139 | 140 | // Get the distance from this vector to the other one squared. 141 | // NJS: note, VC wasn't inlining it correctly in several deeply nested inlines due to being an 'out of line' . 142 | // may be able to tidy this up after switching to VC7 143 | vec_t DistToSqr(const Vector4D &vOther) const 144 | { 145 | Vector4D delta; 146 | 147 | delta.x = x - vOther.x; 148 | delta.y = y - vOther.y; 149 | delta.z = z - vOther.z; 150 | delta.w = w - vOther.w; 151 | 152 | return delta.LengthSqr(); 153 | } 154 | 155 | // Copy 156 | void CopyToArray(float* rgfl) const; 157 | 158 | // Multiply, add, and assign to this (ie: *this = a + b * scalar). This 159 | // is about 12% faster than the actual vector equation (because it's done per-component 160 | // rather than per-vector). 161 | void MulAdd(const Vector4D& a, const Vector4D& b, float scalar); 162 | 163 | // Dot product. 164 | vec_t Dot(const Vector4D& vOther) const; 165 | 166 | // assignment 167 | Vector4D& operator=(const Vector4D &vOther); 168 | 169 | // 2d 170 | vec_t Length2D(void) const; 171 | vec_t Length2DSqr(void) const; 172 | 173 | /// Get the component of this vector parallel to some other given vector 174 | Vector4D ProjectOnto(const Vector4D& onto); 175 | 176 | // copy constructors 177 | // Vector4D(const Vector4D &vOther); 178 | 179 | // arithmetic operations 180 | Vector4D operator-(void) const; 181 | 182 | Vector4D operator+(const Vector4D& v) const; 183 | Vector4D operator-(const Vector4D& v) const; 184 | Vector4D operator*(const Vector4D& v) const; 185 | Vector4D operator/(const Vector4D& v) const; 186 | Vector4D operator*(float fl) const; 187 | Vector4D operator/(float fl) const; 188 | 189 | // Returns a vector with the min or max in X, Y, and Z. 190 | Vector4D Min(const Vector4D &vOther) const; 191 | Vector4D Max(const Vector4D &vOther) const; 192 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/misc/BaseHandle.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "IHandleEntity.hpp" 4 | 5 | #define NUM_ENT_ENTRY_BITS (11 + 2) 6 | #define NUM_ENT_ENTRIES (1 << NUM_ENT_ENTRY_BITS) 7 | #define INVALID_EHANDLE_INDEX 0xFFFFFFFF 8 | #define NUM_SERIAL_NUM_BITS 16 // (32 - NUM_ENT_ENTRY_BITS) 9 | #define NUM_SERIAL_NUM_SHIFT_BITS (32 - NUM_SERIAL_NUM_BITS) 10 | #define ENT_ENTRY_MASK (( 1 << NUM_SERIAL_NUM_BITS) - 1) 11 | 12 | class IHandleEntity; 13 | 14 | class CBaseHandle 15 | { 16 | public: 17 | CBaseHandle(); 18 | CBaseHandle(const CBaseHandle &other); 19 | CBaseHandle(unsigned long value); 20 | CBaseHandle(int iEntry, int iSerialNumber); 21 | 22 | void Init(int iEntry, int iSerialNumber); 23 | void Term(); 24 | 25 | // Even if this returns true, Get() still can return return a non-null value. 26 | // This just tells if the handle has been initted with any values. 27 | bool IsValid() const; 28 | 29 | int GetEntryIndex() const; 30 | int GetSerialNumber() const; 31 | 32 | int ToInt() const; 33 | bool operator !=(const CBaseHandle &other) const; 34 | bool operator ==(const CBaseHandle &other) const; 35 | bool operator ==(const IHandleEntity* pEnt) const; 36 | bool operator !=(const IHandleEntity* pEnt) const; 37 | bool operator <(const CBaseHandle &other) const; 38 | bool operator <(const IHandleEntity* pEnt) const; 39 | 40 | // Assign a value to the handle. 41 | const CBaseHandle& operator=(const IHandleEntity *pEntity); 42 | const CBaseHandle& Set(const IHandleEntity *pEntity); 43 | 44 | // Use this to dereference the handle. 45 | // Note: this is implemented in game code (ehandle.h) 46 | IHandleEntity* Get() const; 47 | 48 | protected: 49 | // The low NUM_SERIAL_BITS hold the index. If this value is less than MAX_EDICTS, then the entity is networkable. 50 | // The high NUM_SERIAL_NUM_BITS bits are the serial number. 51 | unsigned long m_Index; 52 | }; 53 | 54 | inline CBaseHandle::CBaseHandle() 55 | { 56 | m_Index = INVALID_EHANDLE_INDEX; 57 | } 58 | 59 | inline CBaseHandle::CBaseHandle(const CBaseHandle &other) 60 | { 61 | m_Index = other.m_Index; 62 | } 63 | 64 | inline CBaseHandle::CBaseHandle(unsigned long value) 65 | { 66 | m_Index = value; 67 | } 68 | 69 | inline CBaseHandle::CBaseHandle(int iEntry, int iSerialNumber) 70 | { 71 | Init(iEntry, iSerialNumber); 72 | } 73 | 74 | inline void CBaseHandle::Init(int iEntry, int iSerialNumber) 75 | { 76 | m_Index = iEntry | (iSerialNumber << NUM_ENT_ENTRY_BITS); 77 | } 78 | 79 | inline void CBaseHandle::Term() 80 | { 81 | m_Index = INVALID_EHANDLE_INDEX; 82 | } 83 | 84 | inline bool CBaseHandle::IsValid() const 85 | { 86 | return m_Index != INVALID_EHANDLE_INDEX; 87 | } 88 | 89 | inline int CBaseHandle::GetEntryIndex() const 90 | { 91 | return m_Index & ENT_ENTRY_MASK; 92 | } 93 | 94 | inline int CBaseHandle::GetSerialNumber() const 95 | { 96 | return m_Index >> NUM_ENT_ENTRY_BITS; 97 | } 98 | 99 | inline int CBaseHandle::ToInt() const 100 | { 101 | return (int)m_Index; 102 | } 103 | 104 | inline bool CBaseHandle::operator !=(const CBaseHandle &other) const 105 | { 106 | return m_Index != other.m_Index; 107 | } 108 | 109 | inline bool CBaseHandle::operator ==(const CBaseHandle &other) const 110 | { 111 | return m_Index == other.m_Index; 112 | } 113 | 114 | inline bool CBaseHandle::operator ==(const IHandleEntity* pEnt) const 115 | { 116 | return Get() == pEnt; 117 | } 118 | 119 | inline bool CBaseHandle::operator !=(const IHandleEntity* pEnt) const 120 | { 121 | return Get() != pEnt; 122 | } 123 | 124 | inline bool CBaseHandle::operator <(const CBaseHandle &other) const 125 | { 126 | return m_Index < other.m_Index; 127 | } 128 | 129 | inline bool CBaseHandle::operator <(const IHandleEntity *pEntity) const 130 | { 131 | unsigned long otherIndex = (pEntity) ? pEntity->GetRefEHandle().m_Index : INVALID_EHANDLE_INDEX; 132 | return m_Index < otherIndex; 133 | } 134 | 135 | inline const CBaseHandle& CBaseHandle::operator=(const IHandleEntity *pEntity) 136 | { 137 | return Set(pEntity); 138 | } 139 | 140 | inline const CBaseHandle& CBaseHandle::Set(const IHandleEntity *pEntity) 141 | { 142 | if(pEntity) { 143 | *this = pEntity->GetRefEHandle(); 144 | } else { 145 | m_Index = INVALID_EHANDLE_INDEX; 146 | } 147 | 148 | return *this; 149 | } -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/misc/CUserCmd.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "checksum_crc.hpp" 4 | #include "checksum_md5.hpp" 5 | #include "../Math/QAngle.hpp" 6 | 7 | #define IN_ATTACK (1 << 0) 8 | #define IN_JUMP (1 << 1) 9 | #define IN_DUCK (1 << 2) 10 | #define IN_FORWARD (1 << 3) 11 | #define IN_BACK (1 << 4) 12 | #define IN_USE (1 << 5) 13 | #define IN_CANCEL (1 << 6) 14 | #define IN_LEFT (1 << 7) 15 | #define IN_RIGHT (1 << 8) 16 | #define IN_MOVELEFT (1 << 9) 17 | #define IN_MOVERIGHT (1 << 10) 18 | #define IN_ATTACK2 (1 << 11) 19 | #define IN_RUN (1 << 12) 20 | #define IN_RELOAD (1 << 13) 21 | #define IN_ALT1 (1 << 14) 22 | #define IN_ALT2 (1 << 15) 23 | #define IN_SCORE (1 << 16) // Used by client.dll for when scoreboard is held down 24 | #define IN_SPEED (1 << 17) // Player is holding the speed key 25 | #define IN_WALK (1 << 18) // Player holding walk key 26 | #define IN_ZOOM (1 << 19) // Zoom key for HUD zoom 27 | #define IN_WEAPON1 (1 << 20) // weapon defines these bits 28 | #define IN_WEAPON2 (1 << 21) // weapon defines these bits 29 | #define IN_BULLRUSH (1 << 22) 30 | #define IN_GRENADE1 (1 << 23) // grenade 1 31 | #define IN_GRENADE2 (1 << 24) // grenade 2 32 | #define IN_LOOKSPIN (1 << 25) 33 | 34 | class CUserCmd 35 | { 36 | public: 37 | CUserCmd() 38 | { 39 | memset(this, 0, sizeof(*this)); 40 | }; 41 | virtual ~CUserCmd() {}; 42 | 43 | CRC32_t GetChecksum(void) const 44 | { 45 | CRC32_t crc; 46 | CRC32_Init(&crc); 47 | 48 | CRC32_ProcessBuffer(&crc, &command_number, sizeof(command_number)); 49 | CRC32_ProcessBuffer(&crc, &tick_count, sizeof(tick_count)); 50 | CRC32_ProcessBuffer(&crc, &viewangles, sizeof(viewangles)); 51 | CRC32_ProcessBuffer(&crc, &aimdirection, sizeof(aimdirection)); 52 | CRC32_ProcessBuffer(&crc, &forwardmove, sizeof(forwardmove)); 53 | CRC32_ProcessBuffer(&crc, &sidemove, sizeof(sidemove)); 54 | CRC32_ProcessBuffer(&crc, &upmove, sizeof(upmove)); 55 | CRC32_ProcessBuffer(&crc, &buttons, sizeof(buttons)); 56 | CRC32_ProcessBuffer(&crc, &impulse, sizeof(impulse)); 57 | CRC32_ProcessBuffer(&crc, &weaponselect, sizeof(weaponselect)); 58 | CRC32_ProcessBuffer(&crc, &weaponsubtype, sizeof(weaponsubtype)); 59 | CRC32_ProcessBuffer(&crc, &random_seed, sizeof(random_seed)); 60 | CRC32_ProcessBuffer(&crc, &mousedx, sizeof(mousedx)); 61 | CRC32_ProcessBuffer(&crc, &mousedy, sizeof(mousedy)); 62 | 63 | CRC32_Final(&crc); 64 | return crc; 65 | } 66 | 67 | int command_number; // 0x04 For matching server and client commands for debugging 68 | int tick_count; // 0x08 the tick the client created this command 69 | QAngle viewangles; // 0x0C Player instantaneous view angles. 70 | Vector aimdirection; // 0x18 71 | float forwardmove; // 0x24 72 | float sidemove; // 0x28 73 | float upmove; // 0x2C 74 | int buttons; // 0x30 Attack button states 75 | char impulse; // 0x34 76 | int weaponselect; // 0x38 Current weapon id 77 | int weaponsubtype; // 0x3C 78 | int random_seed; // 0x40 For shared random functions 79 | short mousedx; // 0x44 mouse accum in x from create move 80 | short mousedy; // 0x46 mouse accum in y from create move 81 | bool hasbeenpredicted; // 0x48 Client only, tracks whether we've predicted this command at least once 82 | char pad_0x4C[0x18]; // 0x4C Current sizeof( usercmd ) = 100 = 0x64 83 | }; 84 | 85 | class CVerifiedUserCmd 86 | { 87 | public: 88 | CUserCmd m_cmd; 89 | CRC32_t m_crc; 90 | }; 91 | -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/misc/ClientClass.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Recv.hpp" 4 | 5 | class ClientClass; 6 | class IClientNetworkable; 7 | 8 | typedef IClientNetworkable* (*CreateClientClassFn)(int entnum, int serialNum); 9 | typedef IClientNetworkable* (*CreateEventFn)(); 10 | 11 | class ClientClass 12 | { 13 | public: 14 | CreateClientClassFn m_pCreateFn; 15 | CreateEventFn m_pCreateEventFn; 16 | char* m_pNetworkName; 17 | RecvTable* m_pRecvTable; 18 | ClientClass* m_pNext; 19 | ClassId m_ClassID; 20 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/misc/Color.cpp: -------------------------------------------------------------------------------- 1 | #include "Color.hpp" 2 | 3 | Color Color::Black(0, 0, 0, 255); 4 | Color Color::White(255, 255, 255, 255); 5 | Color Color::Red(255, 0, 0, 255); 6 | Color Color::Green(0, 128, 0, 255); 7 | Color Color::Blue(0, 0, 255, 255); 8 | 9 | Color::Color() 10 | { 11 | *((int *)this) = 0; 12 | } 13 | Color::Color(int _r, int _g, int _b) 14 | { 15 | SetColor(_r, _g, _b, 255); 16 | } 17 | Color::Color(int _r, int _g, int _b, int _a) 18 | { 19 | SetColor(_r, _g, _b, _a); 20 | } 21 | void Color::SetRawColor(int color32) 22 | { 23 | *((int *)this) = color32; 24 | } 25 | int Color::GetRawColor() const 26 | { 27 | return *((int *)this); 28 | } 29 | void Color::SetColor(int _r, int _g, int _b, int _a) 30 | { 31 | _CColor[0] = (unsigned char)_r; 32 | _CColor[1] = (unsigned char)_g; 33 | _CColor[2] = (unsigned char)_b; 34 | _CColor[3] = (unsigned char)_a; 35 | } 36 | void Color::SetColor(float _r, float _g, float _b, float _a) 37 | { 38 | _CColor[0] = static_cast(_r * 255.0f); 39 | _CColor[1] = static_cast(_g * 255.0f); 40 | _CColor[2] = static_cast(_b * 255.0f); 41 | _CColor[3] = static_cast(_a * 255.0f); 42 | } 43 | void Color::GetColor(int &_r, int &_g, int &_b, int &_a) const 44 | { 45 | _r = _CColor[0]; 46 | _g = _CColor[1]; 47 | _b = _CColor[2]; 48 | _a = _CColor[3]; 49 | } 50 | bool Color::operator== (const Color &rhs) const 51 | { 52 | return (*((int *)this) == *((int *)&rhs)); 53 | } 54 | bool Color::operator!= (const Color &rhs) const 55 | { 56 | return !(operator==(rhs)); 57 | } 58 | Color& Color::operator=(const Color &rhs) 59 | { 60 | SetRawColor(rhs.GetRawColor()); 61 | return *this; 62 | } 63 | -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/misc/Color.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class Color 10 | { 11 | public: 12 | Color(); 13 | Color(int _r, int _g, int _b); 14 | Color(int _r, int _g, int _b, int _a); 15 | Color(float _r, float _g, float _b) : Color(_r, _g, _b, 1.0f) {} 16 | Color(float _r, float _g, float _b, float _a) 17 | : Color( 18 | static_cast(_r * 255.0f), 19 | static_cast(_g * 255.0f), 20 | static_cast(_b * 255.0f), 21 | static_cast(_a * 255.0f)) 22 | { 23 | } 24 | explicit Color(float* rgb) : Color(rgb[0], rgb[1], rgb[2], 1.0f) {} 25 | explicit Color(unsigned long argb) 26 | { 27 | _CColor[2] = (unsigned char)((argb & 0x000000FF) >> (0 * 8)); 28 | _CColor[1] = (unsigned char)((argb & 0x0000FF00) >> (1 * 8)); 29 | _CColor[0] = (unsigned char)((argb & 0x00FF0000) >> (2 * 8)); 30 | _CColor[3] = (unsigned char)((argb & 0xFF000000) >> (3 * 8)); 31 | } 32 | 33 | void SetRawColor(int color32); 34 | int GetRawColor() const; 35 | void SetColor(int _r, int _g, int _b, int _a = 0); 36 | void SetColor(float _r, float _g, float _b, float _a = 0); 37 | void GetColor(int &_r, int &_g, int &_b, int &_a) const; 38 | 39 | std::string GetNormalnijHexColor() const; 40 | 41 | int r() const { return _CColor[0]; } 42 | int g() const { return _CColor[1]; } 43 | int b() const { return _CColor[2]; } 44 | int a() const { return _CColor[3]; } 45 | 46 | unsigned char &operator[](int index) 47 | { 48 | return _CColor[index]; 49 | } 50 | const unsigned char &operator[](int index) const 51 | { 52 | return _CColor[index]; 53 | } 54 | 55 | bool operator==(const Color &rhs) const; 56 | bool operator!=(const Color &rhs) const; 57 | Color &operator=(const Color &rhs); 58 | 59 | static Color FromHSB(float hue, float saturation, float brightness) 60 | { 61 | float h = hue == 1.0f ? 0 : hue * 6.0f; 62 | float f = h - (int)h; 63 | float p = brightness * (1.0f - saturation); 64 | float q = brightness * (1.0f - saturation * f); 65 | float t = brightness * (1.0f - (saturation * (1.0f - f))); 66 | 67 | if (h < 1) 68 | { 69 | return Color( 70 | (unsigned char)(brightness * 255), 71 | (unsigned char)(t * 255), 72 | (unsigned char)(p * 255) 73 | ); 74 | } 75 | else if (h < 2) 76 | { 77 | return Color( 78 | (unsigned char)(q * 255), 79 | (unsigned char)(brightness * 255), 80 | (unsigned char)(p * 255) 81 | ); 82 | } 83 | else if (h < 3) 84 | { 85 | return Color( 86 | (unsigned char)(p * 255), 87 | (unsigned char)(brightness * 255), 88 | (unsigned char)(t * 255) 89 | ); 90 | } 91 | else if (h < 4) 92 | { 93 | return Color( 94 | (unsigned char)(p * 255), 95 | (unsigned char)(q * 255), 96 | (unsigned char)(brightness * 255) 97 | ); 98 | } 99 | else if (h < 5) 100 | { 101 | return Color( 102 | (unsigned char)(t * 255), 103 | (unsigned char)(p * 255), 104 | (unsigned char)(brightness * 255) 105 | ); 106 | } 107 | else 108 | { 109 | return Color( 110 | (unsigned char)(brightness * 255), 111 | (unsigned char)(p * 255), 112 | (unsigned char)(q * 255) 113 | ); 114 | } 115 | } 116 | 117 | static Color Black; 118 | static Color White; 119 | static Color Red; 120 | static Color Green; 121 | static Color Blue; 122 | 123 | private: 124 | unsigned char _CColor[4]; 125 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/misc/EHandle.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BaseHandle.hpp" 4 | #include "../sdk.hpp" 5 | 6 | // -------------------------------------------------------------------------------------------------- // 7 | // Game-code CBaseHandle implementation. 8 | // -------------------------------------------------------------------------------------------------- // 9 | 10 | inline IHandleEntity* CBaseHandle::Get() const 11 | { 12 | return g_EntityList->GetClientEntityFromHandle(*this); 13 | } 14 | 15 | 16 | // -------------------------------------------------------------------------------------------------- // 17 | // CHandle. 18 | // -------------------------------------------------------------------------------------------------- // 19 | template< class T > 20 | class CHandle : public CBaseHandle 21 | { 22 | public: 23 | 24 | CHandle(); 25 | CHandle(int iEntry, int iSerialNumber); 26 | CHandle(const CBaseHandle &handle); 27 | CHandle(T *pVal); 28 | 29 | // The index should have come from a call to ToInt(). If it hasn't, you're in trouble. 30 | static CHandle FromIndex(int index); 31 | 32 | T* Get() const; 33 | void Set(const T* pVal); 34 | 35 | operator T*(); 36 | operator T*() const; 37 | 38 | bool operator !() const; 39 | bool operator==(T *val) const; 40 | bool operator!=(T *val) const; 41 | const CBaseHandle& operator=(const T *val); 42 | 43 | T* operator->() const; 44 | }; 45 | 46 | 47 | // ----------------------------------------------------------------------- // 48 | // Inlines. 49 | // ----------------------------------------------------------------------- // 50 | 51 | template 52 | CHandle::CHandle() 53 | { 54 | } 55 | 56 | 57 | template 58 | CHandle::CHandle(int iEntry, int iSerialNumber) 59 | { 60 | Init(iEntry, iSerialNumber); 61 | } 62 | 63 | 64 | template 65 | CHandle::CHandle(const CBaseHandle &handle) 66 | : CBaseHandle(handle) 67 | { 68 | } 69 | 70 | 71 | template 72 | CHandle::CHandle(T *pObj) 73 | { 74 | Term(); 75 | Set(pObj); 76 | } 77 | 78 | 79 | template 80 | inline CHandle CHandle::FromIndex(int index) 81 | { 82 | CHandle ret; 83 | ret.m_Index = index; 84 | return ret; 85 | } 86 | 87 | 88 | template 89 | inline T* CHandle::Get() const 90 | { 91 | return (T*)CBaseHandle::Get(); 92 | } 93 | 94 | 95 | template 96 | inline CHandle::operator T *() 97 | { 98 | return Get(); 99 | } 100 | 101 | template 102 | inline CHandle::operator T *() const 103 | { 104 | return Get(); 105 | } 106 | 107 | 108 | template 109 | inline bool CHandle::operator !() const 110 | { 111 | return !Get(); 112 | } 113 | 114 | template 115 | inline bool CHandle::operator==(T *val) const 116 | { 117 | return Get() == val; 118 | } 119 | 120 | template 121 | inline bool CHandle::operator!=(T *val) const 122 | { 123 | return Get() != val; 124 | } 125 | 126 | template 127 | void CHandle::Set(const T* pVal) 128 | { 129 | CBaseHandle::Set(reinterpret_cast(pVal)); 130 | } 131 | 132 | template 133 | inline const CBaseHandle& CHandle::operator=(const T *val) 134 | { 135 | Set(val); 136 | return *this; 137 | } 138 | 139 | template 140 | T* CHandle::operator -> () const 141 | { 142 | return Get(); 143 | } -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/misc/GlobalVars.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CGlobalVarsBase 4 | { 5 | public: 6 | float realtime; // 0x0000 7 | int framecount; // 0x0004 8 | float absoluteframetime; // 0x0008 9 | float absoluteframestarttimestddev; // 0x000C 10 | float curtime; // 0x0010 11 | float frametime; // 0x0014 12 | int maxClients; // 0x0018 13 | int tickcount; // 0x001C 14 | float interval_per_tick; // 0x0020 15 | float interpolation_amount; // 0x0024 16 | int simTicksThisFrame; // 0x0028 17 | int network_protocol; // 0x002C 18 | void* pSaveData; // 0x0030 19 | bool m_bClient; // 0x0031 20 | bool m_bRemoteClient; // 0x0032 21 | 22 | private: 23 | // 100 (i.e., tickcount is rounded down to this base and then the "delta" from this base is networked 24 | int nTimestampNetworkingBase; 25 | // 32 (entindex() % nTimestampRandomizeWindow ) is subtracted from gpGlobals->tickcount to Set the networking basis, prevents 26 | // all of the entities from forcing a new PackedEntity on the same tick (i.e., prevents them from getting lockstepped on this) 27 | int nTimestampRandomizeWindow; 28 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/misc/IHandleEntity.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CBaseHandle; 4 | 5 | class IHandleEntity 6 | { 7 | public: 8 | virtual ~IHandleEntity() {} 9 | virtual void SetRefEHandle(const CBaseHandle &handle) = 0; 10 | virtual const CBaseHandle& GetRefEHandle() const = 0; 11 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/misc/Recv.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | enum SendPropType 6 | { 7 | DPT_Int = 0, 8 | DPT_Float, 9 | DPT_Vector, 10 | DPT_VectorXY, 11 | DPT_String, 12 | DPT_Array, 13 | DPT_DataTable, 14 | DPT_Int64, 15 | DPT_NUMSendPropTypes 16 | }; 17 | 18 | class DVariant 19 | { 20 | public: 21 | union 22 | { 23 | float m_Float; 24 | long m_Int; 25 | char* m_pString; 26 | void* m_pData; 27 | float m_Vector[3]; 28 | __int64 m_Int64; 29 | }; 30 | SendPropType m_Type; 31 | }; 32 | 33 | class RecvTable; 34 | class RecvProp; 35 | 36 | class CRecvProxyData 37 | { 38 | public: 39 | const RecvProp* m_pRecvProp; // The property it's receiving. 40 | DVariant m_Value; // The value given to you to store. 41 | int m_iElement; // Which array element you're getting. 42 | int m_ObjectID; // The object being referred to. 43 | }; 44 | 45 | //----------------------------------------------------------------------------- 46 | // pStruct = the base structure of the datatable this variable is in (like C_BaseEntity) 47 | // pOut = the variable that this this proxy represents (like C_BaseEntity::m_SomeValue). 48 | // 49 | // Convert the network-standard-type value in m_Value into your own format in pStruct/pOut. 50 | //----------------------------------------------------------------------------- 51 | typedef void(*RecvVarProxyFn)(const CRecvProxyData *pData, void *pStruct, void *pOut); 52 | 53 | // ------------------------------------------------------------------------ // 54 | // ArrayLengthRecvProxies are optionally used to Get the length of the 55 | // incoming array when it changes. 56 | // ------------------------------------------------------------------------ // 57 | typedef void(*ArrayLengthRecvProxyFn)(void *pStruct, int objectID, int currentArrayLength); 58 | 59 | // NOTE: DataTable receive proxies work differently than the other proxies. 60 | // pData points at the object + the recv table's offset. 61 | // pOut should be Set to the location of the object to unpack the data table into. 62 | // If the parent object just contains the child object, the default proxy just does *pOut = pData. 63 | // If the parent object points at the child object, you need to dereference the pointer here. 64 | // NOTE: don't ever return null from a DataTable receive proxy function. Bad things will happen. 65 | typedef void(*DataTableRecvVarProxyFn)(const RecvProp *pProp, void **pOut, void *pData, int objectID); 66 | 67 | class RecvProp 68 | { 69 | public: 70 | char* m_pVarName; 71 | SendPropType m_RecvType; 72 | int m_Flags; 73 | int m_StringBufferSize; 74 | int m_bInsideArray; 75 | const void* m_pExtraData; 76 | RecvProp* m_pArrayProp; 77 | ArrayLengthRecvProxyFn m_ArrayLengthProxy; 78 | RecvVarProxyFn m_ProxyFn; 79 | DataTableRecvVarProxyFn m_DataTableProxyFn; 80 | RecvTable* m_pDataTable; 81 | int m_Offset; 82 | int m_ElementStride; 83 | int m_nElements; 84 | const char* m_pParentArrayPropName; 85 | 86 | RecvVarProxyFn GetProxyFn() const; 87 | void SetProxyFn(RecvVarProxyFn fn); 88 | DataTableRecvVarProxyFn GetDataTableProxyFn() const; 89 | void SetDataTableProxyFn(DataTableRecvVarProxyFn fn); 90 | 91 | }; 92 | 93 | class RecvTable 94 | { 95 | public: 96 | RecvProp* m_pProps; 97 | int m_nProps; 98 | void* m_pDecoder; 99 | char* m_pNetTableName; 100 | bool m_bInitialized; 101 | bool m_bInMainList; 102 | }; 103 | 104 | inline RecvVarProxyFn RecvProp::GetProxyFn() const 105 | { 106 | return m_ProxyFn; 107 | } 108 | 109 | inline void RecvProp::SetProxyFn(RecvVarProxyFn fn) 110 | { 111 | m_ProxyFn = fn; 112 | } 113 | 114 | inline DataTableRecvVarProxyFn RecvProp::GetDataTableProxyFn() const 115 | { 116 | return m_DataTableProxyFn; 117 | } 118 | 119 | inline void RecvProp::SetDataTableProxyFn(DataTableRecvVarProxyFn fn) 120 | { 121 | m_DataTableProxyFn = fn; 122 | } -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/misc/UtlBuffer.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spirthack/CSGOSimple/c37d4bc36efe99c621eb288fd34299c1692ee1dd/CSGOSimple/valve_sdk/misc/UtlBuffer.hpp -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/misc/characterset.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spirthack/CSGOSimple/c37d4bc36efe99c621eb288fd34299c1692ee1dd/CSGOSimple/valve_sdk/misc/characterset.cpp -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/misc/characterset.hpp: -------------------------------------------------------------------------------- 1 | //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======// 2 | // 3 | // Purpose: Shared code for parsing / searching for characters in a string 4 | // using lookup tables 5 | // 6 | // $Workfile: $ 7 | // $Date: $ 8 | // $NoKeywords: $ 9 | //===========================================================================// 10 | 11 | #pragma once 12 | 13 | struct characterset_t 14 | { 15 | char Set[256]; 16 | }; 17 | 18 | 19 | // This is essentially a strpbrk() using a precalculated lookup table 20 | //----------------------------------------------------------------------------- 21 | // Purpose: builds a simple lookup table of a group of important characters 22 | // Input : *pSetBuffer - pointer to the buffer for the group 23 | // *pSetString - list of characters to flag 24 | //----------------------------------------------------------------------------- 25 | extern void CharacterSetBuild(characterset_t *pSetBuffer, const char *pSetString); 26 | 27 | 28 | //----------------------------------------------------------------------------- 29 | // Purpose: 30 | // Input : *pSetBuffer - pre-build group buffer 31 | // character - character to lookup 32 | // Output : int - 1 if the character was in the Set 33 | //----------------------------------------------------------------------------- 34 | #define IN_CHARACTERSET( SetBuffer, character ) ((SetBuffer).Set[(character)]) 35 | -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/misc/checksum_crc.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef unsigned long CRC32_t; 4 | 5 | void CRC32_Init(CRC32_t *pulCRC); 6 | void CRC32_ProcessBuffer(CRC32_t *pulCRC, const void *p, int len); 7 | void CRC32_Final(CRC32_t *pulCRC); 8 | CRC32_t CRC32_GetTableEntry(unsigned int slot); 9 | 10 | inline CRC32_t CRC32_ProcessSingleBuffer(const void *p, int len) 11 | { 12 | CRC32_t crc; 13 | 14 | CRC32_Init(&crc); 15 | CRC32_ProcessBuffer(&crc, p, len); 16 | CRC32_Final(&crc); 17 | 18 | return crc; 19 | } 20 | -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/misc/checksum_md5.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // 16 bytes == 128 bit digest 4 | #define MD5_DIGEST_LENGTH 16 5 | 6 | // MD5 Hash 7 | typedef struct 8 | { 9 | unsigned int buf[4]; 10 | unsigned int bits[2]; 11 | unsigned char in[64]; 12 | } MD5Context_t; 13 | 14 | void MD5Init(MD5Context_t *context); 15 | void MD5Update(MD5Context_t *context, unsigned char const *buf, unsigned int len); 16 | void MD5Final(unsigned char digest[MD5_DIGEST_LENGTH], MD5Context_t *context); 17 | 18 | char *MD5_Print(unsigned char *digest, int hashlen); 19 | 20 | unsigned int MD5_PseudoRandom(unsigned int nSeed); -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/misc/datamap.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | struct inputdata_t; 5 | typedef enum _fieldtypes 6 | { 7 | FIELD_VOID = 0, // No type or value 8 | FIELD_FLOAT, // Any floating point value 9 | FIELD_STRING, // A string ID (return from ALLOC_STRING) 10 | FIELD_VECTOR, // Any vector, QAngle, or AngularImpulse 11 | FIELD_QUATERNION, // A quaternion 12 | FIELD_INTEGER, // Any integer or enum 13 | FIELD_BOOLEAN, // boolean, implemented as an int, I may use this as a hint for compression 14 | FIELD_SHORT, // 2 byte integer 15 | FIELD_CHARACTER, // a byte 16 | FIELD_COLOR32, // 8-bit per channel r,g,b,a (32bit color) 17 | FIELD_EMBEDDED, // an embedded object with a datadesc, recursively traverse and embedded class/structure based on an additional typedescription 18 | FIELD_CUSTOM, // special type that contains function pointers to it's read/write/parse functions 19 | 20 | FIELD_CLASSPTR, // CBaseEntity * 21 | FIELD_EHANDLE, // Entity handle 22 | FIELD_EDICT, // edict_t * 23 | 24 | FIELD_POSITION_VECTOR, // A world coordinate (these are fixed up across level transitions automagically) 25 | FIELD_TIME, // a floating point time (these are fixed up automatically too!) 26 | FIELD_TICK, // an integer tick count( fixed up similarly to time) 27 | FIELD_MODELNAME, // Engine string that is a model name (needs precache) 28 | FIELD_SOUNDNAME, // Engine string that is a sound name (needs precache) 29 | 30 | FIELD_INPUT, // a list of inputed data fields (all derived from CMultiInputVar) 31 | FIELD_FUNCTION, // A class function pointer (Think, Use, etc) 32 | 33 | FIELD_VMATRIX, // a vmatrix (output coords are NOT worldspace) 34 | 35 | // NOTE: Use float arrays for local transformations that don't need to be fixed up. 36 | FIELD_VMATRIX_WORLDSPACE,// A VMatrix that maps some local space to world space (translation is fixed up on level transitions) 37 | FIELD_MATRIX3X4_WORLDSPACE, // matrix3x4_t that maps some local space to world space (translation is fixed up on level transitions) 38 | 39 | FIELD_INTERVAL, // a start and range floating point interval ( e.g., 3.2->3.6 == 3.2 and 0.4 ) 40 | FIELD_MODELINDEX, // a model index 41 | FIELD_MATERIALINDEX, // a material index (using the material precache string table) 42 | 43 | FIELD_VECTOR2D, // 2 floats 44 | 45 | FIELD_TYPECOUNT, // MUST BE LAST 46 | } fieldtype_t; 47 | 48 | class ISaveRestoreOps; 49 | class C_BaseEntity; 50 | // 51 | // Function prototype for all input handlers. 52 | // 53 | typedef void (C_BaseEntity::*inputfunc_t)(inputdata_t &data); 54 | 55 | struct datamap_t; 56 | struct typedescription_t; 57 | 58 | enum 59 | { 60 | TD_OFFSET_NORMAL = 0, 61 | TD_OFFSET_PACKED = 1, 62 | 63 | // Must be last 64 | TD_OFFSET_COUNT, 65 | }; 66 | 67 | struct typedescription_t 68 | { 69 | int32_t fieldType; //0x0000 70 | char* fieldName; //0x0004 71 | int fieldOffset[TD_OFFSET_COUNT]; //0x0008 72 | int16_t fieldSize_UNKNWN; //0x0010 73 | int16_t flags_UNKWN; //0x0012 74 | char pad_0014[12]; //0x0014 75 | datamap_t* td; //0x0020 76 | char pad_0024[24]; //0x0024 77 | }; //Size: 0x003C 78 | 79 | 80 | //----------------------------------------------------------------------------- 81 | // Purpose: stores the list of objects in the hierarchy 82 | // used to iterate through an object's data descriptions 83 | //----------------------------------------------------------------------------- 84 | struct datamap_t 85 | { 86 | typedescription_t *dataDesc; 87 | int dataNumFields; 88 | char const *dataClassName; 89 | datamap_t *baseMap; 90 | 91 | bool chains_validated; 92 | // Have the "packed" offsets been computed 93 | bool packed_offsets_computed; 94 | int packed_size; 95 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/misc/glow_outline_effect.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "UtlVector.hpp" 4 | #include "../Interfaces/IClientEntity.hpp" 5 | 6 | class GlowObjectDefinition_t 7 | { 8 | public: 9 | GlowObjectDefinition_t() { memset(this, 0, sizeof(*this)); } 10 | 11 | int32_t m_nNextFreeSlot; //0x0000 12 | class IClientEntity* m_pEntity; //0x0004 13 | union 14 | { 15 | Vector m_vGlowColor; //0x0008 16 | struct 17 | { 18 | float m_flRed; //0x0012 19 | float m_flGreen; //0x000C 20 | float m_flBlue; //0x0010 21 | }; 22 | }; 23 | float m_flAlpha; //0x0014 24 | uint8_t pad_0014[4]; //0x0018 25 | float m_flSomeFloat; //0x001C 26 | uint8_t pad_001C[4]; //0x0020 27 | float m_flAnotherFloat; //0x0024 28 | bool m_bRenderWhenOccluded; //0x0025 29 | bool m_bRenderWhenUnoccluded; //0x0026 30 | bool m_bFullBloomRender; //0x0027 31 | uint8_t pad_0027[5]; //0x002C 32 | int32_t m_nGlowStyle; //0x0030 33 | int32_t m_nSplitScreenSlot; //0x0034 34 | 35 | bool IsUnused() const { return m_nNextFreeSlot != GlowObjectDefinition_t::ENTRY_IN_USE; } 36 | 37 | static const int END_OF_FREE_LIST = -1; 38 | static const int ENTRY_IN_USE = -2; 39 | }; //Size: 0x0038 (56) 40 | 41 | class CGlowObjectManager 42 | { 43 | public: 44 | int RegisterGlowObject(IClientEntity *pEntity, const Vector &vGlowColor, float flGlowAlpha, bool bRenderWhenOccluded, bool bRenderWhenUnoccluded, int nSplitScreenSlot) 45 | { 46 | int nIndex; 47 | if(m_nFirstFreeSlot == GlowObjectDefinition_t::END_OF_FREE_LIST) { 48 | nIndex = m_GlowObjectDefinitions.AddToTail(); 49 | } else { 50 | nIndex = m_nFirstFreeSlot; 51 | m_nFirstFreeSlot = m_GlowObjectDefinitions[nIndex].m_nNextFreeSlot; 52 | } 53 | 54 | m_GlowObjectDefinitions[nIndex].m_pEntity = pEntity; 55 | m_GlowObjectDefinitions[nIndex].m_vGlowColor = vGlowColor; 56 | m_GlowObjectDefinitions[nIndex].m_flAlpha = flGlowAlpha; 57 | m_GlowObjectDefinitions[nIndex].m_bRenderWhenOccluded = bRenderWhenOccluded; 58 | m_GlowObjectDefinitions[nIndex].m_bRenderWhenUnoccluded = bRenderWhenUnoccluded; 59 | m_GlowObjectDefinitions[nIndex].m_nSplitScreenSlot = nSplitScreenSlot; 60 | m_GlowObjectDefinitions[nIndex].m_nNextFreeSlot = GlowObjectDefinition_t::ENTRY_IN_USE; 61 | 62 | return nIndex; 63 | } 64 | 65 | void UnregisterGlowObject(int nGlowObjectHandle) 66 | { 67 | m_GlowObjectDefinitions[nGlowObjectHandle].m_nNextFreeSlot = m_nFirstFreeSlot; 68 | m_GlowObjectDefinitions[nGlowObjectHandle].m_pEntity = NULL; 69 | m_nFirstFreeSlot = nGlowObjectHandle; 70 | } 71 | 72 | void SetEntity(int nGlowObjectHandle, IClientEntity *pEntity) 73 | { 74 | m_GlowObjectDefinitions[nGlowObjectHandle].m_pEntity = pEntity; 75 | } 76 | 77 | void SetColor(int nGlowObjectHandle, const Vector &vGlowColor) 78 | { 79 | m_GlowObjectDefinitions[nGlowObjectHandle].m_vGlowColor = vGlowColor; 80 | } 81 | 82 | void SetAlpha(int nGlowObjectHandle, float flAlpha) 83 | { 84 | m_GlowObjectDefinitions[nGlowObjectHandle].m_flAlpha = flAlpha; 85 | } 86 | 87 | void SetRenderFlags(int nGlowObjectHandle, bool bRenderWhenOccluded, bool bRenderWhenUnoccluded) 88 | { 89 | m_GlowObjectDefinitions[nGlowObjectHandle].m_bRenderWhenOccluded = bRenderWhenOccluded; 90 | m_GlowObjectDefinitions[nGlowObjectHandle].m_bRenderWhenUnoccluded = bRenderWhenUnoccluded; 91 | } 92 | 93 | bool IsRenderingWhenOccluded(int nGlowObjectHandle) const 94 | { 95 | return m_GlowObjectDefinitions[nGlowObjectHandle].m_bRenderWhenOccluded; 96 | } 97 | 98 | bool IsRenderingWhenUnoccluded(int nGlowObjectHandle) const 99 | { 100 | return m_GlowObjectDefinitions[nGlowObjectHandle].m_bRenderWhenUnoccluded; 101 | } 102 | 103 | bool HasGlowEffect(IClientEntity *pEntity) const 104 | { 105 | for(int i = 0; i < m_GlowObjectDefinitions.Count(); ++i) { 106 | if(!m_GlowObjectDefinitions[i].IsUnused() && m_GlowObjectDefinitions[i].m_pEntity == pEntity) { 107 | return true; 108 | } 109 | } 110 | 111 | return false; 112 | } 113 | 114 | 115 | CUtlVector m_GlowObjectDefinitions; //0x0000 116 | int m_nFirstFreeSlot; //0x000C 117 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/misc/vfunc.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | template 4 | __forceinline static FuncType CallVFunction(void* ppClass, int index) 5 | { 6 | int* pVTable = *(int**)ppClass; 7 | int dwAddress = pVTable[index]; 8 | return (FuncType)(dwAddress); 9 | } 10 | -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/netvars.cpp: -------------------------------------------------------------------------------- 1 | #include "netvars.hpp" 2 | 3 | #include 4 | #include 5 | 6 | #include "sdk.hpp" 7 | 8 | void NetvarSys::Initialize() 9 | { 10 | database.clear(); 11 | 12 | for(auto clientclass = g_CHLClient->GetAllClasses(); 13 | clientclass != nullptr; 14 | clientclass = clientclass->m_pNext) { 15 | if(clientclass->m_pRecvTable) { 16 | database.emplace_back(LoadTable(clientclass->m_pRecvTable)); 17 | } 18 | } 19 | } 20 | 21 | NetvarSys::netvar_table NetvarSys::LoadTable(RecvTable* recvTable) 22 | { 23 | auto table = netvar_table{}; 24 | 25 | table.offset = 0; 26 | table.name = recvTable->m_pNetTableName; 27 | 28 | for(auto i = 0; i < recvTable->m_nProps; ++i) { 29 | auto prop = &recvTable->m_pProps[i]; 30 | 31 | if(!prop || isdigit(prop->m_pVarName[0])) 32 | continue; 33 | if(strcmp("baseclass", prop->m_pVarName) == 0) 34 | continue; 35 | 36 | if(prop->m_RecvType == DPT_DataTable && prop->m_pDataTable) { 37 | table.child_tables.emplace_back(LoadTable(prop->m_pDataTable)); 38 | table.child_tables.back().offset = prop->m_Offset; 39 | table.child_tables.back().prop = prop; 40 | } else { 41 | table.child_props.emplace_back(prop); 42 | } 43 | } 44 | return table; 45 | } 46 | 47 | void NetvarSys::Dump() 48 | { 49 | auto outfile = std::ofstream("netvar_dump.txt"); 50 | 51 | Dump(outfile); 52 | } 53 | 54 | void NetvarSys::Dump(std::ostream& stream) 55 | { 56 | for(const auto& table : database) { 57 | if(table.child_props.empty() && table.child_tables.empty()) 58 | continue; 59 | stream << table.name << '\n'; 60 | DumpTable(stream, table, 1); 61 | stream << '\n'; 62 | } 63 | 64 | stream << std::endl; 65 | } 66 | 67 | void NetvarSys::DumpTable(std::ostream& stream, const netvar_table& table, uint32_t indentation) 68 | { 69 | char line_buffer[1024]; 70 | 71 | for(const auto& prop : table.child_props) { 72 | sprintf_s(line_buffer, "%*c%*s: 0x%08X", indentation * 4, ' ', -(50 - (int)indentation * 4), prop->m_pVarName, table.offset + prop->m_Offset); 73 | stream << line_buffer << '\n'; 74 | } 75 | for(const auto& child : table.child_tables) { 76 | sprintf_s(line_buffer, "%*c%*s: 0x%08X", indentation * 4, ' ', -(50 - (int)indentation * 4), child.prop->m_pVarName, table.offset + child.offset); 77 | stream << line_buffer << '\n'; 78 | DumpTable(stream, child, indentation + 1); 79 | } 80 | } 81 | 82 | uint32_t NetvarSys::GetOffset(const std::string& tableName, const std::string& propName) 83 | { 84 | auto result = 0u; 85 | for(const auto& table : database) { 86 | if(table.name == tableName) { 87 | result = GetOffset(table, propName); 88 | if(result != 0) 89 | return result; 90 | } 91 | } 92 | return 0; 93 | } 94 | 95 | uint32_t NetvarSys::GetOffset(const NetvarSys::netvar_table& table, const std::string& propName) 96 | { 97 | for(const auto& prop : table.child_props) { 98 | if(strncmp(prop->m_pVarName, propName.data(), propName.size()) == 0) { 99 | return table.offset + prop->m_Offset; 100 | } 101 | } 102 | for(const auto& child : table.child_tables) { 103 | auto prop_offset = GetOffset(child, propName); 104 | if(prop_offset != 0) 105 | return table.offset + prop_offset; 106 | } 107 | for(const auto& child : table.child_tables) { 108 | if(strncmp(child.prop->m_pVarName, propName.data(), propName.size()) == 0) { 109 | return table.offset + child.offset; 110 | } 111 | } 112 | return 0; 113 | } 114 | 115 | RecvProp* NetvarSys::GetNetvarProp(const std::string& tableName, const std::string& propName) 116 | { 117 | RecvProp* result = nullptr; 118 | for(const auto& table : database) { 119 | if(table.name == tableName) { 120 | result = GetNetvarProp(table, propName); 121 | } 122 | } 123 | return result; 124 | } 125 | 126 | RecvProp* NetvarSys::GetNetvarProp(const NetvarSys::netvar_table& table, const std::string& propName) 127 | { 128 | for(const auto& prop : table.child_props) { 129 | if(strncmp(prop->m_pVarName, propName.data(), propName.size()) == 0) { 130 | return prop; 131 | } 132 | } 133 | for(const auto& child : table.child_tables) { 134 | auto prop = GetNetvarProp(child, propName); 135 | if(prop != 0) 136 | return prop; 137 | } 138 | for(const auto& child : table.child_tables) { 139 | if(strncmp(child.prop->m_pVarName, propName.data(), propName.size()) == 0) { 140 | return child.prop; 141 | } 142 | } 143 | return nullptr; 144 | } -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/netvars.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "Misc/Recv.hpp" 8 | #include "../Singleton.hpp" 9 | 10 | class NetvarSys 11 | : public Singleton 12 | { 13 | struct netvar_table 14 | { 15 | std::string name; 16 | RecvProp* prop; 17 | uint32_t offset; 18 | std::vector child_props; 19 | std::vector child_tables; 20 | }; 21 | public: 22 | void Initialize(); 23 | 24 | void Dump(); 25 | void Dump(std::ostream& stream); 26 | 27 | uint32_t GetOffset(const std::string& tableName, const std::string& propName); 28 | RecvProp* GetNetvarProp(const std::string& tableName, const std::string& propName); 29 | 30 | private: 31 | static netvar_table LoadTable(RecvTable* clientClass); 32 | static void DumpTable(std::ostream& stream, const netvar_table& table, uint32_t indentation); 33 | static uint32_t GetOffset(const netvar_table& table, const std::string& propName); 34 | static RecvProp* GetNetvarProp(const netvar_table& table, const std::string& propName); 35 | 36 | private: 37 | std::vector database; 38 | }; -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/sdk.cpp: -------------------------------------------------------------------------------- 1 | #include "sdk.hpp" 2 | 3 | #include "../Helpers/Utils.hpp" 4 | 5 | namespace Interfaces 6 | { 7 | CreateInterfaceFn get_module_factory(HMODULE module) 8 | { 9 | return reinterpret_cast(GetProcAddress(module, "CreateInterface")); 10 | } 11 | 12 | template 13 | T* get_interface(CreateInterfaceFn f, const char* szInterfaceVersion) 14 | { 15 | auto result = reinterpret_cast(f(szInterfaceVersion, nullptr)); 16 | 17 | if(!result) { 18 | throw std::runtime_error(std::string("[get_interface] Failed to GetOffset interface: ") + szInterfaceVersion); 19 | } 20 | 21 | return result; 22 | } 23 | 24 | void Initialize() 25 | { 26 | auto engineFactory = get_module_factory(GetModuleHandleW(L"engine.dll")); 27 | auto clientFactory = get_module_factory(GetModuleHandleW(L"client.dll")); 28 | auto valveStdFactory = get_module_factory(GetModuleHandleW(L"vstdlib.dll")); 29 | auto vguiFactory = get_module_factory(GetModuleHandleW(L"vguimatsurface.dll")); 30 | auto vgui2Factory = get_module_factory(GetModuleHandleW(L"vgui2.dll")); 31 | auto matSysFactory = get_module_factory(GetModuleHandleW(L"materialsystem.dll")); 32 | auto dataCacheFactory = get_module_factory(GetModuleHandleW(L"datacache.dll")); 33 | auto vphysicsFactory = get_module_factory(GetModuleHandleW(L"vphysics.dll")); 34 | auto inputSysFactory = get_module_factory(GetModuleHandleW(L"inputsystem.dll")); 35 | 36 | g_CHLClient = get_interface (clientFactory , "VClient018"); 37 | g_EntityList = get_interface (clientFactory , "VClientEntityList003"); 38 | g_Prediction = get_interface (clientFactory , "VClientPrediction001"); 39 | g_GameMovement = get_interface (clientFactory , "GameMovement001"); 40 | g_MdlCache = get_interface (dataCacheFactory, "MDLCache004"); 41 | g_EngineClient = get_interface (engineFactory , "VEngineClient014"); 42 | g_MdlInfo = get_interface (engineFactory , "VModelInfoClient004"); 43 | g_MdlRender = get_interface (engineFactory , "VEngineModel016"); 44 | g_RenderView = get_interface (engineFactory , "VEngineRenderView014"); 45 | g_EngineTrace = get_interface (engineFactory , "EngineTraceClient004"); 46 | g_DebugOverlay = get_interface (engineFactory , "VDebugOverlay004"); 47 | g_GameEvents = get_interface (engineFactory , "GAMEEVENTSMANAGER002"); 48 | g_EngineSound = get_interface (engineFactory , "IEngineSoundClient003"); 49 | g_MatSystem = get_interface (matSysFactory , "VMaterialSystem080"); 50 | g_CVar = get_interface (valveStdFactory , "VEngineCvar007"); 51 | g_VGuiPanel = get_interface (vgui2Factory , "VGUI_Panel009"); 52 | g_VGuiSurface = get_interface (vguiFactory , "VGUI_Surface031"); 53 | g_PhysSurface = get_interface(vphysicsFactory , "VPhysicsSurfaceProps001"); 54 | g_InputSystem = get_interface (inputSysFactory , "InputSystemVersion001"); 55 | 56 | auto client = GetModuleHandleW(L"client.dll"); 57 | auto engine = GetModuleHandleW(L"engine.dll"); 58 | auto dx9api = GetModuleHandleW(L"shaderapidx9.dll"); 59 | do { 60 | g_ClientMode = **(IClientMode***)((*(uintptr_t**)g_CHLClient)[10] + 0x5); 61 | } while (!g_ClientMode); 62 | g_GlobalVars = **(CGlobalVarsBase***)(Utils::PatternScan(client, "A1 ? ? ? ? 5E 8B 40 10") + 1); 63 | g_Input = *(CInput**)(Utils::PatternScan(client, "B9 ? ? ? ? F3 0F 11 04 24 FF 50 10") + 1); 64 | g_MoveHelper = **(IMoveHelper***)(Utils::PatternScan(client, "8B 0D ? ? ? ? 8B 45 ? 51 8B D4 89 02 8B 01") + 2); 65 | g_GlowObjManager = *(CGlowObjectManager**)(Utils::PatternScan(client, "0F 11 05 ? ? ? ? 83 C8 01") + 3); 66 | g_ViewRender = *(IViewRender**)(Utils::PatternScan(client, "A1 ? ? ? ? B9 ? ? ? ? C7 05 ? ? ? ? ? ? ? ? FF 10") + 1); 67 | g_D3DDevice9 = **(IDirect3DDevice9***)(Utils::PatternScan(dx9api, "A1 ? ? ? ? 50 8B 08 FF 51 0C") + 1); 68 | g_ClientState = **(CClientState***)(Utils::PatternScan(engine, "A1 ? ? ? ? 8B 80 ? ? ? ? C3") + 1); 69 | g_LocalPlayer = *(C_LocalPlayer*)(Utils::PatternScan(client, "8B 0D ? ? ? ? 83 FF FF 74 07") + 2); 70 | g_WeaponSystem = *(IWeaponSystem * *)(Utils::PatternScan(client, "8B 35 ? ? ? ? FF 10 0F B7 C0") + 2); 71 | } 72 | 73 | void Dump() 74 | { 75 | // Ugly macros ugh 76 | #define STRINGIFY_IMPL(s) #s 77 | #define STRINGIFY(s) STRINGIFY_IMPL(s) 78 | #define PRINT_INTERFACE(name) Utils::ConsolePrint("%-20s: %p\n", STRINGIFY(name), name) 79 | 80 | PRINT_INTERFACE(g_CHLClient ); 81 | PRINT_INTERFACE(g_EntityList ); 82 | PRINT_INTERFACE(g_Prediction ); 83 | PRINT_INTERFACE(g_GameMovement); 84 | PRINT_INTERFACE(g_MdlCache ); 85 | PRINT_INTERFACE(g_EngineClient); 86 | PRINT_INTERFACE(g_MdlInfo ); 87 | PRINT_INTERFACE(g_MdlRender ); 88 | PRINT_INTERFACE(g_RenderView ); 89 | PRINT_INTERFACE(g_EngineTrace ); 90 | PRINT_INTERFACE(g_DebugOverlay); 91 | PRINT_INTERFACE(g_GameEvents ); 92 | PRINT_INTERFACE(g_EngineSound ); 93 | PRINT_INTERFACE(g_MatSystem ); 94 | PRINT_INTERFACE(g_CVar ); 95 | PRINT_INTERFACE(g_VGuiPanel ); 96 | PRINT_INTERFACE(g_VGuiSurface ); 97 | PRINT_INTERFACE(g_PhysSurface ); 98 | PRINT_INTERFACE(g_InputSystem ); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /CSGOSimple/valve_sdk/sdk.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define NOMINMAX 4 | #include 5 | 6 | #include "Misc/Enums.hpp" 7 | #include "Misc/vfunc.hpp" 8 | 9 | #include "Math/VMatrix.hpp" 10 | #include "Math/QAngle.hpp" 11 | #include "Math/Vector.hpp" 12 | #include "Misc/Studio.hpp" 13 | 14 | #include "Interfaces/IAppSystem.hpp" 15 | #include "Interfaces/IBaseClientDll.hpp" 16 | #include "Interfaces/IClientEntity.hpp" 17 | #include "Interfaces/IClientEntityList.hpp" 18 | #include "Interfaces/IClientMode.hpp" 19 | #include "Interfaces/IConVar.hpp" 20 | #include "Interfaces/ICvar.hpp" 21 | #include "Interfaces/IEngineTrace.hpp" 22 | #include "Interfaces/IVEngineClient.hpp" 23 | #include "Interfaces/IVDebugOverlay.hpp" 24 | #include "Interfaces/ISurface.hpp" 25 | #include "Interfaces/CInput.hpp" 26 | #include "Interfaces/IVModelInfoClient.hpp" 27 | #include "Interfaces/IVModelRender.hpp" 28 | #include "Interfaces/IRenderView.hpp" 29 | #include "Interfaces/IGameEventmanager.hpp" 30 | #include "Interfaces/IMaterialSystem.hpp" 31 | #include "Interfaces/IMoveHelper.hpp" 32 | #include "Interfaces/IMDLCache.hpp" 33 | #include "Interfaces/IPrediction.hpp" 34 | #include "Interfaces/IPanel.hpp" 35 | #include "Interfaces/IEngineSound.hpp" 36 | #include "Interfaces/IViewRender.hpp" 37 | #include "Interfaces/CClientState.hpp" 38 | #include "Interfaces/IPhysics.hpp" 39 | #include "Interfaces/IInputSystem.hpp" 40 | #include "interfaces/IRefCounted.hpp" 41 | 42 | #include "Misc/Convar.hpp" 43 | #include "Misc/CUserCmd.hpp" 44 | #include "Misc/glow_outline_effect.hpp" 45 | #include "Misc/datamap.hpp" 46 | 47 | #include "netvars.hpp" 48 | 49 | struct IDirect3DDevice9; 50 | 51 | namespace Interfaces 52 | { 53 | void Initialize(); 54 | void Dump(); 55 | } 56 | 57 | inline IVEngineClient* g_EngineClient = nullptr; 58 | inline IBaseClientDLL* g_CHLClient = nullptr; 59 | inline IClientEntityList* g_EntityList = nullptr; 60 | inline CGlobalVarsBase* g_GlobalVars = nullptr; 61 | inline IEngineTrace* g_EngineTrace = nullptr; 62 | inline ICvar* g_CVar = nullptr; 63 | inline IPanel* g_VGuiPanel = nullptr; 64 | inline IClientMode* g_ClientMode = nullptr; 65 | inline IVDebugOverlay* g_DebugOverlay = nullptr; 66 | inline ISurface* g_VGuiSurface = nullptr; 67 | inline CInput* g_Input = nullptr; 68 | inline IVModelInfoClient* g_MdlInfo = nullptr; 69 | inline IVModelRender* g_MdlRender = nullptr; 70 | inline IVRenderView* g_RenderView = nullptr; 71 | inline IMaterialSystem* g_MatSystem = nullptr; 72 | inline IGameEventManager2* g_GameEvents = nullptr; 73 | inline IMoveHelper* g_MoveHelper = nullptr; 74 | inline IMDLCache* g_MdlCache = nullptr; 75 | inline IPrediction* g_Prediction = nullptr; 76 | inline CGameMovement* g_GameMovement = nullptr; 77 | inline IEngineSound* g_EngineSound = nullptr; 78 | inline CGlowObjectManager* g_GlowObjManager = nullptr; 79 | inline IViewRender* g_ViewRender = nullptr; 80 | inline IDirect3DDevice9* g_D3DDevice9 = nullptr; 81 | inline CClientState* g_ClientState = nullptr; 82 | inline IPhysicsSurfaceProps* g_PhysSurface = nullptr; 83 | inline IInputSystem* g_InputSystem = nullptr; 84 | inline IWeaponSystem* g_WeaponSystem = nullptr; 85 | 86 | template 87 | void ConMsg(const char* pMsg, Args... args) 88 | { 89 | static auto import = (void(*)(const char*, ...))GetProcAddress(GetModuleHandleW(L"tier0.dll"), "?ConMsg@@YAXPBDZZ"); 90 | return import(pMsg, args...); 91 | } 92 | template 93 | void ConColorMsg(const Color& clr, const char* pMsg, Args... args) 94 | { 95 | static auto import = (void(*)(const Color&, const char*, ...))GetProcAddress(GetModuleHandleW(L"tier0.dll"), "?ConColorMsg@@YAXABVColor@@PBDZZ"); 96 | return import(clr, pMsg, args...); 97 | } 98 | 99 | #include "Misc/EHandle.hpp" 100 | 101 | class C_LocalPlayer 102 | { 103 | friend bool operator==(const C_LocalPlayer& lhs, void* rhs); 104 | public: 105 | C_LocalPlayer() : m_local(nullptr) {} 106 | 107 | operator bool() const { return *m_local != nullptr; } 108 | operator C_BasePlayer*() const { return *m_local; } 109 | 110 | C_BasePlayer* operator->() { return *m_local; } 111 | 112 | private: 113 | C_BasePlayer** m_local; 114 | }; 115 | 116 | inline C_LocalPlayer g_LocalPlayer; 117 | 118 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Mark H C 4 | Copyright (c) 2018 spirthack 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CSGOSimple 2 | CSGOSimple is an internal cheat base. This fork was created after MarkHC stops working on this project 3 | 4 | ## Repositories: 5 | Gitlab: https://gitlab.com/spirt/csgosimple 6 | Github: https://github.com/spirthack/csgosimple 7 | 8 | # features ahead MarkHC/CSGOSimple: 9 | It exists :trollface: 10 | ImGui updated to newer version, you always can update it manually later 11 | Latest structs/interfaces updated after CSGO update 12 | Fixed some bugs, like vfunc hooker 13 | ImGui Renderer(improved) 14 | Panorama support 15 | 16 | 17 | ![Menu Screenshot after ImGui update](https://i.imgur.com/pYgCja5.png) 18 | 19 | 20 | Thanks all original(MarkHC's) CSGOSimple devs. 21 | 22 | 23 | 24 | ![ESP Screenshot](https://i.imgur.com/NRJ4e2n.png) 25 | ![ESP Screenshot](https://i.imgur.com/KWO0bsw.png) 26 | ![ESP Screenshot](https://i.imgur.com/17iVttS.png) 27 | -------------------------------------------------------------------------------- /SimpleInjector/README.md: -------------------------------------------------------------------------------- 1 | # SimpleInjector 2 | This is a very simple LoadLibrary injector for the main project. 3 | 4 | *You may use your own injector if you desire.* 5 | 6 | ## Usage: 7 | 1. The DLL must be on the same folder as the injector. 8 | 2. Run CSGO. 9 | 3. Run the injector. 10 | -------------------------------------------------------------------------------- /SimpleInjector/SimpleInjector.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /SimpleInjector/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | bool file_exists(const wchar_t* name) 8 | { 9 | std::ifstream infile{ name }; 10 | return infile.good(); 11 | } 12 | 13 | bool process_exists(const wchar_t* name, uint32_t& pid) 14 | { 15 | auto snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); 16 | 17 | if(snapshot == INVALID_HANDLE_VALUE) 18 | return false; 19 | 20 | auto entry = PROCESSENTRY32{ sizeof(PROCESSENTRY32) }; 21 | 22 | if(Process32First(snapshot, &entry)) { 23 | do { 24 | if(!wcscmp(entry.szExeFile, name)) { 25 | pid = entry.th32ProcessID; 26 | CloseHandle(snapshot); 27 | return true; 28 | } 29 | } while(Process32Next(snapshot, &entry)); 30 | } 31 | CloseHandle(snapshot); 32 | return false; 33 | } 34 | 35 | bool enable_debug_privilege(HANDLE process) 36 | { 37 | LUID luid; 38 | HANDLE token; 39 | TOKEN_PRIVILEGES newPrivileges; 40 | 41 | if(!OpenProcessToken(process, TOKEN_ADJUST_PRIVILEGES, &token)) 42 | return false; 43 | 44 | if(!LookupPrivilegeValue(nullptr, SE_DEBUG_NAME, &luid)) 45 | return false; 46 | 47 | newPrivileges.PrivilegeCount = 1; 48 | newPrivileges.Privileges[0].Luid = luid; 49 | newPrivileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; 50 | 51 | return AdjustTokenPrivileges( 52 | token, // TokenHandle 53 | FALSE, // DisableAllPrivileges 54 | &newPrivileges, // NewPrivileges 55 | sizeof(newPrivileges), // BufferLength 56 | nullptr, // PreviousState (OPTIONAL) 57 | nullptr // ReturnLength (OPTIONAL) 58 | ); 59 | } 60 | 61 | bool process_open(uint32_t pid, HANDLE& handle) 62 | { 63 | handle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_OPERATION | 64 | PROCESS_VM_READ | PROCESS_VM_WRITE | 65 | PROCESS_CREATE_THREAD, FALSE, pid); 66 | 67 | return handle != nullptr; 68 | } 69 | 70 | bool inject(HANDLE process, const wchar_t* dll) 71 | { 72 | auto thread = HANDLE{ nullptr }; 73 | auto exit_code = 0; 74 | auto dllpath = VirtualAllocEx(process, nullptr, 0x1000, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); 75 | 76 | if(!dllpath) 77 | goto fail; 78 | 79 | auto success = WriteProcessMemory(process, dllpath, dll, (wcslen(dll) + 1) * sizeof(wchar_t), nullptr); 80 | 81 | if(!success) 82 | goto fail; 83 | 84 | thread = CreateRemoteThread(process, nullptr, 0, 85 | (LPTHREAD_START_ROUTINE)LoadLibraryW, dllpath, 0, nullptr); 86 | 87 | if(!thread) { 88 | goto fail; 89 | } 90 | 91 | if(WaitForSingleObject(thread, 4000) == WAIT_OBJECT_0) { 92 | exit_code = 0; 93 | GetExitCodeThread(thread, (DWORD*)&exit_code); 94 | } 95 | 96 | fail: 97 | if(thread) 98 | CloseHandle(thread); 99 | if(dllpath) 100 | VirtualFreeEx(process, dllpath, 0, MEM_RELEASE); 101 | 102 | return exit_code != 0; 103 | } 104 | 105 | int main() 106 | { 107 | constexpr auto TARGET_FILE = L"csgosimple.dll"; 108 | constexpr auto TARGET_PROCESS = L"csgo.exe"; 109 | 110 | wchar_t fullpath[MAX_PATH] = { 0 }; 111 | auto proc_id = 0u; 112 | auto proc_handle = HANDLE{ nullptr }; 113 | 114 | enable_debug_privilege(GetCurrentProcess()); 115 | 116 | try { 117 | if(!file_exists(TARGET_FILE)) 118 | throw std::runtime_error{ "DLL not found." }; 119 | 120 | if(!process_exists(TARGET_PROCESS, proc_id)) 121 | throw std::runtime_error{ "Process is not running." }; 122 | 123 | if(!process_open(proc_id, proc_handle)) { 124 | throw std::runtime_error{ "Failed to open process." }; 125 | } 126 | 127 | _wfullpath(fullpath, TARGET_FILE, MAX_PATH); 128 | 129 | if(!inject(proc_handle, fullpath)) { 130 | throw std::runtime_error{ "Failed to inject DLL." }; 131 | } 132 | } catch(const std::exception& ex) { 133 | std::cout << "[ERROR] " << ex.what() << '\n'; 134 | std::cout << "Press any key to exit..." << '\n'; 135 | std::cin.get(); 136 | return EXIT_FAILURE; 137 | } 138 | 139 | return EXIT_SUCCESS; 140 | } 141 | --------------------------------------------------------------------------------