├── .gitattributes ├── .gitignore ├── GMod-SDK.sln ├── GMod-SDK ├── GMod-SDK.vcxproj ├── GMod-SDK.vcxproj.filters ├── ImGui │ ├── imconfig.h │ ├── imgui.cpp │ ├── imgui.h │ ├── imgui_demo.cpp │ ├── imgui_draw.cpp │ ├── imgui_impl_dx9.cpp │ ├── imgui_impl_dx9.h │ ├── imgui_impl_win32.cpp │ ├── imgui_impl_win32.h │ ├── imgui_internal.h │ ├── imgui_widgets.cpp │ ├── imstb_rectpack.h │ ├── imstb_textedit.h │ └── imstb_truetype.h ├── Interface.h ├── Memory.cpp ├── Memory.h ├── NetVars.h ├── client │ ├── CBaseAnimating.h │ ├── CClientEntityList.h │ ├── CCollisionProperty.h │ ├── CHLClient.h │ ├── CInput.h │ ├── CInputSystem.h │ ├── CUniformRandomStream.h │ ├── CViewRender.h │ ├── CViewSetup.h │ ├── C_BaseCombatCharacter.h │ ├── C_BasePlayer.h │ ├── ClientClass.h │ ├── ClientModeShared.h │ ├── ConCommand.h │ ├── ConVar.h │ ├── IGameMovement.h │ ├── IPrediction.h │ ├── c_basecombatweapon.h │ └── usercmd.h ├── dllmain.cpp ├── engine │ ├── CEngineClient.h │ ├── CGameEventManager.h │ ├── CIVDebugOverlay.h │ ├── CMaterialSystem.h │ ├── CModelInfo.h │ ├── CModelRender.h │ ├── CNetChan.h │ ├── CVRenderView.h │ ├── IEngineTrace.h │ ├── IStudioRender.h │ ├── gametrace.h │ ├── iclientrenderable.h │ ├── imaterial.h │ ├── inetmessage.h │ ├── takedamageinfo.h │ ├── trace.h │ └── vmatrix.h ├── globals.hpp ├── hacks │ ├── AntiAim.h │ ├── AutoWall.h │ ├── ConVarSpoofing.h │ ├── ConfigSystem.h │ ├── ESP.h │ ├── Executor.h │ ├── GunHacks.h │ ├── LegitAim.h │ ├── Misc.h │ ├── Prediction.h │ ├── ScriptDumper.h │ ├── Triggerbot.h │ ├── Utils.h │ └── menu │ │ ├── Fonts.h │ │ ├── GUI.h │ │ ├── MenuBackground.h │ │ ├── MenuControls.h │ │ └── drawing.h ├── hooks │ ├── CreateMove.h │ ├── DrawModelExecute.h │ ├── FrameStageNotify.h │ ├── Paint.h │ ├── PaintTraverse.h │ ├── Present.h │ ├── ProcessGMODServerToClient.h │ ├── RenderView.h │ ├── RunCommand.h │ └── RunStringEx.h ├── json.h ├── lua_shared │ ├── CLuaConVars.h │ ├── CLuaInterface.h │ └── CLuaShared.h ├── mathlib │ ├── math_pfns.h │ └── mathlib.h ├── tier0 │ ├── Color.h │ ├── Vector.h │ ├── basetypes.h │ ├── platform.h │ ├── shareddefs.h │ └── soundinfo.h ├── tier1 │ ├── KeyValues.cpp │ ├── KeyValues.h │ ├── bitbuf.h │ ├── checksum_crc.h │ └── checksum_md5.h ├── vgui │ ├── ISurfaceV30.h │ └── VPanelWrapper.h ├── vguimatsurface │ └── CMatSystemSurface.h └── vphysics │ └── CPhysicsSurfaceProps.h ├── LICENSE └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.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 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Dd]ebugPublic/ 19 | [Rr]elease/ 20 | [Rr]eleases/ 21 | x64/ 22 | x86/ 23 | bld/ 24 | [Bb]in/ 25 | [Oo]bj/ 26 | [Ll]og/ 27 | 28 | # Visual Studio 2015/2017 cache/options directory 29 | .vs/ 30 | # Uncomment if you have tasks that create the project's static files in wwwroot 31 | #wwwroot/ 32 | 33 | # Visual Studio 2017 auto generated files 34 | Generated\ Files/ 35 | 36 | # MSTest test Results 37 | [Tt]est[Rr]esult*/ 38 | [Bb]uild[Ll]og.* 39 | 40 | # NUNIT 41 | *.VisualState.xml 42 | TestResult.xml 43 | 44 | # Build Results of an ATL Project 45 | [Dd]ebugPS/ 46 | [Rr]eleasePS/ 47 | dlldata.c 48 | 49 | # Benchmark Results 50 | BenchmarkDotNet.Artifacts/ 51 | 52 | # .NET Core 53 | project.lock.json 54 | project.fragment.lock.json 55 | artifacts/ 56 | 57 | # StyleCop 58 | StyleCopReport.xml 59 | 60 | # Files built by Visual Studio 61 | *_i.c 62 | *_p.c 63 | *_h.h 64 | *.ilk 65 | *.meta 66 | *.obj 67 | *.iobj 68 | *.pch 69 | *.pdb 70 | *.ipdb 71 | *.pgc 72 | *.pgd 73 | *.rsp 74 | *.sbr 75 | *.tlb 76 | *.tli 77 | *.tlh 78 | *.tmp 79 | *.tmp_proj 80 | *_wpftmp.csproj 81 | *.log 82 | *.vspscc 83 | *.vssscc 84 | .builds 85 | *.pidb 86 | *.svclog 87 | *.scc 88 | 89 | # Chutzpah Test files 90 | _Chutzpah* 91 | 92 | # Visual C++ cache files 93 | ipch/ 94 | *.aps 95 | *.ncb 96 | *.opendb 97 | *.opensdf 98 | *.sdf 99 | *.cachefile 100 | *.VC.db 101 | *.VC.VC.opendb 102 | 103 | # Visual Studio profiler 104 | *.psess 105 | *.vsp 106 | *.vspx 107 | *.sap 108 | 109 | # Visual Studio Trace Files 110 | *.e2e 111 | 112 | # TFS 2012 Local Workspace 113 | $tf/ 114 | 115 | # Guidance Automation Toolkit 116 | *.gpState 117 | 118 | # ReSharper is a .NET coding add-in 119 | _ReSharper*/ 120 | *.[Rr]e[Ss]harper 121 | *.DotSettings.user 122 | 123 | # JustCode is a .NET coding add-in 124 | .JustCode 125 | 126 | # TeamCity is a build add-in 127 | _TeamCity* 128 | 129 | # DotCover is a Code Coverage Tool 130 | *.dotCover 131 | 132 | # AxoCover is a Code Coverage Tool 133 | .axoCover/* 134 | !.axoCover/settings.json 135 | 136 | # Visual Studio code coverage results 137 | *.coverage 138 | *.coveragexml 139 | 140 | # NCrunch 141 | _NCrunch_* 142 | .*crunch*.local.xml 143 | nCrunchTemp_* 144 | 145 | # MightyMoose 146 | *.mm.* 147 | AutoTest.Net/ 148 | 149 | # Web workbench (sass) 150 | .sass-cache/ 151 | 152 | # Installshield output folder 153 | [Ee]xpress/ 154 | 155 | # DocProject is a documentation generator add-in 156 | DocProject/buildhelp/ 157 | DocProject/Help/*.HxT 158 | DocProject/Help/*.HxC 159 | DocProject/Help/*.hhc 160 | DocProject/Help/*.hhk 161 | DocProject/Help/*.hhp 162 | DocProject/Help/Html2 163 | DocProject/Help/html 164 | 165 | # Click-Once directory 166 | publish/ 167 | 168 | # Publish Web Output 169 | *.[Pp]ublish.xml 170 | *.azurePubxml 171 | # Note: Comment the next line if you want to checkin your web deploy settings, 172 | # but database connection strings (with potential passwords) will be unencrypted 173 | *.pubxml 174 | *.publishproj 175 | 176 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 177 | # checkin your Azure Web App publish settings, but sensitive information contained 178 | # in these scripts will be unencrypted 179 | PublishScripts/ 180 | 181 | # NuGet Packages 182 | *.nupkg 183 | # The packages folder can be ignored because of Package Restore 184 | **/[Pp]ackages/* 185 | # except build/, which is used as an MSBuild target. 186 | !**/[Pp]ackages/build/ 187 | # Uncomment if necessary however generally it will be regenerated when needed 188 | #!**/[Pp]ackages/repositories.config 189 | # NuGet v3's project.json files produces more ignorable files 190 | *.nuget.props 191 | *.nuget.targets 192 | 193 | # Microsoft Azure Build Output 194 | csx/ 195 | *.build.csdef 196 | 197 | # Microsoft Azure Emulator 198 | ecf/ 199 | rcf/ 200 | 201 | # Windows Store app package directories and files 202 | AppPackages/ 203 | BundleArtifacts/ 204 | Package.StoreAssociation.xml 205 | _pkginfo.txt 206 | *.appx 207 | 208 | # Visual Studio cache files 209 | # files ending in .cache can be ignored 210 | *.[Cc]ache 211 | # but keep track of directories ending in .cache 212 | !*.[Cc]ache/ 213 | 214 | # Others 215 | ClientBin/ 216 | ~$* 217 | *~ 218 | *.dbmdl 219 | *.dbproj.schemaview 220 | *.jfm 221 | *.pfx 222 | *.publishsettings 223 | orleans.codegen.cs 224 | 225 | # Including strong name files can present a security risk 226 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 227 | #*.snk 228 | 229 | # Since there are multiple workflows, uncomment next line to ignore bower_components 230 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 231 | #bower_components/ 232 | 233 | # RIA/Silverlight projects 234 | Generated_Code/ 235 | 236 | # Backup & report files from converting an old project file 237 | # to a newer Visual Studio version. Backup files are not needed, 238 | # because we have git ;-) 239 | _UpgradeReport_Files/ 240 | Backup*/ 241 | UpgradeLog*.XML 242 | UpgradeLog*.htm 243 | ServiceFabricBackup/ 244 | *.rptproj.bak 245 | 246 | # SQL Server files 247 | *.mdf 248 | *.ldf 249 | *.ndf 250 | 251 | # Business Intelligence projects 252 | *.rdl.data 253 | *.bim.layout 254 | *.bim_*.settings 255 | *.rptproj.rsuser 256 | 257 | # Microsoft Fakes 258 | FakesAssemblies/ 259 | 260 | # GhostDoc plugin setting file 261 | *.GhostDoc.xml 262 | 263 | # Node.js Tools for Visual Studio 264 | .ntvs_analysis.dat 265 | node_modules/ 266 | 267 | # Visual Studio 6 build log 268 | *.plg 269 | 270 | # Visual Studio 6 workspace options file 271 | *.opt 272 | 273 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 274 | *.vbw 275 | 276 | # Visual Studio LightSwitch build output 277 | **/*.HTMLClient/GeneratedArtifacts 278 | **/*.DesktopClient/GeneratedArtifacts 279 | **/*.DesktopClient/ModelManifest.xml 280 | **/*.Server/GeneratedArtifacts 281 | **/*.Server/ModelManifest.xml 282 | _Pvt_Extensions 283 | 284 | # Paket dependency manager 285 | .paket/paket.exe 286 | paket-files/ 287 | 288 | # FAKE - F# Make 289 | .fake/ 290 | 291 | # JetBrains Rider 292 | .idea/ 293 | *.sln.iml 294 | 295 | # CodeRush personal settings 296 | .cr/personal 297 | 298 | # Python Tools for Visual Studio (PTVS) 299 | __pycache__/ 300 | *.pyc 301 | 302 | # Cake - Uncomment if you are using it 303 | # tools/** 304 | # !tools/packages.config 305 | 306 | # Tabs Studio 307 | *.tss 308 | 309 | # Telerik's JustMock configuration file 310 | *.jmconfig 311 | 312 | # BizTalk build output 313 | *.btp.cs 314 | *.btm.cs 315 | *.odx.cs 316 | *.xsd.cs 317 | 318 | # OpenCover UI analysis results 319 | OpenCover/ 320 | 321 | # Azure Stream Analytics local run output 322 | ASALocalRun/ 323 | 324 | # MSBuild Binary and Structured Log 325 | *.binlog 326 | 327 | # NVidia Nsight GPU debugger configuration file 328 | *.nvuser 329 | 330 | # MFractors (Xamarin productivity tool) working folder 331 | .mfractor/ 332 | 333 | # Local History for Visual Studio 334 | .localhistory/ 335 | -------------------------------------------------------------------------------- /GMod-SDK.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31112.23 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GMod-SDK", "GMod-SDK\GMod-SDK.vcxproj", "{7E3672B6-C73B-4547-84BE-13CC102FE5C4}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {7E3672B6-C73B-4547-84BE-13CC102FE5C4}.Debug|x64.ActiveCfg = Debug|x64 17 | {7E3672B6-C73B-4547-84BE-13CC102FE5C4}.Debug|x64.Build.0 = Debug|x64 18 | {7E3672B6-C73B-4547-84BE-13CC102FE5C4}.Debug|x86.ActiveCfg = Debug|Win32 19 | {7E3672B6-C73B-4547-84BE-13CC102FE5C4}.Debug|x86.Build.0 = Debug|Win32 20 | {7E3672B6-C73B-4547-84BE-13CC102FE5C4}.Release|x64.ActiveCfg = Release|x64 21 | {7E3672B6-C73B-4547-84BE-13CC102FE5C4}.Release|x64.Build.0 = Release|x64 22 | {7E3672B6-C73B-4547-84BE-13CC102FE5C4}.Release|x86.ActiveCfg = Release|Win32 23 | {7E3672B6-C73B-4547-84BE-13CC102FE5C4}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {68947B57-D641-44C4-B31B-D283F24B956E} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /GMod-SDK/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 explicit ImVec4(float f[3]) noexcept { x = f[0]; y = f[1]; z = f[2]; w = 0.0f; } 60 | 61 | //---- Use 32-bit vertex indices (default is 16-bit) to allow meshes with more than 64K vertices. Render function needs to support it. 62 | //#define ImDrawIdx unsigned int 63 | 64 | //---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files. 65 | /* 66 | namespace ImGui 67 | { 68 | void MyFunction(const char* name, const MyMatrix44& v); 69 | } 70 | */ 71 | -------------------------------------------------------------------------------- /GMod-SDK/ImGui/imgui_draw.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gaztoof/GMod-SDK/a65eedc7dad8ab2c20b87a110c8cfeafaba853f7/GMod-SDK/ImGui/imgui_draw.cpp -------------------------------------------------------------------------------- /GMod-SDK/ImGui/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 | -------------------------------------------------------------------------------- /GMod-SDK/ImGui/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 | // Missing features: 9 | // [ ] Platform: Gamepad support (best leaving it to user application to fill io.NavInputs[] with gamepad inputs from their source of choice). 10 | 11 | #pragma once 12 | 13 | IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd); 14 | IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown(); 15 | IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame(); 16 | 17 | // Handler for Win32 messages, update mouse/keyboard data. 18 | // You may or not need this for your implementation, but it can serve as reference for handling inputs. 19 | // Intentionally commented out to avoid dragging dependencies on types. You can copy the extern declaration in your code. 20 | /* 21 | IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 22 | */ 23 | -------------------------------------------------------------------------------- /GMod-SDK/Interface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | typedef PVOID(*CreateInterfaceFn)(const char* Name, int* ReturnCode); 5 | PVOID GetInterface(const char* moduleName, const char* interfaceName) 6 | { 7 | CreateInterfaceFn createInterface = (CreateInterfaceFn)GetProcAddress(GetModuleHandleA(moduleName), "CreateInterface"); 8 | return createInterface(interfaceName, NULL); 9 | } -------------------------------------------------------------------------------- /GMod-SDK/Memory.cpp: -------------------------------------------------------------------------------- 1 | #include "Memory.h" 2 | 3 | void BytePatch(PVOID source, BYTE newValue) 4 | { 5 | DWORD originalProtection; 6 | VirtualProtect(source, sizeof(PVOID), PAGE_EXECUTE_READWRITE, &originalProtection); 7 | *(BYTE*)(source) = newValue; 8 | VirtualProtect(source, sizeof(PVOID), originalProtection, &originalProtection); 9 | } 10 | 11 | void RestoreVMTHook(PVOID** src, PVOID dst, int index) 12 | { 13 | PVOID* VMT = *src; 14 | PVOID ret = (VMT[index]); 15 | DWORD originalProtection; 16 | VirtualProtect(&VMT[index], sizeof(PVOID), PAGE_EXECUTE_READWRITE, &originalProtection); 17 | VMT[index] = dst; 18 | VirtualProtect(&VMT[index], sizeof(PVOID), originalProtection, &originalProtection); 19 | } 20 | std::vector vmtHooks; 21 | void RestoreVMTHooks() 22 | { 23 | for (int i = 0; i < vmtHooks.size(); i++) 24 | { 25 | auto currData = vmtHooks[i]; 26 | RestoreVMTHook(currData.src, currData.dst, currData.index); 27 | } 28 | } 29 | 30 | // credits to osiris for the following 31 | static auto generateBadCharTable(std::string_view pattern) noexcept 32 | { 33 | std::array table; 34 | 35 | auto lastWildcard = pattern.rfind('?'); 36 | if (lastWildcard == std::string_view::npos) 37 | lastWildcard = 0; 38 | 39 | const auto defaultShift = (std::max)(std::size_t(1), pattern.length() - 1 - lastWildcard); 40 | table.fill(defaultShift); 41 | 42 | for (auto i = lastWildcard; i < pattern.length() - 1; ++i) 43 | table[static_cast(pattern[i])] = pattern.length() - 1 - i; 44 | 45 | return table; 46 | } 47 | const char* findPattern(const char* moduleName, std::string_view pattern, std::string patternName) noexcept 48 | { 49 | PVOID moduleBase = 0; 50 | std::size_t moduleSize = 0; 51 | if (HMODULE handle = GetModuleHandleA(moduleName)) 52 | if (MODULEINFO moduleInfo; GetModuleInformation(GetCurrentProcess(), handle, &moduleInfo, sizeof(moduleInfo))) 53 | { 54 | moduleBase = moduleInfo.lpBaseOfDll; 55 | moduleSize = moduleInfo.SizeOfImage; 56 | } 57 | 58 | 59 | if (moduleBase && moduleSize) { 60 | int lastIdx = pattern.length() - 1; 61 | const auto badCharTable = generateBadCharTable(pattern); 62 | 63 | auto start = static_cast(moduleBase); 64 | const auto end = start + moduleSize - pattern.length(); 65 | 66 | while (start <= end) { 67 | int i = lastIdx; 68 | while (i >= 0 && (pattern[i] == '?' || start[i] == pattern[i])) 69 | --i; 70 | 71 | if (i < 0) 72 | { 73 | return start; 74 | } 75 | 76 | start += badCharTable[static_cast(start[lastIdx])]; 77 | } 78 | } 79 | std::string toPrint = "Failed to find pattern\"" + patternName + "\", let the dev know ASAP!"; 80 | MessageBoxA(NULL, toPrint.c_str(), "ERROR", MB_OK | MB_ICONWARNING); 81 | return 0; 82 | } 83 | char* GetRealFromRelative(char* address, int offset, int instructionSize, bool isRelative) // Address must be an instruction, not a pointer! And offset = the offset to the bytes you want to retrieve. 84 | { 85 | #ifdef _WIN64 86 | isRelative = true; 87 | #endif 88 | char* instruction = address + offset; 89 | if (!isRelative) 90 | { 91 | return *(char**)(instruction); 92 | } 93 | 94 | int relativeAddress = *(int*)(instruction); 95 | char* realAddress = address + instructionSize + relativeAddress; 96 | return realAddress; 97 | } 98 | 99 | std::string RandomString(int length) 100 | { 101 | std::string output; 102 | std::string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; 103 | for (int i = 0; i < length; i++) 104 | output += alphabet[rand() % (alphabet.length() - 1)]; 105 | return output; 106 | } -------------------------------------------------------------------------------- /GMod-SDK/Memory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | void BytePatch(PVOID source, BYTE newValue); 14 | 15 | struct hookData { 16 | PVOID** src; 17 | PVOID dst; 18 | int index; 19 | }; 20 | extern std::vector vmtHooks; 21 | 22 | template 23 | T VMTHook(PVOID** src, PVOID dst, int index, bool noRestore = false) 24 | { 25 | // I could do tramp hooking instead of VMT hooking, but I came across a few problems while implementing my tramp, and VMT just makes it easier. 26 | PVOID* VMT = *src; 27 | PVOID ret = (VMT[index]); 28 | DWORD originalProtection; 29 | VirtualProtect(&VMT[index], sizeof(PVOID), PAGE_EXECUTE_READWRITE, &originalProtection); 30 | VMT[index] = dst; 31 | VirtualProtect(&VMT[index], sizeof(PVOID), originalProtection, &originalProtection); 32 | if (!noRestore) 33 | { 34 | hookData currData = { src, ret, index }; 35 | vmtHooks.push_back(currData); 36 | } 37 | return (T)ret; 38 | }; 39 | void RestoreVMTHook(PVOID** src, PVOID dst, int index); 40 | void RestoreVMTHooks(); 41 | 42 | const char* findPattern(const char* moduleName, std::string_view pattern, std::string patternName) noexcept; 43 | 44 | char* GetRealFromRelative(char* address, int offset, int instructionSize = 6, bool isRelative = true); // Address must be a CALL instruction, not a pointer! And offset the offset to the bytes you want to retrieve. 45 | 46 | template 47 | T* GetVMT(uintptr_t address, int index, uintptr_t offset) // Address must be a VTable pointer, not a VTable ! 48 | { 49 | #ifdef _WIN64 50 | uintptr_t step = 3; 51 | uintptr_t instructionSize = 7; 52 | uintptr_t instruction = ((*(uintptr_t**)(address))[index] + offset); 53 | 54 | uintptr_t relativeAddress = *(DWORD*)(instruction + step); 55 | uintptr_t realAddress = instruction + instructionSize + relativeAddress; 56 | return *(T**)(realAddress); 57 | #else 58 | uintptr_t instruction = ((*(uintptr_t**)(address))[index] + offset); 59 | return *(T**)(*(uintptr_t*)(instruction)); 60 | #endif 61 | } 62 | template 63 | T* GetVMT(uintptr_t address, uintptr_t offset) // This doesn't reads from the VMT, address must be the function's base ! Not a pointer! 64 | { 65 | #ifdef _WIN64 66 | uintptr_t step = 3; 67 | uintptr_t instructionSize = 7; 68 | uintptr_t instruction = address + offset; 69 | 70 | uintptr_t relativeAddress = *(DWORD*)(instruction + step); 71 | uintptr_t realAddress = instruction + instructionSize + relativeAddress; 72 | return *(T**)(realAddress); 73 | #else 74 | uintptr_t instruction = (address + offset); 75 | return *(T**)(*(uintptr_t*)(instruction)); 76 | #endif 77 | } 78 | 79 | std::string RandomString(int length); -------------------------------------------------------------------------------- /GMod-SDK/NetVars.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | // WIP 6 | DWORD getNetVar(const char* moduleName, const char* netvarName) 7 | { 8 | 9 | } -------------------------------------------------------------------------------- /GMod-SDK/client/CBaseAnimating.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gaztoof/GMod-SDK/a65eedc7dad8ab2c20b87a110c8cfeafaba853f7/GMod-SDK/client/CBaseAnimating.h -------------------------------------------------------------------------------- /GMod-SDK/client/CClientEntityList.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Auto reconstructed from vtable block @ 0x0087DCA8 4 | // from "client.dylib", by ida_vtables.idc 5 | // Modified VTable dumper script obviously by t.me/Gaztoof. 6 | class CClientEntityList 7 | { 8 | public: 9 | /*0*/ virtual void* Constr(void*) = 0; 10 | /*2*/ virtual void* Destr1() = 0; 11 | /*3*/ virtual void* destr2() = 0; 12 | /*4*/ virtual void* GetClientEntity(int entnum) = 0; 13 | /*5*/ virtual void* GetClientEntityFromHandle(uintptr_t hEnt) = 0; 14 | /*6*/ virtual int NumberOfEntities(bool bIncludeNonNetworkable = false) = 0; 15 | /*10*/ virtual int GetHighestEntityIndex(void) = 0; 16 | /*11*/ virtual void SetMaxEntities(int maxents) = 0; 17 | /*12*/ virtual int GetMaxEntities(void) = 0; 18 | }; -------------------------------------------------------------------------------- /GMod-SDK/client/CCollisionProperty.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../tier0/Vector.h" 4 | 5 | struct Ray_t; 6 | class CGameTrace; 7 | // Auto reconstructed from vtable block @ 0x009294A8 8 | // from "client.dylib", by ida_vtables.idc 9 | // Modified VTable dumper script obviously by t.me/Gaztoof. 10 | class CCollisionProperty 11 | { 12 | public: 13 | //Don't forget the constructor. 14 | /*0*/ virtual Vector& GetEntityHandle(void) = 0; 15 | /*1*/ virtual Vector& OBBMinsPreScaled(void)const = 0; 16 | /*2*/ virtual Vector& OBBMaxsPreScaled(void)const = 0; 17 | /*3*/ virtual Vector& OBBMins(void)const = 0; 18 | /*4*/ virtual Vector& OBBMaxs(void)const = 0; 19 | /*5*/ virtual void WorldSpaceTriggerBounds(Vector* pVecWorldMins, Vector* pVecWorldMaxs)const = 0; 20 | /*6*/ virtual bool TestCollision(Ray_t const&, unsigned int mask, CGameTrace&) = 0; 21 | /*7*/ virtual bool TestHitboxes(Ray_t const&, unsigned int mask, CGameTrace&) = 0; 22 | /*8*/ virtual int GetCollisionModelIndex(void) = 0; 23 | /*9*/ virtual void* GetCollisionModel(void) = 0; 24 | /*10*/ virtual void* GetCollisionOrigin(void)const = 0; 25 | /*11*/ virtual void* GetCollisionAngles(void)const = 0; 26 | /*12*/ virtual void* CollisionToWorldTransform(void)const = 0; 27 | /*13*/ virtual void* GetSolid(void)const = 0; 28 | /*14*/ virtual void* GetSolidFlags(void)const = 0; 29 | /*15*/ virtual void* GetIClientUnknown(void) = 0; 30 | /*16*/ virtual void* GetCollisionGroup(void)const = 0; 31 | /*17*/ virtual void* WorldSpaceSurroundingBounds(Vector*, Vector*) = 0; 32 | /*18*/ virtual void* ShouldTouchTrigger(int)const = 0; 33 | /*19*/ virtual void* GetRootParentToWorldTransform(void)const = 0; 34 | }; -------------------------------------------------------------------------------- /GMod-SDK/client/CHLClient.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../tier0/shareddefs.h" 4 | #include "../tier0/Vector.h" 5 | class CViewSetup; 6 | enum class 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 | class CGlobalVarsBase 18 | { 19 | public: 20 | float realtime; 21 | int framecount; 22 | float absoluteframetime; 23 | float curtime; 24 | float frametime; 25 | int maxClients; 26 | int tickcount; 27 | float interval_per_tick; 28 | float interpolation_amount; 29 | int simTicksThisFrame; 30 | int network_protocol; 31 | void* pSaveData; 32 | private: 33 | bool m_bClient; 34 | int nTimestampNetworkingBase; 35 | int nTimestampRandomizeWindow; 36 | 37 | }; 38 | // Auto reconstructed from vtable block @ 0x0087DA90 39 | // from "client.dylib", by ida_vtables.idc 40 | // Modified VTable dumper script obviously by t.me/Gaztoof. 41 | class CHLClient 42 | { 43 | public: 44 | // https://github.com/NicknineTheEagle/TF2-Base/blob/master/src/public/cdll_int.h 45 | /*0*/ virtual void* Init(void* (*)(char const*, int*), void* (*)(char const*, int*), CGlobalVarsBase*, void*) = 0; 46 | /*1*/ virtual void* PostInit(void) = 0; 47 | /*2*/ virtual void* Shutdown(void) = 0; 48 | /*3*/ virtual void* ReplayInit(void* (*)(char const*, int*)) = 0; 49 | /*4*/ virtual void* ReplayPostInit(void) = 0; 50 | /*5*/ virtual void* LevelInitPreEntity(char const*) = 0; 51 | /*6*/ virtual void* LevelInitPostEntity(void) = 0; 52 | /*7*/ virtual void* LevelShutdown(void) = 0; 53 | /*8*/ virtual void* GetAllClasses(void) = 0; 54 | /*9*/ virtual void* HudVidInit(void) = 0; 55 | /*10*/ virtual void* HudProcessInput(bool) = 0; 56 | /*11*/ virtual void* HudUpdate(bool) = 0; 57 | /*12*/ virtual void* HudReset(void) = 0; 58 | /*13*/ virtual void* HudText(char const*) = 0; 59 | /*14*/ virtual void IN_ActivateMouse(void) = 0; 60 | /*15*/ virtual void IN_DeactivateMouse(void) = 0; 61 | /*16*/ virtual void IN_Accumulate(void) = 0; 62 | /*17*/ virtual void IN_ClearStates(void) = 0; 63 | /*18*/ virtual bool IN_IsKeyDown(char const* keyName, bool& isdown) = 0; 64 | 65 | /*19*/ virtual void* IN_OnMouseWheeled(int) = 0; 66 | /*20*/ virtual void CreateMove(int sequence_number, float input_sample_frametime, bool active) = 0; 67 | /*21*/ virtual void* ExtraMouseSample(float, bool) = 0; 68 | /*22*/ virtual void* IN_KeyEvent(int, ButtonCode_t, char const*) = 0; 69 | 70 | /*23*/ virtual void* WriteUsercmdDeltaToBuffer(void*, int, int, bool) = 0; 71 | /*24*/ virtual void* EncodeUserCmdToBuffer(void*, int) = 0; 72 | /*25*/ virtual void* DecodeUserCmdFromBuffer(void*, int) = 0; 73 | /*26*/ virtual void* View_Render(void*) = 0; 74 | /*27*/ virtual void RenderView(const CViewSetup& view, int nClearFlags, int whatToDraw) = 0; 75 | /*28*/ virtual void View_Fade(void*) = 0; 76 | /*29*/ virtual void SetCrosshairAngle(QAngle const&) = 0; 77 | /*30*/ virtual void InitSprite(void*, char const*) = 0; 78 | /*31*/ virtual void ShutdownSprite(void*) = 0; 79 | /*32*/ virtual int GetSpriteSize(void)const = 0; 80 | /*33*/ virtual void VoiceStatus(int entindex, int bTalking) = 0; 81 | /*34*/ virtual void* InstallStringTableCallback(char const*) = 0; 82 | /*35*/ virtual void FrameStageNotify(ClientFrameStage_t curStage) = 0; 83 | /*36*/ virtual bool DispatchUserMessage(int, void*) = 0; 84 | /*37*/ virtual void* SaveInit(int) = 0; 85 | /*38*/ virtual void* SaveWriteFields(void*, char const*, void*, void*, void*, int) = 0; 86 | /*39*/ virtual void* SaveReadFields(void*, char const*, void*, void*, void*, int) = 0; 87 | /*40*/ virtual void* PreSave(void*) = 0; 88 | /*41*/ virtual void* Save(void*) = 0; 89 | /*42*/ virtual void* WriteSaveHeaders(void*) = 0; 90 | /*43*/ virtual void* ReadRestoreHeaders(void*) = 0; 91 | /*44*/ virtual void* Restore(void*, bool) = 0; 92 | /*45*/ virtual void* DispatchOnRestore(void) = 0; 93 | /*46*/ virtual void* GetStandardRecvProxies(void) = 0; 94 | /*47*/ virtual void* WriteSaveGameScreenshot(char const*) = 0; 95 | /*48*/ virtual void* EmitSentenceCloseCaption(char const*) = 0; 96 | /*49*/ virtual void* EmitCloseCaption(char const*, float) = 0; 97 | /*50*/ virtual void* CanRecordDemo(char*, int)const = 0; 98 | /*51*/ virtual void* OnDemoRecordStart(char const*) = 0; 99 | /*52*/ virtual void* OnDemoRecordStop(void) = 0; 100 | /*53*/ virtual void* OnDemoPlaybackStart(char const*) = 0; 101 | /*54*/ virtual void* OnDemoPlaybackStop(void) = 0; 102 | /*55*/ virtual bool ShouldDrawDropdownConsole(void) = 0; 103 | /*56*/ virtual int GetScreenWidth(void) = 0; 104 | /*57*/ virtual int GetScreenHeight(void) = 0; 105 | /*58*/ virtual void* WriteSaveGameScreenshotOfSize(char const*, int, int, bool, bool) = 0; 106 | /*59*/ virtual void* GetPlayerView(void*) = 0; 107 | /*60*/ virtual void* SetupGameProperties(void*) = 0; 108 | /*61*/ virtual void* GetPresenceID(char const*) = 0; 109 | /*62*/ virtual void* GetPropertyIdString(unsigned int) = 0; 110 | /*63*/ virtual void* GetPropertyDisplayString(unsigned int, unsigned int, char*, int) = 0; 111 | /*64*/ virtual void* InvalidateMdlCache(void) = 0; 112 | /*65*/ virtual void* IN_SetSampleTime(float) = 0; 113 | /*66*/ virtual void* ReloadFilesInList(void*) = 0; 114 | /*67*/ virtual void* StartStatsReporting(void*, bool) = 0; 115 | /*68*/ virtual void* HandleUiToggle(void) = 0; 116 | /*69*/ virtual bool ShouldAllowConsole(void) = 0; 117 | /*70*/ virtual void* GetRenamedRecvTableInfos(void) = 0; 118 | /*71*/ virtual void* GetClientUIMouthInfo(void) = 0; 119 | /*72*/ virtual void* FileReceived(char const*, unsigned int) = 0; 120 | /*73*/ virtual void* TranslateEffectForVisionFilter(char const*, char const*) = 0; 121 | /*74*/ virtual void* ClientAdjustStartSoundParams(void*) = 0; 122 | /*75*/ virtual void* DisconnectAttempt(void) = 0; 123 | /*76*/ virtual void* GMOD_ReceiveServerMessage(void*, int) = 0; 124 | /*77*/ virtual void* GMOD_DoSnapshots(void) = 0; 125 | /*78*/ virtual void* GMOD_VoiceVolume(unsigned int, float) = 0; 126 | /*79*/ virtual void* GMOD_OnDrawSkybox(void) = 0; 127 | /*80*/ virtual void* IN_MouseWheelAnalog(int) = 0; 128 | /*81*/ virtual void* GMOD_RequestLuaFiles(void) = 0; 129 | /*82*/ virtual void* GMOD_SignOnStateChanged(int, int, int) = 0; 130 | 131 | bool IsKeyDown(const char* name){ // this doesn't works i think 132 | bool b = false; 133 | IN_IsKeyDown(name, b); 134 | return b; 135 | } 136 | }; -------------------------------------------------------------------------------- /GMod-SDK/client/CInput.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../tier0/Vector.h" 3 | #include "../tier1/checksum_crc.h" 4 | 5 | struct CameraThirdData_t 6 | { 7 | float m_flPitch; 8 | float m_flYaw; 9 | float m_flDist; 10 | float m_flLag; 11 | Vector m_vecHullMin; 12 | Vector m_vecHullMax; 13 | }; 14 | 15 | // Created with ReClass.NET 1.2 by KN4CK3R 16 | class CInput 17 | { 18 | public: 19 | typedef struct 20 | { 21 | unsigned int AxisFlags; 22 | unsigned int AxisMap; 23 | unsigned int ControlMap; 24 | } joy_axis_t; 25 | enum 26 | { 27 | GAME_AXIS_NONE = 0, 28 | GAME_AXIS_FORWARD, 29 | GAME_AXIS_PITCH, 30 | GAME_AXIS_SIDE, 31 | GAME_AXIS_YAW, 32 | MAX_GAME_AXES 33 | }; 34 | enum 35 | { 36 | MOUSE_ACCEL_THRESHHOLD1 = 0, // if mouse moves > this many mickey's double it 37 | MOUSE_ACCEL_THRESHHOLD2, // if mouse moves > this many mickey's double it a second time 38 | MOUSE_SPEED_FACTOR, // 0 = disabled, 1 = threshold 1 enabled, 2 = threshold 2 enabled 39 | 40 | NUM_MOUSE_PARAMS, 41 | }; 42 | // Has the mouse been initialized? 43 | bool m_fMouseInitialized; 44 | // Is the mosue active? 45 | bool m_fMouseActive; 46 | // Has the joystick advanced initialization been run? 47 | bool m_fJoystickAdvancedInit; 48 | // Used to support hotplugging by reinitializing the advanced joystick system when we toggle between some/none joysticks. 49 | bool m_fHadJoysticks; 50 | 51 | // Accumulated mouse deltas 52 | float m_flAccumulatedMouseXMovement; 53 | float m_flAccumulatedMouseYMovement; 54 | float m_flPreviousMouseXPosition; 55 | float m_flPreviousMouseYPosition; 56 | float m_flRemainingJoystickSampleTime; 57 | float m_flKeyboardSampleTime; 58 | 59 | // Flag to restore systemparameters when exiting 60 | bool m_fRestoreSPI; 61 | // Original mouse parameters 62 | int m_rgOrigMouseParms[NUM_MOUSE_PARAMS]; 63 | // Current mouse parameters. 64 | int m_rgNewMouseParms[NUM_MOUSE_PARAMS]; 65 | bool m_rgCheckMouseParam[NUM_MOUSE_PARAMS]; 66 | // Are the parameters valid 67 | bool m_fMouseParmsValid; 68 | // Joystick Axis data 69 | joy_axis_t m_rgAxes[6]; 70 | // List of queryable keys 71 | void* m_pKeys; 72 | 73 | // Is the 3rd person camera using the mouse? 74 | bool m_fCameraInterceptingMouse; 75 | // Are we in 3rd person view? 76 | bool m_fCameraInThirdPerson; 77 | // Should we move view along with mouse? 78 | bool m_fCameraMovingWithMouse; 79 | 80 | 81 | // Is the camera in distance moving mode? 82 | bool m_fCameraDistanceMove; 83 | // Old and current mouse position readings. 84 | int m_nCameraOldX; 85 | int m_nCameraOldY; 86 | int m_nCameraX; 87 | int m_nCameraY; 88 | 89 | // orthographic camera settings 90 | bool m_CameraIsOrthographic; 91 | 92 | QAngle m_angPreviousViewAngles; 93 | 94 | float m_flLastForwardMove; 95 | 96 | float m_flPreviousJoystickForward; 97 | float m_flPreviousJoystickSide; 98 | float m_flPreviousJoystickPitch; 99 | float m_flPreviousJoystickYaw; 100 | 101 | class CVerifiedUserCmd 102 | { 103 | public: 104 | CUserCmd m_cmd; 105 | CRC32_t m_crc; 106 | }; 107 | 108 | CUserCmd* m_pCommands; 109 | CVerifiedUserCmd* m_pVerifiedCommands; 110 | 111 | CameraThirdData_t* m_pCameraThirdData; 112 | 113 | /*void* N0000004F; //0x0000 114 | char pad_0008[136]; //0x0008 115 | void* m_pKeys; //0x0090 116 | bool m_fCameraInterceptingMouse; //0x0098 117 | bool m_fCameraInThirdPerson; //0x0099 118 | bool m_fCameraMovingWithMouse; //0x009A 119 | char pad_009B[21]; //0x009B 120 | QAngle m_angPreviousViewAngles; //0x00B0 121 | float m_flLastForwardMove; //0x00BC 122 | uint32_t m_nClearInputState; //0x00C0 123 | char pad_00C4[892]; //0x00C4*/ 124 | 125 | virtual void Init_All(void); 126 | virtual void Shutdown_All(void); 127 | virtual int GetButtonBits(int); 128 | virtual void CreateMove(int sequence_number, float input_sample_frametime, bool active); 129 | virtual void ExtraMouseSample(float frametime, bool active); 130 | virtual bool WriteUsercmdDeltaToBuffer(bf_write* buf, int from, int to, bool isnewcommand); 131 | virtual void EncodeUserCmdToBuffer(bf_write& buf, int slot); 132 | virtual void DecodeUserCmdFromBuffer(bf_read& buf, int slot); 133 | 134 | virtual CUserCmd* GetUserCmd(int sequence_number); 135 | 136 | virtual void MakeWeaponSelection(C_BaseCombatWeapon* weapon); 137 | 138 | virtual float KeyState(ButtonCode_t* key); 139 | virtual int KeyEvent(int down, ButtonCode_t keynum, const char* pszCurrentBinding); 140 | virtual ButtonCode_t* FindKey(const char* name); 141 | 142 | virtual void ControllerCommands(void); 143 | virtual void Joystick_Advanced(void); 144 | virtual void Joystick_SetSampleTime(float frametime); 145 | virtual void IN_SetSampleTime(float frametime); 146 | 147 | virtual void AccumulateMouse(void); 148 | virtual void ActivateMouse(void); 149 | virtual void DeactivateMouse(void); 150 | 151 | virtual void ClearStates(void); 152 | virtual float GetLookSpring(void); 153 | 154 | virtual void GetFullscreenMousePos(int* mx, int* my, int* unclampedx = NULL, int* unclampedy = NULL); 155 | virtual void SetFullscreenMousePos(int mx, int my); 156 | virtual void ResetMouse(void); 157 | 158 | // virtual bool IsNoClipping( void ); 159 | virtual float GetLastForwardMove(void); 160 | virtual float Joystick_GetForward(void); 161 | virtual float Joystick_GetSide(void); 162 | virtual float Joystick_GetPitch(void); 163 | virtual float Joystick_GetYaw(void); 164 | virtual void ClearInputButton(int bits); 165 | 166 | virtual void CAM_Think(void); 167 | virtual int CAM_IsThirdPerson(void); 168 | virtual void CAM_ToThirdPerson(void); 169 | virtual void CAM_ToFirstPerson(void); 170 | virtual void CAM_StartMouseMove(void); 171 | virtual void CAM_EndMouseMove(void); 172 | virtual void CAM_StartDistance(void); 173 | virtual void CAM_EndDistance(void); 174 | virtual int CAM_InterceptingMouse(void); 175 | 176 | // orthographic camera info 177 | virtual void CAM_ToOrthographic(); 178 | virtual bool CAM_IsOrthographic() const; 179 | virtual void CAM_OrthographicSize(float& w, float& h) const; 180 | 181 | virtual float CAM_CapYaw(float fVal) { return fVal; } 182 | 183 | }; //Size: 0x0448 -------------------------------------------------------------------------------- /GMod-SDK/client/CInputSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../tier0/shareddefs.h" 3 | 4 | // Auto reconstructed from vtable block @ 0x0000A118 5 | // from "inputsystem.dylib", by ida_vtables.idc 6 | // Modified VTable dumper script obviously by t.me/Gaztoof. 7 | class CInputSystem 8 | { 9 | public: 10 | /*0*/ virtual void Connect(void* (*)(char const*, int*)) = 0; 11 | /*1*/ virtual void Disconnect(void) = 0; 12 | /*2*/ virtual void QueryInterface(char const*) = 0; 13 | /*3*/ virtual void Init(void) = 0; 14 | /*4*/ virtual void Shutdown(void) = 0; 15 | 16 | /*5*/ virtual void Undocumented1(void) = 0; // All of those 4 functions are unimplemented. Probably disabled by the devs or the compiler. 17 | /*5*/ virtual void Undocumented2(void) = 0; 18 | /*5*/ virtual void Undocumented3(void) = 0; 19 | /*5*/ virtual void Undocumented4(void) = 0; 20 | 21 | /*5*/ virtual void AttachToWindow(void*) = 0; 22 | /*6*/ virtual void DetachFromWindow(void) = 0; 23 | /*7*/ virtual void EnableInput(bool) = 0; 24 | /*8*/ virtual void EnableMessagePump(bool) = 0; 25 | /*9*/ virtual void PollInputState(void) = 0; 26 | /*10*/ virtual int GetPollTick(void)const = 0; 27 | /*11*/ virtual bool IsButtonDown(ButtonCode_t)const = 0; 28 | /*12*/ virtual int GetButtonPressedTick(ButtonCode_t)const = 0; 29 | /*13*/ virtual int GetButtonReleasedTick(ButtonCode_t)const = 0; 30 | /*14*/ virtual int GetAnalogValue(void*)const = 0; 31 | /*15*/ virtual int GetAnalogDelta(void*)const = 0; 32 | /*16*/ virtual int GetEventCount(void)const = 0; 33 | /*17*/ virtual int GetEventData(void)const = 0; 34 | /*18*/ virtual void PostUserEvent(void const*) = 0; 35 | /*19*/ virtual int GetJoystickCount(void)const = 0; 36 | /*20*/ virtual void EnableJoystickInput(int, bool) = 0; 37 | /*21*/ virtual void EnableJoystickDiagonalPOV(int, bool) = 0; 38 | /*22*/ virtual void SampleDevices(void) = 0; 39 | /*23*/ virtual void SetRumble(float, float, int) = 0; 40 | /*24*/ virtual void StopRumble(void) = 0; 41 | 42 | /*25*/ virtual void Undocumented5(void) = 0; 43 | /*26*/ virtual void Undocumented6(void) = 0; 44 | /*27*/ virtual void Undocumented7(void) = 0; 45 | /*28*/ virtual void Undocumented8(void) = 0; 46 | /*29*/ virtual void Undocumented9(void) = 0; 47 | /*30*/ virtual void Undocumented10(void) = 0; 48 | /*31*/ virtual void Undocumented11(void) = 0; 49 | /*32*/ virtual void Undocumented12(void) = 0; 50 | /*33*/ virtual void Undocumented13(void) = 0; 51 | /*34*/ virtual void Undocumented14(void) = 0; 52 | /*35*/ virtual void Undocumented15(void) = 0; 53 | 54 | /*36*/ virtual const char* ButtonCodeToString(ButtonCode_t code) const = 0; 55 | /*37*/ virtual const char* AnalogCodeToString(void* code) const = 0; // AnalogCode_t 56 | /*38*/ virtual ButtonCode_t StringToButtonCode(const char* pString) const = 0; 57 | /*39*/ virtual void* StringToAnalogCode(const char* pString) const = 0; 58 | 59 | /*40*/ virtual void SleepUntilInput(int nMaxSleepTimeMS = -1) = 0; 60 | 61 | /*41*/ virtual ButtonCode_t VirtualKeyToButtonCode(int nVirtualKey) const = 0; 62 | /*42*/ virtual int ButtonCodeToVirtualKey(ButtonCode_t code) const = 0; 63 | 64 | /* 65 | * Every following function was a real pain to reverse. For some reasons, the MacOS inputsystem is totally different from the Windows one. 66 | * There's a lot of functions I named "undocumented" as I was lazy to find out what they were doing. 67 | */ 68 | 69 | }; -------------------------------------------------------------------------------- /GMod-SDK/client/CUniformRandomStream.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Auto reconstructed from vtable block @ 0x00019438 4 | // from "libvstdlib.dylib", by ida_vtables.idc 5 | // Modified VTable dumper script obviously by t.me/Gaztoof. 6 | class CUniformRandomStream 7 | { 8 | public: 9 | //Don't forget the constructor. 10 | /*0*/ virtual void SetSeed(int) = 0; 11 | /*1*/ virtual float RandomFloat(float, float) = 0; 12 | /*2*/ virtual int RandomInt(int, int) = 0; 13 | /*3*/ virtual float RandomFloatExp(float, float, float) = 0; 14 | }; -------------------------------------------------------------------------------- /GMod-SDK/client/CViewRender.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "CViewSetup.h" 3 | #include "../engine/imaterial.h" 4 | // Auto reconstructed from vtable block @ 0x008EEC18 5 | // from "client.dylib", by ida_vtables.idc 6 | // Modified VTable dumper script obviously by t.me/Gaztoof. 7 | class CViewRender 8 | { 9 | public: 10 | /*0*/ virtual void* Init(void) = 0; 11 | /*1*/ virtual void* LevelInit(void) = 0; 12 | /*2*/ virtual void* LevelShutdown(void) = 0; 13 | /*3*/ virtual void* Shutdown(void) = 0; 14 | /*4*/ virtual void* OnRenderStart(void) = 0; 15 | /*5*/ virtual void* Render(vrect_t*) = 0; 16 | /*6*/ virtual void* RenderView(CViewSetup const&, int, int) = 0; 17 | /*7*/ virtual void* GetDrawFlags(void) = 0; 18 | /*8*/ virtual void* StartPitchDrift(void) = 0; 19 | /*9*/ virtual void* StopPitchDrift(void) = 0; 20 | /*10*/ virtual void* GetFrustum(void) = 0; 21 | /*11*/ virtual void* ShouldDrawBrushModels(void) = 0; 22 | /*12*/ virtual void* GetPlayerViewSetup(void)const = 0; 23 | /*13*/ virtual void* GetViewSetup(void)const = 0; 24 | /*14*/ virtual void* DisableVis(void) = 0; 25 | /*15*/ virtual void* BuildWorldListsNumber(void)const = 0; 26 | /*16*/ virtual void* SetCheapWaterStartDistance(float) = 0; 27 | /*17*/ virtual void* SetCheapWaterEndDistance(float) = 0; 28 | /*18*/ virtual void* GetWaterLODParams(float&, float&) = 0; 29 | /*19*/ virtual void* DriftPitch(void) = 0; 30 | /*20*/ virtual void* SetScreenOverlayMaterial(IMaterial*) = 0; 31 | /*21*/ virtual void* GetScreenOverlayMaterial(void) = 0; 32 | /*22*/ virtual void* WriteSaveGameScreenshot(char const*) = 0; 33 | /*23*/ virtual void* WriteSaveGameScreenshotOfSize(char const*, int, int, bool, bool) = 0; 34 | /*24*/ virtual void* WriteReplayScreenshot(void*) = 0; 35 | /*25*/ virtual void* UpdateReplayScreenshotCache(void) = 0; 36 | /*26*/ virtual void* QueueOverlayRenderView(CViewSetup const&, int, int) = 0; 37 | /*27*/ virtual void* GetZNear(void) = 0; 38 | /*28*/ virtual void* GetZFar(void) = 0; 39 | /*29*/ virtual void* GetScreenFadeDistances(float*, float*) = 0; 40 | /*30*/ virtual void* GetCurrentlyDrawingEntity(void) = 0; 41 | /*31*/ virtual void* SetCurrentlyDrawingEntity(void*) = 0; 42 | /*32*/ virtual void* UpdateShadowDepthTexture(ITexture*, ITexture*, CViewSetup const&) = 0; 43 | /*33*/ virtual void* FreezeFrame(float) = 0; 44 | /*34*/ virtual void* GetReplayScreenshotSystem(void) = 0; 45 | }; -------------------------------------------------------------------------------- /GMod-SDK/client/CViewSetup.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../tier0/Vector.h" 3 | #include "../engine/vmatrix.h" 4 | enum ClearFlags_t 5 | { 6 | VIEW_CLEAR_COLOR = 0x1, 7 | VIEW_CLEAR_DEPTH = 0x2, 8 | VIEW_CLEAR_FULL_TARGET = 0x4, 9 | VIEW_NO_DRAW = 0x8, 10 | VIEW_CLEAR_OBEY_STENCIL = 0x10, // Draws a quad allowing stencil test to clear through portals 11 | VIEW_CLEAR_STENCIL = 0x20, 12 | }; 13 | 14 | enum StereoEye_t 15 | { 16 | STEREO_EYE_MONO = 0, 17 | STEREO_EYE_LEFT = 1, 18 | STEREO_EYE_RIGHT = 2, 19 | STEREO_EYE_MAX = 3, 20 | }; 21 | 22 | 23 | //----------------------------------------------------------------------------- 24 | // Purpose: Renderer setup data. 25 | //----------------------------------------------------------------------------- 26 | class CViewSetup 27 | { 28 | public: 29 | 30 | int x; 31 | int m_nUnscaledX; 32 | int y; 33 | int m_nUnscaledY; 34 | int width; 35 | int m_nUnscaledWidth; 36 | int height; 37 | StereoEye_t m_eStereoEye; 38 | int m_nUnscaledHeight; 39 | bool m_bOrtho; 40 | float m_OrthoLeft; 41 | float m_OrthoTop; 42 | float m_OrthoRight; 43 | float m_OrthoBottom; 44 | float fov; 45 | float fovViewmodel; 46 | Vector origin; 47 | QAngle angles; 48 | float zNear; 49 | float zFar; 50 | float zNearViewmodel; 51 | float zFarViewmodel; 52 | float m_flAspectRatio; 53 | bool m_bOffCenter; 54 | float m_flOffCenterTop; 55 | float m_flOffCenterBottom; 56 | float m_flOffCenterLeft; 57 | float m_flOffCenterRight; 58 | bool m_bDoBloomAndToneMapping; 59 | 60 | bool m_bCacheFullSceneState; 61 | bool m_bViewToProjectionOverride; 62 | VMatrix m_ViewToProjection; 63 | }; -------------------------------------------------------------------------------- /GMod-SDK/client/C_BaseCombatCharacter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "c_basecombatweapon.h" 4 | #include "IClientNetworkable.h" 5 | #include "C_BaseFlex.h" 6 | 7 | class C_BaseCombatCharacter : public C_BaseFlex 8 | { 9 | public: 10 | virtual void OnPreDataChanged(DataUpdateType_t updateType); 11 | virtual void OnDataChanged(DataUpdateType_t updateType); 12 | 13 | virtual bool IsBaseCombatCharacter(void) { return true; }; 14 | virtual C_BaseCombatCharacter* MyCombatCharacterPointer(void) { return this; } 15 | 16 | // ----------------------- 17 | // Vision 18 | // ----------------------- 19 | enum FieldOfViewCheckType { USE_FOV, DISREGARD_FOV }; 20 | bool IsAbleToSee(const CBaseEntity* entity, FieldOfViewCheckType checkFOV); // Visible starts with line of sight, and adds all the extra game checks like fog, smoke, camo... 21 | bool IsAbleToSee(C_BaseCombatCharacter* pBCC, FieldOfViewCheckType checkFOV); // Visible starts with line of sight, and adds all the extra game checks like fog, smoke, camo... 22 | 23 | virtual bool IsLookingTowards(const CBaseEntity* target, float cosTolerance ) const; // return true if our view direction is pointing at the given target, within the cosine of the angular tolerance. LINE OF SIGHT IS NOT CHECKED. 24 | virtual bool IsLookingTowards(const Vector& target, float cosTolerance) const; // return true if our view direction is pointing at the given target, within the cosine of the angular tolerance. LINE OF SIGHT IS NOT CHECKED. 25 | 26 | virtual bool IsInFieldOfView(CBaseEntity* entity) const; // Calls IsLookingAt with the current field of view. 27 | virtual bool IsInFieldOfView(const Vector& pos) const; 28 | 29 | enum LineOfSightCheckType 30 | { 31 | IGNORE_NOTHING, 32 | IGNORE_ACTORS 33 | }; 34 | virtual bool IsLineOfSightClear(CBaseEntity* entity, LineOfSightCheckType checkType = IGNORE_NOTHING) const;// strictly LOS check with no other considerations 35 | virtual bool IsLineOfSightClear(const Vector& pos, LineOfSightCheckType checkType = IGNORE_NOTHING, CBaseEntity* entityToIgnore = NULL) const; 36 | 37 | 38 | // ----------------------- 39 | // Ammo 40 | // ----------------------- 41 | void RemoveAmmo(int iCount, int iAmmoIndex); 42 | void RemoveAmmo(int iCount, const char* szName); 43 | void RemoveAllAmmo(); 44 | int GetAmmoCount(int iAmmoIndex) const; 45 | int GetAmmoCount(char* szName) const; 46 | 47 | C_BaseCombatWeapon* Weapon_OwnsThisType(const char* pszWeapon, int iSubType = 0) const; // True if already owns a weapon of this class 48 | virtual bool Weapon_Switch(C_BaseCombatWeapon* pWeapon, int viewmodelindex = 0); 49 | virtual bool Weapon_CanSwitchTo(C_BaseCombatWeapon* pWeapon); 50 | 51 | virtual C_BaseCombatWeapon* GetActiveWeapon(void) const; 52 | 53 | virtual int BloodColor(); 54 | virtual void DoMuzzleFlash(); 55 | 56 | 57 | }; 58 | -------------------------------------------------------------------------------- /GMod-SDK/client/ClientClass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef void* (*CreateClientClassFn)(int entnum, int serialNum); 4 | typedef void* (*CreateEventFn)(); 5 | 6 | class RecvProp 7 | { 8 | // This info comes from the receive data table. 9 | public: 10 | RecvProp(); 11 | 12 | void InitArray(int nElements, int elementStride); 13 | 14 | int GetNumElements() const; 15 | void SetNumElements(int nElements); 16 | 17 | int GetElementStride() const; 18 | void SetElementStride(int stride); 19 | 20 | int GetFlags() const; 21 | 22 | const char* GetName() const; 23 | void* GetType() const; 24 | 25 | void** GetDataTable() const; 26 | void SetDataTable(RecvTable* pTable); 27 | 28 | void* GetProxyFn() const; 29 | void SetProxyFn(void* fn); 30 | 31 | void* GetDataTableProxyFn() const; 32 | void SetDataTableProxyFn(void* fn); 33 | 34 | int GetOffset() const; 35 | void SetOffset(int o); 36 | 37 | // Arrays only. 38 | RecvProp* GetArrayProp() const; 39 | void SetArrayProp(RecvProp* pProp); 40 | 41 | // Arrays only. 42 | void SetArrayLengthProxy(void* proxy); 43 | void* GetArrayLengthProxy() const; 44 | 45 | bool IsInsideArray() const; 46 | void SetInsideArray(); 47 | 48 | // Some property types bind more data to the prop in here. 49 | const void* GetExtraData() const; 50 | void SetExtraData(const void* pData); 51 | 52 | // If it's one of the numbered "000", "001", etc properties in an array, then 53 | // these can be used to get its array property name for debugging. 54 | const char* GetParentArrayPropName(); 55 | void SetParentArrayPropName(const char* pArrayPropName); 56 | 57 | public: 58 | 59 | const char* m_pVarName; 60 | void* m_RecvType; 61 | int m_Flags; 62 | int m_StringBufferSize; 63 | 64 | 65 | private: 66 | 67 | bool m_bInsideArray; // Set to true by the engine if this property sits inside an array. 68 | 69 | // Extra data that certain special property types bind to the property here. 70 | const void* m_pExtraData; 71 | 72 | // If this is an array (DPT_Array). 73 | RecvProp* m_pArrayProp; 74 | void* m_ArrayLengthProxy; 75 | 76 | void* m_ProxyFn; 77 | void* m_DataTableProxyFn; // For RDT_DataTable. 78 | 79 | RecvTable* m_pDataTable; // For RDT_DataTable. 80 | int m_Offset; 81 | 82 | int m_ElementStride; 83 | int m_nElements; 84 | 85 | // If it's one of the numbered "000", "001", etc properties in an array, then 86 | // these can be used to get its array property name for debugging. 87 | const char* m_pParentArrayPropName; 88 | }; 89 | class RecvTable 90 | { 91 | public: 92 | 93 | typedef RecvProp PropType; 94 | 95 | RecvTable(); 96 | RecvTable(RecvProp* pProps, int nProps, const char* pNetTableName); 97 | ~RecvTable(); 98 | 99 | void Construct(RecvProp* pProps, int nProps, const char* pNetTableName); 100 | 101 | int GetNumProps(); 102 | RecvProp* GetProp(int i); 103 | 104 | const char* GetName(); 105 | 106 | // Used by the engine while initializing array props. 107 | void SetInitialized(bool bInitialized); 108 | bool IsInitialized() const; 109 | 110 | // Used by the engine. 111 | void SetInMainList(bool bInList); 112 | bool IsInMainList() const; 113 | 114 | 115 | public: 116 | 117 | // Properties described in a table. 118 | RecvProp* m_pProps; 119 | int m_nProps; 120 | 121 | // The decoder. NOTE: this covers each RecvTable AND all its children (ie: its children 122 | // will have their own decoders that include props for all their children). 123 | void* m_pDecoder; 124 | 125 | const char* m_pNetTableName; // The name matched between client and server. 126 | 127 | 128 | private: 129 | 130 | bool m_bInitialized; 131 | bool m_bInMainList; 132 | }; 133 | 134 | class ClientClass 135 | { 136 | public: 137 | ClientClass(const char* pNetworkName, CreateClientClassFn createFn, CreateEventFn createEventFn, RecvTable* pRecvTable) 138 | { 139 | m_pNetworkName = pNetworkName; 140 | m_pCreateFn = createFn; 141 | m_pCreateEventFn = createEventFn; 142 | m_pRecvTable = pRecvTable; 143 | 144 | // Link it in 145 | //m_pNext = g_pClientClassHead; 146 | //g_pClientClassHead = this; 147 | } 148 | 149 | const char* GetName() 150 | { 151 | return m_pNetworkName; 152 | } 153 | 154 | public: 155 | CreateClientClassFn m_pCreateFn; 156 | CreateEventFn m_pCreateEventFn; // Only called for event objects. 157 | const char* m_pNetworkName; 158 | RecvTable* m_pRecvTable; 159 | ClientClass* m_pNext; 160 | int m_ClassID; // Managed by the engine. 161 | }; 162 | -------------------------------------------------------------------------------- /GMod-SDK/client/ClientModeShared.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "C_BasePlayer.h" 3 | #include "usercmd.h" 4 | 5 | // Auto reconstructed from vtable block @ 0x0087DE78 6 | // from "client.dylib", by ida_vtables.idc 7 | // Modified VTable dumper script obviously by t.me/Gaztoof. 8 | class ClientModeShared 9 | { 10 | public: 11 | /*0*/ virtual void* destr() = 0; 12 | /*1/ virtual void* InitViewport(void) = 0; 13 | /*2*/ virtual void* Init(void) = 0; 14 | /*3*/ virtual void* VGui_Shutdown(void) = 0; 15 | /*4*/ virtual void* Shutdown(void) = 0; 16 | /*5*/ virtual void* Enable(void) = 0; 17 | /*6*/ virtual void* Disable(void) = 0; 18 | /*7*/ virtual void* Layout(void) = 0; 19 | /*8*/ virtual void* GetViewport(void) = 0; 20 | /*9*/ virtual void* GetViewportAnimationController(void) = 0; 21 | /*10*/ virtual void* ProcessInput(bool) = 0; 22 | /*11*/ virtual bool ShouldDrawDetailObjects(void) = 0; 23 | /*12*/ virtual bool ShouldDrawEntity(C_BaseEntity*) = 0; 24 | /*13*/ virtual bool ShouldDrawLocalPlayer(C_BasePlayer*) = 0; 25 | /*14*/ virtual bool ShouldDrawParticles(void) = 0; 26 | /*15*/ virtual bool ShouldDrawFog(void) = 0; 27 | /*16*/ virtual void* OverrideView(void*) = 0; 28 | /*17*/ virtual void* KeyInput(int,ButtonCode_t,char const*) = 0; 29 | /*18*/ virtual void* StartMessageMode(int) = 0; 30 | /*19*/ virtual void* GetMessagePanel(void) = 0; 31 | /*20*/ virtual void* OverrideMouseInput(float*,float*) = 0; 32 | /*21*/ virtual void* CreateMove(float,CUserCmd*) = 0; 33 | /*22*/ virtual void* LevelInit(char const*) = 0; 34 | /*23*/ virtual void* LevelShutdown(void) = 0; 35 | /*24*/ virtual bool ShouldDrawViewModel(void) = 0; 36 | /*25*/ virtual bool ShouldDrawCrosshair(void) = 0; 37 | /*26*/ virtual void* AdjustEngineViewport(int&,int&,int&,int&) = 0; 38 | /*27*/ virtual void* PreRender(void*) = 0; 39 | /*28*/ virtual void* PostRender(void) = 0; 40 | /*29*/ virtual void* PostRenderVGui(void) = 0; 41 | /*30*/ virtual void* ActivateInGameVGuiContext(void*) = 0; 42 | /*31*/ virtual void* DeactivateInGameVGuiContext(void) = 0; 43 | /*32*/ virtual void* GetViewModelFOV(void) = 0; 44 | /*33*/ virtual void* CanRecordDemo(char*,int)const = 0; 45 | /*34*/ virtual void* ComputeVguiResConditions(void*) = 0; 46 | /*35*/ virtual const char* GetServerName(void) = 0; 47 | /*36*/ virtual const char* SetServerName(wchar_t*) = 0; 48 | /*37*/ virtual void* GetMapName(void) = 0; 49 | /*38*/ virtual void* SetMapName(wchar_t*) = 0; 50 | /*39*/ virtual void* DoPostScreenSpaceEffects(void const*) = 0; 51 | /*40*/ virtual void* DisplayReplayMessage(char const*,float,bool,char const*,bool) = 0; 52 | /*41*/ virtual void* Update(void) = 0; 53 | /*42*/ virtual bool ShouldBlackoutAroundHUD(void) = 0; 54 | /*43*/ virtual bool ShouldOverrideHeadtrackControl(void) = 0; 55 | /*44*/ virtual bool IsInfoPanelAllowed(void) = 0; 56 | /*45*/ virtual void* InfoPanelDisplayed(void) = 0; 57 | /*46*/ virtual void* ReloadScheme(void) = 0; 58 | /*47*/ virtual void* HudElementKeyInput(int,ButtonCode_t,char const*) = 0; 59 | /*48*/ virtual void* HandleSpectatorKeyInput(int,ButtonCode_t,char const*) = 0; 60 | /*49*/ virtual void* GetHUDChatPanel(void) = 0; 61 | /*50*/ virtual void* UpdateReplayMessages(void) = 0; 62 | }; -------------------------------------------------------------------------------- /GMod-SDK/client/ConCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Auto reconstructed from vtable block @ 0x00082BCC 4 | // from "lua_shared.dylib", by ida_vtables.idc 5 | // Modified VTable dumper script obviously by t.me/Gaztoof. 6 | class ConCommand 7 | { 8 | public: 9 | 10 | /*1*/ virtual void* destr() = 0; 11 | /*2*/ virtual bool IsCommand(void)const = 0; 12 | /*3*/ virtual bool IsFlagSet(int)const = 0; 13 | /*4*/ virtual void* AddFlags(int) = 0; 14 | /*5*/ virtual void* GetName(void)const = 0; 15 | /*6*/ virtual void* GetHelpText(void)const = 0; 16 | /*7*/ virtual bool IsRegistered(void)const = 0; 17 | /*8*/ virtual void* GetDLLIdentifier(void)const = 0; 18 | /*9*/ virtual void* CreateBase(char const*, char const*, int) = 0; 19 | /*10*/ virtual void* Init(void) = 0; 20 | /*11*/ virtual void* AutoCompleteSuggest(char const*, void *) = 0; 21 | /*12*/ virtual void* CanAutoComplete(void) = 0; 22 | /*13*/ virtual void* Dispatch(void const*) = 0; 23 | }; -------------------------------------------------------------------------------- /GMod-SDK/client/ConVar.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../tier0/Color.h" 3 | 4 | #define FCVAR_ARCHIVE 128 5 | #define FCVAR_ARCHIVE_XBOX 16777216 6 | #define FCVAR_CHEAT 16384 7 | #define FCVAR_CLIENTCMD_CAN_EXECUTE 1073741824 8 | #define FCVAR_CLIENTDLL 8 9 | #define FCVAR_DEMO 65536 10 | #define FCVAR_DONTRECORD 131072 11 | #define FCVAR_GAMEDLL 4 12 | #define FCVAR_LUA_CLIENT 262144 13 | #define FCVAR_LUA_SERVER 524288 14 | #define FCVAR_NEVER_AS_STRING 4096 15 | #define FCVAR_NONE 0 16 | #define FCVAR_NOTIFY 256 17 | #define FCVAR_NOT_CONNECTED 4194304 18 | #define FCVAR_PRINTABLEONLY 1024 19 | #define FCVAR_PROTECTED 32 20 | #define FCVAR_REPLICATED 8192 21 | #define FCVAR_SERVER_CANNOT_QUERY 536870912 22 | #define FCVAR_SERVER_CAN_EXECUTE 268435456 23 | #define FCVAR_SPONLY 64 24 | #define FCVAR_UNLOGGED 2048 25 | #define FCVAR_UNREGISTERED 1 26 | #define FCVAR_USERINFO 512 27 | 28 | void dummyCallback(void* convar, const char* pOldValString) { return; } 29 | 30 | 31 | // Auto reconstructed from vtable block @ 0x00082C0C 32 | // from "lua_shared.dylib", by ida_vtables.idc 33 | // Modified VTable dumper script obviously by t.me/Gaztoof. 34 | class ConVar 35 | { 36 | // https://i.imgur.com/uisym0i.png 37 | // https://i.imgur.com/f2HoNEu.png 38 | public: 39 | ConVar* pNextConvar; //0x0008 40 | uint32_t bRegistered; //0x0010 41 | char pad_0014[4]; //0x0014 42 | char *pszName; //0x0018 43 | char *pszHelpString; //0x0020 44 | uint32_t nflags; //0x0028 45 | char pad_002C[4]; //0x002C 46 | void *s_pConCommandBases; //0x0030 47 | ConVar *pParent; //0x0038 48 | char *pszDefaultValue; //0x0040 49 | char *pszValueStr; //0x0048 50 | uint32_t strLength; //0x0050 51 | float fVal; //0x0054 52 | int32_t intValue; //0x0058 53 | uint32_t bHasMin; //0x005C 54 | float fMinVal; //0x0060 55 | uint32_t bHasMax; //0x0064 56 | float fMaxVal; //0x0068 57 | char pad_006C[4]; //0x006C 58 | PVOID CALLBACKPTR; //0x0070 59 | 60 | 61 | /*0*/ virtual void* Destr() = 0; 62 | /*2*/ virtual bool IsCommand(void)const = 0; 63 | /*3*/ virtual bool IsFlagSet(int)const = 0; 64 | /*4*/ virtual void AddFlags(int) = 0; 65 | /*4*/ virtual void RemoveFlagsDoNotUse(int) = 0; 66 | 67 | /*4*/ virtual uint64_t GetFlagsDoNotUse() = 0; 68 | 69 | /*7*/ virtual const char* GetName(void)const = 0; 70 | /*8*/ virtual const char* GetHelpText(void)const = 0; 71 | /*9*/ virtual bool IsRegistered(void)const = 0; 72 | /*10*/ virtual void* GetDLLIdentifier(void)const = 0; 73 | /*11*/ virtual void CreateBase(char const*, char const*, int) = 0; 74 | /*11*/ virtual void Init(void) = 0; 75 | 76 | /*11*/ virtual void Unk1(void) = 0; 77 | /*11*/ virtual void Unk2(void) = 0; 78 | ///*12*/ virtual void SetValue(char const*) = 0; 79 | ///*13*/ virtual void SetValue(float) = 0; 80 | ///*14*/ virtual void SetValue(int) = 0; 81 | /*15*/ virtual void InternalSetValue(char const*) = 0; // This doesn't works for me, for some reasons 82 | /*16*/ virtual void InternalSetValue(float) = 0; 83 | /*17*/ virtual void InternalSetValue(int) = 0; 84 | /*18*/ virtual void SetValue(int) = 0; 85 | /*19*/ virtual void* ClampValue(float&) = 0; 86 | /*20*/ virtual void* ChangeStringValue(char const*, float) = 0; 87 | /*21*/ virtual void* Create(char const* name, char const*defaultValue, int flags, char const*helperString, bool hasMin, float fMin, bool hasMax, float fMax, void *fnCallback) = 0; 88 | 89 | public: 90 | void SetFlags(int flag) { 91 | nflags = flag; 92 | } 93 | void RemoveFlags(int flag) { 94 | nflags &= ~flag; 95 | } 96 | void DisableCallback() { 97 | if(this->CALLBACKPTR) 98 | *(PVOID*)(this->CALLBACKPTR) = dummyCallback; 99 | } 100 | }; 101 | 102 | class CCvar 103 | { 104 | public: 105 | /*0*/ virtual void Connect(void* (*)(char const*, int*)) = 0; 106 | /*1*/ virtual void Disconnect(void) = 0; 107 | /*2*/ virtual void* QueryInterface(char const*) = 0; 108 | /*3*/ virtual void* Init(void) = 0; 109 | /*4*/ virtual void Shutdown(void) = 0; 110 | 111 | /*5*/ virtual void* Nothing1(void) = 0; 112 | /*6*/ virtual void* Nothing2(void) = 0; 113 | /*7*/ virtual void* Nothing3(void) = 0; 114 | /*8*/ virtual void* Nothing4(void) = 0; 115 | 116 | /*10*/ virtual void* AllocateDLLIdentifier(void) = 0; 117 | /*11*/ virtual void RegisterConCommand(void*) = 0; 118 | /*12*/ virtual void UnregisterConCommand(void*) = 0; 119 | /*13*/ virtual void UnregisterConCommands(int) = 0; 120 | /*14*/ virtual const char* GetCommandLineValue(char const*) = 0; 121 | /*15*/ virtual void* FindCommandBase(char const*) = 0; 122 | /*16*/ virtual const void* FindCommandBase(char const*)const = 0; 123 | /*17*/ virtual ConVar* FindVar(char const * var_name) = 0; 124 | /*18*/ virtual ConVar* FindVar(char const* var_name)const = 0; 125 | /*19*/ virtual void* FindCommand(char const*) = 0; 126 | /*20*/ virtual void* FindCommand(char const*)const = 0; 127 | 128 | /*21*/ virtual void InstallGlobalChangeCallback(void (*)(ConVar*, char const*, float)) = 0; 129 | /*22*/ virtual void RemoveGlobalChangeCallback(void (*)(ConVar*, char const*, float)) = 0; 130 | /*23*/ virtual void CallGlobalChangeCallbacks(ConVar*, char const*, float) = 0; 131 | /*24*/ virtual void InstallConsoleDisplayFunc(void*) = 0; 132 | /*25*/ virtual void RemoveConsoleDisplayFunc(void*) = 0; 133 | /*26*/ virtual void ConsoleColorPrintf(Color const&, char const*, ...)const = 0; 134 | /*27*/ virtual void ConsolePrintf(char const*, ...)const = 0; 135 | /*28*/ virtual void ConsoleDPrintf(char const*, ...)const = 0; 136 | /*29*/ virtual void RevertFlaggedConVars(int) = 0; 137 | /*30*/ virtual void InstallCVarQuery(void*) = 0; 138 | /*31*/ virtual bool IsMaterialThreadSetAllowed(void)const = 0; 139 | /*32*/ virtual void QueueMaterialThreadSetValue(ConVar*, char const*) = 0; 140 | /*33*/ virtual void QueueMaterialThreadSetValue(ConVar*, int) = 0; 141 | /*34*/ virtual void QueueMaterialThreadSetValue(ConVar*, float) = 0; 142 | /*35*/ virtual bool HasQueuedMaterialThreadConVarSets(void)const = 0; 143 | /*36*/ virtual void ProcessQueuedMaterialThreadConVarSets(void) = 0; 144 | /*37*/ virtual void FactoryInternalIterator(void) = 0; 145 | }; -------------------------------------------------------------------------------- /GMod-SDK/client/IGameMovement.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../tier0/Vector.h" 3 | 4 | class CBasePlayer; 5 | 6 | class CMoveData { 7 | public: 8 | int padd; //0x0000 9 | uintptr_t m_nPlayerHandle; //0x0004 10 | int m_nImpulseCommand; //0x0008 11 | QAngle m_vecViewAngles; //0x000C 12 | QAngle m_vecAbsViewAngles; //0x0018 13 | int m_nButtons; //0x0024 14 | int m_nOldButtons; //0x0028 15 | float m_flForwardMove; //0x002C 16 | float m_flSideMove; //0x0030 17 | float m_flUpMove; //0x0034 18 | float m_flMaxSpeed; //0x0038 19 | float m_flClientMaxSpeed; //0x003C 20 | Vector m_vecVelocity; //0x0040 21 | QAngle m_vecAngles; //0x004C 22 | QAngle m_vecOldAngles; //0x0058 23 | float m_outStepHeight; //0x0064 24 | Vector m_outWishVel; //0x0068 25 | Vector m_outJumpVel; //0x0074 26 | Vector m_vecConstraintCenter; //0x0080 27 | float m_flConstraintRadius; //0x008C 28 | float m_flConstraintWidth; //0x0090 29 | float m_flConstraintSpeedFactor; //0x0094 30 | Vector m_vecAbsOrigin; //0x0098 31 | //char pad_0001[8]; //0x00A0 32 | }; 33 | 34 | class CGameMovement 35 | { 36 | public: 37 | virtual ~CGameMovement(void) {} 38 | 39 | // Process the current movement command 40 | virtual void ProcessMovement(C_BasePlayer* pPlayer, CMoveData * pMove) = 0; 41 | virtual void StartTrackPredictionErrors(C_BasePlayer* pPlayer) = 0; 42 | virtual void FinishTrackPredictionErrors(C_BasePlayer* pPlayer) = 0; 43 | virtual void DiffPrint(char const* fmt, ...) = 0; 44 | 45 | // Allows other parts of the engine to find out the normal and ducked player bbox sizes 46 | virtual Vector GetPlayerMins(bool ducked) const = 0; 47 | virtual Vector GetPlayerMaxs(bool ducked) const = 0; 48 | virtual Vector GetPlayerViewOffset(bool ducked) const = 0; 49 | virtual void TracePlayerBBox(const Vector& start, const Vector& end, unsigned int fMask, int collisionGroup, trace_t& pm); 50 | virtual void TryTouchGround(const Vector& start, const Vector& end, const Vector& mins, const Vector& maxs, unsigned int fMask, int collisionGroup, trace_t& pm); 51 | 52 | 53 | CMoveData* mv; 54 | int m_nOldWaterLevel; 55 | float m_flWaterEntryTime; 56 | int m_nOnLadder; 57 | Vector m_vecForward; 58 | Vector m_vecRight; 59 | Vector m_vecUp; 60 | 61 | // Does most of the player movement logic. 62 | // Returns with origin, angles, and velocity modified in place. 63 | // were contacted during the move. 64 | virtual void UNK0(void); 65 | virtual void UNK1(void); 66 | virtual void UNK2(void); 67 | virtual void PlayerMove(void); 68 | virtual float CalcRoll(const QAngle& angles, const Vector& velocity, float rollangle, float rollspeed); 69 | 70 | virtual void DecayPunchAngle(void); 71 | 72 | virtual void CheckWaterJump(void); 73 | 74 | virtual void WaterMove(void); 75 | 76 | virtual void AirAccelerate(Vector& wishdir, float wishspeed, float accel); 77 | 78 | virtual void AirMove(void); 79 | virtual float GetAirSpeedCap(void) { return 30.f; } 80 | 81 | virtual bool CanAccelerate(); 82 | virtual void Accelerate(Vector& wishdir, float wishspeed, float accel); 83 | 84 | // Only used by players. Moves along the ground when player is a MOVETYPE_WALK. 85 | virtual void WalkMove(void); 86 | 87 | // Handle MOVETYPE_WALK. 88 | virtual void FullWalkMove(); 89 | 90 | 91 | }; 92 | -------------------------------------------------------------------------------- /GMod-SDK/client/IPrediction.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CPrediction 4 | { 5 | virtual ~CPrediction(void) = 0;// 6 | 7 | virtual void Init(void) = 0;// 8 | virtual void Shutdown(void) = 0;// 9 | 10 | // Implement IPrediction 11 | public: 12 | 13 | virtual void Update 14 | ( 15 | int startframe, // World update ( un-modded ) most recently received 16 | bool validframe, // Is frame data valid 17 | int incoming_acknowledged, // Last command acknowledged to have been run by server (un-modded) 18 | int outgoing_command // Last command (most recent) sent to server (un-modded) 19 | );// 20 | 21 | virtual void PreEntityPacketReceived(int commands_acknowledged, int current_world_update_packet);// 22 | virtual void PostEntityPacketReceived(void);//5 23 | virtual void PostNetworkDataReceived(int commands_acknowledged);// 24 | 25 | virtual void OnReceivedUncompressedPacket(void);// 26 | 27 | // The engine needs to be able to access a few predicted values 28 | virtual void GetViewOrigin(Vector& org);// 29 | virtual void SetViewOrigin(Vector& org);// 9 30 | virtual void GetViewAngles(Vector& ang);//10 31 | virtual void SetViewAngles(Vector& ang);// 11 32 | 33 | virtual void GetLocalViewAngles(QAngle& ang);// 12 34 | virtual void SetLocalViewAngles(QAngle& ang);// 13 35 | 36 | virtual bool InPrediction(void) const;//14 37 | virtual bool IsFirstTimePredicted(void) const;// 15 38 | 39 | 40 | 41 | virtual int GetIncomingPacketNumber(void) const;// 42 | 43 | virtual void RunCommand(void* player, CUserCmd* cmd, void* moveHelper);//17 44 | 45 | virtual void SetupMove(C_BasePlayer* player, CUserCmd* cmd, void* pHelper, void* move);//18 46 | virtual void FinishMove(C_BasePlayer* player, CUserCmd* cmd, void* move);//19 47 | virtual void SetIdealPitch(int nSlot, void* player, const Vector& origin, const Vector& angles, const Vector& viewheight);//20 48 | 49 | virtual void CheckError(int nSlot, void* player, int commands_acknowledged);// 50 | }; -------------------------------------------------------------------------------- /GMod-SDK/client/usercmd.h: -------------------------------------------------------------------------------- 1 | // 2 | // Purpose: 3 | // 4 | // $NoKeywords: $ 5 | // 6 | //=============================================================================// 7 | #if !defined( USERCMD_H ) 8 | #define USERCMD_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | #include "../mathlib/math_pfns.h" 13 | #include "../tier0/Vector.h" 14 | #include "../tier1/checksum_crc.h" 15 | 16 | 17 | class bf_read; 18 | class bf_write; 19 | 20 | class CEntityGroundContact 21 | { 22 | public: 23 | int entindex; 24 | float minheight; 25 | float maxheight; 26 | }; 27 | 28 | #define IN_ATTACK (1 << 0) 29 | #define IN_JUMP (1 << 1) 30 | #define IN_DUCK (1 << 2) 31 | #define IN_FORWARD (1 << 3) 32 | #define IN_BACK (1 << 4) 33 | #define IN_USE (1 << 5) 34 | #define IN_CANCEL (1 << 6) 35 | #define IN_LEFT (1 << 7) 36 | #define IN_RIGHT (1 << 8) 37 | #define IN_MOVELEFT (1 << 9) 38 | #define IN_MOVERIGHT (1 << 10) 39 | #define IN_ATTACK2 (1 << 11) 40 | #define IN_RUN (1 << 12) 41 | #define IN_RELOAD (1 << 13) 42 | #define IN_ALT1 (1 << 14) 43 | #define IN_ALT2 (1 << 15) 44 | #define IN_SCORE (1 << 16) // Used by client.dll for when scoreboard is held down 45 | #define IN_SPEED (1 << 17) // Player is holding the speed key 46 | #define IN_WALK (1 << 18) // Player holding walk key 47 | #define IN_ZOOM (1 << 19) // Zoom key for HUD zoom 48 | #define IN_WEAPON1 (1 << 20) // weapon defines these bits 49 | #define IN_WEAPON2 (1 << 21) // weapon defines these bits 50 | #define IN_BULLRUSH (1 << 22) 51 | #define IN_GRENADE1 (1 << 23) // grenade 1 52 | #define IN_GRENADE2 (1 << 24) // grenade 2 53 | #define IN_LOOKSPIN (1 << 25) 54 | 55 | 56 | class CUserCmd 57 | { 58 | public: 59 | // For matching server and client commands for debugging 60 | int command_number; 61 | // the tick the client created this command 62 | int tick_count; 63 | 64 | // Player instantaneous view angles. 65 | QAngle viewangles; 66 | // Intended velocities 67 | // forward velocity. 68 | float forwardmove; 69 | // sideways velocity. 70 | float sidemove; 71 | // upward velocity. 72 | float upmove; 73 | // Attack button states 74 | int buttons; 75 | // Impulse command issued. 76 | BYTE impulse; 77 | // Current weapon id 78 | int weaponselect; 79 | int weaponsubtype; 80 | 81 | int random_seed; // For shared random functions 82 | 83 | short mousedx; // mouse accum in x from create move 84 | short mousedy; // mouse accum in y from create move 85 | 86 | // Client only, tracks whether we've predicted this command at least once 87 | bool hasbeenpredicted; 88 | 89 | // Back channel to communicate IK state 90 | CRC32_t GetChecksum(void) const 91 | { 92 | CRC32_t crc; 93 | 94 | CRC32_Init(&crc); 95 | CRC32_ProcessBuffer(&crc, &command_number, sizeof(command_number)); 96 | CRC32_ProcessBuffer(&crc, &tick_count, sizeof(tick_count)); 97 | CRC32_ProcessBuffer(&crc, &viewangles, sizeof(viewangles)); 98 | CRC32_ProcessBuffer(&crc, &forwardmove, sizeof(forwardmove)); 99 | CRC32_ProcessBuffer(&crc, &sidemove, sizeof(sidemove)); 100 | CRC32_ProcessBuffer(&crc, &upmove, sizeof(upmove)); 101 | CRC32_ProcessBuffer(&crc, &buttons, sizeof(buttons)); 102 | CRC32_ProcessBuffer(&crc, &impulse, sizeof(impulse)); 103 | CRC32_ProcessBuffer(&crc, &weaponselect, sizeof(weaponselect)); 104 | CRC32_ProcessBuffer(&crc, &weaponsubtype, sizeof(weaponsubtype)); 105 | CRC32_ProcessBuffer(&crc, &random_seed, sizeof(random_seed)); 106 | CRC32_ProcessBuffer(&crc, &mousedx, sizeof(mousedx)); 107 | CRC32_ProcessBuffer(&crc, &mousedy, sizeof(mousedy)); 108 | CRC32_Final(&crc); 109 | 110 | return crc; 111 | } 112 | 113 | // Thanks to copypaste from uc.me for the following: 114 | 115 | uint8_t buttons_pressed[5]; // holds current buttons pressed and sends to server used for PlayerButtonDown and other hooks on server 116 | int8_t scroll_wheel_speed; 117 | bool world_clicking; // used for context menu aiming 118 | Vector world_click_direction; // this too 119 | bool is_typing; // does hand to ear animation 120 | Vector motion_sensor_positions[20]; // kinect stuff 121 | bool forced; // CUserCmd_IsForced check gmod wiki 122 | 123 | }; 124 | 125 | #endif // USERCMD_H 126 | -------------------------------------------------------------------------------- /GMod-SDK/dllmain.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "Memory.h" 8 | 9 | #include "Interface.h" 10 | #include "globals.hpp" 11 | 12 | #include "hooks/DrawModelExecute.h" 13 | #include "hooks/CreateMove.h" 14 | #include "hooks/FrameStageNotify.h" 15 | #include "hooks/RenderView.h" 16 | #include "hooks/Present.h" 17 | #include "hooks/PaintTraverse.h" 18 | #include "hooks/RunStringEx.h" 19 | #include "hooks/ProcessGMODServerToClient.h" 20 | #include "hooks/RunCommand.h" 21 | #include "hooks/Paint.h" 22 | 23 | 24 | #include "hacks/ConVarSpoofing.h" 25 | #include "engine/inetmessage.h" 26 | 27 | void Main() 28 | { 29 | ZeroMemory(Settings::ScriptInput, sizeof(Settings::ScriptInput)); 30 | srand(time(nullptr)); 31 | #ifdef _DEBUG 32 | AllocConsole(); 33 | FILE* f; 34 | freopen_s(&f, "CONOUT$", "w", stdout); 35 | freopen_s(&f, "CONIN$", "r", stdin); 36 | SetConsoleTitle(L"GMod SDK - WIP - Coded by t.me/Gaztoof"); 37 | #endif 38 | ConColorMsg = (MsgFn)GetProcAddress(GetModuleHandleW(L"tier0.dll"), ConColorMsgDec); 39 | 40 | ConPrint("Successfully injected!", Color(0, 255, 0)); 41 | ConfigSystem::HandleConfig("Default", ConfigSystem::configHandle::Load); 42 | Globals::bSendpacket = (bool*)(GetRealFromRelative((char*)findPattern("engine", CL_MovePattern, "CL_MOVE"), 0x1, 5) + BSendPacketOffset); 43 | Globals::predictionRandomSeed = (unsigned int*)(GetRealFromRelative((char*)findPattern("client", PredictionSeedPattern, "predictionRandomSeed") + 0x3, 0x2, 6)); 44 | Globals::hostName = (char*)(GetRealFromRelative((char*)findPattern("client", HostNamePattern, "HostName"), 0x3, 7)); 45 | MoveHelper = (GetRealFromRelative((char*)findPattern("client", MoveHelperPattern, "MoveHelper"), 0x3, 7)); // https://i.imgur.com/p3C93PT.png 46 | DWORD originalProtection; 47 | VirtualProtect(Globals::bSendpacket, sizeof(bool), PAGE_EXECUTE_READWRITE, &originalProtection); 48 | 49 | EngineClient = (CEngineClient*)GetInterface("engine.dll", "VEngineClient015"); 50 | LuaShared = (CLuaShared*)GetInterface("lua_shared.dll", "LUASHARED003"); 51 | ClientEntityList = (CClientEntityList*)GetInterface("client.dll", "VClientEntityList003"); 52 | CHLclient = (CHLClient*)GetInterface("client.dll", "VClient017"); 53 | MaterialSystem = (CMaterialSystem*)GetInterface("materialsystem.dll", "VMaterialSystem080"); 54 | InputSystem = (CInputSystem*)GetInterface("inputsystem.dll", "InputSystemVersion001"); 55 | CVar = (CCvar*)GetInterface("vstdlib.dll", "VEngineCvar007"); 56 | ModelRender = (CModelRender*)GetInterface("engine.dll", "VEngineModel016"); 57 | RenderView = (CVRenderView*)GetInterface("engine.dll", "VEngineRenderView014"); 58 | EngineTrace = (IEngineTrace*)GetInterface("engine.dll", "EngineTraceClient003"); 59 | IVDebugOverlay = (CIVDebugOverlay*)GetInterface("engine.dll", "VDebugOverlay003"); 60 | GameEventManager = (CGameEventManager*)GetInterface("engine.dll", "GAMEEVENTSMANAGER002"); 61 | MatSystemSurface = (CMatSystemSurface*)GetInterface("vguimatsurface.dll", "VGUI_Surface030"); 62 | PanelWrapper = (VPanelWrapper*)GetInterface("vgui2.dll", "VGUI_Panel009"); 63 | PhysicsSurfaceProps = (CPhysicsSurfaceProps*)GetInterface("vphysics.dll", "VPhysicsSurfaceProps001"); 64 | Prediction = (CPrediction*)GetInterface("client.dll", "VClientPrediction001"); 65 | GameMovement = (CGameMovement*)GetInterface("client.dll", "GameMovement001"); 66 | EngineVGui = (void*)GetInterface("engine.dll", "VEngineVGui001"); // Eventually implement that? 67 | ModelInfo = (CModelInfo*)GetInterface("engine.dll", "VModelInfoClient006"); 68 | 69 | // x64: thats directly the vtable pointer // CEngineClient::IsPaused points to clientstate https://i.imgur.com/4aWvQbs.png 70 | ClientState = GetRealFromRelative((*(char***)(EngineClient))[84], CClientStateOffset, CClientStateSize, false); 71 | ViewRender = GetVMT((uintptr_t)CHLclient, 2, ViewRenderOffset); // CHLClient::Shutdown points to _view https://i.imgur.com/3Ad96gY.png 72 | ClientMode = GetVMT((uintptr_t)CHLclient, 10, ClientModeOffset); // HudProcessInput points to g_pClientMode, and we retrieve it. https://i.imgur.com/h0qYd5q.png I got the information from the .dylib -> https://i.imgur.com/kBaS7Vq.png 73 | GlobalVars = GetVMT((uintptr_t)CHLclient, 0, GlobalVarsOffset); // CHLClient::Init points to gpGlobals https://i.imgur.com/aIwpS45.png 74 | Input = GetVMT((uintptr_t)CHLclient, 20, InputOffset); // CHLClient::CreateMove points to input https://i.imgur.com/TnEcetn.png 75 | UniformRandomStream = GetVMT((uintptr_t)GetProcAddress(GetModuleHandleA("vstdlib.dll"), "RandomSeed"), RandomSeedOffset); // RandomSeed points to s_pUniformStream https://i.imgur.com/bddk0QK.png 76 | 77 | localPlayer = (C_BasePlayer*)ClientEntityList->GetClientEntity(EngineClient->GetLocalPlayer()); 78 | 79 | if(Lua = LuaShared->GetLuaInterface((unsigned char)LuaInterfaceType::LUA_CLIENT)) 80 | oRunStringEx = VMTHook< _RunStringEx>((PVOID**)Lua, (PVOID)hkRunStringEx, 111); 81 | oCreateLuaInterfaceFn = VMTHook<_CreateLuaInterfaceFn>((PVOID**)LuaShared, (PVOID)hkCreateLuaInterfaceFn, 4); 82 | oCloseLuaInterfaceFn = VMTHook<_CloseLuaInterfaceFn>((PVOID**)LuaShared, (PVOID)hkCloseInterfaceLuaFn, 5); 83 | 84 | oCreateMove = VMTHook<_CreateMove>((PVOID**)ClientMode, (PVOID)hkCreateMove, 21); 85 | oFrameStageNotify = VMTHook< _FrameStageNotify>((PVOID**)CHLclient, hkFrameStageNotify, 35); 86 | oRenderView = VMTHook<_RenderView>((PVOID**)ViewRender, (PVOID)hkRenderView, 6); 87 | oPaintTraverse = VMTHook< _PaintTraverse>((PVOID**)PanelWrapper, (PVOID)hkPaintTraverse, 41); 88 | oDrawModelExecute = VMTHook< _DrawModelExecute>((PVOID**)ModelRender, (PVOID)hkDrawModelExecute, 20); 89 | oProcessGMOD_ServerToClient = VMTHook< _ProcessGMOD_ServerToClient>((PVOID**)ClientState, (PVOID)hkProcessGMOD_ServerToClient, 64); 90 | oRunCommand = VMTHook< _RunCommand>((PVOID**)Prediction, (PVOID)hkRunCommand, 19); 91 | oPaint = VMTHook<_Paint>((PVOID**)EngineVGui, (PVOID)hkPaint, 13); 92 | 93 | present = GetRealFromRelative((char*)findPattern(PresentModule, PresentPattern, "Present"), 0x2, 6, false); 94 | 95 | Globals::damageEvent = new DamageEvent(); 96 | Globals::deathEvent = new DeathEvent(); 97 | GameEventManager->AddListener((IGameEventListener2*)Globals::damageEvent, "player_hurt", false); 98 | GameEventManager->AddListener((IGameEventListener2*)Globals::deathEvent, "entity_killed", false); 99 | 100 | // This can be easily detected(for instance, perphead will ban you for it), so disabled unless you need it and researched enough the server you're on. 101 | if (false) 102 | { 103 | ConVar* cvar = CVar->FindVar("mat_fullbright"); 104 | cvar->RemoveFlags(FCVAR_CHEAT); 105 | 106 | //This'll let you change your name ingame freely 107 | cvar = CVar->FindVar("name"); 108 | cvar->RemoveFlags(FCVAR_SERVER_CAN_EXECUTE); 109 | cvar->DisableCallback(); 110 | } 111 | 112 | 113 | //GlobalVars->maxClients 114 | //GlobalVars + 0x14 = 1 will let u do anything lua related 115 | oPresent = *(_Present*)(present); 116 | *(_Present**)(present) = (_Present*)hkPresent; 117 | 118 | //EngineClient->ClientCmd_Unrestricted("play \"items/suitchargeok1.wav\""); 119 | //Sleep(2200); 120 | Sleep(1000); 121 | MatSystemSurface->PlaySound("HL1/fvox/bell.wav"); 122 | Sleep(1100); 123 | MatSystemSurface->PlaySound("HL1/fvox/activated.wav"); 124 | Globals::openMenu = true; 125 | } 126 | 127 | BOOL APIENTRY DllMain(HMODULE hModule, uintptr_t ul_reason_for_call, LPVOID lpReserved) 128 | { 129 | if (ul_reason_for_call == DLL_PROCESS_ATTACH) 130 | std::thread(Main).detach(); 131 | return TRUE; 132 | } 133 | 134 | -------------------------------------------------------------------------------- /GMod-SDK/engine/CGameEventManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | class IGameEvent 7 | { 8 | public: 9 | virtual ~IGameEvent() {}; 10 | virtual const char* GetName() const = 0; 11 | 12 | virtual bool IsReliable() const = 0; 13 | virtual bool IsLocal() const = 0; 14 | virtual bool IsEmpty(const char* keyname = NULL) = 0; 15 | 16 | virtual bool GetBool(const char* keyname = NULL, bool default_value = false) = 0; 17 | virtual int GetInt(const char* keyname = NULL, int default_value = 0) = 0; 18 | virtual uint64_t GetUint64(const char* keyname = NULL, uint64_t default_value = 0) = 0; 19 | virtual float GetFloat(const char* keyname = NULL, float default_value = 0.0f) = 0; 20 | virtual const char* GetString(const char* keyname = NULL, const char* default_value = "") = 0; 21 | virtual const wchar_t* GetWString(const char* keyname = NULL, const wchar_t* default_value = L"") = 0; 22 | virtual const void* GetPtr(const char* keyname = NULL, const void* default_values = NULL) = 0; 23 | 24 | virtual void SetBool(const char* keyname, bool value) = 0; 25 | virtual void SetInt(const char* keyname, int value) = 0; 26 | virtual void SetUint64(const char* keyname, uint64_t value) = 0; 27 | virtual void SetFloat(const char* keyname, float value) = 0; 28 | virtual void SetString(const char* keyname, const char* value) = 0; 29 | virtual void SetWString(const char* keyname, const wchar_t* value) = 0; 30 | virtual void SetPtr(const char* keyname, const void* value) = 0; 31 | }; 32 | class IGameEventListener2 33 | { 34 | public: 35 | virtual ~IGameEventListener2(void) {}; 36 | 37 | // FireEvent is called by EventManager if event just occured 38 | // KeyValue memory will be freed by manager if not needed anymore 39 | virtual void FireGameEvent(IGameEvent* event) = 0; 40 | }; 41 | 42 | // Auto reconstructed from vtable block @ 0x004F3AD8 43 | // from "engine.dylib", by ida_vtables.idc 44 | // Modified VTable dumper script obviously by t.me/Gaztoof. 45 | class CGameEventManager 46 | { 47 | public: 48 | /*0*/ virtual void* Destr1() = 0; 49 | /*1*/ virtual void* LoadEventsFromFile(char const*) = 0; 50 | /*2*/ virtual void* Reset(void) = 0; 51 | /*3*/ virtual void* AddListener(IGameEventListener2*, char const*, bool) = 0; 52 | /*4*/ virtual void* FindListener(IGameEventListener2*, char const*) = 0; 53 | /*5*/ virtual void* RemoveListener(IGameEventListener2*) = 0; 54 | /*6*/ virtual void* CreateEventt(char const*, bool) = 0; 55 | /*7*/ virtual void* FireEvent(IGameEvent*, bool) = 0; 56 | /*8*/ virtual void* FireEventClientSide(IGameEvent*) = 0; 57 | /*9*/ virtual void* DuplicateEvent(IGameEvent*) = 0; 58 | /*10*/ virtual void* FreeEvent(IGameEvent*) = 0; 59 | /*11*/ virtual void* SerializeEvent(IGameEvent*, void*) = 0; 60 | /*12*/ virtual void* UnserializeEvent(void*) = 0; 61 | }; -------------------------------------------------------------------------------- /GMod-SDK/engine/CIVDebugOverlay.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../tier0/Vector.h" 4 | 5 | // Auto reconstructed from vtable block @ 0x00531358 6 | // from "engine.dylib", by ida_vtables.idc 7 | // Modified VTable dumper script obviously by t.me/Gaztoof. 8 | class CIVDebugOverlay 9 | { 10 | public: 11 | /*0*/ virtual void* AddEntityTextOverlay(int, int, float, int, int, int, int, char const*, ...) = 0; 12 | /*1*/ virtual void* AddBoxOverlay(Vector const&, Vector const&, Vector const&, QAngle const&, int, int, int, int, float) = 0; 13 | /*2*/ virtual void* AddTriangleOverlay(Vector const&, Vector const&, Vector const&, int, int, int, int, bool, float) = 0; 14 | /*3*/ virtual void* AddLineOverlay(Vector const&, Vector const&, int, int, int, bool, float) = 0; 15 | /*4*/ virtual void* AddTextOverlay(Vector const&, float, char const*, ...) = 0; 16 | /*5*/ virtual void* AddTextOverlay(Vector const&, int, float, char const*, ...) = 0; 17 | /*6*/ virtual void* AddScreenTextOverlay(float, float, float, int, int, int, int, char const*) = 0; 18 | /*7*/ virtual void* AddSweptBoxOverlay(Vector const&, Vector const&, Vector const&, Vector const&, QAngle const&, int, int, int, int, float) = 0; 19 | /*8*/ virtual void* AddGridOverlay(Vector const&) = 0; 20 | /*9*/ virtual bool ScreenPosition(Vector const& in, Vector& out) = 0; 21 | /*10*/ virtual bool ScreenPosition(float, float, Vector&) = 0; 22 | /*11*/ virtual void* GetFirst(void) = 0; 23 | /*12*/ virtual void* GetNext(void*) = 0; 24 | /*13*/ virtual void* ClearDeadOverlays(void) = 0; 25 | /*14*/ virtual void* ClearAllOverlays(void) = 0; 26 | /*15*/ virtual void* AddTextOverlayRGB(Vector const&, int, float, float, float, float, float, char const*, ...) = 0; 27 | /*16*/ virtual void* AddTextOverlayRGB(Vector const&, int, float, int, int, int, int, char const*, ...) = 0; 28 | /*17*/ virtual void* AddLineOverlayAlpha(Vector const&, Vector const&, int, int, int, int, bool, float) = 0; 29 | /*18*/ virtual void* AddBoxOverlay2(Vector const&, Vector const&, Vector const&, QAngle const&, Color const&, Color const&, float) = 0; 30 | }; -------------------------------------------------------------------------------- /GMod-SDK/engine/CModelRender.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../tier0/Vector.h" 4 | #include "vmatrix.h" 5 | #include "../tier0/Color.h" 6 | #include "trace.h" 7 | #include "IEngineTrace.h" 8 | #include "imaterial.h" 9 | #include "IStudioRender.h" 10 | 11 | struct model_t 12 | { 13 | int pad; 14 | char *name; 15 | }; 16 | 17 | struct ModelRenderInfo_t 18 | { 19 | Vector origin; 20 | QAngle angles; 21 | void* pRenderable; 22 | const model_t* pModel; 23 | const matrix3x4_t* pModelToWorld; 24 | const matrix3x4_t* pLightingOffset; 25 | const Vector* pLightingOrigin; 26 | int flags; 27 | int entity_index; 28 | int skin; 29 | int body; 30 | int hitboxset; 31 | void* instance; 32 | 33 | ModelRenderInfo_t() 34 | { 35 | pModelToWorld = NULL; 36 | pLightingOffset = NULL; 37 | pLightingOrigin = NULL; 38 | } 39 | }; 40 | typedef unsigned short ModelInstanceHandle_t; 41 | 42 | struct DrawModelState_t 43 | { 44 | void* m_pStudioHdr; 45 | void* m_pStudioHWData; 46 | void* m_pRenderable; 47 | const matrix3x4_t* m_pModelToWorld; 48 | void* m_decals; 49 | int m_drawFlags; 50 | int m_lod; 51 | }; 52 | 53 | class CModelRender 54 | { 55 | public: 56 | /*0*/ virtual int DrawModel(int flags, void* pRenderable, ModelInstanceHandle_t instance, int entity_index, const void* model, Vector const& origin, QAngle const& angles, int skin, int body, int hitboxset, const matrix3x4_t* modelToWorld = NULL, const matrix3x4_t* pLightingOffset = NULL) = 0; 57 | /*1*/ virtual void ForcedMaterialOverride(IMaterial* newMaterial, OverrideType_t nOverrideType = OVERRIDE_NORMAL) = 0; 58 | /*2*/ virtual void SetViewTarget(const void* pStudioHdr, int nBodyIndex, const Vector& target) = 0; 59 | /*3*/ virtual ModelInstanceHandle_t CreateInstance(void* pRenderable, void* pCache = NULL) = 0; 60 | /*4*/ virtual void DestroyInstance(ModelInstanceHandle_t handle) = 0; 61 | /*5*/ virtual void SetStaticLighting(ModelInstanceHandle_t handle, void* pHandle) = 0; 62 | /*6*/ virtual void* GetStaticLighting(ModelInstanceHandle_t handle) = 0; 63 | /*7*/ virtual bool ChangeInstance(ModelInstanceHandle_t handle, void* pRenderable) = 0; 64 | /*8*/ virtual void AddDecal(ModelInstanceHandle_t handle, Ray_t const& ray, Vector const& decalUp, int decalIndex, int body, bool noPokeThru = false, int maxLODToDecal = ADDDECAL_TO_ALL_LODS) = 0; 65 | /*9*/ virtual void GMODAddDecal(ModelInstanceHandle_t handle, Ray_t const& ray, Vector const& decalUp, int decalIndex, int body, bool noPokeThru = false, int maxLODToDecal = ADDDECAL_TO_ALL_LODS) = 0; 66 | /*1*/ virtual void RemoveAllDecals(ModelInstanceHandle_t handle) = 0; 67 | /*11*/ virtual void RemoveAllDecalsFromAllModels() = 0; 68 | /*12*/ virtual matrix3x4_t* DrawModelShadowSetup(void* pRenderable, int body, int skin, DrawModelInfo_t* pInfo, matrix3x4_t* pCustomBoneToWorld = NULL) = 0; 69 | /*13*/ virtual void DrawModelShadow(void* pRenderable, const DrawModelInfo_t& info, matrix3x4_t* pCustomBoneToWorld = NULL) = 0; 70 | /*14*/ virtual bool RecomputeStaticLighting(ModelInstanceHandle_t handle) = 0; 71 | /*15*/ virtual void ReleaseAllStaticPropColorData(void) = 0; 72 | /*16*/ virtual void RestoreAllStaticPropColorData(void) = 0; 73 | /*17*/ virtual int DrawModelEx(ModelRenderInfo_t& pInfo) = 0; 74 | /*18*/ virtual int DrawModelExStaticProp(ModelRenderInfo_t& pInfo) = 0; 75 | /*19*/ virtual bool DrawModelSetup(ModelRenderInfo_t& pInfo, DrawModelState_t* pState, matrix3x4_t* pCustomBoneToWorld, matrix3x4_t** ppBoneToWorldOut) = 0; 76 | /*20*/ virtual void DrawModelExecute(const DrawModelState_t& state, const ModelRenderInfo_t& pInfo, matrix3x4_t* pCustomBoneToWorld = NULL) = 0; 77 | /*21*/ virtual void SetupLighting(const Vector& vecCenter) = 0; 78 | /*22*/ virtual int DrawStaticPropArrayFast(void* pProps, int count, bool bShadowDepth) = 0; 79 | /*23*/ virtual void SuppressEngineLighting(bool bSuppress) = 0; 80 | /*24*/ virtual void SetupColorMeshes(int nTotalVerts) = 0; 81 | /*25*/ virtual void AddColoredDecal(ModelInstanceHandle_t handle, Ray_t const& ray, Vector const& decalUp, int decalIndex, int body, Color cColor, bool noPokeThru = false, int maxLODToDecal = ADDDECAL_TO_ALL_LODS) = 0; 82 | }; 83 | -------------------------------------------------------------------------------- /GMod-SDK/engine/CNetChan.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../client/CViewSetup.h" 3 | 4 | // Auto reconstructed from vtable block @ 0x004F4CE0 5 | // from "engine.dylib", by ida_vtables.idc 6 | // Modified VTable dumper script obviously by t.me/Gaztoof. 7 | class CNetChan 8 | { 9 | public: 10 | /*0*/ virtual const char* GetName(void)const = 0; 11 | /*1*/ virtual const char* GetAddress(void)const = 0; 12 | /*2*/ virtual float GetTime(void)const = 0; 13 | /*3*/ virtual float GetTimeConnected(void)const = 0; 14 | /*4*/ virtual int GetBufferSize(void)const = 0; 15 | /*5*/ virtual int GetDataRate(void)const = 0; 16 | /*6*/ virtual bool IsLoopback(void)const = 0; 17 | /*7*/ virtual bool IsTimingOut(void)const = 0; 18 | /*8*/ virtual bool IsPlayback(void)const = 0; 19 | /*9*/ virtual float GetLatency(int)const = 0; 20 | /*10*/ virtual float GetAvgLatency(int)const = 0; 21 | /*11*/ virtual float GetAvgLoss(int)const = 0; 22 | /*12*/ virtual float GetAvgChoke(int)const = 0; 23 | /*13*/ virtual float GetAvgData(int)const = 0; 24 | /*14*/ virtual float GetAvgPackets(int)const = 0; 25 | /*15*/ virtual int GetTotalData(int)const = 0; 26 | /*16*/ virtual int GetSequenceNr(int)const = 0; 27 | /*17*/ virtual bool IsValidPacket(int, int)const = 0; 28 | /*18*/ virtual float GetPacketTime(int, int)const = 0; 29 | /*19*/ virtual int GetPacketBytes(int, int, int)const = 0; 30 | /*20*/ virtual bool GetStreamProgress(int, int*, int*)const = 0; 31 | /*21*/ virtual float GetTimeSinceLastReceived(void)const = 0; 32 | /*22*/ virtual float GetCommandInterpolationAmount(int, int)const = 0; 33 | /*23*/ virtual float GetPacketResponseLatency(int, int, int*, int*)const = 0; 34 | /*24*/ virtual void GetRemoteFramerate(float*, float*)const = 0; 35 | /*25*/ virtual float GetTimeoutSeconds(void)const = 0; 36 | // every following index = index+1, i'm lazy to update them. 37 | /*27*/ virtual void* destr1() = 0; 38 | /*28*/ virtual void* SetDataRate(float) = 0; 39 | /*29*/ virtual void* RegisterMessage(void*) = 0; 40 | /*30*/ virtual void* StartStreaming(unsigned int) = 0; 41 | /*31*/ virtual void* ResetStreaming(void) = 0; 42 | /*32*/ virtual void* SetTimeout(float) = 0; 43 | /*33*/ virtual void* SetDemoRecorder(void*) = 0; 44 | /*34*/ virtual void* SetChallengeNr(unsigned int) = 0; 45 | /*35*/ virtual void* Reset(void) = 0; 46 | /*36*/ virtual void* Clear(void) = 0; 47 | /*37*/ virtual void* Shutdown(char const*) = 0; 48 | /*38*/ virtual void* ProcessPlayback(void) = 0; 49 | /*39*/ virtual void* ProcessStream(void) = 0; 50 | /*40*/ virtual void* ProcessPacket(void*, bool) = 0; 51 | /*41*/ virtual void* SendNetMsg(void*, bool, bool) = 0; 52 | /*42*/ virtual void* SendData(void*, bool) = 0; 53 | /*43*/ virtual void* SendFile(char const*, unsigned int) = 0; 54 | /*44*/ virtual void* DenyFile(unsigned int) = 0; 55 | /*45*/ virtual void* RequestFile_OLD(char const*, unsigned int) = 0; 56 | /*46*/ virtual void SetChoked(void) = 0; // m_outSequenceNr++; m_nChokedPackets; 57 | /*47*/ virtual void* SendDatagram(void*) = 0; 58 | /*48*/ virtual void* Transmit(bool) = 0; 59 | /*49*/ virtual void* GetRemoteAddress(void)const = 0; 60 | /*50*/ virtual void* GetMsgHandler(void)const = 0; 61 | /*51*/ virtual void* GetDropNumber(void)const = 0; 62 | /*52*/ virtual void* GetSocket(void)const = 0; 63 | /*53*/ virtual void* GetChallengeNr(void)const = 0; 64 | /*54*/ virtual void* GetSequenceData(int&, int&, int&) = 0; 65 | /*55*/ virtual void* SetSequenceData(int, int, int) = 0; 66 | /*56*/ virtual void* UpdateMessageStats(int, int) = 0; 67 | /*57*/ virtual void* CanPacket(void)const = 0; 68 | /*58*/ virtual void* IsOverflowed(void)const = 0; 69 | /*59*/ virtual void* IsTimedOut(void)const = 0; 70 | /*60*/ virtual void* HasPendingReliableData(void) = 0; 71 | /*61*/ virtual void* SetFileTransmissionMode(bool) = 0; 72 | /*62*/ virtual void* SetCompressionMode(bool) = 0; 73 | /*63*/ virtual void* RequestFile(void*, unsigned int) = 0; 74 | /*64*/ virtual void* SetMaxBufferSize(bool, int, bool) = 0; 75 | /*65*/ virtual void* IsNull(void)const = 0; 76 | /*66*/ virtual void* GetNumBitsWritten(bool) = 0; 77 | /*67*/ virtual void* SetInterpolationAmount(float) = 0; 78 | /*68*/ virtual void* SetRemoteFramerate(float, float) = 0; 79 | /*69*/ virtual void* SetMaxRoutablePayloadSize(int) = 0; 80 | /*70*/ virtual void* GetMaxRoutablePayloadSize(void) = 0; 81 | /*71*/ virtual void* GetProtocolVersion(void) = 0; 82 | 83 | // https://i.imgur.com/PxwCKE9.png 84 | 85 | int unknown; 86 | 87 | // last send outgoing sequence number 88 | int m_nOutSequenceNr; 89 | // last received incoming sequnec number 90 | int m_nInSequenceNr; 91 | // last received acknowledge outgoing sequnce number 92 | int m_nOutSequenceNrAck; 93 | // state of outgoing reliable data (0/1) flip flop used for loss detection 94 | int m_nOutReliableState; 95 | // state of incoming reliable data 96 | int m_nInReliableState; 97 | 98 | 99 | int m_nChokedPackets; //number of choked packets 100 | 101 | }; 102 | 103 | class INetChannelInfo 104 | { 105 | public: 106 | 107 | enum { 108 | GENERIC = 0, // must be first and is default group 109 | LOCALPLAYER, // bytes for local player entity update 110 | OTHERPLAYERS, // bytes for other players update 111 | ENTITIES, // all other entity bytes 112 | SOUNDS, // game sounds 113 | EVENTS, // event messages 114 | USERMESSAGES, // user messages 115 | ENTMESSAGES, // entity messages 116 | VOICE, // voice data 117 | STRINGTABLE, // a stringtable update 118 | MOVE, // client move cmds 119 | STRINGCMD, // string command 120 | SIGNON, // various signondata 121 | TOTAL, // must be last and is not a real group 122 | }; 123 | 124 | virtual const char* GetName(void) const = 0; // get channel name 125 | virtual const char* GetAddress(void) const = 0; // get channel IP address as string 126 | virtual float GetTime(void) const = 0; // current net time 127 | virtual float GetTimeConnected(void) const = 0; // get connection time in seconds 128 | virtual int GetBufferSize(void) const = 0; // netchannel packet history size 129 | virtual int GetDataRate(void) const = 0; // send data rate in byte/sec 130 | 131 | virtual bool IsLoopback(void) const = 0; // true if loopback channel 132 | virtual bool IsTimingOut(void) const = 0; // true if timing out 133 | virtual bool IsPlayback(void) const = 0; // true if demo playback 134 | 135 | virtual float GetLatency(int flow) const = 0; // current latency (RTT), more accurate but jittering 136 | virtual float GetAvgLatency(int flow) const = 0; // average packet latency in seconds 137 | virtual float GetAvgLoss(int flow) const = 0; // avg packet loss[0..1] 138 | virtual float GetAvgChoke(int flow) const = 0; // avg packet choke[0..1] 139 | virtual float GetAvgData(int flow) const = 0; // data flow in bytes/sec 140 | virtual float GetAvgPackets(int flow) const = 0; // avg packets/sec 141 | virtual int GetTotalData(int flow) const = 0; // total flow in/out in bytes 142 | virtual int GetSequenceNr(int flow) const = 0; // last send seq number 143 | virtual bool IsValidPacket(int flow, int frame_number) const = 0; // true if packet was not lost/dropped/chocked/flushed 144 | virtual float GetPacketTime(int flow, int frame_number) const = 0; // time when packet was send 145 | virtual int GetPacketBytes(int flow, int frame_number, int group) const = 0; // group size of this packet 146 | virtual bool GetStreamProgress(int flow, int* received, int* total) const = 0; // TCP progress if transmitting 147 | virtual float GetTimeSinceLastReceived(void) const = 0; // get time since last recieved packet in seconds 148 | virtual float GetCommandInterpolationAmount(int flow, int frame_number) const = 0; 149 | virtual void GetPacketResponseLatency(int flow, int frame_number, int* pnLatencyMsecs, int* pnChoke) const = 0; 150 | virtual void GetRemoteFramerate(float* pflFrameTime, float* pflFrameTimeStdDeviation) const = 0; 151 | 152 | virtual float GetTimeoutSeconds() const = 0; 153 | }; 154 | -------------------------------------------------------------------------------- /GMod-SDK/engine/CVRenderView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../tier0/shareddefs.h" 4 | #include "../tier0/Vector.h" 5 | #include "vmatrix.h" 6 | #include "imaterial.h" 7 | #include "../client/CViewSetup.h" 8 | 9 | enum DrawBrushModelMode_t 10 | { 11 | DBM_DRAW_ALL = 0, 12 | DBM_DRAW_OPAQUE_ONLY, 13 | DBM_DRAW_TRANSLUCENT_ONLY, 14 | }; 15 | 16 | class CVRenderView 17 | { 18 | public: 19 | virtual void DrawBrushModel(void* baseentity, void* model, const Vector& origin, const QAngle& angles, bool bUnused) = 0; 20 | virtual void DrawIdentityBrushModel(void* pList, void* model) = 0; 21 | virtual void TouchLight(struct dlight_t* light) = 0; 22 | virtual void Draw3DDebugOverlays(void) = 0; 23 | virtual void SetBlend(float blend) = 0; 24 | virtual float GetBlend(void) = 0; 25 | virtual void SetColorModulation(float const* blend) = 0; 26 | virtual void GetColorModulation(float* blend) = 0; 27 | virtual void SceneBegin(void) = 0; 28 | virtual void SceneEnd(void) = 0; 29 | virtual void GetVisibleFogVolume(const Vector& eyePoint, void* pInfo) = 0; 30 | virtual void* CreateWorldList() = 0; 31 | 32 | virtual void BuildWorldLists(void* pList, void* pInfo, int iForceFViewLeaf, const void* pVisData = NULL, bool bShadowDepth = false, float* pReflectionWaterHeight = NULL) = 0; 33 | virtual void DrawWorldLists(void* pList, unsigned long flags, float waterZAdjust) = 0; 34 | 35 | // Optimization for top view 36 | virtual void DrawTopView(bool enable) = 0; 37 | virtual void TopViewBounds(Vector2D const& mins, Vector2D const& maxs) = 0; 38 | 39 | // Draw lights 40 | virtual void DrawLights(void) = 0; 41 | // FIXME: This function is a stub, doesn't do anything in the engine right now 42 | virtual void DrawMaskEntities(void) = 0; 43 | 44 | // Draw surfaces with alpha 45 | virtual void DrawTranslucentSurfaces(void* pList, int sortIndex, unsigned long flags, bool bShadowDepth) = 0; 46 | 47 | // Draw Particles ( just draws the linefine for debugging map leaks ) 48 | virtual void DrawLineFile(void) = 0; 49 | // Draw lightmaps 50 | virtual void DrawLightmaps(void* pList, int pageId) = 0; 51 | // Wraps view render sequence, sets up a view 52 | virtual void ViewSetupVis(bool novis, int numorigins, const Vector origin[]) = 0; 53 | 54 | // Return true if any of these leaves are visible in the current PVS. 55 | virtual bool AreAnyLeavesVisible(int* leafList, int nLeaves) = 0; 56 | 57 | virtual void VguiPaint(void) = 0; 58 | // Sets up view fade parameters 59 | virtual void ViewDrawFade(byte* color, IMaterial* pMaterial) = 0; 60 | // Sets up the projection matrix for the specified field of view 61 | virtual void OLD_SetProjectionMatrix(float fov, float zNear, float zFar) = 0; 62 | // Determine lighting at specified position 63 | virtual colorVec GetLightAtPoint(Vector& pos) = 0; 64 | // Whose eyes are we looking through? 65 | virtual int GetViewEntity(void) = 0; 66 | // Get engine field of view setting 67 | virtual float GetFieldOfView(void) = 0; 68 | // 1 == ducking, 0 == not 69 | virtual unsigned char** GetAreaBits(void) = 0; 70 | 71 | // Set up fog for a particular leaf 72 | virtual void SetFogVolumeState(int nVisibleFogVolume, bool bUseHeightFog) = 0; 73 | 74 | // Installs a brush surface draw override method, null means use normal renderer 75 | virtual void InstallBrushSurfaceRenderer(void* pBrushRenderer) = 0; 76 | 77 | // Draw brush model shadow 78 | virtual void DrawBrushModelShadow(void* pRenderable) = 0; 79 | 80 | // Does the leaf contain translucent surfaces? 81 | virtual bool LeafContainsTranslucentSurfaces(void* pList, int sortIndex, unsigned long flags) = 0; 82 | 83 | virtual bool DoesBoxIntersectWaterVolume(const Vector& mins, const Vector& maxs, int leafWaterDataID) = 0; 84 | 85 | virtual void SetAreaState() = 0; 86 | 87 | // See i 88 | virtual void VGui_Paint(int mode) = 0; 89 | 90 | // Push, pop views (see PushViewFlags_t above for flags) 91 | virtual void Push3DView(const CViewSetup& view, int nFlags, ITexture* pRenderTarget, void *frustumPlanes) = 0; 92 | virtual void Push2DView(const CViewSetup& view, int nFlags, ITexture* pRenderTarget, void *frustumPlanes) = 0; 93 | virtual void PopView(void *frustumPlanes) = 0; 94 | 95 | // Sets the main view 96 | virtual void SetMainView(const Vector& vecOrigin, const QAngle& angles) = 0; 97 | 98 | enum 99 | { 100 | VIEW_SETUP_VIS_EX_RETURN_FLAGS_USES_RADIAL_VIS = 0x00000001 101 | }; 102 | 103 | // Wraps view render sequence, sets up a view 104 | virtual void ViewSetupVisEx(bool novis, int numorigins, const Vector origin[], unsigned int& returnFlags) = 0; 105 | 106 | //replaces the current view frustum with a rhyming replacement of your choice 107 | virtual void OverrideViewFrustum(void *custom) = 0; 108 | 109 | virtual void DrawBrushModelShadowDepth(void* baseentity, void* model, const Vector& origin, const QAngle& angles, void *DepthMode) = 0; 110 | virtual void UpdateBrushModelLightmap(void* model, void* pRenderable) = 0; 111 | virtual void BeginUpdateLightmaps(void) = 0; 112 | virtual void EndUpdateLightmaps(void) = 0; 113 | virtual void OLD_SetOffCenterProjectionMatrix(float fov, float zNear, float zFar, float flAspectRatio, float flBottom, float flTop, float flLeft, float flRight) = 0; 114 | virtual void OLD_SetProjectionMatrixOrtho(float left, float top, float right, float bottom, float zNear, float zFar) = 0; 115 | virtual void Push3DView(const CViewSetup& view, int nFlags, ITexture* pRenderTarget, void*frustumPlanes, ITexture* pDepthTexture) = 0; 116 | virtual void GetMatricesForView(const CViewSetup& view, VMatrix* pWorldToView, VMatrix* pViewToProjection, VMatrix* pWorldToProjection, VMatrix* pWorldToPixels) = 0; 117 | virtual void DrawBrushModelEx(void* baseentity, void* model, const Vector& origin, const QAngle& angles, DrawBrushModelMode_t mode) = 0; 118 | }; 119 | -------------------------------------------------------------------------------- /GMod-SDK/engine/IStudioRender.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "imaterial.h" 3 | #include 4 | 5 | enum OverrideType_t 6 | { 7 | OVERRIDE_NORMAL = 0, 8 | OVERRIDE_BUILD_SHADOWS, 9 | OVERRIDE_DEPTH_WRITE, 10 | OVERRIDE_SSAO_DEPTH_WRITE, 11 | }; 12 | 13 | struct StudioRenderConfig_t 14 | { 15 | float fEyeShiftX; // eye X position 16 | float fEyeShiftY; // eye Y position 17 | float fEyeShiftZ; // eye Z position 18 | float fEyeSize; // adjustment to iris textures 19 | float fEyeGlintPixelWidthLODThreshold; 20 | 21 | int maxDecalsPerModel; 22 | int drawEntities; 23 | int skin; 24 | int fullbright; 25 | 26 | bool bEyeMove : 1; // look around 27 | bool bSoftwareSkin : 1; 28 | bool bNoHardware : 1; 29 | bool bNoSoftware : 1; 30 | bool bTeeth : 1; 31 | bool bEyes : 1; 32 | bool bFlex : 1; 33 | bool bWireframe : 1; 34 | bool bDrawNormals : 1; 35 | bool bDrawTangentFrame : 1; 36 | bool bDrawZBufferedWireframe : 1; 37 | bool bSoftwareLighting : 1; 38 | bool bShowEnvCubemapOnly : 1; 39 | bool bWireframeDecals : 1; 40 | 41 | // Reserved for future use 42 | int m_nReserved[4]; 43 | }; 44 | 45 | 46 | 47 | //----------------------------------------------------------------------------- 48 | // Studio render interface 49 | //----------------------------------------------------------------------------- 50 | enum 51 | { 52 | ADDDECAL_TO_ALL_LODS = -1 53 | }; 54 | 55 | 56 | //----------------------------------------------------------------------------- 57 | // DrawModel flags 58 | //----------------------------------------------------------------------------- 59 | enum 60 | { 61 | STUDIORENDER_DRAW_ENTIRE_MODEL = 0, 62 | STUDIORENDER_DRAW_OPAQUE_ONLY = 0x01, 63 | STUDIORENDER_DRAW_TRANSLUCENT_ONLY = 0x02, 64 | STUDIORENDER_DRAW_GROUP_MASK = 0x03, 65 | 66 | STUDIORENDER_DRAW_NO_FLEXES = 0x04, 67 | STUDIORENDER_DRAW_STATIC_LIGHTING = 0x08, 68 | 69 | STUDIORENDER_DRAW_ACCURATETIME = 0x10, // Use accurate timing when drawing the model. 70 | STUDIORENDER_DRAW_NO_SHADOWS = 0x20, 71 | STUDIORENDER_DRAW_GET_PERF_STATS = 0x40, 72 | 73 | STUDIORENDER_DRAW_WIREFRAME = 0x80, 74 | 75 | STUDIORENDER_DRAW_ITEM_BLINK = 0x100, 76 | 77 | STUDIORENDER_SHADOWDEPTHTEXTURE = 0x200, 78 | 79 | STUDIORENDER_SSAODEPTHTEXTURE = 0x1000, 80 | 81 | STUDIORENDER_GENERATE_STATS = 0x8000, 82 | }; 83 | 84 | 85 | //----------------------------------------------------------------------------- 86 | // Standard model vertex formats 87 | //----------------------------------------------------------------------------- 88 | // FIXME: remove these (materials/shaders should drive vertex format). Need to 89 | // list required forcedmaterialoverrides in models/bsps (rather than 90 | // all models supporting all possible overrides, as they do currently). 91 | #define VERTEX_TEXCOORD0_2D ( ( (uint64_t) 2 ) << ( TEX_COORD_SIZE_BIT + ( 3*0 ) ) ) 92 | enum MaterialVertexFormat_t 93 | { 94 | MATERIAL_VERTEX_FORMAT_MODEL_SKINNED = (VertexFormat_t)VERTEX_POSITION | VERTEX_COLOR | VERTEX_NORMAL | VERTEX_TEXCOORD0_2D | VERTEX_BONEWEIGHT(2) | VERTEX_BONE_INDEX | VERTEX_USERDATA_SIZE(4), 95 | MATERIAL_VERTEX_FORMAT_MODEL_SKINNED_DX7 = (VertexFormat_t)VERTEX_POSITION | VERTEX_COLOR | VERTEX_NORMAL | VERTEX_TEXCOORD0_2D | VERTEX_BONEWEIGHT(2) | VERTEX_BONE_INDEX, 96 | MATERIAL_VERTEX_FORMAT_MODEL = (VertexFormat_t)VERTEX_POSITION | VERTEX_COLOR | VERTEX_NORMAL | VERTEX_TEXCOORD0_2D | VERTEX_USERDATA_SIZE(4), 97 | MATERIAL_VERTEX_FORMAT_MODEL_DX7 = (VertexFormat_t)VERTEX_POSITION | VERTEX_COLOR | VERTEX_NORMAL | VERTEX_TEXCOORD0_2D, 98 | MATERIAL_VERTEX_FORMAT_COLOR = (VertexFormat_t)VERTEX_SPECULAR 99 | }; 100 | struct ColorMeshInfo_t 101 | { 102 | // A given color mesh can own a unique Mesh, or it can use a shared Mesh 103 | // (in which case it uses a sub-range defined by m_nVertOffset and m_nNumVerts) 104 | void* m_pMesh; 105 | void* m_pPooledVBAllocator; 106 | int m_nVertOffsetInBytes; 107 | int m_nNumVerts; 108 | }; 109 | 110 | struct DrawModelInfo_t 111 | { 112 | void* m_pStudioHdr; 113 | void* m_pHardwareData; 114 | void *m_Decals; 115 | int m_Skin; 116 | int m_Body; 117 | int m_HitboxSet; 118 | void* m_pClientEntity; 119 | int m_Lod; 120 | ColorMeshInfo_t* m_pColorMeshes; 121 | bool m_bStaticLighting; 122 | Vector m_vecAmbientCube[6]; // ambient, and lights that aren't in locallight[] 123 | int m_nLocalLightCount; 124 | int m_LocalLightDescs[4]; 125 | }; -------------------------------------------------------------------------------- /GMod-SDK/engine/gametrace.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //=============================================================================// 6 | 7 | #ifndef GAMETRACE_H 8 | #define GAMETRACE_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | 13 | #include "trace.h" 14 | #include "../tier0/Vector.h" 15 | 16 | #if defined( CLIENT_DLL ) 17 | class C_BaseEntity; 18 | #else 19 | class CBaseEntity; 20 | #endif 21 | 22 | 23 | //----------------------------------------------------------------------------- 24 | // Purpose: A trace is returned when a box is swept through the world 25 | // NOTE: eventually more of this class should be moved up into the base class!! 26 | //----------------------------------------------------------------------------- 27 | struct csurface_t 28 | { 29 | const char* name; 30 | short surfaceProps; 31 | unsigned short flags; // BUGBUG: These are declared per surface, not per material, but this database is per-material now 32 | }; 33 | class CGameTrace : public CBaseTrace 34 | { 35 | public: 36 | float fractionleftsolid; // time we left a solid, only valid if we started in solid 37 | csurface_t surface; // surface hit (impact surface) 38 | 39 | int hitgroup; // 0 == generic, non-zero is specific body part 40 | short physicsbone; // physics bone hit by trace in studio 41 | 42 | #if defined( CLIENT_DLL ) 43 | C_BaseEntity* m_pEnt; 44 | #else 45 | C_BasePlayer* m_pEnt; 46 | #endif 47 | 48 | // NOTE: this member is overloaded. 49 | // If hEnt points at the world entity, then this is the static prop index. 50 | // Otherwise, this is the hitbox index. 51 | int hitbox; // box hit by trace in studio 52 | 53 | CGameTrace() {} 54 | 55 | private: 56 | // No copy constructors allowed 57 | //CGameTrace(const CGameTrace& vOther); 58 | }; 59 | 60 | 61 | 62 | 63 | typedef CGameTrace trace_t; 64 | 65 | //============================================================================= 66 | 67 | #define TLD_DEF_LEAF_MAX 256 68 | #define TLD_DEF_ENTITY_MAX 1024 69 | 70 | 71 | #endif // GAMETRACE_H 72 | -------------------------------------------------------------------------------- /GMod-SDK/engine/iclientrenderable.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "vmatrix.h" 4 | 5 | typedef unsigned short ClientShadowHandle_t; 6 | typedef unsigned short ClientRenderHandle_t; 7 | typedef unsigned short ModelInstanceHandle_t; 8 | typedef unsigned char uint8; 9 | 10 | 11 | struct model_t; 12 | 13 | 14 | struct RenderableInstance_t 15 | { 16 | uint8 m_nAlpha; 17 | }; 18 | 19 | class IClientRenderable 20 | { 21 | public: 22 | virtual void* GetIClientUnknown() = 0; 23 | virtual Vector const& GetRenderOrigin(void) = 0; 24 | virtual QAngle const& GetRenderAngles(void) = 0; 25 | virtual bool ShouldDraw(void) = 0; 26 | virtual int GetRenderFlags(void) = 0; // ERENDERFLAGS_xxx 27 | virtual void Unused(void) const {} 28 | virtual ClientShadowHandle_t GetShadowHandle() const = 0; 29 | virtual ClientRenderHandle_t& RenderHandle() = 0; 30 | virtual model_t* GetModel() const = 0; 31 | virtual int DrawModel(int flags, const RenderableInstance_t& instance) = 0; 32 | virtual int GetBody() = 0; 33 | virtual void GetColorModulation(float* color) = 0; 34 | virtual bool LODTest() = 0; 35 | virtual bool SetupBones(matrix3x4_t* pBoneToWorldOut, int nMaxBones, int boneMask, float currentTime) = 0; 36 | virtual void SetupWeights(const matrix3x4_t* pBoneToWorld, int nFlexWeightCount, float* pFlexWeights, float* pFlexDelayedWeights) = 0; 37 | virtual void DoAnimationEvents(void) = 0; 38 | virtual void* /*IPVSNotify*/ GetPVSNotifyInterface() = 0; 39 | virtual void GetRenderBounds(Vector& mins, Vector& maxs) = 0; 40 | virtual void GetRenderBoundsWorldspace(Vector& mins, Vector& maxs) = 0; 41 | virtual void GetShadowRenderBounds(Vector& mins, Vector& maxs, int /*ShadowType_t*/ shadowType) = 0; 42 | virtual bool ShouldReceiveProjectedTextures(int flags) = 0; 43 | virtual bool GetShadowCastDistance(float* pDist, int /*ShadowType_t*/ shadowType) const = 0; 44 | virtual bool GetShadowCastDirection(Vector* pDirection, int /*ShadowType_t*/ shadowType) const = 0; 45 | virtual bool IsShadowDirty() = 0; 46 | virtual void MarkShadowDirty(bool bDirty) = 0; 47 | virtual IClientRenderable* GetShadowParent() = 0; 48 | virtual IClientRenderable* FirstShadowChild() = 0; 49 | virtual IClientRenderable* NextShadowPeer() = 0; 50 | virtual int /*ShadowType_t*/ ShadowCastType() = 0; 51 | virtual void CreateModelInstance() = 0; 52 | virtual ModelInstanceHandle_t GetModelInstance() = 0; 53 | virtual const matrix3x4_t& RenderableToWorldTransform() = 0; 54 | virtual int LookupAttachment(const char* pAttachmentName) = 0; 55 | virtual bool GetAttachment(int number, Vector& origin, QAngle& angles) = 0; 56 | virtual bool GetAttachment(int number, matrix3x4_t& matrix) = 0; 57 | virtual float* GetRenderClipPlane(void) = 0; 58 | virtual int GetSkin() = 0; 59 | virtual void OnThreadedDrawSetup() = 0; 60 | virtual bool UsesFlexDelayedWeights() = 0; 61 | virtual void RecordToolMessage() = 0; 62 | virtual bool ShouldDrawForSplitScreenUser(int nSlot) = 0; 63 | virtual uint8 OverrideAlphaModulation(uint8 nAlpha) = 0; 64 | virtual uint8 OverrideShadowAlphaModulation(uint8 nAlpha) = 0; 65 | }; -------------------------------------------------------------------------------- /GMod-SDK/engine/inetmessage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "CNetChan.h" 3 | #include "../tier1/bitbuf.h" 4 | class CNetChan; 5 | class INetMessage 6 | { 7 | public: 8 | virtual ~INetMessage() {}; 9 | 10 | // Use these to setup who can hear whose voice. 11 | // Pass in client indices (which are their ent indices - 1). 12 | 13 | virtual void SetNetChannel(CNetChan* netchan) = 0; // netchannel this message is from/for 14 | virtual void SetReliable(bool state) = 0; // set to true if it's a reliable message 15 | 16 | virtual bool Process(void) = 0; // calles the recently set handler to process this message 17 | 18 | virtual bool ReadFromBuffer(bf_read*buffer) = 0; // returns true if parsing was OK 19 | virtual bool WriteToBuffer(bf_write*buffer) = 0; // returns true if writing was OK 20 | 21 | virtual bool IsReliable(void) const = 0; // true, if message needs reliable handling 22 | 23 | virtual int GetType(void) const = 0; // returns module specific header tag eg svc_serverinfo 24 | virtual int GetGroup(void) const = 0; // returns net message group of this message 25 | virtual const char* GetName(void) const = 0; // returns network message name, eg "svc_serverinfo" 26 | virtual CNetChan* GetNetChannel(void) const = 0; 27 | virtual const char* ToString(void) const = 0; // returns a human readable string about message content 28 | private: 29 | bool m_bReliable; 30 | CNetChan* m_pChan; 31 | 32 | }; 33 | class CGModNetMessage : public INetMessage 34 | { 35 | public: 36 | CGModNetMessage(int iChannel, bf_read* pBuf) 37 | : m_iChannel(iChannel), m_pBuf(pBuf) 38 | {} 39 | virtual int GetType() const { return 18; } 40 | virtual int GetGroup() const { return INetChannelInfo::GENERIC; } 41 | //virtual const char* GetName() const { return "clc_GMod_ClientToServer"; } 42 | //virtual const char* ToString() const { return GetName(); } 43 | 44 | virtual bool WriteToBuffer(bf_write&); 45 | public: 46 | int m_iChannel; 47 | bf_read* m_pBuf; 48 | }; 49 | 50 | -------------------------------------------------------------------------------- /GMod-SDK/engine/trace.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $Workfile: $ 6 | // $Date: $ 7 | // 8 | //----------------------------------------------------------------------------- 9 | // $Log: $ 10 | // 11 | // $NoKeywords: $ 12 | //=============================================================================// 13 | 14 | #ifndef TRACE_H 15 | #define TRACE_H 16 | 17 | #ifdef _WIN32 18 | #pragma once 19 | #endif 20 | 21 | 22 | #include "../mathlib/math_pfns.h" 23 | #include "../tier0/Vector.h" 24 | #include "../mathlib/mathlib.h" 25 | // Note: These flags need to match the bspfile.h DISPTRI_TAG_* flags. 26 | #define DISPSURF_FLAG_SURFACE (1<<0) 27 | #define DISPSURF_FLAG_WALKABLE (1<<1) 28 | #define DISPSURF_FLAG_BUILDABLE (1<<2) 29 | #define DISPSURF_FLAG_SURFPROP1 (1<<3) 30 | #define DISPSURF_FLAG_SURFPROP2 (1<<4) 31 | 32 | //============================================================================= 33 | // Base Trace Structure 34 | // - shared between engine/game dlls and tools (vrad) 35 | //============================================================================= 36 | 37 | class CBaseTrace 38 | { 39 | public: 40 | 41 | // these members are aligned!! 42 | Vector startpos; // start position 43 | Vector endpos; // final position 44 | cplane_t plane; // surface normal at impact 45 | 46 | float fraction; // time completed, 1.0 = didn't hit anything 47 | 48 | int contents; // contents on other side of surface hit 49 | unsigned short dispFlags; // displacement flags for marking surfaces with data 50 | 51 | bool allsolid; // if true, plane is not valid 52 | bool startsolid; // if true, the initial point was in a solid area 53 | 54 | }; 55 | 56 | #endif // TRACE_H -------------------------------------------------------------------------------- /GMod-SDK/engine/vmatrix.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../tier0/Vector.h" 3 | #include 4 | #include "../mathlib/mathlib.h" 5 | 6 | 7 | struct vmatrix_t 8 | { 9 | vec_t m[4][4]; 10 | }; 11 | 12 | class VMatrix 13 | { 14 | public: 15 | 16 | VMatrix(); 17 | VMatrix( 18 | vec_t m00, vec_t m01, vec_t m02, vec_t m03, 19 | vec_t m10, vec_t m11, vec_t m12, vec_t m13, 20 | vec_t m20, vec_t m21, vec_t m22, vec_t m23, 21 | vec_t m30, vec_t m31, vec_t m32, vec_t m33 22 | ); 23 | 24 | // Creates a matrix where the X axis = forward 25 | // the Y axis = left, and the Z axis = up 26 | VMatrix(const Vector& forward, const Vector& left, const Vector& up); 27 | 28 | // Construct from a 3x4 matrix 29 | VMatrix(const matrix3x4_t& matrix3x4); 30 | 31 | // Set the values in the matrix. 32 | void Init( 33 | vec_t m00, vec_t m01, vec_t m02, vec_t m03, 34 | vec_t m10, vec_t m11, vec_t m12, vec_t m13, 35 | vec_t m20, vec_t m21, vec_t m22, vec_t m23, 36 | vec_t m30, vec_t m31, vec_t m32, vec_t m33 37 | ); 38 | 39 | 40 | // Initialize from a 3x4 41 | void Init(const matrix3x4_t& matrix3x4); 42 | 43 | // array access 44 | inline float* operator[](int i) 45 | { 46 | return m[i]; 47 | } 48 | 49 | inline const float* operator[](int i) const 50 | { 51 | return m[i]; 52 | } 53 | 54 | // Get a pointer to m[0][0] 55 | inline float* Base() 56 | { 57 | return &m[0][0]; 58 | } 59 | 60 | inline const float* Base() const 61 | { 62 | return &m[0][0]; 63 | } 64 | 65 | void SetLeft(const Vector& vLeft); 66 | void SetUp(const Vector& vUp); 67 | void SetForward(const Vector& vForward); 68 | 69 | void GetBasisVectors(Vector& vForward, Vector& vLeft, Vector& vUp) const; 70 | void SetBasisVectors(const Vector& vForward, const Vector& vLeft, const Vector& vUp); 71 | 72 | // Get/set the translation. 73 | Vector& GetTranslation(Vector& vTrans) const; 74 | void SetTranslation(const Vector& vTrans); 75 | 76 | void PreTranslate(const Vector& vTrans); 77 | void PostTranslate(const Vector& vTrans); 78 | 79 | matrix3x4_t& As3x4(); 80 | const matrix3x4_t& As3x4() const; 81 | void CopyFrom3x4(const matrix3x4_t& m3x4); 82 | void Set3x4(matrix3x4_t& matrix3x4) const; 83 | 84 | bool operator==(const VMatrix& src) const; 85 | bool operator!=(const VMatrix& src) const { return !(*this == src); } 86 | 87 | // Access the basis vectors. 88 | Vector GetLeft() const; 89 | Vector GetUp() const; 90 | Vector GetForward() const; 91 | Vector GetTranslation() const; 92 | 93 | 94 | // Matrix->vector operations. 95 | public: 96 | // Multiply by a 3D vector (same as operator*). 97 | void V3Mul(const Vector& vIn, Vector& vOut) const; 98 | 99 | // Multiply by a 4D vector. 100 | //void V4Mul( const Vector4D &vIn, Vector4D &vOut ) const; 101 | 102 | // Applies the rotation (ignores translation in the matrix). (This just calls VMul3x3). 103 | Vector ApplyRotation(const Vector& vVec) const; 104 | 105 | // Multiply by a vector (divides by w, assumes input w is 1). 106 | Vector operator*(const Vector& vVec) const; 107 | 108 | // Multiply by the upper 3x3 part of the matrix (ie: only apply rotation). 109 | Vector VMul3x3(const Vector& vVec) const; 110 | 111 | // Apply the inverse (transposed) rotation (only works on pure rotation matrix) 112 | Vector VMul3x3Transpose(const Vector& vVec) const; 113 | 114 | // Multiply by the upper 3 rows. 115 | Vector VMul4x3(const Vector& vVec) const; 116 | 117 | // Apply the inverse (transposed) transformation (only works on pure rotation/translation) 118 | Vector VMul4x3Transpose(const Vector& vVec) const; 119 | 120 | 121 | // Matrix->plane operations. 122 | //public: 123 | // Transform the plane. The matrix can only contain translation and rotation. 124 | //void TransformPlane( const VPlane &inPlane, VPlane &outPlane ) const; 125 | 126 | // Just calls TransformPlane and returns the result. 127 | //VPlane operator*(const VPlane &thePlane) const; 128 | 129 | // Matrix->matrix operations. 130 | public: 131 | 132 | VMatrix& operator=(const VMatrix& mOther); 133 | 134 | // Multiply two matrices (out = this * vm). 135 | void MatrixMul(const VMatrix& vm, VMatrix& out) const; 136 | 137 | // Add two matrices. 138 | const VMatrix& operator+=(const VMatrix& other); 139 | 140 | // Just calls MatrixMul and returns the result. 141 | VMatrix operator*(const VMatrix& mOther) const; 142 | 143 | // Add/Subtract two matrices. 144 | VMatrix operator+(const VMatrix& other) const; 145 | VMatrix operator-(const VMatrix& other) const; 146 | 147 | // Negation. 148 | VMatrix operator-() const; 149 | 150 | // Return inverse matrix. Be careful because the results are undefined 151 | // if the matrix doesn't have an inverse (ie: InverseGeneral returns false). 152 | VMatrix operator~() const; 153 | 154 | // Matrix operations. 155 | public: 156 | // Set to identity. 157 | void Identity(); 158 | 159 | bool IsIdentity() const; 160 | 161 | // Setup a matrix for origin and angles. 162 | void SetupMatrixOrgAngles(const Vector& origin, const QAngle& vAngles); 163 | 164 | // General inverse. This may fail so check the return! 165 | bool InverseGeneral(VMatrix& vInverse) const; 166 | 167 | // Does a fast inverse, assuming the matrix only contains translation and rotation. 168 | void InverseTR(VMatrix& mRet) const; 169 | 170 | // Usually used for debug checks. Returns true if the upper 3x3 contains 171 | // unit vectors and they are all orthogonal. 172 | bool IsRotationMatrix() const; 173 | 174 | // This calls the other InverseTR and returns the result. 175 | VMatrix InverseTR() const; 176 | 177 | // Get the scale of the matrix's basis vectors. 178 | Vector GetScale() const; 179 | 180 | // (Fast) multiply by a scaling matrix setup from vScale. 181 | VMatrix Scale(const Vector& vScale); 182 | 183 | // Normalize the basis vectors. 184 | VMatrix NormalizeBasisVectors() const; 185 | 186 | // Transpose. 187 | VMatrix Transpose() const; 188 | 189 | // Transpose upper-left 3x3. 190 | VMatrix Transpose3x3() const; 191 | 192 | public: 193 | // The matrix. 194 | vec_t m[4][4]; 195 | }; 196 | 197 | -------------------------------------------------------------------------------- /GMod-SDK/hacks/AntiAim.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../globals.hpp" 5 | 6 | QAngle &BackupCMD(CUserCmd* cmd, bool run = false) { 7 | static float oldForward; 8 | static float oldSide; 9 | static float oldUp; 10 | static QAngle oldAng; 11 | if (!run) 12 | { 13 | oldForward = cmd->forwardmove; 14 | oldSide = cmd->sidemove; 15 | oldUp = cmd->upmove; // wanted to add up fixing but useless when i think of it... 16 | oldAng = cmd->viewangles; 17 | } 18 | else { 19 | if (localPlayer->getMoveType() == MOVETYPE_NOCLIP || localPlayer->getMoveType() == MOVETYPE_LADDER) 20 | return oldAng; 21 | 22 | // old = 160 23 | // new = 30 24 | //if(x < 0.) return x+360 25 | //+180 26 | float deltaYaw = ANG2DEG(cmd->viewangles.y - oldAng.y); 27 | 28 | // V this perfectly explains https://i.imgur.com/8cED0pl.png 29 | cmd->forwardmove = cos(DEG2RAD(deltaYaw)) * oldForward + cos(DEG2RAD(deltaYaw + 90.f)) * oldSide; 30 | cmd->sidemove = sin(DEG2RAD(deltaYaw)) * oldForward + sin(DEG2RAD(deltaYaw + 90.f)) * oldSide; 31 | if ((cmd->forwardmove < 1 && cmd->forwardmove > 0) || (cmd->forwardmove > -1 && cmd->forwardmove < 0)) cmd->forwardmove = 0; 32 | if ((cmd->sidemove < 1 && cmd->sidemove > 0) || (cmd->sidemove > -1 && cmd->sidemove < 0)) cmd->sidemove = 0; 33 | // ^ this'll make u undetected on a few servers 34 | } 35 | return oldAng; 36 | } 37 | 38 | // fake doesn't works yet 39 | void StaticPitch(CUserCmd* cmd, bool down) 40 | { 41 | if (Globals::Untrusted) 42 | { 43 | cmd->viewangles.x = down ? -90.f : 90.f; 44 | } 45 | else { 46 | cmd->viewangles.x = down ? -89.f : 89.f; 47 | } 48 | } 49 | void JitterPitch(CUserCmd* cmd) 50 | { 51 | cmd->viewangles.x = (rand() % 2) ? -89.f : 89.f; 52 | } 53 | void FastSpin(CUserCmd* cmd) 54 | { 55 | int random = rand() % 360; 56 | static float yaw = cmd->viewangles.y; 57 | yaw += random; 58 | cmd->viewangles.y += yaw; 59 | } 60 | void SlowSpin(CUserCmd* cmd) 61 | { 62 | int random = rand() % 10; 63 | 64 | static float yaw = cmd->viewangles.y; 65 | yaw += random; 66 | 67 | cmd->viewangles.y = yaw; 68 | } 69 | void BackJitter(CUserCmd* cmd) 70 | { 71 | static float yaw = cmd->viewangles.y; 72 | 73 | yaw += 50.f; 74 | if (rand() % 50 == 0) 75 | yaw += 180.f; 76 | cmd->viewangles.y = yaw; 77 | } 78 | void Inverse(CUserCmd* pCmd) 79 | { 80 | pCmd->viewangles.y -= 180.f; 81 | } 82 | void Sideways(CUserCmd* cmd) 83 | { 84 | cmd->viewangles.y -= 90.f; 85 | } 86 | 87 | void AntiAimPitch(CUserCmd* cmd, int kind) 88 | { 89 | if (localPlayer->getMoveType() == MOVETYPE_NOCLIP || localPlayer->getMoveType() == MOVETYPE_LADDER /* || cmd->buttons & (IN_USE | IN_ATTACK)*/) 90 | return; 91 | 92 | switch (kind) 93 | { 94 | case 0: 95 | break; 96 | case 1: 97 | StaticPitch(cmd, false); 98 | break; 99 | case 2: 100 | StaticPitch(cmd, true); 101 | break; 102 | case 3: 103 | JitterPitch(cmd); 104 | break; 105 | 106 | } 107 | } 108 | void AntiAimYaw(CUserCmd* cmd, int kind) 109 | { 110 | if (localPlayer->getMoveType() == MOVETYPE_NOCLIP || localPlayer->getMoveType() == MOVETYPE_LADDER /* || cmd->buttons & (IN_USE | IN_ATTACK)*/) 111 | return; 112 | 113 | switch (kind) 114 | { 115 | case 0: 116 | break; 117 | case 1: 118 | FastSpin(cmd); 119 | break; 120 | case 2: 121 | SlowSpin(cmd); 122 | break; 123 | case 3: 124 | BackJitter(cmd); 125 | break; 126 | case 4: 127 | Inverse(cmd); 128 | break; 129 | case 5: 130 | Sideways(cmd); 131 | break; 132 | 133 | } 134 | } -------------------------------------------------------------------------------- /GMod-SDK/hacks/AutoWall.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../engine/trace.h" 4 | #include "../engine/gametrace.h" 5 | #include "../globals.hpp" 6 | #include "Utils.h" 7 | 8 | float ScaleDamage(int hitGroup) 9 | { 10 | switch (hitGroup) 11 | { 12 | case HITGROUP_GENERIC: 13 | return 1.f; 14 | case HITGROUP_HEAD: 15 | return 4.f; 16 | case HITGROUP_CHEST: 17 | return 1.f; 18 | case HITGROUP_STOMACH: 19 | return 1.25f; 20 | case HITGROUP_LEFTARM: 21 | return 1.f; 22 | case HITGROUP_RIGHTARM: 23 | return 1.f; 24 | case HITGROUP_LEFTLEG: 25 | return 0.75f; 26 | case HITGROUP_RIGHTLEG: 27 | return 0.75f; 28 | case HITGROUP_GEAR: 29 | return 1.f; 30 | default: 31 | return 1.f; 32 | break; 33 | } 34 | } // https://www.gamersdecide.com/articles/csgo-weapons-damage-chart 35 | 36 | 37 | // This is WIP, i'm releasing to UC before I finish making it. 38 | bool CanHit(C_BasePlayer* target, Vector from, Vector to) 39 | { 40 | if (!localPlayer || !localPlayer->GetActiveWeapon()) 41 | return false; 42 | //C_BaseCombatWeapon* weapon = localPlayer->GetActiveWeapon(); 43 | //if (!weapon->UsesLua()) 44 | //return false; 45 | // lua only for now. 46 | 47 | //float gunDamage = GetLuaWeaponDamage(weapon); 48 | 49 | trace_t Trace; 50 | CTraceFilter filter; 51 | filter.pSkip = localPlayer; 52 | Ray_t Ray; 53 | 54 | Ray.Init(from, to); 55 | EngineTrace->TraceRay(Ray, MASK_SHOT, &filter, &Trace); 56 | //engineTrace->ClipRayToEntity(Ray, MASK_SHOT_HULL | CONTENTS_HITBOX, (IHandleEntity*)target, &Trace); 57 | //m_PhysicsSurface->surface_data( Trace.surface.surfaceProps) = surfacedata_t*, get game.penetrationmodifier inside it 58 | 59 | //float currentDamage = gunDamage; 60 | if (Trace.m_pEnt == target || Trace.fraction >= 0.98f) 61 | { 62 | //gunDamage *= ScaleDamage(Trace.hitgroup); 63 | return true; 64 | } 65 | 66 | return false; 67 | } 68 | -------------------------------------------------------------------------------- /GMod-SDK/hacks/ConVarSpoofing.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include 5 | #include "../client/ConVar.h" 6 | #include "../Memory.h" 7 | // i prefer doing that than including globals.hpp ... 8 | extern CCvar* CVar; 9 | 10 | class SpoofedConVar { 11 | // Inspired of https://gist.github.com/markhc/c975ce63c8714709e410f1be43e4048f 12 | public: 13 | SpoofedConVar(ConVar* pCVar) { 14 | m_pOriginalCVar = pCVar; 15 | Spoof(); 16 | } 17 | ~SpoofedConVar() { 18 | 19 | CVar->UnregisterConCommand(m_pDummyCVar); 20 | free(m_pDummyCVar); 21 | 22 | DWORD dwOld; 23 | VirtualProtect((LPVOID)m_pOriginalCVar->pszName, 128, PAGE_READWRITE, &dwOld); 24 | strcpy(m_pOriginalCVar->pszName, m_szOriginalName); 25 | VirtualProtect((LPVOID)m_pOriginalCVar->pszName, 128, dwOld, &dwOld); 26 | VirtualProtect((LPVOID)m_pOriginalCVar->pszValueStr, 128, PAGE_READWRITE, &dwOld); 27 | strcpy(m_pOriginalCVar->pszValueStr, m_szOriginalValue); 28 | VirtualProtect((LPVOID)m_pOriginalCVar->pszValueStr, 128, dwOld, &dwOld); 29 | } 30 | 31 | void Spoof() { 32 | if (m_pOriginalCVar) { 33 | m_iOriginalFlags = m_pOriginalCVar->nflags; 34 | strcpy(m_szOriginalName, m_pOriginalCVar->pszName); 35 | strcpy(m_szOriginalValue, m_pOriginalCVar->pszValueStr); 36 | 37 | std::string dummyName = "XD_" + std::string(m_pOriginalCVar->pszName); 38 | 39 | m_pDummyCVar = (ConVar*)malloc(sizeof(ConVar)); 40 | if (!m_pDummyCVar) return; 41 | memcpy(m_pDummyCVar, m_pOriginalCVar, sizeof(ConVar)); 42 | DWORD dwOld; 43 | VirtualProtect((LPVOID)m_pOriginalCVar->pszName, 128, PAGE_READWRITE, &dwOld); 44 | 45 | strcpy(m_pOriginalCVar->pszName, dummyName.c_str()); 46 | m_pDummyCVar->Create(m_szOriginalName, m_pOriginalCVar->pszDefaultValue, m_pOriginalCVar->nflags, m_pOriginalCVar->pszHelpString, m_pOriginalCVar->bHasMin, m_pOriginalCVar->fMinVal, m_pOriginalCVar->bHasMax, m_pOriginalCVar->fMaxVal, NULL); 47 | 48 | CVar->RegisterConCommand(m_pDummyCVar); 49 | VirtualProtect((LPVOID)m_pOriginalCVar->pszName, 128, dwOld, &dwOld); 50 | 51 | 52 | } 53 | } 54 | 55 | public: 56 | ConVar* m_pOriginalCVar = nullptr; 57 | private: 58 | ConVar* m_pDummyCVar = nullptr; 59 | 60 | char m_szOriginalName[128]; 61 | char m_szOriginalValue[128]; 62 | int m_iOriginalFlags; 63 | 64 | }; -------------------------------------------------------------------------------- /GMod-SDK/hacks/Executor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../globals.hpp" 4 | #include "../hooks/RunStringEx.h" 5 | #include 6 | #include 7 | std::mutex executorMutex; 8 | 9 | void ExecuteScript(const char* input) 10 | { 11 | if (!Lua) return; 12 | std::unique_lock lock(executorMutex); 13 | Globals::waitingToBeExecuted.store(std::make_pair(true, input)); 14 | } 15 | void LoadScriptFromFile() 16 | { 17 | OPENFILENAMEA openFileName = { 0 }; 18 | char fileName[MAX_PATH] = ""; 19 | 20 | openFileName.lStructSize = sizeof(OPENFILENAMEA); 21 | openFileName.lpstrDefExt = "lua"; 22 | openFileName.lpstrFile = fileName; 23 | openFileName.lpstrFilter = "LUA Files (*.lua)\0*.lua\0\0"; 24 | openFileName.hwndOwner = NULL; 25 | openFileName.nMaxFile = sizeof(fileName); 26 | openFileName.Flags = OFN_ENABLESIZING | OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; 27 | 28 | if (GetOpenFileNameA(&openFileName)) 29 | { 30 | if (!strlen(fileName)) 31 | return; 32 | std::ifstream stream(fileName); 33 | if (stream.bad()) 34 | return; 35 | std::string fileContent = std::string((std::istreambuf_iterator(stream)), std::istreambuf_iterator()); 36 | strcpy(Settings::ScriptInput, fileContent.c_str()); 37 | } 38 | } -------------------------------------------------------------------------------- /GMod-SDK/hacks/LegitAim.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../globals.hpp" 5 | #include "AutoWall.h" 6 | #include "Utils.h" 7 | 8 | void DoLegitAimbot(CUserCmd* cmd) 9 | { 10 | static C_BasePlayer* lastTarget = nullptr; 11 | static bool tempState = false; 12 | static int smoothSteps = 0; 13 | 14 | bool keyDown; 15 | getKeyState(Settings::Aimbot::aimbotKey, Settings::Aimbot::aimbotKeyStyle, &keyDown, henlo1, henlo2, henlo3); 16 | 17 | if (!keyDown || !Settings::Aimbot::enableAimbot) { Settings::Aimbot::finalTarget = nullptr; smoothSteps = 0; return; } 18 | 19 | if (Settings::Aimbot::lockOnTarget && (Settings::Aimbot::finalTarget && !Settings::Aimbot::finalTarget->IsAlive()))Settings::Aimbot::finalTarget = localPlayer; 20 | if (Settings::Aimbot::finalTarget == localPlayer) { smoothSteps = 0; return; } 21 | 22 | int selectedHitBox = 0; 23 | 24 | Vector eyePos = localPlayer->EyePosition(); 25 | Vector finalPos; 26 | bool isErrorModel = false; 27 | bool canHit = false; 28 | if (!Settings::Aimbot::lockOnTarget || !Settings::Aimbot::finalTarget || !Settings::Aimbot::finalTarget->IsAlive() || Settings::Aimbot::finalTarget->IsDormant()) // isNotLock or if final is bad, or dead 29 | { 30 | Settings::Aimbot::finalTarget = nullptr; 31 | float finalDistance = FLT_MAX; 32 | for (int i = 0; i < ClientEntityList->GetHighestEntityIndex(); i++) 33 | { 34 | C_BasePlayer* entity = (C_BasePlayer*)ClientEntityList->GetClientEntity(i); 35 | if (!entity || !entity->IsAlive() || !entity->IsPlayer() || entity == localPlayer || entity->IsDormant()) 36 | continue; 37 | 38 | if (!Settings::Aimbot::aimAtTeammates && entity->getTeamNum() == localPlayer->getTeamNum()) 39 | continue; 40 | bool isFriend = false; 41 | Settings::friendListMutex.lock(); 42 | for (auto var : Settings::friendList) 43 | { 44 | if (var.first == entity && var.second.first) 45 | { 46 | isFriend = true; 47 | break; 48 | } 49 | } 50 | Settings::friendListMutex.unlock(); 51 | 52 | if (isFriend && !Settings::Aimbot::aimAtFriends && !Settings::Aimbot::onlyAimAtFriends) 53 | continue; 54 | if (Settings::Aimbot::onlyAimAtFriends && !isFriend) 55 | continue; 56 | 57 | // This is an exemple of something you can do for a custom server. 58 | /*entity->PushEntity(); 59 | Lua->GetField(-1, "GetNWInt"); 60 | Lua->Push(-2); 61 | 62 | Lua->PushString("Buildmode"); 63 | Lua->Call(2, 1); 64 | int buildMode = Lua->GetNumber(-1); 65 | Lua->Pop(2); 66 | if (buildMode) continue;*/ 67 | #pragma message("THIS IS TO BE TESTED!!") 68 | Vector entPos; 69 | auto model = ((model_t*)entity->GetClientRenderable()->GetModel()); 70 | if (model && !_strcmpi(ModelInfo->GetStudiomodel(model)->name, "error.mdl")) 71 | { 72 | entPos = entity->EyePosition(); 73 | isErrorModel = true; 74 | } 75 | else { 76 | // https://i.imgur.com/0WZNkbC.jpg 77 | // https://i.imgur.com/rRxWCUN.jpeg 78 | // 6 head 79 | // 3 torso 80 | 81 | isErrorModel = false; 82 | matrix3x4_t bones[128]; 83 | if (!entity->GetClientRenderable()->SetupBones(bones, 128, BONE_USED_BY_HITBOX, GlobalVars->curtime)) 84 | continue; 85 | //std::cout << ((model_t*)entity->GetClientRenderable()->GetModel())->name << std::endl; 86 | auto bone = Studio_BoneIndexByName(ModelInfo->GetStudiomodel((const model_t*)entity->GetClientRenderable()->GetModel()), IntToBoneName(Settings::Aimbot::aimbotHitbox), &selectedHitBox); 87 | 88 | entPos = Vector(bones[selectedHitBox][0][3], bones[selectedHitBox][1][3], bones[selectedHitBox][2][3]); // 6 = hitbox https://i.imgur.com/0WZNkbC.jpg 89 | } 90 | canHit = CanHit(entity, eyePos, entPos); 91 | if (!canHit && Settings::Aimbot::aimbotAutoWall) 92 | continue; 93 | if (!Settings::Aimbot::aimAtFriends && Settings::friendList.find(entity) != Settings::friendList.find(entity)) 94 | continue; 95 | 96 | 97 | float distance = FLT_MAX; 98 | float fovDistance = FLT_MAX; 99 | if (Settings::Aimbot::aimbotSelection == 0) // Distance 100 | { 101 | distance = localPlayer->GetAbsOrigin().DistTo(entPos); 102 | if (distance > finalDistance) 103 | continue; 104 | } 105 | else if (Settings::Aimbot::aimbotSelection == 1) // Health 106 | { 107 | distance = entity->GetHealth(); 108 | if (distance > finalDistance) 109 | continue; 110 | } 111 | else if (Settings::Aimbot::aimbotSelection == 2) // FOV 112 | { 113 | const VMatrix viewMatrix = EngineClient->WorldToScreenMatrix(); 114 | Vector screenPos; 115 | if (!WorldToScreen(entPos, screenPos)) 116 | continue; 117 | screenPos.z = 0; 118 | distance = Vector(Globals::screenWidth / 2, Globals::screenHeight / 2, 0).DistTo(screenPos); 119 | fovDistance = distance; 120 | if (distance > finalDistance) 121 | continue; 122 | } 123 | // do min damage sorting here with ray tracing 124 | if (Settings::Aimbot::aimbotFovEnabled) 125 | { 126 | if (fovDistance == FLT_MAX) 127 | { 128 | const VMatrix viewMatrix = EngineClient->WorldToScreenMatrix(); 129 | Vector screenPos; 130 | if (!WorldToScreen(entPos, screenPos)) 131 | continue; 132 | screenPos.z = 0; 133 | fovDistance = Vector(Globals::screenWidth / 2, Globals::screenHeight / 2, 0).DistTo(screenPos); 134 | } 135 | if (fovDistance > Settings::Aimbot::aimbotFOV) 136 | continue; 137 | } 138 | 139 | finalPos = entPos; 140 | finalDistance = distance; 141 | Settings::Aimbot::finalTarget = entity; 142 | } 143 | } 144 | 145 | if (Settings::Aimbot::finalTarget && Settings::Aimbot::finalTarget->IsAlive()) 146 | { 147 | auto calc = (finalPos - eyePos + Settings::Aimbot::finalTarget->getVelocity() * GlobalVars->frametime * GlobalVars->interval_per_tick - localPlayer->getVelocity() * GlobalVars->interval_per_tick).toAngle(); 148 | 149 | canHit = CanHit(Settings::Aimbot::finalTarget, eyePos, finalPos); 150 | 151 | bool shouldFire = true; 152 | if (lastTarget != Settings::Aimbot::finalTarget) 153 | smoothSteps = 0; 154 | 155 | 156 | if (Settings::Aimbot::smoothing && !Settings::Aimbot::silentAim) 157 | { 158 | smoothSteps++; 159 | 160 | if (smoothSteps >= Settings::Aimbot::smoothSteps) 161 | shouldFire = true; 162 | else { 163 | shouldFire = false; 164 | 165 | auto delta = calc - cmd->viewangles; 166 | auto smoothed = cmd->viewangles + (delta * (1.f / Settings::Aimbot::smoothSteps)); 167 | 168 | calc = smoothed; 169 | } 170 | } 171 | 172 | // it is better to use smoothing without silent aim. 173 | if (!Settings::Aimbot::silentAim) 174 | { 175 | EngineClient->SetViewAngles(calc); 176 | } 177 | 178 | if (Settings::Aimbot::aimbotAutoFire && shouldFire) 179 | { 180 | if (canHit) 181 | { 182 | static bool toggle = false; 183 | toggle = !toggle; 184 | if (toggle) 185 | { 186 | cmd->buttons |= IN_ATTACK; 187 | } 188 | else if (Settings::Aimbot::pistolFastShoot)cmd->buttons &= ~IN_ATTACK; 189 | } 190 | } 191 | 192 | if (cmd->buttons & IN_ATTACK) 193 | { 194 | cmd->viewangles = calc; 195 | if(Settings::Aimbot::silentAim) 196 | *Globals::bSendpacket = false; 197 | } 198 | 199 | } else smoothSteps = 0; 200 | lastTarget = Settings::Aimbot::finalTarget; 201 | 202 | } -------------------------------------------------------------------------------- /GMod-SDK/hacks/Prediction.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../globals.hpp" 4 | #include "../client/usercmd.h" 5 | #include "Utils.h" 6 | #include "../tier1/checksum_md5.h" 7 | #include "../client/IGameMovement.h" 8 | float m_flOldCurtime; 9 | float m_flOldFrametime; 10 | CMoveData moveData; 11 | 12 | void StartPrediction(CUserCmd* cmd) 13 | { 14 | if (!Settings::Misc::edgeJump || false) return; // Temporarily making prediction "disabled" cause far from being perfect... 15 | *Globals::predictionRandomSeed = MD5_PseudoRandom(cmd->command_number) & 0x7FFFFFFF; 16 | //*Globals::predictionRandomSeed = cmd->random_seed; 17 | 18 | m_flOldCurtime = GlobalVars->curtime; 19 | m_flOldFrametime = GlobalVars->frametime; 20 | 21 | GlobalVars->curtime = localPlayer->getTickBase() * GlobalVars->interval_per_tick; 22 | GlobalVars->frametime = GlobalVars->interval_per_tick; 23 | 24 | //localPlayer->PreThink(); 25 | //localPlayer->Think(); 26 | 27 | GameMovement->StartTrackPredictionErrors(localPlayer); 28 | memset((void*)&moveData, 0, sizeof(moveData)); 29 | 30 | if (cmd->weaponselect; auto wp=(C_BaseCombatWeapon*)ClientEntityList->GetClientEntity(cmd->weaponselect)) 31 | { 32 | localPlayer->SelectItem(wp->GetName(), cmd->weaponsubtype); 33 | } 34 | Prediction->SetupMove(localPlayer, cmd, MoveHelper, &moveData); 35 | GameMovement->ProcessMovement(localPlayer, &moveData); 36 | //GameMovement->FullWalkMove(); 37 | Prediction->FinishMove(localPlayer, cmd, &moveData); 38 | } 39 | void EndPrediction(CUserCmd* cmd) 40 | { 41 | if (!Settings::Misc::edgeJump || false) return; // Temporarily making prediction "disabled" cause far from being perfect... 42 | //localPlayer->PostThink(); 43 | GlobalVars->curtime = m_flOldCurtime; 44 | GlobalVars->frametime = m_flOldFrametime; 45 | 46 | GameMovement->FinishTrackPredictionErrors(localPlayer); 47 | *Globals::predictionRandomSeed = -1; 48 | }; -------------------------------------------------------------------------------- /GMod-SDK/hacks/ScriptDumper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../globals.hpp" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace fs = std::filesystem; 11 | fs::path SanitizePath(fs::path in) 12 | { 13 | fs::path retPath; 14 | for (const auto& part : in) 15 | if (part != ".." && part != "\\" && part != "/" ) 16 | { 17 | std::string outPartName; 18 | for (auto ch : part.string()) 19 | { 20 | if ((ch == '\\' || ch == '/' || ch == ':' || ch == '?' || ch == '"' || ch == '<' || ch == '>' || ch == '|') && part != in.root_name()) // hm that's bad 21 | outPartName += '.'; 22 | else if (ch >= ' ' && ch <= '~') 23 | outPartName += ch; 24 | } 25 | 26 | retPath += outPartName; 27 | if(outPartName != in.filename()) 28 | retPath += "\\"; 29 | } 30 | 31 | return retPath; 32 | } 33 | void CreateRecurringDir(fs::path in) 34 | { 35 | fs::path out; 36 | for (const auto& part : in) 37 | { 38 | if (part != "\\" && part != "/") 39 | { 40 | out += part; 41 | out += "\\"; 42 | } 43 | 44 | if(out != out.root_path()) 45 | fs::create_directory(out); 46 | } 47 | } 48 | 49 | // Idk why, but thinking that the server can just spam runstrings to you will just eventually overload your disk / lag you sucks. 50 | // And at the same time, they could be loading all of their scripts through net/runstrings :/ 51 | std::optional SaveScript(std::string fileName, std::string fileContent) 52 | { 53 | try 54 | { 55 | if (fileName == "RunString(Ex)" || fileName.find('.') == std::string::npos)fileName = "runString.lua"; 56 | 57 | fs::path scripthookPath = "C:\\GaztoofScriptHook\\Original\\"; 58 | fs::path detourPath = "C:\\GaztoofScriptHook\\Detour\\"; 59 | 60 | if (EngineClient->GetNetChannelInfo() && EngineClient->GetNetChannelInfo()->GetAddress()) 61 | { 62 | std::string hostName = Globals::hostName; 63 | 64 | if (hostName.length()) { 65 | std::replace(hostName.begin(), hostName.end(), '/', ' '); 66 | scripthookPath += hostName; 67 | detourPath += hostName; 68 | } 69 | scripthookPath += " - "; 70 | detourPath += " - "; 71 | scripthookPath += EngineClient->GetNetChannelInfo()->GetAddress(); 72 | detourPath += EngineClient->GetNetChannelInfo()->GetAddress(); 73 | } 74 | else { 75 | scripthookPath += "No Server"; 76 | detourPath += "No Server"; 77 | } 78 | 79 | scripthookPath += "\\"; 80 | detourPath += "\\"; 81 | 82 | scripthookPath += fs::path(fileName); 83 | detourPath += fs::path(fileName); 84 | 85 | fs::path targetDir = SanitizePath(scripthookPath); 86 | fs::path detourDir = SanitizePath(detourPath); 87 | 88 | CreateRecurringDir(targetDir.parent_path()); 89 | CreateRecurringDir(detourDir.parent_path()); 90 | 91 | if (fileName != "runString.lua") 92 | { 93 | std::string strToPrint = "Successfully dumped script \"" + fileName + "\" !"; 94 | ConPrint(strToPrint.c_str(), Color(204, 51, 255)); 95 | } 96 | 97 | std::ofstream outFile; 98 | outFile.open(targetDir.string()); 99 | if (outFile.good()) 100 | { 101 | outFile << fileContent; 102 | outFile.close(); 103 | } 104 | 105 | std::ifstream inFile; 106 | inFile.open(detourDir.string()); 107 | if (inFile.good() && fileName != "runString.lua") { 108 | 109 | std::string content((std::istreambuf_iterator(inFile)), 110 | (std::istreambuf_iterator())); 111 | if (!strcmp(content.c_str(), fileContent.c_str()))return {}; 112 | 113 | std::string strToPrint = "Successfully detoured script \"" + fileName + "\" !"; 114 | ConPrint(strToPrint.c_str(), Color(255, 51, 113)); 115 | 116 | fileContent = content; 117 | return fileContent; 118 | } 119 | /*else { 120 | std::ofstream outDetourFile; 121 | outDetourFile.open(detourDir.string()); 122 | if (outDetourFile.good()) 123 | { 124 | outDetourFile << fileContent; 125 | outDetourFile.close(); 126 | } 127 | }*/ 128 | } 129 | catch (...) {} 130 | 131 | return {}; 132 | } -------------------------------------------------------------------------------- /GMod-SDK/hacks/Triggerbot.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../globals.hpp" 4 | #include "Utils.h" 5 | #include "AutoWall.h" 6 | 7 | // That's bad, honestly needs a little improve 8 | void TriggerBot(CUserCmd* cmd) 9 | { 10 | if (!Settings::Triggerbot::triggerBot)return; 11 | QAngle viewAng; 12 | viewAng.z = 0; 13 | EngineClient->GetViewAngles(viewAng); 14 | trace_t Trace; 15 | CTraceFilter filter; 16 | filter.pSkip = localPlayer; 17 | Ray_t Ray; 18 | 19 | Ray.Init(localPlayer->EyePosition(), localPlayer->EyePosition() + cmd->viewangles.toVector() * 69696.f); 20 | EngineTrace->TraceRay(Ray, MASK_SHOT, &filter, &Trace); 21 | 22 | C_BasePlayer* target = (C_BasePlayer*)Trace.m_pEnt; 23 | if (!target || !target->IsPlayer() || !target->IsAlive()) 24 | return; 25 | 26 | if (!Settings::Aimbot::aimAtTeammates && target->InLocalTeam()) 27 | return; 28 | 29 | if ((Settings::Triggerbot::triggerBotHead && Trace.hitgroup == HITGROUP_HEAD) || (Settings::Triggerbot::triggerBotChest && Trace.hitgroup == HITGROUP_CHEST) || (Settings::Triggerbot::triggerBotStomach && Trace.hitgroup == HITGROUP_STOMACH)) 30 | { 31 | static bool toggle = false; 32 | toggle = !toggle; 33 | 34 | if (Settings::Triggerbot::triggerbotFastShoot) 35 | { 36 | if(toggle || Settings::Triggerbot::triggerbotFastShoot) 37 | cmd->buttons |= IN_ATTACK; 38 | else cmd->buttons &= ~IN_ATTACK; 39 | } 40 | else cmd->buttons |= IN_ATTACK; 41 | } 42 | } -------------------------------------------------------------------------------- /GMod-SDK/hacks/Utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../mathlib/math_pfns.h" 3 | #include "../tier0/Color.h" 4 | #include "../globals.hpp" 5 | #include "../engine/vmatrix.h" 6 | #include "../tier0/Vector.h" 7 | #include "../client/C_BaseCombatWeapon.h" 8 | 9 | /*bool WorldToScreen(Vector in, Vector& out) 10 | { 11 | return !IVDebugOverlay->ScreenPosition(in, out); 12 | }*/ 13 | bool WorldToScreen(Vector in, Vector& out) 14 | { 15 | auto matrix = Globals::viewMatr.load().m; 16 | 17 | float w = matrix[3][0] * in.x + matrix[3][1] * in.y + matrix[3][2] * in.z + matrix[3][3]; 18 | if (w > 0.001f) 19 | { 20 | float fl1DBw = 1 / w; 21 | out.x = (Globals::screenWidth / 2) + (0.5f * ((matrix[0][0] * in.x + matrix[0][1] * in.y + matrix[0][2] * in.z + matrix[0][3]) * fl1DBw) * Globals::screenWidth + 0.5f); 22 | out.y = (Globals::screenHeight / 2) - (0.5f * ((matrix[1][0] * in.x + matrix[1][1] * in.y + matrix[1][2] * in.z + matrix[1][3]) * fl1DBw) * Globals::screenHeight + 0.5f); 23 | return true; 24 | } 25 | return false; 26 | } 27 | 28 | const char* GetLuaEntBase(C_BaseCombatWeapon* _this) 29 | { 30 | if (!Lua || !_this->UsesLua()) 31 | return ""; 32 | _this->PushEntity(); 33 | Lua->GetField(-1, "Base"); 34 | const char* out = ""; 35 | if (Lua->IsType(-1, LuaObjectType::STRING)) 36 | out = Lua->GetString(-1, NULL); 37 | Lua->Pop(2); 38 | return out; 39 | } 40 | 41 | double GetLuaWeaponDamage(C_BaseCombatWeapon* _this) 42 | { 43 | if (!Lua || !_this->UsesLua()) 44 | return 0.f; 45 | double damage = 1.f; 46 | int topop = 3; 47 | _this->PushEntity(); 48 | Lua->GetField(-1, "Primary"); 49 | if (!Lua->IsType(-1, LuaObjectType::TABLE)) 50 | { 51 | --topop; 52 | Lua->Pop(1); 53 | } 54 | Lua->GetField(-1, "Damage"); 55 | if (Lua->IsType(-1, LuaObjectType::NUMBER)) 56 | { 57 | damage = Lua->GetNumber(-1); 58 | } 59 | Lua->Pop(topop); 60 | 61 | return damage; 62 | } 63 | 64 | const char* GetLuaEntName(C_BaseCombatWeapon* _this) 65 | { 66 | if (!Lua || !_this->UsesLua()) 67 | return ""; 68 | _this->PushEntity(); 69 | Lua->GetField(-1, "PrintName"); 70 | const char* out = ""; 71 | if (Lua->IsType(-1, LuaObjectType::STRING)) 72 | out = Lua->GetString(-1, NULL); 73 | Lua->Pop(2); 74 | return out; 75 | } 76 | 77 | ButtonCode_t VKToButtonCode(int input) 78 | { 79 | return InputSystem->VirtualKeyToButtonCode(input); 80 | }; 81 | 82 | #define getKeyState(key, style, out)\ 83 | {\ 84 | static bool toggleState = false; \ 85 | static bool lastButtonState = false;\ 86 | bool tempButtonState = false;\ 87 | \ 88 | switch (style)\ 89 | {\ 90 | case 0:\ 91 | *out = true;\ 92 | break;\ 93 | case 1:\ 94 | *out = InputSystem->IsButtonDown(key) && !MatSystemSurface->IsCursorVisible();\ 95 | break;\ 96 | case 2:\ 97 | tempButtonState = InputSystem->IsButtonDown(key) && !MatSystemSurface->IsCursorVisible();\ 98 | if (tempButtonState != lastButtonState && tempButtonState)\ 99 | toggleState = !toggleState;\ 100 | lastButtonState = tempButtonState;\ 101 | *out = toggleState;\ 102 | break;\ 103 | case 3:\ 104 | *out = false;\ 105 | break;\ 106 | }\ 107 | } 108 | 109 | const char* IntToBoneName(int input) 110 | { 111 | // https://wiki.facepunch.com/gmod/Entity:GetBoneName 112 | switch (Settings::Aimbot::aimbotHitbox) 113 | { 114 | case 0: 115 | return "ValveBiped.Bip01_Head1"; 116 | case 1: 117 | return "ValveBiped.Bip01_Spine2"; // chest 118 | case 2: 119 | return "ValveBiped.Bip01_Pelvis"; // stomach 120 | } 121 | return ""; 122 | } 123 | std::wstring StringToWString(std::string input) 124 | { 125 | return std::wstring(input.begin(), input.end()); 126 | } 127 | 128 | mstudiobone_t* Studio_BoneIndexByName(studiohdr_t* pStudioHdr, char const* pName, int* outIndex = NULL) 129 | { 130 | int start = 0, end = pStudioHdr->numbones - 1; 131 | const BYTE* pBoneTable = pStudioHdr->GetBoneTableSortedByName(); 132 | mstudiobone_t* pbones = pStudioHdr->pBone(0); 133 | 134 | while (start <= end) 135 | { 136 | int mid = (start + end) >> 1; 137 | const char* boneName = pbones[pBoneTable[mid]].pszName(); 138 | int cmp = strcmp(boneName, pName); 139 | 140 | if (cmp < 0) 141 | { 142 | start = mid + 1; 143 | } 144 | else if (cmp > 0) 145 | { 146 | end = mid - 1; 147 | } 148 | else 149 | { 150 | if(outIndex != NULL) 151 | *outIndex = pBoneTable[mid]; 152 | 153 | return pStudioHdr->pBone(pBoneTable[mid]); 154 | } 155 | } 156 | return nullptr; 157 | } 158 | 159 | 160 | int GetUserId(int entListIndex) 161 | { 162 | player_info_s info; 163 | EngineClient->GetPlayerInfo(entListIndex, &info); 164 | return info.userID; 165 | } 166 | const char* GetSteamID(int entListIndex) 167 | { 168 | player_info_s info; 169 | EngineClient->GetPlayerInfo(entListIndex, &info); 170 | return info.guid; 171 | } 172 | 173 | #include "../Memory.h" 174 | 175 | const char* GetClassName(C_BasePlayer* _this) 176 | { 177 | // I had to pattern this as the game simply decided not to put it in C_BasePlayer. 178 | const char* out = ""; 179 | static _GetClassName getClassName = (_GetClassName)(GetRealFromRelative((char*)findPattern("client", GetClassNamePattern, "GetClassName"), 1, 5, true)); 180 | 181 | return getClassName(_this); 182 | 183 | } 184 | 185 | double LuaMathRand(double min, double max){ 186 | if (!Lua) return 0.; 187 | Lua->PushSpecial(0); // SPECIAL_GLOB 188 | Lua->GetField(-1, "math"); 189 | Lua->GetField(-1, "Rand"); 190 | Lua->PushNumber(min); 191 | Lua->PushNumber(max); 192 | Lua->Call(2, 1); 193 | double retVal = (double)Lua->GetNumber(-1); 194 | Lua->Pop(3); 195 | return retVal; 196 | } 197 | void LuaMathSetSeed(double seed){ 198 | if (!Lua) return; 199 | Lua->PushSpecial(0); // SPECIAL_GLOB 200 | Lua->GetField(-1, "math"); 201 | Lua->GetField(-1, "randomseed"); 202 | Lua->PushNumber(seed); 203 | Lua->Call(1, 0); 204 | Lua->Pop(2); 205 | } 206 | double LuaCurTime() 207 | { 208 | if (!Lua) return 0.; 209 | Lua->PushSpecial(0); // SPECIAL_GLOB 210 | Lua->GetField(-1, "CurTime"); 211 | Lua->Call(0, 1); 212 | double curTime = Lua->GetNumber(-1); 213 | Lua->Pop(2); 214 | return curTime; 215 | } -------------------------------------------------------------------------------- /GMod-SDK/hacks/menu/MenuControls.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../ImGui/imgui.h" 3 | 4 | void ColorPicker(const char* name, Color* color, bool alpha) { 5 | 6 | ImGuiStyle* style = &ImGui::GetStyle(); 7 | auto alphaSliderFlag = alpha ? ImGuiColorEditFlags_AlphaBar : ImGuiColorEditFlags_NoAlpha; 8 | ImGui::SameLine(219.f); 9 | ImGui::ColorEdit4(std::string{ "##" }.append(name).append("Picker").c_str(), color->fCol, alphaSliderFlag | ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoTooltip, &color->rainbow); 10 | } 11 | 12 | 13 | namespace Menu { 14 | const void InsertSpacer(const char* label) { 15 | ImGui::BeginChild(label, ImVec2(210.f, 18.f), false); ImGui::EndChild(); 16 | } 17 | const void InsertGroupboxSpacer(const char* label) { 18 | ImGui::BeginChild(label, ImVec2(210.f, 9.f), false); ImGui::EndChild(); 19 | } 20 | const void InsertGroupboxTitle(const char* label) { 21 | ImGui::Spacing(); ImGui::NewLine(); ImGui::SameLine(11.f); ImGui::GroupBoxTitle(label); 22 | } 23 | 24 | const void InsertGroupBoxLeft(const char* label, float y) { 25 | ImGui::NewLine(); ImGui::SameLine(19.f); ImGui::BeginGroupBox(label, ImVec2(258.f, y), true); 26 | } 27 | const void InsertGroupBoxRight(const char* label, float y) { 28 | ImGui::NewLine(); ImGui::SameLine(10.f); ImGui::BeginGroupBox(label, ImVec2(258.f, y), true); 29 | } 30 | const void InsertEndGroupBoxLeft(const char* label, const char* y) { 31 | ImGui::EndGroupBox(); ImGui::SameLine(19.f); ImGui::BeginGroupBoxScroll(label, y, ImVec2(258.f, 11.f), true); ImGui::EndGroupBoxScroll(); 32 | } 33 | const void InsertEndGroupBoxRight(const char* label, const char* y) { 34 | ImGui::EndGroupBox(); ImGui::SameLine(10.f); ImGui::BeginGroupBoxScroll(label, y, ImVec2(258.f, 11.f), true); ImGui::EndGroupBoxScroll(); 35 | } 36 | 37 | const void InsertGroupBoxLarge(const char* label, float y) { 38 | ImGui::NewLine(); ImGui::SameLine(19.f); ImGui::BeginGroupBox(label, ImVec2(526.f, y), true); 39 | } 40 | const void InsertEndGroupBoxLarge(const char* label, const char* groupboxName) { 41 | ImGui::EndGroupBox(); ImGui::SameLine(19.f); ImGui::BeginGroupBoxScroll(label, groupboxName, ImVec2(526.f, 11.f), true); ImGui::EndGroupBoxScroll(); 42 | } 43 | 44 | const void InsertGroupBoxTop(const char* label, ImVec2& size) { 45 | ImGui::NewLine(); ImGui::SameLine(19.f); ImGui::BeginGroupBox(label, size, true); 46 | } 47 | const void InsertEndGroupBoxTop(const char* label, const char* groupboxName, ImVec2& size) { 48 | ImGui::EndGroupBox(); ImGui::SameLine(19.f); ImGui::BeginGroupBoxScroll(label, groupboxName, size, true); ImGui::EndGroupBoxScroll(); 49 | } 50 | 51 | const void InsertCheckbox(const char* label, bool* button) { 52 | ImGui::Spacing(); ImGui::NewLine(); ImGui::SameLine(19.f); ImGui::Checkbox(label, button); 53 | } 54 | const void InsertSlider(const char* label, float* fl, float v_min, float v_max, const char* format = "%.f") { 55 | ImGui::Spacing(); ImGui::NewLine(); ImGui::NewLine(); ImGui::SameLine(42.f); ImGui::PushItemWidth(159.f); ImGui::SliderFloat(label, fl, v_min, v_max, format); ImGui::PopItemWidth(); 56 | } 57 | 58 | const void InsertSliderWithoutText(const char* label, float *v, float v_min, float v_max, const char* format = "%.f") 59 | { 60 | ImGui::Spacing(); 61 | ImGui::Spacing(); 62 | ImGui::NewLine(); 63 | ImGui::SameLine(42.f); 64 | ImGui::PushItemWidth(159.f); 65 | ImGui::SliderFloat(label, v, v_min, v_max, format); 66 | ImGui::PopItemWidth(); 67 | } 68 | 69 | 70 | const void InsertCombo(const char* label, int* current_item, const char* const items[], int size) { 71 | ImGui::Spacing(); ImGui::NewLine(); ImGui::NewLine(); ImGui::SameLine(42.f); ImGui::PushItemWidth(158.f); ImGui::Combo(label, current_item, items, size); ImGui::PopItemWidth(); ImGui::CustomSpacing(1.f); 72 | } 73 | const void InsertComboMiddle(const char* label, int* current_item, const char* const items[], int size) { 74 | ImGui::Spacing(); ImGui::NewLine(); ImGui::NewLine(); ImGui::SameLine(50.f); ImGui::PushItemWidth(158.f); ImGui::Combo(label, current_item, items, size); ImGui::PopItemWidth(); ImGui::CustomSpacing(1.f); 75 | } 76 | 77 | const void InsertComboColor(const char* label, int* current_item, const char* const items[], int size, Color* col, bool alpha) { 78 | ImGui::Spacing(); ImGui::NewLine(); ImGui::NewLine(); ImGui::SameLine(42.f); ImGui::PushItemWidth(158.f); ImGui::Combo(label, current_item, items, size); ImGui::PopItemWidth(); ImGui::SameLine(1.f); ColorPicker(label, col, alpha); 79 | } 80 | const void InsertComboWithoutText(const char* label, int* current_item, const char* items[], int size) { 81 | ImGui::Spacing(); ImGui::NewLine(); ImGui::SameLine(42.f); ImGui::PushItemWidth(158.f); ImGui::Combo(label, current_item, items, size); ImGui::PopItemWidth(); ImGui::CustomSpacing(1.f); 82 | } 83 | const void InsertMultiCombo(const char* label, const char** displayName, bool* data, int dataSize) { 84 | ImGui::Spacing(); ImGui::NewLine(); ImGui::NewLine(); ImGui::SameLine(42.f); ImGui::PushItemWidth(158.f); ImGui::MultiCombo(label, displayName, data, dataSize); ImGui::PopItemWidth(); ImGui::CustomSpacing(1.f); 85 | } 86 | const void InsertMultiComboWithoutText(const char* label, const char** displayName, bool* data, int dataSize) { 87 | ImGui::Spacing(); ImGui::NewLine(); ImGui::SameLine(42.f); ImGui::PushItemWidth(158.f); ImGui::MultiCombo(label, displayName, data, dataSize); ImGui::PopItemWidth(); ImGui::CustomSpacing(1.f); 88 | } 89 | 90 | const void InsertButton(const char* label) { 91 | ImGui::Spacing(); ImGui::NewLine(); ImGui::NewLine(); ImGui::SameLine(42.f); ImGui::PushItemWidth(158.f); ImGui::Button(label, ImVec2(158.f, 0)); ImGui::PopItemWidth(); ImGui::CustomSpacing(1.f); 92 | } 93 | 94 | const void InsertButtonLeft(const char* label, bool& button) { 95 | ImGui::Spacing(); ImGui::NewLine(); ImGui::NewLine(); ImGui::SameLine(19.f); ImGui::PushItemWidth(158.f); button = ImGui::Button(label, ImVec2(158.f, 0)); ImGui::PopItemWidth(); 96 | } 97 | 98 | const void InsertButtonSameline(const char* label, bool& button) { 99 | ImGui::SameLine(); ImGui::PushItemWidth(158.f); button = ImGui::Button(label, ImVec2(158.f, 0)); ImGui::PopItemWidth(); 100 | } 101 | 102 | const void InsertButtonMiddle(const char* label, bool& button) { 103 | ImGui::Spacing(); ImGui::NewLine(); ImGui::NewLine(); ImGui::SameLine(50.f); ImGui::PushItemWidth(158.f); button = ImGui::Button(label, ImVec2(158.f, 0)); ImGui::PopItemWidth(); ImGui::CustomSpacing(1.f); 104 | } 105 | 106 | const void InsertText(const char* label) { 107 | ImGui::Spacing(); ImGui::NewLine(); ImGui::SameLine(42.f); ImGui::Text(label); 108 | } 109 | const void InsertMultiTextInput(const char* label, char* buf, int bufSize, float x, float y) { 110 | ImGui::Spacing(); ImGui::NewLine(); ImGui::NewLine(); ImGui::SameLine(19.f); ImGui::PushItemWidth(158.f); ImGui::InputTextMultiline(label, buf, bufSize, ImVec2(x, y), ImGuiInputTextFlags_AllowTabInput); ImGui::PopItemWidth(); 111 | } 112 | const void InsertColorPicker(const char* label, Color *col, bool alpha) { 113 | ImGui::SameLine(219.f); ColorPicker(label, col, alpha); 114 | } 115 | const void InsertComboColorPicker(const char* label, Color *col, bool alpha) { 116 | ImGui::SameLine(1.f); ColorPicker(label, col, alpha); 117 | } 118 | 119 | } -------------------------------------------------------------------------------- /GMod-SDK/hooks/CreateMove.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../globals.hpp" 4 | #include "../client/usercmd.h" 5 | #include "../tier0/Vector.h" 6 | #include "../hacks/AntiAim.h" 7 | #include "../hacks/LegitAim.h" 8 | #include "../hacks/GunHacks.h" 9 | #include "../hacks/Triggerbot.h" 10 | #include "../hacks/Misc.h" 11 | #include "../hacks/Prediction.h" 12 | 13 | typedef bool(__thiscall* _CreateMove)(ClientModeShared*, float, CUserCmd*); 14 | _CreateMove oCreateMove; 15 | 16 | bool __fastcall hkCreateMove(ClientModeShared* ClientMode, 17 | #ifndef _WIN64 18 | void*, // __fastcall does literally nothing in x64, so that's why we make it inactive 19 | #endif 20 | float flInputSampleTime, CUserCmd* cmd) 21 | { 22 | Globals::lastCmd = *cmd; 23 | 24 | localPlayer = (C_BasePlayer*)ClientEntityList->GetClientEntity(EngineClient->GetLocalPlayer()); 25 | *Globals::bSendpacket = true; 26 | if (localPlayer && localPlayer->IsAlive() && !Settings::currentlyInFreeCam && cmd->tick_count != 0) 27 | { 28 | DoMisc(cmd); 29 | Globals::lastRealCmd = *cmd; 30 | if (cmd->tick_count != 0xFFFFF) 31 | { 32 | PrePrediction(cmd); 33 | StartPrediction(cmd); 34 | BackupCMD(cmd, false); 35 | PostPrediction(cmd); 36 | 37 | C_BaseCombatWeapon* currWeapon = localPlayer->GetActiveWeapon(); 38 | 39 | bool inCombat = false; 40 | if (currWeapon && !currWeapon->UsesLua()) 41 | { 42 | if ((cmd->buttons & IN_ATTACK) && 43 | (currWeapon->NextPrimaryAttack() <= GlobalVars->curtime) && 44 | (currWeapon->PrimaryAmmoCount() > 0)) 45 | inCombat = true; 46 | else inCombat = false; 47 | } 48 | else inCombat = (cmd->buttons & IN_ATTACK); 49 | 50 | if (Settings::AntiAim::enableAntiAim && !inCombat) { 51 | bool antiAimKeyDown; 52 | getKeyState(Settings::AntiAim::antiAimKey, Settings::AntiAim::antiAimKeyStyle, &antiAimKeyDown, henlo1, henlo2, henlo3); 53 | if (antiAimKeyDown) 54 | { 55 | AntiAimPitch(cmd, Settings::AntiAim::currentAntiAimPitch); 56 | AntiAimYaw(cmd, Settings::AntiAim::currentAntiAimYaw); 57 | } 58 | } 59 | 60 | DoLegitAimbot(cmd); 61 | TriggerBot(cmd); 62 | GunHacks(cmd, currWeapon); 63 | 64 | if (currWeapon && currWeapon->SecondaryAmmoCount() > 0 && currWeapon->PrimaryAmmoCount() == 0) 65 | { 66 | cmd->buttons |= IN_RELOAD; 67 | cmd->buttons &= ~(IN_ATTACK | IN_ATTACK2); 68 | } 69 | EndPrediction(cmd); 70 | BackupCMD(cmd, true); 71 | } 72 | } 73 | if (Settings::currentlyInFreeCam) 74 | { 75 | cmd->buttons = NULL; 76 | cmd->forwardmove = cmd->sidemove = cmd->upmove = 0.f; 77 | cmd->viewangles = Globals::lastRealCmd.viewangles; 78 | } 79 | if (!Globals::Untrusted) 80 | cmd->viewangles.FixAngles(); 81 | auto thisCmd = *cmd; 82 | oCreateMove(ClientMode, flInputSampleTime, cmd); 83 | if (Settings::Misc::fakeLag) 84 | { 85 | static int m_nChokedPackets = 0; 86 | bool fakeLagKeyDown = false; 87 | getKeyState(Settings::Misc::fakeLagKey, Settings::Misc::fakeLagKeyStyle, &fakeLagKeyDown, henlo1, henlo2, henlo3); 88 | if (fakeLagKeyDown) 89 | if (m_nChokedPackets < (int)Settings::Misc::fakeLagTicks) 90 | { 91 | *Globals::bSendpacket = false; 92 | ++m_nChokedPackets; 93 | } 94 | else 95 | { 96 | *Globals::bSendpacket = true; 97 | m_nChokedPackets = 0; 98 | } 99 | } 100 | if (*Globals::bSendpacket && cmd->tick_count != 0) 101 | { 102 | Globals::lastNetworkedCmd = thisCmd; 103 | localPlayer->GetClientRenderable()->SetupBones(Globals::lastMatrix, 128, BONE_USED_BY_HITBOX, GlobalVars->curtime); 104 | } 105 | Globals::lastEndCmd = *cmd; 106 | return false; 107 | } -------------------------------------------------------------------------------- /GMod-SDK/hooks/DrawModelExecute.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../globals.hpp" 4 | #include "../client/usercmd.h" 5 | #include "../client/ClientModeShared.h" 6 | #include "../tier0/Vector.h" 7 | #include "../engine/vmatrix.h" 8 | 9 | typedef void(__thiscall* _DrawModelExecute)(CModelRender*, const DrawModelState_t&, const ModelRenderInfo_t*, matrix3x4_t*); 10 | _DrawModelExecute oDrawModelExecute; 11 | 12 | 13 | 14 | void __fastcall hkDrawModelExecute(CModelRender* modelrender, 15 | #ifndef _WIN64 16 | void*, // __fastcall does literally nothing in x64, so that's why we make it inactive 17 | #endif 18 | const DrawModelState_t& state, ModelRenderInfo_t* pInfo, matrix3x4_t* pCustomBoneToWorld = NULL) 19 | { 20 | if (pInfo->entity_index) 21 | { 22 | C_BasePlayer* entity = (C_BasePlayer*)ClientEntityList->GetClientEntity(pInfo->entity_index); 23 | if(!entity || !entity->IsAlive() || (!entity->IsPlayer() && !entity->IsRagdoll() && !entity->IsBaseCombatCharacter() && !entity->IsWeapon() && !entity->IsARagdoll() && (!strstr(pInfo->pModel->name, "models/weapons/") || !Settings::Misc::removeHands))) 24 | return oDrawModelExecute(modelrender, state, pInfo, pCustomBoneToWorld); 25 | chamsSetting setting; 26 | 27 | if (entity == localPlayer) 28 | { 29 | rainbowColor(Settings::Chams::localPlayerChamsSettings.hiddenColor, Settings::Misc::rainbowSpeed); 30 | rainbowColor(Settings::Chams::localPlayerChamsSettings.visibleColor, Settings::Misc::rainbowSpeed); 31 | 32 | setting = Settings::Chams::localPlayerChamsSettings; 33 | } 34 | else if (entity->IsPlayer()) 35 | { 36 | rainbowColor(Settings::Chams::playerChamsSettings.hiddenColor, Settings::Misc::rainbowSpeed); 37 | rainbowColor(Settings::Chams::playerChamsSettings.visibleColor, Settings::Misc::rainbowSpeed); 38 | rainbowColor(Settings::Chams::teamMateSettings.hiddenColor, Settings::Misc::rainbowSpeed); 39 | rainbowColor(Settings::Chams::teamMateSettings.visibleColor, Settings::Misc::rainbowSpeed); 40 | 41 | if(entity->getTeamNum() == localPlayer->getTeamNum()) 42 | setting = Settings::Chams::teamMateSettings; 43 | else setting = Settings::Chams::playerChamsSettings; 44 | } 45 | else if (entity->IsBaseCombatCharacter() && !entity->IsPlayer()) // IF ITS A NPC 46 | { 47 | rainbowColor(Settings::Chams::npcChamsSettings.hiddenColor, Settings::Misc::rainbowSpeed); 48 | rainbowColor(Settings::Chams::npcChamsSettings.visibleColor, Settings::Misc::rainbowSpeed); 49 | setting = Settings::Chams::npcChamsSettings; 50 | } 51 | else if (entity->IsRagdoll() || entity->IsARagdoll()) // Isragdoll = ragdoll entity, isaragdoll = ragdolled player cuz dead 52 | { 53 | rainbowColor(Settings::Chams::ragdollChamsSettings.hiddenColor, Settings::Misc::rainbowSpeed); 54 | rainbowColor(Settings::Chams::ragdollChamsSettings.visibleColor, Settings::Misc::rainbowSpeed); 55 | setting = Settings::Chams::ragdollChamsSettings; 56 | } 57 | else if (entity->IsWeapon()) 58 | { 59 | rainbowColor(Settings::Chams::weaponChamsSettings.hiddenColor, Settings::Misc::rainbowSpeed); 60 | rainbowColor(Settings::Chams::weaponChamsSettings.visibleColor, Settings::Misc::rainbowSpeed); 61 | setting = Settings::Chams::weaponChamsSettings; 62 | } 63 | else if (!entity->IsWeapon() && strstr(pInfo->pModel->name, "models/weapons/") && Settings::Misc::removeHands) 64 | { 65 | return; 66 | } 67 | else { 68 | return oDrawModelExecute(modelrender, state, pInfo, pCustomBoneToWorld); 69 | } 70 | 71 | IMaterial* DebugWhite = MaterialSystem->FindMaterial("models/debug/debugwhite", TEXTURE_GROUP_MODEL); 72 | DebugWhite->AddRef(); // that's so the game loads it, if 0 stuff on the map uses this texture, the game will simply unload it 73 | 74 | bool didDraw = false; 75 | if (entity == localPlayer && Settings::Chams::netLocalChamsSettings.visibleMaterial && Globals::lastNetworkedCmd.command_number) // ghetto asf... 76 | { 77 | if (Settings::Chams::netLocalChamsSettings.visibleMaterial == 1) 78 | DebugWhite->SetMaterialVarFlag(MATERIAL_VAR_SELFILLUM, false); 79 | else if (Settings::Chams::netLocalChamsSettings.visibleMaterial == 2) 80 | DebugWhite->SetMaterialVarFlag(MATERIAL_VAR_SELFILLUM, true); 81 | 82 | RenderView->SetBlend(Settings::Chams::netLocalChamsSettings.visibleColor.fCol[3]); 83 | RenderView->SetColorModulation(Settings::Chams::netLocalChamsSettings.hiddenColor.fCol); 84 | modelrender->ForcedMaterialOverride(DebugWhite); //entity->SetMaterialOverridePointer(DebugWhite); <- this works too 85 | 86 | 87 | oDrawModelExecute(modelrender, state, pInfo, Globals::lastMatrix); 88 | } 89 | 90 | if (setting.hiddenMaterial) 91 | { 92 | didDraw = true; 93 | DebugWhite->SetMaterialVarFlag(MATERIAL_VAR_IGNOREZ, true); // xqz = true, normal = false 94 | 95 | if(setting.hiddenMaterial == 1) 96 | DebugWhite->SetMaterialVarFlag(MATERIAL_VAR_SELFILLUM, false); 97 | else if(setting.hiddenMaterial == 2) 98 | DebugWhite->SetMaterialVarFlag(MATERIAL_VAR_SELFILLUM, true); 99 | 100 | RenderView->SetBlend(setting.visibleColor.fCol[3]); 101 | RenderView->SetColorModulation(setting.hiddenColor.fCol); 102 | modelrender->ForcedMaterialOverride(DebugWhite); //entity->SetMaterialOverridePointer(DebugWhite); <- this works too 103 | oDrawModelExecute(modelrender, state, pInfo, pCustomBoneToWorld); 104 | } 105 | if (setting.visibleMaterial) 106 | { 107 | didDraw = true; 108 | DebugWhite->SetMaterialVarFlag(MATERIAL_VAR_IGNOREZ, false); // xqz = true, normal = false 109 | 110 | if (setting.visibleMaterial == 1) 111 | DebugWhite->SetMaterialVarFlag(MATERIAL_VAR_SELFILLUM, false); 112 | else if (setting.visibleMaterial == 2) 113 | DebugWhite->SetMaterialVarFlag(MATERIAL_VAR_SELFILLUM, true); 114 | 115 | RenderView->SetBlend(setting.visibleColor.fCol[3]); 116 | RenderView->SetColorModulation(setting.visibleColor.fCol); 117 | modelrender->ForcedMaterialOverride(DebugWhite); //entity->SetMaterialOverridePointer(DebugWhite); <- this works too but i prefer forcedmaterialoverride /shrug 118 | oDrawModelExecute(modelrender, state, pInfo, pCustomBoneToWorld); 119 | } 120 | 121 | DebugWhite->SetMaterialVarFlag(MATERIAL_VAR_IGNOREZ, false); 122 | DebugWhite->SetMaterialVarFlag(MATERIAL_VAR_SELFILLUM, false); 123 | 124 | RenderView->SetBlend(1.f); 125 | RenderView->SetColorModulation(Color(255, 255, 255).fCol); 126 | modelrender->ForcedMaterialOverride(nullptr); 127 | if (!didDraw) 128 | oDrawModelExecute(modelrender, state, pInfo, pCustomBoneToWorld); 129 | return; 130 | } 131 | return oDrawModelExecute(modelrender, state, pInfo, pCustomBoneToWorld); 132 | } -------------------------------------------------------------------------------- /GMod-SDK/hooks/FrameStageNotify.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../globals.hpp" 4 | #include "../client/usercmd.h" 5 | #include 6 | 7 | typedef void(__thiscall* _FrameStageNotify)(CHLClient*, ClientFrameStage_t); 8 | _FrameStageNotify oFrameStageNotify; 9 | 10 | void __fastcall hkFrameStageNotify(CHLClient* client, 11 | #ifndef _WIN64 12 | void*, // __fastcall does literally nothing in x64, so that's why we make it inactive 13 | #endif 14 | ClientFrameStage_t stage) 15 | { 16 | 17 | localPlayer = (C_BasePlayer*)ClientEntityList->GetClientEntity(EngineClient->GetLocalPlayer()); 18 | 19 | static ConVar* fullbrightCvar = CVar->FindVar("mat_fullbright"); 20 | if (fullbrightCvar && fullbrightCvar->intValue != Settings::Visuals::fullBright) { 21 | if (Settings::Visuals::fullBright) 22 | fullbrightCvar->RemoveFlags(FCVAR_CHEAT); 23 | else fullbrightCvar->AddFlags(FCVAR_CHEAT); 24 | fullbrightCvar->SetValue(Settings::Visuals::fullBright); 25 | } 26 | if (Settings::Misc::svAllowCsLua && !spoofedAllowCsLua) { 27 | spoofedAllowCsLua = new SpoofedConVar(CVar->FindVar("sv_allowcslua")); 28 | spoofedAllowCsLua->m_pOriginalCVar->DisableCallback(); 29 | }if (Settings::Misc::svCheats && !spoofedCheats) { 30 | spoofedCheats = new SpoofedConVar(CVar->FindVar("sv_cheats")); 31 | spoofedCheats->m_pOriginalCVar->DisableCallback(); 32 | } 33 | 34 | if (spoofedAllowCsLua && spoofedAllowCsLua->m_pOriginalCVar->intValue != Settings::Misc::svAllowCsLua) spoofedAllowCsLua->m_pOriginalCVar->SetValue(Settings::Misc::svAllowCsLua); 35 | if (spoofedCheats && spoofedCheats->m_pOriginalCVar->intValue != Settings::Misc::svCheats) spoofedCheats->m_pOriginalCVar->SetValue(Settings::Misc::svCheats); 36 | 37 | //Input->cameraoffset 38 | 39 | if(Settings::Visuals::noVisualRecoil && localPlayer && localPlayer->IsAlive()) 40 | { 41 | //https://i.imgur.com/Y5hSyqS.png 42 | if (Settings::Visuals::noVisualRecoil) 43 | localPlayer->GetViewPunch() = QAngle(0, 0, 0); 44 | } 45 | 46 | // i guess this enum's wrong as norecoil in renderstart didnt work at all 47 | if (false && stage == ClientFrameStage_t::FRAME_RENDER_START) 48 | { 49 | 50 | // do thirdperson 51 | } 52 | static bool appliedNightMode = false; 53 | static bool waitingForLoadingEnd = false; 54 | static bool lastNightModeState = false; 55 | static Color lastNightModeColor = Color(255, 255, 255); 56 | if (lastNightModeState != Settings::Visuals::changeWorldColor || lastNightModeColor != Settings::Visuals::worldColor) 57 | { 58 | lastNightModeColor = Settings::Visuals::worldColor; 59 | lastNightModeState = Settings::Visuals::changeWorldColor; 60 | appliedNightMode = false; 61 | } 62 | 63 | if (EngineClient->IsDrawingLoadingImage()) 64 | { 65 | waitingForLoadingEnd = true; 66 | } 67 | else if (waitingForLoadingEnd) { 68 | appliedNightMode = false; 69 | waitingForLoadingEnd = false; 70 | } 71 | 72 | if (!waitingForLoadingEnd && stage == ClientFrameStage_t::FRAME_RENDER_END) 73 | { 74 | for (MaterialHandle_t i = MaterialSystem->FirstMaterial(); i != MaterialSystem->InvalidMaterial(); i = MaterialSystem->NextMaterial(i)) 75 | { 76 | auto material = MaterialSystem->GetMaterial(i); 77 | if (!material || material->IsErrorMaterial() || !material->IsPrecached()) 78 | continue; 79 | // that's quite a big FPS killer 80 | #pragma region WorldColor 81 | if (!strcmp(material->GetTextureGroupName(), TEXTURE_GROUP_WORLD)) 82 | { 83 | if (Settings::Visuals::changeWorldColor && !appliedNightMode) 84 | { 85 | material->AlphaModulate(Settings::Visuals::worldColor.fCol[3]); 86 | material->ColorModulate(Settings::Visuals::worldColor.fCol[0], Settings::Visuals::worldColor.fCol[1], Settings::Visuals::worldColor.fCol[2]); 87 | } 88 | else if(!Settings::Visuals::changeWorldColor && !appliedNightMode) 89 | { 90 | material->AlphaModulate(1.f); 91 | material->ColorModulate(1.f, 1.f, 1.f); 92 | } 93 | } 94 | #pragma endregion 95 | 96 | } 97 | appliedNightMode = true; 98 | static bool lastSkyBox = false; 99 | if (Settings::Visuals::disableSkyBox != lastSkyBox) 100 | { 101 | lastSkyBox = Settings::Visuals::disableSkyBox; 102 | if (lastSkyBox) 103 | { 104 | EngineClient->ClientCmd("r_3dsky 0"); 105 | } 106 | else { 107 | EngineClient->ClientCmd("r_3dsky 1"); 108 | } 109 | } 110 | } 111 | bool thirdpKeyDown = false; 112 | getKeyState(Settings::Misc::thirdpersonKey, Settings::Misc::thirdpersonKeyStyle, &thirdpKeyDown); 113 | bool freecamKeyDown = false; 114 | getKeyState(Settings::Misc::freeCamKey, Settings::Misc::freeCamKeyStyle, &freecamKeyDown); 115 | 116 | bool needsSetViewAngles = (Settings::Misc::thirdperson && thirdpKeyDown) || (Settings::Misc::freeCam && freecamKeyDown); 117 | 118 | if(needsSetViewAngles && localPlayer && localPlayer->IsAlive() && stage == ClientFrameStage_t::FRAME_RENDER_START) 119 | localPlayer->SetLocalViewAngles(Globals::lastNetworkedCmd.viewangles); 120 | if(oFrameStageNotify) 121 | oFrameStageNotify(client, stage); 122 | if (needsSetViewAngles && localPlayer && localPlayer->IsAlive() && stage == ClientFrameStage_t::FRAME_RENDER_START) 123 | localPlayer->SetLocalViewAngles(Globals::lastRealCmd.viewangles); 124 | return; 125 | } -------------------------------------------------------------------------------- /GMod-SDK/hooks/Paint.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #pragma once 4 | 5 | #include "../globals.hpp" 6 | #include 7 | #include 8 | 9 | enum PaintMode_t 10 | { 11 | PAINT_UIPANELS = (1 << 0), 12 | PAINT_INGAMEPANELS = (1 << 1), 13 | PAINT_CURSOR = (1 << 2) 14 | }; 15 | 16 | typedef void(__thiscall* _Paint)(void*, PaintMode_t); 17 | _Paint oPaint; 18 | 19 | 20 | 21 | void __fastcall hkPaint(void* _this, 22 | #ifndef _WIN64 23 | void*, // __fastcall does literally nothing in x64, so that's why we make it inactive 24 | #endif 25 | PaintMode_t mode) 26 | { 27 | if (mode & 2) 28 | { 29 | vmatrix_t matrix; 30 | memcpy(&matrix, &EngineClient->WorldToScreenMatrix().m, sizeof(vmatrix_t)); 31 | 32 | Globals::viewMatr.store(matrix); 33 | } 34 | return oPaint(_this, mode); 35 | } -------------------------------------------------------------------------------- /GMod-SDK/hooks/PaintTraverse.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../globals.hpp" 4 | 5 | void __fastcall hkPaintTraverse(VPanelWrapper* _this, 6 | #ifndef _WIN64 7 | void*, // __fastcall does literally nothing in x64, so that's why we make it inactive 8 | #endif 9 | VPanel* panel, bool force_repaint, bool allow_force) 10 | { 11 | /* 12 | * Why do this here instead of inside present? 13 | * Because this has the panel argument, which is required to call any functions using the wrapper. 14 | * Why am I using the wrapper and not directly VPanel? 15 | * The panel argument is not actually a pointer to panel, but instead some kind of identifier. 16 | * What does this do? Blocks any form of input while the menu is open, doing only EnableInput(false) will automatically 17 | * set your mouse to the screen's center which is real annoying cause you have to pause the game everytime you open the menu. 18 | */ 19 | 20 | /*vmatrix_t matrix; 21 | memcpy(&matrix, &EngineClient->WorldToScreenMatrix().m, sizeof(vmatrix_t)); 22 | 23 | Globals::viewMatr.store(matrix);*/ 24 | 25 | // there's no real need to run anything outside of this check 26 | // it's not needed to disable input or check for pending lua like 10 times per frame 27 | if (!strcmp(PanelWrapper->GetName(panel), "FocusOverlayPanel")) 28 | { 29 | Globals::lastPanelIdentifier = panel; 30 | PanelWrapper->SetKeyBoardInputEnabled(panel, Globals::openMenu); 31 | PanelWrapper->SetMouseInputEnabled(panel, Globals::openMenu); 32 | InputSystem->EnableInput(!Globals::openMenu); 33 | 34 | auto l = Globals::waitingToBeExecuted.load(); 35 | if (l.first && l.second && oRunStringEx) 36 | { 37 | auto Lua = LuaShared->GetLuaInterface(Globals::executeState * 2); 38 | if (!oRunStringEx(Lua, RandomString(16).c_str(), "", l.second, true, false, false, false)) { 39 | const char* error = Lua->GetString(-1); 40 | static Color red(255, 0, 0); 41 | ConPrint(error, red); 42 | Lua->Pop(); 43 | } 44 | Globals::waitingToBeExecuted.store(std::make_pair(false, nullptr)); 45 | } 46 | } 47 | 48 | oPaintTraverse(_this, panel, force_repaint, allow_force); 49 | } 50 | -------------------------------------------------------------------------------- /GMod-SDK/hooks/ProcessGMODServerToClient.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../engine/inetmessage.h" 5 | 6 | typedef void(__thiscall* _ProcessGMOD_ServerToClient)(void*, CGModNetMessage*); 7 | _ProcessGMOD_ServerToClient oProcessGMOD_ServerToClient; 8 | 9 | 10 | 11 | void __fastcall hkProcessGMOD_ServerToClient(void* _this, 12 | #ifndef _WIN64 13 | void*, // __fastcall does literally nothing in x64, so that's why we make it inactive 14 | #endif 15 | CGModNetMessage* netMsg) 16 | { 17 | //std::cout << netMsg->m_pBuf->GetNumBitsLeft() << " : " << std::endl; 18 | return oProcessGMOD_ServerToClient(_this, netMsg); 19 | } -------------------------------------------------------------------------------- /GMod-SDK/hooks/RenderView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../globals.hpp" 4 | #include "../client/usercmd.h" 5 | #include "../hacks/Misc.h" 6 | #include "../hacks/Utils.h" 7 | 8 | typedef bool(__thiscall* _RenderView)(CViewRender*, CViewSetup&, int, int); 9 | _RenderView oRenderView; 10 | 11 | bool __fastcall hkRenderView(CViewRender* ViewRender, 12 | #ifndef _WIN64 13 | void*, // __fastcall does literally nothing in x64, so that's why we make it inactive 14 | #endif 15 | CViewSetup& view, int nClearFlags, int whatToDraw) 16 | { 17 | bool zoomKeyDown = false; 18 | getKeyState(Settings::Misc::zoomKey, Settings::Misc::zoomKeyStyle, &zoomKeyDown, henlo69, henlo70, henlo71); 19 | 20 | // make this run only if not holding right click for instance to restore fov to what it should be while aiming 21 | if(Settings::Visuals::fovEnabled) 22 | if (zoomKeyDown && Settings::Misc::zoom) 23 | view.fov = Settings::Misc::zoomFOV; 24 | else view.fov = Settings::Visuals::fov; 25 | 26 | //view.angles = Globals::lastCmd.viewangles; 27 | if(Settings::Visuals::viewModelFOV == -1.f) 28 | Settings::Visuals::viewModelFOV = view.fovViewmodel; 29 | 30 | view.fovViewmodel = Settings::Visuals::viewModelFOV; 31 | 32 | static Vector camPos = Vector(0,0,0); 33 | 34 | bool thirdpKeyDown = false; 35 | getKeyState(Settings::Misc::thirdpersonKey, Settings::Misc::thirdpersonKeyStyle, &thirdpKeyDown, henlo1, henlo2, henlo3); 36 | static bool lastThirdPersonState = false; 37 | if (localPlayer && Settings::Misc::thirdperson && thirdpKeyDown) { 38 | lastThirdPersonState = true; 39 | ThirdPerson(view); 40 | view.angles = Globals::lastCmd.viewangles; 41 | 42 | Input->m_fCameraInThirdPerson = true; 43 | } 44 | else { 45 | if (lastThirdPersonState) 46 | Input->m_fCameraInThirdPerson = false; 47 | lastThirdPersonState = false; 48 | 49 | } 50 | 51 | bool freeCamKeyDown = false; 52 | getKeyState(Settings::Misc::freeCamKey, Settings::Misc::freeCamKeyStyle, &freeCamKeyDown, henlo4, henlo5, henlo6); 53 | 54 | static bool lastFreeCamState = false; 55 | if (localPlayer && Settings::Misc::freeCam && freeCamKeyDown) 56 | { 57 | view.angles = Globals::lastCmd.viewangles; 58 | lastFreeCamState = true; 59 | Settings::currentlyInFreeCam = true; 60 | FreeCam(view, camPos); 61 | Input->m_fCameraInThirdPerson = true; 62 | } 63 | else { 64 | if (lastFreeCamState) 65 | { 66 | EngineClient->SetViewAngles(Globals::lastRealCmd.viewangles); 67 | Input->m_fCameraInThirdPerson = false; 68 | } 69 | lastFreeCamState = false; 70 | camPos = Vector(0, 0, 0); 71 | Settings::currentlyInFreeCam = false; 72 | } 73 | 74 | if ((!freeCamKeyDown || !Settings::Misc::freeCam) && (!thirdpKeyDown || !Settings::Misc::thirdperson)) 75 | { 76 | //view.angles = Globals::lastCmd.viewangles; 77 | } 78 | 79 | return oRenderView(ViewRender, view, nClearFlags, whatToDraw); 80 | } -------------------------------------------------------------------------------- /GMod-SDK/hooks/RunCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #pragma once 4 | 5 | #include "../globals.hpp" 6 | #include 7 | #include 8 | 9 | typedef void(__thiscall* _RunCommand)(void*, CBasePlayer*, CUserCmd*, void*); 10 | _RunCommand oRunCommand; 11 | 12 | void __fastcall hkRunCommand(void* _this, 13 | #ifndef _WIN64 14 | void*, // __fastcall does literally nothing in x64, so that's why we make it inactive 15 | #endif 16 | CBasePlayer* player, CUserCmd* ucmd, void* moveHelper) 17 | { 18 | // https://www.unknowncheats.me/forum/2193961-post4.html 19 | if (Settings::Misc::noRecoil) 20 | { 21 | QAngle angle; 22 | EngineClient->GetViewAngles(angle); 23 | oRunCommand(_this, player, ucmd, moveHelper); 24 | EngineClient->SetViewAngles(angle); 25 | } 26 | else oRunCommand(_this, player, ucmd, moveHelper); 27 | } -------------------------------------------------------------------------------- /GMod-SDK/hooks/RunStringEx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #pragma once 4 | 5 | #include "../globals.hpp" 6 | #include "../hacks/ScriptDumper.h" 7 | #include 8 | #include 9 | 10 | 11 | typedef bool(__thiscall* _RunStringEx)(CLuaInterface*, const char*, const char*, const char*, bool, bool, bool, bool); 12 | _RunStringEx oRunStringEx = nullptr; 13 | 14 | bool __fastcall hkRunStringEx(CLuaInterface* _this, 15 | #ifndef _WIN64 16 | void*, // __fastcall does literally nothing in x64, so that's why we make it inactive 17 | #endif 18 | const char* filename, const char* path, const char* stringToRun, bool run, bool printErrors, bool dontPushErrors, bool noReturns) 19 | { 20 | std::optional script = {}; 21 | if (Settings::Misc::scriptDumper) 22 | script = SaveScript(std::string(filename), std::string(stringToRun)); 23 | 24 | return oRunStringEx(_this, filename, path, script.has_value() ? script.value().c_str() : stringToRun, run, printErrors, dontPushErrors, noReturns); 25 | } 26 | 27 | 28 | typedef int (__thiscall* _CloseLuaInterfaceFn)(CLuaShared*, CLuaInterface*); 29 | _CloseLuaInterfaceFn oCloseLuaInterfaceFn; 30 | int __fastcall hkCloseInterfaceLuaFn(CLuaShared* _this, 31 | #ifndef _WIN64 32 | void*, // __fastcall does literally nothing in x64, so that's why we make it inactive 33 | #endif 34 | CLuaInterface* luaInterface) 35 | { 36 | if (luaInterface == Lua) Lua = nullptr; 37 | return oCloseLuaInterfaceFn(_this, luaInterface); 38 | } 39 | 40 | 41 | typedef CLuaInterface* (__thiscall* _CreateLuaInterfaceFn)(CLuaShared*, LuaInterfaceType, bool); 42 | _CreateLuaInterfaceFn oCreateLuaInterfaceFn; 43 | CLuaInterface* __fastcall hkCreateLuaInterfaceFn(CLuaShared* _this, 44 | #ifndef _WIN64 45 | void*, // __fastcall does literally nothing in x64, so that's why we make it inactive 46 | #endif 47 | LuaInterfaceType luaState, bool renew) 48 | { 49 | auto luaInterface = oCreateLuaInterfaceFn(_this, luaState, renew); 50 | if (luaState != LuaInterfaceType::LUA_CLIENT) return luaInterface; 51 | 52 | Lua = luaInterface; 53 | 54 | if(!oRunStringEx) oRunStringEx = VMTHook<_RunStringEx>((PVOID**)Lua, (PVOID)hkRunStringEx, 111, true); 55 | 56 | return Lua; 57 | } -------------------------------------------------------------------------------- /GMod-SDK/lua_shared/CLuaConVars.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Auto reconstructed from vtable block @ 0x000823B8 4 | // from "lua_shared.dylib", by ida_vtables.idc 5 | // Modified VTable dumper script obviously by t.me/Gaztoof. 6 | class CLuaConVars 7 | { 8 | public: 9 | /*0*/ virtual void* Destr() = 0; 10 | /*2*/ virtual void* Init(void) = 0; 11 | /*3*/ virtual void* CreateConVar(char const*, char const*, char const*, int) = 0; 12 | /*4*/ virtual void* CreateConCommand(char const*, char const*, int, void (*)(void const*), int (*)(char const*, char(*)[128])) = 0; 13 | /*5*/ virtual void* DestroyManaged(void) = 0; 14 | /*6*/ virtual void* Cache(char const*, char const*) = 0; 15 | /*7*/ virtual void* ClearCache(void) = 0; 16 | }; -------------------------------------------------------------------------------- /GMod-SDK/lua_shared/CLuaShared.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include "CLuaInterface.h" 5 | // Auto reconstructed from vtable block @ 0x00082B68 6 | // from "lua_shared.dylib", by ida_vtables.idc 7 | // Modified VTable dumper script obviously by t.me/Gaztoof. 8 | enum LuaFindResult 9 | { 10 | IHaveNoIdea 11 | }; 12 | enum class LuaInterfaceType 13 | { 14 | LUA_CLIENT = 0, 15 | LUA_SERVER = 1, 16 | LUA_MENU = 2 17 | }; 18 | 19 | class CLuaShared 20 | { 21 | public: 22 | /*0*/ virtual void* destr1() = 0; 23 | /*2*/ virtual void* Init(void* (*)(char const*, int*), bool, void*, void*) = 0; 24 | /*3*/ virtual void* Shutdown(void) = 0; 25 | /*4*/ virtual void* DumpStats(void) = 0; 26 | /*5*/ virtual CLuaInterface* CreateLuaInterface(unsigned char, bool) = 0; 27 | /*6*/ virtual void* CloseLuaInterface(void*) = 0; 28 | /*7*/ virtual CLuaInterface* GetLuaInterface(unsigned char) = 0; 29 | /*8*/ virtual void LoadFile(std::string const&, std::string const&, bool, bool) = 0; 30 | /*9*/ virtual void* GetCache(std::string const&) = 0; 31 | /*10*/ virtual void* MountLua(char const*) = 0; 32 | /*11*/ virtual void* MountLuaAdd(char const*, char const*) = 0; 33 | /*12*/ virtual void* UnMountLua(char const*) = 0; 34 | /*13*/ virtual void* SetFileContents(char const*, char const*) = 0; 35 | /*14*/ virtual void* SetLuaFindHook(void*) = 0; 36 | /*15*/ virtual void* FindScripts(std::string const&, std::string const&, std::vector &) = 0; 37 | /*16*/ virtual void* GetStackTraces(void) = 0; 38 | /*17*/ virtual void* InvalidateCache(std::string const&) = 0; 39 | /*18*/ virtual void* EmptyCache(void) = 0; 40 | }; -------------------------------------------------------------------------------- /GMod-SDK/mathlib/math_pfns.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //=====================================================================================// 6 | #include "../tier0/Vector.h" 7 | #include 8 | 9 | #ifndef _MATH_PFNS_H_ 10 | #define _MATH_PFNS_H_ 11 | 12 | #if defined( _X360 ) 13 | #include 14 | #endif 15 | 16 | #if !defined( _X360 ) 17 | typedef unsigned char BYTE; 18 | 19 | // These globals are initialized by mathlib and redirected based on available fpu features 20 | extern float (*pfSqrt)(float x); 21 | extern float (*pfRSqrt)(float x); 22 | extern float (*pfRSqrtFast)(float x); 23 | extern void (*pfFastSinCos)(float x, float* s, float* c); 24 | extern float (*pfFastCos)(float x); 25 | 26 | // The following are not declared as macros because they are often used in limiting situations, 27 | // and sometimes the compiler simply refuses to inline them for some reason 28 | #define FastSqrt(x) sqrtf(x) 29 | #define FastRSqrt(x) 1.0f / sqrtf(x) 30 | #define FastRSqrtFast(x) 1.0f / sqrtf(x) 31 | #define FastSinCos(x,s,c) 0 32 | #define FastCos(x) cosf(x) 33 | 34 | #if defined(__i386__) || defined(_M_IX86) 35 | // On x86, the inline FPU or SSE sqrt instruction is faster than 36 | // the overhead of setting up a function call and saving/restoring 37 | // the FPU or SSE register state and can be scheduled better, too. 38 | #undef FastSqrt 39 | #define FastSqrt(x) ::sqrtf(x) 40 | #endif 41 | 42 | #endif // !_X360 43 | 44 | #if defined( _X360 ) 45 | 46 | FORCEINLINE float _VMX_Sqrt(float x) 47 | { 48 | return __fsqrts(x); 49 | } 50 | 51 | FORCEINLINE float _VMX_RSqrt(float x) 52 | { 53 | float rroot = __frsqrte(x); 54 | 55 | // Single iteration NewtonRaphson on reciprocal square root estimate 56 | return (0.5f * rroot) * (3.0f - (x * rroot) * rroot); 57 | } 58 | 59 | FORCEINLINE float _VMX_RSqrtFast(float x) 60 | { 61 | return __frsqrte(x); 62 | } 63 | 64 | FORCEINLINE void _VMX_SinCos(float a, float* pS, float* pC) 65 | { 66 | XMScalarSinCos(pS, pC, a); 67 | } 68 | 69 | FORCEINLINE float _VMX_Cos(float a) 70 | { 71 | return XMScalarCos(a); 72 | } 73 | 74 | // the 360 has fixed hw and calls directly 75 | #define FastSqrt(x) _VMX_Sqrt(x) 76 | #define FastRSqrt(x) _VMX_RSqrt(x) 77 | #define FastRSqrtFast(x) _VMX_RSqrtFast(x) 78 | #define FastSinCos(x,s,c) _VMX_SinCos(x,s,c) 79 | #define FastCos(x) _VMX_Cos(x) 80 | 81 | #endif // _X360 82 | 83 | /*struct cplane_t 84 | { 85 | float normal[3]; 86 | float dist; 87 | BYTE type; // for fast side tests 88 | BYTE signbits; // signx + (signy<<1) + (signz<<1) 89 | BYTE pad[2]; 90 | 91 | #ifdef VECTOR_NO_SLOW_OPERATIONS 92 | cplane_t() {} 93 | 94 | private: 95 | // No copy constructors allowed if we're in optimal mode 96 | cplane_t(const cplane_t& vOther); 97 | #endif 98 | }; 99 | 100 | // structure offset for asm code 101 | #define CPLANE_NORMAL_X 0 102 | #define CPLANE_NORMAL_Y 4 103 | #define CPLANE_NORMAL_Z 8 104 | #define CPLANE_DIST 12 105 | #define CPLANE_TYPE 16 106 | #define CPLANE_SIGNBITS 17 107 | #define CPLANE_PAD0 18 108 | #define CPLANE_PAD1 19*/ 109 | 110 | 111 | const float PI = 3.141592654f; 112 | inline constexpr float DEG2RAD(float fDegrees) { return fDegrees * (PI / 180.0f); } 113 | inline constexpr float RAD2DEG(float fRadians) { return fRadians * (180.0f / PI); } 114 | inline constexpr float ANG2DEG(float fAngle) { if (fAngle < 0.f) return fAngle + 360.f; else return fAngle; } 115 | 116 | 117 | #endif // _MATH_PFNS_H_ -------------------------------------------------------------------------------- /GMod-SDK/tier0/Color.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | struct Color 5 | { 6 | uint8_t color[4]; 7 | float fCol[4]; 8 | int r, g, b, a; 9 | bool rainbow; 10 | 11 | Color(uint8_t R, uint8_t G, uint8_t B, uint8_t A) { 12 | color[0] = R; 13 | color[1] = G; 14 | color[2] = B; 15 | color[3] = A; 16 | r = R; g = G; b = B; a = A; 17 | fCol[0] = (float)R/255.f; fCol[1] = (float)G / 255.f; fCol[2] = (float)B / 255.f; fCol[3] = (float)A / 255.f; 18 | rainbow = false; 19 | } 20 | Color(uint8_t R, uint8_t G, uint8_t B) { 21 | color[0] = R; 22 | color[1] = G; 23 | color[2] = B; 24 | color[3] = 255; 25 | r = R; g = G; b = B; a = 255; 26 | fCol[0] = (float)R / 255.f; fCol[1] = (float)G / 255.f; fCol[2] = (float)B / 255.f; fCol[3] = 1.f; 27 | rainbow = false; 28 | } 29 | bool operator == (const Color& other) 30 | { 31 | return fCol[0] == other.fCol[0] && fCol[1] == other.fCol[1] && fCol[2] == other.fCol[2] && fCol[3] == other.fCol[3]; 32 | } 33 | bool operator != (const Color& other) 34 | { 35 | return !(*this == other); 36 | } 37 | static Color FromHSB(float hue, float saturation, float brightness) 38 | { 39 | float h = hue == 1.0f ? 0 : hue * 6.0f; 40 | float f = h - (int)h; 41 | float p = brightness * (1.0f - saturation); 42 | float q = brightness * (1.0f - saturation * f); 43 | float t = brightness * (1.0f - (saturation * (1.0f - f))); 44 | 45 | if (h < 1) 46 | { 47 | return Color( 48 | (uint8_t)(brightness * 255), 49 | (uint8_t)(t * 255), 50 | (uint8_t)(p * 255) 51 | ); 52 | } 53 | else if (h < 2) 54 | { 55 | return Color( 56 | (uint8_t)(q * 255), 57 | (uint8_t)(brightness * 255), 58 | (uint8_t)(p * 255) 59 | ); 60 | } 61 | else if (h < 3) 62 | { 63 | return Color( 64 | (uint8_t)(p * 255), 65 | (uint8_t)(brightness * 255), 66 | (uint8_t)(t * 255) 67 | ); 68 | } 69 | else if (h < 4) 70 | { 71 | return Color( 72 | (uint8_t)(p * 255), 73 | (uint8_t)(q * 255), 74 | (uint8_t)(brightness * 255) 75 | ); 76 | } 77 | else if (h < 5) 78 | { 79 | return Color( 80 | (uint8_t)(t * 255), 81 | (uint8_t)(p * 255), 82 | (uint8_t)(brightness * 255) 83 | ); 84 | } 85 | else 86 | { 87 | return Color( 88 | (uint8_t)(brightness * 255), 89 | (uint8_t)(p * 255), 90 | (uint8_t)(q * 255) 91 | ); 92 | } 93 | } 94 | // wip 95 | /*void RandomizeIfNeeded() 96 | { 97 | if (rainbow) 98 | { 99 | static float rainbowFl; 100 | rainbowFl += 0.005f; 101 | if (rainbowFl > 1.f) rainbowFl = 0.f; 102 | *this = FromHSB(rainbowFl, 1.f, 1.f); 103 | } 104 | }*/ 105 | }; -------------------------------------------------------------------------------- /GMod-SDK/tier0/soundinfo.h: -------------------------------------------------------------------------------- 1 | //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //=============================================================================// 6 | 7 | #ifndef SOUNDINFO_H 8 | #define SOUNDINFO_H 9 | 10 | #ifdef _WIN32 11 | #pragma once 12 | #endif 13 | 14 | #include "Vector.h" 15 | 16 | 17 | 18 | //----------------------------------------------------------------------------- 19 | enum soundlevel_t 20 | { 21 | SNDLVL_NONE = 0, 22 | 23 | SNDLVL_20dB = 20, // rustling leaves 24 | SNDLVL_25dB = 25, // whispering 25 | SNDLVL_30dB = 30, // library 26 | SNDLVL_35dB = 35, 27 | SNDLVL_40dB = 40, 28 | SNDLVL_45dB = 45, // refrigerator 29 | 30 | SNDLVL_50dB = 50, // 3.9 // average home 31 | SNDLVL_55dB = 55, // 3.0 32 | 33 | SNDLVL_IDLE = 60, // 2.0 34 | SNDLVL_60dB = 60, // 2.0 // normal conversation, clothes dryer 35 | 36 | SNDLVL_65dB = 65, // 1.5 // washing machine, dishwasher 37 | SNDLVL_STATIC = 66, // 1.25 38 | 39 | SNDLVL_70dB = 70, // 1.0 // car, vacuum cleaner, mixer, electric sewing machine 40 | 41 | SNDLVL_NORM = 75, 42 | SNDLVL_75dB = 75, // 0.8 // busy traffic 43 | 44 | SNDLVL_80dB = 80, // 0.7 // mini-bike, alarm clock, noisy restaurant, office tabulator, outboard motor, passing snowmobile 45 | SNDLVL_TALKING = 80, // 0.7 46 | SNDLVL_85dB = 85, // 0.6 // average factory, electric shaver 47 | SNDLVL_90dB = 90, // 0.5 // screaming child, passing motorcycle, convertible ride on frw 48 | SNDLVL_95dB = 95, 49 | SNDLVL_100dB = 100, // 0.4 // subway train, diesel truck, woodworking shop, pneumatic drill, boiler shop, jackhammer 50 | SNDLVL_105dB = 105, // helicopter, power mower 51 | SNDLVL_110dB = 110, // snowmobile drvrs seat, inboard motorboat, sandblasting 52 | SNDLVL_120dB = 120, // auto horn, propeller aircraft 53 | SNDLVL_130dB = 130, // air raid siren 54 | 55 | SNDLVL_GUNFIRE = 140, // 0.27 // THRESHOLD OF PAIN, gunshot, jet engine 56 | SNDLVL_140dB = 140, // 0.2 57 | 58 | SNDLVL_150dB = 150, // 0.2 59 | 60 | SNDLVL_180dB = 180, // rocket launching 61 | 62 | // NOTE: Valid soundlevel_t values are 0-255. 63 | // 256-511 are reserved for sounds using goldsrc compatibility attenuation. 64 | }; 65 | 66 | struct SoundInfo_t 67 | { 68 | int nSequenceNumber; 69 | int nEntityIndex; 70 | int nChannel; 71 | const char* pszName; 72 | Vector vOrigin; 73 | Vector vDirection; 74 | float fVolume; 75 | soundlevel_t Soundlevel; 76 | bool bLooping; 77 | int nPitch; 78 | Vector vListenerOrigin; 79 | int nFlags; 80 | int nSoundNum; 81 | float fDelay; 82 | bool bIsSentence; 83 | bool bIsAmbient; 84 | int nSpeakerEntity; 85 | }; 86 | 87 | struct SpatializationInfo_t 88 | { 89 | typedef enum 90 | { 91 | SI_INCREATION = 0, 92 | SI_INSPATIALIZATION 93 | } SPATIALIZATIONTYPE; 94 | 95 | // Inputs 96 | SPATIALIZATIONTYPE type; 97 | // Info about the sound, channel, origin, direction, etc. 98 | SoundInfo_t info; 99 | 100 | // Requested Outputs ( NULL == not requested ) 101 | Vector* pOrigin; 102 | QAngle* pAngles; 103 | float* pflRadius; 104 | }; 105 | 106 | #endif // SOUNDINFO_H 107 | -------------------------------------------------------------------------------- /GMod-SDK/tier1/KeyValues.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gaztoof/GMod-SDK/a65eedc7dad8ab2c20b87a110c8cfeafaba853f7/GMod-SDK/tier1/KeyValues.h -------------------------------------------------------------------------------- /GMod-SDK/tier1/checksum_crc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef CHECKSUM_CRC_H 4 | #define CHECKSUM_CRC_H 5 | #ifdef _WIN32 6 | #pragma once 7 | #endif 8 | 9 | typedef unsigned int CRC32_t; 10 | 11 | void CRC32_Init(CRC32_t* pulCRC); 12 | void CRC32_ProcessBuffer(CRC32_t* pulCRC, const void* p, int len); 13 | void CRC32_Final(CRC32_t* pulCRC); 14 | CRC32_t CRC32_GetTableEntry(unsigned int slot); 15 | 16 | inline CRC32_t CRC32_ProcessSingleBuffer(const void* p, int len) 17 | { 18 | CRC32_t crc; 19 | 20 | CRC32_Init(&crc); 21 | CRC32_ProcessBuffer(&crc, p, len); 22 | CRC32_Final(&crc); 23 | 24 | return crc; 25 | } 26 | #include "../tier0/basetypes.h" 27 | 28 | #define CRC32_INIT_VALUE 0xFFFFFFFFUL 29 | #define CRC32_XOR_VALUE 0xFFFFFFFFUL 30 | 31 | #define NUM_BYTES 256 32 | static const CRC32_t pulCRCTable[NUM_BYTES] = 33 | { 34 | 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 35 | 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 36 | 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 37 | 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 38 | 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 39 | 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 40 | 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 41 | 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 42 | 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 43 | 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 44 | 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 45 | 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 46 | 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 47 | 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 48 | 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 49 | 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 50 | 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 51 | 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 52 | 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 53 | 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 54 | 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 55 | 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 56 | 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 57 | 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 58 | 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 59 | 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 60 | 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 61 | 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 62 | 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 63 | 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 64 | 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 65 | 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 66 | 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 67 | 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 68 | 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 69 | 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 70 | 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 71 | 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 72 | 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 73 | 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 74 | 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 75 | 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 76 | 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 77 | 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 78 | 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 79 | 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 80 | 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 81 | 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 82 | 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 83 | 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 84 | 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 85 | 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 86 | 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 87 | 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 88 | 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 89 | 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 90 | 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 91 | 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 92 | 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 93 | 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 94 | 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 95 | 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 96 | 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 97 | 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d 98 | }; 99 | 100 | void CRC32_Init(CRC32_t* pulCRC) 101 | { 102 | *pulCRC = CRC32_INIT_VALUE; 103 | } 104 | 105 | void CRC32_Final(CRC32_t* pulCRC) 106 | { 107 | *pulCRC ^= CRC32_XOR_VALUE; 108 | } 109 | 110 | CRC32_t CRC32_GetTableEntry(unsigned int slot) 111 | { 112 | return pulCRCTable[(unsigned char)slot]; 113 | } 114 | 115 | void CRC32_ProcessBuffer(CRC32_t* pulCRC, const void* pBuffer, int nBuffer) 116 | { 117 | CRC32_t ulCrc = *pulCRC; 118 | unsigned char* pb = (unsigned char*)pBuffer; 119 | unsigned int nFront; 120 | int nMain; 121 | 122 | JustAfew: 123 | 124 | switch (nBuffer) 125 | { 126 | case 7: 127 | ulCrc = pulCRCTable[*pb++ ^ (unsigned char)ulCrc] ^ (ulCrc >> 8); 128 | 129 | case 6: 130 | ulCrc = pulCRCTable[*pb++ ^ (unsigned char)ulCrc] ^ (ulCrc >> 8); 131 | 132 | case 5: 133 | ulCrc = pulCRCTable[*pb++ ^ (unsigned char)ulCrc] ^ (ulCrc >> 8); 134 | 135 | case 4: 136 | ulCrc ^= (*(CRC32_t*)pb); 137 | ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8); 138 | ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8); 139 | ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8); 140 | ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8); 141 | *pulCRC = ulCrc; 142 | return; 143 | 144 | case 3: 145 | ulCrc = pulCRCTable[*pb++ ^ (unsigned char)ulCrc] ^ (ulCrc >> 8); 146 | 147 | case 2: 148 | ulCrc = pulCRCTable[*pb++ ^ (unsigned char)ulCrc] ^ (ulCrc >> 8); 149 | 150 | case 1: 151 | ulCrc = pulCRCTable[*pb++ ^ (unsigned char)ulCrc] ^ (ulCrc >> 8); 152 | 153 | case 0: 154 | *pulCRC = ulCrc; 155 | return; 156 | } 157 | 158 | // We may need to do some alignment work up front, and at the end, so that 159 | // the main loop is aligned and only has to worry about 8 byte at a time. 160 | // 161 | // The low-order two bits of pb and nBuffer in total control the 162 | // upfront work. 163 | // 164 | nFront = ((unsigned int)pb) & 3; 165 | nBuffer -= nFront; 166 | switch (nFront) 167 | { 168 | case 3: 169 | ulCrc = pulCRCTable[*pb++ ^ (unsigned char)ulCrc] ^ (ulCrc >> 8); 170 | case 2: 171 | ulCrc = pulCRCTable[*pb++ ^ (unsigned char)ulCrc] ^ (ulCrc >> 8); 172 | case 1: 173 | ulCrc = pulCRCTable[*pb++ ^ (unsigned char)ulCrc] ^ (ulCrc >> 8); 174 | } 175 | 176 | nMain = nBuffer >> 3; 177 | while (nMain--) 178 | { 179 | ulCrc ^= (*(CRC32_t*)pb); 180 | ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8); 181 | ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8); 182 | ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8); 183 | ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8); 184 | ulCrc ^= (*(CRC32_t*)(pb + 4)); 185 | ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8); 186 | ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8); 187 | ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8); 188 | ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8); 189 | pb += 8; 190 | } 191 | 192 | nBuffer &= 7; 193 | goto JustAfew; 194 | } 195 | 196 | #endif // CHECKSUM_CRC_H 197 | -------------------------------------------------------------------------------- /GMod-SDK/vgui/ISurfaceV30.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // The copyright to the contents herein is the property of Valve, L.L.C. 4 | // The contents may be used and/or copied only with the written permission of 5 | // Valve, L.L.C., or in accordance with the terms and conditions stipulated in 6 | // the agreement/contract under which the contents have been supplied. 7 | // 8 | // Purpose: 9 | // 10 | // $NoKeywords: $ 11 | //============================================================================= 12 | 13 | #ifndef ISURFACE_V30_H 14 | #define ISURFACE_V30_H 15 | 16 | #ifdef _WIN32 17 | #pragma once 18 | #endif 19 | 20 | #include "../tier0/Vector.h" 21 | 22 | #ifdef CreateFont 23 | #undef CreateFont 24 | #endif 25 | 26 | #ifdef PlaySound 27 | #undef PlaySound 28 | #endif 29 | 30 | class Color; 31 | 32 | namespace vgui 33 | { 34 | 35 | class Image; 36 | class Point; 37 | 38 | // handles 39 | typedef unsigned long HCursor; 40 | typedef unsigned long HTexture; 41 | typedef unsigned long HFont; 42 | } 43 | 44 | 45 | 46 | namespace SurfaceV30 47 | { 48 | 49 | //SRC only defines 50 | 51 | 52 | struct Vertex_t 53 | { 54 | Vertex_t() {} 55 | Vertex_t(const Vector2D& pos, const Vector2D& coord = Vector2D(0, 0)) 56 | { 57 | m_Position = pos; 58 | m_TexCoord = coord; 59 | } 60 | void Init(const Vector2D& pos, const Vector2D& coord = Vector2D(0, 0)) 61 | { 62 | m_Position = pos; 63 | m_TexCoord = coord; 64 | } 65 | 66 | Vector2D m_Position; 67 | Vector2D m_TexCoord; 68 | }; 69 | 70 | 71 | enum FontDrawType_t 72 | { 73 | // Use the "additive" value from the scheme file 74 | FONT_DRAW_DEFAULT = 0, 75 | 76 | // Overrides 77 | FONT_DRAW_NONADDITIVE, 78 | FONT_DRAW_ADDITIVE, 79 | 80 | FONT_DRAW_TYPE_COUNT = 2, 81 | }; 82 | 83 | 84 | // Refactor these two 85 | struct CharRenderInfo 86 | { 87 | // In: 88 | FontDrawType_t drawType; 89 | wchar_t ch; 90 | 91 | // Out 92 | bool valid; 93 | 94 | // In/Out (true by default) 95 | bool shouldclip; 96 | // Text pos 97 | int x, y; 98 | // Top left and bottom right 99 | Vertex_t verts[2]; 100 | int textureId; 101 | int abcA; 102 | int abcB; 103 | int abcC; 104 | int fontTall; 105 | vgui::HFont currentFont; 106 | }; 107 | 108 | 109 | struct IntRect 110 | { 111 | int x0; 112 | int y0; 113 | int x1; 114 | int y1; 115 | }; 116 | 117 | 118 | //----------------------------------------------------------------------------- 119 | // Purpose: Wraps contextless windows system functions 120 | //----------------------------------------------------------------------------- 121 | 122 | } // end namespace 123 | 124 | //----------------------------------------------------------------------------- 125 | // FIXME: This works around using scoped interfaces w/ EXPOSE_SINGLE_INTERFACE 126 | //----------------------------------------------------------------------------- 127 | 128 | #define VGUI_SURFACE_INTERFACE_VERSION_30 "VGUI_Surface030" 129 | 130 | #endif // ISURFACE_V30_H -------------------------------------------------------------------------------- /GMod-SDK/vgui/VPanelWrapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | // Auto reconstructed from vtable block @ 0x0002D6F8 5 | // from "vgui2.dylib", by ida_vtables.idc 6 | // Modified VTable dumper script obviously by t.me/Gaztoof. 7 | class VPanel 8 | { 9 | public: 10 | /*0*/ virtual void* Destr() = 0; 11 | /*1*/ virtual void* Init(void*) = 0; 12 | /*2*/ virtual void* Plat(void) = 0; 13 | /*3*/ virtual void* SetPlat(void*) = 0; 14 | /*4*/ virtual void* GetHPanel(void) = 0; 15 | /*5*/ virtual void* SetHPanel(unsigned long) = 0; 16 | /*6*/ virtual void* PopupWantsFront(void) = 0; 17 | /*7*/ virtual void* SetPopupWantsFront(bool) = 0; 18 | /*8*/ virtual void* IsPopup(void) = 0; 19 | /*9*/ virtual void* SetPopup(bool) = 0; 20 | /*10*/ virtual void* IsFullyVisible(void) = 0; 21 | /*11*/ virtual void* SetPos(int, int) = 0; 22 | /*12*/ virtual void* GetPos(int&, int&) = 0; 23 | /*13*/ virtual void* SetSize(int, int) = 0; 24 | /*14*/ virtual void* GetSize(int&, int&) = 0; 25 | /*15*/ virtual void* SetMinimumSize(int, int) = 0; 26 | /*16*/ virtual void* GetMinimumSize(int&, int&) = 0; 27 | /*17*/ virtual void* SetZPos(int) = 0; 28 | /*18*/ virtual void* GetZPos(void) = 0; 29 | /*19*/ virtual void* GetAbsPos(int&, int&) = 0; 30 | /*20*/ virtual void* GetClipRect(int&, int&, int&, int&) = 0; 31 | /*21*/ virtual void* SetInset(int, int, int, int) = 0; 32 | /*22*/ virtual void* GetInset(int&, int&, int&, int&) = 0; 33 | /*23*/ virtual void* Solve(void) = 0; 34 | /*24*/ virtual void* SetVisible(bool) = 0; 35 | /*25*/ virtual void* SetEnabled(bool) = 0; 36 | /*26*/ virtual void* IsVisible(void) = 0; 37 | /*27*/ virtual void* IsEnabled(void) = 0; 38 | /*28*/ virtual void* SetParent(VPanel*) = 0; 39 | /*29*/ virtual void* GetChildCount(void) = 0; 40 | /*30*/ virtual void* GetChild(int) = 0; 41 | /*31*/ virtual void* GetParent(void) = 0; 42 | /*32*/ virtual void* MoveToFront(void) = 0; 43 | /*33*/ virtual void* MoveToBack(void) = 0; 44 | /*34*/ virtual void* HasParent(VPanel*) = 0; 45 | /*35*/ virtual void* GetChildren(void) = 0; 46 | /*36*/ virtual void* GetName(void) = 0; 47 | /*37*/ virtual void* GetClassName(void) = 0; 48 | /*38*/ virtual void* GetScheme(void) = 0; 49 | /*39*/ virtual void* SendMessage(void*, unsigned int) = 0; 50 | /*40*/ virtual void* Client(void) = 0; 51 | /*41*/ virtual void* SetKeyBoardInputEnabled(bool) = 0; 52 | /*42*/ virtual void* SetMouseInputEnabled(bool) = 0; 53 | /*43*/ virtual void* IsKeyBoardInputEnabled(void) = 0; 54 | /*44*/ virtual void* IsMouseInputEnabled(void) = 0; 55 | /*45*/ virtual void* IsTopmostPopup(void)const = 0; 56 | /*46*/ virtual void* SetTopmostPopup(bool) = 0; 57 | /*47*/ virtual void* SetSiblingPin(VPanel*, unsigned char, unsigned char) = 0; 58 | /*48*/ virtual void* GetInternalAbsPos(int&, int&) = 0; 59 | }; 60 | 61 | // Auto reconstructed from vtable block @ 0x0002E034 62 | // from "vgui2.dylib", by ida_vtables.idc 63 | // Modified VTable dumper script obviously by t.me/Gaztoof. 64 | 65 | // DO NOT USE ANY METHOD FROM THIS, IT IS ONE METHOD OFF FROM THE ACTUAL ONE AND I'm CURRENTLY LAZY TO FIX. 66 | class VPanelWrapper 67 | { 68 | public: 69 | //Don't forget the constructor. 70 | /*0*/ virtual void* Destr() = 0; 71 | /*1*/ virtual void* Init(unsigned int, void*) = 0; 72 | /*2*/ virtual void* SetPos(unsigned int, int, int) = 0; 73 | /*3*/ virtual void* GetPos(unsigned int, int&, int&) = 0; 74 | /*4*/ virtual void* SetSize(unsigned int, int, int) = 0; 75 | /*5*/ virtual void* GetSize(unsigned int, int&, int&) = 0; 76 | /*6*/ virtual void* SetMinimumSize(unsigned int, int, int) = 0; 77 | /*7*/ virtual void* GetMinimumSize(unsigned int, int&, int&) = 0; 78 | /*8*/ virtual void* SetZPos(unsigned int, int) = 0; 79 | /*9*/ virtual void* GetZPos(unsigned int) = 0; 80 | /*10*/ virtual void* GetAbsPos(unsigned int, int&, int&) = 0; 81 | /*11*/ virtual void* GetClipRect(unsigned int, int&, int&, int&, int&) = 0; 82 | /*12*/ virtual void* SetInset(unsigned int, int, int, int, int) = 0; 83 | /*13*/ virtual void* GetInset(unsigned int, int&, int&, int&, int&) = 0; 84 | /*14*/ virtual void* SetVisible(unsigned int, bool) = 0; 85 | /*15*/ virtual void* IsVisible(unsigned int) = 0; 86 | /*16*/ virtual void* SetParent(unsigned int, unsigned int) = 0; 87 | /*17*/ virtual void* GetChildCount(unsigned int) = 0; 88 | /*18*/ virtual void* GetChild(unsigned int, int) = 0; 89 | /*19*/ virtual void* GetChildren(unsigned int) = 0; 90 | /*20*/ virtual void* GetParent(unsigned int) = 0; 91 | /*21*/ virtual void* MoveToFront(unsigned int) = 0; 92 | /*22*/ virtual void* MoveToBack(unsigned int) = 0; 93 | /*23*/ virtual void* HasParent(unsigned int, unsigned int) = 0; 94 | /*24*/ virtual void* IsPopup(unsigned int) = 0; 95 | /*25*/ virtual void* SetPopup(unsigned int, bool) = 0; 96 | /*26*/ virtual void* IsFullyVisible(unsigned int) = 0; 97 | /*27*/ virtual void* GetScheme(unsigned int) = 0; 98 | /*28*/ virtual void* IsProportional(unsigned int) = 0; 99 | /*29*/ virtual void* IsAutoDeleteSet(unsigned int) = 0; 100 | /*30*/ virtual void* DeletePanel(unsigned int) = 0; 101 | /*31*/ virtual void* SetKeyBoardInputEnabled(VPanel* panel, bool) = 0; 102 | /*32*/ virtual void* SetMouseInputEnabled(VPanel* panel, bool) = 0; 103 | /*33*/ virtual bool IsKeyBoardInputEnabled(VPanel* panel) = 0; 104 | /*34*/ virtual void* IsMouseInputEnabled(unsigned int) = 0; 105 | /*35*/ virtual void* Solve(unsigned int) = 0; 106 | /*36*/ virtual const char* GetName(VPanel* ) = 0; 107 | /*37*/ virtual const char* GetClassName(unsigned int) = 0; 108 | /*38*/ virtual void* SendMessage(unsigned int, void*, unsigned int) = 0; 109 | /*39*/ virtual void* Think(unsigned int) = 0; 110 | /*40*/ virtual void* PerformApplySchemeSettings(unsigned int) = 0; 111 | /*41*/ virtual void* PaintTraverse(unsigned int, bool, bool) = 0; 112 | /*42*/ virtual void* Repaint(unsigned int) = 0; 113 | /*43*/ virtual void* IsWithinTraverse(unsigned int, int, int, bool) = 0; 114 | /*44*/ virtual void* OnChildAdded(unsigned int, unsigned int) = 0; 115 | /*45*/ virtual void* OnSizeChanged(unsigned int, int, int) = 0; 116 | /*46*/ virtual void* InternalFocusChanged(unsigned int, bool) = 0; 117 | /*47*/ virtual void* RequestInfo(unsigned int, void*) = 0; 118 | /*48*/ virtual void* RequestFocus(unsigned int, int) = 0; 119 | /*49*/ virtual void* RequestFocusPrev(unsigned int, unsigned int) = 0; 120 | /*50*/ virtual void* RequestFocusNext(unsigned int, unsigned int) = 0; 121 | /*51*/ virtual void* GetCurrentKeyFocus(unsigned int) = 0; 122 | /*52*/ virtual void* GetTabPosition(unsigned int) = 0; 123 | /*53*/ virtual void* Plat(unsigned int) = 0; 124 | /*54*/ virtual void* SetPlat(unsigned int, void*) = 0; 125 | /*55*/ virtual void* GetPanel(unsigned int, char const*) = 0; 126 | /*56*/ virtual void* IsEnabled(unsigned int) = 0; 127 | /*57*/ virtual void* SetEnabled(unsigned int, bool) = 0; 128 | /*58*/ virtual void* IsTopmostPopup(unsigned int) = 0; 129 | /*59*/ virtual void* SetTopmostPopup(unsigned int, bool) = 0; 130 | /*60*/ virtual void* SetSiblingPin(unsigned int, unsigned int, unsigned char, unsigned char) = 0; 131 | /*61*/ virtual void* PopupWantsFront(unsigned int) = 0; 132 | /*62*/ virtual void* SetPopupWantsFront(unsigned int, bool) = 0; 133 | /*63*/ virtual void* Client(unsigned int) = 0; 134 | /*64*/ virtual void* GetModuleName(unsigned int) = 0; 135 | }; -------------------------------------------------------------------------------- /GMod-SDK/vphysics/CPhysicsSurfaceProps.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | struct surfacephysicsparams_t 5 | { 6 | float friction; 7 | float elasticity; 8 | float density; 9 | float thickness; 10 | float dampening; 11 | }; 12 | struct surfaceaudioparams_t 13 | { 14 | // sounds / audio data 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 | 19 | // audio thresholds 20 | float roughThreshold; // surface roughness > this causes "rough" scrapes, < this causes "smooth" scrapes 21 | float hardThreshold; // surface hardness > this causes "hard" impacts, < this causes "soft" impacts 22 | float hardVelocityThreshold; // collision velocity > this causes "hard" impacts, < this causes "soft" impacts 23 | // NOTE: Hard impacts must meet both hardnessFactor AND velocity thresholds 24 | }; 25 | struct surfacesoundnames_t 26 | { 27 | unsigned short stepleft; 28 | unsigned short stepright; 29 | 30 | unsigned short impactSoft; 31 | unsigned short impactHard; 32 | 33 | unsigned short scrapeSmooth; 34 | unsigned short scrapeRough; 35 | 36 | unsigned short bulletImpact; 37 | unsigned short rolling; 38 | 39 | unsigned short breakSound; 40 | unsigned short strainSound; 41 | }; 42 | 43 | struct surfacegameprops_t 44 | { 45 | char pad02[0xC]; 46 | float maxSpeedFactor; 47 | float jumpFactor; 48 | char pad00[0x4]; 49 | float flPenetrationModifier; 50 | float flDamageModifier; 51 | unsigned short material; 52 | char pad01[0x3]; 53 | 54 | }; 55 | 56 | struct surfacedata_t 57 | { 58 | surfacephysicsparams_t physics; // physics parameters 59 | surfaceaudioparams_t audio; // audio parameters 60 | surfacesoundnames_t sounds; // names of linked sounds 61 | surfacegameprops_t game; // Game data / properties 62 | 63 | 64 | }; 65 | 66 | // Auto reconstructed from vtable block @ 0x00111068 67 | // from "vphysics.dylib", by ida_vtables.idc 68 | // Modified VTable dumper script obviously by t.me/Gaztoof. 69 | class CPhysicsSurfaceProps 70 | { 71 | public: 72 | /*0*/ virtual void Destr() = 0; 73 | /*1*/ virtual int ParseSurfaceData(char const* pFilename, char const* pTextfile) = 0; 74 | /*2*/ virtual int SurfacePropCount(void)const = 0; 75 | /*3*/ virtual int GetSurfaceIndex(char const* pSurfacePropName)const = 0; 76 | /*4*/ virtual void GetPhysicsProperties(int surfaceDataIndex, float* density, float* thickness, float* friction , float* elasticity)const = 0; 77 | /*5*/ virtual surfacedata_t* GetSurfaceData(int surfaceDataIndex) = 0; 78 | /*6*/ virtual const char* GetString(unsigned short stringTableIndex)const = 0; 79 | /*7*/ virtual const char* GetPropName(int surfaceDataIndex)const = 0; 80 | /*8*/ virtual void SetWorldMaterialIndexTable(int* pMapArray, int mapSize) = 0; 81 | /*9*/ virtual void GetPhysicsParameters(int surfaceDataIndex, surfacephysicsparams_t* pParamsOut)const = 0; 82 | /*10*/ virtual void GetIVPMaterial(int) = 0; 83 | /*11*/ virtual void GetIVPMaterialIndex(void const*)const = 0; 84 | /*12*/ virtual void GetIVPManager(void) = 0; 85 | /*13*/ virtual void RemapIVPMaterialIndex(int)const = 0; 86 | /*14*/ virtual void GetReservedMaterialName(int)const = 0; 87 | }; -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Gaztoof 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GMod-SDK 2 | 3 | 4 | This is a module for [Garry's Mod](https://store.steampowered.com/app/4000/Garrys_Mod/) that works based on a SDK. 5 | 6 | I've spent the past few days reversing a few modules of the game, in order to get as many interfaces as I could that would be useful to make any type of internal module for [Garry's Mod](https://store.steampowered.com/app/4000/Garrys_Mod/). 7 | 8 | Note that this is still WIP! 9 | 10 | This works in both x86, and x64. 11 | 12 | I've uploaded every idb / dylib i've made while reversing the game, except x64 client.dll as it takes too much space for github. 13 | 14 | The gui is an almost-perfect gamesense clone. 15 | 16 | This also comes in with a built-in lua executor. 17 | 18 | ![](https://i.imgur.com/TecyXLF.png) 19 | ![](https://i.imgur.com/So6vWVn.png) 20 | ![](https://i.imgur.com/85YRzrO.png) 21 | ![](https://i.imgur.com/SouXE7G.png) 22 | ![](https://i.imgur.com/fBRleQL.png) 23 | 24 | ## Usage 25 | 26 | Compile as x86/x64 Release. Debug works too. 27 | 28 | Get yourself an injector, select Garry's Mod, and inject the compiled .DLL into the target process. 29 | 30 | If you did this right, the cheat should loaded. 31 | 32 | Press INSERT to open the menu. 33 | 34 | ## How to update 35 | 36 | In case I stop working on this project, and you want to update it, feel free to fork this project. 37 | 38 | Get the .dylibs using the game's macOs build [SteamDepotDownloader](https://github.com/SteamRE/DepotDownloader/), and make sure they're up-to-date when you compare them to the Windows build's interfaces. 39 | 40 | Null functions can sometime be a pain, make sure they're not phasing out your entire interfaces. A single null function will stop everything from working. 41 | 42 | ## Contact 43 | 44 | You can contact me on [Telegram](https://t.me/Gaztoof), at t.me/@Gaztoof 45 | 46 | [This](https://www.youtube.com/channel/UCB7rQNzTsaoS2-I0Z4byUxA) is my YouTube channel. 47 | 48 | ## Made with 49 | 50 | * [IDA Pro](http://www.dropwizard.io/1.0.2/docs/) - The software I used to reverse the game. 51 | * [VMT Dumper](https://pastebin.com/eVHDkHZX) - The IDA script I used for dumping the VTables. I've found it on a forum and modified it. 52 | * [IMGui](https://github.com/ocornut/imgui) - The GUI is just modified pure ImGui. 53 | 54 | ## Contributing 55 | 56 | 1. Fork the project () 57 | 2. Create your feature branch (`git checkout -b feature/fooBar`) 58 | 3. Commit your changes (`git commit -am 'Add some fooBar'`) 59 | 4. Push to the branch (`git push origin feature/fooBar`) 60 | 5. Create a new Pull Request 61 | --------------------------------------------------------------------------------