├── .gitignore ├── README.md ├── sinclairv3.sln └── sinclairv3 ├── cstrike ├── cdll_client_int.h ├── cdll_engine_int.h ├── cdll_int.h ├── clientclass.h ├── convar.h ├── cstrike.h ├── cusercmd.h ├── defines.h ├── enums.h ├── globalvars_base.h ├── ienginetrace.h ├── imaterial.h ├── imaterialsystem.h ├── imaterialvar.h ├── inetmessage.h ├── ivdebugoverlay.h ├── ivmodelrender.h ├── modelinfo.h ├── sdk_hud_chat.h ├── utl_vector.h ├── vgui │ └── isurface.h ├── vgui2 │ └── vpanel.h └── weapons.h ├── dllmain.cpp ├── errors └── errors.h ├── extern ├── custom_winapi │ ├── custom_winapi.cpp │ └── custom_winapi.h ├── extern.h └── hasher │ └── hasher.h ├── framework.h ├── game ├── entities │ ├── entities.cpp │ ├── entities.h │ └── player │ │ ├── player.cpp │ │ └── player.h ├── features │ ├── features.h │ ├── movement │ │ ├── movement.cpp │ │ └── movement.h │ └── visual │ │ ├── visual.cpp │ │ └── visual.h ├── game.cpp ├── game.h ├── hooking │ ├── functions │ │ ├── create_move.cpp │ │ ├── draw_crosshair.cpp │ │ ├── frame_stage_notify.cpp │ │ ├── get_color_modulation.cpp │ │ ├── get_cs_wpn_data.cpp │ │ ├── get_current_game_type.cpp │ │ ├── is_using_static_prop_debug_modes.cpp │ │ ├── paint.cpp │ │ ├── push_notice.cpp │ │ ├── send_net_msg.cpp │ │ └── vsnprintf.cpp │ ├── hooking.cpp │ ├── hooking.h │ └── prototypes.h ├── memory │ ├── memory.cpp │ └── memory.h ├── props │ ├── props.cpp │ └── props.h └── renderer │ └── surface │ ├── surface.cpp │ └── surface.h ├── logger ├── logger.cpp └── logger.h ├── math ├── math.cpp ├── math.h ├── matrix │ └── matrix.h └── position │ └── position.h ├── pe ├── pe.cpp ├── pe.h └── util │ ├── util.cpp │ └── util.h ├── sinclairv3.vcxproj ├── sinclairv3.vcxproj.filters ├── sinclairv3.vcxproj.user └── util ├── color └── color.h └── util.h /.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 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # NuGet Symbol Packages 188 | *.snupkg 189 | # The packages folder can be ignored because of Package Restore 190 | **/[Pp]ackages/* 191 | # except build/, which is used as an MSBuild target. 192 | !**/[Pp]ackages/build/ 193 | # Uncomment if necessary however generally it will be regenerated when needed 194 | #!**/[Pp]ackages/repositories.config 195 | # NuGet v3's project.json files produces more ignorable files 196 | *.nuget.props 197 | *.nuget.targets 198 | 199 | # Microsoft Azure Build Output 200 | csx/ 201 | *.build.csdef 202 | 203 | # Microsoft Azure Emulator 204 | ecf/ 205 | rcf/ 206 | 207 | # Windows Store app package directories and files 208 | AppPackages/ 209 | BundleArtifacts/ 210 | Package.StoreAssociation.xml 211 | _pkginfo.txt 212 | *.appx 213 | *.appxbundle 214 | *.appxupload 215 | 216 | # Visual Studio cache files 217 | # files ending in .cache can be ignored 218 | *.[Cc]ache 219 | # but keep track of directories ending in .cache 220 | !?*.[Cc]ache/ 221 | 222 | # Others 223 | ClientBin/ 224 | ~$* 225 | *~ 226 | *.dbmdl 227 | *.dbproj.schemaview 228 | *.jfm 229 | *.pfx 230 | *.publishsettings 231 | orleans.codegen.cs 232 | 233 | # Including strong name files can present a security risk 234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 235 | #*.snk 236 | 237 | # Since there are multiple workflows, uncomment next line to ignore bower_components 238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 239 | #bower_components/ 240 | 241 | # RIA/Silverlight projects 242 | Generated_Code/ 243 | 244 | # Backup & report files from converting an old project file 245 | # to a newer Visual Studio version. Backup files are not needed, 246 | # because we have git ;-) 247 | _UpgradeReport_Files/ 248 | Backup*/ 249 | UpgradeLog*.XML 250 | UpgradeLog*.htm 251 | ServiceFabricBackup/ 252 | *.rptproj.bak 253 | 254 | # SQL Server files 255 | *.mdf 256 | *.ldf 257 | *.ndf 258 | 259 | # Business Intelligence projects 260 | *.rdl.data 261 | *.bim.layout 262 | *.bim_*.settings 263 | *.rptproj.rsuser 264 | *- [Bb]ackup.rdl 265 | *- [Bb]ackup ([0-9]).rdl 266 | *- [Bb]ackup ([0-9][0-9]).rdl 267 | 268 | # Microsoft Fakes 269 | FakesAssemblies/ 270 | 271 | # GhostDoc plugin setting file 272 | *.GhostDoc.xml 273 | 274 | # Node.js Tools for Visual Studio 275 | .ntvs_analysis.dat 276 | node_modules/ 277 | 278 | # Visual Studio 6 build log 279 | *.plg 280 | 281 | # Visual Studio 6 workspace options file 282 | *.opt 283 | 284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 285 | *.vbw 286 | 287 | # Visual Studio LightSwitch build output 288 | **/*.HTMLClient/GeneratedArtifacts 289 | **/*.DesktopClient/GeneratedArtifacts 290 | **/*.DesktopClient/ModelManifest.xml 291 | **/*.Server/GeneratedArtifacts 292 | **/*.Server/ModelManifest.xml 293 | _Pvt_Extensions 294 | 295 | # Paket dependency manager 296 | .paket/paket.exe 297 | paket-files/ 298 | 299 | # FAKE - F# Make 300 | .fake/ 301 | 302 | # CodeRush personal settings 303 | .cr/personal 304 | 305 | # Python Tools for Visual Studio (PTVS) 306 | __pycache__/ 307 | *.pyc 308 | 309 | # Cake - Uncomment if you are using it 310 | # tools/** 311 | # !tools/packages.config 312 | 313 | # Tabs Studio 314 | *.tss 315 | 316 | # Telerik's JustMock configuration file 317 | *.jmconfig 318 | 319 | # BizTalk build output 320 | *.btp.cs 321 | *.btm.cs 322 | *.odx.cs 323 | *.xsd.cs 324 | 325 | # OpenCover UI analysis results 326 | OpenCover/ 327 | 328 | # Azure Stream Analytics local run output 329 | ASALocalRun/ 330 | 331 | # MSBuild Binary and Structured Log 332 | *.binlog 333 | 334 | # NVidia Nsight GPU debugger configuration file 335 | *.nvuser 336 | 337 | # MFractors (Xamarin productivity tool) working folder 338 | .mfractor/ 339 | 340 | # Local History for Visual Studio 341 | .localhistory/ 342 | 343 | # BeatPulse healthcheck temp database 344 | healthchecksdb 345 | 346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 347 | MigrationBackup/ 348 | 349 | # Ionide (cross platform F# VS Code tools) working folder 350 | .ionide/ 351 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # sinclair_csgo 2 | - My CS:GO cheat, written with performance in mind. 3 | - Currently **in development**, and I plan to keep this as such! 4 | 5 | # Credits 6 | - @swoopae for his hasher. 7 | - @Speedi13 for his [Custom WINAPI](https://github.com/Speedi13/Custom-GetProcAddress-and-GetModuleHandle-and-more) functions. 8 | - Other creators from whom I might've taken minimal contributions such as enumerators for various matters or even inspiration. 9 | 10 | # Adresses (signatures) 11 | - Addresses are stored at entry point in an array, being accessable by the StaticAddresses enumerator. 12 | - It would not be relevant to list every stored address, as you can directly peek within the PE utilities header to see them fairly verboosely listed within an enumerator. 13 | 14 | # Interfaces 15 | - Interfaces are stored at entry point, and are accessible in the interfaces prototypes namespace. 16 | - These are the current available interfaces: 17 | - IBaseClientDLL 18 | - ClientModeShared 19 | - CGlobalVarsBase 20 | - IVEngineClient 21 | - IClientEntityList 22 | - IEngineTraceClient 23 | - IVDebugOverlay 24 | - ISurface 25 | - ICVar 26 | - IInputSystem 27 | - CModelInfo 28 | - IVModelRenderer 29 | - MaterialSystem 30 | 31 | # Hooks 32 | - Sinclair currently uses the GameOverlayRenderer.dll hooking utilities, and it comes with these specific hooks: 33 | - CreateMove (ClientModeShared one) 34 | - DrawCrosshair 35 | - FrameStageNotify 36 | - GetColorModulation 37 | - GetCSWpnData 38 | - GetCurrentGameType 39 | - IsUsingStaticPropDebugModes 40 | - Paint (Engine VGui) 41 | - PushNotice (CCSGOHudChat one) 42 | - SendNetMsg (CNetChan one) 43 | - 'vsnprintf' (Game formatting function) 44 | 45 | # Props (Netvars) 46 | - Sinclair stores every prop with it's submember's offsets in a double unordered map at entry point that uses hashes. 47 | - Alternatives could've been chose but it'd be likely that they'd be worse. 48 | 49 | # Rendering 50 | - Sinclair comes with an ISurface wrapper that uses DrawColoredText for non-widestring text rendering, and with the following geometry shapes available: 51 | - Rectangle 52 | - Rectangle Outline 53 | - Line 54 | - The aforementioned shapes also come with the following color preservation modes: 55 | - Preserve 56 | - Change and Restore 57 | - Change 58 | - Unique to others, it also has a get current color (Global to Surface) method in the wrapper. 59 | 60 | # Design 61 | - Sinclair is designed with what'd perform the best in mind, explaining the templates 'abuse'. 62 | - This could be a trade off, due to possibly extended compilation times, but this should not be noticeable when compiling on computers that benefit from the multi-processor option. 63 | - In this current stage, it is very likely for inconsistencies in code to be noticeable, if you notice any of those, please proceed with reporting them or even making a pull request solving them. Sometimes, inconsistencies might be there for actual practical matters, the consistency being though opposed by my coding style. These inconsistencies though should not be often apparent. 64 | 65 | # Features 66 | - Outside of aforementioned capabilities, actual features are: 67 | - No Duck Delay 68 | - Force Crosshair 69 | - Dangerzone Compass 70 | - Nightmode (with static prop/skybox modulation) 71 | - net_graph watermark 72 | - FileCRCCheck netmessage protobuf bypass 73 | - Game bounding box calculated box ESP 74 | -------------------------------------------------------------------------------- /sinclairv3.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30907.101 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sinclairv3", "sinclairv3\sinclairv3.vcxproj", "{EBD61037-C45F-4C02-BCE4-03DF760029BE}" 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 | {EBD61037-C45F-4C02-BCE4-03DF760029BE}.Debug|x64.ActiveCfg = Debug|x64 17 | {EBD61037-C45F-4C02-BCE4-03DF760029BE}.Debug|x64.Build.0 = Debug|x64 18 | {EBD61037-C45F-4C02-BCE4-03DF760029BE}.Debug|x86.ActiveCfg = Debug|Win32 19 | {EBD61037-C45F-4C02-BCE4-03DF760029BE}.Debug|x86.Build.0 = Debug|Win32 20 | {EBD61037-C45F-4C02-BCE4-03DF760029BE}.Release|x64.ActiveCfg = Release|x64 21 | {EBD61037-C45F-4C02-BCE4-03DF760029BE}.Release|x64.Build.0 = Release|x64 22 | {EBD61037-C45F-4C02-BCE4-03DF760029BE}.Release|x86.ActiveCfg = Release|Win32 23 | {EBD61037-C45F-4C02-BCE4-03DF760029BE}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {7ECAE169-92D7-450B-BC4E-78C11D6FBE7E} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /sinclairv3/cstrike/cdll_client_int.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | #include "../game/memory/memory.h" 6 | #include "../math/math.h" 7 | 8 | class IInputSystem { 9 | private: 10 | enum indices { 11 | ENABLE_INPUT_INDEX = 11, 12 | IS_BUTTON_DOWN_INDEX = 15, 13 | BUTTON_CODE_TO_STRING_INDEX = 40, 14 | GET_CURSOR_POSITION_INDEX = 56 15 | }; 16 | 17 | public: 18 | __forceinline void enable_input(bool state) { 19 | return util::vtable::func::getter::the(this, state); 20 | } 21 | 22 | __forceinline bool is_button_down(ButtonCode code) { 23 | return util::vtable::func::getter::the(this, code); 24 | } 25 | 26 | __forceinline const char* button_code_to_string(ButtonCode code) { 27 | return util::vtable::func::getter::the(this, code); 28 | } 29 | 30 | __forceinline void get_cursor_position(int* x, int* y) { 31 | return util::vtable::func::getter::the(this, x, y); 32 | } 33 | }; -------------------------------------------------------------------------------- /sinclairv3/cstrike/cdll_engine_int.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | #include "../game/memory/memory.h" 6 | #include "../math/math.h" 7 | 8 | class IClientEntityList { 9 | private: 10 | enum indices { 11 | GET_INDEX = 3, 12 | GET_FROM_HANDLE_INDEX = 4, 13 | GET_HIGHEST_ENITTY_INDEX_INDEX = 6 14 | }; 15 | 16 | public: 17 | template 18 | __forceinline T get(int index) { 19 | return util::vtable::func::getter::the(this, index); 20 | } 21 | 22 | template 23 | __forceinline T get_from_handle(int index) { 24 | return util::vtable::func::getter::the(this, index); 25 | } 26 | 27 | __forceinline int get_highest_entity_index() { 28 | return util::vtable::func::getter::the(this); 29 | } 30 | }; -------------------------------------------------------------------------------- /sinclairv3/cstrike/cdll_int.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | #include "../game/memory/memory.h" 6 | #include "../math/math.h" 7 | 8 | #include "sdk_hud_chat.h" 9 | 10 | #define MAX_PLAYER_NAME_LENGTH 128 11 | #define MAX_STEAM_ID_LENGTH 20 12 | #define MAX_CUSTOM_FILES 4 13 | #define SIGNED_GUID_LEN 32 14 | 15 | class IBaseClientDLL { 16 | private: 17 | enum indices { 18 | GET_ALL_CLASSES_INDEX = 8, 19 | IN_ACTIVATE_MOUSE_INDEX = 15, 20 | IN_DEACTIVATE_MOUSE_INDEX = 16, 21 | DISPATCH_USER_MESSAGE_INDEX = 38 22 | }; 23 | 24 | public: 25 | __forceinline ClientClass* get_all_classes() { 26 | return util::vtable::func::getter::the(this); 27 | } 28 | 29 | __forceinline void in_activate_mouse() { 30 | return util::vtable::func::getter::the(this); 31 | } 32 | 33 | __forceinline void in_deactivate_mouse() { 34 | return util::vtable::func::getter::the(this); 35 | } 36 | 37 | __forceinline bool dispatch_user_message(int msg_type, uint32_t pass_through_flags, uint32_t size, const void* msg = nullptr) { 38 | return util::vtable::func::getter::the(this, msg_type, pass_through_flags, size, msg); 39 | } 40 | }; 41 | 42 | class CHLClient { 43 | public: 44 | char pad_0000[28]; //0x0000 45 | CHudChat* chat_element; //0x001C 46 | char pad_0020[8]; //0x0020 47 | int32_t screen_x; //0x0028 48 | int32_t screen_y; //0x002C 49 | char pad_0030[16]; //0x0030 50 | }; //Size: 0x0040 51 | 52 | struct player_info_t { 53 | // version for future compatibility 54 | uint64_t version; 55 | union { 56 | // steamid64 57 | uint64_t steam_id64; 58 | struct { 59 | uint32_t xuid_low; 60 | uint32_t xuid_high; 61 | }; 62 | }; 63 | // scoreboard information 64 | char name[MAX_PLAYER_NAME_LENGTH]; 65 | // local server user ID, unique while server is running 66 | int user_id; 67 | // global unique player identifer 68 | char guid[SIGNED_GUID_LEN + 1]; 69 | // friends identification number 70 | uint32_t friends_id; 71 | // friends name 72 | char friends_name[MAX_PLAYER_NAME_LENGTH]; 73 | // true, if player is a bot controlled by game.dll 74 | bool fake_player; 75 | // true if player is the HLTV proxy 76 | bool is_hltv; 77 | // custom files CRC for this player 78 | int custom_files[MAX_CUSTOM_FILES]; 79 | // this counter increases each time the server downloaded a new file 80 | uint8_t files_downloaded; 81 | }; 82 | 83 | class IVEngineClient { 84 | private: 85 | enum indices { 86 | CLIENT_CMD_INDEX = 7, 87 | GET_PLAYER_INFO_INDEX = 8, 88 | GET_PLAYER_FOR_UID_INDEX = 9, 89 | GET_LOCAL_PLAYER_INDEX = 12, 90 | GET_VIEW_ANGLES_INDEX = 18, 91 | SET_VIEW_ANGLES_INDEX = 19, 92 | GET_MAX_CLIENTS_INDEX = 20, 93 | IS_IN_GAME_INDEX = 26, 94 | IS_CONNECTED_INDEX = 27, 95 | GET_GAME_DIRECTORY_INDEX = 36, 96 | GET_LEVEL_NAME_INDEX = 53, 97 | GET_LEVEL_NAME_SHORT_INDEX = 54, 98 | IS_TAKING_SCREENSHOT_INDEX = 92, 99 | EXECUTE_CLIENT_CMD_INDEX = 108, 100 | CLIENT_CMD_UNRESTRICTED_INDEX = 114, 101 | SET_BLUR_FADE_INDEX = 180, 102 | IS_VOICE_RECORDING_INDEX = 224 103 | }; 104 | 105 | public: 106 | __forceinline void client_cmd(const char* command) { 107 | return util::vtable::func::getter::the(this, command); 108 | } 109 | 110 | __forceinline bool get_player_info(int entity_index, const player_info_t* info) { 111 | return util::vtable::func::getter::the(this, entity_index, info); 112 | } 113 | 114 | __forceinline int get_player_for_userid(int userid) { 115 | return util::vtable::func::getter::the(this, userid); 116 | } 117 | 118 | __forceinline int get_local_player() { 119 | return util::vtable::func::getter::the(this); 120 | } 121 | 122 | __forceinline void get_view_angles(math::point_3d_t* angle) { 123 | return util::vtable::func::getter::the(this, angle); 124 | } 125 | 126 | __forceinline void set_view_angles(math::point_3d_t* angle) { 127 | return util::vtable::func::getter::the(this, angle); 128 | } 129 | 130 | __forceinline int get_max_clients() { 131 | return util::vtable::func::getter::the(this); 132 | } 133 | 134 | __forceinline bool is_in_game() { 135 | return util::vtable::func::getter::the(this); 136 | } 137 | 138 | __forceinline bool is_connected() { 139 | return util::vtable::func::getter::the(this); 140 | } 141 | 142 | __forceinline bool is_in_game_and_connected() { 143 | return is_in_game() && is_connected(); 144 | } 145 | 146 | __forceinline const char* get_game_directory() { 147 | return util::vtable::func::getter::the(this); 148 | } 149 | 150 | __forceinline const char* get_level_name() { 151 | return util::vtable::func::getter::the(this); 152 | } 153 | 154 | __forceinline const char* get_level_name_short() { 155 | return util::vtable::func::getter::the(this); 156 | } 157 | 158 | __forceinline bool is_taking_screenshot() { 159 | return util::vtable::func::getter::the(this); 160 | } 161 | 162 | __forceinline void execute_client_cmd(const char* command) { 163 | return util::vtable::func::getter::the(this, command); 164 | } 165 | 166 | __forceinline void client_cmd_unrestricted(const char* command) { 167 | return util::vtable::func::getter::the(this, command); 168 | } 169 | 170 | __forceinline void set_blur_fade(float scale) { 171 | return util::vtable::func::getter::the(this, scale); 172 | } 173 | 174 | __forceinline bool is_voice_recording() { 175 | return util::vtable::func::getter::the(this); 176 | } 177 | }; 178 | -------------------------------------------------------------------------------- /sinclairv3/cstrike/clientclass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | #include "../game/memory/memory.h" 6 | #include "../math/math.h" 7 | 8 | #include 9 | 10 | class DVariant { 11 | public: 12 | union { 13 | float as_float; 14 | long as_nt; 15 | char* as_string; 16 | void* as_data; 17 | math::point_3d_t as_vector; 18 | int64_t as_int64; 19 | }; 20 | 21 | SendPropType vType; 22 | }; 23 | 24 | class CRecvProxyData { 25 | public: 26 | const RecvProp* recv_prop; // The property it's receiving. 27 | DVariant value; // The value given to you to store. 28 | int element; // Which array element you're getting. 29 | int object_id; // The object being referred to. 30 | }; 31 | 32 | struct RecvProp { 33 | // This info comes from the receive data table. 34 | 35 | char* var_name; 36 | int recv_type; 37 | int flags; 38 | int string_buf_size; 39 | 40 | bool inside_array; 41 | 42 | const void* extra_data; 43 | 44 | RecvProp* array_prop; 45 | array_length_recv_proxy_t array_length_proxy; 46 | 47 | recv_var_proxy_t proxy_fn; 48 | data_table_recv_var_proxy_t data_table_proxy_fn; 49 | 50 | RecvTable* data_table; 51 | int offset; 52 | 53 | int element_stride; 54 | int elements; 55 | 56 | const char* parent_array_prop_name; 57 | }; 58 | 59 | struct RecvTable { 60 | RecvProp* props; 61 | int props_len; 62 | 63 | CRecvDecoder* decoder; 64 | 65 | char* net_table_name; 66 | 67 | private: 68 | bool initialized; 69 | bool in_main_list; 70 | }; 71 | 72 | struct ClientClass { 73 | create_client_class_t create_fn; 74 | create_event_t create_event_fn; // Only called for event objects. 75 | char* network_name; 76 | RecvTable* recv_table; 77 | ClientClass* next; 78 | ClassIds class_id; // Managed by the engine. 79 | }; 80 | -------------------------------------------------------------------------------- /sinclairv3/cstrike/convar.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | #include "../game/memory/memory.h" 6 | #include "../math/math.h" 7 | 8 | #include "utl_vector.h" 9 | 10 | class CConVar { 11 | private: 12 | enum indices { 13 | GET_FLOAT_INDEX = 12, 14 | GET_INT_INDEX, 15 | SET_VALUE_SZ_INDEX, 16 | SET_VALUE_FLOAT_INDEX, 17 | SET_VALUE_INT_INDEX 18 | }; 19 | 20 | public: 21 | __forceinline float get_float() { 22 | return util::vtable::func::getter::the(this); 23 | } 24 | 25 | __forceinline int get_int() { 26 | return util::vtable::func::getter::the(this); 27 | } 28 | 29 | __forceinline void set_value(const char* value) { 30 | return util::vtable::func::getter::the(this, value); 31 | } 32 | 33 | __forceinline void set_value(float value) { 34 | return util::vtable::func::getter::the(this, value); 35 | } 36 | 37 | __forceinline void set_value(int value) { 38 | return util::vtable::func::getter::the(this, value); 39 | } 40 | 41 | public: 42 | char pad000[0x4]; 43 | CConVar* next; 44 | int registered; 45 | char* name; 46 | char* description; 47 | int flags; 48 | char pad1[0x4]; 49 | CConVar* parent; 50 | char* default_value; 51 | char* string; 52 | int string_length; 53 | float float_value; 54 | int int_value; 55 | int has_min; 56 | float min; 57 | int has_max; 58 | float max; 59 | CUtlVector callback; 60 | }; 61 | 62 | class ICVar { 63 | private: 64 | enum indices { 65 | REGISTER_CON_COMMAND_INDEX = 10, 66 | UNREGISTER_CON_COMMAND_INDEX, 67 | FIND_VAR_INDEX = 15 68 | }; 69 | 70 | public: 71 | __forceinline void register_con_command(CConVar* command) { 72 | return util::vtable::func::getter::the(this, command); 73 | } 74 | 75 | __forceinline void unregister_con_command(CConVar* command) { 76 | return util::vtable::func::getter::the(this, command); 77 | } 78 | 79 | __forceinline CConVar* find_var(const char* name) { 80 | return util::vtable::func::getter::the(this, name); 81 | } 82 | }; -------------------------------------------------------------------------------- /sinclairv3/cstrike/cstrike.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | #include "../game/memory/memory.h" 6 | #include "../math/math.h" 7 | 8 | #include "vgui2/vpanel.h" 9 | #include "vgui/isurface.h" 10 | #include "cusercmd.h" 11 | #include "utl_vector.h" 12 | #include "convar.h" 13 | #include "clientclass.h" 14 | #include "cdll_int.h" 15 | #include "cdll_client_int.h" 16 | #include "cdll_engine_int.h" 17 | #include "globalvars_base.h" 18 | #include "ienginetrace.h" 19 | #include "modelinfo.h" 20 | #include "weapons.h" 21 | #include "inetmessage.h" 22 | #include "imaterial.h" 23 | #include "imaterialvar.h" 24 | #include "imaterialsystem.h" 25 | #include "ivmodelrender.h" 26 | #include "ivdebugoverlay.h" -------------------------------------------------------------------------------- /sinclairv3/cstrike/cusercmd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | #include "../game/memory/memory.h" 6 | #include "../math/math.h" 7 | 8 | class CUserCmd { 9 | public: 10 | char pad000[4]; 11 | 12 | // For matching server and client commands for debugging 13 | int command_number; 14 | 15 | // the tick the client created this command 16 | int tick_count; 17 | 18 | // Player instantaneous view angles. 19 | math::point_3d_t view_angles; 20 | math::point_3d_t aim_direction; // For pointing devices. 21 | 22 | // Intended velocities 23 | // forward velocity. 24 | float forward_move; 25 | // sideways velocity. 26 | float side_move; 27 | // upward velocity. 28 | float up_move; 29 | // Attack button states 30 | int buttons; 31 | // Impulse command issued. 32 | char impulse; 33 | // Current weapon id 34 | int weapon_select; 35 | int weapon_subtype; 36 | 37 | int random_seed; // For shared random functions 38 | 39 | short mouse_dx; // mouse accum in x from create move 40 | short mouse_dy; // mouse accum in y from create move 41 | 42 | // Client only, tracks whether we've predicted this command at least once 43 | bool has_been_predicted; 44 | }; 45 | -------------------------------------------------------------------------------- /sinclairv3/cstrike/defines.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "enums.h" 6 | 7 | typedef uintptr_t CBaseHandle; 8 | typedef uintptr_t HCursor; 9 | typedef uintptr_t HTexture; 10 | typedef uintptr_t HFont; 11 | typedef uintptr_t HPanel; 12 | typedef uintptr_t MaterialHandle; 13 | 14 | class bf_read; 15 | class bf_write; 16 | 17 | class CClientThinkHandlePtr; 18 | typedef CClientThinkHandlePtr* ClientThinkHandle_t; 19 | 20 | class CRecvDecoder; 21 | class DVariant; 22 | class CRecvProxyData; 23 | struct RecvProp; 24 | struct RecvTable; 25 | struct ClientClass; 26 | 27 | class CSaveRestoreData; 28 | 29 | class CHudChat; 30 | class CCSGO_HudChat; 31 | 32 | class CUserCmd; 33 | 34 | class CConVar; 35 | class ICVar; 36 | 37 | struct model_t; 38 | 39 | class IBaseClientDLL; 40 | class CHLClient; 41 | class CGlobalVarsBase; 42 | struct player_info_t; 43 | class IVEngineClient; 44 | class IClientEntityList; 45 | class IInputSystem; 46 | class IEngineTraceClient; 47 | class IMaterial; 48 | struct mstudiobone_t; 49 | struct mstudiobbox_t; 50 | struct mstudiohitboxset_t; 51 | struct studiohdr_t; 52 | class CModelInfo; 53 | class IMaterialSystem; 54 | class CCSWeaponData; 55 | class INetMessage; 56 | class ISurface; 57 | class IMaterial; 58 | class IMaterialVar; 59 | class IVModelRender; 60 | class CIVDebugOverlay; 61 | class SurfacePlat; 62 | class VPanel; 63 | 64 | typedef void(__thiscall* start_drawing_t)(void*); 65 | typedef void(__thiscall* finish_drawing_t)(void*); 66 | 67 | typedef void* (*create_client_class_t)(int entity_number, int serial_number); 68 | typedef void* (*create_event_t)(); 69 | 70 | typedef void(*recv_var_proxy_t)(const CRecvProxyData* proxy_data, void* data, void* out); 71 | typedef void(*data_table_recv_var_proxy_t)(const RecvProp* prop, void** out, void* data, int object_id); 72 | typedef void(*array_length_recv_proxy_t)(void* data, int object_id, int current_array_length); 73 | typedef void(*convar_callback_t)(CConVar* convar, const char* old_svalue, float old_value); 74 | 75 | 76 | // actual defines, sorry, this could've been an enum but i'm lazy :p 77 | #define FCVAR_UNREGISTERED (1<<0) // If this is set, don't add to linked list, etc. 78 | #define FCVAR_DEVELOPMENTONLY (1<<1) // Hidden in released products. Flag is removed automatically if ALLOW_DEVELOPMENT_CVARS is defined. 79 | #define FCVAR_GAMEDLL (1<<2) // defined by the game DLL 80 | #define FCVAR_CLIENTDLL (1<<3) // defined by the client DLL 81 | #define FCVAR_HIDDEN (1<<4) // Hidden. Doesn't appear in find or auto complete. Like DEVELOPMENTONLY, but can't be compiled out. 82 | 83 | // ConVar only 84 | #define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value 85 | #define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server. 86 | #define FCVAR_ARCHIVE (1<<7) // set to cause it to be saved to vars.rc 87 | #define FCVAR_NOTIFY (1<<8) // notifies players when changed 88 | #define FCVAR_USERINFO (1<<9) // changes the client's info string 89 | 90 | #define FCVAR_PRINTABLEONLY (1<<10) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ). 91 | 92 | #define FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS (1<<10) // When on concommands this allows remote clients to execute this cmd on the server. 93 | // We are changing the default behavior of concommands to disallow execution by remote clients without 94 | // this flag due to the number existing concommands that can lag or crash the server when clients abuse them. 95 | 96 | #define FCVAR_UNLOGGED (1<<11) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log 97 | #define FCVAR_NEVER_AS_STRING (1<<12) // never try to print that cvar 98 | 99 | // texture group names 100 | // These are given to FindMaterial to reference the texture groups that show up on the 101 | #define TEXTURE_GROUP_LIGHTMAP "Lightmaps" 102 | #define TEXTURE_GROUP_WORLD "World textures" 103 | #define TEXTURE_GROUP_MODEL "Model textures" 104 | #define TEXTURE_GROUP_STATIC_PROP "StaticProp textures" 105 | #define TEXTURE_GROUP_COMBINED "Combined Textures" 106 | #define TEXTURE_GROUP_COMPOSITE "Composited Textures" 107 | #define TEXTURE_GROUP_VGUI "VGUI textures" 108 | #define TEXTURE_GROUP_PARTICLE "Particle textures" 109 | #define TEXTURE_GROUP_DECAL "Decal textures" 110 | #define TEXTURE_GROUP_SKYBOX "SkyBox textures" 111 | #define TEXTURE_GROUP_CLIENT_EFFECTS "ClientEffect textures" 112 | #define TEXTURE_GROUP_OTHER "Other textures" 113 | #define TEXTURE_GROUP_PRECACHED "Precached" // TODO: assign texture groups to the precached materials 114 | #define TEXTURE_GROUP_CUBE_MAP "CubeMap textures" 115 | #define TEXTURE_GROUP_RENDER_TARGET "RenderTargets" 116 | #define TEXTURE_GROUP_UNACCOUNTED "Unaccounted textures" // Textures that weren't assigned a texture group. 117 | //#define TEXTURE_GROUP_STATIC_VERTEX_BUFFER "Static Vertex" 118 | #define TEXTURE_GROUP_STATIC_INDEX_BUFFER "Static Indices" 119 | #define TEXTURE_GROUP_STATIC_VERTEX_BUFFER_DISP "Displacement Verts" 120 | #define TEXTURE_GROUP_STATIC_VERTEX_BUFFER_COLOR "Lighting Verts" 121 | #define TEXTURE_GROUP_STATIC_VERTEX_BUFFER_WORLD "World Verts" 122 | #define TEXTURE_GROUP_STATIC_VERTEX_BUFFER_MODELS "Model Verts" 123 | #define TEXTURE_GROUP_STATIC_VERTEX_BUFFER_OTHER "Other Verts" 124 | #define TEXTURE_GROUP_DYNAMIC_INDEX_BUFFER "Dynamic Indices" 125 | #define TEXTURE_GROUP_DYNAMIC_VERTEX_BUFFER "Dynamic Verts" 126 | #define TEXTURE_GROUP_DEPTH_BUFFER "DepthBuffer" 127 | #define TEXTURE_GROUP_VIEW_MODEL "ViewModel" 128 | #define TEXTURE_GROUP_PIXEL_SHADERS "Pixel Shaders" 129 | #define TEXTURE_GROUP_VERTEX_SHADERS "Vertex Shaders" 130 | #define TEXTURE_GROUP_RENDER_TARGET_SURFACE "RenderTarget Surfaces" 131 | #define TEXTURE_GROUP_MORPH_TARGETS "Morph Targets" 132 | #define TEXTURE_GROUP_SCALEFORM "Scaleform textures" 133 | 134 | #define BONE_USED_MASK 0x000FFF00 135 | #define BONE_USED_BY_ANYTHING 0x000FFF00 136 | #define BONE_USED_BY_HITBOX 0x00000100 // bone (or child) is used by a hit box 137 | #define BONE_USED_BY_ATTACHMENT 0x00000200 // bone (or child) is used by an attachment point 138 | #define BONE_USED_BY_VERTEX_MASK 0x0003FC00 139 | #define BONE_USED_BY_VERTEX_LOD0 0x00000400 // bone (or child) is used by the toplevel model via skinned vertex 140 | #define BONE_USED_BY_VERTEX_LOD1 0x00000800 141 | #define BONE_USED_BY_VERTEX_LOD2 0x00001000 142 | #define BONE_USED_BY_VERTEX_LOD3 0x00002000 143 | #define BONE_USED_BY_VERTEX_LOD4 0x00004000 144 | #define BONE_USED_BY_VERTEX_LOD5 0x00008000 145 | #define BONE_USED_BY_VERTEX_LOD6 0x00010000 146 | #define BONE_USED_BY_VERTEX_LOD7 0x00020000 147 | #define BONE_USED_BY_BONE_MERGE 0x00040000 // bone is available for bone merge to occur against it 148 | #define BONE_ALWAYS_SETUP 0x00080000 149 | 150 | -------------------------------------------------------------------------------- /sinclairv3/cstrike/enums.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum SendPropType { 4 | DPT_FLOAT = 1, 5 | DPT_VECTOR_3D, 6 | DPT_VECTOR_2D, 7 | DPT_STRING, 8 | DPT_ARRAY, // an array of the base types (can't be of datatables). 9 | DPT_DATA_TABLE, 10 | DPT_INT64, 11 | DPT_NUM_SEND_PROP_TYPES 12 | }; 13 | 14 | enum ClientFrameStages { 15 | FRAME_UNDEFINED = -1, // (haven't run any frames yet) 16 | START, 17 | 18 | // A network packet is being recieved 19 | NET_UPDATE_START, 20 | // Data has been received and we're going to start calling PostDataUpdate 21 | NET_UPDATE_POSTDATAUPDATE_START, 22 | // Data has been received and we've called PostDataUpdate on all data 23 | // recipients 24 | NET_UPDATE_POSTDATAUPDATE_END, 25 | // We've received all packets, we can now do interpolation, prediction, 26 | // etc.. 27 | NET_UPDATE_END, 28 | 29 | // We're about to start rendering the scene 30 | RENDER_START, 31 | // We've finished rendering the scene. 32 | RENDER_END 33 | }; 34 | 35 | enum ClassIds { 36 | C_AI_BASE_NPC, 37 | C_AK47, 38 | C_BASE_ANIMATING, 39 | C_BASE_ANIMATING_OVERLAY, 40 | C_BASE_ATTRIBUTABLE_ITEM, 41 | C_BASE_BUTTON, 42 | C_BASE_COMBAT_CHARACTER, 43 | C_BASE_COMBAT_WEAPON, 44 | C_BASE_CS_GRENADE, 45 | C_BASE_CS_GRENADE_PROJECTILE, 46 | C_BASE_DOOR, 47 | C_BASE_ENTITY, 48 | C_BASE_FLEX, 49 | C_BASE_GRENADE, 50 | C_BASE_PARTICLE_ENTITY, 51 | C_BASE_PLAYER, 52 | C_BASE_PROP_DOOR, 53 | C_BASE_TEAM_OBJECTIVE_RESOURCE, 54 | C_BASE_TEMP_ENTITY, 55 | C_BASE_TOGGLE, 56 | C_BASE_TRIGGER, 57 | C_BASE_VIEW_MODEL, 58 | C_BASE_V_PHYSICS_TRIGGER, 59 | C_BASE_WEAPON_WORLD_MODEL, 60 | C_BEAM, 61 | C_BEAM_SPOTLIGHT, 62 | C_BONE_FOLLOWER, 63 | C_BRC_4_TARGET, 64 | C_BREACH_CHARGE, 65 | C_BREACH_CHARGE_PROJECTILE, 66 | C_BREAKABLE_PROP, 67 | C_BREAKABLE_SURFACE, 68 | C_BUMP_MINE, 69 | C_BUMP_MINE_PROJECTILE, 70 | C_C4, 71 | C_CASCADE_LIGHT, 72 | C_CHICKEN, 73 | C_COLOR_CORRECTION, 74 | C_COLOR_CORRECTION_VOLUME, 75 | C_CS_GAME_RULES_PROXY, 76 | C_CS_PLAYER, 77 | C_CS_PLAYER_RESOURCE, 78 | C_CS_RAGDOLL, 79 | C_CS_TEAM, 80 | C_DANGER_ZONE, 81 | C_DANGER_ZONE_CONTROLLER, 82 | C_DEAGLE, 83 | C_DECOY_GRENADE, 84 | C_DECOY_PROJECTILE, 85 | C_DRONE, 86 | C_DRONEGUN, 87 | C_DYNAMIC_LIGHT, 88 | C_DYNAMIC_PROP, 89 | C_ECON_ENTITY, 90 | C_ECON_WEARABLE, 91 | C_EMBERS, 92 | C_ENTITY_DISSOLVE, 93 | C_ENTITY_FLAME, 94 | C_ENTITY_FREEZING, 95 | C_ENTITY_PARTICLE_TRAIL, 96 | C_ENV_AMBIENT_LIGHT, 97 | C_ENV_DETAIL_CONTROLLER, 98 | C_ENV_DOF_CONTROLLER, 99 | C_ENV_GAS_CANISTER, 100 | C_ENV_PARTICLE_SCRIPT, 101 | C_ENV_PROJECTED_TEXTURE, 102 | C_ENV_QUADRATIC_BEAM, 103 | C_ENV_SCREEN_EFFECT, 104 | C_ENV_SCREEN_OVERLAY, 105 | C_ENV_TONEMAP_CONTROLLER, 106 | C_ENV_WIND, 107 | C_FE_PLAYER_DECAL, 108 | C_FIRE_CRACKER_BLAST, 109 | C_FIRE_SMOKE, 110 | C_FIRE_TRAIL, 111 | C_FISH, 112 | C_FISTS, 113 | C_FLASHBANG, 114 | C_FOG_CONTROLLER, 115 | C_FOOTSTEP_CONTROL, 116 | C_FUNC_DUST, 117 | C_FUNC_LOD, 118 | C_FUNC_AREA_PORTAL_WINDOW, 119 | C_FUNC_BRUSH, 120 | C_FUNC_CONVEYOR, 121 | C_FUNC_LADDER, 122 | C_FUNC_MONITOR, 123 | C_FUNC_MOVE_LINEAR, 124 | C_FUNC_OCCLUDER, 125 | C_FUNC_REFLECTIVE_GLASS, 126 | C_FUNC_ROTATING, 127 | C_FUNC_SMOKE_VOLUME, 128 | C_FUNC_TRACK_TRAIN, 129 | C_GAME_RULES_PROXY, 130 | C_GRASS_BURN, 131 | C_HANDLE_TEST, 132 | C_HE_GRENADE, 133 | C_HOSTAGE, 134 | C_HOSTAGE_CARRIABLE_PROP, 135 | C_INCENDIARY_GRENADE, 136 | C_INFERNO, 137 | C_INFO_LADDER_DISMOUNT, 138 | C_INFO_MAP_REGION, 139 | C_INFO_OVERLAY_ACCESSOR, 140 | C_ITEM_HEALTHSHOT, 141 | C_ITEM_CASH, 142 | C_ITEM_DOGTAGS, 143 | C_KNIFE, 144 | C_KNIFE_GG, 145 | C_LIGHT_GLOW, 146 | C_MAP_VETO_PICK_CONTROLLER, 147 | C_MATERIAL_MODIFY_CONTROL, 148 | C_MELEE, 149 | C_MOLOTOV_GRENADE, 150 | C_MOLOTOV_PROJECTILE, 151 | C_MOVIE_DISPLAY, 152 | C_PARADROP_CHOPPER, 153 | C_PARTICLE_FIRE, 154 | C_PARTICLE_PERFORMANCE_MONITOR, 155 | C_PARTICLE_SYSTEM, 156 | C_PHYS_BOX, 157 | C_PHYS_BOX_MULTIPLAYER, 158 | C_PHYSICS_PROP, 159 | C_PHYSICS_PROP_MULTIPLAYER, 160 | C_PHYS_MAGNET, 161 | C_PHYS_PROP_AMMO_BOX, 162 | C_PHYS_PROP_LOOT_CRATE, 163 | C_PHYS_PROP_RADAR_JAMMER, 164 | C_PHYS_PROP_WEAPON_UPGRADE, 165 | C_PLANTED_C4, 166 | C_PLASMA, 167 | C_PLAYER_PING, 168 | C_PLAYER_RESOURCE, 169 | C_POINT_CAMERA, 170 | C_POINT_COMMENTARY_NODE, 171 | C_POINT_WORLD_TEXT, 172 | C_POSE_CONTROLLER, 173 | C_POST_PROCESS_CONTROLLER, 174 | C_PRECIPITATION, 175 | C_PRECIPITATION_BLOCKER, 176 | C_PREDICTED_VIEW_MODEL, 177 | C_PROP_HALLUCINATION, 178 | C_PROP_COUNTER, 179 | C_PROP_DOOR_ROTATING, 180 | C_PROP_JEEP, 181 | C_PROP_VEHICLE_DRIVEABLE, 182 | C_RAGDOLL_MANAGER, 183 | C_RAGDOLL_PROP, 184 | C_RAGDOLL_PROP_ATTACHED, 185 | C_ROPE_KEYFRAME, 186 | C_SCAR17, 187 | C_SCENE_ENTITY, 188 | C_SENSOR_GRENADE, 189 | C_SENSOR_GRENADE_PROJECTILE, 190 | C_SHADOW_CONTROL, 191 | C_SLIDESHOW_DISPLAY, 192 | C_SMOKE_GRENADE, 193 | C_SMOKE_GRENADE_PROJECTILE, 194 | C_SMOKE_STACK, 195 | C_SNOWBALL, 196 | C_SNOWBALL_PILE, 197 | C_SNOWBALL_PROJECTILE, 198 | C_SPATIAL_ENTITY, 199 | C_SPOTLIGHT_END, 200 | C_SPRITE, 201 | C_SPRITE_ORIENTED, 202 | C_SPRITE_TRAIL, 203 | C_STATUE_PROP, 204 | C_STEAM_JET, 205 | C_SUN, 206 | C_SUNLIGHT_SHADOW_CONTROL, 207 | C_SURVIVAL_SPAWN_CHOPPER, 208 | C_TABLET, 209 | C_TEAM, 210 | C_TEAMPLAY_ROUND_BASED_RULES_PROXY, 211 | C_TE_ARMOR_RICOCHET, 212 | C_TE_BASE_BEAM, 213 | C_TE_BEAM_ENT_POINT, 214 | C_TE_BEAM_ENTS, 215 | C_TE_BEAM_FOLLOW, 216 | C_TE_BEAM_LASER, 217 | C_TE_BEAM_POINTS, 218 | C_TE_BEAM_RING, 219 | C_TE_BEAM_RING_POINT, 220 | C_TE_BEAM_SPLINE, 221 | C_TE_BLOOD_SPRITE, 222 | C_TE_BLOOD_STREAM, 223 | C_TE_BREAK_MODEL, 224 | C_TE_BSP_DECAL, 225 | C_TE_BUBBLES, 226 | C_TE_BUBBLE_TRAIL, 227 | C_TE_CLIENT_PROJECTILE, 228 | C_TE_DECAL, 229 | C_TE_DUST, 230 | C_TE_DYNAMIC_LIGHT, 231 | C_TE_EFFECT_DISPATCH, 232 | C_TE_ENERGY_SPLASH, 233 | C_TE_EXPLOSION, 234 | C_TE_FIRE_BULLETS, 235 | C_TE_FIZZ, 236 | C_TE_FOOTPRINT_DECAL, 237 | C_TE_FOUNDRY_HELPERS, 238 | C_TE_GAUSS_EXPLOSION, 239 | C_TE_GLOW_SPRITE, 240 | C_TE_IMPACT, 241 | C_TE_KILL_PLAYER_ATTACHMENTS, 242 | C_TE_LARGE_FUNNEL, 243 | C_TE_METAL_SPARKS, 244 | C_TE_MUZZLE_FLASH, 245 | C_TE_PARTICLE_SYSTEM, 246 | C_TE_PHYSICS_PROP, 247 | C_TE_PLANT_BOMB, 248 | C_TE_PLAYER_ANIM_EVENT, 249 | C_TE_PLAYER_DECAL, 250 | C_TE_PROJECTED_DECAL, 251 | C_TE_RADIO_ICON, 252 | C_TE_SHATTER_SURFACE, 253 | C_TE_SHOW_LINE, 254 | C_TESLA, 255 | C_TE_SMOKE, 256 | C_TE_SPARKS, 257 | C_TE_SPRITE, 258 | C_TE_SPRITE_SPRAY, 259 | C_TEST_PROXY_TOGGLE_NETWORKABLE, 260 | C_TEST_TRACELINE, 261 | C_TE_WORLD_DECAL, 262 | C_TRIGGER_PLAYER_MOVEMENT, 263 | C_TRIGGER_SOUND_OPERATOR, 264 | C_VGUI_SCREEN, 265 | C_VOTE_CONTROLLER, 266 | C_WATER_BULLET, 267 | C_WATER_LOD_CONTROL, 268 | C_WEAPON_AUG, 269 | C_WEAPON_AWP, 270 | C_WEAPON_BASE_ITEM, 271 | C_WEAPON_BIZON, 272 | C_WEAPON_CS_BASE, 273 | C_WEAPON_CS_BASE_GUN, 274 | C_WEAPON_CYCLER, 275 | C_WEAPON_ELITE, 276 | C_WEAPON_FAMAS, 277 | C_WEAPON_FIVESEVEN, 278 | C_WEAPON_G3SG1, 279 | C_WEAPON_GALIL, 280 | C_WEAPON_GALILAR, 281 | C_WEAPON_GLOCK, 282 | C_WEAPON_HKP2000, 283 | C_WEAPON_M249, 284 | C_WEAPON_M3, 285 | C_WEAPON_M4A1, 286 | C_WEAPON_MAC10, 287 | C_WEAPON_MAG7, 288 | C_WEAPON_MP5_NAVY, 289 | C_WEAPON_MP7, 290 | C_WEAPON_MP9, 291 | C_WEAPON_NEGEV, 292 | C_WEAPON_NOVA, 293 | C_WEAPON_P228, 294 | C_WEAPON_P250, 295 | C_WEAPON_P90, 296 | C_WEAPON_SAWEDOFF, 297 | C_WEAPON_SCAR20, 298 | C_WEAPON_SCOUT, 299 | C_WEAPON_SG550, 300 | C_WEAPON_SG552, 301 | C_WEAPON_SG556, 302 | C_WEAPON_SHIELD, 303 | C_WEAPON_SSG08, 304 | C_WEAPON_TASER, 305 | C_WEAPON_TEC9, 306 | C_WEAPON_TMP, 307 | C_WEAPON_UMP45, 308 | C_WEAPON_USP, 309 | C_WEAPON_XM1014, 310 | C_WEAPON_ZONE_REPULSOR, 311 | C_WORLD, 312 | C_WORLD_VGUI_TEXT, 313 | DUST_TRAIL, 314 | MOVIE_EXPLOSION, 315 | PARTICLE_SMOKE_GRENADE, 316 | ROCKET_TRAIL, 317 | SMOKE_TRAIL, 318 | SPORE_EXPLOSION, 319 | SPORE_TRAIL, 320 | }; 321 | 322 | enum ShouldTransmitState { 323 | SHOULDTRANSMIT_START = 0, // The entity is starting to be transmitted (maybe it entered the PVS). 324 | 325 | SHOULDTRANSMIT_END // Called when the entity isn't being transmitted by the server. 326 | // This signals a good time to hide the entity until next time 327 | // the server wants to transmit its state. 328 | }; 329 | 330 | // NOTE: All of these are commented out; NotifyShouldTransmit actually 331 | // has all these in them. Left it as an enum in case we want to go back though 332 | enum DataUpdateType { 333 | DATA_UPDATE_CREATED = 0, // indicates it was created +and+ entered the pvs 334 | // DATA_UPDATE_ENTERED_PVS, 335 | DATA_UPDATE_DATATABLE_CHANGED, 336 | // DATA_UPDATE_LEFT_PVS, 337 | // DATA_UPDATE_DESTROYED, // FIXME: Could enable this, but it's a little worrying 338 | // since it changes a bunch of existing code 339 | }; 340 | 341 | enum InitReturnVal_t { 342 | INIT_FAILED = 0, 343 | INIT_OK, 344 | 345 | INIT_LAST_VAL, 346 | }; 347 | 348 | enum AppSystemTier_t { 349 | APP_SYSTEM_TIER0 = 0, 350 | APP_SYSTEM_TIER1, 351 | APP_SYSTEM_TIER2, 352 | APP_SYSTEM_TIER3, 353 | 354 | APP_SYSTEM_TIER_OTHER, 355 | }; 356 | 357 | enum CmdButtons { 358 | IN_ATTACK = (1 << 0), 359 | IN_JUMP = (1 << 1), 360 | IN_DUCK = (1 << 2), 361 | IN_FORWARD = (1 << 3), 362 | IN_BACK = (1 << 4), 363 | IN_USE = (1 << 5), 364 | IN_MOVELEFT = (1 << 9), 365 | IN_MOVERIGHT = (1 << 10), 366 | IN_ATTACK2 = (1 << 11), 367 | IN_SCORE = (1 << 16), 368 | IN_BULLRUSH = (1 << 22) 369 | }; 370 | 371 | enum PlayerFlags { 372 | FLAG_ONGROUND = (1 << 0), 373 | FLAG_DUCKING = (1 << 1), 374 | FLAG_ANIMDUCKING = (1 << 2), 375 | FLAG_WATERJUMP = (1 << 3), 376 | FLAG_ONTRAIN = (1 << 4), 377 | FLAG_INRAIN = (1 << 5), 378 | FLAG_FROZEN = (1 << 6), 379 | FLAG_ATCONTROLS = (1 << 7), 380 | FLAG_CLIENT = (1 << 8), 381 | FLAG_FAKECLIENT = (1 << 9), 382 | FLAG_INWATER = (1 << 10), 383 | FLAG_FLY = (1 << 11), 384 | FLAG_SWIM = (1 << 12), 385 | FLAG_CONVEYOR = (1 << 13), 386 | FLAG_NPC = (1 << 14), 387 | FLAG_GODMODE = (1 << 15), 388 | FLAG_NOTARGET = (1 << 16), 389 | FLAG_ANIMTARGET = (1 << 17), 390 | FLAG_PARTIALGROUND = (1 << 18), 391 | FLAG_STATICPROP = (1 << 19), 392 | FLAG_GRAPHED = (1 << 20), 393 | FLAG_GRENADE = (1 << 21), 394 | FLAG_STEPMOVEMENT = (1 << 22), 395 | FLAG_DONTTOUCH = (1 << 23), 396 | FLAG_BASEVELOCITY = (1 << 24), 397 | FLAG_WORLDBRUSH = (1 << 25), 398 | FLAG_OBJECT = (1 << 26), 399 | FLAG_KILLME = (1 << 27), 400 | FLAG_ONFIRE = (1 << 28), 401 | FLAG_DISSOLVING = (1 << 29), 402 | FLAG_TRANSRAGDOLL = (1 << 30), 403 | FLAG_UNBLOCKABLE_BY_PLAYER = (1 << 31) 404 | }; 405 | 406 | enum MoveTypes { 407 | MOVETYPE_NONE = 0, 408 | MOVETYPE_ISOMETRIC, 409 | MOVETYPE_WALK, 410 | MOVETYPE_STEP, 411 | MOVETYPE_FLY, 412 | MOVETYPE_FLYGRAVITY, 413 | MOVETYPE_VPHYSICS, 414 | MOVETYPE_PUSH, 415 | MOVETYPE_NOCLIP, 416 | MOVETYPE_LADDER, 417 | MOVETYPE_OBSERVER, 418 | MOVETYPE_CUSTOM, 419 | MOVETYPE_LAST = MOVETYPE_CUSTOM, 420 | MOVETYPE_MAX_BITS = 4 421 | }; 422 | 423 | enum TeamIds { 424 | TEAM_NONE = 0, 425 | TEAM_SPECTATOR = 1, 426 | TEAM_TERRORIST = 2, 427 | TEAM_COUNTER_TERRORIST = 3 428 | }; 429 | 430 | enum ObserverModes { 431 | MODE_NONE = 0, 432 | MODE_DEATHCAM, 433 | MODE_FREEZECAM, 434 | MODE_FIXED, 435 | MODE_IN_EYE, 436 | MODE_CHASE, 437 | MODE_ROAMING, 438 | }; 439 | 440 | enum ChatFilters { 441 | CHAT_FILTER_NONE = 0, 442 | CHAT_FILTER_JOINLEAVE = 1, 443 | CHAT_FILTER_NAMECHANGE = 2, 444 | CHAT_FILTER_PUBLICCHAT = 4, 445 | CHAT_FILTER_SERVERMSG = 8, 446 | CHAT_FILTER_TEAMCHANGE = 10, 447 | CHAT_FILTER_ACHIEVEMENT = 20 448 | }; 449 | 450 | enum ButtonCode { 451 | KEY_INVALID = 0x0, 452 | KEY_0 = 0x1, 453 | KEY_1 = 0x2, 454 | KEY_2 = 0x3, 455 | KEY_3 = 0x4, 456 | KEY_4 = 0x5, 457 | KEY_5 = 0x6, 458 | KEY_6 = 0x7, 459 | KEY_7 = 0x8, 460 | KEY_8 = 0x9, 461 | KEY_9 = 0xA, 462 | KEY_A = 0xB, 463 | KEY_B = 0xC, 464 | KEY_C = 0xD, 465 | KEY_D = 0xE, 466 | KEY_E = 0xF, 467 | KEY_F = 0x10, 468 | KEY_G = 0x11, 469 | KEY_H = 0x12, 470 | KEY_I = 0x13, 471 | KEY_J = 0x14, 472 | KEY_K = 0x15, 473 | KEY_L = 0x16, 474 | KEY_M = 0x17, 475 | KEY_N = 0x18, 476 | KEY_O = 0x19, 477 | KEY_P = 0x1A, 478 | KEY_Q = 0x1B, 479 | KEY_R = 0x1C, 480 | KEY_S = 0x1D, 481 | KEY_T = 0x1E, 482 | KEY_U = 0x1F, 483 | KEY_V = 0x20, 484 | KEY_W = 0x21, 485 | KEY_X = 0x22, 486 | KEY_Y = 0x23, 487 | KEY_Z = 0x24, 488 | KEY_PAD_0 = 0x25, 489 | KEY_PAD_1 = 0x26, 490 | KEY_PAD_2 = 0x27, 491 | KEY_PAD_3 = 0x28, 492 | KEY_PAD_4 = 0x29, 493 | KEY_PAD_5 = 0x2A, 494 | KEY_PAD_6 = 0x2B, 495 | KEY_PAD_7 = 0x2C, 496 | KEY_PAD_8 = 0x2D, 497 | KEY_PAD_9 = 0x2E, 498 | KEY_PAD_DIVIDE = 0x2F, 499 | KEY_PAD_MULTIPLY = 0x30, 500 | KEY_PAD_MINUS = 0x31, 501 | KEY_PAD_PLUS = 0x32, 502 | KEY_PAD_ENTER = 0x33, 503 | KEY_PAD_DECIMAL = 0x34, 504 | KEY_LBRACKET = 0x35, 505 | KEY_RBRACKET = 0x36, 506 | KEY_SEMICOLON = 0x37, 507 | KEY_APOSTROPHE = 0x38, 508 | KEY_BACKQUOTE = 0x39, 509 | KEY_COMMA = 0x3A, 510 | KEY_PERIOD = 0x3B, 511 | KEY_SLASH = 0x3C, 512 | KEY_BACKSLASH = 0x3D, 513 | KEY_MINUS = 0x3E, 514 | KEY_EQUAL = 0x3F, 515 | KEY_ENTER = 0x40, 516 | KEY_SPACE = 0x41, 517 | KEY_BACKSPACE = 0x42, 518 | KEY_TAB = 0x43, 519 | KEY_CAPSLOCK = 0x44, 520 | KEY_NUMLOCK = 0x45, 521 | KEY_ESCAPE = 0x46, 522 | KEY_SCROLLLOCK = 0x47, 523 | KEY_INSERT = 0x48, 524 | KEY_DELETE = 0x49, 525 | KEY_HOME = 0x4A, 526 | KEY_END = 0x4B, 527 | KEY_PAGEUP = 0x4C, 528 | KEY_PAGEDOWN = 0x4D, 529 | KEY_BREAK = 0x4E, 530 | KEY_LSHIFT = 0x4F, 531 | KEY_RSHIFT = 0x50, 532 | KEY_LALT = 0x51, 533 | KEY_RALT = 0x52, 534 | KEY_LCONTROL = 0x53, 535 | KEY_RCONTROL = 0x54, 536 | KEY_LWIN = 0x55, 537 | KEY_RWIN = 0x56, 538 | KEY_APP = 0x57, 539 | KEY_UP = 0x58, 540 | KEY_LEFT = 0x59, 541 | KEY_DOWN = 0x5A, 542 | KEY_RIGHT = 0x5B, 543 | KEY_F1 = 0x5C, 544 | KEY_F2 = 0x5D, 545 | KEY_F3 = 0x5E, 546 | KEY_F4 = 0x5F, 547 | KEY_F5 = 0x60, 548 | KEY_F6 = 0x61, 549 | KEY_F7 = 0x62, 550 | KEY_F8 = 0x63, 551 | KEY_F9 = 0x64, 552 | KEY_F10 = 0x65, 553 | KEY_F11 = 0x66, 554 | KEY_F12 = 0x67, 555 | KEY_MOUSE_1 = 0x6B, 556 | KEY_MOUSE_2 = 0x6C, 557 | KEY_MOUSE_3 = 0x6D, 558 | KEY_MOUSE_4 = 0x6E, 559 | KEY_MOUSE_5 = 0x6F 560 | }; 561 | 562 | enum CursorCode { 563 | DC_USER, 564 | DC_NONE, 565 | DC_ARROW, 566 | DC_IBEAM, 567 | DC_HOURGLASS, 568 | DC_WAITARROW, 569 | DC_CROSSHAIR, 570 | DC_UP, 571 | DC_SIZENWSE, 572 | DC_SIZENESW, 573 | DC_SIZEWE, 574 | DC_SIZENS, 575 | DC_SIZEALL, 576 | DC_NO, 577 | DC_HAND, 578 | DC_BLANK, // don't show any custom vgui cursor, just let windows do it stuff (for HTML widget) 579 | DC_LAST, 580 | }; 581 | 582 | enum TraceType { 583 | TRACE_EVERYTHING = 0, 584 | TRACE_WORLD_ONLY, 585 | TRACE_ENTITIES_ONLY, 586 | TRACE_EVERYTHING_FILTER_PROPS, 587 | }; 588 | 589 | enum Contents { 590 | CONTENTS_EMPTY = 0X0, 591 | CONTENTS_SOLID = 0X1, 592 | CONTENTS_WINDOW = 0X2, 593 | CONTENTS_AUX = 0X4, 594 | CONTENTS_GRATE = 0X8, 595 | CONTENTS_SLIME = 0X10, 596 | CONTENTS_WATER = 0X20, 597 | CONTENTS_BLOCKLOS = 0X40, 598 | CONTENTS_OPAQUE = 0X80, 599 | CONTENTS_TESTFOGVOLUME = 0X100, 600 | CONTENTS_UNUSED = 0X200, 601 | CONTENTS_BLOCKLIGHT = 0X400, 602 | CONTENTS_TEAM1 = 0X800, 603 | CONTENTS_TEAM2 = 0X1000, 604 | CONTENTS_IGNORE_NODRAW_OPAQUE = 0X2000, 605 | CONTENTS_MOVEABLE = 0X4000, 606 | CONTENTS_AREAPORTAL = 0X8000, 607 | CONTENTS_PLAYERCLIP = 0X10000, 608 | CONTENTS_MONSTERCLIP = 0X20000, 609 | CONTENTS_CURRENT0 = 0X40000, 610 | CONTENTS_CURRENT90 = 0X80000, 611 | CONTENTS_CURRENT180 = 0X100000, 612 | CONTENTS_CURRENT270 = 0X200000, 613 | CONTENTS_CURRENT_UP = 0X400000, 614 | CONTENTS_CURRENT_DOWN = 0X800000, 615 | CONTENTS_ORIGIN = 0X1000000, 616 | CONTENTS_MONSTER = 0X2000000, 617 | CONTENTS_DEBRIS = 0X4000000, 618 | CONTENTS_DETAIL = 0X8000000, 619 | CONTENTS_TRANSLUCENT = 0X10000000, 620 | CONTENTS_LADDER = 0X20000000, 621 | CONTENTS_HITBOX = 0X40000000, 622 | 623 | LAST_VISIBLE_CONTENTS = CONTENTS_OPAQUE, 624 | ALL_VISIBLE_CONTENTS = LAST_VISIBLE_CONTENTS | LAST_VISIBLE_CONTENTS - 1 625 | }; 626 | 627 | enum Masks { 628 | MASK_ALL = 0XFFFFFFFF, 629 | MASK_SOLID = (CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_WINDOW | CONTENTS_MONSTER | CONTENTS_GRATE), 630 | MASK_PLAYERSOLID = (CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_PLAYERCLIP | CONTENTS_WINDOW | CONTENTS_MONSTER | CONTENTS_GRATE), 631 | MASK_NPCSOLID = (CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_MONSTERCLIP | CONTENTS_WINDOW | CONTENTS_MONSTER | CONTENTS_GRATE), 632 | MASK_NPCFLUID = (CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_MONSTERCLIP | CONTENTS_WINDOW | CONTENTS_MONSTER), 633 | MASK_WATER = (CONTENTS_WATER | CONTENTS_MOVEABLE | CONTENTS_SLIME), 634 | MASK_OPAQUE = (CONTENTS_WATER | CONTENTS_MOVEABLE | CONTENTS_OPAQUE), 635 | MASK_OPAQUE_NPC = (MASK_OPAQUE | CONTENTS_MONSTER), 636 | MASK_BLOCKLOS = (CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_SLIME), 637 | MASK_BLOCKLOS_NPC = (MASK_BLOCKLOS | CONTENTS_MONSTER), 638 | MASK_VISIBLE = (MASK_OPAQUE | CONTENTS_IGNORE_NODRAW_OPAQUE), 639 | MASK_VISIBLE_NPC = (MASK_OPAQUE_NPC | CONTENTS_IGNORE_NODRAW_OPAQUE), 640 | MASK_SHOT = (CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_MONSTER | CONTENTS_WINDOW | CONTENTS_DEBRIS | CONTENTS_HITBOX), 641 | MASK_SHOT_BRUSHONLY = (CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_WINDOW | CONTENTS_DEBRIS), 642 | MASK_SHOT_HULL = (CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_MONSTER | CONTENTS_WINDOW | CONTENTS_DEBRIS | CONTENTS_GRATE), 643 | MASK_SHOT_PLAYER = (MASK_SHOT_HULL | CONTENTS_HITBOX), 644 | MASK_SHOT_PORTAL = (CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_WINDOW | CONTENTS_MONSTER), 645 | MASK_SOLID_BRUSHONLY = (CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_WINDOW | CONTENTS_GRATE), 646 | MASK_PLAYERSOLID_BRUSHONLY = (CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_WINDOW | CONTENTS_PLAYERCLIP | CONTENTS_GRATE), 647 | MASK_NPCSOLID_BRUSHONLY = (CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_WINDOW | CONTENTS_MONSTERCLIP | CONTENTS_GRATE), 648 | MASK_NPCWORLDSTATIC = (CONTENTS_SOLID | CONTENTS_WINDOW | CONTENTS_MONSTERCLIP | CONTENTS_GRATE), 649 | MASK_NPCWORLDSTATIC_FLUID = (CONTENTS_SOLID | CONTENTS_WINDOW | CONTENTS_MONSTERCLIP), 650 | MASK_SPLITAREAPORTAL = (CONTENTS_WATER | CONTENTS_SLIME), 651 | MASK_CURRENT = (CONTENTS_CURRENT0 | CONTENTS_CURRENT90 | CONTENTS_CURRENT180 | CONTENTS_CURRENT270 | CONTENTS_CURRENT_UP | CONTENTS_CURRENT_DOWN), 652 | MASK_DEADSOLID = (CONTENTS_SOLID | CONTENTS_PLAYERCLIP | CONTENTS_WINDOW | CONTENTS_GRATE) 653 | }; 654 | 655 | enum ClcMessages { 656 | CLC_CLIENT_INFO = 8, // client info (table CRC etc) 657 | CLC_MOVE = 9, // [CUserCmd] 658 | CLC_VOICE_DATA = 10, // Voicestream data from a client 659 | CLC_BASELINE_ACK = 11, // client acknowledges a new baseline seqnr 660 | CLC_LISTEN_EVENTS = 12, // client acknowledges a new baseline seqnr 661 | CLC_RESPOND_CVAR_VALUE = 13, // client is responding to a svc_GetCvarValue message. 662 | CLC_FIRE_CRC_CHECK = 14, // client is sending a file's CRC to the server to be verified. 663 | CLC_LOADING_PROGRESS = 15, // client loading progress 664 | CLC_SPLIT_PLAYER_CONNECT = 16, 665 | CLC_CLIENT_MESSAGE = 17, 666 | CLC_CMD_KEY_VALUES = 18, 667 | CLC_HLTV_REPLAY = 20 668 | }; 669 | 670 | enum WeaponType { 671 | TYPE_KNIFE = 0, 672 | TYPE_PISTOL, 673 | TYPE_SUBMACHINE_GUN, 674 | TYPE_RIFLE, 675 | TYPE_SHOTGUN, 676 | TYPE_SNIPER_RIFLE, 677 | TYPE_MACHINE_GUN, 678 | TYPE_C4, 679 | TYPE_PLACEHOLDER, 680 | TYPE_GRENADE, 681 | TYPE_UNKNOWN, 682 | TYPE_STACKABLE_ITEM, 683 | TYPE_FISTS, 684 | TYPE_BREACH_CHARGE, 685 | TYPE_BUMP_MINE, 686 | TYPE_TABLET, 687 | TYPE_MELEE 688 | }; 689 | 690 | enum PaintMode { 691 | PAINT_UI_PANELS = (1 << 0), 692 | PAINT_IN_GAME_PANELS = (1 << 1), 693 | }; 694 | 695 | enum FontFeature { 696 | FONT_FEATURE_ANTIALIASED_FONTS = 1, 697 | FONT_FEATURE_DROPSHADOW_FONTS = 2, 698 | FONT_FEATURE_OUTLINE_FONTS = 6, 699 | }; 700 | 701 | enum FontDrawType { 702 | FONT_DRAW_DEFAULT = 0, 703 | FONT_DRAW_NONADDITIVE, 704 | FONT_DRAW_ADDITIVE, 705 | FONT_DRAW_TYPE_COUNT = 2, 706 | }; 707 | 708 | enum FontFlags { 709 | FONTFLAG_NONE, 710 | FONTFLAG_ITALIC = 0x001, 711 | FONTFLAG_UNDERLINE = 0x002, 712 | FONTFLAG_STRIKEOUT = 0x004, 713 | FONTFLAG_SYMBOL = 0x008, 714 | FONTFLAG_ANTIALIAS = 0x010, 715 | FONTFLAG_GAUSSIANBLUR = 0x020, 716 | FONTFLAG_ROTARY = 0x040, 717 | FONTFLAG_DROPSHADOW = 0x080, 718 | FONTFLAG_ADDITIVE = 0x100, 719 | FONTFLAG_OUTLINE = 0x200, 720 | FONTFLAG_CUSTOM = 0x400, 721 | FONTFLAG_BITMAP = 0x800, 722 | }; 723 | 724 | enum MaterialVarFlags { 725 | MATERIAL_VAR_DEBUG = (1 << 0), 726 | MATERIAL_VAR_NO_DEBUG_OVERRIDE = (1 << 1), 727 | MATERIAL_VAR_NO_DRAW = (1 << 2), 728 | MATERIAL_VAR_USE_IN_FILLRATE_MODE = (1 << 3), 729 | MATERIAL_VAR_VERTEXCOLOR = (1 << 4), 730 | MATERIAL_VAR_VERTEXALPHA = (1 << 5), 731 | MATERIAL_VAR_SELFILLUM = (1 << 6), 732 | MATERIAL_VAR_ADDITIVE = (1 << 7), 733 | MATERIAL_VAR_ALPHATEST = (1 << 8), 734 | MATERIAL_VAR_MULTIPASS = (1 << 9), 735 | MATERIAL_VAR_ZNEARER = (1 << 10), 736 | MATERIAL_VAR_MODEL = (1 << 11), 737 | MATERIAL_VAR_FLAT = (1 << 12), 738 | MATERIAL_VAR_NOCULL = (1 << 13), 739 | MATERIAL_VAR_NOFOG = (1 << 14), 740 | MATERIAL_VAR_IGNOREZ = (1 << 15), 741 | MATERIAL_VAR_DECAL = (1 << 16), 742 | MATERIAL_VAR_ENVMAPSPHERE = (1 << 17), 743 | MATERIAL_VAR_NOALPHAMOD = (1 << 18), 744 | MATERIAL_VAR_ENVMAPCAMERASPACE = (1 << 19), 745 | MATERIAL_VAR_BASEALPHAENVMAPMASK = (1 << 20), 746 | MATERIAL_VAR_TRANSLUCENT = (1 << 21), 747 | MATERIAL_VAR_NORMALMAPALPHAENVMAPMASK = (1 << 22), 748 | MATERIAL_VAR_NEEDS_SOFTWARE_SKINNING = (1 << 23), 749 | MATERIAL_VAR_OPAQUETEXTURE = (1 << 24), 750 | MATERIAL_VAR_ENVMAPMODE = (1 << 25), 751 | MATERIAL_VAR_SUPPRESS_DECALS = (1 << 26), 752 | MATERIAL_VAR_HALFLAMBERT = (1 << 27), 753 | MATERIAL_VAR_WIREFRAME = (1 << 28), 754 | MATERIAL_VAR_ALLOWALPHATOCOVERAGE = (1 << 29), 755 | MATERIAL_VAR_ALPHA_MODIFIED_BY_PROXY = (1 << 30), 756 | MATERIAL_VAR_VERTEXFOG = (1 << 31) 757 | }; 758 | 759 | enum LifeStates { 760 | LIFE_ALIVE = 0, 761 | LIFE_DYING, 762 | LIFE_DEAD, 763 | LIFE_RESPAWNABLE, 764 | LIFE_DISCARDBODY, 765 | }; -------------------------------------------------------------------------------- /sinclairv3/cstrike/globalvars_base.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | #include "../game/memory/memory.h" 6 | #include "../math/math.h" 7 | 8 | class CGlobalVarsBase { 9 | public: 10 | // Absolute time (per frame still - Use Plat_FloatTime() for a high precision real time 11 | // perf clock, but not that it doesn't obey host_timescale/host_framerate) 12 | float real_time; 13 | // Absolute frame counter - continues to increase even if game is paused 14 | int frame_count; 15 | // Non-paused frametime 16 | float absolute_frame_time; 17 | float absolute_frame_time_std_dev; 18 | 19 | // Current time 20 | // 21 | // On the client, this (along with tickcount) takes a different meaning based on what 22 | // piece of code you're in: 23 | // 24 | // - While receiving network packets (like in PreDataUpdate/PostDataUpdate and proxies), 25 | // this is set to the SERVER TICKCOUNT for that packet. There is no interval between 26 | // the server ticks. 27 | // [server_current_Tick * tick_interval] 28 | // 29 | // - While rendering, this is the exact client clock 30 | // [client_current_tick * tick_interval + interpolation_amount] 31 | // 32 | // - During prediction, this is based on the client's current tick: 33 | // [client_current_tick * tick_interval] 34 | float cur_time; 35 | 36 | // Time spent on last server or client frame (has nothing to do with think intervals) 37 | float frame_time; 38 | // current maxplayers setting 39 | int max_clients; 40 | 41 | // Simulation ticks - does not increase when game is paused 42 | int tick_count; 43 | 44 | // Simulation tick interval 45 | float interval_per_tick; 46 | 47 | int network_protocol; 48 | 49 | // current saverestore data 50 | CSaveRestoreData* save_data; 51 | 52 | // Set to true in client code. 53 | bool client; 54 | 55 | // true if we are a remote client (needs prediction & interpolation - server not on this machine) as opposed to split-screen or local 56 | bool remote_client; 57 | 58 | /* 59 | private: 60 | // 100 (i.e., tickcount is rounded down to this base and then the "delta" from this base is networked 61 | int nTimestampNetworkingBase; 62 | // 32 (entindex() % nTimestampRandomizeWindow ) is subtracted from gpGlobals->tickcount to set the networking basis, prevents 63 | // all of the entities from forcing a new PackedEntity on the same tick (i.e., prevents them from getting lockstepped on this) 64 | int nTimestampRandomizeWindow; 65 | */ 66 | }; 67 | -------------------------------------------------------------------------------- /sinclairv3/cstrike/ienginetrace.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | #include "../game/memory/memory.h" 6 | #include "../math/math.h" 7 | 8 | struct Ray_t { 9 | __declspec(align(16)) math::point_3d_t start; 10 | __declspec(align(16)) math::point_3d_t delta; 11 | __declspec(align(16)) math::point_3d_t start_offset; 12 | __declspec(align(16)) math::point_3d_t extents; 13 | const math::matrix* world_axis_transform = nullptr; 14 | //without your matrix3x4 15 | bool is_ray; 16 | bool is_swept; 17 | 18 | __forceinline void init(math::point_3d_t const& start, math::point_3d_t const& end) { 19 | delta = end - start; 20 | 21 | is_swept = (delta.length_sqr() != 0); 22 | 23 | extents.x = extents.y = extents.z = 0.0f; 24 | 25 | is_ray = true; 26 | 27 | start_offset.x = start_offset.y = start_offset.z = 0.0f; 28 | 29 | this->start = start; 30 | } 31 | 32 | __forceinline void init(math::point_3d_t const& start, math::point_3d_t const& end, math::point_3d_t const& mins, math::point_3d_t const& maxs) { 33 | delta = end - start; 34 | 35 | world_axis_transform = nullptr; 36 | is_swept = (delta.length_sqr() != 0); 37 | 38 | extents = maxs - mins; 39 | extents *= 0.5f; 40 | is_ray = (extents.length_sqr() < 1e-6); 41 | 42 | start_offset = maxs + mins; 43 | start_offset *= 0.5f; 44 | this->start = math::point_3d_t(start) + start_offset; 45 | start_offset *= -1.0f; 46 | } 47 | }; 48 | 49 | struct cplane_t { 50 | math::point_3d_t normal; 51 | float dist; 52 | uint8_t type; // for fast side tests 53 | uint8_t signbits; // signx + (signy<<1) + (signz<<1) 54 | char pad000[2]; 55 | }; 56 | 57 | class CBaseTrace { 58 | public: 59 | math::point_3d_t start_pos; 60 | math::point_3d_t end_pos; 61 | cplane_t plane; 62 | float fraction; 63 | int contents; 64 | unsigned short disp_flags; 65 | bool all_solid; 66 | bool start_solid; 67 | }; 68 | 69 | struct csurface_t { 70 | const char* name; 71 | short surface_props; 72 | unsigned short flags; 73 | }; 74 | 75 | class CGameTrace : public CBaseTrace { 76 | public: 77 | 78 | // Returns true if hEnt points at the world entity. 79 | // If this returns true, then you can't use GetHitBoxIndex(). 80 | bool dit_hit_world() const; 81 | 82 | // Returns true if we hit something and it wasn't the world. 83 | bool did_hit_non_world_entity() const; 84 | 85 | // Gets the entity's network index if the trace has hit an entity. 86 | // If not, returns -1. 87 | int get_entity_index() const; 88 | 89 | // Returns true if there was any kind of impact at all 90 | bool did_hit() const; 91 | public: 92 | 93 | float fraction_left_solid; // time we left a solid, only valid if we started in solid 94 | csurface_t surface; // surface hit (impact surface) 95 | 96 | int hit_group; // 0 == generic, non-zero is specific body part 97 | short physics_bone; // physics bone hit by trace in studio 98 | 99 | #if defined( CLIENT_DLL ) 100 | C_BaseEntity* m_pEnt; 101 | #else 102 | // Change when I add this 103 | void* ent; 104 | #endif 105 | 106 | // NOTE: this member is overloaded. 107 | // If hEnt points at the world entity, then this is the static prop index. 108 | // Otherwise, this is the hitbox index. 109 | int hitbox; // box hit by trace in studio 110 | 111 | __forceinline CGameTrace() {} 112 | 113 | private: 114 | // No copy constructors allowed 115 | CGameTrace(const CGameTrace& vOther); 116 | }; 117 | 118 | 119 | //----------------------------------------------------------------------------- 120 | // Returns true if there was any kind of impact at all 121 | //----------------------------------------------------------------------------- 122 | __forceinline bool CGameTrace::did_hit() const { 123 | return fraction < 1 || all_solid || start_solid; 124 | } 125 | 126 | __forceinline bool CGameTrace::dit_hit_world() const { 127 | return ent != nullptr; 128 | } 129 | 130 | __forceinline bool CGameTrace::did_hit_non_world_entity() const { 131 | return ent != nullptr && !dit_hit_world(); 132 | } 133 | 134 | class ITraceFilter { 135 | public: // IClientEntity 136 | virtual bool should_hit_entity(void* pEntity, int contentsMask) = 0; 137 | virtual TraceType get_trace_type() const = 0; 138 | }; 139 | 140 | class CTraceFilter : public ITraceFilter { 141 | public: // IClientEntity 142 | bool should_hit_entity(void* entity_handle, int contents_mask) { 143 | return !(entity_handle == skip); 144 | } 145 | 146 | TraceType get_trace_type() const { 147 | return TRACE_EVERYTHING; 148 | } 149 | 150 | void* skip; 151 | }; 152 | 153 | class CTraceFilterSkipTwoEntities : public ITraceFilter { 154 | public: 155 | __forceinline CTraceFilterSkipTwoEntities(void* pass_ent1, void* pass_ent2) { 156 | skip1 = pass_ent1; 157 | skip2 = pass_ent2; 158 | } 159 | // IClientEntity 160 | virtual bool should_hit_entity(void* entity_handle, int contents_mask) { 161 | return !(entity_handle == skip1 || entity_handle == skip2); 162 | } 163 | virtual TraceType get_trace_type() const { 164 | return TRACE_EVERYTHING; 165 | } 166 | 167 | void* skip1; 168 | void* skip2; 169 | }; 170 | 171 | class IEngineTraceClient { 172 | public: 173 | virtual int get_point_contents(const math::point_3d_t& vec_abs_pos, int content_mask = MASK_ALL, void** entity = nullptr) = 0; 174 | virtual int get_point_contents_world_only(const math::point_3d_t& vec_abs_pos, int content_mask = MASK_ALL) = 0; 175 | virtual int get_point_contents_collideable(void* collide, const math::point_3d_t& vec_abs_pos) = 0; 176 | // IClientEntity 177 | virtual void clip_ray_to_entity(const Ray_t& ray, unsigned int fmask, void* ent, CGameTrace* trace) = 0; 178 | virtual void clip_ray_to_collideable(const Ray_t& ray, unsigned int fmask, void* collide, CGameTrace* trace) = 0; 179 | virtual void trace_ray(const Ray_t& ray, unsigned int fmask, ITraceFilter* trace_filter, CGameTrace* trace) = 0; 180 | }; 181 | -------------------------------------------------------------------------------- /sinclairv3/cstrike/imaterial.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | #include "../game/memory/memory.h" 6 | #include "../math/math.h" 7 | 8 | class IMaterial { 9 | private: 10 | enum indices { 11 | GET_NAME_INDEX = 0, 12 | GET_TEXTURE_GROUP_NAME_INDEX = 1, 13 | FIND_VAR_INDEX = 8, 14 | ALPHA_MODULATE_INDEX = 27, 15 | COLOR_MODULATE_INDEX = 28, 16 | SET_MATERIAL_VAR_FLAG_INDEX = 29 17 | }; 18 | 19 | public: 20 | __forceinline const char* get_name() { 21 | return util::vtable::func::getter::the(this); 22 | } 23 | 24 | __forceinline const char* get_texture_group_name() { 25 | return util::vtable::func::getter::the(this); 26 | } 27 | 28 | __forceinline IMaterialVar* find_var(const char* var_name, bool* found, bool complain = true) { 29 | return util::vtable::func::getter::the(this, var_name, found, complain); 30 | } 31 | 32 | __forceinline void alpha_modulate(float a) { 33 | return util::vtable::func::getter::the(this, a); 34 | } 35 | 36 | __forceinline void color_modulate(float r, float g, float b) { 37 | return util::vtable::func::getter::the(this, r, g, b); 38 | } 39 | 40 | __forceinline void set_material_var_flag(MaterialVarFlags flag, bool on) { 41 | return util::vtable::func::getter::the(this, flag, on); 42 | } 43 | }; -------------------------------------------------------------------------------- /sinclairv3/cstrike/imaterialsystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | #include "../game/memory/memory.h" 6 | #include "../math/math.h" 7 | 8 | class IMaterialSystem { 9 | private: 10 | enum indices { 11 | CREATE_MATERIAL_INDEX = 83, 12 | FIND_MATERIAL_INDEX = 84, 13 | GET_MATERIAL_INDEX = 89 14 | }; 15 | 16 | public: 17 | // Reminder: Implement KeyValues 18 | __forceinline IMaterial* create_material(const char* material_name, void* key_values) { 19 | return util::vtable::func::getter::the(this, material_name, key_values); 20 | } 21 | 22 | __forceinline IMaterial* find_material(const char* material_name, const char* texture_group, bool complain = true, const char* complain_prefix = "") { 23 | return util::vtable::func::getter::the(this, material_name, texture_group, complain, complain_prefix); 24 | } 25 | 26 | __forceinline IMaterial* get_material(MaterialHandle handle) { 27 | return util::vtable::func::getter::the(this, handle); 28 | } 29 | }; -------------------------------------------------------------------------------- /sinclairv3/cstrike/imaterialvar.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | #include "../game/memory/memory.h" 6 | #include "../math/math.h" 7 | 8 | class IMaterialVar { 9 | private: 10 | enum indices { 11 | SET_FLOAT_VALUE_INDEX = 4, 12 | SET_INT_VALUE_INDEX = 5, 13 | SET_STRING_VALUE_INDEX = 6, 14 | GET_STRING_VALUE_INDEX = 7, 15 | SET_VEC_2D_VALUE_INDEX = 11, 16 | SET_VEC_3D_VALUE_INDEX = 12 17 | }; 18 | 19 | public: 20 | __forceinline void set_float_value(float value) { 21 | return util::vtable::func::getter::the(this, value); 22 | } 23 | 24 | __forceinline void set_int_value(int value) { 25 | return util::vtable::func::getter::the(this, value); 26 | } 27 | 28 | __forceinline void set_string_value(const char* value) { 29 | return util::vtable::func::getter::the(this, value); 30 | } 31 | 32 | __forceinline const char* get_string_value() { 33 | return util::vtable::func::getter::the(this); 34 | } 35 | 36 | __forceinline void set_vec_2d_value(const math::point_t& value) { 37 | return util::vtable::func::getter::the(this, value.x, value.y); 38 | } 39 | 40 | __forceinline void set_vec_3d_value(const math::point_3d_t& value) { 41 | return util::vtable::func::getter::the(this, value.x, value.y, value.z); 42 | } 43 | }; -------------------------------------------------------------------------------- /sinclairv3/cstrike/inetmessage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | #include "../game/memory/memory.h" 6 | #include "../math/math.h" 7 | 8 | class INetMessage { 9 | private: 10 | enum indices { 11 | GET_TYPE_INDEX = 7, 12 | GET_GROUP_INDEX = 8 13 | }; 14 | 15 | public: 16 | int get_type() { 17 | return util::vtable::func::getter::the(this); 18 | } 19 | 20 | int get_group() { 21 | return util::vtable::func::getter::the(this); 22 | } 23 | }; -------------------------------------------------------------------------------- /sinclairv3/cstrike/ivdebugoverlay.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | #include "../game/memory/memory.h" 6 | #include "../math/math.h" 7 | 8 | class CIVDebugOverlay { 9 | private: 10 | enum indices { 11 | SCREEN_POSITION_INDEX = 13 12 | }; 13 | 14 | public: 15 | __forceinline int screen_position(const math::point_3d_t& in, math::point_3d_t& out) { 16 | return util::vtable::func::getter::the(this, &in, &out); 17 | } 18 | }; -------------------------------------------------------------------------------- /sinclairv3/cstrike/ivmodelrender.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | #include "../game/memory/memory.h" 6 | #include "../math/math.h" 7 | 8 | class IVModelRender { 9 | private: 10 | enum indices { 11 | FORCE_MATERIAL_OVERRIDE_INDEX = 1, 12 | IS_FORCED_MATERIAL_OVERRIDE_INDEX = 2, 13 | }; 14 | 15 | public: 16 | __forceinline void force_material_override(IMaterial* material) { 17 | return util::vtable::func::getter::the(this, material); 18 | } 19 | 20 | __forceinline bool force_material_override() { 21 | return util::vtable::func::getter::the(this); 22 | } 23 | }; -------------------------------------------------------------------------------- /sinclairv3/cstrike/modelinfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | #include "../game/memory/memory.h" 6 | #include "../math/math.h" 7 | 8 | struct mstudiobone_t { 9 | int sznameindex; 10 | inline char* const pszName(void) const { return ((char*)this) + sznameindex; } 11 | int parent; // parent bone 12 | int bonecontroller[6]; // bone controller index, -1 == none 13 | 14 | // default 15 | math::point_3d_t pos; 16 | math::point_4d_t quat; 17 | math::point_3d_t rot; 18 | // compression scale 19 | math::point_3d_t posscale; 20 | math::point_3d_t rotscale; 21 | 22 | math::matrix pose_to_bone; 23 | math::point_4d_t alignment; 24 | int flags; 25 | int proctype; 26 | int procindex; // procedural rule 27 | mutable int physicsbone; // index into physically simulated bone 28 | inline void* pProcedure() const { if (procindex == 0) return NULL; else return (void*)(((uint8_t*)this) + procindex); }; 29 | int surfacepropidx; // index into string tablefor property name 30 | inline char* const pszSurfaceProp(void) const { return ((char*)this) + surfacepropidx; } 31 | inline int GetSurfaceProp(void) const { return surfacepropLookup; } 32 | int contents; // See BSPFlags.h for the contents flags 33 | int surfacepropLookup; // this index must be cached by the loader, not saved in the file 34 | int unused[7]; // remove as appropriate 35 | }; 36 | 37 | struct mstudiobbox_t { 38 | int bone; 39 | int group; // intersection group 40 | math::point_3d_t bbmin; // bounding box, or the ends of the capsule if flCapsuleRadius > 0 41 | math::point_3d_t bbmax; 42 | int szhitboxnameindex; // offset to the name of the hitbox. 43 | math::point_3d_t angOffsetOrientation; 44 | float flCapsuleRadius; 45 | int unused[4]; 46 | 47 | const char* pszHitboxName() const { 48 | if (szhitboxnameindex == 0) 49 | return ""; 50 | 51 | return ((const char*)this) + szhitboxnameindex; 52 | } 53 | }; 54 | 55 | struct mstudiohitboxset_t { 56 | int sznameindex; 57 | inline char* const pszName(void) const { return ((char*)this) + sznameindex; } 58 | int numhitboxes; 59 | int hitboxindex; 60 | inline mstudiobbox_t* pHitbox(int i) const { return (mstudiobbox_t*)(((uint8_t*)this) + hitboxindex) + i; }; 61 | }; 62 | 63 | struct studiohdr_t { 64 | int id; 65 | int version; 66 | 67 | int checksum; // this has to be the same in the phy and vtx files to load! 68 | 69 | char name[64]; 70 | 71 | int length; 72 | 73 | math::point_3d_t eyeposition; // ideal eye position 74 | 75 | math::point_3d_t illumposition; // illumination center 76 | 77 | math::point_3d_t hull_min; // ideal movement hull size 78 | math::point_3d_t hull_max; 79 | 80 | math::point_3d_t view_bbmin; // clipping bounding box 81 | math::point_3d_t view_bbmax; 82 | 83 | 84 | int flags; 85 | 86 | int numbones; // bones 87 | int boneindex; 88 | 89 | inline mstudiobone_t* pBone(int i) const { assert(i >= 0 && i < numbones); return (mstudiobone_t*)(((uint8_t*)this) + boneindex) + i; }; 90 | 91 | int RemapSeqBone(int iSequence, int iLocalBone) const; // maps local sequence bone to global bone 92 | int RemapAnimBone(int iAnim, int iLocalBone) const; // maps local animations bone to global bone 93 | 94 | int numbonecontrollers; // bone controllers 95 | int bonecontrollerindex; 96 | 97 | int numhitboxsets; 98 | int hitboxsetindex; 99 | 100 | 101 | // Look up hitbox set by index 102 | mstudiohitboxset_t* pHitboxSet(int i) const { 103 | assert(i >= 0 && i < numhitboxsets); 104 | return (mstudiohitboxset_t*)(((uint8_t*)this) + hitboxsetindex) + i; 105 | }; 106 | 107 | // Calls through to hitbox to determine size of specified set 108 | inline mstudiobbox_t* pHitbox(int i, int set) const { 109 | mstudiohitboxset_t const* s = pHitboxSet(set); 110 | if (!s) 111 | return NULL; 112 | 113 | return s->pHitbox(i); 114 | }; 115 | 116 | 117 | // Calls through to set to get hitbox count for set 118 | inline int iHitboxCount(int set) const { 119 | mstudiohitboxset_t const* s = pHitboxSet(set); 120 | if (!s) 121 | return 0; 122 | 123 | return s->numhitboxes; 124 | }; 125 | }; 126 | 127 | class CModelInfo { 128 | private: 129 | enum indices { 130 | GET_MODEL_INDEX = 2, 131 | GET_MODEL_INDEX_INDEX = 2, 132 | GET_MODEL_NAME_INDEX = 4, 133 | GET_MODEL_MATERIALS_INDEX = 18, 134 | GET_STUDIO_MODEL_INDEX = 31 135 | }; 136 | 137 | public: 138 | __forceinline model_t* get_model(int index) { 139 | return util::vtable::func::getter::the(this, index); 140 | } 141 | 142 | __forceinline int get_model_index(const char* filename) { 143 | return util::vtable::func::getter::the(this, filename); 144 | } 145 | 146 | __forceinline const char* get_model_name(const void* modelname) { 147 | return util::vtable::func::getter::the(this, modelname); 148 | } 149 | 150 | __forceinline void get_model_materials(const model_t* model, int count, IMaterial** ppmaterial) { 151 | return util::vtable::func::getter::the(this, model, count, ppmaterial); 152 | } 153 | 154 | __forceinline studiohdr_t* get_studio_model(const model_t* model) { 155 | return util::vtable::func::getter::the(this, model); 156 | } 157 | }; -------------------------------------------------------------------------------- /sinclairv3/cstrike/sdk_hud_chat.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | #include "../game/memory/memory.h" 6 | #include "../math/math.h" 7 | 8 | class CHudChat { 9 | private: 10 | enum indices { 11 | CHAT_PRINTF_INDEX = 27 12 | }; 13 | 14 | public: 15 | template 16 | __forceinline void chat_printf(int player_index, int filter, const char(&fmt)[N], Args... args) { 17 | return util::vtable::func::getter::the_cdecl(this, player_index, filter, fmt, args...); 18 | } 19 | }; 20 | 21 | class CCSGO_HudChat { 22 | public: 23 | }; -------------------------------------------------------------------------------- /sinclairv3/cstrike/utl_vector.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Refer to Cstrike leak 4 | 5 | template 6 | class CUtlMemory { 7 | public: 8 | T& operator[](m _index) { return m_memory[_index]; } 9 | 10 | protected: 11 | T* m_memory; 12 | int m_allocation_count; 13 | int m_grow_size; 14 | }; 15 | 16 | template > 17 | class CUtlVector { 18 | typedef a allocator; 19 | 20 | public: 21 | T& operator[](int _index) { return m_memory[_index]; } 22 | 23 | int count() const { return m_size; } 24 | 25 | void set_size(int _value) { m_size = _value; } 26 | 27 | protected: 28 | allocator m_memory; 29 | int m_size; 30 | T* m_elements; 31 | }; -------------------------------------------------------------------------------- /sinclairv3/cstrike/vgui/isurface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../defines.h" 4 | 5 | #include "../../game/memory/memory.h" 6 | #include "../../math/math.h" 7 | 8 | #include "../vgui2/vpanel.h" 9 | 10 | struct Vertex_t { 11 | Vertex_t() {} 12 | Vertex_t(const math::point_t& pos, const math::point_t& coord = math::point_t{ 0, 0 }) { 13 | position = pos; 14 | tex_coord = coord; 15 | } 16 | void init(const math::point_t& pos, const math::point_t& coord = math::point_t{ 0, 0 }) { 17 | position = pos; 18 | tex_coord = coord; 19 | } 20 | 21 | math::point_t position; 22 | math::point_t tex_coord; 23 | }; 24 | 25 | class ISurface { 26 | private: 27 | enum indices { 28 | DRAW_SET_COLOR_RGBA_INDEX = 15, 29 | DRAW_FILLED_RECTANGLE_INDEX = 16, 30 | DRAW_OUTLINED_RECTANGLE_INDEX = 18, 31 | DRAW_LINE_INDEX = 19, 32 | DRAW_POLY_LINE_INDEX = 20, 33 | CREATE_FONT_INDEX = 71, 34 | SET_FONT_GLYPH_SET_INDEX = 72, 35 | DRAW_TEXTURED_POLY_LINE_INDEX = 104, 36 | DRAW_TEXTURED_POLYGON_INDEX = 106, 37 | DRAW_COLORED_TEXT_INDEX = 163 38 | }; 39 | 40 | public: 41 | __forceinline void draw_set_color(int r, int g, int b, int a) { 42 | return util::vtable::func::getter::the(this, r, g, b, a); 43 | } 44 | 45 | __forceinline void draw_filled_rectangle(int x, int y, int w, int h) { 46 | return util::vtable::func::getter::the(this, x, y, w, h); 47 | } 48 | 49 | // This could be remade with vertices but seems to work fine (for now) 50 | __forceinline void draw_outlined_rectangle(int x, int y, int w, int h) { 51 | return util::vtable::func::getter::the(this, x, y, w, h); 52 | } 53 | 54 | __forceinline void draw_line(int x0, int y0, int x1, int y1) { 55 | return util::vtable::func::getter::the(this, x0, y0, x1, y1); 56 | } 57 | 58 | __forceinline void draw_poly_line(int* x, int* y, int points) { 59 | return util::vtable::func::getter::the(this, x, y, points); 60 | } 61 | 62 | __forceinline HFont create_font() { 63 | return util::vtable::func::getter::the(this); 64 | } 65 | 66 | __forceinline void set_font_glyph_set(HFont font, const char* font_name, int tall, int weight, int blur, 67 | int scan_lines, FontFlags flags, int range_min = 0, int range_max = 0) { 68 | return util::vtable::func::getter::the(this, font, font_name, 69 | tall, weight, blur, scan_lines, flags, range_min, range_max); 70 | } 71 | 72 | __forceinline void draw_textured_poly_line(const Vertex_t* points_vertices, int points) { 73 | return util::vtable::func::getter::the(this, points_vertices, points); 74 | } 75 | 76 | __forceinline void draw_textured_polygon(int points, Vertex_t* points_vertices, bool clip_vertices = false) { 77 | return util::vtable::func::getter::the(this, points, points_vertices, clip_vertices); 78 | } 79 | 80 | __forceinline void draw_colored_text(HFont font, int x, int y, int r, int g, int b, int a, const char* text) { 81 | return util::vtable::func::getter::the_cdecl(this, font, x, y, r, g, b, a, text); 82 | } 83 | 84 | public: 85 | // thanks IDA 86 | char pad_0000[20]; 87 | float float14; 88 | char pad_0001[20]; 89 | util::color_t::color_type r; 90 | util::color_t::color_type g; 91 | util::color_t::color_type b; 92 | util::color_t::color_type a; 93 | }; -------------------------------------------------------------------------------- /sinclairv3/cstrike/vgui2/vpanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../defines.h" 4 | 5 | #include "../../game/memory/memory.h" 6 | #include "../../math/math.h" 7 | 8 | class SurfacePlat { 9 | public: 10 | HWND hwnd; 11 | HDC hdc; 12 | HDC hwnd_dc; 13 | HDC texture_dc; 14 | HGLRC hglrc; 15 | HRGN clip_rgn; 16 | HBITMAP bitmap; 17 | math::point_t bitmap_size; 18 | math::point_4d_t restore_info; 19 | bool is_fullscreen; 20 | bool disabled; // whether the window can take user input 21 | math::point_3d_t fullscreen_info; 22 | VPanel* embedded_panel; 23 | 24 | bool is_toolbar; // whether it has an icon in the tool tray or not 25 | HICON notify_icon; 26 | uint32_t notify_panel; 27 | 28 | HPanel last_key_focus_index; // index to the last panel to have the focus 29 | }; 30 | 31 | class VPanel { 32 | public: 33 | VPanel** child_arr; 34 | VPanel* parent; 35 | SurfacePlat* plat; // platform-specific data 36 | }; -------------------------------------------------------------------------------- /sinclairv3/cstrike/weapons.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | #include "../game/memory/memory.h" 6 | #include "../math/math.h" 7 | 8 | class CCSWeaponData { 9 | public: 10 | char pad000[20]; 11 | int max_clip; 12 | char pad001[112]; 13 | const char* name; 14 | char pad002[60]; 15 | WeaponType type; 16 | char pad003[4]; 17 | int price; 18 | char pad004[8]; 19 | float cycle_time; 20 | char pad005[12]; 21 | bool full_auto; 22 | char pad006[3]; 23 | int damage; 24 | float armor_ratio; 25 | int bullets; 26 | float penetration; 27 | char pad007[8]; 28 | float range; 29 | float range_modifier; 30 | char pad008[16]; 31 | bool silencer; 32 | char pad009[15]; 33 | float max_speed; 34 | float max_speed_alt; 35 | char pad010[100]; 36 | float recoil_magnitude; 37 | float recoil_magnitude_alt; 38 | char pad011[16]; 39 | float recovery_time_stand; 40 | }; -------------------------------------------------------------------------------- /sinclairv3/dllmain.cpp: -------------------------------------------------------------------------------- 1 | #include "framework.h" 2 | 3 | #include "cstrike/cstrike.h" 4 | 5 | BOOL WINAPI detach(LPVOID params) { 6 | // In case of detachment outside of panic, restore original state 7 | game::detach::the(); 8 | pe::detach::the(); 9 | 10 | // Close I/O 11 | fclose(stdin); 12 | fclose(stdout); 13 | 14 | // Delocate console 15 | FreeConsole(); 16 | 17 | // We have to return something 18 | return TRUE; 19 | } 20 | 21 | DWORD WINAPI attach(LPVOID params) { 22 | // Get start time 23 | const std::chrono::high_resolution_clock::time_point start = std::chrono::high_resolution_clock::now(); 24 | 25 | // Create console 26 | AllocConsole(); 27 | SetConsoleTitleA("sinclair v3"); 28 | 29 | // Call logger initializer 30 | logger::init::the(); 31 | 32 | // Start handling functions that can throw 33 | try { 34 | if (!pe::init::the()) { 35 | SINCLAIR_THROW(errors::Errors::INITIALIZER_FAILED); 36 | } 37 | 38 | if (!game::init::the()) { 39 | SINCLAIR_THROW(errors::Errors::INITIALIZER_FAILED); 40 | } 41 | } 42 | // Perhaps not the best solution but serves its job 43 | catch (const std::exception& err) { 44 | _RPT0(_CRT_ERROR, err.what()); 45 | 46 | detach(params); 47 | } 48 | 49 | // Get end time 50 | const std::chrono::high_resolution_clock::time_point end = std::chrono::high_resolution_clock::now(); 51 | 52 | // Print calculated output of end - start 53 | logger::the("%s: it took *about* %lf seconds to initialize\n", __FUNCTION__, std::chrono::duration_cast>(end - start).count()); 54 | 55 | std::this_thread::sleep_for(std::chrono::milliseconds(400)); 56 | 57 | return TRUE; 58 | } 59 | 60 | BOOL APIENTRY DllMain(HMODULE hModule, 61 | DWORD ul_reason_for_call, 62 | LPVOID lpReserved 63 | ) { 64 | if (ul_reason_for_call == DLL_PROCESS_ATTACH) { 65 | const HANDLE attach_thread = CreateThread(nullptr, 0, attach, hModule, 0, nullptr); 66 | if (attach_thread != nullptr) { 67 | CloseHandle(attach_thread); 68 | } 69 | } 70 | else if (ul_reason_for_call == DLL_PROCESS_DETACH && lpReserved == nullptr) { 71 | return detach(hModule); 72 | } 73 | 74 | return TRUE; // succesful attach 75 | } 76 | 77 | -------------------------------------------------------------------------------- /sinclairv3/errors/errors.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../logger/logger.h" 4 | 5 | #include 6 | 7 | namespace errors { 8 | enum Errors { 9 | PE_GETTER_RESULT_WAS_NULL, 10 | PE_UTIL_EXPORTS_RESULT_WAS_NULL, 11 | PE_UTIL_ADDRESS_WAS_NULL, 12 | GAME_MEMORY_EXPORT_WAS_NULL, 13 | GAME_MEMORY_INTERFACE_WAS_NULL, 14 | GAME_MEMORY_BYTE_FAILED_REMOVING_WRITE_PROTECTION, 15 | GAME_MEMORY_BYTE_FAILED_RESTORING_WRITE_PROTECTION, 16 | GAME_MEMORY_BYTE_PATCH_FAILED, 17 | GAME_ENTITIES_LOCAL_WAS_NULL, 18 | GAME_RENDERER_FONT_WAS_NULL, 19 | INITIALIZER_FAILED, 20 | 21 | ERRORS_LIST_SIZE 22 | }; 23 | 24 | namespace codes { 25 | constexpr static const char* the[errors::Errors::ERRORS_LIST_SIZE] 26 | { 27 | "While trying to obtain a module, the returned result was NULL", // PE_GETTER_RESULT_WAS_NULL 28 | "WHile trying to obtain an export, the returned result was NULL", // PE_UTIL_EXPORTS_RESULT_WAS_NULL 29 | "While trying to obtain an address, the returned result was NULL", // PE_UTIL_ADDRESS_WAS_NULL 30 | "While trying to assign an interface by assesed export, the returned result was NULL", // GAME_MEMORY_EXPORT_WAS_NULL 31 | "While verifying an interface, the returned result was NULL", // GAME_MEMORY_INTERFACE_WAS_NULL 32 | "While bytepatching, upon trying to remove write protection, the operation has failed", // GAME_MEMORY_BYTE_FAILED_REMOVING_WRITE_PROTECTION 33 | "While bytepatching, upon trying to restore write protection, the operation has failed", // GAME_MEMORY_BYTE_FAILED_RESTORING_WRITE_PROTECTION 34 | "While bytepatching, the returned result was false", // GAME_MEMORY_BYTE_PATCH_FAILED 35 | "While trying to assign local player by an assessed address, the returned result was NULL", // GAME_ENTITIES_LOCAL_WAS_NULL 36 | "While trying to create a font, the returned result was NULL", // GAME_RENDERER_FONT_WAS_NULL 37 | "Upon initialization, something has thrown" // INITIALIZER_FAILED 38 | }; 39 | } 40 | } 41 | 42 | #define SINCLAIR_THROW(errno) throw std::runtime_error(errors::codes::the[errno]); -------------------------------------------------------------------------------- /sinclairv3/extern/custom_winapi/custom_winapi.h: -------------------------------------------------------------------------------- 1 | // https://github.com/Speedi13/Custom-GetProcAddress-and-GetModuleHandle-and-more 2 | // Credits: github.com/Speedi13 3 | 4 | #pragma once 5 | #include 6 | ////////////////////////////////////////////////////////////////////////////////////////////////// 7 | // Equivalent to the windows api function GetProcAddress 8 | ////////////////////////////////////////////////////////////////////////////////////////////////// 9 | /// 10 | /// Retrieves the address of an exported function inside the specified module 11 | /// 12 | /// Address of the module 13 | /// Name of the exported procedure 14 | /// Is the module mapped or a raw file? (TRUE / FALSE) 15 | /// returns the exported procedure address inside the specified module 16 | FARPROC WINAPI GetExportAddress(_In_ HMODULE hModule, _In_ LPCSTR lpProcName, _In_ BOOLEAN MappedAsImage); 17 | 18 | ////////////////////////////////////////////////////////////////////////////////////////////////// 19 | // Equivalent to the windows api function GetModuleHandleA and GetModuleHandleW 20 | ////////////////////////////////////////////////////////////////////////////////////////////////// 21 | /// 22 | /// Retrieves the address of an loaded module by name 23 | /// 24 | /// name of the module, zero for current module 25 | /// returns address of the module in memory 26 | HMODULE WINAPI GetModuleA(_In_opt_ LPCSTR lpModuleName); 27 | 28 | /// 29 | /// Retrieves the address of an loaded module by name 30 | /// 31 | /// name of the module, zero for current module 32 | /// returns address of the module in memory 33 | HMODULE WINAPI GetModuleW(_In_opt_ LPCWSTR lpModuleName); 34 | 35 | ////////////////////////////////////////////////////////////////////////////////////////////////// 36 | // Equivalent to the windows api function ImageNtHeader 37 | ////////////////////////////////////////////////////////////////////////////////////////////////// 38 | /// 39 | /// Locates the IMAGE_NT_HEADERS structure in a PE image and returns a pointer to the data 40 | /// 41 | /// The base address of an image that is mapped into memory by a call to the MapViewOfFile / ReadFile function 42 | /// If the function succeeds, the return value is a pointer to an IMAGE_NT_HEADERS structure 43 | IMAGE_NT_HEADERS* WINAPI ImageNtHeader(_In_ PVOID Base); 44 | 45 | ////////////////////////////////////////////////////////////////////////////////////////////////// 46 | // Equivalent to the windows api function ImageDirectoryEntryToDataEx 47 | ////////////////////////////////////////////////////////////////////////////////////////////////// 48 | /// 49 | /// Locates a directory entry within the image header and returns the address of the data for the directory entry 50 | /// 51 | /// The base address of the image or data file 52 | /// If the flag is TRUE, the file is mapped by the system as an image. If this flag is FALSE, the file is mapped as a data file by the MapViewOfFile/ ReadFile function 53 | /// The directory entry to be located 54 | /// A pointer to a variable that receives the size of the data for the directory entry that is located 55 | /// If the function succeeds, the return value is a pointer to the data for the directory entry 56 | PVOID WINAPI ImageDirectoryEntryToDataEx(PVOID Base, BOOLEAN MappedAsImage, USHORT DirectoryEntry, ULONG* Size); 57 | 58 | ////////////////////////////////////////////////////////////////////////////////////////////////// 59 | // Equivalent to the windows api function ImageRvaToSection and ImageRvaToVa 60 | ////////////////////////////////////////////////////////////////////////////////////////////////// 61 | /// 62 | /// Locates a relative virtual address (RVA) within the image header of a file that is mapped as a file and returns a pointer to the section table entry for that RVA 63 | /// 64 | /// A pointer to an IMAGE_NT_HEADERS structure. This structure can be obtained by calling the ImageNtHeader function. 65 | /// This parameter is reserved 66 | /// The relative virtual address to be located 67 | /// If the function succeeds, the return value is a pointer to an IMAGE_SECTION_HEADER structure 68 | IMAGE_SECTION_HEADER* WINAPI ImageRvaToSection(PIMAGE_NT_HEADERS NtHeaders, PVOID Base, ULONG Rva); 69 | 70 | /// 71 | /// Locates a relative virtual address (RVA) within the image header of a file that is mapped as a file and returns the virtual address of the corresponding byte in the file. 72 | /// 73 | /// A pointer to an IMAGE_NT_HEADERS structure. This structure can be obtained by calling the ImageNtHeader function 74 | /// The base address of an image that is mapped into memory through a call to the MapViewOfFile function 75 | /// The relative virtual address to be located 76 | /// If the function succeeds, the return value is the virtual address in the mapped file 77 | PVOID WINAPI ImageRvaToVa(PIMAGE_NT_HEADERS NtHeaders, void* Base, DWORD Rva); 78 | 79 | ////////////////////////////////////////////////////////////////////////////////////////////////// 80 | // Opposite to the windows api function ImageRvaToSection and ImageRvaToVa 81 | ////////////////////////////////////////////////////////////////////////////////////////////////// 82 | /// 83 | /// Locates the section header containing the virtual address (VA) in a non mapped file buffer 84 | /// 85 | /// A pointer to an IMAGE_NT_HEADERS structure. This structure can be obtained by calling the ImageNtHeader function. 86 | /// This parameter is reserved 87 | /// Pointer to data inside the Images buffer 88 | /// If the function succeeds, the return value is a pointer to an IMAGE_SECTION_HEADER structure 89 | IMAGE_SECTION_HEADER* WINAPI ImageVaToSection(PIMAGE_NT_HEADERS NtHeaders, PVOID Base, void* Va); 90 | 91 | /// 92 | /// Locates the relative virtual address (RVA) of a pointer into the non mapped file buffer 93 | /// 94 | /// A pointer to an IMAGE_NT_HEADERS structure. This structure can be obtained by calling the ImageNtHeader function 95 | /// The base address of an image that is mapped into memory through a call to the MapViewOfFile function 96 | /// ointer to data inside the Images buffer 97 | /// If the function succeeds, the return value is the relative virtual address (RVA) in the mapped file 98 | DWORD WINAPI ImageVaToRva(PIMAGE_NT_HEADERS NtHeaders, void* Base, void* Va); 99 | 100 | /// 101 | /// Locates the relative virtual address (RVA) of a pointer into the non mapped file buffer 102 | /// 103 | /// The base address of an image that is mapped into memory through a call to the MapViewOfFile function 104 | /// ointer to data inside the Images buffer 105 | /// If the function succeeds, the return value is the relative virtual address (RVA) in the mapped file 106 | DWORD WINAPI ImageVaToRva(void* Base, void* Va); 107 | 108 | ////////////////////////////////////////////////////////////////////////////////////////////////// 109 | // Utility functions for GetModuleW 110 | ////////////////////////////////////////////////////////////////////////////////////////////////// 111 | wchar_t* GetFileNameFromPath(wchar_t* Path); 112 | wchar_t* RemoveFileExtension(wchar_t* FullFileName, wchar_t* OutputBuffer, DWORD OutputBufferSize); -------------------------------------------------------------------------------- /sinclairv3/extern/extern.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "hasher/hasher.h" 4 | #include "custom_winapi/custom_winapi.h" -------------------------------------------------------------------------------- /sinclairv3/extern/hasher/hasher.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // HELO mr swoopae :DDDDDDDDDDDDDDDDDDDDDD 4 | 5 | #include 6 | 7 | #define stringify(x) #x 8 | #define concat_impl(x, y) x##y 9 | #define concat(x, y) concat_impl(x, y) 10 | 11 | template 12 | struct constant_holder { 13 | enum class val_holder : T { 14 | val = v 15 | }; 16 | }; 17 | 18 | #define constant(value) ((decltype(value))constant_holder::val_holder::val) 19 | 20 | constexpr static uint32_t seed = 0x45C3370D; 21 | constexpr static uint32_t prime = 0x1000193; 22 | 23 | inline uint32_t fnv1a_rt(const char* key, const uint32_t len) { 24 | const char* data = (char*)key; 25 | auto hash = seed; 26 | 27 | for (size_t i = 0; i < len; ++i) { 28 | const uint8_t val = (uint8_t)(data[i]); 29 | hash = hash ^ val; 30 | hash *= prime; 31 | } 32 | 33 | return hash; 34 | } 35 | 36 | constexpr uint32_t fnv1a_ct(const char* key, const uint32_t val = seed) { 37 | return !*key ? val : fnv1a_ct(key + 1, (unsigned)(1ull * 38 | (val ^ (std::uint8_t)*key) * prime)); 39 | } 40 | 41 | #define HASH_CT(s) constant(fnv1a_ct(s)) 42 | #define HASH_RT(s) fnv1a_rt(s, strlen(s)) -------------------------------------------------------------------------------- /sinclairv3/framework.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "cstrike/defines.h" 7 | #include "math/math.h" 8 | #include "logger/logger.h" 9 | #include "pe/pe.h" 10 | #include "pe/util/util.h" 11 | #include "game/game.h" 12 | #include "util/util.h" 13 | 14 | -------------------------------------------------------------------------------- /sinclairv3/game/entities/entities.cpp: -------------------------------------------------------------------------------- 1 | #include "entities.h" 2 | 3 | #include "../memory/memory.h" 4 | 5 | #include "../../cstrike/cstrike.h" 6 | 7 | // Prototypes 8 | game::entities::player_t* game::entities::prototypes::local; -------------------------------------------------------------------------------- /sinclairv3/game/entities/entities.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "player/player.h" 4 | 5 | namespace game { 6 | namespace entities { 7 | struct player_t; 8 | 9 | namespace prototypes { 10 | extern game::entities::player_t* local; 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /sinclairv3/game/entities/player/player.cpp: -------------------------------------------------------------------------------- 1 | #include "player.h" 2 | 3 | namespace game { 4 | namespace entities { 5 | bool player_t::alive() { 6 | return health() > 0 && lifestate() == LifeStates::LIFE_ALIVE; 7 | } 8 | 9 | int player_t::health() { 10 | return *(int*)((uintptr_t)this + game::props::prototypes::props[HASH_CT("DT_BasePlayer")][HASH_CT("m_iHealth")]); 11 | } 12 | 13 | uint8_t player_t::lifestate() { 14 | return *(uint8_t*)((uintptr_t)this + game::props::prototypes::props[HASH_CT("DT_BasePlayer")][HASH_CT("m_lifeState")]); 15 | } 16 | 17 | uint8_t player_t::team() { 18 | return *(uint8_t*)((uintptr_t)this + game::props::prototypes::props[HASH_CT("DT_BasePlayer")][HASH_CT("m_iTeamNum")]); 19 | } 20 | 21 | uint8_t player_t::flags() { 22 | return *(uint8_t*)((uintptr_t)this + game::props::prototypes::props[HASH_CT("DT_BasePlayer")][HASH_CT("m_fFlags")]); 23 | } 24 | 25 | uint8_t player_t::movetype() { 26 | return *(uint8_t*)((uintptr_t)this + (game::props::prototypes::props[HASH_CT("DT_BaseEntity")][HASH_CT("m_nRenderMode")] + 1)); 27 | } 28 | 29 | bool player_t::scoped() { 30 | return *(bool*)((uintptr_t)this + game::props::prototypes::props[HASH_CT("DT_CSPlayer")][HASH_CT("m_bIsScoped")]); 31 | } 32 | 33 | math::point_3d_t player_t::origin() { 34 | return *(math::point_3d_t*)((uintptr_t)this + game::props::prototypes::props[HASH_CT("DT_BasePlayer")][HASH_CT("m_vecViewOffset[0]")]); 35 | } 36 | 37 | bool player_t::compute_hitbox_surrounding_box(math::point_3d_t* mins, math::point_3d_t* maxs) { 38 | typedef bool(__thiscall* compute_hitbox_surrounding_box_t)(player_t*, math::point_3d_t*, math::point_3d_t*); 39 | static compute_hitbox_surrounding_box_t compute_hitbox_surrounding_box_o = (compute_hitbox_surrounding_box_t)pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GET_ENTITY_BOUNDING_BOX]; 40 | return compute_hitbox_surrounding_box_o(this, mins, maxs); 41 | } 42 | 43 | bool player_t::dormant() { 44 | typedef bool(__thiscall* is_dormant_t)(player_t*); 45 | static is_dormant_t is_dormant_o = (is_dormant_t)pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_ENTITY_IS_DORMANT]; 46 | return is_dormant_o(this); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /sinclairv3/game/entities/player/player.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../../cstrike/defines.h" 4 | #include "../../../math/math.h" 5 | #include "../../props/props.h" 6 | 7 | namespace game { 8 | namespace entities { 9 | struct player_t { 10 | bool alive(); 11 | int health(); 12 | uint8_t lifestate(); 13 | uint8_t team(); 14 | uint8_t flags(); 15 | uint8_t movetype(); 16 | bool scoped(); 17 | math::point_3d_t origin(); 18 | bool compute_hitbox_surrounding_box(math::point_3d_t* mins, math::point_3d_t* maxs); 19 | bool dormant(); 20 | }; 21 | } 22 | } -------------------------------------------------------------------------------- /sinclairv3/game/features/features.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "movement/movement.h" 4 | #include "visual/visual.h" -------------------------------------------------------------------------------- /sinclairv3/game/features/movement/movement.cpp: -------------------------------------------------------------------------------- 1 | #include "movement.h" 2 | 3 | #include "../../../cstrike/cstrike.h" 4 | 5 | namespace game { 6 | namespace features { 7 | namespace movement { 8 | void bunny_hop(CUserCmd* cmd) { 9 | if (!(game::entities::prototypes::local->flags() & PlayerFlags::FLAG_ONGROUND) && 10 | !(game::entities::prototypes::local->movetype() & MoveTypes::MOVETYPE_LADDER)) 11 | cmd->buttons &= ~CmdButtons::IN_JUMP; 12 | } 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /sinclairv3/game/features/movement/movement.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../../cstrike/defines.h" 4 | 5 | #include "../../entities/entities.h" 6 | 7 | namespace game { 8 | namespace features { 9 | namespace movement { 10 | void bunny_hop(CUserCmd* cmd); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /sinclairv3/game/features/visual/visual.cpp: -------------------------------------------------------------------------------- 1 | #include "visual.h" 2 | 3 | #include "../../../cstrike/cstrike.h" 4 | 5 | #include "../../renderer/surface/surface.h" 6 | 7 | namespace game { 8 | namespace features { 9 | namespace visual { 10 | namespace util { 11 | bool compute_2d_bounding_box(game::entities::player_t* entity, 12 | math::point_4d_t& out) { 13 | // Get entity mins/maxs 14 | math::point_3d_t mins, maxs; 15 | if (!entity->compute_hitbox_surrounding_box(&mins, &maxs)) { 16 | return false; 17 | } 18 | 19 | // Thse Spectacular Mathematical Calculations are not awesome, (or mine on that note) 20 | 21 | // Computed box sides used in transformed points (screen) array 22 | const math::point_t& flb{ }, brt{ }, blb{ }, frt{ }, frb{ }, brb{ }, blt{ }, flt{ }; 23 | 24 | const math::point_3d_t world[8] = { 25 | { mins.x, mins.y, mins.z }, 26 | { mins.x, maxs.y, mins.z }, 27 | { maxs.x, maxs.y, mins.z }, 28 | { maxs.x, mins.y, mins.z }, 29 | { maxs.x, maxs.y, maxs.z }, 30 | { mins.x, maxs.y, maxs.z }, 31 | { mins.x, mins.y, maxs.z }, 32 | { maxs.x, mins.y, maxs.z } 33 | }; 34 | 35 | // Transformed points 36 | math::point_3d_t screen[8] = { 37 | { blb.x, blb.y, 0.f }, 38 | { brb.x, brb.y, 0.f }, 39 | { frb.x, frb.y, 0.f }, 40 | { flb.x, flb.y, 0.f }, 41 | { frt.x, frt.y, 0.f }, 42 | { brt.x, brt.y, 0.f }, 43 | { blt.x, blt.y, 0.f }, 44 | { flt.x, flt.y, 0.f } 45 | }; 46 | 47 | // Calculate screen position points 48 | for (int i = 0; i < 8; ++i) { 49 | if (game::memory::interfaces::prototypes::debug_overlay->screen_position(world[i], screen[i])) { 50 | return false; 51 | } 52 | } 53 | 54 | // Get individual points 55 | float left = screen[3].x; 56 | float right = screen[3].x; 57 | float bottom = screen[3].y; 58 | float top = screen[3].y; 59 | 60 | // Assign individual points 61 | for (int i = 0; i < 8; ++i) { 62 | if (left > screen[i].x) { 63 | left = screen[i].x; 64 | } 65 | 66 | if (right < screen[i].x) { 67 | right = screen[i].x; 68 | } 69 | 70 | if (bottom < screen[i].y) { 71 | bottom = screen[i].y; 72 | } 73 | 74 | if (top > screen[i].y) { 75 | top = screen[i].y; 76 | } 77 | } 78 | 79 | // Assign to output 4-dimensional vector of points 80 | out.x = (int)left; 81 | out.y = (int)top; 82 | out.z = (int)(right - left); 83 | out.v = (int)(bottom - top); 84 | 85 | return true; 86 | } 87 | } 88 | 89 | namespace esp { 90 | namespace paint { 91 | void the() { 92 | if (!game::memory::interfaces::prototypes::engine_client->is_in_game_and_connected()) { 93 | return; 94 | } 95 | 96 | game::renderer::surface::set_color({ 0, 0, 0, 220 }); 97 | 98 | for (int i = 1; i < 65; ++i) { 99 | game::entities::player_t* entity = 100 | game::memory::interfaces::prototypes::entity_list->get(i); 101 | 102 | if (entity == nullptr || entity == game::entities::prototypes::local) { 103 | continue; 104 | } 105 | 106 | if (!entity->alive() || entity->dormant()) { 107 | continue; 108 | } 109 | 110 | math::point_4d_t position; 111 | if (!game::features::visual::util::compute_2d_bounding_box(entity, position)) 112 | continue; 113 | 114 | // Bounding box outline 115 | game::renderer::surface::rectangle_outline 116 | (position.x - 1, position.y - 1, position.z + 2, position.v + 2); 117 | game::renderer::surface::rectangle_outline 118 | (position.x + 1, position.y + 1, position.z - 2, position.v - 2); 119 | 120 | // Health outline 121 | game::renderer::surface::rectangle_outline 122 | (position.x - 1, position.y + position.v + 2, position.z + 2, 3); 123 | 124 | // Bounding box 125 | game::renderer::surface::rectangle_outline 126 | (position.x, position.y, position.z, position.v, { 255, 255, 255, 220 }); 127 | 128 | // Health 129 | game::renderer::surface::rectangle 130 | (position.x, position.y + position.v + 3, position.z * (entity->health() / 100), 1, { 255, 255, 255, 220 }); 131 | 132 | // Get player info (name, steamid32/64, etc) 133 | player_info_t player_info; 134 | if (!game::memory::interfaces::prototypes::engine_client->get_player_info(i, &player_info)) 135 | continue; 136 | 137 | // Name 138 | game::renderer::surface::text 139 | (player_info.name, position.x, position.y - 14, { 255, 255, 255, 220 }); 140 | } 141 | } 142 | } 143 | } 144 | } 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /sinclairv3/game/features/visual/visual.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../../cstrike/defines.h" 4 | 5 | #include "../../entities/entities.h" 6 | 7 | namespace game { 8 | namespace features { 9 | namespace visual { 10 | namespace util { 11 | bool compute_2d_bounding_box(game::entities::player_t* entity, 12 | math::point_4d_t& out); 13 | } 14 | 15 | namespace esp { 16 | namespace paint { 17 | void the(); 18 | } 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /sinclairv3/game/game.cpp: -------------------------------------------------------------------------------- 1 | #include "game.h" 2 | 3 | namespace game { 4 | // declare initializer 5 | namespace init { 6 | bool the() { 7 | if (!game::memory::interfaces::init::the()) { 8 | logger::the("%s: Failed at memory interfaces initializer\n", __FUNCTION__); 9 | return false; 10 | } 11 | 12 | if (!game::renderer::surface::init::the()) { 13 | logger::the("%s: Failed at surface renderer initializer\n", __FUNCTION__); 14 | return false; 15 | } 16 | 17 | game::props::init::the(); 18 | 19 | if (!game::hooking::init::the()) { 20 | logger::the("%s: Failed at hooking initializer\n", __FUNCTION__); 21 | return false; 22 | } 23 | 24 | logger::the("%s: Initialized\n", __FUNCTION__); 25 | return true; 26 | } 27 | } 28 | 29 | // declare detachment 30 | namespace detach { 31 | void the() { 32 | game::hooking::detach::the(); 33 | 34 | logger::the("%s: Detached\n", __FUNCTION__); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /sinclairv3/game/game.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "memory/memory.h" 4 | #include "props/props.h" 5 | #include "entities/entities.h" 6 | #include "hooking/hooking.h" 7 | #include "renderer/surface/surface.h" 8 | #include "features/features.h" 9 | 10 | namespace game { 11 | namespace init { 12 | bool the(); 13 | } 14 | 15 | namespace detach { 16 | void the(); 17 | } 18 | } -------------------------------------------------------------------------------- /sinclairv3/game/hooking/functions/create_move.cpp: -------------------------------------------------------------------------------- 1 | #include "../../game.h" 2 | 3 | #include "../../../cstrike/cstrike.h" 4 | 5 | bool __stdcall game::hooking::functions::prototypes::create_move::hooked(float sample_time, CUserCmd* cmd) { 6 | if (game::entities::prototypes::local == nullptr || 7 | !game::entities::prototypes::local->alive() || 8 | cmd == nullptr || 9 | cmd->command_number == 0) 10 | return o_fn(sample_time, cmd); 11 | 12 | cmd->buttons |= CmdButtons::IN_BULLRUSH; 13 | 14 | game::features::movement::bunny_hop(cmd); 15 | 16 | cmd->view_angles.cstrike_clamp(); 17 | cmd->view_angles.cstrike_normalize(); 18 | 19 | return false; 20 | } -------------------------------------------------------------------------------- /sinclairv3/game/hooking/functions/draw_crosshair.cpp: -------------------------------------------------------------------------------- 1 | #include "../../game.h" 2 | 3 | #include "../../../cstrike/cstrike.h" 4 | 5 | void __fastcall game::hooking::functions::prototypes::draw_crosshair::hooked(REGISTERS) { 6 | // As we currently byte patch on entry point, what we are doing, as I said before, 7 | // is patching a comparassion's second argument to something that's not even available 8 | // thus never failing 9 | 10 | // [by not failing, I mean, it never returns, we always proceed with rendering, clarifying 11 | // due to different code within the actual source itself and compiled output] 12 | 13 | // the check. That, though, will cause for our crosshair to render while we are scoped, so my 14 | // approach is, don't render the crosshair if you're scoped. This won't cause any issues, 15 | // as you shouldn't ever see your crosshair within scope, or with a scopable weapon eitherway 16 | if (game::entities::prototypes::local->scoped()) { 17 | return; 18 | } 19 | 20 | return o_fn(thisptr, dummy); 21 | } -------------------------------------------------------------------------------- /sinclairv3/game/hooking/functions/frame_stage_notify.cpp: -------------------------------------------------------------------------------- 1 | #include "../../game.h" 2 | 3 | #include "../../../cstrike/cstrike.h" 4 | 5 | void __stdcall game::hooking::functions::prototypes::frame_stage_notify::hooked(ClientFrameStages stage) { 6 | switch (stage) { 7 | case ClientFrameStages::NET_UPDATE_POSTDATAUPDATE_END: 8 | // I could sig the entity that is set to local in FSN but that caused some issues which I don't care enough to bother with 9 | // so I'll just update local myself where the game does it too 10 | game::entities::prototypes::local = game::memory::interfaces::prototypes::entity_list->get(game::memory::interfaces::prototypes::engine_client->get_local_player()); 11 | 12 | break; 13 | } 14 | 15 | return o_fn(stage); 16 | } -------------------------------------------------------------------------------- /sinclairv3/game/hooking/functions/get_color_modulation.cpp: -------------------------------------------------------------------------------- 1 | #include "../../game.h" 2 | 3 | #include "../../../cstrike/cstrike.h" 4 | 5 | void __fastcall game::hooking::functions::prototypes::get_color_modulation::hooked(REGISTERS_t(IMaterial*), float* r, float* g, float* b) { 6 | o_fn(thisptr, dummy, r, g, b); 7 | 8 | const uint32_t group_name = HASH_RT(thisptr->get_texture_group_name()); 9 | switch (group_name) { 10 | case HASH_CT(TEXTURE_GROUP_WORLD): 11 | case HASH_CT(TEXTURE_GROUP_SKYBOX): 12 | *r *= 0.2f; 13 | *g *= 0.2f; 14 | *b *= 0.2f; 15 | break; 16 | 17 | case HASH_CT(TEXTURE_GROUP_STATIC_PROP): 18 | *r *= 0.45f; 19 | *g *= 0.45f; 20 | *b *= 0.45f; 21 | break; 22 | 23 | default: 24 | break; 25 | } 26 | } -------------------------------------------------------------------------------- /sinclairv3/game/hooking/functions/get_cs_wpn_data.cpp: -------------------------------------------------------------------------------- 1 | #include "../../game.h" 2 | 3 | #include "../../../cstrike/cstrike.h" 4 | 5 | const CCSWeaponData& game::hooking::functions::prototypes::get_cs_wpn_data::hooked(REGISTERS) { 6 | // planning to use this for cl_crosshairstyle 1 on snipers 7 | return o_fn(thisptr, dummy); 8 | } -------------------------------------------------------------------------------- /sinclairv3/game/hooking/functions/get_current_game_type.cpp: -------------------------------------------------------------------------------- 1 | #include "../../game.h" 2 | 3 | #include "../../../cstrike/cstrike.h" 4 | 5 | int __fastcall game::hooking::functions::prototypes::get_current_game_type::hooked(REGISTERS) { 6 | // Dangerzone index 7 | return 6; 8 | } -------------------------------------------------------------------------------- /sinclairv3/game/hooking/functions/is_using_static_prop_debug_modes.cpp: -------------------------------------------------------------------------------- 1 | #include "../../game.h" 2 | 3 | #include "../../../cstrike/cstrike.h" 4 | 5 | bool __cdecl game::hooking::functions::prototypes::is_using_static_prop_debug_modes::hooked() { 6 | return true; 7 | } -------------------------------------------------------------------------------- /sinclairv3/game/hooking/functions/paint.cpp: -------------------------------------------------------------------------------- 1 | #include "../../game.h" 2 | 3 | #include "../../../cstrike/cstrike.h" 4 | 5 | void __fastcall game::hooking::functions::prototypes::paint::hooked(REGISTERS, PaintMode mode) { 6 | // Engine VGui utilities 7 | const static start_drawing_t o_start_drawing = (start_drawing_t)pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_PAINT_START_DRAWING]; 8 | const static finish_drawing_t o_finish_drawing = (finish_drawing_t)pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_PAINT_FINISH_DRAWING]; 9 | 10 | int v3 = *(int*)thisptr /* a1 */; 11 | 12 | if (*(DWORD*)(v3 + 72) /* staticTransitionPanel */ && (mode & PaintMode::PAINT_UI_PANELS) != 0) { 13 | o_start_drawing(game::memory::interfaces::prototypes::surface); 14 | 15 | game::features::visual::esp::paint::the(); 16 | 17 | o_finish_drawing(game::memory::interfaces::prototypes::surface); 18 | } 19 | 20 | o_fn(thisptr, dummy, mode); 21 | } -------------------------------------------------------------------------------- /sinclairv3/game/hooking/functions/push_notice.cpp: -------------------------------------------------------------------------------- 1 | #include "../../game.h" 2 | 3 | #include "../../../cstrike/cstrike.h" 4 | 5 | void __fastcall game::hooking::functions::prototypes::push_notice::hooked(REGISTERS_t(CCSGO_HudChat*), 6 | const char* text, int text_len, const char* always_null) { 7 | return o_fn(thisptr, dummy, text, text_len, always_null); 8 | } -------------------------------------------------------------------------------- /sinclairv3/game/hooking/functions/send_net_msg.cpp: -------------------------------------------------------------------------------- 1 | #include "../../game.h" 2 | 3 | #include "../../../cstrike/cstrike.h" 4 | 5 | // We're hooking the CNetChan SendNetMsg to be able to skip protobufs 6 | // You can do something along these lines by hooking FileCRCCheck by CGameClient 7 | // but that'll only work in local games 8 | bool __fastcall game::hooking::functions::prototypes::send_net_msg::hooked(REGISTERS, 9 | INetMessage& msg, bool voice, bool reliable) { 10 | if (msg.get_type() == ClcMessages::CLC_FIRE_CRC_CHECK) // skip CNetMessagePB 11 | return false; 12 | 13 | return o_fn(thisptr, dummy, msg, voice, reliable); 14 | } -------------------------------------------------------------------------------- /sinclairv3/game/hooking/functions/vsnprintf.cpp: -------------------------------------------------------------------------------- 1 | #include "../../game.h" 2 | 3 | #include "../../../cstrike/cstrike.h" 4 | 5 | // this is disgusting... 6 | int __cdecl game::hooking::functions::prototypes::vsnprintf::hooked(char* dest, int text_len, const char* fmt, ...) { 7 | int v4; // ecx 8 | 9 | va_list args; 10 | va_start(args, fmt); 11 | if (_ReturnAddress() == pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_NET_GRAPH_TEXT_MAIN_MENU_RET_ADDR] || 12 | _ReturnAddress() == pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_NET_GRAPH_TEXT_GAME_RET_ADDR]) { 13 | // This isn't safe, but according to caps should never be an issue unless you get a trillion ping 14 | char buf[256] = "[sinclair] "; 15 | strcat_s(buf, fmt); 16 | v4 = _vsnprintf(dest, text_len, buf, args); 17 | } 18 | else { 19 | v4 = _vsnprintf(dest, text_len, fmt, args); 20 | } 21 | va_end(args); 22 | 23 | if ((v4 < 0) || (text_len > 0 && v4 >= text_len)) { 24 | v4 = text_len - 1; 25 | dest[text_len - 1] = '\0'; 26 | } 27 | 28 | return v4; 29 | } -------------------------------------------------------------------------------- /sinclairv3/game/hooking/hooking.cpp: -------------------------------------------------------------------------------- 1 | #include "hooking.h" 2 | 3 | #include "../../util/util.h" 4 | 5 | #include "../../cstrike/cstrike.h" 6 | 7 | // Prototypes 8 | game::hooking::types::game_overlay_renderer_hook_t game::hooking::prototypes::o_hook; 9 | game::hooking::types::game_overlay_renderer_unhook_t game::hooking::prototypes::o_unhook; 10 | 11 | namespace game { 12 | namespace hooking { 13 | // declare initialization 14 | namespace init { 15 | bool the() { 16 | game::hooking::prototypes::o_hook = (game::hooking::types::game_overlay_renderer_hook_t)pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GAME_OVERAY_RENDERER_HOOKING]; 17 | 18 | if (game::hooking::prototypes::o_hook == nullptr) { 19 | logger::the("%s: \"o_hook\" was nullptr\n", __FUNCTION__); 20 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 21 | return false; 22 | } 23 | 24 | game::hooking::prototypes::o_unhook = (game::hooking::types::game_overlay_renderer_unhook_t)pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GAME_OVERAY_RENDERER_UNHOOKING]; 25 | 26 | if (game::hooking::prototypes::o_unhook == nullptr) { 27 | logger::the("%s: \"o_unhook\" was nullptr\n", __FUNCTION__); 28 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 29 | return false; 30 | } 31 | 32 | game::hooking::init::have_values_been_initialized = true; 33 | 34 | if (!game::hooking::apply_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_PAINT])) { 35 | logger::the("%s: Failed at hooking address \"ADDRESS_PAINT\"\n", __FUNCTION__); 36 | return false; 37 | } 38 | 39 | if (!game::hooking::apply_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_SEND_NET_MSG])) { 40 | logger::the("%s: Failed at hooking address \"ADDRESS_SEND_NET_MSG\"\n", __FUNCTION__); 41 | return false; 42 | } 43 | 44 | if (!game::hooking::apply_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_NET_GRAPH_TEXT_FORMATTER])) { 45 | logger::the("%s: Failed at hooking address \"ADDRESS_NET_GRAPH_TEXT_FORMATTER\"\n", __FUNCTION__); 46 | return false; 47 | } 48 | 49 | if (!game::hooking::apply_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_DRAW_CROSSHAIR])) { 50 | logger::the("%s: Failed at hooking address \"ADDRESS_DRAW_CROSSHAIR\"\n", __FUNCTION__); 51 | return false; 52 | } 53 | 54 | if (!game::hooking::apply_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GET_CS_WPN_DATA])) { 55 | logger::the("%s: Failed at hooking address \"ADDRESS_GET_CS_WPN_DATA\"\n", __FUNCTION__); 56 | return false; 57 | } 58 | 59 | if (!game::hooking::apply_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_PUSH_NOTICE])) { 60 | logger::the("%s: Failed at hooking address \"ADDRESS_PUSH_NOTICE\"\n", __FUNCTION__); 61 | return false; 62 | } 63 | 64 | if (!game::hooking::apply_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_CREATE_MOVE])) { 65 | logger::the("%s: Failed at hooking address \"ADDRESS_CREATE_MOVE\"\n", __FUNCTION__); 66 | return false; 67 | } 68 | 69 | if (!game::hooking::apply_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_FRAME_STAGE_NOTIFY])) { 70 | logger::the("%s: Failed at hooking address \"ADDRESS_FRAME_STAGE_NOTIFY\"\n", __FUNCTION__); 71 | return false; 72 | } 73 | 74 | if (!game::hooking::apply_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GET_CURRENT_GAME_TYPE])) { 75 | logger::the("%s: Failed at hooking address \"ADDRESS_GET_CURRENT_GAME_TYPE\"\n", __FUNCTION__); 76 | return false; 77 | } 78 | 79 | if (!game::hooking::apply_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GET_COLOR_MODULATION])) { 80 | logger::the("%s: Failed at hooking address \"ADDRESS_GET_COLOR_MODULATION\"\n", __FUNCTION__); 81 | return false; 82 | } 83 | 84 | if (!game::hooking::apply_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_IS_USING_STATIC_PROP_DEBUG_MODES])) { 85 | logger::the("%s: Failed at hooking address \"ADDRESS_IS_USING_STATIC_PROP_DEBUG_MODES\"\n", __FUNCTION__); 86 | return false; 87 | } 88 | 89 | logger::the("%s: Initialized\n", __FUNCTION__); 90 | return true; 91 | } 92 | } 93 | 94 | // declare detachment 95 | namespace detach { 96 | void the() { 97 | game::hooking::remove_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_PAINT]); 98 | game::hooking::remove_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_SEND_NET_MSG]); 99 | game::hooking::remove_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_NET_GRAPH_TEXT_FORMATTER]); 100 | game::hooking::remove_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_DRAW_CROSSHAIR]); 101 | game::hooking::remove_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GET_CS_WPN_DATA]); 102 | game::hooking::remove_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_PUSH_NOTICE]); 103 | game::hooking::remove_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_CREATE_MOVE]); 104 | game::hooking::remove_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_FRAME_STAGE_NOTIFY]); 105 | game::hooking::remove_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GET_CURRENT_GAME_TYPE]); 106 | game::hooking::remove_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GET_COLOR_MODULATION]); 107 | game::hooking::remove_hook(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_IS_USING_STATIC_PROP_DEBUG_MODES]); 108 | 109 | logger::the("%s: Detached\n", __FUNCTION__); 110 | } 111 | } 112 | } 113 | } -------------------------------------------------------------------------------- /sinclairv3/game/hooking/hooking.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../memory/memory.h" 4 | 5 | #include "prototypes.h" 6 | 7 | #include 8 | 9 | namespace game { 10 | namespace hooking { 11 | namespace init { 12 | static bool have_values_been_initialized = false; 13 | bool the(); 14 | } 15 | 16 | namespace detach { 17 | void the(); 18 | } 19 | 20 | namespace types { 21 | typedef bool(__cdecl* game_overlay_renderer_hook_t)(void*, void*, void*, int); 22 | typedef void(__cdecl* game_overlay_renderer_unhook_t)(void*, bool); 23 | } 24 | 25 | namespace prototypes { 26 | extern game::hooking::types::game_overlay_renderer_hook_t o_hook; 27 | extern game::hooking::types::game_overlay_renderer_unhook_t o_unhook; 28 | } 29 | 30 | template 31 | inline bool apply_hook(void* address) { 32 | assert(game::hooking::init::have_values_been_initialized); 33 | 34 | logger::the("%s: Applying hook at \"address\" (0x%X)\n", __FUNCTION__, address); 35 | return game::hooking::prototypes::o_hook(address, T::hooked, &T::o_fn, 0); 36 | } 37 | 38 | inline void remove_hook(void* address) { 39 | assert(game::hooking::init::have_values_been_initialized); 40 | 41 | logger::the("%s: Removing hook at \"address\" (0x%X)\n", __FUNCTION__, address); 42 | game::hooking::prototypes::o_unhook(address, false); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /sinclairv3/game/hooking/prototypes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../cstrike/defines.h" 4 | 5 | #define PROTOTYPE_FUNCTION(function_name, function_prototype) \ 6 | struct function_name \ 7 | { \ 8 | using fn = function_prototype; \ 9 | static fn hooked; \ 10 | static fn* o_fn; \ 11 | }; \ 12 | inline function_name::fn* function_name::o_fn; 13 | 14 | namespace game { 15 | namespace hooking { 16 | namespace functions { 17 | namespace prototypes { 18 | PROTOTYPE_FUNCTION 19 | ( 20 | push_notice, 21 | void(__fastcall)(CCSGO_HudChat*, void*, const char*, int, const char*) 22 | ); 23 | 24 | PROTOTYPE_FUNCTION 25 | ( 26 | create_move, 27 | bool(__stdcall)(float, CUserCmd*) 28 | ); 29 | 30 | PROTOTYPE_FUNCTION 31 | ( 32 | frame_stage_notify, 33 | void(__stdcall)(ClientFrameStages) 34 | ); 35 | 36 | PROTOTYPE_FUNCTION 37 | ( 38 | get_current_game_type, 39 | int(__fastcall)(void*, void*) 40 | ); 41 | 42 | PROTOTYPE_FUNCTION 43 | ( 44 | get_color_modulation, 45 | void(__fastcall)(IMaterial*, void*, float*, float*, float*) 46 | ); 47 | 48 | PROTOTYPE_FUNCTION 49 | ( 50 | is_using_static_prop_debug_modes, 51 | bool(__cdecl)() 52 | ); 53 | 54 | PROTOTYPE_FUNCTION 55 | ( 56 | get_cs_wpn_data, 57 | const CCSWeaponData& (__fastcall)(void*, void*) 58 | ); 59 | 60 | PROTOTYPE_FUNCTION 61 | ( 62 | draw_crosshair, 63 | void(__fastcall)(void*, void*) 64 | ); 65 | 66 | PROTOTYPE_FUNCTION 67 | ( 68 | vsnprintf, 69 | int(__cdecl)(char*, int, const char*, ...) 70 | ); 71 | 72 | PROTOTYPE_FUNCTION 73 | ( 74 | send_net_msg, 75 | bool(__fastcall)(void*, void*, INetMessage&, bool, bool) 76 | ); 77 | 78 | PROTOTYPE_FUNCTION 79 | ( 80 | paint, 81 | void(__fastcall)(void*, void*, PaintMode) 82 | ); 83 | } 84 | } 85 | } 86 | } -------------------------------------------------------------------------------- /sinclairv3/game/memory/memory.cpp: -------------------------------------------------------------------------------- 1 | #include "memory.h" 2 | 3 | #include "../../cstrike/cstrike.h" 4 | 5 | // Prototypes 6 | pe::util::memory::exports::types::create_interface_t game::memory::interfaces::prototypes::interface_exports[pe::Images::IMAGES_LIST_SIZE]; 7 | 8 | IBaseClientDLL* game::memory::interfaces::prototypes::base_client; 9 | CHLClient* game::memory::interfaces::prototypes::client_mode_shared; 10 | CGlobalVarsBase* game::memory::interfaces::prototypes::global_vars; 11 | IVEngineClient* game::memory::interfaces::prototypes::engine_client; 12 | IClientEntityList* game::memory::interfaces::prototypes::entity_list; 13 | IEngineTraceClient* game::memory::interfaces::prototypes::engine_trace; 14 | CIVDebugOverlay* game::memory::interfaces::prototypes::debug_overlay; 15 | ISurface* game::memory::interfaces::prototypes::surface; 16 | ICVar* game::memory::interfaces::prototypes::cvar_system; 17 | IInputSystem* game::memory::interfaces::prototypes::input_system; 18 | CModelInfo* game::memory::interfaces::prototypes::model_info; 19 | IVModelRender* game::memory::interfaces::prototypes::model_render; 20 | IMaterialSystem* game::memory::interfaces::prototypes::material_system; 21 | 22 | namespace game { 23 | namespace memory { 24 | namespace interfaces { 25 | // declare initializer 26 | namespace init { 27 | bool the() { 28 | game::memory::interfaces::prototypes::interface_exports[pe::Images::IMAGE_CLIENT] = 29 | pe::util::memory::exports::getter::the(pe::prototypes::images[pe::Images::IMAGE_CLIENT], "CreateInterface"); 30 | 31 | game::memory::interfaces::prototypes::interface_exports[pe::Images::IMAGE_ENGINE] = 32 | pe::util::memory::exports::getter::the(pe::prototypes::images[pe::Images::IMAGE_ENGINE], "CreateInterface"); 33 | 34 | game::memory::interfaces::prototypes::interface_exports[pe::Images::IMAGE_INPUT_SYSTEM] = 35 | pe::util::memory::exports::getter::the(pe::prototypes::images[pe::Images::IMAGE_INPUT_SYSTEM], "CreateInterface"); 36 | 37 | game::memory::interfaces::prototypes::interface_exports[pe::Images::IMAGE_VGUI_MAT_SURFACE] = 38 | pe::util::memory::exports::getter::the(pe::prototypes::images[pe::Images::IMAGE_VGUI_MAT_SURFACE], "CreateInterface"); 39 | 40 | game::memory::interfaces::prototypes::interface_exports[pe::Images::IMAGE_MATERIAL_SYSTEM] = 41 | pe::util::memory::exports::getter::the(pe::prototypes::images[pe::Images::IMAGE_MATERIAL_SYSTEM], "CreateInterface"); 42 | 43 | game::memory::interfaces::prototypes::interface_exports[pe::Images::IMAGE_VSTDLIB] = 44 | pe::util::memory::exports::getter::the(pe::prototypes::images[pe::Images::IMAGE_VSTDLIB], "CreateInterface"); 45 | 46 | game::memory::interfaces::prototypes::base_client = game::memory::interfaces::getter::the("VClient018"); 47 | 48 | if (game::memory::interfaces::prototypes::base_client == nullptr) { 49 | logger::the("%s: \"base_client\" was nullptr\n", __FUNCTION__); 50 | SINCLAIR_THROW(errors::Errors::GAME_MEMORY_INTERFACE_WAS_NULL); 51 | return false; 52 | } 53 | 54 | game::memory::interfaces::prototypes::client_mode_shared = **util::vtable::getter::the(game::memory::interfaces::prototypes::base_client); 55 | 56 | if (game::memory::interfaces::prototypes::client_mode_shared == nullptr) { 57 | logger::the("%s: \"client_mode_shared\" was nullptr\n", __FUNCTION__); 58 | SINCLAIR_THROW(errors::Errors::GAME_MEMORY_INTERFACE_WAS_NULL); 59 | return false; 60 | } 61 | 62 | logger::the("%s: Found \"client_mode_shared\" (0x%X)\n", __FUNCTION__, game::memory::interfaces::prototypes::client_mode_shared); 63 | 64 | game::memory::interfaces::prototypes::global_vars = **util::vtable::getter::the(game::memory::interfaces::prototypes::base_client); 65 | 66 | if (game::memory::interfaces::prototypes::global_vars == nullptr) { 67 | logger::the("%s: \"global_vars\" was nullptr\n", __FUNCTION__); 68 | SINCLAIR_THROW(errors::Errors::GAME_MEMORY_INTERFACE_WAS_NULL); 69 | return false; 70 | } 71 | 72 | logger::the("%s: Found \"global_vars\" (0x%X)\n", __FUNCTION__, game::memory::interfaces::prototypes::global_vars); 73 | 74 | game::memory::interfaces::prototypes::engine_client = game::memory::interfaces::getter::the("VEngineClient014"); 75 | 76 | if (game::memory::interfaces::prototypes::engine_client == nullptr) { 77 | logger::the("%s: \"engine_client\" was nullptr\n", __FUNCTION__); 78 | SINCLAIR_THROW(errors::Errors::GAME_MEMORY_INTERFACE_WAS_NULL); 79 | return false; 80 | } 81 | 82 | game::memory::interfaces::prototypes::entity_list = game::memory::interfaces::getter::the("VClientEntityList003"); 83 | 84 | if (game::memory::interfaces::prototypes::entity_list == nullptr) { 85 | logger::the("%s: \"entity_list\" was nullptr\n", __FUNCTION__); 86 | SINCLAIR_THROW(errors::Errors::GAME_MEMORY_INTERFACE_WAS_NULL); 87 | return false; 88 | } 89 | 90 | game::memory::interfaces::prototypes::engine_trace = game::memory::interfaces::getter::the("EngineTraceClient004"); 91 | 92 | if (game::memory::interfaces::prototypes::engine_trace == nullptr) { 93 | logger::the("%s: \"engine_trace\" was nullptr\n", __FUNCTION__); 94 | SINCLAIR_THROW(errors::Errors::GAME_MEMORY_INTERFACE_WAS_NULL); 95 | return false; 96 | } 97 | 98 | game::memory::interfaces::prototypes::debug_overlay = game::memory::interfaces::getter::the("VDebugOverlay004"); 99 | 100 | if (game::memory::interfaces::prototypes::debug_overlay == nullptr) { 101 | logger::the("%s: \"debug_overlay\" was nullptr\n", __FUNCTION__); 102 | SINCLAIR_THROW(errors::Errors::GAME_MEMORY_INTERFACE_WAS_NULL); 103 | return false; 104 | } 105 | 106 | game::memory::interfaces::prototypes::surface = game::memory::interfaces::getter::the("VGUI_Surface031"); 107 | 108 | if (game::memory::interfaces::prototypes::surface == nullptr) { 109 | logger::the("%s: \"surface\" was nullptr\n", __FUNCTION__); 110 | SINCLAIR_THROW(errors::Errors::GAME_MEMORY_INTERFACE_WAS_NULL); 111 | return false; 112 | } 113 | 114 | game::memory::interfaces::prototypes::cvar_system = game::memory::interfaces::getter::the("VEngineCvar007"); 115 | 116 | if (game::memory::interfaces::prototypes::cvar_system == nullptr) { 117 | logger::the("%s: \"cvar_system\" was nullptr\n", __FUNCTION__); 118 | SINCLAIR_THROW(errors::Errors::GAME_MEMORY_INTERFACE_WAS_NULL); 119 | return false; 120 | } 121 | 122 | game::memory::interfaces::prototypes::input_system = game::memory::interfaces::getter::the("InputSystemVersion001"); 123 | 124 | if (game::memory::interfaces::prototypes::input_system == nullptr) { 125 | logger::the("%s: \"input_system\" was nullptr\n", __FUNCTION__); 126 | SINCLAIR_THROW(errors::Errors::GAME_MEMORY_INTERFACE_WAS_NULL); 127 | return false; 128 | } 129 | 130 | game::memory::interfaces::prototypes::model_info = game::memory::interfaces::getter::the("VModelInfoClient004"); 131 | 132 | if (game::memory::interfaces::prototypes::model_info == nullptr) { 133 | logger::the("%s: \"model_info\" was nullptr\n", __FUNCTION__); 134 | SINCLAIR_THROW(errors::Errors::GAME_MEMORY_INTERFACE_WAS_NULL); 135 | return false; 136 | } 137 | 138 | game::memory::interfaces::prototypes::model_render = game::memory::interfaces::getter::the("VEngineModel016"); 139 | 140 | if (game::memory::interfaces::prototypes::model_render == nullptr) { 141 | logger::the("%s: \"model_render\" was nullptr\n", __FUNCTION__); 142 | SINCLAIR_THROW(errors::Errors::GAME_MEMORY_INTERFACE_WAS_NULL); 143 | return false; 144 | } 145 | 146 | game::memory::interfaces::prototypes::material_system = game::memory::interfaces::getter::the("VMaterialSystem080"); 147 | 148 | if (game::memory::interfaces::prototypes::material_system == nullptr) { 149 | logger::the("%s: \"material_system\" was nullptr\n", __FUNCTION__); 150 | SINCLAIR_THROW(errors::Errors::GAME_MEMORY_INTERFACE_WAS_NULL); 151 | return false; 152 | } 153 | 154 | logger::the("%s: Initialized\n", __FUNCTION__); 155 | return true; 156 | } 157 | } 158 | } 159 | } 160 | } -------------------------------------------------------------------------------- /sinclairv3/game/memory/memory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../pe/pe.h" 4 | #include "../../pe/util/util.h" 5 | 6 | #include "../../util/util.h" 7 | 8 | #include "../../cstrike/defines.h" 9 | 10 | namespace game { 11 | namespace memory { 12 | namespace interfaces { 13 | namespace init { 14 | bool the(); 15 | } 16 | 17 | namespace getter { 18 | template 19 | inline T the(const char(&name)[N]) { 20 | // If this exists then the map itself is also valid 21 | assert(interface_exports_map[index]); 22 | 23 | // Get factory export address from map 24 | const T result = (T)interface_exports_map[index](name, 0); 25 | 26 | if (result == nullptr) { 27 | logger::the("%s: \"result\" (interface_fn(\"%s\", 0)) was nullptr, returning\n", __FUNCTION__, name); 28 | SINCLAIR_THROW(errors::Errors::GAME_MEMORY_EXPORT_WAS_NULL); 29 | return nullptr; 30 | } 31 | 32 | logger::the("%s: Found \"result\" (%s) at 0x%X\n", __FUNCTION__, name, result); 33 | return result; 34 | } 35 | } 36 | 37 | namespace prototypes { 38 | extern pe::util::memory::exports::types::create_interface_t interface_exports[pe::Images::IMAGES_LIST_SIZE]; 39 | 40 | extern IBaseClientDLL* base_client; 41 | extern CHLClient* client_mode_shared; 42 | extern CGlobalVarsBase* global_vars; 43 | extern IVEngineClient* engine_client; 44 | extern IClientEntityList* entity_list; 45 | extern IEngineTraceClient* engine_trace; 46 | extern CIVDebugOverlay* debug_overlay; 47 | extern ISurface* surface; 48 | extern ICVar* cvar_system; 49 | extern IInputSystem* input_system; 50 | extern CModelInfo* model_info; 51 | extern IVModelRender* model_render; 52 | extern IMaterialSystem* material_system; 53 | } 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /sinclairv3/game/props/props.cpp: -------------------------------------------------------------------------------- 1 | #include "props.h" 2 | 3 | #include "../../cstrike/cstrike.h" 4 | 5 | // Prototypes 6 | game::props::types::props_type game::props::prototypes::props; 7 | 8 | namespace game { 9 | namespace props { 10 | // declare initializer 11 | namespace init { 12 | void the() { 13 | game::props::dumper::the(); 14 | 15 | logger::the("%s: Initialized\n", __FUNCTION__); 16 | } 17 | } 18 | 19 | namespace collecter { 20 | void the(RecvTable* table) { 21 | for (int i = 0; i < table->props_len; ++i) { 22 | const RecvProp* current_prop = &table->props[i]; 23 | 24 | if (current_prop == nullptr || isdigit(current_prop->var_name[0]) || 25 | (current_prop->var_name[0] == 'b' && current_prop->var_name[4] == 'c')) { 26 | 27 | continue; 28 | } 29 | 30 | if (current_prop->data_table && 31 | (current_prop->recv_type == SendPropType::DPT_FLOAT || 32 | current_prop->recv_type == SendPropType::DPT_VECTOR_2D || 33 | current_prop->recv_type == SendPropType::DPT_VECTOR_3D || 34 | current_prop->recv_type == SendPropType::DPT_STRING || 35 | current_prop->recv_type == SendPropType::DPT_ARRAY || 36 | current_prop->recv_type == SendPropType::DPT_DATA_TABLE)) { 37 | game::props::collecter::the(current_prop->data_table); 38 | } 39 | 40 | game::props::prototypes::props[HASH_RT(table->net_table_name)][HASH_RT(current_prop->var_name)] = current_prop->offset; 41 | } 42 | } 43 | } 44 | 45 | namespace dumper { 46 | void the() { 47 | for (ClientClass* data = game::memory::interfaces::prototypes::base_client->get_all_classes(); data != nullptr; data = data->next) { 48 | if (data->recv_table) { 49 | game::props::collecter::the(data->recv_table); 50 | } 51 | } 52 | 53 | logger::the("%s: Initialized\n", __FUNCTION__); 54 | } 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /sinclairv3/game/props/props.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../memory/memory.h" 4 | 5 | #include "../../cstrike/defines.h" 6 | 7 | #include "../../extern/hasher/hasher.h" 8 | 9 | #include 10 | 11 | namespace game { 12 | namespace props { 13 | namespace init { 14 | void the(); 15 | } 16 | 17 | namespace types { 18 | typedef std::unordered_map> props_type; 19 | } 20 | 21 | namespace prototypes { 22 | extern game::props::types::props_type props; 23 | } 24 | 25 | namespace collecter { 26 | void the(RecvTable* table); 27 | } 28 | 29 | namespace dumper { 30 | void the(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /sinclairv3/game/renderer/surface/surface.cpp: -------------------------------------------------------------------------------- 1 | #include "surface.h" 2 | 3 | // Prototypes 4 | HFont game::renderer::surface::prototypes::fonts[game::renderer::surface::Fonts::FONT_LIST_SIZE]; 5 | 6 | namespace game { 7 | namespace renderer { 8 | namespace surface { 9 | // declare initializer 10 | namespace init { 11 | bool the() { 12 | game::renderer::surface::prototypes::fonts[game::renderer::surface::Fonts::FONT_PF_TEMPESTA_SEVEN] = 13 | game::memory::interfaces::prototypes::surface->create_font(); 14 | 15 | if (!game::renderer::surface::prototypes::fonts[game::renderer::surface::Fonts::FONT_PF_TEMPESTA_SEVEN]) { 16 | SINCLAIR_THROW(errors::Errors::GAME_RENDERER_FONT_WAS_NULL); 17 | logger::the("%s: \"FONT_VERDANA_BOLD\" (from 0x%X) failed to initialize\n", __FUNCTION__, game::renderer::surface::prototypes::fonts); 18 | return false; 19 | } 20 | 21 | game::memory::interfaces::prototypes::surface->set_font_glyph_set(game::renderer::surface::prototypes::fonts[game::renderer::surface::Fonts::FONT_PF_TEMPESTA_SEVEN], 22 | "PF Tempesta Seven", 13, 0, 0, 0, FontFlags::FONTFLAG_OUTLINE); 23 | 24 | logger::the("%s: Initialized\n", __FUNCTION__); 25 | return true; 26 | } 27 | } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /sinclairv3/game/renderer/surface/surface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../../cstrike/defines.h" 4 | 5 | #include "../../../cstrike/cstrike.h" 6 | 7 | #include "../../memory/memory.h" 8 | 9 | #include 10 | 11 | #define PLAT(vpanel) (((VPanel *)vpanel)->plat) 12 | 13 | namespace game { 14 | namespace renderer { 15 | namespace surface { 16 | enum ColorPreservation { 17 | COLOR_CHANGE, 18 | COLOR_CHANGE_AND_RESTORE, 19 | COLOR_PRESERVE 20 | }; 21 | 22 | enum Fonts { 23 | FONT_PF_TEMPESTA_SEVEN, 24 | 25 | FONT_LIST_SIZE 26 | }; 27 | 28 | namespace init { 29 | bool the(); 30 | } 31 | 32 | namespace prototypes { 33 | extern HFont fonts[game::renderer::surface::Fonts::FONT_LIST_SIZE]; 34 | } 35 | 36 | inline const util::color_t& get_color() { 37 | return { game::memory::interfaces::prototypes::surface->r, 38 | game::memory::interfaces::prototypes::surface->g, 39 | game::memory::interfaces::prototypes::surface->b, 40 | game::memory::interfaces::prototypes::surface->a }; 41 | } 42 | 43 | inline void set_color(const util::color_t& color) { 44 | game::memory::interfaces::prototypes::surface->draw_set_color(color.r, color.g, color.b, color.a); 45 | } 46 | 47 | // We're not going to manage text color ourselves, only for geometry 48 | 49 | // This might be messy but it's to avoid typing more than we already do 50 | // We're not going to assert in something that gets called constantly, we just rely on the fact that 51 | // Initializer has passed, if it has. But if it hasn't, we won't get to this point 52 | 53 | template 55 | inline void text(const char(&text)[N], int x, int y, const util::color_t& color) { 56 | game::memory::interfaces::prototypes::surface->draw_colored_text(fonts_list[font], x, y, color.r, color.g, color.b, color.a, text); 57 | } 58 | 59 | // According to godbolt, there'll never be a cmp, this is processed by compile time 60 | 61 | // Uninitialized but created values will be compiled away 62 | 63 | template 64 | inline void rectangle(int x, int y, int w, int h, const util::color_t& color = { 255, 255, 255, 255 }) { 65 | static util::color_t old_color; 66 | 67 | if (change_color == ColorPreservation::COLOR_CHANGE_AND_RESTORE) 68 | old_color = get_color(); 69 | 70 | if (change_color == ColorPreservation::COLOR_CHANGE || change_color == ColorPreservation::COLOR_CHANGE_AND_RESTORE) 71 | game::renderer::surface::set_color(color); 72 | 73 | game::memory::interfaces::prototypes::surface->draw_filled_rectangle(x, y, x + w, y + h); 74 | 75 | if (change_color == ColorPreservation::COLOR_CHANGE_AND_RESTORE) 76 | game::renderer::surface::set_color(old_color); 77 | } 78 | 79 | template 80 | inline void rectangle_outline(int x, int y, int w, int h, const util::color_t& color = { 255, 255, 255, 255 }) { 81 | static util::color_t old_color; 82 | 83 | if (change_color == ColorPreservation::COLOR_CHANGE_AND_RESTORE) 84 | old_color = get_color(); 85 | 86 | if (change_color == ColorPreservation::COLOR_CHANGE || change_color == ColorPreservation::COLOR_CHANGE_AND_RESTORE) 87 | game::renderer::surface::set_color(color); 88 | 89 | game::memory::interfaces::prototypes::surface->draw_outlined_rectangle(x, y, x + w, y + h); 90 | 91 | if (change_color == ColorPreservation::COLOR_CHANGE_AND_RESTORE) 92 | game::renderer::surface::set_color(old_color); 93 | } 94 | 95 | template 96 | inline void line(int x0, int y0, int x1, int y1, const util::color_t& color = { 255, 255, 255, 255 }) { 97 | static util::color_t old_color; 98 | 99 | if (change_color == ColorPreservation::COLOR_CHANGE_AND_RESTORE) 100 | old_color = get_color(); 101 | 102 | if (change_color == ColorPreservation::COLOR_CHANGE || change_color == ColorPreservation::COLOR_CHANGE_AND_RESTORE) 103 | game::renderer::surface::set_color(color); 104 | 105 | game::memory::interfaces::prototypes::surface->draw_line(x0, y0, x0 + x1, y0 + y1); 106 | 107 | if (change_color == ColorPreservation::COLOR_CHANGE_AND_RESTORE) 108 | game::renderer::surface::set_color(old_color); 109 | } 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /sinclairv3/logger/logger.cpp: -------------------------------------------------------------------------------- 1 | #include "logger.h" 2 | 3 | namespace logger { 4 | // declare initializer 5 | namespace init { 6 | void the() { 7 | // Allow for I/O in our console instance 8 | freopen_s((FILE**)stdin, "CONIN$", "r", stdin); 9 | freopen_s((FILE**)stdout, "CONOUT$", "w", stdout); 10 | 11 | logger::the("%s: Initialized\n", __FUNCTION__); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /sinclairv3/logger/logger.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #pragma warning(disable:4172) 7 | 8 | namespace logger { 9 | namespace init { 10 | void the(); 11 | } 12 | 13 | namespace types { 14 | typedef unsigned int level_type; 15 | } 16 | 17 | namespace level { 18 | constexpr static types::level_type warning = 0; 19 | constexpr static types::level_type error = 1; 20 | constexpr static types::level_type log = 2; 21 | 22 | namespace naming { 23 | constexpr static const char* the[log + 1] /* lol */ = { "warning", "error", "log" }; 24 | } 25 | } 26 | 27 | // this is kinda disgusting but works 28 | template 29 | inline void the(const char(&fmt)[N], Args... args) { 30 | printf("%s | ", logger::level::naming::the[level]); 31 | 32 | printf(fmt, args...); 33 | } 34 | } -------------------------------------------------------------------------------- /sinclairv3/math/math.cpp: -------------------------------------------------------------------------------- 1 | #include "math.h" 2 | -------------------------------------------------------------------------------- /sinclairv3/math/math.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "matrix/matrix.h" 4 | #include "position/position.h" -------------------------------------------------------------------------------- /sinclairv3/math/matrix/matrix.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace math { 7 | template 8 | using matrix = std::array, r>; 9 | } -------------------------------------------------------------------------------- /sinclairv3/math/position/position.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | namespace math { 9 | namespace util { 10 | constexpr static double pi = M_PI; 11 | constexpr static float pi_f = (float)M_PI; 12 | } 13 | 14 | namespace types { 15 | typedef unsigned int screen_2d_position; 16 | } 17 | 18 | template 19 | struct point_t { 20 | constexpr point_t(T x = 0, T y = 0) : x(x), y(y) {} 21 | 22 | T x, y; 23 | 24 | inline T length() const { 25 | return sqrt(x * x + y * y); 26 | } 27 | 28 | inline T length_sqr() const { 29 | return (x * x + y * y); 30 | } 31 | 32 | inline math::point_t operator+(const math::point_t& v) const { 33 | return math::point_t(x + v.x, y + v.y); 34 | } 35 | 36 | inline math::point_t operator-(const math::point_t& v) const { 37 | return point_t(x - v.x, y - v.y); 38 | } 39 | 40 | inline math::point_t& operator*=(T val) { 41 | x *= val; 42 | y *= val; 43 | return *this; 44 | } 45 | 46 | inline math::point_t& operator*=(const math::point_t& v) { 47 | x *= v.x; 48 | y *= v.y; 49 | return *this; 50 | } 51 | }; 52 | 53 | template 54 | struct point_3d_t { 55 | constexpr point_3d_t(T x = 0, T y = 0, T z = 0) : x(x), y(y), z(z) {} 56 | 57 | T x, y, z; 58 | 59 | // These could've used 60 | // but I don't want to mix this datatype 61 | // with functions that have special handling such as nodiscard, 62 | // noexcept, etc 63 | 64 | inline void cstrike_clamp() { 65 | while (x > 89.f) 66 | x -= 180.f; 67 | while (x < -89.f) 68 | x += 180.f; 69 | 70 | while (y > 180.f) 71 | y -= 360.f; 72 | while (y < -180.f) 73 | y += 360.f; 74 | } 75 | 76 | inline void cstrike_normalize() { 77 | 78 | if (x > 89.f) 79 | x = 89.f; 80 | else if (x < -89.0f) 81 | x = -89.f; 82 | 83 | if (y > 180.f) 84 | y = 180.f; 85 | else if (y < -180.0f) 86 | y = -180.f; 87 | 88 | z = 0.f; 89 | } 90 | 91 | inline T length() const { 92 | return sqrt(x * x + y * y + z * z); 93 | } 94 | 95 | inline T length_2d() const { 96 | return sqrt(x * x + y * y); 97 | } 98 | 99 | inline T length_sqr() const { 100 | return (x * x + y * y + z * z); 101 | } 102 | 103 | inline T length_sqr_2d() const { 104 | return (x * x + y * y); 105 | } 106 | 107 | inline math::point_3d_t operator+(const math::point_3d_t& v) const { 108 | return math::point_3d_t(x + v.x, y + v.y, z + v.z); 109 | } 110 | 111 | inline math::point_3d_t operator-(const math::point_3d_t& v) const { 112 | return math::point_3d_t(x - v.x, y - v.y, z - v.z); 113 | } 114 | 115 | inline math::point_3d_t& operator*=(T val) { 116 | x *= val; 117 | y *= val; 118 | z *= val; 119 | return *this; 120 | } 121 | 122 | inline math::point_3d_t& operator*=(const math::point_3d_t& v) { 123 | x *= v.x; 124 | y *= v.y; 125 | z *= v.z; 126 | return *this; 127 | } 128 | }; 129 | 130 | template 131 | struct point_4d_t { 132 | constexpr point_4d_t(T x = 0 , T y = 0, T z = 0, T v = 0) : x(x), y(y), z(z), v(v) {} 133 | 134 | T x, y, z, v; 135 | 136 | inline T length() const { 137 | return sqrt(x * x + y * y + z * z + v * v); 138 | } 139 | 140 | inline T length_2d() const { 141 | return sqrt(x * x + y * y); 142 | } 143 | 144 | inline T length_3d() const { 145 | return sqrt(x * x + y * y + z * z); 146 | } 147 | 148 | inline T length_sqr() const { 149 | return (x * x + y * y + z * z + v * v); 150 | } 151 | 152 | inline T length_sqr_2d() const { 153 | return (x * x + y * y); 154 | } 155 | 156 | inline T length_sqr_3d() const { 157 | return (x * x + y * y + z * z); 158 | } 159 | 160 | inline math::point_4d_t operator+(const math::point_4d_t& v) const { 161 | return math::point_4d_t(x + v.x, y + v.y, z + v.z, this->v + v.v); 162 | } 163 | 164 | inline math::point_4d_t operator-(const math::point_4d_t& v) const { 165 | return math::point_4d_t(x - v.x, y - v.y, z - v.z, this->v + v.v); 166 | } 167 | 168 | inline math::point_4d_t& operator*=(T val) { 169 | x *= val; 170 | y *= val; 171 | z *= val; 172 | v *= val; 173 | return *this; 174 | } 175 | 176 | inline math::point_4d_t& operator*=(const math::point_4d_t& v) { 177 | x *= v.x; 178 | y *= v.y; 179 | z *= v.z; 180 | this->v *= v.v; 181 | return *this; 182 | } 183 | }; 184 | } -------------------------------------------------------------------------------- /sinclairv3/pe/pe.cpp: -------------------------------------------------------------------------------- 1 | #include "pe.h" 2 | 3 | #include "util/util.h" 4 | 5 | // Prototypes 6 | pe::types::image_type pe::prototypes::images[pe::Images::IMAGES_LIST_SIZE]; 7 | 8 | namespace pe { 9 | // declare initializer 10 | namespace init { 11 | bool the() { 12 | if (!pe::getter::the("client.dll")) { 13 | logger::the("%s: Can't find \"client.dll\", throwing\n", __FUNCTION__); 14 | SINCLAIR_THROW(errors::Errors::PE_GETTER_RESULT_WAS_NULL); 15 | return false; 16 | } 17 | 18 | if (!pe::getter::the("engine.dll")) { 19 | logger::the("%s: Can't find \"engine.dll\", throwing\n", __FUNCTION__); 20 | SINCLAIR_THROW(errors::Errors::PE_GETTER_RESULT_WAS_NULL); 21 | return false; 22 | } 23 | 24 | if (!pe::getter::the("inputsystem.dll")) { 25 | logger::the("%s: Can't find \"inputsystem.dll\", throwing\n", __FUNCTION__); 26 | SINCLAIR_THROW(errors::Errors::PE_GETTER_RESULT_WAS_NULL); 27 | return false; 28 | } 29 | 30 | if (!pe::getter::the("vstdlib.dll")) { 31 | logger::the("%s: Can't find \"vstdlib.dll\", throwing\n", __FUNCTION__); 32 | SINCLAIR_THROW(errors::Errors::PE_GETTER_RESULT_WAS_NULL); 33 | return false; 34 | } 35 | 36 | if (!pe::getter::the("vgui2.dll")) { 37 | logger::the("%s: Can't find \"vgui2.dll\", throwing\n", __FUNCTION__); 38 | SINCLAIR_THROW(errors::Errors::PE_GETTER_RESULT_WAS_NULL); 39 | return false; 40 | } 41 | 42 | if (!pe::getter::the("vguimatsurface.dll")) { 43 | logger::the("%s: Can't find \"vguimatsurface.dll\", throwing\n", __FUNCTION__); 44 | SINCLAIR_THROW(errors::Errors::PE_GETTER_RESULT_WAS_NULL); 45 | return false; 46 | } 47 | 48 | if (!pe::getter::the("materialsystem.dll")) { 49 | logger::the("%s: Can't find \"materialsystem.dll\", throwing\n", __FUNCTION__); 50 | SINCLAIR_THROW(errors::Errors::PE_GETTER_RESULT_WAS_NULL); 51 | return false; 52 | } 53 | 54 | if (!pe::getter::the("GameOverlayRenderer.dll")) { 55 | logger::the("%s: Can't find \"GameOverlayRenderer.dll\", throwing\n", __FUNCTION__); 56 | SINCLAIR_THROW(errors::Errors::PE_GETTER_RESULT_WAS_NULL); 57 | return false; 58 | } 59 | 60 | if (!pe::util::init::the()) { 61 | logger::the("%s: Failed at utilities initializer\n", __FUNCTION__); 62 | return false; 63 | } 64 | 65 | pe::util::memory::byte::patch::init::the(); 66 | 67 | logger::the("%s: Initialized | %d images stored in image map\n", __FUNCTION__, pe::Images::IMAGES_LIST_SIZE); 68 | return true; 69 | } 70 | } 71 | 72 | // declare detachment 73 | namespace detach { 74 | void the() { 75 | pe::util::detach::the(); 76 | 77 | logger::the("%s: Detached\n", __FUNCTION__); 78 | } 79 | } 80 | } -------------------------------------------------------------------------------- /sinclairv3/pe/pe.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 4 | // Windows Header Files 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | #include "../extern/custom_winapi/custom_winapi.h" 12 | 13 | #include "../logger/logger.h" 14 | 15 | #include "../errors/errors.h" 16 | 17 | #include 18 | 19 | #define REGISTERS void* thisptr, void* dummy 20 | 21 | #define REGISTERS_t(x) x thisptr, void* dummy 22 | 23 | namespace pe { 24 | enum Images { 25 | IMAGE_CLIENT, 26 | IMAGE_ENGINE, 27 | IMAGE_INPUT_SYSTEM, 28 | IMAGE_VSTDLIB, 29 | IMAGE_VGUI2, 30 | IMAGE_VGUI_MAT_SURFACE, 31 | IMAGE_MATERIAL_SYSTEM, 32 | IMAGE_GAME_OVERLAY_RENDERER, 33 | 34 | IMAGES_LIST_SIZE 35 | }; 36 | 37 | namespace init { 38 | bool the(); 39 | } 40 | 41 | namespace detach { 42 | void the(); 43 | } 44 | 45 | namespace types { 46 | typedef HMODULE image_type; 47 | } 48 | 49 | namespace prototypes { 50 | extern pe::types::image_type images[Images::IMAGES_LIST_SIZE]; 51 | } 52 | 53 | namespace getter { 54 | template 55 | inline bool the(const char(&image)[N]) { 56 | // Assert that image map is valid 57 | assert(image_map); 58 | 59 | // Get result now for valid checks 60 | const pe::types::image_type result = GetModuleA(image); 61 | if (result == NULL) { 62 | logger::the("%s: \"result\" was NULL, returning, refer to MSDN\n", __FUNCTION__); 63 | SINCLAIR_THROW(errors::Errors::PE_GETTER_RESULT_WAS_NULL); 64 | return false; 65 | } 66 | 67 | // Assign value to image map 68 | image_map[index] = result; 69 | 70 | logger::the("%s: \"result\" (%s) [0x%X] was pushed to \"image_map\" (0x%X) at index %d\n", __FUNCTION__, image, result, image_map, index); 71 | return true; 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /sinclairv3/pe/util/util.cpp: -------------------------------------------------------------------------------- 1 | #include "util.h" 2 | 3 | #include "../../cstrike/enums.h" 4 | 5 | // Prototypes 6 | pe::util::types::byte_ptr pe::util::prototypes::static_addresses[pe::util::StaticAddresses::STATIC_ADDRESSES_LIST_SIZE]; 7 | 8 | namespace pe { 9 | namespace util { 10 | // declare initializer 11 | namespace init { 12 | bool the() { 13 | // 83 3D ? ? ? ? ? 56 8B F1 0F 84 ? ? ? ? 8B 0D ? ? ? ? 8B 01 FF 50 20 83 F8 06 0F 85 ? ? ? ? 14 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GET_CURRENT_GAME_TYPE] = 15 | pe::util::memory::patterns::getter::the({ 0x83, 0x3D, -1, -1, -1, -1, -1, 0x56, 0x8B, 0xF1, 0x0F, 0x84, -1, -1, -1, -1, 0x8B, 0x0D, -1, -1, -1, -1, 0x8B, 0x01, 0xFF, 0x50, 0x20, 16 | 0x83, 0xF8, 0x06, 0x0F, 0x85, -1, -1, -1, -1 }); 17 | 18 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GET_CURRENT_GAME_TYPE] == nullptr) { 19 | logger::the("%s: \"ADDRESS_GET_CURRENT_GAME_TYPE\" was nullptr\n", __FUNCTION__); 20 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 21 | return false; 22 | } 23 | 24 | // #STR: "Couldn't get trampoline region lock, will continue possibl 25 | // E8 ? ? ? ? 83 C4 10 EB 21 26 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GAME_OVERAY_RENDERER_HOOKING] = 27 | pe::util::memory::patterns::util::relative_to_absolute( 28 | pe::util::memory::patterns::getter::the({ 0xE8, -1, -1, -1, -1, 0x83, 0xC4, 0x10, 0xEB, 0x21 }) + 1); 29 | 30 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GAME_OVERAY_RENDERER_HOOKING] == nullptr) { 31 | logger::the("%s: \"ADDRESS_GAME_OVERAY_RENDERER_HOOKING\" was nullptr\n", __FUNCTION__); 32 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 33 | return false; 34 | } 35 | 36 | // #STR: "Aborting UnhookFunc because pRealFunctionAddr is null\n", "Aborting UnhookFunc because pRealFunctionAddr is not hooke, "System page siz 37 | // E8 ? ? ? ? 83 C4 08 FF 15 ? ? ? ? 38 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GAME_OVERAY_RENDERER_UNHOOKING] = 39 | pe::util::memory::patterns::util::relative_to_absolute( 40 | pe::util::memory::patterns::getter::the({ 0xE8, -1, -1, -1, -1, 0x83, 0xC4, 0x08, 0xFF, 0x15, -1, -1, -1, -1 }) + 1); 41 | 42 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GAME_OVERAY_RENDERER_UNHOOKING] == nullptr) { 43 | logger::the("%s: \"ADDRESS_GAME_OVERAY_RENDERER_UNHOOKING\" was nullptr\n", __FUNCTION__); 44 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 45 | return false; 46 | } 47 | 48 | // #STR: "Weapon '%s' script file not found, but its data was access, "%s (%d) : %s\n", "", "..\\shared\\cstrike15\\weapon_csbase.cpp" 49 | // 55 8B EC 81 EC 0C 01 ? ? 53 8B D9 56 57 8D 8B 50 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GET_CS_WPN_DATA] = 51 | pe::util::memory::patterns::getter::the({ 0x55, 0x8B, 0xEC, 0x81, 0xEC, 0x0C, 0x01, -1, -1, 0x53, 0x8B, 0xD9, 0x56, 0x57, 0x8D, 0x8B }); 52 | 53 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GET_CS_WPN_DATA] == nullptr) { 54 | logger::the("%s: \"ADDRESS_GET_CS_WPN_DATA\" was nullptr\n", __FUNCTION__); 55 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 56 | return false; 57 | } 58 | 59 | // 55 8B EC 83 E4 F8 81 EC ? ? ? ? 53 56 8B F1 57 83 BE ? ? ? ? ? 75 14 8B 46 04 8D 4E 04 FF 50 20 60 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GET_ENTITY_BOUNDING_BOX] = 61 | pe::util::memory::patterns::getter::the({ 0x55, 0x8B, 0xEC, 0x83, 0xE4, 0xF8, 0x81, 0xEC, -1, -1, -1, -1, 0x53, 0x56, 0x8B, 0xF1, 0x57, 0x83, 0xBE, -1, -1, -1, -1, -1, 0x75, 0x14, 0x8B, 0x46, 0x04, 0x8D, 0x4E, 0x04, 0xFF, 0x50, 0x20 }); 62 | 63 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GET_ENTITY_BOUNDING_BOX] == nullptr) { 64 | logger::the("%s: \"ADDRESS_GET_ENTITY_BOUNDING_BOX\" was nullptr\n", __FUNCTION__); 65 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 66 | return false; 67 | } 68 | 69 | // 83 79 5C FF 74 07 70 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_ENTITY_IS_DORMANT] = 71 | pe::util::memory::patterns::getter::the({ 0x83, 0x79, 0x5C, 0xFF, 0x74, 0x07 }); 72 | 73 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_ENTITY_IS_DORMANT] == nullptr) { 74 | logger::the("%s: \"ADDRESS_ENTITY_IS_DORMANT\" was nullptr\n", __FUNCTION__); 75 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 76 | return false; 77 | } 78 | 79 | // #STR: "Inaccuracy =\t%f\tSpread =\t%f\tSpreadDistance =\t%f\tPlay, "whiteAdditive" 80 | // 55 8B EC 83 E4 F0 83 EC 78 56 8B F1 8B 0D ? ? ? ? 81 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_DRAW_CROSSHAIR] = 82 | pe::util::memory::patterns::getter::the({ 0x55, 0x8B, 0xEC, 0x83, 0xE4, 0xF0, 0x83, 0xEC, 0x78, 0x56, 0x8B, 0xF1, 0x8B, 0x0D, -1, -1, -1, -1 }); 83 | 84 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_DRAW_CROSSHAIR] == nullptr) { 85 | logger::the("%s: \"ADDRESS_DRAW_CROSSHAIR\" was nullptr\n", __FUNCTION__); 86 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 87 | return false; 88 | } 89 | 90 | // Inside DrawCrosshair so the reference strings also stand here 91 | // FF D0 call eax 92 | // 83 F8 05 cmp eax, 5; if getcswpndata.type != sniper_rifle 93 | // ------------------------------------------------ 94 | // (FF D0 83 F8) 05 75 17 A1 ? ? ? ? B9 ? ? ? ? 8B 40 34 FF D0 85 C0 95 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_CMP_FORCE_CROSSHAIR] = 96 | pe::util::memory::patterns::getter::the({ 0x05, 0x75, 0x17, 0xA1, -1, -1, -1, -1, 0xB9, -1, -1, -1, -1, 0x8B, 0x40, 0x34, 0xFF, 0xD0, 0x85, 0xC0, 0x0F, 0x84, -1, -1, -1, -1, 0xE8, -1, -1, -1, -1, 0x99 }); 97 | 98 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_CMP_FORCE_CROSSHAIR] == nullptr) { 99 | logger::the("%s: \"ADDRESS_CMP_FORCE_CROSSHAIR\" was nullptr\n", __FUNCTION__); 100 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 101 | return false; 102 | } 103 | 104 | // 55 8B EC 51 56 8B 75 0C 8D 45 14 57 8B 7D 08 8B D6 50 51 FF 75 10 8B CF E8 ? ? ? ? 83 C4 0C 85 C0 78 08 85 F6 7E 0C 3B C6 7C 08 8D 46 FF 105 | // in Cheat Engine or IDA, look for fps: 106 | // and you'll find the formatter immediately 107 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_NET_GRAPH_TEXT_FORMATTER] = 108 | pe::util::memory::patterns::getter::the({ 0x55, 0x8B, 0xEC, 0x51, 0x56, 0x8B, 0x75, 0x0C, 0x8D, 0x45, 0x14, 0x57, 0x8B, 0x7D, 0x08, 0x8B, 0xD6, 0x50, 0x51, 0xFF, 0x75, 0x10, 0x8B, 0xCF, 0xE8, -1, -1, -1, -1, 0x83, 0xC4, 0x0C, 0x85, 0xC0, 0x78, 0x08, 0x85, 0xF6, 0x7E, 0x0C, 0x3B, 0xC6, 0x7C, 0x08, 0x8D, 0x46, 0xFF }); 109 | 110 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_NET_GRAPH_TEXT_FORMATTER] == nullptr) { 111 | logger::the("%s: \"ADDRESS_NET_GRAPH_TEXT_FORMATTER\" was nullptr\n", __FUNCTION__); 112 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 113 | return false; 114 | } 115 | 116 | // (int)"fps: %5i var: %4.1f ms (v%u%s)", 117 | // E8 ? ? ? ? 8B 87 ? ? ? ? 8D 8C 24 ? ? ? ? 51 8B 15 ? ? ? ? 8B C8 68 ? ? ? ? C1 E9 18 51 8B 32 8B C8 C1 E9 10 0F B6 C9 51 8B C8 0F B6 C0 C1 E9 08 0F B6 C9 51 50 8B 87 ? ? ? ? 03 45 10 50 118 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_NET_GRAPH_TEXT_MAIN_MENU_RET_ADDR] = 119 | pe::util::memory::patterns::getter::the({ 0xE8, -1, -1, -1, -1, 0x8B, 0x87, -1, -1, -1, -1, 0x8D, 0x8C, 0x24, -1, -1, -1, -1, 0x51, 0x8B, 0x15, -1, -1, -1, -1, 0x8B, 0xC8, 0x68, -1, -1, -1, -1, 0xC1, 0xE9, 0x18, 0x51, 0x8B, 0x32, 0x8B, 0xC8, 0xC1, 0xE9, 0x10, 0x0F, 0xB6, 0xC9, 0x51, 0x8B, 0xC8, 0x0F, 0xB6, 0xC0, 0xC1, 0xE9, 0x08, 0x0F, 0xB6, 0xC9, 0x51, 0x50, 0x8B, 0x87, -1, -1, -1, -1, 0x03, 0x45, 0x10, 0x50 }) + 5; 120 | 121 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_NET_GRAPH_TEXT_MAIN_MENU_RET_ADDR] == nullptr) { 122 | logger::the("%s: \"ADDRESS_NET_GRAPH_TEXT_MAIN_MENU_RET_ADDR\" was nullptr\n", __FUNCTION__); 123 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 124 | return false; 125 | } 126 | 127 | // (int)"fps: %5i var: %4.1f ms (v%u%s)" 128 | // E8 ? ? ? ? 8B 87 ? ? ? ? 8D 8C 24 ? ? ? ? 83 C4 1C 8B 15 ? ? ? ? 51 68 ? ? ? ? 8B 32 8B C8 C1 E9 18 51 8B C8 C1 E9 10 0F B6 C9 51 8B C8 0F B6 C0 C1 E9 08 0F B6 C9 51 50 FF 75 10 FF 75 0C FF 74 24 34 129 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_NET_GRAPH_TEXT_GAME_RET_ADDR] = 130 | pe::util::memory::patterns::getter::the({ 0xE8, -1, -1, -1, -1, 0x8B, 0x87, -1, -1, -1, -1, 0x8D, 0x8C, 0x24, -1, -1, -1, -1, 0x83, 0xC4, 0x1C, 0x8B, 0x15, -1, -1, -1, -1, 0x51, 0x68, -1, -1, -1, -1, 0x8B, 0x32, 0x8B, 0xC8, 0xC1, 0xE9, 0x18, 0x51, 0x8B, 0xC8, 0xC1, 0xE9, 0x10, 0x0F, 0xB6, 0xC9, 0x51, 0x8B, 0xC8, 0x0F, 0xB6, 0xC0, 0xC1, 0xE9, 0x08, 0x0F, 0xB6, 0xC9, 0x51, 0x50, 0xFF, 0x75, 0x10, 0xFF, 0x75, 0x0C, 0xFF, 0x74, 0x24, 0x34 }) + 5; 131 | 132 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_NET_GRAPH_TEXT_GAME_RET_ADDR] == nullptr) { 133 | logger::the("%s: \"ADDRESS_NET_GRAPH_TEXT_GAME_RET_ADDR\" was nullptr\n", __FUNCTION__); 134 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 135 | return false; 136 | } 137 | 138 | // #STR: "%s %s", "CCSGO_HudVoiceStatus", "#A745F7" 139 | // E8 ? ? ? ? 83 7D D4 00 7C 22 140 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_PUSH_NOTICE] = 141 | pe::util::memory::patterns::util::relative_to_absolute( 142 | pe::util::memory::patterns::getter::the({ 0xE8, -1, -1, -1, -1, 0x83, 0x7D, 0xD4, 0x00, 0x7C, 0x22 }) + 1); 143 | 144 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_PUSH_NOTICE] == nullptr) { 145 | logger::the("%s: \"ADDRESS_PUSH_NOTICE\" was nullptr\n", __FUNCTION__); 146 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 147 | return false; 148 | } 149 | 150 | // function before: 151 | // #STR: "LevelInit" 152 | // this one though has no string associate 153 | // 55 8B EC 8B 0D ? ? ? ? 85 C9 75 06 154 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_CREATE_MOVE] = 155 | pe::util::memory::patterns::getter::the({ 0x55, 0x8B, 0xEC, 0x8B, 0x0D, -1, -1, -1, -1, 0x85, 0xC9, 0x75, 0x06 }); 156 | 157 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_CREATE_MOVE] == nullptr) { 158 | logger::the("%s: \"ADDRESS_CREATE_MOVE\" was nullptr\n", __FUNCTION__); 159 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 160 | return false; 161 | } 162 | 163 | // #STR: "No local player %d after full frame update\n", "Setting fallback player %s as local player\n", "cdll_client_int.cpp" 164 | // 55 8B EC 8B 0D ? ? ? ? 8B 01 8B 80 ? ? ? ? FF D0 A2 ? ? ? ? 165 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_FRAME_STAGE_NOTIFY] = 166 | pe::util::memory::patterns::getter::the({ 0x55, 0x8B, 0xEC, 0x8B, 0x0D, -1, -1, -1, -1, 0x8B, 0x01, 0x8B, 0x80, -1, -1, -1, -1, 0xFF, 0xD0, 0xA2, -1, -1, -1, -1 }); 167 | 168 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_FRAME_STAGE_NOTIFY] == nullptr) { 169 | logger::the("%s: \"ADDRESS_FRAME_STAGE_NOTIFY\" was nullptr\n", __FUNCTION__); 170 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 171 | return false; 172 | } 173 | 174 | // thanks @soar, i was too lazy to re this 175 | // 55 8B EC 83 EC ? 56 8B F1 8A 46 176 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GET_COLOR_MODULATION] = 177 | pe::util::memory::patterns::getter::the({ 0x55, 0x8B, 0xEC, 0x83, 0xEC, -1, 0x56, 0x8B, 0xF1, 0x8A, 0x46 }); 178 | 179 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_GET_COLOR_MODULATION] == nullptr) { 180 | logger::the("%s: \"ADDRESS_GET_COLOR_MODULATION\" was nullptr\n", __FUNCTION__); 181 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 182 | return false; 183 | } 184 | 185 | // E8 ? ? ? ? 84 C0 8B 45 08 186 | // refer to leak, it has many convars pointing to it which help with easy deduction 187 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_IS_USING_STATIC_PROP_DEBUG_MODES] = 188 | pe::util::memory::patterns::util::relative_to_absolute( 189 | pe::util::memory::patterns::getter::the({ 0xE8, -1, -1, -1, -1, 0x84, 0xC0, 0x8B, 0x45, 0x08 }) + 1); 190 | 191 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_IS_USING_STATIC_PROP_DEBUG_MODES] == nullptr) { 192 | logger::the("%s: \"ADDRESS_IS_USING_STATIC_PROP_DEBUG_MODES\" was nullptr\n", __FUNCTION__); 193 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 194 | return false; 195 | } 196 | 197 | // 55 8B EC 83 EC 08 56 8B F1 8B 86 ? ? ? ? 85 C0 198 | // Warning("SendNetMsg %s: stream[%s] buffer overflow (maxsize = %d)!\n", v14, v15, v16); 199 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_SEND_NET_MSG] = 200 | pe::util::memory::patterns::getter::the({ 0x55, 0x8B, 0xEC, 0x83, 0xEC, 0x08, 0x56, 0x8B, 0xF1, 0x8B, 0x86, -1, -1, -1, -1, 0x85, 0xC0 }); 201 | 202 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_IS_USING_STATIC_PROP_DEBUG_MODES] == nullptr) { 203 | logger::the("%s: \"ADDRESS_IS_USING_STATIC_PROP_DEBUG_MODES\" was nullptr\n", __FUNCTION__); 204 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 205 | return false; 206 | } 207 | 208 | // 55 8B EC 83 EC 40 53 8B D9 8B 0D ? ? ? ? 89 5D F8 209 | // #STR: "CEngineVGui::Paint" 210 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_PAINT] = 211 | pe::util::memory::patterns::getter::the({ 0x55, 0x8B, 0xEC, 0x83, 0xEC, 0x40, 0x53, 0x8B, 0xD9, 0x8B, 0x0D, -1, -1, -1, -1, 0x89, 0x5D, 0xF8 }); 212 | 213 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_PAINT] == nullptr) { 214 | logger::the("%s: \"ADDRESS_PAINT\" was nullptr\n", __FUNCTION__); 215 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 216 | return false; 217 | } 218 | 219 | // 55 8B EC 83 E4 C0 83 EC 38 220 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_PAINT_START_DRAWING] = 221 | pe::util::memory::patterns::getter::the({ 0x55, 0x8B, 0xEC, 0x83, 0xE4, 0xC0, 0x83, 0xEC, 0x38 }); 222 | 223 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_PAINT_START_DRAWING] == nullptr) { 224 | logger::the("%s: \"ADDRESS_PAINT_START_DRAWING\" was nullptr\n", __FUNCTION__); 225 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 226 | return false; 227 | } 228 | 229 | // 8B 0D ? ? ? ? 56 C6 05 230 | pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_PAINT_FINISH_DRAWING] = 231 | pe::util::memory::patterns::getter::the({ 0x8B, 0x0D, -1, -1, -1, -1, 0x56, 0xC6, 0x05 }); 232 | 233 | if (pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_PAINT_FINISH_DRAWING] == nullptr) { 234 | logger::the("%s: \"ADDRESS_PAINT_FINISH_DRAWING\" was nullptr\n", __FUNCTION__); 235 | SINCLAIR_THROW(errors::Errors::PE_UTIL_ADDRESS_WAS_NULL); 236 | return false; 237 | } 238 | 239 | logger::the("%s: Initialized | %d addresses stored in address map\n", __FUNCTION__, pe::util::StaticAddresses::STATIC_ADDRESSES_LIST_SIZE); 240 | return true; 241 | } 242 | } 243 | 244 | // declare detachment 245 | namespace detach { 246 | void the() { 247 | pe::util::memory::byte::patch::detach::the(); 248 | 249 | logger::the("%s: Detached\n", __FUNCTION__); 250 | } 251 | } 252 | 253 | namespace memory { 254 | namespace byte { 255 | namespace patch { 256 | // declare initializer 257 | namespace init { 258 | bool the() { 259 | if (!pe::util::memory::byte::patch::getter::the(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_CMP_FORCE_CROSSHAIR])) { 260 | logger::the("%s: Failed upon byte patching \"ADDRESS_CMP_FORCE_CROSSHAIR\"\n", __FUNCTION__); 261 | SINCLAIR_THROW(errors::Errors::GAME_MEMORY_BYTE_PATCH_FAILED); 262 | return false; 263 | } 264 | 265 | logger::the("%s: Initialized\n", __FUNCTION__); 266 | return true; 267 | } 268 | } 269 | 270 | // declare detachment 271 | namespace detach { 272 | void the() { 273 | if (!pe::util::memory::byte::patch::getter::the(pe::util::prototypes::static_addresses[pe::util::StaticAddresses::ADDRESS_CMP_FORCE_CROSSHAIR])) { 274 | logger::the("%s: Failed restoring \"ADDRESS_CMP_FORCE_CROSSHAIR\" by byte patch\n", __FUNCTION__); 275 | } 276 | 277 | logger::the("%s: Detach\n", __FUNCTION__); 278 | } 279 | } 280 | } 281 | } 282 | namespace patterns { 283 | namespace util { 284 | pe::util::types::byte_ptr relative_to_absolute(pe::util::types::byte_ptr address) { 285 | return (pe::util::types::byte_ptr)(address + 4 + *(int*)address); 286 | } 287 | } 288 | } 289 | } 290 | } 291 | } -------------------------------------------------------------------------------- /sinclairv3/pe/util/util.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../pe.h" 4 | 5 | namespace pe { 6 | namespace util { 7 | enum StaticAddresses { 8 | ADDRESS_GET_CURRENT_GAME_TYPE, 9 | ADDRESS_GAME_OVERAY_RENDERER_HOOKING, 10 | ADDRESS_GAME_OVERAY_RENDERER_UNHOOKING, 11 | ADDRESS_GET_CS_WPN_DATA, 12 | ADDRESS_GET_ENTITY_BOUNDING_BOX, 13 | ADDRESS_ENTITY_IS_DORMANT, 14 | ADDRESS_DRAW_CROSSHAIR, 15 | ADDRESS_CMP_FORCE_CROSSHAIR, 16 | ADDRESS_NET_GRAPH_TEXT_FORMATTER, 17 | ADDRESS_NET_GRAPH_TEXT_MAIN_MENU_RET_ADDR, 18 | ADDRESS_NET_GRAPH_TEXT_GAME_RET_ADDR, 19 | ADDRESS_PUSH_NOTICE, 20 | ADDRESS_CREATE_MOVE, 21 | ADDRESS_FRAME_STAGE_NOTIFY, 22 | ADDRESS_GET_COLOR_MODULATION, 23 | ADDRESS_IS_USING_STATIC_PROP_DEBUG_MODES, 24 | ADDRESS_SEND_NET_MSG, 25 | ADDRESS_PAINT, 26 | ADDRESS_PAINT_START_DRAWING, 27 | ADDRESS_PAINT_FINISH_DRAWING, 28 | 29 | STATIC_ADDRESSES_LIST_SIZE 30 | }; 31 | 32 | namespace init { 33 | bool the(); 34 | } 35 | 36 | namespace detach { 37 | void the(); 38 | } 39 | 40 | namespace types { 41 | typedef int address_type; 42 | typedef uint8_t* byte_ptr; 43 | } 44 | 45 | namespace prototypes { 46 | extern pe::util::types::byte_ptr static_addresses[StaticAddresses::STATIC_ADDRESSES_LIST_SIZE]; 47 | } 48 | 49 | namespace memory { 50 | namespace exports { 51 | namespace getter { 52 | template 53 | inline T the(const pe::types::image_type& image, const char(&name)[N]) { 54 | // Get export 55 | const T o_fn = (T)GetExportAddress(image, name, true); 56 | if (o_fn == nullptr) { 57 | logger::the("%s: \"o_fn\" (%s) was nullptr, returning\n", __FUNCTION__, name); 58 | SINCLAIR_THROW(errors::Errors::PE_UTIL_EXPORTS_RESULT_WAS_NULL); 59 | return nullptr; 60 | } 61 | 62 | logger::the("%s: Found \"o_fn\" (%s) at 0x%X in 0x%X\n", __FUNCTION__, name, o_fn, image); 63 | 64 | // We found the export 65 | return o_fn; 66 | } 67 | } 68 | 69 | namespace types { 70 | typedef void* (*create_interface_t)(const char*, int); 71 | } 72 | } 73 | 74 | namespace byte { 75 | namespace patch { 76 | namespace init { 77 | bool the(); 78 | } 79 | 80 | namespace detach { 81 | void the(); 82 | } 83 | 84 | namespace getter { 85 | // https://www.unknowncheats.me/wiki/C%2B%2B:Patching_single_bytes_in_a_single_process_using_C%2B%2B 86 | template 87 | bool the(pe::util::types::byte_ptr address) { 88 | // Old protection state 89 | DWORD new_protect, old_protect; 90 | 91 | // Remove write protection, if it exists 92 | if (!VirtualProtect(address, bytes, PAGE_EXECUTE_READWRITE, &new_protect)) { 93 | logger::the("%s: Failed removing write protection, throwing\n", __FUNCTION__); 94 | SINCLAIR_THROW(errors::Errors::GAME_MEMORY_BYTE_FAILED_REMOVING_WRITE_PROTECTION); 95 | return false; 96 | } 97 | 98 | // Patch bytes 99 | memset(address, type, bytes); 100 | 101 | // Restore old protection state 102 | if (!VirtualProtect(address, bytes, new_protect, &old_protect)) { 103 | logger::the("%s: Failed restoring write protection, throwing\n", __FUNCTION__); 104 | SINCLAIR_THROW(errors::Errors::GAME_MEMORY_BYTE_FAILED_RESTORING_WRITE_PROTECTION); 105 | return false; 106 | } 107 | 108 | logger::the("%s: Byte patched first %d bytes of \"address\" (0x%X)\n", __FUNCTION__, bytes, address); 109 | 110 | return true; 111 | } 112 | } 113 | } 114 | } 115 | 116 | namespace patterns { 117 | namespace getter { 118 | template 119 | inline pe::util::types::byte_ptr the(const pe::util::types::address_type(&address)[N]) { 120 | // Assert that image is valid 121 | assert(image_map[index]); 122 | 123 | // Get the image as a byte_ptr for future use in comparassion 124 | const pe::util::types::byte_ptr image_as_byteptr = (pe::util::types::byte_ptr)image_map[index]; 125 | 126 | // Get NT header 127 | const PIMAGE_DOS_HEADER dos_header = (PIMAGE_DOS_HEADER)image_map[index]; 128 | const PIMAGE_NT_HEADERS nt_headers = (PIMAGE_NT_HEADERS)(image_map[index] + dos_header->e_lfanew); 129 | 130 | // Get image size 131 | const DWORD image_size = nt_headers->OptionalHeader.SizeOfImage; 132 | 133 | for (DWORD i = 0; i < image_size - N; ++i) { 134 | bool proceed = true; 135 | for (DWORD j = 0; j < N; ++j) { 136 | if (image_as_byteptr[i + j] != address[j] && address[j] != -1) { 137 | proceed = false; 138 | break; 139 | } 140 | } 141 | if (proceed) { 142 | logger::the("%s: Found \"address\" (0x%X) in 0x%X\n", __FUNCTION__, &image_as_byteptr[i], image_map[index]); 143 | // We found the address 144 | return &image_as_byteptr[i]; 145 | } 146 | } 147 | 148 | logger::the("%s: Failed finding \"address\" in 0x%X\n", __FUNCTION__, image_map[index]); 149 | return nullptr; 150 | } 151 | } 152 | 153 | namespace util { 154 | pe::util::types::byte_ptr relative_to_absolute(pe::util::types::byte_ptr address); 155 | } 156 | } 157 | } 158 | } 159 | } -------------------------------------------------------------------------------- /sinclairv3/sinclairv3.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | Win32Proj 24 | {ebd61037-c45f-4c02-bce4-03df760029be} 25 | sinclairv3 26 | 10.0 27 | 28 | 29 | 30 | DynamicLibrary 31 | true 32 | v142 33 | MultiByte 34 | 14.28.29333 35 | 36 | 37 | DynamicLibrary 38 | false 39 | v142 40 | true 41 | MultiByte 42 | 14.28.29333 43 | 44 | 45 | DynamicLibrary 46 | true 47 | v142 48 | Unicode 49 | 50 | 51 | DynamicLibrary 52 | false 53 | v142 54 | true 55 | Unicode 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | true 77 | 78 | 79 | false 80 | 81 | 82 | true 83 | 84 | 85 | false 86 | 87 | 88 | 89 | Level3 90 | true 91 | _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;SINCLAIRV3_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 92 | true 93 | NotUsing 94 | 95 | 96 | stdcpplatest 97 | 98 | true 99 | 100 | 101 | Windows 102 | true 103 | false 104 | 105 | 106 | 107 | 108 | Level3 109 | true 110 | true 111 | true 112 | _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;SINCLAIRV3_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 113 | true 114 | NotUsing 115 | 116 | 117 | stdcpplatest 118 | 119 | true 120 | 121 | 122 | Windows 123 | true 124 | true 125 | true 126 | false 127 | 128 | 129 | 130 | 131 | Level3 132 | true 133 | _DEBUG;SINCLAIRV3_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 134 | true 135 | Use 136 | pch.h 137 | 138 | 139 | Windows 140 | true 141 | false 142 | 143 | 144 | 145 | 146 | Level3 147 | true 148 | true 149 | true 150 | NDEBUG;SINCLAIRV3_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 151 | true 152 | Use 153 | pch.h 154 | 155 | 156 | Windows 157 | true 158 | true 159 | true 160 | false 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | -------------------------------------------------------------------------------- /sinclairv3/sinclairv3.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | Header Files 44 | 45 | 46 | Header Files 47 | 48 | 49 | Header Files 50 | 51 | 52 | Header Files 53 | 54 | 55 | Header Files 56 | 57 | 58 | Header Files 59 | 60 | 61 | Header Files 62 | 63 | 64 | Header Files 65 | 66 | 67 | Header Files 68 | 69 | 70 | Header Files 71 | 72 | 73 | Header Files 74 | 75 | 76 | Header Files 77 | 78 | 79 | Header Files 80 | 81 | 82 | Header Files 83 | 84 | 85 | Header Files 86 | 87 | 88 | Header Files 89 | 90 | 91 | Header Files 92 | 93 | 94 | Header Files 95 | 96 | 97 | Header Files 98 | 99 | 100 | Header Files 101 | 102 | 103 | Header Files 104 | 105 | 106 | Header Files 107 | 108 | 109 | Header Files 110 | 111 | 112 | Header Files 113 | 114 | 115 | Header Files 116 | 117 | 118 | Header Files 119 | 120 | 121 | Header Files 122 | 123 | 124 | Header Files 125 | 126 | 127 | Header Files 128 | 129 | 130 | Header Files 131 | 132 | 133 | Header Files 134 | 135 | 136 | Header Files 137 | 138 | 139 | Header Files 140 | 141 | 142 | Header Files 143 | 144 | 145 | Header Files 146 | 147 | 148 | Header Files 149 | 150 | 151 | Header Files 152 | 153 | 154 | Header Files 155 | 156 | 157 | Header Files 158 | 159 | 160 | 161 | 162 | Source Files 163 | 164 | 165 | Source Files 166 | 167 | 168 | Source Files 169 | 170 | 171 | Source Files 172 | 173 | 174 | Source Files 175 | 176 | 177 | Source Files 178 | 179 | 180 | Source Files 181 | 182 | 183 | Source Files 184 | 185 | 186 | Source Files 187 | 188 | 189 | Source Files 190 | 191 | 192 | Source Files 193 | 194 | 195 | Source Files 196 | 197 | 198 | Source Files 199 | 200 | 201 | Source Files 202 | 203 | 204 | Source Files 205 | 206 | 207 | Source Files 208 | 209 | 210 | Source Files 211 | 212 | 213 | Source Files 214 | 215 | 216 | Source Files 217 | 218 | 219 | Source Files 220 | 221 | 222 | Source Files 223 | 224 | 225 | Source Files 226 | 227 | 228 | Source Files 229 | 230 | 231 | Source Files 232 | 233 | 234 | Source Files 235 | 236 | 237 | Source Files 238 | 239 | 240 | -------------------------------------------------------------------------------- /sinclairv3/sinclairv3.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | true 5 | 6 | -------------------------------------------------------------------------------- /sinclairv3/util/color/color.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace util { 6 | struct color_t { 7 | typedef uint8_t color_type; 8 | 9 | color_type r; 10 | color_type g; 11 | color_type b; 12 | color_type a; 13 | }; 14 | } -------------------------------------------------------------------------------- /sinclairv3/util/util.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../pe/pe.h" 4 | #include "../pe/util/util.h" 5 | 6 | #include "color/color.h" 7 | 8 | namespace util { 9 | namespace vtable { 10 | namespace getter { 11 | template 12 | inline static T the(void* base_class) { 13 | return (T)((*(uintptr_t**)(base_class))[index] + offset); 14 | } 15 | } 16 | 17 | namespace func { 18 | namespace getter { 19 | template 20 | inline static T the(void* base_class, Args... args) { 21 | typedef T(__thiscall* fn)(void*, Args...); 22 | return (*(fn**)(base_class))[index](base_class, args...); 23 | } 24 | 25 | template 26 | inline static T the_cdecl(void* base_class, Args... args) { 27 | typedef T(__cdecl* fn)(void*, Args...); 28 | return (*(fn**)(base_class))[index](base_class, args...); 29 | } 30 | } 31 | } 32 | } 33 | } --------------------------------------------------------------------------------